Information and discussion about graphics, figures & tables in LaTeX documents.
gustaf4711
Posts: 6 Joined: Fri Feb 04, 2022 12:17 pm
Post
by gustaf4711 » Mon Feb 10, 2025 4:48 pm
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}
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide : 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook : 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ : the first book about TikZ for perfect drawings in your LaTeX thesis
Bartman
Posts: 369 Joined: Fri Jan 03, 2020 2:39 pm
Post
by Bartman » Mon Feb 10, 2025 6:58 pm
Please try to offer a complete
minimal 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
Post
by gustaf4711 » Tue Feb 11, 2025 6:15 pm
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
Post
by Bartman » Tue Feb 11, 2025 8:47 pm
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
Post
by gustaf4711 » Wed Feb 12, 2025 3:32 pm
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}