Table Formatting using siunitx
I am trying to make a table with four columns: three of the columns are to be center aligned, and one is to be aligned by decimal places ( using S[table-format=3.2]
). Here is my code:
documentclass{article}
usepackage{siunitx}
usepackage{booktabs}
begin{document}
begin{tabular}{c c S[table-format=3.2] c}
toprule
multicolumn{4}{c}{SI Prefixes} \
%hline hline
midrule midrule
Prefix & Symbol & Multiplication Factor & $ldots$ in Scientific Notation \
midrule
giga & G & 1000000000 & $10^9$ \
mega & M & 1000000 & $10^6$ \
kilo & k & 1000 & $10^3$ \
deca & D & 10 & $10^1$ \
rowcolor{gray!20} - & - & 1 & $10^0$ \
deci & d & 0.1 & $10^{-1}$ \
centi & c & 0.01 & $10^{-2}$ \
milli & m & 0.001 & $10^{-3}$ \
micro & $mu$ & 0.000001 & $10^{-6}$ \
nano & n & 0.000000001 & $10^{-9}$ \
bottomrule
end{tabular}
end{document}
However, here is my result:
The columns are overlapping, and I cannot figure out how to fix it. I can't think of a way to set the width of the third column, as that would fix the issue, but to my understanding, you can only fix the width by doing something like p{5cm}
; the S
type will not allow that.
tables siunitx
add a comment |
I am trying to make a table with four columns: three of the columns are to be center aligned, and one is to be aligned by decimal places ( using S[table-format=3.2]
). Here is my code:
documentclass{article}
usepackage{siunitx}
usepackage{booktabs}
begin{document}
begin{tabular}{c c S[table-format=3.2] c}
toprule
multicolumn{4}{c}{SI Prefixes} \
%hline hline
midrule midrule
Prefix & Symbol & Multiplication Factor & $ldots$ in Scientific Notation \
midrule
giga & G & 1000000000 & $10^9$ \
mega & M & 1000000 & $10^6$ \
kilo & k & 1000 & $10^3$ \
deca & D & 10 & $10^1$ \
rowcolor{gray!20} - & - & 1 & $10^0$ \
deci & d & 0.1 & $10^{-1}$ \
centi & c & 0.01 & $10^{-2}$ \
milli & m & 0.001 & $10^{-3}$ \
micro & $mu$ & 0.000001 & $10^{-6}$ \
nano & n & 0.000000001 & $10^{-9}$ \
bottomrule
end{tabular}
end{document}
However, here is my result:
The columns are overlapping, and I cannot figure out how to fix it. I can't think of a way to set the width of the third column, as that would fix the issue, but to my understanding, you can only fix the width by doing something like p{5cm}
; the S
type will not allow that.
tables siunitx
3
you need{...}
around the heading so it isn't parsed as a number but main issue is you have specified a format of 3.2 so 2 decimal places but your numbers are 0.000000001 which have rather more than 2 digits after the point. Use a format that matches your data
– David Carlisle
3 hours ago
How would I format it then? Sorry, I've never usedsiunitx
before. The max amount of digits is 9, so would I put 3.9?
– Aiden Kenny
3 hours ago
It just hit me, the number left of . is the number of digits left of the decimal and same with the right. So I should put 10.9.
– Aiden Kenny
3 hours ago
1
Slightly off-topic: The shortened form ofdeca
(deka
works too...) isda
, notD
.
– Mico
3 hours ago
Good point... I was not aware of this
– Aiden Kenny
2 hours ago
add a comment |
I am trying to make a table with four columns: three of the columns are to be center aligned, and one is to be aligned by decimal places ( using S[table-format=3.2]
). Here is my code:
documentclass{article}
usepackage{siunitx}
usepackage{booktabs}
begin{document}
begin{tabular}{c c S[table-format=3.2] c}
toprule
multicolumn{4}{c}{SI Prefixes} \
%hline hline
midrule midrule
Prefix & Symbol & Multiplication Factor & $ldots$ in Scientific Notation \
midrule
giga & G & 1000000000 & $10^9$ \
mega & M & 1000000 & $10^6$ \
kilo & k & 1000 & $10^3$ \
deca & D & 10 & $10^1$ \
rowcolor{gray!20} - & - & 1 & $10^0$ \
deci & d & 0.1 & $10^{-1}$ \
centi & c & 0.01 & $10^{-2}$ \
milli & m & 0.001 & $10^{-3}$ \
micro & $mu$ & 0.000001 & $10^{-6}$ \
nano & n & 0.000000001 & $10^{-9}$ \
bottomrule
end{tabular}
end{document}
However, here is my result:
The columns are overlapping, and I cannot figure out how to fix it. I can't think of a way to set the width of the third column, as that would fix the issue, but to my understanding, you can only fix the width by doing something like p{5cm}
; the S
type will not allow that.
tables siunitx
I am trying to make a table with four columns: three of the columns are to be center aligned, and one is to be aligned by decimal places ( using S[table-format=3.2]
). Here is my code:
documentclass{article}
usepackage{siunitx}
usepackage{booktabs}
begin{document}
begin{tabular}{c c S[table-format=3.2] c}
toprule
multicolumn{4}{c}{SI Prefixes} \
%hline hline
midrule midrule
Prefix & Symbol & Multiplication Factor & $ldots$ in Scientific Notation \
midrule
giga & G & 1000000000 & $10^9$ \
mega & M & 1000000 & $10^6$ \
kilo & k & 1000 & $10^3$ \
deca & D & 10 & $10^1$ \
rowcolor{gray!20} - & - & 1 & $10^0$ \
deci & d & 0.1 & $10^{-1}$ \
centi & c & 0.01 & $10^{-2}$ \
milli & m & 0.001 & $10^{-3}$ \
micro & $mu$ & 0.000001 & $10^{-6}$ \
nano & n & 0.000000001 & $10^{-9}$ \
bottomrule
end{tabular}
end{document}
However, here is my result:
The columns are overlapping, and I cannot figure out how to fix it. I can't think of a way to set the width of the third column, as that would fix the issue, but to my understanding, you can only fix the width by doing something like p{5cm}
; the S
type will not allow that.
tables siunitx
tables siunitx
asked 3 hours ago
Aiden Kenny
3005
3005
3
you need{...}
around the heading so it isn't parsed as a number but main issue is you have specified a format of 3.2 so 2 decimal places but your numbers are 0.000000001 which have rather more than 2 digits after the point. Use a format that matches your data
– David Carlisle
3 hours ago
How would I format it then? Sorry, I've never usedsiunitx
before. The max amount of digits is 9, so would I put 3.9?
– Aiden Kenny
3 hours ago
It just hit me, the number left of . is the number of digits left of the decimal and same with the right. So I should put 10.9.
– Aiden Kenny
3 hours ago
1
Slightly off-topic: The shortened form ofdeca
(deka
works too...) isda
, notD
.
– Mico
3 hours ago
Good point... I was not aware of this
– Aiden Kenny
2 hours ago
add a comment |
3
you need{...}
around the heading so it isn't parsed as a number but main issue is you have specified a format of 3.2 so 2 decimal places but your numbers are 0.000000001 which have rather more than 2 digits after the point. Use a format that matches your data
– David Carlisle
3 hours ago
How would I format it then? Sorry, I've never usedsiunitx
before. The max amount of digits is 9, so would I put 3.9?
– Aiden Kenny
3 hours ago
It just hit me, the number left of . is the number of digits left of the decimal and same with the right. So I should put 10.9.
– Aiden Kenny
3 hours ago
1
Slightly off-topic: The shortened form ofdeca
(deka
works too...) isda
, notD
.
– Mico
3 hours ago
Good point... I was not aware of this
– Aiden Kenny
2 hours ago
3
3
you need
{...}
around the heading so it isn't parsed as a number but main issue is you have specified a format of 3.2 so 2 decimal places but your numbers are 0.000000001 which have rather more than 2 digits after the point. Use a format that matches your data– David Carlisle
3 hours ago
you need
{...}
around the heading so it isn't parsed as a number but main issue is you have specified a format of 3.2 so 2 decimal places but your numbers are 0.000000001 which have rather more than 2 digits after the point. Use a format that matches your data– David Carlisle
3 hours ago
How would I format it then? Sorry, I've never used
siunitx
before. The max amount of digits is 9, so would I put 3.9?– Aiden Kenny
3 hours ago
How would I format it then? Sorry, I've never used
siunitx
before. The max amount of digits is 9, so would I put 3.9?– Aiden Kenny
3 hours ago
It just hit me, the number left of . is the number of digits left of the decimal and same with the right. So I should put 10.9.
– Aiden Kenny
3 hours ago
It just hit me, the number left of . is the number of digits left of the decimal and same with the right. So I should put 10.9.
– Aiden Kenny
3 hours ago
1
1
Slightly off-topic: The shortened form of
deca
(deka
works too...) is da
, not D
.– Mico
3 hours ago
Slightly off-topic: The shortened form of
deca
(deka
works too...) is da
, not D
.– Mico
3 hours ago
Good point... I was not aware of this
– Aiden Kenny
2 hours ago
Good point... I was not aware of this
– Aiden Kenny
2 hours ago
add a comment |
1 Answer
1
active
oldest
votes
As David Carlisle has already pointed out in a comment, you must (a) change S[table-format=3.2]
to S[table-format=10.9]
and (b) encase the string Multiplication Factor
in curly braces, to keep it from being interpreted by siunitx
.
In addition, you may want to (c) write si{micro}
instead of $mu$
in the second column. The text-mu and math-mu glyphs look quite different in most fonts. Finally, since you're using the siunitx
package, why not (d) use the S
column type for the final column as well and write e9
thru e-9
instead of $10^9$
thru $10^{-9}$
?
A separate observation: the standard short form of deca
(or deka
) is da
, not D
. For sure, si{deca}
(si{deka}
works too...) produces da
.
documentclass{article}
usepackage{siunitx}
usepackage{booktabs}
usepackage[table]{xcolor}
begin{document}
noindent
begin{tabular}{l c S[table-format=10.9] S[retain-zero-exponent=true]}
toprule
multicolumn{4}{c}{SI Prefixes} \
addlinespace %midrule
Prefix & Symbol & {Multiplication Factor} & {dots in Scientific Notation} \
midrule
giga & si{giga} & 1000000000 & e9 \
mega & si{mega} & 1000000 & e6 \
kilo & si{kilo} & 1000 & e3 \
deca & si{deka} & 10 & e1 \
rowcolor{gray!20} -- & -- & 1 & e0 \
deci & si{deci} & 0.1 & e-1 \
centi & si{centi}& 0.01 & e-2 \
milli & si{milli}& 0.001 & e-3 \
micro & si{micro}& 0.000001 & e-6 \
nano & si{nano} & 0.000000001& e-9 \
bottomrule
end{tabular}
end{document}
2
What a great, comprehensive answer! Thanks!
– Aiden Kenny
2 hours ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468585%2ftable-formatting-using-siunitx%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
As David Carlisle has already pointed out in a comment, you must (a) change S[table-format=3.2]
to S[table-format=10.9]
and (b) encase the string Multiplication Factor
in curly braces, to keep it from being interpreted by siunitx
.
In addition, you may want to (c) write si{micro}
instead of $mu$
in the second column. The text-mu and math-mu glyphs look quite different in most fonts. Finally, since you're using the siunitx
package, why not (d) use the S
column type for the final column as well and write e9
thru e-9
instead of $10^9$
thru $10^{-9}$
?
A separate observation: the standard short form of deca
(or deka
) is da
, not D
. For sure, si{deca}
(si{deka}
works too...) produces da
.
documentclass{article}
usepackage{siunitx}
usepackage{booktabs}
usepackage[table]{xcolor}
begin{document}
noindent
begin{tabular}{l c S[table-format=10.9] S[retain-zero-exponent=true]}
toprule
multicolumn{4}{c}{SI Prefixes} \
addlinespace %midrule
Prefix & Symbol & {Multiplication Factor} & {dots in Scientific Notation} \
midrule
giga & si{giga} & 1000000000 & e9 \
mega & si{mega} & 1000000 & e6 \
kilo & si{kilo} & 1000 & e3 \
deca & si{deka} & 10 & e1 \
rowcolor{gray!20} -- & -- & 1 & e0 \
deci & si{deci} & 0.1 & e-1 \
centi & si{centi}& 0.01 & e-2 \
milli & si{milli}& 0.001 & e-3 \
micro & si{micro}& 0.000001 & e-6 \
nano & si{nano} & 0.000000001& e-9 \
bottomrule
end{tabular}
end{document}
2
What a great, comprehensive answer! Thanks!
– Aiden Kenny
2 hours ago
add a comment |
As David Carlisle has already pointed out in a comment, you must (a) change S[table-format=3.2]
to S[table-format=10.9]
and (b) encase the string Multiplication Factor
in curly braces, to keep it from being interpreted by siunitx
.
In addition, you may want to (c) write si{micro}
instead of $mu$
in the second column. The text-mu and math-mu glyphs look quite different in most fonts. Finally, since you're using the siunitx
package, why not (d) use the S
column type for the final column as well and write e9
thru e-9
instead of $10^9$
thru $10^{-9}$
?
A separate observation: the standard short form of deca
(or deka
) is da
, not D
. For sure, si{deca}
(si{deka}
works too...) produces da
.
documentclass{article}
usepackage{siunitx}
usepackage{booktabs}
usepackage[table]{xcolor}
begin{document}
noindent
begin{tabular}{l c S[table-format=10.9] S[retain-zero-exponent=true]}
toprule
multicolumn{4}{c}{SI Prefixes} \
addlinespace %midrule
Prefix & Symbol & {Multiplication Factor} & {dots in Scientific Notation} \
midrule
giga & si{giga} & 1000000000 & e9 \
mega & si{mega} & 1000000 & e6 \
kilo & si{kilo} & 1000 & e3 \
deca & si{deka} & 10 & e1 \
rowcolor{gray!20} -- & -- & 1 & e0 \
deci & si{deci} & 0.1 & e-1 \
centi & si{centi}& 0.01 & e-2 \
milli & si{milli}& 0.001 & e-3 \
micro & si{micro}& 0.000001 & e-6 \
nano & si{nano} & 0.000000001& e-9 \
bottomrule
end{tabular}
end{document}
2
What a great, comprehensive answer! Thanks!
– Aiden Kenny
2 hours ago
add a comment |
As David Carlisle has already pointed out in a comment, you must (a) change S[table-format=3.2]
to S[table-format=10.9]
and (b) encase the string Multiplication Factor
in curly braces, to keep it from being interpreted by siunitx
.
In addition, you may want to (c) write si{micro}
instead of $mu$
in the second column. The text-mu and math-mu glyphs look quite different in most fonts. Finally, since you're using the siunitx
package, why not (d) use the S
column type for the final column as well and write e9
thru e-9
instead of $10^9$
thru $10^{-9}$
?
A separate observation: the standard short form of deca
(or deka
) is da
, not D
. For sure, si{deca}
(si{deka}
works too...) produces da
.
documentclass{article}
usepackage{siunitx}
usepackage{booktabs}
usepackage[table]{xcolor}
begin{document}
noindent
begin{tabular}{l c S[table-format=10.9] S[retain-zero-exponent=true]}
toprule
multicolumn{4}{c}{SI Prefixes} \
addlinespace %midrule
Prefix & Symbol & {Multiplication Factor} & {dots in Scientific Notation} \
midrule
giga & si{giga} & 1000000000 & e9 \
mega & si{mega} & 1000000 & e6 \
kilo & si{kilo} & 1000 & e3 \
deca & si{deka} & 10 & e1 \
rowcolor{gray!20} -- & -- & 1 & e0 \
deci & si{deci} & 0.1 & e-1 \
centi & si{centi}& 0.01 & e-2 \
milli & si{milli}& 0.001 & e-3 \
micro & si{micro}& 0.000001 & e-6 \
nano & si{nano} & 0.000000001& e-9 \
bottomrule
end{tabular}
end{document}
As David Carlisle has already pointed out in a comment, you must (a) change S[table-format=3.2]
to S[table-format=10.9]
and (b) encase the string Multiplication Factor
in curly braces, to keep it from being interpreted by siunitx
.
In addition, you may want to (c) write si{micro}
instead of $mu$
in the second column. The text-mu and math-mu glyphs look quite different in most fonts. Finally, since you're using the siunitx
package, why not (d) use the S
column type for the final column as well and write e9
thru e-9
instead of $10^9$
thru $10^{-9}$
?
A separate observation: the standard short form of deca
(or deka
) is da
, not D
. For sure, si{deca}
(si{deka}
works too...) produces da
.
documentclass{article}
usepackage{siunitx}
usepackage{booktabs}
usepackage[table]{xcolor}
begin{document}
noindent
begin{tabular}{l c S[table-format=10.9] S[retain-zero-exponent=true]}
toprule
multicolumn{4}{c}{SI Prefixes} \
addlinespace %midrule
Prefix & Symbol & {Multiplication Factor} & {dots in Scientific Notation} \
midrule
giga & si{giga} & 1000000000 & e9 \
mega & si{mega} & 1000000 & e6 \
kilo & si{kilo} & 1000 & e3 \
deca & si{deka} & 10 & e1 \
rowcolor{gray!20} -- & -- & 1 & e0 \
deci & si{deci} & 0.1 & e-1 \
centi & si{centi}& 0.01 & e-2 \
milli & si{milli}& 0.001 & e-3 \
micro & si{micro}& 0.000001 & e-6 \
nano & si{nano} & 0.000000001& e-9 \
bottomrule
end{tabular}
end{document}
answered 3 hours ago
Mico
274k30371757
274k30371757
2
What a great, comprehensive answer! Thanks!
– Aiden Kenny
2 hours ago
add a comment |
2
What a great, comprehensive answer! Thanks!
– Aiden Kenny
2 hours ago
2
2
What a great, comprehensive answer! Thanks!
– Aiden Kenny
2 hours ago
What a great, comprehensive answer! Thanks!
– Aiden Kenny
2 hours ago
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468585%2ftable-formatting-using-siunitx%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
you need
{...}
around the heading so it isn't parsed as a number but main issue is you have specified a format of 3.2 so 2 decimal places but your numbers are 0.000000001 which have rather more than 2 digits after the point. Use a format that matches your data– David Carlisle
3 hours ago
How would I format it then? Sorry, I've never used
siunitx
before. The max amount of digits is 9, so would I put 3.9?– Aiden Kenny
3 hours ago
It just hit me, the number left of . is the number of digits left of the decimal and same with the right. So I should put 10.9.
– Aiden Kenny
3 hours ago
1
Slightly off-topic: The shortened form of
deca
(deka
works too...) isda
, notD
.– Mico
3 hours ago
Good point... I was not aware of this
– Aiden Kenny
2 hours ago