LaTeX forum ⇒ GeneralBilingual documents Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
User avatar
Stefan Kottwitz
Site Admin
Posts: 8527
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Bilingual documents

Postby Stefan Kottwitz » Wed Aug 23, 2017 10:39 pm

Both ways (\if conditional, comment package) have one source document, and generate a single PDF document as output, depending on the value chosen, English or Greek. So you need to runs, one with each setting.

Stefan
Site admin

Tags:

Tolaso
Posts: 31
Joined: Tue Dec 20, 2016 12:23 am

Postby Tolaso » Wed Aug 23, 2017 10:40 pm

Stefan Kottwitz wrote:Here is a solution, in a nearly 10 years old thread of LaTeX.org. ;-)

viewtopic.php?f=5&t=5286&start=0


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:

  1. #!/bin/bash
  2. cd ~/TeXs/Temp # This is the directory where the file is.
  3. pdflatex -jobname=script-fr -interaction=nonstopmode "\newif\iffr\newif\ifen\frtrue \input{temp}"
  4. pdflatex -jobname=script-en -interaction=nonstopmode "\newif\iffr\newif\ifen\entrue \input{temp}"


Definitely not very elegant, but it works. I put it here, in case somebody else needs it.


Quick question. Where does this script is supposed to be placed?

User avatar
Stefan Kottwitz
Site Admin
Posts: 8527
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Wed Aug 23, 2017 10:43 pm

This script can be placed anywhere. It's a shell script for Linux or Mac or Unix.

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
Site admin

Tolaso
Posts: 31
Joined: Tue Dec 20, 2016 12:23 am

Postby Tolaso » Wed Aug 23, 2017 10:45 pm

Thank you!! I'll give it a try and share my results if it worked or not?

User avatar
Stefan Kottwitz
Site Admin
Posts: 8527
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Wed Aug 23, 2017 11:04 pm

Sure, let us know!

Stefan
Site admin

User avatar
thomasb
Posts: 76
Joined: Thu Aug 03, 2017 10:54 am
Location: france

Postby thomasb » Thu Aug 24, 2017 1:00 am

This works on Windows :
  • the minimalBilingual.tex
    1. \documentclass{article}
    2. \usepackage[T1]{fontenc}
    3. \usepackage[utf8]{inputenc}
    4. \usepackage[french,english]{babel}
    5. \newcommand{\langfr}[1]{%
    6. \iffr\selectlanguage{french}#1\fi}
    7. \newcommand{\langen}[1]{%
    8. \ifen\selectlanguage{english}#1\fi}
    9. \begin{document}
    10. \section{%
    11. \langfr{Bonjour!}
    12. \langen{Hello!}}
    13. \langfr{Ce texte est en français.\\
    14. Règles typographiques françaises \textit{devraient} s'appliquer.}
    15. \langen{This is text in English.\\
    16. English typographic rules \textit{should} apply.}
    17. \end{document}
  • the batchBilingual.bat
    1. pdflatex -jobname=script-fr -interaction=nonstopmode "\newif\iffr\newif\ifen\frtrue \input{minimalBilingual}"
    2. pdflatex -jobname=script-en -interaction=nonstopmode "\newif\iffr\newif\ifen\entrue \input{minimalBilingual}"
    (a .bat file to be double clicked)

Tolaso
Posts: 31
Joined: Tue Dec 20, 2016 12:23 am

Postby Tolaso » Thu Aug 24, 2017 7:35 am

Well I went for the solution with the .bat file. Everything works perfectly .. !! Unless, I have to rewrite the document in the translated form. :cry: This will take some time.

Thanks guys!

Matt Phillips
Posts: 1
Joined: Fri Sep 01, 2017 11:16 am

Postby Matt Phillips » Fri Sep 01, 2017 11:17 am

Thanks for the clarification! Gonna try it your way.
It's true, I never get tired of this games. Last time I won some money. It was pretty easy to win at casinointheuk. Dude, it's possible to win every day.


Return to “General”

Who is online

Users browsing this forum: No registered users and 12 guests