3

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
    Commented May 24, 2016 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)? Commented May 24, 2016 at 14:17

1 Answer 1

3

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .