我在投影仪幻灯片上有以下表格。它溢出到右边距。我该如何容纳它
\documentclass{beamer}
\begin{document}
\section {Rockall score}
\begin{frame} {Prognosticate rebleeding and mortality}
\begin{flushleft}
\begin{tabular}{c||cccc}
\hline
Variable & 0 & 1 & 2 & 3 \\ \hline \hline
Age & $<60$ & 60-79 & $> 80 $ & \\
Vitals & $P<100$, $ SBP>100$ & $P>100, SBP>100$ & $SBP<100$ & \\
Comorbidity & No major & & IHD, CCF, other major & Ranal, liver failure , malignancy \\ \hline
\end{tabular}
\end{flushleft}
\end{frame}
\end{document}
答案1
这里有几个选项 - 都对原始表格进行了轻微修改
\begin{tabular}{c||p{.2\textwidth}p{.2\textwidth}p{.2\textwidth}p{.2\textwidth}}
并且我在一些单元格中断掉了几行 - 这种手动调整在处理表格时相当典型,特别是在像beamer
演示文稿这样重要的东西中。
使用makebox
使用resizebox
% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass{beamer}
\begin{document}
\begin{frame} {Original}
\begin{tabular}{c||cccc}
\hline
Variable & 0 & 1 & 2 & 3 \\ \hline \hline
Age & $<60$ & 60-79 & $> 80 $ & \\
Vitals & $P<100$, $ SBP>100$ & $P>100, SBP>100$ & $SBP<100$ & \\
Comorbidity & No major & & IHD, CCF, other major & Ranal, liver failure , malignancy \\ \hline
\end{tabular}
\end{frame}
\begin{frame}{Modification}
\makebox[\textwidth][c]{%
\begin{tabular}{c||p{.2\textwidth}p{.2\textwidth}p{.2\textwidth}p{.2\textwidth}}
\hline
Variable & 0 & 1 & 2 & 3 \\ \hline \hline
Age & $<60$ & 60-79 & $> 80 $ & \\
Vitals & $P<100$,\newline $ SBP>100$ & $P>100\newline SBP>100$ & $SBP<100$ & \\
Comorbidity & No major & & IHD, CCF, other major & Ranal, liver failure, malignancy \\ \hline
\end{tabular}
}
\end{frame}
\begin{frame}{Another modification}
\resizebox{\textwidth}{!}{%
\begin{tabular}{c||p{.2\textwidth}p{.2\textwidth}p{.2\textwidth}p{.2\textwidth}}
\hline
Variable & 0 & 1 & 2 & 3 \\ \hline \hline
Age & $<60$ & 60-79 & $> 80 $ & \\
Vitals & $P<100$,\newline $ SBP>100$ & $P>100\newline SBP>100$ & $SBP<100$ & \\
Comorbidity & No major & & IHD, CCF, other major & Ranal, liver failure, malignancy \\ \hline
\end{tabular}
}
\end{frame}
\end{document}
答案2
\scalebox {0.6}{} 也有效,但我不确定这是正确的方法
\begin{frame} {Prognosticate rebleeding and mortality}
\scalebox {0.6}{
\begin{tabular}{c||cccc}
\hline
Variable & 0 & 1 & 2 & 3 \\ \hline \hline
Age & $<60$ & 60-79 & $> 80 $ & \\
Vitals & $P<100$, $ SBP>100$ & $P>100, SBP>100$ & $SBP<100$ & \\
Comorbidity & No major & & IHD, CCF, other major & Renal, liver failure , malignancy \\ \hline
\end{tabular}}
\end{frame}