16

I am new to latex.

I get the following error:

Undefined control sequence. man1 = Person(\textquotesingle{}M\textquotesingle {}, 1, {[}2, 1... ...gle{}M\textquotesingle{}, 1, {[}2, 1{]})}

And the line in question is:

\texttt{man1 = Person(\textquotesingle{}M\textquotesingle{}, 1, {[}2, 1{]})}
0
19

Update Jan. 2021: It has come to my attention that starting with the 2020/02/02 version of the LaTex2e format, it is no longer necessary to load the textcomp package in order to use the instruction \textquotesingle. For more information about the changes brought about by the 2020/02/02 version of LaTeX, see https://www.latex-project.org/news/latex2e-news/ltnews31.pdf.


(The answer I posted back in September 2014 follows. I suppose it is now mainly (purely?!) of historical relevance.)

You may have forgotten to load the textcomp package, which defines the macro \textquotesingle. With the package loaded, your code doesn't throw an error.

By the way, the curly braces after each \textquotesingle and around the square brackets aren't needed. I'd omit them, to reduce code clutter.

enter image description here

\documentclass{article}
\usepackage{textcomp}
\begin{document}
\texttt{man1 = Person(\textquotesingle M\textquotesingle, 1, [2, 1])}
\end{document}
4
  • Does anyone know how to install this on RHEL? There is no texlive-latex-extra package. Apr 23 '19 at 1:06
  • With the passage of time, \textquotesingle (and half a dozen other quote commands) work without needing any packages. I guess they have been added to the kernel.
    – Cicada
    Dec 23 '19 at 3:16
  • @Cicada - Are you sure about this claim? If I try to compile \documentclass{article} \begin{document} \textquotesingle \end{document} -- note that the textcomp package is not loaded -- on my system (MacTeX2019, all add-ins up to date), I get an "Undefined control sequence" message about \textquotesingle.
    – Mico
    Dec 23 '19 at 3:46
  • @Mico, quite right; the different engines give different results. Testing shows pdflatex generates the error still; it's OK in xelatex and lualatex. (Sometimes I forget people still do non-unicode or otherwise have to use pdflatex as their default engine: apologies.)
    – Cicada
    Dec 23 '19 at 6:02

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.