# Avoid inverted exclamation and question marks, when followed by quotes

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 (,,wtf?), LaTeX produces the following output: „wtf¿‘

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

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

You can disable the ligatures using microtype:

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

\begin{document}
,,Hier?

,,Hier!
\end{document}


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}

-
More possibilities: babel shortcuts "  and "' for the quotes or using csquotes :) –  cgnieder Feb 7 at 14:01
The UTF-8 solution appeals to me, because we already force all latex code to utf-8 input encoding.. But the LaTeX is an intermediate result from LyX->LaTeX conversion, so i have no power here. But disabling the ligatures seems neat, i will inject this into the documents head. thx! –  Kaii Feb 7 at 14:03