 |
|
 |
|
01-23-04 10:35 PM
Hello everybody
I am a beginner to make.
For my work with LaTeX I need a few targets to achive
the following:
My "source" file mysource.tex has various forms like
either \documentclass[pdf,nocolor]..
or \documentclass[ps,nocolor]..
or ...
depending on the target, say "make pdf", latex should
run on the first version of the tex file, the second
line will be commented out (or cut out).
Similarly "make ps".
Can make do this? How?
Arun
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: [make] can make do this? |
 |
 |
|
|
01-23-04 10:35 PM
Arun Dev <nospam@pleaz.xy> wrote:quote:
> Hello everybody
>
> I am a beginner to make.
>
> For my work with LaTeX I need a few targets to achive
> the following:
>
> My "source" file mysource.tex has various forms like
> either \documentclass[pdf,nocolor]..
> or \documentclass[ps,nocolor]..
> or ...
>
> depending on the target, say "make pdf", latex should
> run on the first version of the tex file, the second
> line will be commented out (or cut out).
>
> Similarly "make ps".
>
> Can make do this? How?
make cannot do this magically, but you can have to PHONY rules:
.PHONY: ps pdf
ps:
sed -e 's/documentclass\[p.*,nocolor]/documentclass\[ps,nocolor]/'
latex mysource.tex
pdf:
sed -e 's/documentclass\[p.*,nocolor]/documentclass\[pdf,nocolor]/'
latex mysource.tex
Note, that this is by no means a complete makefile, but just a pointer
in the direction you're heading to.
--
Z (Zoran.Cutura@daimlerchrysler.com)
"LISP is worth learning for the profound enlightenment experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days." -- Eric S. Raymond
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: [make] can make do this? |
 |
 |
|
|
01-23-04 10:35 PM
Hi Zoran
Thanks for quick reply!
Zoran Cutura wrote:quote:
>
> make cannot do this magically, but you can have to PHONY rules:
>
> .PHONY: ps pdf
>
> ps:
> sed -e 's/documentclass\[p.*,nocolor]/documentclass\[ps,nocolor]/'
> latex mysource.tex
>
> pdf:
> sed -e 's/documentclass\[p.*,nocolor]/documentclass\[pdf,nocolor]/'
> latex mysource.tex
>
>
> Note, that this is by no means a complete makefile, but just a pointer
> in the direction you're heading to.
I guess, the idea is clear to me.
Unfortunately the example I've given misled you to
assume this is the _only_ difference between the
two versions of the tex-file.
It is not so. There are other blocks of TeX-source within
the document, which have to be added or removed according
to the target.
IMHO, either something like a preprocessor directive
to the C-compiler (-d name=val) or some if-then somewhere
is necessary.
Hope the question is clear ;)
Arun
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: [make] can make do this? |
 |
 |
|
|
01-23-04 10:35 PM
Arun Dev <nospam@pleaz.xy> wrote:quote:
> Hi Zoran
>
> Thanks for quick reply!
>
> Zoran Cutura wrote:
...[QUOTE]
>
> I guess, the idea is clear to me.
>
> Unfortunately the example I've given misled you to
> assume this is the _only_ difference between the
> two versions of the tex-file.
>
> It is not so. There are other blocks of TeX-source within
> the document, which have to be added or removed according
> to the target.
>
> IMHO, either something like a preprocessor directive
> to the C-compiler (-d name=val) or some if-then somewhere
> is necessary.
>
> Hope the question is clear ;)
Well, that isn't what you asked in your first posting, and it is hardly
solved with make only. What I've shown so far is how to write your
rules in the makefile such that you can differ between the two ways of
processing your source. But you've not asked how to process your source
until now.
For preprocessing text-files you may want to try the m4-preprocessor
instead of the simple sed-command I presented in my previous reply.
I don't konw which changes actually need to be done, so I cannot present
you with a concrete sollution.
--
Z (Zoran.Cutura@daimlerchrysler.com)
"LISP is worth learning for the profound enlightenment experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days." -- Eric S. Raymond
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: [make] can make do this? |
 |
 |
|
|
01-23-04 10:35 PM
Greetings.
In article <4003e6c9$1_2@news.tiscalinet.ch>, Arun Dev wrote:quote:
> For my work with LaTeX I need a few targets to achive
> the following:
>
> My "source" file mysource.tex has various forms like
> either \documentclass[pdf,nocolor]..
> or \documentclass[ps,nocolor]..
> or ...
Wouldn't it simply be easier to use conditionals within the LaTeX file
itself to determine which arguments are used depending on whether it's
being processed by latex or pdflatex? This way user intervention is not
required to switch output modes.
For example, you could put the following at the top of the file:
\newif\ifpdf
\ifx\pdfoutput\undefined
\documentclass[ps,nocolor]{article}
\usepackage{graphicx}
\pdffalse
\else
\pdfoutput=1
\pdfcompresslevel=9
\documentclass[pdf,nocolor]{article}
\usepackage[pdftex]{graphicx}
\pdftrue
\fi
Later on in the document when you need to chose between Postscript- and
PDF-specific code you can use the folowing:
\ifpdf
I am running pdflatex! Hooray!
\else
I am not running pdflatex! Hooray!
\fi
Regards,
Tristan
--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <> In a haiku, so it's hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
 |
Re: [make] can make do this? |
 |
 |
|
|
01-23-04 10:35 PM
Hello Zoran
Zoran Cutura wrote:quote:
>
> Well, that isn't what you asked in your first posting, and it is hardly
> solved with make only. What I've shown so far is how to write your
> rules in the makefile such that you can differ between the two ways of
> processing your source. But you've not asked how to process your source
> until now.
Sorry, if I haven't formulated my problem clearly.
I'm myself "searching in the dark".
quote:
> For preprocessing text-files you may want to try the m4-preprocessor
> instead of the simple sed-command I presented in my previous reply.
>
> I don't konw which changes actually need to be done, so I cannot present
> you with a concrete sollution.
It is not necessary. You have been helpful already.
In fact, I've found a LaTeX Macro which does this.
It works fine. Still I would like to understand
how it works. I will try the line presented by
the other poster Tristan Miller in this thread.
Thanks for taking your time.
Arun.
[ Post a follow-up to this message ]
|
|
|
 |
|
 |
|
 |
|
|
|
Sponsored Links |
 |
 |
|
|
 |
All times are GMT. The time now is 01:26 PM. |
 |
|
|
 |
|
 |
|
|
 |
|
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
|
|
|
|
Medical and Health forum | Computer Games Reviews | Graphics design forum
|
 |
|
 |
|