7

I am using Latex code auto-generated by Maple, which uses lots of \it and \rm in math mode. standard book class does not complain, but scrbook complains.

What should one replace \it with to make it happy? I found one question which helped me fix the \rm in math mode. But do not know what to do with \it. Here is MWE

\documentclass[12pt]{scrbook}% 
\usepackage[T1]{fontenc}

 %from questions/57109/what-exactly-does-declareoldfontcommand-and-declarerobustcommand-do
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}

\begin{document}
$\rm e^t  + \it p1$   %what about \it?
\end{document}

I need something like the above trick for rm but for \it. I know nothing about fonts and font families and did not find example to use.

The above is just a MWE. But if you like to see the full Maple Latex code, here is a bigger example. Auto-generated.

\[
\left[ \begin {array}{c} {\frac {\rm d}{{\rm d}t}}{\it p1} \left( t
 \right) \\ \noalign{\medskip}{\frac {\rm d}{{\rm d}t}}{\it p2}
 \left( t \right) \\ \noalign{\medskip}{\frac {\rm d}{{\rm d}t}}{\it 
p3} \left( t \right) \end {array} \right] = \left[ \begin {array}{c} 0
\\ \noalign{\medskip}-{\it q3} \left( t \right) \\ \noalign{\medskip}{
\it q2} \left( t \right) \end {array} \right]
\]
  • 2
    Perhaps \DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}?? – Steven B. Segletes Jun 8 '16 at 2:02
  • See also Is there any reason not to use \let to redefine a deprecated control sequence to the currently recommended one? Ulrike's answer to that posting explains that the KOMA-script document classes are set to generate warning messages when rm, \it, etc are encountered. However, it's still OK to provide instructions such as \DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit} in the preamble. – Mico Jun 8 '16 at 2:51
  • 1
    Erm, i would simply ask LaTeX for help by typing h in an interactive session and learn how to get the old commands enabled without any trouble. It is soooo easy: enabledeprecatedfontcommands – Johannes_B Jun 8 '16 at 5:35
  • 1
    @Mico I just done so. – Johannes_B Jun 8 '16 at 5:49
  • 1
    By the way, I see no justification for {\it p1} that should better be p_1. Anyway, I'm inclined to think that 20 years is long enough to become aware of deprecated commands. Not to mention that \left( t \right) is ridiculous. So, since the code should be improved to begin with, I see no issue with replacing \it. – egreg Jun 8 '16 at 5:59
7

As you may know, old-style font commands like \rm and \it are deprecated in LaTeX. The answer at Does it matter if I use \textit or \it, \bfseries or \bf, etc explains some of the pitfalls of the old-font commands. The more modern approach uses the notions of font family, series, and shape as three orthogonal vectors of a font's definition.

Examples of font families include roman, sans-serif, and teletype. On the other hand, examples of font shape include upright, italic, slanted, and small-caps. Examples of font series include bold, medium, and light.

Thus, in the answer cited by the OP, there is already the answer to this question listed in that question. The line:

\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}

While I have no prior experience with these commands, it seems likely that it is a way of telling LaTeX to replace \it with \normalfont\itshape in text mode and to associate it with \mathit in math mode.

Thus, the addition to your MWE would be:

\documentclass[12pt]{scrbook}% 
\usepackage[T1]{fontenc}

 %from questions/57109/what-exactly-does-declareoldfontcommand-and-declarerobustcommand-do
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}

\begin{document}
$\rm e^t  + \it p1$   %what about \it?

\[
\left[ \begin {array}{c} {\frac {\rm d}{{\rm d}t}}{\it p1} \left( t
 \right) \\ \noalign{\medskip}{\frac {\rm d}{{\rm d}t}}{\it p2}
 \left( t \right) \\ \noalign{\medskip}{\frac {\rm d}{{\rm d}t}}{\it 
p3} \left( t \right) \end {array} \right] = \left[ \begin {array}{c} 0
\\ \noalign{\medskip}-{\it q3} \left( t \right) \\ \noalign{\medskip}{
\it q2} \left( t \right) \end {array} \right]
\]
\end{document}

More can be learned at https://en.wikibooks.org/wiki/LaTeX/Fonts to see what all the different possibilities for family, series, and shape are typically supported by a font.

enter image description here

9

Use the option the KOMA-bundle provides to get the old font commands back. The option was considered deprecated when implemented, hence you are still getting a warning for using it (once).

\documentclass[enabledeprecatedfontcommands]{scrartcl}
\usepackage{tex4ht}
\begin{document}
\it Wombat
\bf Capybara
\end{document}

It should be mentioned though, that the font commands are deprecated for two decades now.

4

This is merely a suggestion for a different input. bmatrix instead of array, no \left, \right, a macro for the differential d.

enter image description here

\documentclass[12pt]{scrbook}% 
\usepackage[T1]{fontenc}
\usepackage{amsmath}

\newcommand\diff{\mathop{}\!\mathrm{d}}

\begin{document}
$\mathrm{e}^t  + p_1$

\[
\renewcommand*{\arraystretch}{1.5}
\begin{bmatrix}
  \frac{\diff}{\diff t}{p_1} (t) \\ 
  \frac{\diff}{\diff t}{p_2} (t) \\
  \frac{\diff}{\diff t}{p_3} (t)  
\end{bmatrix}
=
\begin{bmatrix}
  0  \\ 
 -q_3 (t) \\ 
  q_2 (t)
\end{bmatrix}
\]
\end{document}
  • I realize that since Maple generates the code for you, this is perhaps not so helpful for you, though others might find it useful. I can delete if you feel it only contributes noise. – Torbjørn T. Jun 8 '16 at 6:56
2

All \rm are to be changed to \mathrm, for example {\rm d} should be \textrm{d} (observe the different position of {...}) and all \it's removed, because they are \mathit in math mode and \mathit is a presumption in this mode for letters.

  • 1
    Would that be \textrm or \mathrm? – Steven B. Segletes Jun 8 '16 at 2:05
  • @StevenB.Segletes At least here \mathrm in the meaning of the operator of differentiation. – Kola B. Jun 8 '16 at 2:08

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.