将 tikzpictures 按列对齐以供 Beamer 使用

将 tikzpictures 按列对齐以供 Beamer 使用

我需要在 Latex Beamer 的一个框架上有两列。

我希望两个 tikzpictures 具有完全相同的大小(节点大小应相等)并且所有文本位于相同的高度,例如 H 的定义应与 G 位于同一行,F' 的定义应与 F 位于同一行。

我怎么也想不通。

任何帮助都值得感激!

平均能量损失

\documentclass{beamer}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{tikz}
\begin{document}
\begin{frame}
    \frametitle{Satz 6}
    \begin{columns}
        \begin{column}{0.5\textwidth}
            \centering
            \begin{adjustbox}{max totalsize={\textwidth}{\textheight},center}
                \begin{tikzpicture}[
                    state/.style={circle, draw, minimum size=2.5em}]
                    \node[state] (n6) at (1,10) {6};
                    \node[state] (n4) at (4,8)  {4};
                    \node[state] (n5) at (8,9)  {5};
                    \node[state] (n3) at (5,5)  {3};
                    %\node[state] (n7) at (2,5) {7};
                    %\node[state] (n8) at (-2,4)  {8};
                    %\node[state] (n9) at (0,1)  {9};
                    %\node[state] (n10) at (1.5,3) {10};
                    
                    % labels
                    %\node[scale=1.5] at (-2,10) {$G = H + T$};
                    %\node[scale=1] at (-0.5,5.5) {$H = (V_H, E_H)$};
                    \node[scale=2] at (5,12) {$H = (V', E')$};
                    \node[scale=2] at (5,3) {$F' = \{4\}$};
                    
                    %\foreach \from/\to [count=\xi] in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4, n5/n3}
                    %\draw (\from) -- (\to) node [midway, label=\xi] {};
                    
                    
                    \draw (n4) -- (n5) node [midway] {};
                    \draw (n4) -- (n6) node [midway] {};
                    \draw (n3) -- (n4) node [midway] {};
                    \draw (n3) -- (n5) node [midway] {};
                \end{tikzpicture}
            \end{adjustbox}
        \end{column}
        \begin{column}{0.5\textwidth}
            \centering
            \begin{adjustbox}{max totalsize={\textwidth}{\textheight},center}
                \begin{tikzpicture}[
                    state/.style={circle, draw, minimum size=2.5em}]
                    \node[state] (n6) at (1,10) {6};
                    \node[state] (n4) at (4,8)  {4};
                    \node[state] (n5) at (8,9)  {5};
                    \node[state] (n1) at (11,8) {1};
                    \node[state] (n2) at (9,6)  {2};
                    \node[state] (n3) at (5,5)  {3};
                    %\node[state] (n7) at (2,5) {7};
                    %\node[state] (n8) at (-2,4)  {8};
                    %\node[state] (n9) at (0,1)  {9};
                    %\node[state] (n10) at (1.5,3) {10};
                    
                    % labels
                    %\node[scale=1.5] at (-2,10) {$G = H + T$};
                    %\node[scale=1] at (-0.5,5.5) {$H = (V_H, E_H)$};
                    \node[scale=2] at (5,12) {$G = (V, E)$};
                    \node[scale=2] at (5,2) {$F = \{2\}$};
                    \node[scale=2] at (5,1) {$F' \cup F = \{2,4\}$};
                    
                    %\foreach \from/\to [count=\xi] in {n6/n4,n4/n5,n5/n1,n1/n2,n2/n5,n2/n3,n3/n4, n5/n3}
                    %\draw (\from) -- (\to) node [midway, label=\xi] {};
                    \draw (n1) -- (n2) node [midway] {};
                    \draw (n1) -- (n5) node [midway] {};
                    \draw (n2) -- (n5) node [midway] {};
                    \draw (n2) -- (n3) node [midway] {};
                    \draw (n4) -- (n5) node [midway] {};
                    \draw (n4) -- (n6) node [midway] {};
                    \draw (n3) -- (n4) node [midway] {};
                    \draw (n3) -- (n5) node [midway] {};
                \end{tikzpicture}
            \end{adjustbox}
        \end{column}
    \end{columns}
\end{frame}
\end{document}

答案1

在此处输入图片描述

\documentclass{beamer}
\usepackage{graphicx}

\usepackage{tikz}
\begin{document}
\begin{frame}
    \frametitle{Satz 6}
    \begin{columns}
        \begin{column}[t]{0.4\textwidth}
            \centering
                \begin{tikzpicture}[scale=0.5,baseline=(current bounding box.north),
                    state/.style={circle, draw, minimum size=2em}]
                    \node[state] (n6) at (1,10) {6};
                    \node[state] (n4) at (4,8)  {4};
                    \node[state] (n5) at (8,9)  {5};
                    \node[state] (n3) at (5,5)  {3};
                    \node at (5,12) {$H = (V', E')$};
                    \node at (5,3) {$F' = \{4\}$};
                    \draw (n4) -- (n5) node [midway] {};
                    \draw (n4) -- (n6) node [midway] {};
                    \draw (n3) -- (n4) node [midway] {};
                    \draw (n3) -- (n5) node [midway] {};
                \end{tikzpicture}
        \end{column}
        \begin{column}[t]{0.6\textwidth}
            \centering
                \begin{tikzpicture}[scale=0.5,baseline=(current bounding box.north),
                    state/.style={circle, draw, minimum size=2em}]
                    \node[state] (n6) at (1,10) {6};
                    \node[state] (n4) at (4,8)  {4};
                    \node[state] (n5) at (8,9)  {5};
                    \node[state] (n1) at (11,8) {1};
                    \node[state] (n2) at (9,6)  {2};
                    \node[state] (n3) at (5,5)  {3};
                    \node at (5,12) {$G = (V, E)$};
                    \node at (5,3) {$F = \{2\}$};
                    \node at (5,2) {$F' \cup F = \{2,4\}$};
                    \draw (n1) -- (n2) node [midway] {};
                    \draw (n1) -- (n5) node [midway] {};
                    \draw (n2) -- (n5) node [midway] {};
                    \draw (n2) -- (n3) node [midway] {};
                    \draw (n4) -- (n5) node [midway] {};
                    \draw (n4) -- (n6) node [midway] {};
                    \draw (n3) -- (n4) node [midway] {};
                    \draw (n3) -- (n5) node [midway] {};
                \end{tikzpicture}
        \end{column}
    \end{columns}
\end{frame}
\end{document}

相关内容