类似证明的环境

类似证明的环境

我有一个名为问题的定理环境,我想使用类似证明的环境,打印“解决方案”而不是“证明”

\documentclass[a4paper,11pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsthm}

\newtheorem{question}{Question}

\begin{document}

\begin{question}
Some question here
\end{question}

\begin{solution}
Here goes the solution to the question
\end{solution}

\begin{theorem}
Some theorem or formula to derive here
\end{theorem}

\begin{proof}
Here goes the proof to the question
\end{proof}

\end{document}

我已经使用命令$\renewcommand{\proofname}{Solution}$作为临时修复,但它会替换所有实例的名称,有时我实际上需要使用常规证明环境,并以“Proof”作为其名称。

答案1

amsthm有三种样式:(plain标题在\bfseries且正文在\itshape)、definition(标题在\bfseries且正文在\rmfamily)和remark(标题在\itshape且正文在\rmfamily)。它们都带有星号版本,不使用计数器。

\documentclass[a4paper,11pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{amsthm}

\newtheorem{theorem}{Theorem}
\newtheorem{question}{Question}
\theoremstyle{remark}
\newtheorem*{solution}{Solution}


\begin{document}

\begin{question}
Some question here
\end{question}

\begin{solution}
Here goes the solution to the question
\end{solution}

\begin{theorem}
Some theorem or formula to derive here
\end{theorem}

\begin{proof}
Here goes the proof to the question
\end{proof}

\end{document}

如果您希望看到QED解决方案末尾的符号,这里有另一种方法。

\documentclass[a4paper,11pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{amsthm}

\newtheorem{theorem}{Theorem}
\newtheorem{question}{Question}

\newenvironment{solution}{\renewcommand{\proofname}{Solution}\begin{proof}}{\end{proof}}


\begin{document}

\begin{question}
Some question here
\end{question}

\begin{solution}
Here goes the solution to the question
\end{solution}

\begin{theorem}
Some theorem or formula to derive here
\end{theorem}

\begin{proof}
Here goes the proof to the question
\end{proof}

\end{document}

在此处输入图片描述

答案2

原文proof复制并修改:

\documentclass[a4paper,11pt]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsthm}

\newtheorem{theorem}{Theorem} % PS
\newtheorem{question}{Question}

\makeatletter
\newenvironment{solution}[1][\solutionname]{\par
  \pushQED{\qed}%
  \normalfont \topsep6\p@\@plus6\p@\relax
  \trivlist
%<amsbook|amsproc>  \itemindent\normalparindent
  \item[\hskip\labelsep
%<amsbook|amsproc>        \scshape
%<amsart|amsthm>        \itshape
\itshape 
    #1\@addpunct{.}]\ignorespaces
}{%
  \popQED\endtrivlist\@endpefalse
}
%    \end{macrocode}
%    Default for \cn{proofname}:
%    \begin{macrocode}
\providecommand{\solutionname}{Solution}

\makeatother


\begin{document}

\begin{question}
Some question here
\end{question}

%\begin{proof}
\begin{solution} % PS
Here goes the solution to the question
%\end{proof}
\end{solution} % PS

\begin{theorem}
Some theorem or formula to derive here
\end{theorem}

\begin{proof}
Here goes the proof to the question
\end{proof}

\end{document}

在此处输入图片描述

相关内容