如何将 tizk 表堆叠在块中?

如何将 tizk 表堆叠在块中?
\documentclass{beamer}

\usepackage{adjustbox}     % adjusting table (too wide)
% Fancy tables
\usepackage{tikz}
\usetikzlibrary{trees,positioning} % tree
\usetikzlibrary{matrix}            % Table

\begin{document}


\begin{frame}[fragile]{Findings 3} %{What's new?}

    \begin{adjustbox}{max width=\textwidth}
        \begin{block}{$\{ [\phi(h),p(t+h)]_C \}$}
        \begin{tikzpicture}[scale=0.9, every node/.style={scale=0.9}]
            \matrix (m)%
            [matrix of math nodes,
            column 1/.style={nodes={rectangle,minimum width=4em}},
            column 2/.style={nodes={rectangle,minimum width=4em}},
            column 3/.style={nodes={rectangle,minimum width=4em}},
            column 4/.style={nodes={rectangle,minimum width=4em}},
            column 5/.style={nodes={rectangle,minimum width=4em}},
            column 6/.style={nodes={rectangle,minimum width=4em}},
            column 7/.style={nodes={rectangle,minimum width=4em}},
            column 8/.style={nodes={rectangle,minimum width=4em}},
            column 9/.style={nodes={rectangle,minimum width=4em}},
            nodes in empty cells
            ]{
                & K=3 & K=4 & K=5 & K=6 & K=7 & K=8 & K=9 & K=10 \\
                \hline
                C=2   & 4     & 7     & 8     & 9     & 10    & 11    & 12    & 13 \\
                C=3   & 4     & 10    & 11    & 12    & 13    & 14    & 15    & 16 \\
                C=4   & 4     & 10    & 14    & 15    & 16    & 17    & 18    & 19 \\
                C=5   & 4     & 10    & 16    & 18    & 19    & 20    & 21    & 22 \\
                C=6   & 4     & 10    & 16    & 21    & 22    & 23    & 24    & 25 \\
                C=7   & 4     & 10    & 16    & 23    & 25    & 26    & 27    & 28 \\
                C=8   & 4     & 10    & 16    & 23    & 28    & 29    & 30    & 31 \\
                C=9   & 4     & 10    & 16    & 23    & 31    & 32    & 33    & 34 \\
                C=10  & 4     & 10    & 16    & 23    & 31    & 35    & 36    & 37 \\
            };
            \draw ([yshift=0.5em]m-1-1.north east) -- (m-10-1.south east);
        \only<2->{
            \draw[red,thick]
            (m-2-2.north east) --
            (m-3-2.south east) --
            (m-3-3.south east) --
            (m-4-3.south east) --
            (m-4-4.south east) --
            (m-6-4.south east) --
            (m-6-5.south east) --
            (m-6-5.south east) --
            (m-9-5.south east) --
            (m-9-6.south east) --
            (m-10-6.south east)
            ;
            \draw[blue,dashed,thick]
            (m-2-2.north east) --
            (m-2-2.south east) --
            (m-2-4.south east) --
            (m-3-4.south east) --
            (m-3-6.south east) --
            (m-4-6.south east) --
            (m-4-8.south east) --
            (m-5-8.south east) --
            (m-5-9.south east);
        }
        \end{tikzpicture}
        \end{block}
% \\
        \begin{block}{$\{ [\phi(t+h),p(h)]_C \}$}
        \begin{tikzpicture}[scale=0.9, every node/.style={scale=0.9}]
            \matrix (m)%
            [matrix of math nodes,
            column 1/.style={nodes={rectangle,minimum width=4em}},
            column 2/.style={nodes={rectangle,minimum width=4em}},
            column 3/.style={nodes={rectangle,minimum width=4em}},
            column 4/.style={nodes={rectangle,minimum width=4em}},
            column 5/.style={nodes={rectangle,minimum width=4em}},
            column 6/.style={nodes={rectangle,minimum width=4em}},
            column 7/.style={nodes={rectangle,minimum width=4em}},
            column 8/.style={nodes={rectangle,minimum width=4em}},
            column 9/.style={nodes={rectangle,minimum width=4em}},
            nodes in empty cells
            ]{
                & K=3 & K=4 & K=5 & K=6 & K=7 & K=8 & K=9 & K=10 \\
                \hline
                C=2   & 4     & 7     & 8     & 9     & 10    & 11    & 12    & 13 \\
                C=3   & 4     & 10    & 11    & 12    & 13    & 14    & 15    & 16 \\
                C=4   & 4     & 10    & 14    & 15    & 16    & 17    & 18    & 19 \\
                C=5   & 4     & 10    & 16    & 18    & 19    & 20    & 21    & 22 \\
                C=6   & 4     & 10    & 16    & 21    & 22    & 23    & 24    & 25 \\
                C=7   & 4     & 10    & 16    & 23    & 25    & 26    & 27    & 28 \\
                C=8   & 4     & 10    & 16    & 23    & 28    & 29    & 30    & 31 \\
                C=9   & 4     & 10    & 16    & 23    & 31    & 32    & 33    & 34 \\
                C=10  & 4     & 10    & 16    & 23    & 31    & 35    & 36    & 37 \\
            };
            \draw ([yshift=0.5em]m-1-1.north east) -- (m-10-1.south east);
        \only<2->{
            \draw[red,thick]
            (m-2-2.north east) --
            (m-3-2.south east) --
            (m-3-3.south east) --
            (m-4-3.south east) --
            (m-4-4.south east) --
            (m-6-4.south east) --
            (m-6-5.south east) --
            (m-6-5.south east) --
            (m-9-5.south east) --
            (m-9-6.south east) --
            (m-10-6.south east)
            ;
            \draw[blue,dashed,thick]
            (m-2-2.north east) --
            (m-2-2.south east) --
            (m-2-4.south east) --
            (m-3-4.south east) --
            (m-3-6.south east) --
            (m-4-6.south east) --
            (m-4-8.south east) --
            (m-5-8.south east) --
            (m-5-9.south east);
        }
        \end{tikzpicture}
        \end{block}
    \end{adjustbox}
%
\end{frame}

\end{document}

我想要得到的是:

一张表叠在另一张Block表上。表中的行来自\only<2->

我似乎无法让adjustbox\only<>和很好地协同工作。block\\

我只能像这样将它们并排放置: 在此处输入图片描述

谢谢!

答案1

这种adjustbox方法是有问题的,因为这会缩放表格以占据整个文本宽度,但这样就没有足够的空间将两个表格堆叠在一起。

可能性 1:为什么不简单地用缩放 tikz 图片呢scale=0.5, every node/.style={scale=0.5}

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{trees,positioning} 
\usetikzlibrary{matrix}            

\begin{document}


\begin{frame}[fragile]{Findings 3} 
\begin{block}{$\{ [\phi(h),p(t+h)]_C \}$}
  \begin{tikzpicture}[scale=0.5, every node/.style={scale=0.5}]
    \matrix (m)[%
          matrix of math nodes,
        column 1/.style={nodes={rectangle,minimum width=4em}},
        column 2/.style={nodes={rectangle,minimum width=4em}},
        column 3/.style={nodes={rectangle,minimum width=4em}},
        column 4/.style={nodes={rectangle,minimum width=4em}},
        column 5/.style={nodes={rectangle,minimum width=4em}},
        column 6/.style={nodes={rectangle,minimum width=4em}},
        column 7/.style={nodes={rectangle,minimum width=4em}},
        column 8/.style={nodes={rectangle,minimum width=4em}},
        column 9/.style={nodes={rectangle,minimum width=4em}},
        nodes in empty cells
    ]{
      & K=3 & K=4 & K=5 & K=6 & K=7 & K=8 & K=9 & K=10 \\
      \hline
      C=2   & 4   & 7   & 8   & 9     & 10    & 11    & 12    & 13 \\
      C=3   & 4   & 10  & 11  & 12    & 13    & 14    & 15    & 16 \\
      C=4   & 4   & 10  & 14  & 15    & 16    & 17    & 18    & 19 \\
      C=5   & 4   & 10  & 16  & 18    & 19    & 20    & 21    & 22 \\
      C=6   & 4   & 10  & 16  & 21    & 22    & 23    & 24    & 25 \\
      C=7   & 4   & 10  & 16  & 23    & 25    & 26    & 27    & 28 \\
      C=8   & 4   & 10  & 16  & 23    & 28    & 29    & 30    & 31 \\
      C=9   & 4   & 10  & 16  & 23    & 31    & 32    & 33    & 34 \\
      C=10  & 4   & 10  & 16  & 23    & 31    & 35    & 36    & 37 \\
    };
    \draw ([yshift=0.5em]m-1-1.north east) -- (m-10-1.south east);
        \only<2->{
            \draw[red,thick]
            (m-2-2.north east) --
            (m-3-2.south east) --
            (m-3-3.south east) --
            (m-4-3.south east) --
            (m-4-4.south east) --
            (m-6-4.south east) --
            (m-6-5.south east) --
            (m-6-5.south east) --
            (m-9-5.south east) --
            (m-9-6.south east) --
            (m-10-6.south east)
            ;
            \draw[blue,dashed,thick]
            (m-2-2.north east) --
            (m-2-2.south east) --
            (m-2-4.south east) --
            (m-3-4.south east) --
            (m-3-6.south east) --
            (m-4-6.south east) --
            (m-4-8.south east) --
            (m-5-8.south east) --
            (m-5-9.south east);
        }
    \end{tikzpicture}
\end{block}

\begin{block}{$\{ [\phi(h),p(t+h)]_C \}$}
  \begin{tikzpicture}[scale=0.5, every node/.style={scale=0.5}]
    \matrix (m)[%
          matrix of math nodes,
        column 1/.style={nodes={rectangle,minimum width=4em}},
        column 2/.style={nodes={rectangle,minimum width=4em}},
        column 3/.style={nodes={rectangle,minimum width=4em}},
        column 4/.style={nodes={rectangle,minimum width=4em}},
        column 5/.style={nodes={rectangle,minimum width=4em}},
        column 6/.style={nodes={rectangle,minimum width=4em}},
        column 7/.style={nodes={rectangle,minimum width=4em}},
        column 8/.style={nodes={rectangle,minimum width=4em}},
        column 9/.style={nodes={rectangle,minimum width=4em}},
        nodes in empty cells
    ]{
      & K=3 & K=4 & K=5 & K=6 & K=7 & K=8 & K=9 & K=10 \\
      \hline
      C=2   & 4   & 7   & 8   & 9     & 10    & 11    & 12    & 13 \\
      C=3   & 4   & 10  & 11  & 12    & 13    & 14    & 15    & 16 \\
      C=4   & 4   & 10  & 14  & 15    & 16    & 17    & 18    & 19 \\
      C=5   & 4   & 10  & 16  & 18    & 19    & 20    & 21    & 22 \\
      C=6   & 4   & 10  & 16  & 21    & 22    & 23    & 24    & 25 \\
      C=7   & 4   & 10  & 16  & 23    & 25    & 26    & 27    & 28 \\
      C=8   & 4   & 10  & 16  & 23    & 28    & 29    & 30    & 31 \\
      C=9   & 4   & 10  & 16  & 23    & 31    & 32    & 33    & 34 \\
      C=10  & 4   & 10  & 16  & 23    & 31    & 35    & 36    & 37 \\
    };
    \draw ([yshift=0.5em]m-1-1.north east) -- (m-10-1.south east);
        \only<2->{
            \draw[red,thick]
            (m-2-2.north east) --
            (m-3-2.south east) --
            (m-3-3.south east) --
            (m-4-3.south east) --
            (m-4-4.south east) --
            (m-6-4.south east) --
            (m-6-5.south east) --
            (m-6-5.south east) --
            (m-9-5.south east) --
            (m-9-6.south east) --
            (m-10-6.south east)
            ;
            \draw[blue,dashed,thick]
            (m-2-2.north east) --
            (m-2-2.south east) --
            (m-2-4.south east) --
            (m-3-4.south east) --
            (m-3-6.south east) --
            (m-4-6.south east) --
            (m-4-8.south east) --
            (m-5-8.south east) --
            (m-5-9.south east);
        }
    \end{tikzpicture}
\end{block}
\end{frame}

\end{document}

在此处输入图片描述

可能性 2:让 Beamer 完成工作

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{trees,positioning} 
\usetikzlibrary{matrix}            

\begin{document}


\begin{frame}[fragile, shrink]{Findings 3} 
\begin{block}{$\{ [\phi(h),p(t+h)]_C \}$}
  \begin{tikzpicture}
    \matrix (m)[%
          matrix of math nodes,
        column 1/.style={nodes={rectangle,minimum width=4em}},
        column 2/.style={nodes={rectangle,minimum width=4em}},
        column 3/.style={nodes={rectangle,minimum width=4em}},
        column 4/.style={nodes={rectangle,minimum width=4em}},
        column 5/.style={nodes={rectangle,minimum width=4em}},
        column 6/.style={nodes={rectangle,minimum width=4em}},
        column 7/.style={nodes={rectangle,minimum width=4em}},
        column 8/.style={nodes={rectangle,minimum width=4em}},
        column 9/.style={nodes={rectangle,minimum width=4em}},
        nodes in empty cells
    ]{
      & K=3 & K=4 & K=5 & K=6 & K=7 & K=8 & K=9 & K=10 \\
      \hline
      C=2   & 4   & 7   & 8   & 9     & 10    & 11    & 12    & 13 \\
      C=3   & 4   & 10  & 11  & 12    & 13    & 14    & 15    & 16 \\
      C=4   & 4   & 10  & 14  & 15    & 16    & 17    & 18    & 19 \\
      C=5   & 4   & 10  & 16  & 18    & 19    & 20    & 21    & 22 \\
      C=6   & 4   & 10  & 16  & 21    & 22    & 23    & 24    & 25 \\
      C=7   & 4   & 10  & 16  & 23    & 25    & 26    & 27    & 28 \\
      C=8   & 4   & 10  & 16  & 23    & 28    & 29    & 30    & 31 \\
      C=9   & 4   & 10  & 16  & 23    & 31    & 32    & 33    & 34 \\
      C=10  & 4   & 10  & 16  & 23    & 31    & 35    & 36    & 37 \\
    };
    \draw ([yshift=0.5em]m-1-1.north east) -- (m-10-1.south east);
        \only<2->{
            \draw[red,thick]
            (m-2-2.north east) --
            (m-3-2.south east) --
            (m-3-3.south east) --
            (m-4-3.south east) --
            (m-4-4.south east) --
            (m-6-4.south east) --
            (m-6-5.south east) --
            (m-6-5.south east) --
            (m-9-5.south east) --
            (m-9-6.south east) --
            (m-10-6.south east)
            ;
            \draw[blue,dashed,thick]
            (m-2-2.north east) --
            (m-2-2.south east) --
            (m-2-4.south east) --
            (m-3-4.south east) --
            (m-3-6.south east) --
            (m-4-6.south east) --
            (m-4-8.south east) --
            (m-5-8.south east) --
            (m-5-9.south east);
        }
    \end{tikzpicture}
\end{block}

\begin{block}{$\{ [\phi(h),p(t+h)]_C \}$}
  \begin{tikzpicture}
    \matrix (m)[%
          matrix of math nodes,
        column 1/.style={nodes={rectangle,minimum width=4em}},
        column 2/.style={nodes={rectangle,minimum width=4em}},
        column 3/.style={nodes={rectangle,minimum width=4em}},
        column 4/.style={nodes={rectangle,minimum width=4em}},
        column 5/.style={nodes={rectangle,minimum width=4em}},
        column 6/.style={nodes={rectangle,minimum width=4em}},
        column 7/.style={nodes={rectangle,minimum width=4em}},
        column 8/.style={nodes={rectangle,minimum width=4em}},
        column 9/.style={nodes={rectangle,minimum width=4em}},
        nodes in empty cells
    ]{
      & K=3 & K=4 & K=5 & K=6 & K=7 & K=8 & K=9 & K=10 \\
      \hline
      C=2   & 4   & 7   & 8   & 9     & 10    & 11    & 12    & 13 \\
      C=3   & 4   & 10  & 11  & 12    & 13    & 14    & 15    & 16 \\
      C=4   & 4   & 10  & 14  & 15    & 16    & 17    & 18    & 19 \\
      C=5   & 4   & 10  & 16  & 18    & 19    & 20    & 21    & 22 \\
      C=6   & 4   & 10  & 16  & 21    & 22    & 23    & 24    & 25 \\
      C=7   & 4   & 10  & 16  & 23    & 25    & 26    & 27    & 28 \\
      C=8   & 4   & 10  & 16  & 23    & 28    & 29    & 30    & 31 \\
      C=9   & 4   & 10  & 16  & 23    & 31    & 32    & 33    & 34 \\
      C=10  & 4   & 10  & 16  & 23    & 31    & 35    & 36    & 37 \\
    };
    \draw ([yshift=0.5em]m-1-1.north east) -- (m-10-1.south east);
        \only<2->{
            \draw[red,thick]
            (m-2-2.north east) --
            (m-3-2.south east) --
            (m-3-3.south east) --
            (m-4-3.south east) --
            (m-4-4.south east) --
            (m-6-4.south east) --
            (m-6-5.south east) --
            (m-6-5.south east) --
            (m-9-5.south east) --
            (m-9-6.south east) --
            (m-10-6.south east)
            ;
            \draw[blue,dashed,thick]
            (m-2-2.north east) --
            (m-2-2.south east) --
            (m-2-4.south east) --
            (m-3-4.south east) --
            (m-3-6.south east) --
            (m-4-6.south east) --
            (m-4-8.south east) --
            (m-5-8.south east) --
            (m-5-9.south east);
        }
    \end{tikzpicture}
\end{block}
\end{frame}

\end{document}

在此处输入图片描述

相关内容