8

In an automated system that is generating LaTeX to render PostScript and PDF, i need to avoid an ambiguity in LaTeX:

  • Two backticks (``) produce a closing doublequote:
  • A question/exclamation mark followed by a backtick (?`) produces the inverted character: ¿
  • Combined, when trying to display a question mark followed by a quote (,,what?``), LaTeX produces the following output: „what¿‘

What is the best practise to avoid this? The desired output is: „what?“

2
  • 2
    Are you using this for German?
    – egreg
    Feb 7, 2014 at 13:49
  • @egreg yes! does it make a difference?
    – Kaii
    Feb 7, 2014 at 13:58

2 Answers 2

6

You can disable the ligatures using microtype:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\DisableLigatures[?,!]{encoding=T1}

\begin{document}
,,Hier?``

,,Hier!``
\end{document}

enter image description here

Or teach the automated system to use UTF-8 and input the “real” characters:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\begin{document}
„Hier?“

„Hier!“
\end{document}

As cgnieder suggests, there's another possibility:

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

\begin{document}
"`Hier?"'

"`Hier!"'
\end{document}
1
  • 2
    More possibilities: babel shortcuts "` and "' for the quotes or using csquotes :)
    – cgnieder
    Feb 7, 2014 at 14:01
0

I simply used curly braces:

\documentclass{article}
\begin{document}
test?{``}
\end{document}

seems to work ;-)

2
  • Sorry, it doesn't work. Typeset this example with LuaLaTeX (screenshot). Oct 3, 2016 at 9:58
  • @HenriMenke with pdflatex I seem to get the desired ?“ (but perhaps with a larger than desired spacing after the ?)
    – Dai Bowen
    Oct 3, 2016 at 10:07

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.