Graphics, Figures & TablesSIUnitX. Columns are too wide; too much white space.

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
gustaf4711
Posts: 6
Joined: Fri Feb 04, 2022 12:17 pm

SIUnitX. Columns are too wide; too much white space.

Post by gustaf4711 »

I use SIunitX to insert a space between every fifth digit when printing numbers to 15 decimals. However the table becomes much too wide, i.e. there is plenty of space between the numbers.

Could anyone please show me what I do badly?

Code: Select all

\sisetup{
       table-number-alignment = center,
       uncertainty-mode = separate,
       round-mode = places,
       round-precision = 15,
       group-digits = all,
       digit-group-size=5,
       group-separator = {\:},
       output-decimal-marker = {\hspace{1pt}.\hspace{1pt}}
      }

\begin{center}
\begin{tabular}{rSS}
 \toprule
    1   &   0.245340708300901   &     0.490921500666745 \\
    2   &   0.737473728545394   &     0.493843385272051 \\
    3   &   1.234076215395325   &     0.499920871336306 \\
    ...\\
  10   &   5.387480890011257   &     0.898591961453085 \\
\bottomrule \\
\end{tabular}
\end{center}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Re: SIUnitX. Columns are too wide; too much white space.

Post by Bartman »

Please try to offer a complete Infominimal working example.

The values ​​of the table-number-alignment and group-digits options are the default settings.

Use the table-format option with a suitable assignment to solve the problem.
gustaf4711
Posts: 6
Joined: Fri Feb 04, 2022 12:17 pm

Re: SIUnitX. Columns are too wide; too much white space.

Post by gustaf4711 »

Thank you for pointing to what I was missing. Below I have added a , hopefully, minimal working example. With the table-format=2.15 it works perfectly.

Best regards,
ChG

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage{a4wide}
\usepackage{siunitx}
\usepackage{booktabs}
\listfiles
\begin{document}
\sisetup{ digit-group-size=5,
          table-format = 1.15,
          output-decimal-marker = {\hspace{1pt}.\hspace{1pt}}
        }
\begin{center}
\begin{tabular}{rSS}
 \toprule
   & \multicolumn{1}{c}{$r_i$} &\multicolumn{1}{c}{$w_i\cdot e^{r_i^2}$}\\
  \midrule
    1   &   0.245340708300901   &     0.490921500666745 \\
    2   &   0.737473728545394   &     0.493843385272051 \\
    3   &   1.234076215395325   &     0.499920871336306 \\
    4   &   1.738537712116587   &     0.509679027117492 \\
    5   &   2.254974002089279   &     0.524080350948597 \\
    6   &   2.788806058428139   &     0.544851742364396 \\
    7   &   3.347854567383536   &     0.575262442850260 \\
    8   &   3.944764040115642   &     0.622278696192320 \\
    9   &   4.603682449550827   &     0.704332961175165 \\
   10   &   5.387480890011257   &     0.898591961453085 \\
\bottomrule \\
\end{tabular}
\end{center}
\end{document}
Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Re: SIUnitX. Columns are too wide; too much white space.

Post by Bartman »

Some notes regarding to the a4wide package:
By the way, the \\ macro after the \bottomrule command can be omitted.
gustaf4711
Posts: 6
Joined: Fri Feb 04, 2022 12:17 pm

Re: SIUnitX. Columns are too wide; too much white space.

Post by gustaf4711 »

Thank you for the lists of obsolete packages as well as the l2tabu (good to train my rusty German)

I add a small modification of the table. After all it had three columns of numbers two of which shall be set in the same way.

Ch

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage{a4wide}
\usepackage{siunitx}
\usepackage{booktabs}
\listfiles
\begin{document}
\sisetup{
       digit-group-size=5,
       output-decimal-marker = {\hspace{1pt}.\hspace{1pt}}
      }
\begin{center}
\begin{tabular}{S[table-format=2.0]*{2}{S[table-format=1.15]}}
 \toprule
   & \multicolumn{1}{c}{$r_i$} &\multicolumn{1}{c}{$w_i\cdot e^{r_i^2}$}\\
  \midrule
    1   &   0.245340708300901   &     0.490921500666745 \\
    2   &   0.737473728545394   &     0.493843385272051 \\
    3   &   1.234076215395325   &     0.499920871336306 \\
    4   &   1.738537712116587   &     0.509679027117492 \\
    5   &   2.254974002089279   &     0.524080350948597 \\
    6   &   2.788806058428139   &     0.544851742364396 \\
    7   &   3.347854567383536   &     0.575262442850260 \\
    8   &   3.944764040115642   &     0.622278696192320 \\
    9   &   4.603682449550827   &     0.704332961175165 \\
   10   &   5.387480890011257   &     0.898591961453085 \\
\bottomrule
\end{tabular}
\end{center}
\end{document}
Post Reply