当我在 \begin{solution} 之后立即放置一个 prooftree 时,解决方案环境的标题既不会与 prooftree 的左侧对齐,也不会位于其上方。当 \begin{prooftree} 之前有一些文本时,结果会很好,但由于我编写了大量练习和解决方案,因此这似乎是一个非常重复的解决方案。
它看起来像这样
我希望它看起来像第二个例子,只是不需要有文字。
这是我的代码。
\documentclass{book}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{bussproofs}
\declaretheoremstyle[
spaceabove= 6pt,
spacebelow= 6pt,
headfont=\normalfont \itshape,
notefont=\mdseries,
notebraces={(}{)},
bodyfont=\normalfont,
postheadspace=1em,
qed= \qedsymbol
]{solution}
\declaretheorem[style=solution, numbered = no]{Solution}
\begin{document}
text text text text
\begin{Solution}
\begin{prooftree}
\AxiomC{$[P]^{1}$}
\AxiomC{$(P \rightarrow Q) \wedge (Q \rightarrow R)$}
\RightLabel{\scriptsize $\wedge E$}
\UnaryInfC{$P \rightarrow Q$}
\RightLabel{\scriptsize $\rightarrow E$}
\BinaryInfC{$Q$}
\AxiomC{$(P \rightarrow Q) \wedge (Q \rightarrow R)$}
\RightLabel{\scriptsize $\wedge E$}
\UnaryInfC{$Q \rightarrow R$}
\RightLabel{\scriptsize $\rightarrow E$}
\BinaryInfC{$R$}
\RightLabel{\scriptsize $\rightarrow I_{1}$}
\UnaryInfC{$P \rightarrow R$}
\end{prooftree}
\end{Solution}
\end{document}
答案1
\mbox{}
在后面输入\begin{solution}
:
\documentclass{book}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{bussproofs}
\declaretheoremstyle[
spaceabove= 6pt,
spacebelow= 6pt,
headfont=\normalfont \itshape,
notefont=\mdseries,
notebraces={(}{)},
bodyfont=\normalfont,
postheadspace=1em,
qed= \qedsymbol
]{solution}
\declaretheorem[style=solution, numbered = no]{Solution}
\begin{document}
text text text text
\begin{Solution}
\mbox{}
\begin{prooftree}
\AxiomC{$[P]^{1}$}
\AxiomC{$(P \rightarrow Q) \wedge (Q \rightarrow R)$}
\RightLabel{\scriptsize $\wedge E$}
\UnaryInfC{$P \rightarrow Q$}
\RightLabel{\scriptsize $\rightarrow E$}
\BinaryInfC{$Q$}
\AxiomC{$(P \rightarrow Q) \wedge (Q \rightarrow R)$}
\RightLabel{\scriptsize $\wedge E$}
\UnaryInfC{$Q \rightarrow R$}
\RightLabel{\scriptsize $\rightarrow E$}
\BinaryInfC{$R$}
\RightLabel{\scriptsize $\rightarrow I_{1}$}
\UnaryInfC{$P \rightarrow R$}
\end{prooftree}
\end{Solution}
\end{document}