2

MWE:

\documentclass[12pt]{article}

%make " quotation marks 
\usepackage[english]{babel}
\usepackage{csquotes}
\MakeOuterQuote{"}

\begin{document}
\texttt{read.table(file, sep = "t")}
\end{document}

The desired output should be obvious from the code above. The output from this is the following:

enter image description here

2
  • The tt font has a backslash where the standard text font has the opening double quote, so that effect is to be expected. – egreg May 24 '16 at 14:15
  • @egreg Thanks for the information. Does the tt font have an opening quote? Or would I have to use ``t'' (two single quotes at the end)? – Clarinetist May 24 '16 at 14:17
2

The character " is made active, to expand to a double opening or closing quote (context depending). However, the typewriter font in OT1 encoding has a backslash where the text fonts have the double opening quote.

Solution:

\documentclass[12pt]{article}
%make " quotation marks
\usepackage[english]{babel}
\usepackage{csquotes}
\MakeOuterQuote{"}

\begingroup\lccode`~=`"
\lowercase{\endgroup
  \DeclareTextFontCommand{\texttt}{\ttfamily\def~{"}}%
}

\begin{document}
\texttt{read.table(file, sep = "t")}
\end{document}

This won't work if you nest quoted text in normal font inside \texttt. It won't work also in the scope of \ttfamily, but it could be arranged for.

enter image description here

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.