GeneralBuilding multiple / alternate versions of a document

General information and discussion about TeXnicCenter
Post Reply
danep
Posts: 3
Joined: Fri Jan 23, 2009 1:27 am

Building multiple / alternate versions of a document

Post by danep »

Hi all

I am interested in producing two different PDF versions of my resume, which I keep in Latex. One version is for web publication and thus should have some info (contact details, GPAs, etc) redacted, while the other version should be pretty much complete. Right now I use a variable (call it "forweb") and conditionals to keep sensitive portions omitted when building for the web. I have to build once with the "forweb" variable set, rename the PDF file produced, and then build again with "forweb" unset. Is there a way to automate this process? In other words, is there a way to produce both versions of the document automatically and simultaneously?

I'm very new to Latex, so go easy on me :D Thanks for the help.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Building multiple / alternate versions of a document

Post by kaiserkarl13 »

You might try writing a shell script that automatically runs LaTeX twice (once with and once without a particular file included). For example:

Code: Select all

#! /bin/sh
## Shell script

pdflatex twoversions.tex

grep -v auxtext twoversions.tex | pdflatex --jobname version2 /dev/stdin

Code: Select all

%% LaTeX input file
\documentclass{article}
\begin{document}
Regular text, section 1.
\input{auxtext-1}
Regular text, section 2.
\input{auxtext-2}
\end{document}
Now simply move everything that you want hidden from the first section into auxtext-1.tex, everything you want hidden from section 2 in auxtext-2.tex, and never use
"auxtext" anywhere else in the file and it should work.

I wrote and tested the above in UNIX. You may be able to write a DOS batch file that does largely the same thing, only you'd have to rewrite it without the grep statement. It may be much harder to do this without grep, awk, etc....
Post Reply