3

I have following table on beamer slide. It overflows into right margin. How can I accomodate it

\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}
Vaibhav
  • 6,625
  • 15
  • 49
  • 76

2 Answers2

3

Here are a couple of options- both have a slight modification to your original table

\begin{tabular}{c||p{.2\textwidth}p{.2\textwidth}p{.2\textwidth}p{.2\textwidth}}

and I have broken a couple of lines in some of the cells- such manual tweaking is fairly typical when working with tables, especially in something as important as a beamer presentation.

Use makebox

first modification

Use resizebox

second modification

% 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}
cmhughes
  • 100,947
0

\scalebox {0.6}{} also worked, though I am not sure it is correct way to do it

\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}
Vaibhav
  • 6,625
  • 15
  • 49
  • 76