3

I'm preparing a Resume using LaTeX, mainly for the purpose of easy customization. In particular, I wish to be able to generate different outputs from the same input file by changing a few parameters.

One such requirement is: specific chunks of text have to be chosen according to one of the input parameters ("dev"/"training"/"generic"). I can have the chunks of text appropriate to each parameter in a separate .tex file ("dev_summary.tex", "training_summary.tex", etc.) and \input them according to the parameter. I've currently implemented this with:

  \newcommand{\whoami}[1]{trainer#1}

and later

 \input{\whoami{_summary.tex}}

Now I just have to change the string "trainer" in the newcommand line whenever I want to change the first parameter. However, is there a better way where I can keep this file unedited and instead pass this change as a commandline argument?

Sundar R
  • 131
  • Also: I just found out about LuaTeX (from http://tex.stackexchange.com/a/18813/44036), which looks like a more programming/customization friendly alternative. Is that so? There are further customizations that I need to do in addition to the above, would LuaTeX be the better option in that case? – Sundar R Mar 25 '14 at 12:36

1 Answers1

2

There are several ways to set such things on the command line. perhaps the simplest is to change your input slighty so that instead of dev_summary.tex you have subdirectories/folders dev, trainer etc and then dev/summary.tex

Then your main file just needs

\input{summary}

and it will input the first summary.tex in your input path so a command line of

TEXINPUTS=dev: pdflatex mainfile

will input dev/summary.tex and

TEXINPUTS=trainer: pdflatex mainfile

will input trainer/summary.tex

(This assuming a unix-like command line, on windows you may have to do the setting of the environment variable a separate command, not sure)

David Carlisle
  • 757,742
  • I'm on Windows, and it looks like there's a slightly more convoluted way of achieving something similar: http://superuser.com/a/223126/3200 So this is certainly one possible option for me (and separating the files in directories does make it a bit more elegant). – Sundar R Mar 25 '14 at 14:03