[Tex/LaTex] Typesetting single quotes

fontspunctuationtypewriter

How can the single quote character be typeset as the ascii character ' in a LaTeX document?

For instance, consider the document:

\documentclass{standalone}

\usepackage[T1]{fontenc}

\begin{document}

\texttt{Note that alpha''' is a valid Haskell identifier.}

\end{document}

The output produced by pdflatex is

single quote in typeset document

Notice how the first two quotes are typeset differently than the third one. The third one is bigger further away from the second.

With other fonts this become more evident. Adding to the preamble:

\usepackage{dejavu}

gives the result

single quotes with dejavu

I want all of them typeset the same way, as the ascii single quote character '.

Any clues?

Best Answer

You can break the ligature just by inserting {} but you may prefer the straight quote from textcomp rather than three right quotes:

enter image description here

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{textcomp}
\begin{document}

\texttt{Note that alpha''' is a valid Haskell identifier.}

\texttt{Note that alpha'{'}' is a valid Haskell identifier.}


\texttt{Note that alpha\textquotesingle\textquotesingle\textquotesingle{}
 is a valid Haskell identifier.}

\end{document}