GeneralLaTeX document in different languages

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Moreno71
Posts: 2
Joined: Fri May 01, 2009 6:19 pm

LaTeX document in different languages

Post by Moreno71 »

I wonder if there's a way to keep a single LaTeX document in different languages in such a way that the output document could be generated in the desired language, instead of keeping several documents in parallel.
Any ideas?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

PGScooter
Posts: 31
Joined: Mon Jul 14, 2008 2:47 pm

LaTeX document in different languages

Post by PGScooter »

Hi Moreno71,

I remember seeing a similar thread a few months ago. I'm not sure what the best solution was, but I will give my proposal again:

Say you want to have English and Spanish, then make a new command:

Code: Select all

\newcommand{\mylanguage}[2]{#1}
and where you want to have two versions, do this:

Code: Select all

\mylanguage{This is my text in English}{y esto la version en espanol}
as is, this code will produce the English version. To produce the Spanish version, you just have to replace the #1 with a #2.

Note that I was not able to test this code, I hope it's right.
Moreno71
Posts: 2
Joined: Fri May 01, 2009 6:19 pm

LaTeX document in different languages

Post by Moreno71 »

Perhaps you were referring to this thread: http://www.latex-community.org/forum/vi ... 039&p=7944?
If so, it seems that they didn't find a proper solution.

Anyway, your idea looks like a simple and clever solution. I'll give it a try.

Thanks a lot.
PGScooter
Posts: 31
Joined: Mon Jul 14, 2008 2:47 pm

Re: LaTeX document in different languages

Post by PGScooter »

great, please post back with your comments or if you find a way that you like better. I would be interested in hearing about the particular problems that come up. This must be a somewhat common endeavor. I am guessing that if there is no dedicated module, then perhaps it really is just a simple solution. I guess you'll have to let us know.
Post Reply