我的演示文稿中有下表:
\documentclass[11pt]{beamer}
\setbeamertemplate{headline}{}
\AtBeginSection[]
{
\begin{frame}<beamer>
\tableofcontents[currentsection]
\end{frame}
}
\begin{document}
\begin{frame}
\begin{tabular}
{|| c | c | c||}
\hline
\hline Construct & Formal formulation & Practical formulation \\
\hline
\hline Control & $\phi: H \times \mathcal{T} \to \mathbb{Z}$ & $\langle h_0, \ldots, h_k \rangle \equiv \langle \ldots h_{i,\tau} \ldots \rangle$ \\
\hline Parametrized values & $\psi: \Phi \to \mathbb{Z}$ & Terms of expression language implemented as DAGs. \\
\hline State & $\sigma: L \to \Psi$ & Through derivation, state is read and updated according to the synthesis semantics \\
\hline Set of controls & $\Phi$ & Constraints on the control values \\
\hline
\end{tabular}
\end{frame}
\end{document}
问题是最后一列超出了表格的右边距。我尝试了网站上的几种解决方案,但都没有奏效?
答案1
以下其中一个怎么样:
\documentclass[11pt]{beamer}
\usepackage{tabularx}
\usepackage{booktabs} % Only needed for the third example.
\setbeamertemplate{headline}{}
\AtBeginSection[]
{
\begin{frame}<beamer>
\tableofcontents[currentsection]
\end{frame}
}
\begin{document}
\begin{frame}
\begin{tabularx}{\textwidth}{|| c | c | >{\centering\arraybackslash}X||}
\hline
\hline Construct & Formal formulation & Practical formulation \\
\hline
\hline Control & $\phi: H \times \mathcal{T} \to \mathbb{Z}$ & $\langle h_0, \ldots, h_k \rangle \equiv \langle \ldots h_{i,\tau} \ldots \rangle$ \\
\hline Parametrized values & $\psi: \Phi \to \mathbb{Z}$ & Terms of expression language implemented as DAGs. \\
\hline State & $\sigma: L \to \Psi$ & Through derivation, state is read and updated according to the synthesis semantics \\
\hline Set of controls & $\Phi$ & Constraints on the control values \\
\hline
\end{tabularx}
\end{frame}
\begin{frame}
\begin{tabularx}{\textwidth}{|| p{2.1cm} | p{2.5cm} | >{\centering\arraybackslash}X||}
\hline
\hline Construct & Formal \newline formulation & Practical formulation \\
\hline
\hline Control & $\phi: H \times \mathcal{T} \to \mathbb{Z}$ & $\langle h_0, \ldots, h_k \rangle \equiv \langle \ldots h_{i,\tau} \ldots \rangle$ \\
\hline Parametrized values & $\psi: \Phi \to \mathbb{Z}$ & Terms of expression language implemented as DAGs. \\
\hline State & $\sigma: L \to \Psi$ & Through derivation, state is read and updated according to the synthesis semantics \\
\hline Set of \newline controls & $\Phi$ & Constraints on the control values \\
\hline
\end{tabularx}
\end{frame}
\begin{frame}
\begin{tabularx}{\textwidth}{ p{2.1cm} p{2.5cm} X}
\toprule
Construct & Formal \newline formulation & Practical formulation \\
\midrule
Control & $\phi: H \times \mathcal{T} \to \mathbb{Z}$ & $\langle h_0, \ldots, h_k \rangle \equiv \langle \ldots h_{i,\tau} \ldots \rangle$ \\ \addlinespace
Parametrized values & $\psi: \Phi \to \mathbb{Z}$ & Terms of expression language implemented as DAGs. \\ \addlinespace
State & $\sigma: L \to \Psi$ & Through derivation, state is read and updated according to the synthesis semantics \\ \addlinespace
Set of \newline controls & $\Phi$ & Constraints on the control values \\
\bottomrule
\end{tabularx}
\end{frame}
\end{document}