[OS X TeX] Unwanted blank page

Maarten Sneep maarten.sneep at xs4all.nl
Thu Jan 5 22:48:38 CET 2006


On 5 Jan 2006, at 0:26, Josep M. Font wrote:

> Some years ago I used a different trick which does not force one to  
> modify the source file  every time one wants to include or exclude  
> the exercises. It uses some TeX mechanisms (which of course work  
> with LaTeX), which ask interactively what option you want. Adapting  
> my own code to your situation, I think the following should work:

While the interactive option will work, it will be very tedious when  
finalising your document, correcting the overfull boxes, etc. Since  
it is possible to include (la)tex code on the command line, you can  
use a make file to get the final bits right.

pdflatex \\PassOptionsToPackage{draft}{graphics} \\input yourfile.tex

will run the the file yourfile through pdflatex, but prevent  
inclusion of the graphics, without editing the file itself. This can  
be done in a normal script of a makefile. The speed increase is  
considerable (the same is true for passing draft to hyperref). Ideal  
when you need multiple runs for the cross-references, the first run  
passes much more quickly in this case. The thing is that the commands  
will appear _before_ the \documentclass command, and that limits your  
options to either plain tex commands, or latex kernel commands (i.e.  
not a command defined in a package). However, your definition of a  
boolean fits in those categories:

to typeset with exercises:
pdflatex \\newif\\ifexercises\\exercisestrue \\input yourfile.tex

to typeset without:
pdflatex \\newif\\ifexercises \\input yourfile.tex

You may want to add some code to set a default inside the tex file,  
and you'll need to remove the \typein.
I tried some code to test whether the \if was defined, but that is  
hard. Perhaps try a different approach (note this is untested, and  
unsupported by me):

with exercises:
pdflatex \\def\\IncludeExercisesThisRun{} \\input yourfile.tex

without exercises:
pdflatex yourfile.tex

with the following in the file:

\newif\ifexercises
\ifx\IncludeExercisesThisRun\undefined
\exercisesfalse
\else
\exercisestrue
\fi

and the rest as before. This basically turns the existence of a macro  
into a boolean flag, which you then use to define the flag you're  
really interested in.

HTMH,

Maarten
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the macostex-archives mailing list