19

It sounds simple but I have a really heavy issue with the "ö ü ä ß" in Latex. I use a template from my university, i have a mac and i use TeXShop if that matters.

Within there is a packages.tex with the following (...)

\usepackage[T1]{fontenc}            % Standard package for selecting font encodings
\usepackage{lmodern}                    % alternative Computer Modern-fonts for computer screens
\usepackage{textcomp}                   % LaTeX support for the Text Companion fonts
(...)

Also I have a thesis.tex with

(...)
\usepackage[utf8]{inputenc}     % Accept different input encodings
\usepackage{ifthen}                     % Conditional commands in LaTeX documents
(...)

Now I tried to use

\usepackage[ngerman]{babel}

as well as

\usepackage[applemac]{inputenc}

but unfortunately it doesn't work. The best case was another error "hyphenation flashed" or something.

\documentclass[
    fontsize=12pt,
    a4paper,
    portrait,                               
    oneside,                                    
    openright,                              
    final,                                          
    titlepage,                                  
    onecolumn,                                  
    bibliography=totoc,
    numbers=noenddot                    
]{scrbook}
\usepackage[T1]{fontenc}        
\usepackage{lmodern}    
\usepackage[utf8]{inputenc}     
\usepackage{ifthen}         
\begin{document}
öä
\end{document}

Now I replaced

\usepackage[utf8]{inputenc}     

with

\usepackage[applemac]{inputenc}

in the minimal working example above and it worked BUT in the other document it still doesn't work :( There it gives me the error (see picture)

error

editor

21
  • 10
    Leave utf8 and don't touch it!
    – Johannes_B
    Jul 29, 2015 at 20:25
  • 4
    which encoding DO your files have? you should be able to see that in a reasonably functionable editor
    – Bort
    Jul 29, 2015 at 20:35
  • 4
    @Dean don't randomly change packages, the code in your question runs without error. Copy it back from the website and save as a new file making sure that the file is saved in UTF-8 encoding. the pdflatex should run without error, Jul 29, 2015 at 20:40
  • 1
    @SeanAllred he meant leave the document as specifying utf-8 and don't change it:-) Jul 29, 2015 at 20:41
  • 2
    @Dean Please don't ask multiple unrelated questions in one question and always paste code and error messages as text not as an image, You have sone characters defined as text but used in math but without any real example hard to say what. Jul 29, 2015 at 20:44

4 Answers 4

26

Based on this LaTeX website, there are following solutions for your problem.

According the subsection "indirekte Eingabe von Umlauten" you can write \"A, \"O, \"U, \"a, \"o, \"u and \ss{} or {\"A}, {\"O}, {\"U}, {\"a}, {\"o}, {\"u} and {\ss} to get german letters.

If you include the german or ngmerman (ngerman has the new hyphentation rules), you can write "A, "O, "U, "a, "o, "u, "s to get the letters.

This is very usefull, if you need to write one or two german letters. But it's not too funny to write a german essay with that notation.

The subsection "direkte Verwendung der Umlaute" gives another solution (for Mac). Just put following lines in your preamble:

\usepackage[applemac]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

OR

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

If you know which encoding your editor uses, you can just use that instead. I think that Texmaker is a good cross-plattform editor.

I've tried to make an example, so you can see how it should work. If this example doesn't work, try to write applemac instead of utf8. That should end your problem.

\documentclass[a4paper]{article}

%German language
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

%Unimportant
\usepackage[top=2cm,right=2cm,bottom=2cm,left=2cm]{geometry}
\thispagestyle{empty}
\usepackage{verse}


\begin{document}
\null
\vfill
\null

\poemtitle{Die polyglotte Katze}
\settowidth{\versewidth}{in das die Maus vor kurzem kroch,}
\begin{verse}[\versewidth]
Die polyglotte Katze\\
Die Katze sitzt vorm Mauseloch,\\
in das die Maus vor kurzem kroch,\\
und denkt:'Da wart nicht lang ich,\\
die Maus, die fang ich!'\\!


Die Maus jedoch spricht in dem Bau:\\
'Ich bin zwar klein, doch bin ich schlau!\\
Ich rühr mich nicht von hinnen,\\
ich bleibe drinnen!'\\!


Da plötzlich hört sie - statt'miau' -\\
ein laut vernehmliches'wau-wau'\\
und lacht:'Die arme Katze,\\
der Hund, der hatse!\\
Jetzt muß sie aber schleunigst flitzen,\\
anstatt vor meinem Loch zu sitzen!'\\!


Doch leider - nun, man ahnt’s bereits -\\
war das ein Irrtum ihrerseits,\\
denn als die Maus vors Loch hintritt -\\
es war nur ein ganz kleiner Schritt -\\
wird sie durch Katzenpfotenkraft\\
hinweggerafft! - - -\\!


Danach wäscht sich die Katz die Pfote\\
und spricht mit der ihr eignen Note:\\
'Wie nützlich ist es dann und wann,\\
wenn man ’ne fremde Sprache kann ...!'\\
\end{verse}
\bigskip
\centering {\footnotesize \itshape Heinz Erhardt (1909--1979)}\footnote{Höret dieses Gedicht über Kätzchen, welches nie auf den Straßen in Straßburg gehör fand.}

\bigskip


\null
\vfill
\null
\end{document}

Here an image of how it looks

German letters.

NB! As a "Notfallplan" you can use sharelatex or overleaf (free online editors) untill you have fixed your problem.

1
  • 2
    The files were saved in an encoding by the first author, and as it states in the file thight have been utf-8. There is no use in setting the inputencoding to different values, make the editor match the encoding. If not, it will become an issue when adding new files. Please see texwelt.de/wissen/fragen/2656/… (assuming you know german).
    – Johannes_B
    Jul 29, 2015 at 21:44
4

First option with pure LaTeX:

enter image description here

\documentclass[
    fontsize=12pt,
    a4paper,
    portrait,                               
    oneside,                                    
    openright,                              
    final,                                          
    titlepage,                                  
    onecolumn,                                  
    bibliography=totoc,
    numbers=noenddot                    
]{scrbook}
\usepackage{lmodern}    
\usepackage{ifthen}         
\begin{document}

Try \"o, \"a, \"B, \"A, \"u, \"U, ...

\end{document}

This is sure tedious, but try now this second option:

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} 
\begin{document}

Häuser

ü ö ä Ä Ü Ö ß

\end{document}

enter image description here

I used \usepackage [utf8]{inputenc} on Windows.

12
  • 8
    no one should be using [applemac] this century, especially if they are not on a mac. If the \"o syntax is used the input is ASCII so you do not need inputenc at all. Jul 29, 2015 at 20:37
  • 1
    Have you written a text in german like that? it's tedious
    – Bort
    Jul 29, 2015 at 20:37
  • Thank you trying to help me but this is no alternative cause i have like thousand of öäüß's
    – Dean
    Jul 29, 2015 at 20:43
  • 3
    @AboAmmar No! almost every line of that page is really bad advice. Jul 29, 2015 at 20:53
  • 3
    @Sverre lshort is a big general introduction (and old) so yes can be out dated in parts but this is a specific page on German accents and suggests {\"A} (outer braces kill any kerning), (n)german package (rather than babel/polyglossia), using platform specific (and in 2/3 cases non standard) encodings rather than utf8. That's quite a high proportion of outdated advice in a rather short page. Jul 30, 2015 at 9:03
1

I don't know if it was mentioned before but you might try LuaLaTex or XeLaTeX which have genuine support for UTF8, means you can write äöüß how you want and all other characters too and don't have to worry about it normally. They have other advantages, too, like embedding other fonts easily etc.

Just ensure you save the TEX files in UTF8 encoding.

0

Instead of \usepackage[whatever]{inputenc}, try to use

\usepackage{selinput}
\SelectInputMappings{adieresis={ä},germandbls={ß},Euro={€},} 

in the preamble of your document.

4
  • What is the advantage over just using utf8 encoding?
    – Daniel
    Oct 28, 2015 at 23:05
  • If the whole document is encoded in utf8 (and you are aware of that), than there's no advantage of using selinput-package. But the problem described sounds very much like there are parts that have different encodings. I had similar issues when copying excerpts from another file not encoded in utf8. Selinput can manage these different encodings, inputenc is determined on the encoding you define (utf8). Read package description for further information: link
    – Nico
    Oct 30, 2015 at 9:21
  • Hm... IMHO, combining different encodings or being not aware of the actual encoding sound like asking for a lot of later trouble.
    – Daniel
    Oct 30, 2015 at 12:41
  • You should probably make explicit, that one must not simply copy&paste your code, but actually enter the second line (or at least the umlauts) in the file. Reason: If you copy&paste from any half-recent browser, the encoding will most probably be UTF8. As an extra complication on OS X, this will in most cases even be UTF8-NFD (decomposed form), which "looks right" on screen and in the editor, but makes pdflatex choke. All the glory details to be find here
    – Daniel
    Oct 30, 2015 at 12:52

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