![如何以有用的方式嵌套证明](https://linux22.com/image/306499/%E5%A6%82%E4%BD%95%E4%BB%A5%E6%9C%89%E7%94%A8%E7%9A%84%E6%96%B9%E5%BC%8F%E5%B5%8C%E5%A5%97%E8%AF%81%E6%98%8E.png)
我正在使用 amsthm 和 amsbook 并嵌套声明和证明。我想要两件事:
1)较深层次的证明应该缩进。
2) 每个校样周围应有一个半框(仅左侧和底部的线)以方便读者阅读。如果校样长度超过一页,则框的左侧线应延伸至多页。
这就是我的例子现在的样子:
这就是我的例子应该看起来像:
这是代码:
\documentclass[oneside,english,reqno]{amsbook}
\usepackage{etoolbox}
\usepackage{thmtools}
\makeatletter
\providecommand{\claimname}{Claim}
\providecommand{\definitionname}{Definition}
\providecommand{\theoremname}{Theorem}
\declaretheoremstyle[
spaceabove=\thm@preskip,
spacebelow=\thm@postskip,
headfont=\normalfont\scshape,
notefont=\mdseries,
notebraces={(}{)},
numberwithin=section,
headformat=\smash{\fbox{\NUMBER.}}~\NAME\NOTE,
bodyfont=\BodyFont,
]{boxed}
\def\BodyFont{\normalfont\itshape}
\declaretheorem[style=boxed,name=\theoremname]{thm}
\declaretheorem[style=boxed,name=\claimname]{claim}
\def\BodyFont{\normalfont}
\declaretheorem[style=boxed,name=\definitionname]{defn}
\numberwithin{section}{chapter}
\makeatletter
\let\sv@thm\@thm
\def\@thm{\let\indent\relax\sv@thm}
\let\oldref\ref
\newcommand\thref[1]{\textup{\fbox{\ref{#1}}}}
\expandafter\patchcmd\csname\string\proof\endcsname
{\normalparindent}{0pt }{}{}
\makeatother
\begin{document}
\chapter{First Chapter}
\section{First Section}
\begin{claim}
\label{claim:Cool_Claim}Some Claim some words some words some
words some words some words some words some words some words some
words some words some words some words some words some words some
words some words some words some words some words some words some
words some words some words some words
\begin{proof}
This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof.
\end{proof}
\end{claim}
\begin{claim}
This is a new claim
\begin{proof}
This is the proof of the new claim.
\begin{claim}
Here is a subclaim of the new claim.
\begin{proof}
And this is the proof of the subclaim.
\end{proof}
\end{claim}
\end{proof}
\end{claim}
\begin{defn}
Some Definition
\end{defn}
This is now normal text again. As we learnt in \thref{claim:Cool_Claim}.
\end{document}
答案1
实现此目的的一种方法是使用mdframed
proof
并用适当的环境包围环境mdframed
:
\documentclass[oneside,english,reqno]{amsbook}
\usepackage{etoolbox}
\usepackage{thmtools}
\usepackage[framemethod=tikz]{mdframed}
\surroundwithmdframed[
hidealllines=true,
leftline=true,
bottomline=true,
innertopmargin=0pt,
skipabove=\dimexpr\topsep+6pt\relax,
skipbelow=\topsep,
innerrightmargin=0pt,
]{proof}
\makeatletter
\providecommand{\claimname}{Claim}
\providecommand{\definitionname}{Definition}
\providecommand{\theoremname}{Theorem}
\declaretheoremstyle[
spaceabove=\thm@preskip,
spacebelow=\thm@postskip,
headfont=\normalfont\scshape,
notefont=\mdseries,
notebraces={(}{)},
numberwithin=section,
headformat=\smash{\fbox{\NUMBER.}}~\NAME\NOTE,
bodyfont=\BodyFont,
]{boxed}
\def\BodyFont{\normalfont\itshape}
\declaretheorem[style=boxed,name=\theoremname]{thm}
\declaretheorem[style=boxed,name=\claimname]{claim}
\def\BodyFont{\normalfont}
\declaretheorem[style=boxed,name=\definitionname]{defn}
\numberwithin{section}{chapter}
\makeatletter
\let\sv@thm\@thm
\def\@thm{\let\indent\relax\sv@thm}
\let\oldref\ref
\newcommand\thref[1]{\textup{\fbox{\ref{#1}}}}
\expandafter\patchcmd\csname\string\proof\endcsname
{\normalparindent}{0pt }{}{}
\makeatother
\begin{document}
\chapter{First Chapter}
\section{First Section}
\begin{claim}
\label{claim:Cool_Claim}Some Claim some words some words some
words some words some words some words some words some words some
words some words some words some words some words some words some
words some words some words some words some words some words some
words some words some words some words
\begin{proof}
This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof. This is the text of the proof.
\end{proof}
\end{claim}
\begin{claim}
This is a new claim
\begin{proof}
This is the proof of the new claim.
\begin{claim}
Here is a subclaim of the new claim.
\begin{proof}
And this is the proof of the subclaim.
\end{proof}
\end{claim}
\end{proof}
\end{claim}
\begin{defn}
Some Definition
\end{defn}
This is now normal text again. As we learnt in \thref{claim:Cool_Claim}.
\end{document}
作为芭芭拉·比顿在评论中提到,让每个结构都有一个独立的计数器对读者来说将是一场噩梦;让结构共享一个计数器要好得多(使用sibling
来自的键实现thmtools
)。一个简化的例子展示了如何获得共享计数器的结构:
\documentclass[oneside,english,reqno]{amsbook}
\usepackage{thmtools}
\numberwithin{section}{chapter}
\providecommand{\claimname}{Claim}
\providecommand{\definitionname}{Definition}
\providecommand{\theoremname}{Theorem}
\makeatletter
\declaretheoremstyle[
spaceabove=\thm@preskip,
spacebelow=\thm@postskip,
headfont=\normalfont\scshape,
notefont=\mdseries,
notebraces={(}{)},
headformat=\smash{\fbox{\NUMBER.}}~\NAME\NOTE,
bodyfont=\BodyFont,
]{boxed}
\def\BodyFont{\normalfont\itshape}
\declaretheorem[style=boxed,numberwithin=section,name=\theoremname]{thm}
\declaretheorem[style=boxed,name=\claimname,sibling=thm]{claim}
\def\BodyFont{\normalfont}
\declaretheorem[style=boxed,name=\definitionname,sibling=thm]{defn}
\makeatother
\begin{document}
\chapter{Test}
\section{Test}
\begin{claim}
test
\end{claim}
\begin{claim}
test
\end{claim}
\begin{defn}
test
\end{defn}
\end{document}