定理スタイルのパーソナライゼーション

定理スタイルのパーソナライゼーション

私は定理のスタイルを次のようにカスタマイズします。

\documentclass{article}
\usepackage{amsthm}

\swapnumbers % optional, of course
\newtheorem{thm}{Theorem}[section] % the main one

% for specifying a name
\theoremstyle{plain} % just in case the style had changed
\newcommand{\thistheoremname}{}
\newtheorem{genericthm}[thm]{\thistheoremname \textmd{\textit{ (Theorem)}}}
\newenvironment{nth}[1]
  {\renewcommand{\thistheoremname}{#1}%
   \begin{genericthm}}
  {\end{genericthm}}

\begin{document}
\begin{nth}{The name of the theorem}
    theorem explanation
\end{nth}
\end{document}

そして、次のような出力が得られます。 しかし、私は少し違うものを希望します:

  • 定理の名前の末尾のドットを削除します
  • 定理の説明を新しい行に記入してください(\newline を試しましたが、うまくいきませんでした)

答え1

このような?

\documentclass{article}
\usepackage{amsthm}
\newtheoremstyle{mystyle}% 〈name〉
    {3pt}% 〈Space above〉
    {3pt}% 〈Space below〉
    {\itshape}% 〈Body font〉
    {}% 〈Indent amount〉
    {\bfseries}% 〈Theorem head font〉
    {\newline}% 〈Punctuation after theorem head〉
    {.5em}% 〈Space after theorem head〉
    {\thmnumber{#2}\thmnote{ #3}\thmname{ \mdseries\itshape(#1)}}% 〈Theorem head spec (can be left empty, meaning ‘normal’)〉

\theoremstyle{mystyle}
\newtheorem{thm}{Theorem}[section] % the main one

\begin{document}
\section{Test}
\begin{thm}[The name of the theorem]
    theorem explanation
\end{thm}
\begin{thm}[Another Theorem]
    Content.
\end{thm}
\end{document}

結果

答え2

\swapnumber損害を与えるので削除する必要があります。

\documentclass{article}
\usepackage{amsthm}

\newtheoremstyle{swapped}
 {\topsep}
 {\topsep}
 {\itshape}
 {}
 {\bfseries}
 {\newline}
 {0pt}
 {\thmnumber{#2 }\thmname{#1}\thmnote{\textmd{ (\textit{#3})}}}

\theoremstyle{swapped}
\newtheorem{thm}{Theorem}[section] % the main one

% for specifying a name
\newtheoremstyle{named}
 {\topsep}
 {\topsep}
 {\itshape}
 {}
 {\bfseries}
 {\newline}
 {0pt}
 {\thmnumber{#2 \thistheoremname} \textmd{(\textit{\thmname{#1}\thmnote{, #3}})}}

\theoremstyle{named}
\newcommand{\thistheoremname}{}
\newtheorem{genericthm}[thm]{Theorem}
\newenvironment{nth}[1]
  {\renewcommand{\thistheoremname}{#1}%
   \begin{genericthm}}
  {\end{genericthm}}

\begin{document}

\section{Test}

\begin{thm}
Theorem statement
\end{thm}

\begin{thm}[with a note]
Theorem statement
\end{thm}

\begin{nth}{The name of the theorem}
Theorem statement
\end{nth}

\begin{nth}{The name of the theorem}[with a note]
Theorem statement
\end{nth}

\end{document}

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

統一性を保つために、定理の注釈はすべて斜体(ただし、括弧は垂直)にして、\newlineすべての文に使用します。

関連情報