0

I have this table:

% \usepackage{booktabs}


\begin{table*}
\centering
\begin{adjustbox}{max width=\columnwidth}
{\setlength{\extrarowheight}{5pt}%
\begin{tabular}{llllll} 
\toprule
  & Our Solution & {[}10] & {[}12] & {[}18] & {[}19]  \\ 
\hline
Y & x            & x      & x      & x      & x       \\ 
\hline
Y & x            & x      & x      & x      & x       \\ 
\hline
Y & x            & x      & x~     & x      & x       \\ 
\hline
Y & x            & x      & x      & x      & x       \\ 
\hline
Y & x            & x      & x      & x      & x       \\
\bottomrule
\end{tabular}}
\end{table*}

I want it to look like this, but no matter what I try it never works, either the font is too small or the table looks too small:

enter image description here

1 Answer 1

1

If you're having trouble making your table fit, see My table doesn't fit; what are my options?. Below is your table, made to fit within the default text width via these methods:

  • Reduced the lengthy final column: Cost in USD -> Cost (USD)

  • Reduced the \tabcolsep by 30%: \setlegnth{\tabcolsep}{0.7\tabcolsep}

enter image description here

\documentclass{article}

 \usepackage{booktabs}

\begin{document}

\begin{table}
  \centering
  \setlength{\tabcolsep}{0.7\tabcolsep}% Reduce column separation by 30%
  \begin{tabular}{ c l r r }
  \toprule
  Smart contact    & Function name                 & Gas usage & Cost (USD) \\ 
  \midrule
  Registration     & Deployment                    & 1,072,013 &      68.17 \\
                   & registerStakeholder           &    58,218 &       3.70 \\
                   & isStakeholderRegistered(view) &    35,000 &       2.22 \\
  \addlinespace % \midrule
  Compliance       & Deployment                    & 2,011,085 &     127.89 \\
                   & submitCertification           &   117,087 &       7.44 \\
                   & approveCertification          &    48,334 &       3.07 \\
  \addlinespace % \midrule
  Garment tracking & Deployment                    &   752,071 &      47.82 \\
                   & createBatch                   &   162,391 &      10.32 \\
                   & getBatch(view)                &    30,000 &       1.90 \\
  \bottomrule
\end{tabular}
\end{table}

\end{document}

You can further consider using siunitx to format your final columns for consistency, rather than doing it manually.

1
  • Thank you so much!
    – CyberSham
    Commented Apr 29, 2023 at 11:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .