6

I'm writing a German document and thus I need äÄöÖüÜß to work. However I don't use it this way: "a"A"o... I just type äÄö...
My Problem is that "Test" s is displayed as "Testß

Here is a MWE:

% !TEX encoding=latin1
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc} 

\begin{document}
"Test" s
\end{document}
  • 1
    use utf8 instead of latin1 and it should work IMHO. Or it is a ngerman issue. – sztruks Dec 1 '18 at 18:01
  • 3
    You should never use straight quotes. Use \glqq Term here\grqq if you want quotes in the output or resort to a package like csquotes. – TeXnician Dec 1 '18 at 18:02
  • @sztruks I tried using utf8 in both places. Sadly that didn't change anything – Dr_DragonKiller Dec 1 '18 at 18:05
  • 4
    the use of " is an error you should use left and right quotes – David Carlisle Dec 1 '18 at 18:11
  • 2
    Add a character: "Test" s to "Test"\ s. – user156344 Dec 1 '18 at 19:30
12

The character " should never be used in running text to denote quotes. For double English quotes, use

``Test'' s

If you want German style quotes, use

"`Test"' s

With UTF-8 input, you can use

“Test” s

for English style and

„Test“ s

for German style. The alternative \glqq Test\grqq\ s is less convenient.

Examples:

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc} % not needed with LaTeX after 2018-04-01
\usepackage[ngerman]{babel}

\usepackage{upquote,booktabs} % for the table

\begin{document}

\begin{tabular}{lll}
\toprule
\multicolumn{1}{c}{Style} &
\multicolumn{1}{c}{Input} &
\multicolumn{1}{c}{Output} \\
\midrule
English & \verb|``Test'' s| & ``Test'' s
\\
English & \verb|“Test” s| & “Test” s
\\
German & \verb|"`Test"' s| & "`Test"' s
\\
German & \verb|„Test“ s| & „Test“ s
\\
German & \verb|\glqq Test\grqq\ s| & \glqq Test\grqq\ s
\\
\bottomrule
\end{tabular}

\end{document}

enter image description here

  • +1: Didn't know `"``. Congratulations to 700k btw. – Dr. Manuel Kuehner Dec 1 '18 at 21:09
  • @Dr.ManuelKuehner Table 1 in texdoc babel-ngerman. Thanks! – egreg Dec 1 '18 at 21:10
  • 1
    @JanusBahsJacquet Typo, sorry. – egreg Dec 2 '18 at 8:11
5

Solution 3: use left and right quotes in the source too, as David Carlisle auggested:

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc} 

\begin{document}
“Test”s, and “test” s too (but I’d use “test”~s, then).
\end{document}

This is the output I get:

Output of the code

  • 1
    +1: Good point: But I cannot find them on my German keyboard (as direct keys). – Dr. Manuel Kuehner Dec 1 '18 at 20:09
  • 2
    @Dr.ManuelKuehner: I have a Mac with an “international English” keyboard, so I can type them rather easily. I couldn’t stand using LaTeX with a different keyboard! :-) – GuM Dec 1 '18 at 20:15
  • 2
    @GuM My advice is: buy whatever keyboard you prefer, so long as it is International English. – egreg Dec 1 '18 at 20:42
  • 1
    @egreg Never have heard of international English keyboards :) – Dr. Manuel Kuehner Dec 1 '18 at 20:54
3

If you want to use latin1 (which is ISO 8859-1), then I have collected two solutions which are already mentioned in the comments.

The problem is, that in some cases* "A, "O, "U, "a, "o, "u, "s are commands for special characters (instead of \"A, \"O or \ss{} for example). So LaTeX cannot know what you mean in your example.

*Depending on the loaded packages, in this case, the babel package.

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc} 

\usepackage{csquotes}

\begin{document}

\section*{They are all the same regarding the ß}

\begin{itemize}
\item "Test" s
\item " s
\item "s
\item But: "\ s % Thanks to comment of user Dũng Vũ
\end{itemize}

\section*{Solution 1: Use \texttt{babel}'s quotation marks}
% See also https://www.namsu.de/Extra/befehle/Anfuehrungszeichen.html
% https://de.wikibooks.org/wiki/LaTeX-W%C3%B6rterbuch:_Anf%C3%BChrungszeichen
% \glqq --> German Left Double Quote
% \grqq --> German Right Double Quote
% \glq --> German Left Single Quote
% \grq --> German Right Single Quote

\begin{itemize}
\item \glqq Test\grqq\ s (Don't forget the \textbackslash\ after the command)
\item \glq Test\grq\ s
\end{itemize}

\section*{Solution 2: Use the \texttt{csquote} package}
% For more information, have a look at the manual
% https://ctan.org/pkg/csquotes

\enquote{Test} s

\end{document}

enter image description here

Note: On the screenshot, you see on the bottom right that I use the correct encoding in the editor, in this case ISO-8859-1 which is latin1.

  • @dũng-vũ I mentioned you in the "solution". – Dr. Manuel Kuehner Dec 1 '18 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.