General ⇒ Bilingual documents
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
Bilingual documents
Stefan
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Bilingual documents
Stefan Kottwitz wrote:Here is a solution, in a nearly 10 years old thread of LaTeX.org.
http://latex.org/forum/viewtopic.php?f=5&t=5286&start=0
Quick question. Where does this script is supposed to be placed?Keta wrote: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/bashcd ~/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}"
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
Bilingual documents
On a Windows PC, it could be a batch file or a cmd file or a powershell script. It only matters that it calls LaTeX two times, once with each option.
Stefan
Bilingual documents
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
Bilingual documents
- the minimalBilingual.tex
Code: Select all
Code, edit and compile here:\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 batchBilingual.bat
(a .bat file to be double clicked)
Code: Select all
pdflatex -jobname=script-fr -interaction=nonstopmode "\newif\iffr\newif\ifen\frtrue \input{minimalBilingual}"pdflatex -jobname=script-en -interaction=nonstopmode "\newif\iffr\newif\ifen\entrue \input{minimalBilingual}"
Bilingual documents

Thanks guys!
-
- Posts: 1
- Joined: Fri Sep 01, 2017 11:16 am