0

I am using custom class and when I use ${\rm test}$ I get complaint that it is Undefined control sequence. It does not in text mode either. I tried searching through the cls file and other relevant linked files for \rm but I can never find where it would be removed, actaully, it is used in the class as:

\newcommand\@makecopyrightpage{
   \ColumnSave
   \pagenumbering{roman}
   \setcounter{page}{2}
   %\thispagestyle{empty} 
   \thispagestyle{plain}
   \null
   \vfill
   \if@copyright
      \begin{center}
         %\normalsize \rm Copyright \copyright\ \@copyrightyear
         %\ifx\@copyrightyear\@degreeyear\else , \@degreeyear \fi
         %\ by \@author \\
         %\@copyrightinfo
         \normalsize \normalfont \copyright\  \@copyrightyear  \hspace{1pt}
         \@author \\
      \end{center}
   \fi
   \vfill
   \ColumnRestore
}

the only other places that \rm can be found in the class:

\def\ps@headings{\def\@oddfoot{}\def\@evenfoot{}%     No feet.
\def\@oddhead{\hbox {}\slshape \rightmark \hfil \rm\thepage}% Heading.
\def\chaptermark##1{\markright {\uppercase{\ifnum \c@secnumdepth >\m@ne
  \@chapapp\ \thechapter. \ \fi ##1}}}}

% Definition of 'myheadings' page style.
%
\def\ps@myheadings{\def\@oddhead{\hbox{}\slshape\rightmark \hfil \rm\thepage}%
\def\@oddfoot{}\def\@evenhead{\rm \thepage\hfil\slshape\leftmark\hbox {}}%
\def\@evenfoot{}\def\sectionmark##1{}\def\subsectionmark##1{}}

When i switch to \documentclass{report} everything works. How can i investigate where it got lost?

16
  • 6
    \rm has been deprecated and not defined by default in latex since latex2e was released in 1993. report class defines it for compatibility with documents written in the 1980s but other classes may not. Mar 3 '20 at 20:35
  • 3
    The \rm command has been deprecated for 25 years. Some document classes define it for back compatibility. There are classes and packages around that use \rm and siblings: it's a sure sign that they should be avoided.
    – egreg
    Mar 3 '20 at 20:36
  • 2
    yes that would work but not using \rm would be better. Mar 3 '20 at 20:37
  • 2
    \mathrm{zzz} in math mode but none of the uses you show in your question are in math. Mar 3 '20 at 20:40
  • 2
    @Mico er no, not unless you have a very old 1980s copy of Lamport. Lamport's book is still the official documentation for 2e. Mar 3 '20 at 20:42
5

The syntax for roman in math in LaTeX is $\mathrm{test}$ not ${\rm test}$.

\rm has not been defined in LaTeX since LaTeX2e was released in 1993.

As described in clsguide the guide to writing latex classes that comes with latex, you could define \rm via

\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}

and the report class does this, however that was over compatibility concerns with documents written in the 1980s. No documents written this century should be using \rm so for a class being written now it is better not to define \rm and assume that the document has correct markup. That way bad markup in the document is easily found and corrected.

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.