
我正在使用由 Maple 自動生成的 Latex 程式碼,它在數學模式下使用了大量的\it
和 。\rm
標準書班不是抱怨,而是scrbook
抱怨。
應該用什麼\it
來取代它才能讓它快樂呢?我發現一個問題這幫助我修復了\rm
數學模式。但又不知道該怎麼辦\it
。這裡是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}
我需要類似上面的技巧 for rm
but for \it
。我對字體和字體系列一無所知,也沒有找到可以使用的範例。
上面只是一個MWE。但如果您想查看完整的 Maple Latex 程式碼,這裡有一個更大的範例。自動產生。
\[
\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]
\]
答案1
如您所知,舊式字體命令如\rm
和\it
如您所知, LaTeX 中已棄用 。答案在我使用 \textit 或 \it、\bfseries 或 \bf 等有關係嗎解釋了舊字體命令的一些缺陷。更現代的方法使用字體系列、系列和形狀的概念作為字體定義的三個正交向量。
字體系列的範例包括羅馬字體、無襯線字體和電傳打字機。另一方面,字體形狀的範例包括直立、斜體、傾斜和小型大寫字母。字體系列的範例包括粗體、中等字體和淺色字體。
因此,在OP引用的答案中,已經在該問題中列出了該問題的答案。該行:
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
雖然我之前沒有使用這些命令的經驗,但它似乎是告訴 LaTeX 在文字模式下替換\it
為並在數學模式下\normalfont\itshape
將其關聯的一種方式。\mathit
因此,您的 MWE 的附加內容將是:
\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}
更多資訊可以在https://en.wikibooks.org/wiki/LaTeX/Fonts查看字體通常支援的系列、系列和形狀的所有不同可能性。
答案2
使用 KOMA 捆綁包提供的選項來恢復舊的字體命令。該選項在實施時被視為已棄用,因此您仍然會收到使用它的警告(一次)。
\documentclass[enabledeprecatedfontcommands]{scrartcl}
\usepackage{tex4ht}
\begin{document}
\it Wombat
\bf Capybara
\end{document}
但應該要提到的是,字體指令已經被棄用了二十年。
答案3
這只是不同輸入的建議。bmatrix
而不是array
, no \left
, \right
, 微分 d 的宏。
\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}
答案4
所有\rm
都將更改為\mathrm
,例如{\rm d}
應該是\textrm{d}
(觀察 的不同位置{...}
)並且所有\it
都被刪除,因為它們處於\mathit
數學模式並且\mathit
是該模式下字母的假設。