かすみん日記

暇なときに何か喋ります

【LaTeX】定理・証明環境 (amsthm)

amsthm.styを使っています。
設定のメモ。

ソースコード

\documentclass[11pt,b5paper,papersize]{jsarticle}

\usepackage{amsmath}
\usepackage{amsthm}

\newtheoremstyle{mystyle}%   % スタイル名
    {}%                      % 上部スペース
    {}%                      % 下部スペース
    {\normalfont}%           % 本文フォント
    {}%                      % インデント量
    {\bf}%                   % 見出しフォント
    {}%                      % 見出し後の句読点, '.'
    { }%                     % 見出し後のスペース, ' ' or \newline
    {\underline{\thmname{#1}\thmnumber{#2}\thmnote{#3}}}%
                             % 見出しの書式 (can be left empty, meaning `normal')
\theoremstyle{mystyle} % スタイルの適用

\newtheorem{theorem}{定理}[section]
\newtheorem{lemma}{補題}[section]

\renewcommand{\proofname}{証明}

\makeatletter % use at mark
\renewenvironment{proof}[1][\proofname]{\par
  \pushQED{\qed}%
  \normalfont \topsep6\p@\@plus6\p@\relax
  \trivlist
  \item[\hskip\labelsep
        \itshape
    {\bf\underline{#1}}]\ignorespaces
    % {\bf\underline{#1}\@addpunct{.}}]\ignorespaces % ピリオドあり
}{%
  \popQED\endtrivlist\@endpefalse
}
\makeatother % end at mark

\newcommand\aaa{あああああああああああああああああ
あああああああああああああああああああああああああああ
ああああああああああああああああああああああ}

%%
\begin{document}

%
\section{定理・証明環境}
amsthmをベースに、定理・証明環境を作りました。

\begin{theorem}
  \aaa
\end{theorem}

\begin{proof}
  \aaa
\end{proof}

\begin{theorem}
  \aaa
\end{theorem}

\begin{proof}
  \aaa
\end{proof}

\begin{lemma}
  \aaa
\end{lemma}

[ ]に引数を入れると以下のようになる。

\begin{theorem}[にゃんこの定理]
  \label{thm:nyanko}
  \aaa
\end{theorem}

\begin{proof}[定理\ref{thm:nyanko}の証明]
  \aaa
\end{proof}

\end{document}

実行結果

f:id:geniusium:20190129222117p:plain