Ajustar tabla en texto

Ajustar tabla en texto

Hice una tabla pero tengo el siguiente problema: no cabe dentro del ancho del texto. Intenté solucionarlo con \adjustbox y \tabularx, ambos sin éxito (se vuelve demasiado pequeño y casi ilegible). Me preguntaba si hay otra opción para que las mesas luzcan mejor. Os dejo aquí mi código y el resultado del mismo:

\begin{center}
    \begin{tabular}{ccccc}
    \hline
    Verification & Deterministic Versions Comparison & Expected Outcome & True? & Proof \\
    \hline
    1     & Current allocation vs. Optimized & Optimized - Cheaper allocation & Yes & \euro 411,03M vs. \euro 405,82M \\
    
    2     & Optimized vs. Capacity constrained (no UK-EUR) & Optimized - Cheaper allocation & Yes & \euro 405,82M vs.\euro 406,40M \\
    
    3     & Capacity constrained (no UK-EUR) vs. 70\%-30\% volume split by brewery (no UK-EUR) & Capacity constrained (no UK-EUR) - Cheaper allocation & Yes & \euro 406,40M vs. \euro 407,05M \\
  
    4     & 70\%-30\% volume split by brewery (no UK-EUR) vs. Sustainable version (no UK-EUR) & Sustainable version (no UK-EUR) - Lower transportation costs & Yes & \euro 16,79M vs. \euro 14,40M \\
     \hline
    \end{tabular}
      \caption{Verification of the expected outcomes of the versions of the deterministic model.}
    \end{center}

ingrese la descripción de la imagen aquí

¡¡Muchas gracias!!

Respuesta1

Debe dividir el texto largo de las celdas en más líneas:

\documentclass{article}
\usepackage{geometry}
\usepackage{eurosym}
\usepackage{booktabs, makecell, tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}

\begin{document}
\begin{table}[ht]
\setcellgapes{3pt}
\makegapedcells
\begin{tabularx}{\linewidth}{@{}cLLcL@{}}
\toprule
Ver. & Deterministic Versions Comparison & Expected Outcome & True? & Proof \\
\midrule
1     & Current allocation vs. Optimized & Optimized - Cheaper allocation & Yes & \euro 411,03M vs. \euro 405,82M \\

2     & Optimized vs. Capacity constrained (no UK-EUR) & Optimized - Cheaper allocation & Yes & \euro 405,82M vs.\euro 406,40M \\

3     & Capacity constrained (no UK-EUR) vs. 70\%-30\% volume split by brewery (no UK-EUR) & Capacity constrained (no UK-EUR) - Cheaper allocation & Yes & \euro 406,40M vs. \euro 407,05M \\

4     & 70\%-30\% volume split by brewery (no UK-EUR) vs. Sustainable version (no UK-EUR) & Sustainable version (no UK-EUR) - Lower transportation costs & Yes & \euro 16,79M vs. \euro 14,40M \\
 \bottomrule
\end{tabularx}
  \caption{Verification of the expected outcomes of the versions of the deterministic model. Ver. is abbreviation for Verification.}
\end{table}
\end{document}

ingrese la descripción de la imagen aquí

Respuesta2

Probablemente pueda permitir saltos de línea dentro de las celdas de la tabla.

Además de esto, probablemente puedas rotar las mesas que sean demasiado anchas.

\documentclass{article}
\usepackage{microtype}
\usepackage{graphicx}%
\usepackage[official]{eurosym}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{array}
\usepackage{varwidth}
\newsavebox\tablebox

\newcolumntype{L}[1]{%
  >{%
     \raggedright
     \hsize=#1\hsize
     \begin{varwidth}[t]{\hsize}%
     \narrowragged
     \hyphenpenalty=50
     \exhyphenpenalty=50
     \doublehyphendemerits=50
     \let\newline\\%
     \arraybackslash
     \hspace{0pt}%
     \vrule width 0pt height 1.25\ht\strutbox depth 0pt %
   }%
  X%
  <{%
     \vrule width 0pt height 0pt depth \dimexpr1.25\ht\strutbox-\ht\strutbox+\dp\strutbox
     \end{varwidth}%
   }%
}

\newcolumntype{C}[1]{%
  >{%
     \centering
     \hsize=#1\hsize
     \begin{varwidth}[t]{\hsize}%
     \narrowragged
     \hyphenpenalty=50
     \exhyphenpenalty=50
     \doublehyphendemerits=50
     \let\newline\\%
     \arraybackslash
     \hspace{0pt}%
     \vrule width 0pt height 1.25\ht\strutbox depth 0pt %
   }%
  X%
  <{%
     \vrule width 0pt height 0pt depth \dimexpr1.25\ht\strutbox-\ht\strutbox+\dp\strutbox
     \end{varwidth}%
   }%
}

\fboxsep=-\fboxrule

\begin{document}

\noindent text text text text text text text text text\linebreak

\savebox\tablebox{%
   \begin{tabularx}{\textwidth}{@{}C{.6}L{1.5}L{1.4}C{0.55}L{.95}@{}}%
   \toprule
   Veri\-fi\-ca\-tion&Deterministic Versions Comparison&Expected Outcome&True?&Proof\\
   \midrule
   1 & Current allocation vs. Optimized & Optimized~-- Cheaper allocation & Yes & \euro 411,03M vs. \euro 405,82M \\
   2 & Optimized vs. Capacity constrained (no UK-EUR) & Optimized~-- Cheaper allocation & Yes & \euro 405,82M vs. \euro 406,40M \\
   3 & Capacity constrained (no UK-EUR) vs. 70\%-30\% volume split by brewery (no UK-EUR) & Capacity constrained (no UK-EUR)~-- Cheaper allocation & Yes & \euro 406,40M vs. \euro 407,05M \\
   4 & 70\%-30\% volume split by brewery (no UK-EUR) vs. Sustainable version (no UK-EUR) & Sustainable version (no UK-EUR)~-- Lower transportation costs & Yes & \euro 16,79M vs. \euro 14,40M\\
   \bottomrule
   \end{tabularx}%
}%

\begin{table}
%\centering
%\rotatebox[origin=c]{0}{%
   \begin{minipage}{\wd\tablebox}%
   \usebox{\tablebox}%
   \caption{Verification of the expected outcomes of the versions of the deterministic model.}%
   \end{minipage}%
%}%
\end{table}


\newpage

\noindent text text text text text text text text text\linebreak

\savebox\tablebox{%
   \begin{tabularx}{1.25\textwidth}{@{}C{.5}L{1.9}L{1.45}C{0.35}L{.8}@{}}%
   \toprule
   Veri\-fi\-ca\-tion&Deterministic Versions Comparison&Expected Outcome&True?&Proof\\
   \midrule
   1 & Current allocation vs. Optimized & Optimized~-- Cheaper allocation & Yes & \euro 411,03M vs. \euro 405,82M \\
   2 & Optimized vs. Capacity constrained (no UK-EUR) & Optimized~-- Cheaper allocation & Yes & \euro 405,82M vs. \euro 406,40M \\
   3 & Capacity constrained (no UK-EUR) vs. 70\%-30\% volume split by brewery (no UK-EUR) & Capacity constrained (no UK-EUR)~-- Cheaper allocation & Yes & \euro 406,40M vs. \euro 407,05M \\
   4 & 70\%-30\% volume split by brewery (no UK-EUR) vs. Sustainable version (no UK-EUR) & Sustainable version (no UK-EUR)~-- Lower transportation costs & Yes & \euro 16,79M vs. \euro 14,40M\\
   \bottomrule
   \end{tabularx}%
}%

\begin{table}
\centering
\rotatebox[origin=c]{90}{%
   \begin{minipage}{\wd\tablebox}%
   \usebox{\tablebox}%
   \caption{Verification of the expected outcomes of the versions of the deterministic model.}%
   \end{minipage}%
}%
\end{table}


\end{document}

ingrese la descripción de la imagen aquí

ingrese la descripción de la imagen aquí

información relacionada