\newtheorem をカスタマイズする方法

\newtheorem をカスタマイズする方法

\newtheorem コマンドで作成された環境で斜体のテキスト形式を削除する方法があるかどうか知りたいです。

これが私のコードです:

\newtheorem{teorema}{Teorema}[subsection]

\begin{document}

\begin{teorema}
    This is a new theorem.
\end{teorema}

結果は次のとおりです。

ここに画像の説明を入力してください

問題は、テキストを斜体にしたくないということです。どうすればそれが実現できるでしょうか?

答え1

を使用するとかなり簡単ですamsthm

\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{teorema}{Teorema}[subsection]

定理をサブセクションごとに番号付けすることは、いくつかの理由からお勧めできません。まず、サブセクションの使用を強制されますが、これは必ずしも必要ではありません。次に、クラスに章がある場合は、定理が数字。

斜体の方が文を見つけやすく視覚的な手がかりとなるため、直立型の使用もお勧めできません。

答え2

\newtheoremの動作方法と、 で定義された環境にパッチを適用できる方法は、\newtheoremドキュメントクラスと使用中のパッケージによって異なります。

article-class を使用し、パッケージを使用しない場合は、次の操作を実行できます。

\documentclass{article}

\newtheorem{teorema}{Teorema}[subsection]
\makeatletter
\@ifdefinable\Oldteorema{\let\Oldteorema=\teorema}%
\renewcommand\teorema{\@ifnextchar[{\teoremaopt}{\Oldteorema\normalfont}}%
\newcommand\teoremaopt[1][]{\Oldteorema[{#1}]\normalfont}%
\makeatother

\begin{document}

\begin{teorema}
    This is a new theorem.
\end{teorema}

\begin{teorema}[someone]
    This is a new theorem.
\end{teorema}


\end{document}

これが他のドキュメントクラス (例: beamer) でも動作するという保証はありません。

使用を検討しましたか?amsthm パッケージ\newtheoremstyle/コマンドではどう\theoremstyleですか?

関連情報