![桌子看起来像一个块](https://linux22.com/image/253715/%E6%A1%8C%E5%AD%90%E7%9C%8B%E8%B5%B7%E6%9D%A5%E5%83%8F%E4%B8%80%E4%B8%AA%E5%9D%97.png)
目标是创建一个与所用主题块具有相同样式的表格,以便在整个文档中拥有一致的样式。这可以通过代码中显示的以下两种方法来实现。最后的调整是添加漂亮的水平线和垂直线来分隔“单元格”。我尝试使用表格,但垂直线被分开了,有什么方法可以使其完美/完全做到这一点吗?
\documentclass{beamer}
\usetheme{Berlin}
\setbeamertemplate{blocks}[rounded][shadow=true]
\usepackage[USenglish]{babel}
\usepackage{times}
\usepackage{tikz}
\usepackage{parskip}
\begin{document}
% Methode 1
\begin{frame}[t]
\tikzset{blocknode/.style={inner sep=0,text width=0.5\textwidth,below right}}
\begin{block}{\tikz{\node[blocknode] {asdf}; \node[blocknode] at (0.5\textwidth,0) {qwertz};}}
\begin{tikzpicture}
\node[blocknode] {\begin{itemize}\item a\item b\end{itemize}};
\node[blocknode] at (0.5\textwidth,0) {\begin{itemize}\item c\item d\end{itemize}};
\end{tikzpicture}
\end{block}
% Methode 2
\begin{block}{
\begin{center}
\begin{tabular}{p{0.45\textwidth}|p{0.45\textwidth}}
1 & 2 \\
\end{tabular}
\end{center}}
\begin{center}
\begin{tabular}{p{0.45\textwidth}|p{0.45\textwidth}}
\begin{itemize}\item 3\end{itemize} &
\begin{itemize}\item 4\end{itemize}\\ \hline
\begin{itemize}\item 5\end{itemize} &
\begin{itemize}\item 6\end{itemize} \\ \hline
\begin{itemize}\item 7\end{itemize} &
\begin{itemize}\item 8\end{itemize} \\
\end{tabular}
\end{center}
\end{block}
\end{frame}
\end{document}
答案1
在方法 2 中,您可以创建一个空的块标题,然后将表格向上一点:
\documentclass{beamer}
\usetheme{Berlin}
\setbeamertemplate{blocks}[rounded][shadow=true]
\usepackage[USenglish]{babel}
\usepackage{times}
\usepackage{tikz}
\usepackage{parskip}
\begin{document}
\begin{frame}[t]
% Methode 2
\begin{block}{~\vspace{0.7cm}}
\begin{center}
\vspace{-0.8cm}
\begin{tabular}{p{0.45\textwidth}|p{0.45\textwidth}}
\textcolor{white}{\bf Head 1} & \textcolor{white}{\bf Head 2} \\
\begin{itemize}\item 3\end{itemize} &
\begin{itemize}\item 4\end{itemize}\\ \hline
\begin{itemize}\item 5\end{itemize} &
\begin{itemize}\item 6\end{itemize} \\ \hline
\begin{itemize}\item 7\end{itemize} &
\begin{itemize}\item 8\end{itemize} \\
\end{tabular}
\end{center}
\end{block}
\end{frame}
\end{document}