Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers 2

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}
share|improve this answer
    
There probably shouldn't be a space between alpha and \textquotesingle –  Aaron McDaid Feb 7 '13 at 11:55
    
@AaronMcDaid thanks. I updated the answer. –  David Carlisle Feb 7 '13 at 12:11
add comment

Use \lstinline from the listings package. An option can make it substitute ' with \textquotesingle from the textcomp package:

\documentclass{article}
\usepackage{listings}
\usepackage{textcomp}
\lstset{upquote=true}

\begin{document}
\texttt{Note that \lstinline@alpha'''@ is a valid Haskell identifier.}
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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