
.tex
同僚からファイルを受け取りましたが、その\rm
ファイルには数式モードのコマンドがいくつか含まれています。私たちはどちらも Windows を使用していますが、同僚は WinEdt を使用し、私は TeXmaker を使用しています。同僚のコンピューターではこのファイルはエラーなしでコンパイルされますが、私のノートブックでは\rm
未定義のコマンドであるというエラー メッセージが表示されます。何が起こっているのでしょうか。
どうもありがとうございます。
答え1
\rm
は、LaTeX 形式では定義されていません。一部のクラスでは、LaTeX 2.09 (つまり、1993 年以前に作成されたドキュメント) との互換性のために定義されています。Koma クラスでは以前は警告付きで定義されていましたが、最近のリリースでは定義されていないため、使用するとエラーが発生します。
20 年間の廃止を経て、scrartcl
著者がもはや必要ないと考えるのも無理はないでしょう。
ファイルを書き込むために使用するエディタ (winedt、texmaker など) は、これにまったく関係ありません。
答え2
使用するエディタは関係ありません。重要なのは、どのバージョンのエディタscrartcl
を使用するかです。最近まで(2016年6月)、KOMAスクリプトのドキュメントクラスはscrartcl
、、、scrreprt
およびscrbook
、ちょっとは、非推奨のフォント切り替え命令\rm
、\bf
、\it
などを許容し、これらの命令に遭遇した場合は大量の警告メッセージを発行していました。しかし、2016 年 6 月に、KOMA-Script クラスでのこれらの命令のサポートは完全に終了しました。
もしあなたが本当に、絶対に、絶対にしなければならないuse\rm
およびその他の非推奨のフォント切り替え命令を使用する場合は、次のコード (以下から直接引用article.cls
) をプリアンブルに追加できます。
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
と\sl
は\sc
テキストモードでのみ機能しますが、ない数式モードでは、この投稿この件に関する詳しい情報。
完全な MWE:
\documentclass{scrartcl}
% The following code is from the file `article.cls`
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
\begin{document}
$a$ $\it a$ $\rm a$ $\bf a$ $\sf a$ $\tt a$
\end{document}