7

Problem:

Inline text gets curled quote marks and I would like to format these automatically to be straight ones instead.

Minimal Working Example (MWE):

\documentclass{article}
\usepackage{xcolor}

\definecolor{light-gray}{gray}{0.95}
\newcommand{\code}[1]{\colorbox{light-gray}{\texttt{#1}}}

\begin{document}

The function \code{date('Y-m-d')} allows you to...

\end{document}

Outputs:

enter image description here

Desired output:

Instead of curled single quotes, they should be straight ones like '.

1 Answer 1

11

enter image description here

One option is to use the \textquotesingle from the textcomp package as this:

\documentclass{article}
\usepackage{xcolor}
\usepackage{textcomp}
\definecolor{light-gray}{gray}{0.95}
\newcommand{\code}[1]{\colorbox{light-gray}{\texttt{#1}}}

\begin{document}

The function \code{date(\textquotesingle Y-m-d\textquotesingle)} allows you to...

\end{document}

You must log in to answer this question.

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