12

I am using LuaLaTeX on a Mac and I want to have my PDF in Calibri font. I have issues with Umlauts.

\documentclass{minimal} 
\usepackage{fontspec}
\setmainfont{Calibri}

\begin{document}
äöüß
\end{document}

This is the error message that I receive:

String contains an invalid utf-8 sequence.

If I escape the Umlauts, it works. However, his is very annoying and there should be an easier way to do it.

\"a \"o \"u \s{}

What package do I need to include to get Umlauts working without having to escape them?

3
  • Welcome to TeX.SX! Are you sure your file is saved as UTF-8 encoded? What editor are you using?
    – egreg
    Commented Sep 10, 2013 at 17:52
  • No, I am not sure whether its UTF-8. I am using the TexShop editor. I already tried to include \usepackage{luatextra} \usepackage[utf8]{luainputenc} with no luck.
    – jaspb
    Commented Sep 10, 2013 at 17:58
  • Add the line "% !TEX encoding = UTF-8 Unicode" (everything between the quotes, but not the quotes) at the start of the file, save and retry. Then go at the “Source” tab in the Preferences and make sure “Unicode (UTF-8)” is selected from the drop down menu below “Encoding”.
    – egreg
    Commented Sep 10, 2013 at 18:01

1 Answer 1

7

By default, TeXShop encodes its document with the old Latin-1 encoding. Richard Koch has received requests to change the default into UTF-8, but always denied.

So, make sure you have this in the Preferences; I'm referring to the drop-down menu under ”Encoding”.

enter image description here

Your first document can be converted on the fly by adding the magic line

% !TEX encoding = UTF-8 Unicode

at the start of the file and saving. Be sure to convert in this way all documents you already have, before changing the Preferences.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .