4

How do I get german umlauts in a PDF using Arial TT-Font and XeLaTeX or luaLaTeX?

The following example produces a box instead of "ü":

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{fontspec}
\setmainfont{Arial}

\begin{document}
\section{Einführung}
Text.
\end{document}
lockstep
  • 250,273
AlexG
  • 54,894

1 Answers1

5

You should take a look at the output (log) of XeTeX/LuaTeX:

(/opt/texlive2011/texmf-dist/tex/xelatex/xunicode/xunicode.sty
*** you should *not* be loading the inputenc package
*** XeTeX expects the source to be in UTF8 encoding
*** some features of other encodings may conflict, resulting in poor output.

If you follow that advice, the output of your code is correct.

topskip
  • 37,020
  • I saw this before and I also tried without but it didn't help. I have ascii not unicode source files. So there is no chance to get umlauts? – AlexG Jun 13 '12 at 11:41
  • 1
    @AlexG you can still use the \"a commands or if you load babel you can use the shorthand "a for ä. With pure ascii, you couldn't key in any umlaut directly (ascii does not define them). You probably have latin1 or any other 8 bit encoding. You can try the package luainputenc although I strongly, strongly, strongly and strongly advice against it. (But then I actually ask myself why you have the utf8 parameter for the inputenc package. – topskip Jun 13 '12 at 11:45
  • Thanks for clarification. I used latin1 at first, tried utf8 then (which made it into my question), because the former didn't work out neither with xelatex nor with lualatex. Both seem to require utf8 encoded source files (unlike pdflatex for example). Thus luainputenc seems to be the last resort as I don't want to change my OS to using unicode. What is wrong with luainputenc? – AlexG Jun 13 '12 at 12:48
  • 1
    @AlexG luainputenc is really only a last resort. I am not sure if it works in all cases. – topskip Jun 13 '12 at 12:52
  • 1
  • @matth: If I send a utf8 encoded template source file to some person using texniccenter on windows, will further edits in texniccenter (tacitly) keep utf8 encoding? – AlexG Jun 13 '12 at 15:22
  • 2
    Unfortunately, Texniccenter 1 is one of the very few remaining editors that do NOT support UTF8. The upcoming version 2 of TXC will support UTF8. I know some people who use the Alpha 4 productively. In order to make full use of XeLaTeX, you shoud use an editor that supports UTF8. – matth Jun 13 '12 at 15:32
  • I believe that texniccenter does not use UTF-8, so you probably have to use "a for Umlaut encoding or use luainputenc with latin1. – topskip Jun 13 '12 at 15:32
  • I think I am sufficiently briefed now to continue. Thanks @PatrickGundlach and @matth! – AlexG Jun 13 '12 at 15:42
  • @AlexG You might consider answering your own question (and accept it) so that future visitors to the site see the solution that worked for you quickly. – topskip Jun 13 '12 at 16:08