我在证明的末尾有一个 (tikz) 图表(数学模式矩阵),我想将证明结束符号放在图表最后一行的高度上。我试图把它放在\qedhere
最后一行,但 tikz 抱怨
Package tikz Error: Giving up on this path. Did you forget a semicolon?
(不用说,该文件编译起来没有问题\qedhere
。)
编辑。我原来的问题可以通过以下 MWE 重现。
\documentclass[12pt,a4paper]{report}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows,decorations.markings}
\usepackage{amsthm}
\usepackage{amsmath}
\begin{document}
\begin{proof}
The proof is complete by staring at the following diagram
\[
\begin{tikzpicture}
\matrix (m) [matrix of math nodes, row sep=2em, column sep=2em]
{
0 & A & B \\
0 & C & D \qedhere \\
}
;
\path[->]
(m-1-1) edge (m-1-2)
(m-1-1) edge (m-2-1)
(m-2-1) edge (m-2-2)
(m-1-2) edge (m-2-2)
;
\end{tikzpicture}
\]
\end{proof}
\begin{proof}
For comparison, this is where the end of proof symbol should be:
\end{proof}
\end{document}
最后加载 tikz 包,编译时不会出错,但会将 QED 符号留在节点内。我希望它与其他证明的证明符号垂直对齐,即位于行的最末端。
答案1
我建议你使用qedhere
后 \end{tikzpicture}
:
或者,如果您希望它与最后一行对齐,您可以将节点放置在
\node [anchor=east,overlay,inner sep=0, outer sep=0] at (m-2-2 -| 0.5\textwidth,0) {\qedhere};
代码:\qedhere
后 tikzpicture
:
\documentclass[12pt,a4paper]{report}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows,decorations.markings}
\usepackage{amsthm}
\usepackage{amsmath}
\begin{document}
\begin{proof}
The proof is complete by staring at the following diagram
\[
\begin{tikzpicture}
\matrix (m) [matrix of math nodes, row sep=2em, column sep=2em]
{
0 & A & B \\
0 & C & D \\
}
;
\path[->]
(m-1-1) edge (m-1-2)
(m-1-1) edge (m-2-1)
(m-2-1) edge (m-2-2)
(m-1-2) edge (m-2-2)
;
\end{tikzpicture}\qedhere
\]
\end{proof}
\begin{proof}
For comparison, this is where the end of proof symbol should be:
\end{proof}
\end{document}
代码: 用于\node
放置\qed
:
\documentclass[12pt,a4paper]{report}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows,decorations.markings}
\usepackage{amsthm}
\usepackage{amsmath}
\begin{document}
\begin{proof}
The proof is complete by staring at the following diagram
\[
\begin{tikzpicture}
\matrix (m) [matrix of math nodes, row sep=2em, column sep=2em]
{
0 & A & B \\
0 & C & D \\
}
;
\path[->]
(m-1-1) edge (m-1-2)
(m-1-1) edge (m-2-1)
(m-2-1) edge (m-2-2)
(m-1-2) edge (m-2-2)
;
\node [anchor=east,overlay,inner sep=0, outer sep=0] at (m-2-2 -| 0.5\textwidth,0) {\qedhere};
\end{tikzpicture}\qedhere
\]
\end{proof}
\begin{proof}
For comparison, this is where the end of proof symbol should be:
\end{proof}
\end{document}