# How to code the german “ß” in Latex

I've read lots tutorials how to code "ß" in Latex. Unfortunately none of them could help me. Here is my code:

\documentclass[11pt]{amsart}
\usepackage{geometry}
\geometry{letterpaper}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{epstopdf}
\usepackage[encoding]{inputenc}

\begin{document}
daß
\end{document}


For encoding I have tried so far: latin1, latin9, utf8, applemac. All of them crashed with "undefined control sequence". I'm using TeXShop on MacOSX 10.6. TeXShop itself uses utf8 encoding. I've checked that. So, how do I get "ß" WITHOUT typing {\ss}?

-

## migrated from stackoverflow.comAug 28 '13 at 10:16

This question came from our site for professional and enthusiast programmers.

What do you mean by saying without typing {\ss}? –  devnull Aug 28 '13 at 8:00
The problem might be TexShop-specific. Try TextEdit and a .tex file with a header "\documentclass{article} \usepackage[utf8]{inputenc}"; then compile in the terminal by pdflatex. –  ang mo Aug 28 '13 at 9:32
So your question actually is not how to print this specific character "ß", but more on how to correctly set the encoding of your document so that you don't have to encode the special characters with their "entities"... –  nyarlathotep Aug 28 '13 at 9:58
Make sure you save the document with the encoding you wish to use. By default TeXShop offers you "Mac OS Romann" in which case you should use \usepackage[applemac]{inputenc}. However, you could choose to save as "UTF-8" and then pass utf8 as the option to inputenc –  Andrew Swann Aug 28 '13 at 10:29
Just to update, to save with a new encoding, choose "Save As..." and the diaglog there will include an encoding drop down. –  Andrew Swann Aug 28 '13 at 11:13

The encoding in the Line \usepackage[encoding]{inputenc} needs to match the actual encoding of your file. You can tell TexShop to use a specific encoding via a "magic comment", for example % !TeX encoding = utf8. See: TeXShop doesn't remember file encoding.

So, this should do the trick:

% !TeX encoding = utf8
\documentclass[11pt]{amsart}
\usepackage{geometry}
\geometry{letterpaper}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{epstopdf}
\usepackage[utf8]{inputenc}

\begin{document}
daß
\end{document}


However, TexShop does not honour the comment when saving existing files, so you might want to convert your existing files manually. You can convert them with TeXShop's "Save As..."-Dialogue.

-
Adding the encoding line to an existing file will not change its encoding, however, you can use Save As to save the file and choose the correct encoding then. Also, the correct encoding for inputenc is utf8 (not UTF8). It is case-sensitive. –  Alan Munn Aug 28 '13 at 14:24
Thanks for the clarification, Alan. For some reason both utf8 and UTF8 seem to work in my configuration (MicTex with PdfLaTeX on Windows), but I should have checked which one is actually correct. I have updated the answer accordingly. –  Vincent Aug 28 '13 at 15:36
I did exactly what said. First, I set up the encoding line the converted the file via "save as...". But it still does not work. –  MaxPowers Aug 29 '13 at 8:00
Sorry for the late reply, Max. Can you please try the following minimal example: % !TeX encoding = utf8 \documentclass[11pt]{amsart} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenx} \begin{document} daß \end{document} –  Vincent Sep 6 '13 at 21:31
@MaxPowers, Somehow I messed up the line-breaks in the previous comment. They should be there as in the original example. At least the line-break after the % !TeX encoding = utf8 mandatory. –  Vincent Sep 6 '13 at 21:41

Variant 1: Download a latex source file with an ß encoded in utf8 and using \usepackage[utf8]{inputenc}. Run pdflatex on it and check the output. Then open it in TeXShop and try again. Change it in some irrelevant place and try agein. Change the ß and try again. Open a new file, copy all contents and paste them to the new file, save and try again.

Along this route, you'll find the root of the error.

Variant 2: Use xetex or luatex instead of inputenc. You still need to make sure, that the file is indeed utf8 encoded.

-

For German language you should try using these packages (German description in comments, if you need it you'll understand ):

\usepackage[utf8]{inputenc} % UTF-8-Codierung
\usepackage[
english, % Englische Rechtschreibung
ngerman  % neue Deutsche Rechtschreibung (wenn hier auch Überschriften)
]{babel} % Silbentrennung etc.
\usepackage{marvosym} % Sonderzeichen
\DeclareUnicodeCharacter{20AC}{\EUR} % €-Zeichen über [Alt-Gr]-[E] einfügen

-
Welcome to TeX.SX! Can you please add, how "ß" can be input with this settings (directly in encoding UTF-8, or via "s")? –  Heiko Oberdiek Aug 29 '13 at 12:17
I can simply add by typing "s With a German keyboard layout you can also enter it by pressing the ß-Key ;) –  Cerdo Aug 29 '13 at 14:09
Tried it but doesnt work ... –  MaxPowers Sep 1 '13 at 16:50
What does not work? "s` or the key on a German keyboard layout? –  Cerdo Sep 4 '13 at 7:24