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

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

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