3

I've gone through posts like Shrink table to fit on a page, or keep it as it is and Fitting tables into beamer with no success.

Here is what I've been trying:

\documentclass[aspectratio=169, hyperref={pdfpagelabels=false}]{beamer}
%\documentclass[handout, hyperref={pdfpagelabels=false}]{beamer}
\usetheme{Madrid} 
\let\Tiny=\tiny
\usepackage{multimedia}
%\usepackage[backend=bibtex,style=authoryear]{biblatex}
\usecolortheme{whale} 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[spanish]{babel}
\usefonttheme{professionalfonts}  
\usenavigationsymbolstemplate{} 
\setbeamertemplate{footline}[frame number]
\setbeamertemplate{frametitle}[default][center]
\setbeamersize{text margin left=2em,text margin right=2em}
\usepackage{adjustbox}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{float}
\usepackage[flushleft]{threeparttable}
\floatstyle{plaintop}
\usepackage{siunitx}

\begin{document}
\begin{frame}{Resultados}
\begin{table}[H]
\centering
\begin{adjustbox}{max height=0.3\textheight , max width=0.8\textwidth}
\begin{threeparttable}
\caption{Estimación de p$K_\text{a}$ para ácidos y alcoholes}\label{table:estimacion_pka_RM1}
\begin{tabular}{lccccc}
\toprule
 & \textbf{} & \multicolumn{4}{c}{RM1} \\  \cmidrule(lr){3-6}
 &  & \multicolumn{2}{c}{COSMO} & \multicolumn{2}{c}{SS-COSMO} \\  \cmidrule(lr){3-4}\cmidrule(lr){5-6}
 & p$K\text{a}_{\text{exp}}$\SI{298}{K} & p$K\text{a}_{\text{calc}}$ & $\Delta$p$K\text{a}$ & p$K\text{a}_{\text{calc}}$ & $\Delta$p$K\text{a}$ \\  \midrule
\textbf{Ácidos}&  &  &  &  &  \\  
acético & 4.75 & 2.1 & 2.6 & 4.2 & 0.6 \\  
fluoroacético & 2.59 & -0.8 & 3.3 & -0.8 & 3.4 \\  
fórmico & 3.75 & ref & - & ref & - \\  
pirúvico & 2.39 & -3.0 & 5.4 & 0.7 & 1.7 \\  
glioxílico & 3.18 & -2.3 & 5.5 & 0.4 & 2.8 \\  
propanoico & 4.86 & 2.3 & 2.5 & 3.9 & 0.9 \\  
butanoico & 4.83 & 2.6 & 2.3 & 4.2 & 0.7 \\  
acrílico & 4.25 & 2.0 & 2.3 & 1.0 & 3.3 \\  
láctico & 3.86 & 0.7 & 3.2 & 5.0 & -1.2 \\  
benzoico & 4.2 & 1.1 & 3.1 & 1.6 & 2.6 \\  
MAE &  &  & 3.1 &  & 1.8 \\  \bottomrule
\end{tabular}
\begin{tablenotes}
\footnotesize
\item {Comparación de p$K\text{a}$ calculados con RM1 y dos estrategias de solvatación: implícita (COSMO) y explícita-implícita(SS-COSMO). $\Delta$p$K\text{a}$ =p$K\text{a}_{\text{exp}}$-p$K\text{a}_{\text{calc}}$.}
\end{tablenotes}
\end{threeparttable}
\end{adjustbox}
\end{table}
\end{frame}

\end{document}

As you can see below, the output is too large:

image

Any idea how to diminish table's height?

2
  • Take a look here too : tex.stackexchange.com/questions/301549/…... You will possibly need to break the table manually
    – koleygr
    Oct 12, 2017 at 19:04
  • 1
    Just use the width in your adjastbox and finish table before line : "propanoico & 4.86 & 2.3 & 2.5 & 3.9 & 0.9 \\" . Then start A new tabular (with same headers if you want) from the above line to the end of table. (use caption package to give \captionof{table}{Your caption here} and avoid table environment (just a tabular is enough))
    – koleygr
    Oct 12, 2017 at 19:11

1 Answer 1

5

To start with a quote from the beamer user guide:

Never use a smaller font size to “fit more on a frame.” Never ever use the evil option shrink.

So please use the following solution at your own risk!

    \documentclass[aspectratio=169, hyperref={pdfpagelabels=false}]{beamer}
%\documentclass[handout, hyperref={pdfpagelabels=false}]{beamer}
\usetheme{Madrid} 
\let\Tiny=\tiny
\usepackage{multimedia}
%\usepackage[backend=bibtex,style=authoryear]{biblatex}
\usecolortheme{whale} 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[spanish]{babel}
\usefonttheme{professionalfonts}  
\usenavigationsymbolstemplate{} 
\setbeamertemplate{footline}[frame number]
\setbeamertemplate{frametitle}[default][center]
\setbeamersize{text margin left=2em,text margin right=2em}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage[flushleft]{threeparttable}
\usepackage{siunitx}

\begin{document}

\begin{frame}[shrink=25]{Resultados}
    \centering
    \begin{threeparttable}
        \caption{Estimación de p$K_\text{a}$ para ácidos y alcoholes}\label{table:estimacion_pka_RM1}
        \begin{tabular}{lccccc}
            \toprule
             & \textbf{} & \multicolumn{4}{c}{RM1} \\  \cmidrule(lr){3-6}
             &  & \multicolumn{2}{c}{COSMO} & \multicolumn{2}{c}{SS-COSMO} \\  \cmidrule(lr){3-4}\cmidrule(lr){5-6}
             & p$K\text{a}_{\text{exp}}$\SI{298}{K} & p$K\text{a}_{\text{calc}}$ & $\Delta$p$K\text{a}$ & p$K\text{a}_{\text{calc}}$ & $\Delta$p$K\text{a}$ \\  \midrule
            \textbf{Ácidos}&  &  &  &  &  \\  
            acético & 4.75 & 2.1 & 2.6 & 4.2 & 0.6 \\  
            fluoroacético & 2.59 & -0.8 & 3.3 & -0.8 & 3.4 \\  
            fórmico & 3.75 & ref & - & ref & - \\  
            pirúvico & 2.39 & -3.0 & 5.4 & 0.7 & 1.7 \\  
            glioxílico & 3.18 & -2.3 & 5.5 & 0.4 & 2.8 \\  
            propanoico & 4.86 & 2.3 & 2.5 & 3.9 & 0.9 \\  
            butanoico & 4.83 & 2.6 & 2.3 & 4.2 & 0.7 \\  
            acrílico & 4.25 & 2.0 & 2.3 & 1.0 & 3.3 \\  
            láctico & 3.86 & 0.7 & 3.2 & 5.0 & -1.2 \\  
            benzoico & 4.2 & 1.1 & 3.1 & 1.6 & 2.6 \\  
            MAE &  &  & 3.1 &  & 1.8 \\  \bottomrule
        \end{tabular}
        \begin{tablenotes}
            \footnotesize
            \item {Comparación de p$K\text{a}$ calculados con RM1 y dos estrategias de solvatación: implícita (COSMO) y explícita-implícita(SS-COSMO). $\Delta$p$K\text{a}$ =p$K\text{a}_{\text{exp}}$-p$K\text{a}_{\text{calc}}$.}
        \end{tablenotes}
    \end{threeparttable}
\end{frame}

\end{document}

enter image description here


In case the font becomes too small, an alternative could be to transpose the table. Based on https://tex.stackexchange.com/a/32690/36296 a quick test:

\documentclass[aspectratio=169, hyperref={pdfpagelabels=false}]{beamer}
%\documentclass[handout, hyperref={pdfpagelabels=false}]{beamer}
\usetheme{Madrid} 
\let\Tiny=\tiny
\usepackage{multimedia}
%\usepackage[backend=bibtex,style=authoryear]{biblatex}
\usecolortheme{whale} 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[spanish]{babel}
\usefonttheme{professionalfonts}  
\usenavigationsymbolstemplate{} 
\setbeamertemplate{footline}[frame number]
\setbeamertemplate{frametitle}[default][center]
\setbeamersize{text margin left=2em,text margin right=2em}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage[flushleft]{threeparttable}
\usepackage{siunitx}

\usepackage{adjustbox}
\usepackage{array}

\newcolumntype{R}[2]{%
    >{\adjustbox{angle=#1,lap=\width-(#2)}\bgroup}%
    l%
    <{\egroup}%
}
\newcommand*\rot{\multicolumn{1}{R{45}{0.1em}}}% no optional argument here, please!

\begin{document}

\begin{frame}[shrink=25]{Resultados}
    \centering
    \begin{threeparttable}
        \caption{Estimación de p$K_\text{a}$ para ácidos y alcoholes}\label{table:estimacion_pka_RM1}
        \begin{tabular}{lccccc}
            \toprule
             & \textbf{} & \multicolumn{4}{c}{RM1} \\  \cmidrule(lr){3-6}
             &  & \multicolumn{2}{c}{COSMO} & \multicolumn{2}{c}{SS-COSMO} \\  \cmidrule(lr){3-4}\cmidrule(lr){5-6}
             & p$K\text{a}_{\text{exp}}$\SI{298}{K} & p$K\text{a}_{\text{calc}}$ & $\Delta$p$K\text{a}$ & p$K\text{a}_{\text{calc}}$ & $\Delta$p$K\text{a}$ \\  \midrule
            \textbf{Ácidos}&  &  &  &  &  \\  
            acético & 4.75 & 2.1 & 2.6 & 4.2 & 0.6 \\  
            fluoroacético & 2.59 & -0.8 & 3.3 & -0.8 & 3.4 \\  
            fórmico & 3.75 & ref & - & ref & - \\  
            pirúvico & 2.39 & -3.0 & 5.4 & 0.7 & 1.7 \\  
            glioxílico & 3.18 & -2.3 & 5.5 & 0.4 & 2.8 \\  
            propanoico & 4.86 & 2.3 & 2.5 & 3.9 & 0.9 \\  
            butanoico & 4.83 & 2.6 & 2.3 & 4.2 & 0.7 \\  
            acrílico & 4.25 & 2.0 & 2.3 & 1.0 & 3.3 \\  
            láctico & 3.86 & 0.7 & 3.2 & 5.0 & -1.2 \\  
            benzoico & 4.2 & 1.1 & 3.1 & 1.6 & 2.6 \\  
            MAE &  &  & 3.1 &  & 1.8 \\  \bottomrule
        \end{tabular}
        \begin{tablenotes}
            \footnotesize
            \item {Comparación de p$K\text{a}$ calculados con RM1 y dos estrategias de solvatación: implícita (COSMO) y explícita-implícita(SS-COSMO). $\Delta$p$K\text{a}$ =p$K\text{a}_{\text{exp}}$-p$K\text{a}_{\text{calc}}$.}
        \end{tablenotes}
    \end{threeparttable}
\end{frame}

\begin{frame}
    \frametitle{{Resultados}}
    \centering
    \renewcommand{\tabcolsep}{0.15cm}
    \renewcommand{\arraystretch}{1.2}
    \begin{threeparttable}
        \caption{Estimación de p$K_\text{a}$ para ácidos y alcoholes}
        \begin{tabular}{lll*{11}S}
            & & & \rot{acético} & \rot{fluoroacético} & \rot{fórmico} & \rot{pirúvico} & \rot{glioxílico} & \rot{propanoico} & \rot{butanoico} & \rot{acrílico} & \rot{láctico} & \rot{benzoico} &  \rot{MAE}\\
            \toprule
            && p$K\text{a}_{\text{exp}}$\SI{298}{K} & 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2\\[1em]
            \multirow[c]{4}{*}{RM1} & \multirow[c]{2}{*}{COSMOS} & p$K\text{a}_{\text{calc}}$  & 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2\\
            && $\Delta$p$K\text{a}$  & 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2\\[1em]
            & \multirow[c]{2}{*}{SS-COSMOS} & p$K\text{a}_{\text{calc}}$  & 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2\\
            && $\Delta$p$K\text{a}$  & 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2& 4.2\\
            \bottomrule
        \end{tabular}
        \begin{tablenotes}
            \footnotesize
            \item {Comparación de p$K\text{a}$ calculados con RM1 y dos estrategias de solvatación: implícita (COSMO) y explícita-implícita(SS-COSMO). $\Delta$p$K\text{a}$ =p$K\text{a}_{\text{exp}}$-p$K\text{a}_{\text{calc}}$.}
        \end{tablenotes}
    \end{threeparttable}
\end{frame}

\end{document}

enter image description here

4
  • 1
    Thanks, first phrase is a bit disturbing. As you can see data was taken out of prison..
    – user134500
    Oct 12, 2017 at 19:21
  • @samcarter by using '[shrink=25]' it is appearing in the left. \centering is obsolete. How to make it to the center. Sep 28, 2018 at 6:20
  • @rudreshdwivedi Can you make a MWE that reproduces your problem? \centering is not obsolete. Sep 28, 2018 at 8:11
  • can this solution spand multiple frames (like longtable)?
    – Sal Jr
    Oct 15, 2021 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy