?SPAM? - Re: [texhax] choice of documentstyle upon \jobname

Philip TAYLOR P.Taylor at Rhul.Ac.Uk
Thu Dec 1 13:15:18 CET 2005



Reinhard Kotucha wrote:

> A very simple solution is this:
> 
> Remove the \documentclass stuff completely from the file.  Assume this
> file is called paper.tex.
> 
> Then prepare other files:
> 
> paper-first.tex:
> _________________________________
> \documentclass[first]{...}
> \input{paper}
> _________________________________
> 
> paper-second.tex:
> _________________________________
> \documentclass[second]{...}
> \input{paper}
> _________________________________
> 
> paper-printversion.tex:
> _________________________________
> \documentclass[third]{...}
> \usepackage[monochrome]{color}
> \input{paper}
> _________________________________
> 
> The main advantage of this approach is that it is easy to understand,
> even in a few years.  And it's clean LaTeX.

There's even an approach which /does/ allow \jobname to be
used without the need to get into catcodes and the difference
between an expandable token (\jobname) and a macro (\thisname).

Let the projects live in a directory "P".  Create sub-directories
of "P" called <whatever>, one for each possible value of \jobname.
Create one-line include files, one in each sub-directory,
called (e.g.,) "DocClass.tex".  Each should contain a single
line of the form

	\documentclass [<options>]{<class>}

where <options> and <class> are as required for that specific
value of \jobname.

Each main file in "P" will then start with the line

	\input \jobname/DocClass

and each will therefore \input as the very first record

	\documentclass [<options>]{<class>}

where both <options> and <class> are a function of the jobname.

Clear as mud ?! :-)
** Phil.



More information about the texhax mailing list