On 08/10/2013 03:47 PM, Steve Litt wrote:
Hi all,
I need your help. Could you please point me to the best web resources
I'd need in order to understand LaTeX's "if" statement? What I need is
something with examples, so that even though I know absolutely nothing
about it now, the data from the resource will be crystal clear, as
opposed to man pages, whose ambiguous English combine with their lack
of examples to make them suitable only as a memory jogger for those who
already know.
I need to format a book a very different way depending on whether it's
printed on paper (no need for personalization in the footer), or as a
PDF file (must be personalized in the footer). Obviously I don't want
two separate source files.
You can define a conditional of your own thus:
\newif\onpaper
You set it true or false thus:
\onpapertrue
\onpaperfalse
You test it thus:
\ifonpaper
% do the things you want to do then
\else
% do something different
\fi
In this case you would have to set the variable manually each time, but
it doesn't sound as if you have much choice in this case. But there are
lots of other sorts of conditionals in LaTeX, if you want to try to do
it automatically. You can easily test if a command is defined, for
example, and sometimes that will give you all you need.
Feel free to ask more questions.
Richard