Hi all,
I'm doing my CV in three languages. The idea is to have a single tex file with all info, each language properly separated by a command, e.g \fr{info in French}\en{info in English}. Then, a shell script would process the file three times, each time with the proper \frtrue command or so. I hope I'm clear enough.
Is this possible? How could I pass the \frtrue from command line? If there's a better approach for this job, please tell me how to do it. Thanks!
Keta
General ⇒ Multiple documents from one source
NEW: TikZ book now 40% off at Amazon.com for a short time.
Multiple documents from one source
OK, here's a first try, looks like it works correctly. Sorry if the French part is incorrect, I just used a web translator (sorry BTW if the English text is incorrect in first place
).
This should typeset the English text. Changing \entrue with \frtrue would show the French part.
The idea is to have from \documentclass... downwards in a tex file, and the previous commands would be introduced by the shell script. How can this be done?

Code: Select all
\newif\iffr
\newif\ifen
\entrue
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french,english]{babel}
\newcommand{\langfr}[1]{%
\iffr\selectlanguage{french}#1\fi}
\newcommand{\langen}[1]{%
\ifen\selectlanguage{english}#1\fi}
\begin{document}
\section{%
\langfr{Bonjour!}
\langen{Hello!}}
\langfr{Ce texte est en français.\\
Règles typographiques françaises \textit{devraient} s'appliquer.}
\langen{This is text in English.\\
English typographic rules \textit{should} apply.}
\end{document}
The idea is to have from \documentclass... downwards in a tex file, and the previous commands would be introduced by the shell script. How can this be done?
Multiple documents from one source
I finally found a solution. By trial and error, I managed to find that commands can be passed between quotes. So for the previous example, calling the tex file temp.tex, the following script would create the 2 pdf:
Definitely not very elegant, but it works. I put it here, in case somebody else needs it.
Code: Select all
#!/bin/bash
cd ~/TeXs/Temp # This is the directory where the file is.
pdflatex -jobname=script-fr -interaction=nonstopmode "\newif\iffr\newif\ifen\frtrue \input{temp}"
pdflatex -jobname=script-en -interaction=nonstopmode "\newif\iffr\newif\ifen\entrue \input{temp}"