我有一张大桌子,无法放入带有 Beamer 的幻灯片中,我写道:
\documentclass[10pt]{beamer}
\usetheme{CambridgeUS} % theme
\usepackage{tikz}
\begin{document}
\begin{frame}
\begin{tabular}{|l|l|l|}
\hline
% line 1
&
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node(a1){a}
child{node(b1){b}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture}
&
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{a}
child{node(a2){a} child{node{b}}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture}
\\ \hline
%line 2
$a$ & 1 & 1 \\ \hline
%line 3
$b$ & 2 & 2 \\ \hline
%line 4
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{a}
child{node{a}};
\end{tikzpicture}
& 0 & 0 \\ \hline
%line 4
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{a}
child{node{b}};
\end{tikzpicture}
& 0 & 1 \\ \hline
%line 5
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{b}
child{node{a}};
\end{tikzpicture}
& 0 & 0 \\ \hline
%line 6
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{b}
child{node{a}};
\end{tikzpicture}
& 0 & 0 \\ \hline
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{b}
child{node{a}}child{node{a}} ;
\end{tikzpicture}
& 0 & 0 \\ \hline
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{b}
child{node{b}}child{node{a}} ;
\end{tikzpicture}
& 1 & 1 \\ \hline
$\vdots$ & $\vdots$ & $\vdots$ \\ \hline
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node(a1){a}
child{node(b1){b}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture} & 1 & 0 \\ \hline
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{a}
child{node(a2){a} child{node{b}}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture} & 0 & 1 \\ \hline
$\vdots$ & $\vdots$ & $\vdots$ \\ \hline
\end{tabular}
\end{frame}
\end{document}
结果如下图所示
任何能够解决这个尺寸问题的想法都将受到赞赏。
答案1
为了将内容放到幻灯片上,我将其旋转了 90 度,减少了每个单元格周围的空间,并使用了较小的字体。
\documentclass[10pt]{beamer}
\usetheme{CambridgeUS} % theme
\usepackage{tikz}
\long\def\aa{\relax}%
\long\def\ab{\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{a}
child{node{a}};
\end{tikzpicture} }
\long\def\ac{\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{a}
child{node{b}};
\end{tikzpicture} }
\long\def\ad{\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{b}
child{node{a}};
\end{tikzpicture} }
\long\def\ae{ \begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{b}
child{node{a}};
\end{tikzpicture} }
\long\def\af{ \begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{b}
child{node{a}}child{node{a}} ;
\end{tikzpicture} }
\long\def\ag{ \begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{b}
child{node{b}}child{node{a}} ;
\end{tikzpicture} }
\long\def\ah{ \begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node(a1){a}
child{node(b1){b}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture}}
\long\def\ai{\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{a}
child{node(a2){a} child{node{b}}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture} }
\long\def\ba{\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node(a1){a}
child{node(b1){b}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture}}
\long\def\ca{\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{a}
child{node(a2){a} child{node{b}}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture} }
\begin{document}
\begin{frame}\footnotesize
\renewcommand{\tabcolsep}{.05cm}
\begin{tabular}{|l|l|l|l|l|l|l|l|l|l|l|l|l|}\hline
\aa&$a$&$b$&\ab&\ac&\ad&\ae&\af&\ag&$\hdots$&\ah&\ai&$\hdots$\\ \hline
\ba& 1 & 2 & 0 & 0 & 0 & 0& 0& 1&$\hdots$& 1& 0&$\hdots$\\ \hline
\ca& 1 & 2 & 0 & 1 & 0 & 0& 0& 1&$\hdots$& 0& 1&$\hdots$\\ \hline
\end{tabular}
\end{frame}
\tikzset{grow'=right}
\begin{tabular}{|l|l|l|}
\hline
% line 1
&
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node(a1){a}
child{node(b1){b}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture}
&
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node{a}
child{node(a2){a} child{node{b}}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture}
\\ \hline
%line 2
$a$ & 1 & 1 \\ \hline
%line 3
$b$ & 2 & 2 \\ \hline
%line 4
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node{a}
child{node{a}};
\end{tikzpicture}
& 0 & 0 \\ \hline
%line 4
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node{a}
child{node{b}};
\end{tikzpicture}
& 0 & 1 \\ \hline
%line 5
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node{b}
child{node{a}};
\end{tikzpicture}
& 0 & 0 \\ \hline
%line 6
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node{b}
child{node{a}};
\end{tikzpicture}
& 0 & 0 \\ \hline
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node{b}
child{node{a}}child{node{a}} ;
\end{tikzpicture}
& 0 & 0 \\ \hline
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node{b}
child{node{b}}child{node{a}} ;
\end{tikzpicture}
& 1 & 1 \\ \hline
$\vdots$ & $\vdots$ & $\vdots$ \\ \hline
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node(a1){a}
child{node(b1){b}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture} & 1 & 0 \\ \hline
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node{a}
child{node(a2){a} child{node{b}}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture} & 0 & 1 \\ \hline
$\vdots$ & $\vdots$ & $\vdots$ \\ \hline
\end{tabular}
\end{document}
这是另一个版本,方向与您的相同,但间距已缩小。通过查看 Tikz 手册,可以全局设置一些重复的参数以缩小代码。
\documentclass[10pt]{beamer}
\usetheme{CambridgeUS} % theme
\usepackage{tikz}
\begin{document}\tiny
\renewcommand{\arraystretch}{.5}
\begin{frame}
\begin{tabular}{|l|l|l|}
\hline
% line 1
&
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node(a1){a}
child{node(b1){b}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture}
&
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node{a}
child{node(a2){a} child{node{b}}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture}
\\ \hline
%line 2
$a$ & 1 & 1 \\ \hline
%line 3
$b$ & 2 & 2 \\ \hline
%line 4
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node{a}
child{node{a}};
\end{tikzpicture}
& 0 & 0 \\ \hline
%line 4
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node{a}
child{node{b}};
\end{tikzpicture}
& 0 & 1 \\ \hline
%line 5
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node{b}
child{node{a}};
\end{tikzpicture}
& 0 & 0 \\ \hline
%line 6
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.5]
\node{b}
child{node{a}};
\end{tikzpicture}
& 0 & 0 \\ \hline
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node{b}
child{node{a}}child{node{a}} ;
\end{tikzpicture}
& 0 & 0 \\ \hline
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node{b}
child{node{b}}child{node{a}} ;
\end{tikzpicture}
& 1 & 1 \\ \hline
$\vdots$ & $\vdots$ & $\vdots$ \\ \hline
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node(a1){a}
child{node(b1){b}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture} & 1 & 0 \\ \hline
\begin{tikzpicture} [every fit/.style={ellipse,draw,red,inner sep=-2pt},scale=0.25]
\node{a}
child{node(a2){a} child{node{b}}}
child{node{b} child{node{b}} child{node{a}}};
\end{tikzpicture} & 0 & 1 \\ \hline
$\vdots$ & $\vdots$ & $\vdots$ \\ \hline
\end{tabular}
\end{frame}
\end{document}