1

I am trying to adjust the size of the table, so that the table is more aligned with the text. because it reaches the end of the page.

Thanks.

\usepackage{siunitx}
\usepackage{booktabs}

\begin{tabular}{ l *{6}{S[table-format=1.4]} S[table-format=5] S[table-format=3.2] } \toprule \multicolumn{1}{c}{Componente} & \multicolumn{2}{c}{} & \multicolumn{2}{c}{Pico} & \multicolumn{2}{c}{Reposo} \ \cmidrule(lr){4-5} \cmidrule(lr){6-7} & {Cantidad} & {Voltaje} & {Corriente(mA)} & {Potencia(W)} & {Corriente(mA)} & {Potencia(W)} \ \midrule Subisistema & 1 & 3.3 & 19.506 & 0.076 & 4.454 & 0.0175 \ ADCS & & & & & & \

\bottomrule \end{tabular}

enter image description here

DMatheu
  • 13
  • Welcome to TeX.SX! My table doesn't fit; what are my options? contains a list of approaches that can be used to make sure a table fits into the available space. – leandriis May 29 '21 at 21:56
  • 1
    For this particular table, I'd split the headers and their units into two lines. Combined with a slightly decreased \tabcolsep and probably a smaller font size for the column headers you should be able to fit the table into the textwidth. For more specific advice, please make your code compilable by adding the documentclass. (See also: minimal working example (MWE)) – leandriis May 29 '21 at 21:56
  • Unrelated to the issue of the table being too wide, but the number of columns you declare does not match the number of yolumns you actually use. Also, the table-format options of the S type columns do not match the contents of these columns. I would expect something like \begin{tabular}{ l S[table-format=1] S[table-format=1.1] S[table-format=2.3] S[table-format=1.3] S[table-format=1.3] S[table-format=1.4] } instead. – leandriis May 29 '21 at 21:58

1 Answers1

1

Putting the units in another row and using \begin{tabular*}{\textwidth}{% will fit the table on the page.

If more space were needed "Cantidad" could be abbreviated as "Cant."

b

\documentclass[12pt,a4paper]{article}

\usepackage[load=prefix]{siunitx} \usepackage{booktabs}

\begin{document} \begin{table} \centering \setlength{\tabcolsep}{4pt} \begin{tabular}{\textwidth}{% @{\extracolsep{\fill}} l S[table-format=1.0] S[table-format=2.3] S[table-format=3.2] S[table-format=1.3] S[table-format=1.3] S[table-format=1.3] S[table-format=1.4] @{}
} \toprule Componente &\multicolumn{2}{c}{} &\multicolumn{2}{c}{Pico} & \multicolumn{2}{c}{Reposo} \ \cmidrule(lr){4-5} \cmidrule(lr){6-7} &{Cantidad} &{Voltaje} &{Corriente} &{Potencia} &{Corriente} & {Potencia} \ & &{(\si{\volt})} &{(\si{\milli\ampere})} &{(\si{\watt})} &{(\si{\milli\ampere})} &{(\si{\watt})} \ \midrule Subsistema & 1 & 3.3 & 19.506 & 0.076 & 4.454 & 0.0175 \ ADCS & & & & & & \
\bottomrule \end{tabular
} \caption{A table} \end{table}

\end{document}

Simon Dispa
  • 39,141