How can I display foreign language characters in LaTex as they are?
July 14, 2010 2:38 PM   Subscribe

How can I make LaTex more foreign language friendly?

I have been using LaTex for nearly everything: lab reports, resumes etc. I recently was writing a relative's resume in LaTex (it looks spiffy!) but it needs to be in Turkish. My brain exploded when I had to spend two hours converting all ö's to \"{o} and İ's to \.{I}. There must be an easier way to do this, but the internets are not helping. How can I make LaTex recognize special characters without typing the LaTex equivalent?

Thanks.
posted by kuju to Computers & Internet (12 answers total) 1 user marked this as a favorite
 
One thought is that you could use a search-and-replace feature in a text editor if that would make it take less than two hours to do the replacement.
posted by XMLicious at 2:41 PM on July 14, 2010


Response by poster: That did occur to me but only after I finished typing everything. Sadness. It would also be a little bit annoying to do that for pages and pages.
It might be my best option the next time. I just was wondering if there is another solution.
posted by kuju at 2:48 PM on July 14, 2010


Have you taken a look at XeTeX? I've mainly played around with it to get the ligatures, etc from OpenType fonts, but I think its main design was for using Unicode text in LaTeX. You can see from the screenshots that they include Arabic, Amharic, and Devanagari as is in a LaTeX document.
posted by Fortran at 2:53 PM on July 14, 2010


Seconding XeTeX.
posted by zsazsa at 2:57 PM on July 14, 2010


Using XeTeX and XeLaTeX as Fortran suggested is indeed what I'd do. The font definition stuff changes a bit (read up on fontspec) but otherwise it's the same.

If you're married to pdflatex or in a hurry, you can simply \usepackage[utf8x]{inputenc} and save your document as utf-8.
posted by stereo at 2:59 PM on July 14, 2010


Add "\usepackage[utf8]{inputenc}" to your preamble, save the tex file in UTF-8 encoding (which is an option in the save dialog in TeXShop on OS X; check your docs on other editors/platforms), and then just type the åççént§ and compile as normal.

If doing this works for you then that's probably the fastest way for a single document. The more robust/flexible/future proof way is to familiarize yourself with XeTeX.
posted by caek at 3:03 PM on July 14, 2010


Response by poster: XeTeX it is! Wasn't into TeXShop anyways.
posted by kuju at 3:12 PM on July 14, 2010


TeXShop is just an editing environment; it works with either pdfTeX or XeTeX on the backend.
posted by zsazsa at 3:45 PM on July 14, 2010


Yep, XeTeX. But so you and others know, you can type \"o without braces.
posted by domnit at 4:13 PM on July 14, 2010


You can also add a package for foreign language support. caek's suggestion works for linux. Windows I believe is "\usepackage[latin]{inputenc}". I don't know about mac.
posted by furisto at 11:36 PM on July 14, 2010


The inputenc solution certainly works on OS X and Linux. It's the generic TeX solution short of migrating to XeTeX. It is not OS dependent insofar as your operating system supports the encoding you want to use. I don't see any reason why utf8 it wouldn't work on a modern version of Windows.

But using the latin encoding as furisto suggests will not solve the OPs problem. It would be the solution if they were writing in a language that uses the Roman alphabet + Western European diacritics (English, French, etc. -- i.e. latin characters). The OP is writing in Turkish which includes characters not in the latin encoding, so either needs to use a Turkish encoding or utf8. If Windows makes this imposible then change OS. For all its prehistoric code, I'd be surprised if that was the case though.
posted by caek at 3:54 AM on July 15, 2010


Like caek says, the problem you are facing is solved by inputenc, either with utf8 or some other encoding appropriate for Turkish. Remember to also load the Turkish language definition for babel (and switch languages appropriately) to get correct behavior in things like hyphenation.
posted by Dr Dracator at 5:39 AM on July 15, 2010


« Older What to do with all these web apps?   |   Car rental and camping near chicago. Newer »
This thread is closed to new comments.