Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\usepackage[utf8]{inputenc}

or

\usepackage[latin1]{inputenc}

I write in german if that matters.

pro and contra?

share|improve this question
5  
It should be noted (and this is a bit of a rant …) that UTF-8 support has been de-facto standard in editors for at least five years, much more in most cases (since it’s been around since 1993). The only important editor that to this day doesn’t support it is, alas, TeXnicCenter. For shame. –  Konrad Rudolph Aug 17 '10 at 12:08
    
This is no longer true, of course; modern versions of TeXnicCenter do support Unicode. –  Ingmar Mar 26 '13 at 10:16
add comment

7 Answers 7

up vote 10 down vote accepted

If you can: don't use \usepackage[utf8]{inputenc} nor \usepackage[latin1]{inputenc}. Use LuaTeX:

\documentclass{article}
\usepackage{luaotfload}
\usepackage[EU2]{fontenc}
\usepackage{lmodern}
\begin{document}
Das Mädchen ging über die \textbf{Brücke} nach \textit{draußen}.
\end{document}

This will give you access to all modern things (OpenType fonts for example) while keeping most of the backward compatibility.

Wait for TeXlive 2010 (or get the pretest) and you have a decent environment for LuaTeX. Million thanks to the few people who make the LuaLaTeX packages!

If you are able to read german: see the site http://www.luatex.de for more examples (especially on fontspec).

share|improve this answer
4  
Can you use microtype in luatex? I understand that is the last big advatange pdflatex has over others (eg xelatex) –  thrope Aug 16 '10 at 10:40
    
I am not sure what the status of the microtype package is. But in theory it should work, as LuaTeX is based on pdftex and has the font expansion etc. built in. I know that margin kerning works (using myself) but I don't know about the interfaces for LuaLaTeX. –  topskip Aug 16 '10 at 12:14
1  
I´m using TexmakerX (supports utf8) and yesterday MikTex 2.9 beta was released which now features Luatex. –  gkane Aug 27 '10 at 19:18
    
I would refrain from using Luatex in many contexts (for example, paper submission in source format). Of course, for your personal use, do what you want. –  Jean-Christophe Dubacq Jul 13 '12 at 18:55
    
@Jean-ChristopheDubacq Why? Will the computer explode? Or will the PDF be invalid? Please elaborate. –  topskip Jul 13 '12 at 18:59
show 1 more comment

Short answer: If your editor can use Unicode (and in my opinion any good editor should save files as UTF-8 by default), then use Unicode.

The main advantage of Unicode (and its main encoding UTF-8) is that it makes text files universally readable: Someone writing German umlauts can use the same encoding as someone writing Korean. Prior to that, when obtaining a a text file, there was no way to know which character encoding to apply to it: Latin 1? or Latin 9? or maybe a Russian encoding?

Also for documents that use more than 256 different characters, UTF-8 is very useful. With it you can for example use both "ü" and "ł" in the same text (as I do here).

Both modern (experimental) TeX compilers (LuaTeX and XeTeX) use Unicode/UTF-8 by default as do modern programming languages (i.e. .NET) and operating systems.

share|improve this answer
    
T1 is 8-bit so that means at most 256 chars are allocated. If you use utf8 to input chars beyond the 256 chars, how can that be useful with pdftex. It seems xetex or luatex is required in this case. Am I right? –  Leo Liu Aug 16 '10 at 9:57
    
I still don't really understand TeX's font system. Something like pastebin.com/fEVaicCN compiles fine, more "exotic" (from a US/Western European standpoint) characters don't. –  Caramdir Aug 16 '10 at 10:10
    
Maybe you are confounding the input character set and output character set. What matters here is the input character set. With latin1 or cp1252 or others, 256 chars is the maximum (less in latin1). However, TeX is intelligent enough to use several output encodings (at least, one for math symbols and one for text), and so can display much more than 256 different symbols. T1 is just one of the output encodings used by TeX. –  Jean-Christophe Dubacq Jul 13 '12 at 18:54
add comment

I'm of the idea that, whenever possible, you should stick to utf8 (unicode) as it is finally the solution about character encodings on computer documents. Of course you only have to make sure that your text editor supports and behaves nicely with unicode documents.

In either case, if you have to work with collaborators, you have to make sure that they do also use decent text editors that can handle the appropriate encoding without messing with the special characters. For documents with many collaborators I've learned the hard way that it is better to stick to ascii and use (La)TeX commands to produce special characters.

share|improve this answer
add comment

One of the advantages of using utf8 for source files is it is friendly towards version control tools. For example, if you have the source in latin-1, then most of latin-1 chars will show up as \267, \320 etc. when diffing.

share|improve this answer
add comment

In short:

  • utf8 supports much more characters than latin1.
  • utf8 is multilingual and cross-platform spread, latin1 is mainly used on Windows.

Unicode, which is supported by utf8, is international standard and it shall support all languages and shall handle all kinds of writing. utf8 is the widest spread encoding for Unicode and it is backwards-compatible with ASCII (in contrary to other Unicode encodings). In utf8, each character is represented by 1 to 4 bytes. That's why the number of possible symbols is really huge. latin1 uses just one byte, beeing limited to a maximum of 256 characters. I think it uses just 191 of 256 possible.

So, utf8 might be already be favourable if you use just one platform.

utf8 is the standard encoding on Linux and Mac OS X. The number of LaTeX editors supporting utf8 on Windows increased, for instance TeXworks uses it by default.

If there's a possibility that anybody, including you, would open your document on a Mac or on Linux, I recommend to use utf8. This already concerns german umlauts.

share|improve this answer
add comment

The background...

Pure ascii is a 7-bit encoding that is only good for english, the german characters is missing.

Latin1 is a 8-bit (1 byte) character encoding that used to be the standard encoding in Germany some 5-10 years ago. And it does support the special german characters. If you have a look at the latin1 page over at wikipedia you quickly realised that it was a little bit messy but it did work.

So to solve this in a nicer way, utf8 was created and since it is using 1-4 bytes to store one character. More or less all special characters from all different countries inclusive the Asian ones can be saved in the same character encoding.

And since all modern OS (Windows, Linux and MacOS) use utf8, you are probably using it right now without even knowing it.

share|improve this answer
add comment

I would also suggest using utf8, but you should definitely check whether all the editors you are going to use (if working with many platforms) actually support it. Although it is 2010, this may still pose a problem. Shame on some developers.

In my personal opinion, using the package ngerman and encoding umlauts via " (i.e. ä = "a) may work better in the long run. It takes a few days to adjust to writing like this, but then your TeX files are ASCII files. With ASCII files, you will never run into any problems.

[I realize that this is not the most modern approach. I myself am quite happy with using utf8 and the venerable vim editor. Your mileage may vary...]

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.