84

I did my document in an ISO-standard. It does not support umlaut alphabets, such as ä and ö. I need them. The document gets compiled without UTF8, but not with UTF8. More precisely, the document does not get compiled with the line at the beginning of my main.tex:

\usepackage[utf8]{inputenc}

How can I compile my LaTeX document in UTF8?

Ned Batchelder
  • 364,293
  • 75
  • 561
  • 662
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697

7 Answers7

111

I'm not sure whether I got your problem but maybe it helps if you store the source using a UTF-8 encoding.

I'm also using \usepackage[utf8]{inputenc} in my LaTeX sources and by storing the files as UTF-8 files everything works just peachy.

Uwe Honekamp
  • 2,478
  • 1
  • 17
  • 15
  • Can you give a command to change the settings of the files to UTF-8? How can I even see my current settings? – Léo Léopold Hertz 준영 Aug 10 '09 at 04:08
  • 2
    This depends on your editor, it should be able to store files in UTF-8. Please check the applicable preference settings. On my Mac, provides me with a combo box that lets me settle the encoding in the file dialog. – Uwe Honekamp Aug 10 '09 at 04:20
21

Save your file in UTF8 format.

Verify the file format using the following (UNIX) command:

file -bi filename.tex 

You should see:

text/x-tex; charset=utf-8

Convert the file using iconv if it is not UTF8:

iconv --from-code=ISO-8859-1 --to-code=UTF-8 filename.txt > filename-utf.txt
Dave Jarvis
  • 30,436
  • 41
  • 178
  • 315
Mark Elliot
  • 75,278
  • 22
  • 140
  • 160
16

\usepackage[utf8]{inputenc} will not work for a bibliographic entry such as this:

@ARTICLE{Hardy2007,
author = {Ibn Taymiyyah, Aḥmad ibn ʿAbd al{-}Halīm},
title = {Naqḍ al{-}manṭiq},
shorttitle = {Naqḍ al-manṭiq},
editor = {Ḥamzah, Aḥmad},
publisher = {Maktabat a{l-}Sunnah},
address = {Cairo},
year = {1970},
sortname = {IbnTaymiyyaNaqdalmantiq},
keywords = { Logic, Medieval}} 

For this entry use \usepackage[utf8x]{inputenc}

D W
  • 2,979
  • 4
  • 34
  • 45
  • This solves problems with characters from other languages (e.g. Chinese, Japanese, Korean, Vietnamese), as shown in your example. More reading: http://tex.stackexchange.com/questions/13067/utf8x-vs-utf8-inputenc – caw Dec 02 '14 at 01:55
  • I came across this answer by mistake and it solved me a long-standing problem with em-dash and accented letters in the PDF's sidebar table of contents. – Oskar Limka May 07 '19 at 21:38
6

Convert your document to utf8. LaTeX just reads your text as it is. If you want to use the utf8 input encoding, your document has to be encoded in utf8. This can usually be set by the editor. There is also the program iconv that is useful for converting files from iso encodings to utf.

In the end, you'll have to use an editor that is capable of supporting utf. (I have no idea about the status of utf support on windows, but any reasonable editor on linux should be fine).

jowi
  • 161
  • 2
0

I have success with using the Chrome addon "Sharelatex". This online editor has great compability with most latex files, but it somewhat lacks configuration possibilities. www.sharelatex.com

Christian Hayter
  • 30,581
  • 6
  • 72
  • 99
0

You needed to iconv your source.

That said, the TEX-based compiler invoked by latex doesn't really support variable-length encodings; it needs big libraries that tell it that certain bytes go together. Xelatex is Unicode-aware and works much better.

Tobu
  • 24,771
  • 4
  • 91
  • 98
0

I use LEd Editor with special "Filter" feature. It replaces \"{o} with ö and vice versa in its own editor, while maintaining original \"{o} in tex files. This makes text easily readable when viewed in LEd Editor and there is no need for special packages. It works with bibliography files too.

Adnan
  • 9
  • 1