如何使用表格绘制表格
\documentclass{beamer}
\begin{document}
\begin{frame}{Cs}
\centering
\begin{table}
\centering
\caption{C}
\begin{tabular}{|l|l|}
\hline
u & i\\
\hline
~58Ko & ~1Mo.\\
\hline
DqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsd. & FDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsdDqsdqsdqsdqsd.
\end{tabular}
\end{table}
\end{frame}
\end{document}
使用这个,我得到了一个溢出框架的大表。请问如何修复这个问题?
答案1
、l
或列类型不允许文本换行;如果要文本换行,则需要使用列类型r
:c
p{<length>}
\documentclass{beamer}
\begin{document}
\begin{frame}
\frametitle{Test frame}
\begin{table}
\centering
\caption{A test table}
\begin{tabular}{|p{5cm}|p{5cm}|}
\hline
u & i \\
\hline
~58Ko & ~1Mo.\\
\hline
text text text text text text text text text text text text text text text text text
&
text text text text text text text text text text text text text text text text text \\
\hline
\end{tabular}
\end{table}
\end{frame}
\end{document}
同一张表使用booktabs
(特别是没有垂直规则):
\documentclass{beamer}
\usepackage{booktabs}
\begin{document}
\begin{frame}
\frametitle{Test frame}
\begin{table}
\centering
\caption{A test table}
\begin{tabular}{p{5cm}p{5cm}}
\toprule
u & i \\
\midrule
~58Ko & ~1Mo.\\
text text text text text text text text text text text text text text text text text
&
text text text text text text text text text text text text text text text text text \\
\bottomrule
\end{tabular}
\end{table}
\end{frame}
\end{document}