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]
\]
Nasser
  • 20,220

4 Answers4

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.

Johannes_B
  • 24,235
  • 10
  • 93
  • 248
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

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}
Torbjørn T.
  • 206,688
  • 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 08 '16 at 06: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.

Kola B.
  • 690