将 qed 符号移动到居中 tikz 图片的底部

将 qed 符号移动到居中 tikz 图片的底部

以下代码产生此输出
在此处输入图片描述

我怎样才能将 qed 符号放在底线,而不将其$P(X)=$从垂直中心移动?

\documentclass{article}

\usepackage{amsthm}
\usepackage{tikz}

\begin{document}
    \begin{proof}
        something something something\\

        $P(X)=$\begin{tikzpicture}[baseline={(current bounding box.center)}]
        \node (1) at (0,0){$1$};
        \node (2) at (-2,-1){$2$};
        \node (3) at (0,-1){$3$};
        \node (4) at (2,-1){$4$};
        \node (5) at (-2,-2){$5$};
        \node (6) at (0,-2){$6$};
        \node (7) at (2,-2){$7$};
        \node (8) at (0,-3){$8$};
        \end{tikzpicture}
    \end{proof}
\end{document}

答案1

用于\raisebox降低基线。

\documentclass{article}

\usepackage{amsthm}
\usepackage{tikz}

\begin{document}
    \begin{proof}
        something something something\\

        \raisebox{\depth}{%
        $P(X)=$\begin{tikzpicture}[baseline={(current bounding box.center)}]
        \node (1) at (0,0){$1$};
        \node (2) at (-2,-1){$2$};
        \node (3) at (0,-1){$3$};
        \node (4) at (2,-1){$4$};
        \node (5) at (-2,-2){$5$};
        \node (6) at (0,-2){$6$};
        \node (7) at (2,-2){$7$};
        \node (8) at (0,-3){$8$};
        \end{tikzpicture}}
    \end{proof}
\end{document}

答案2

写矩阵的方式非常奇怪。这个简单的解决方案有什么问题:

\documentclass{article}
\usepackage{amsthm,mathtools}

\begin{document}
    \begin{proof}
       something something something\\
\[
\setlength\arraycolsep{1cm}
\renewcommand\arraystretch{2}
P(X) = \begin{matrix}
    &   1   &           \\
2   &   3   &   4       \\
5   &   6   &   7       \\
    &   8   &           \\
        \end{matrix}
\]
    \end{proof}
\end{document}

相关内容