General ⇒ Multiple documents from one source
Multiple documents from one source
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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
Multiple documents from one source

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
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}"