Fixed column width and align on decimal with siunitx The Next CEO of Stack OverflowSiunitx - significant stars (***) far awayalign numbers based on the decimal point with textbf and stars in the tableAlign decimal marker with thousands separator using siunitxsiunitx: Decimal alignment with 'less than' signAlign numbers by decimal point using siunitx and bfseriessiunitx and missing decimal pointUsing siunitx, fixed column width with arrayreducing siunitx column widthsiunitx removes a decimal zeroDuplicate decimal marker (siunitx)Problems with column width and text alignment using siunitxsiunitx - bold decimal separator

What was the first Unix version to run on a microcomputer?

What happened in Rome, when the western empire "fell"?

Are police here, aren't itthey?

Can you be charged for obstruction for refusing to answer questions?

Unclear about dynamic binding

Why do airplanes bank sharply to the right after air-to-air refueling?

How did people program for Consoles with multiple CPUs?

How to avoid supervisors with prejudiced views?

Won the lottery - how do I keep the money?

Some questions about different axiomatic systems for neighbourhoods

Proper way to express "He disappeared them"

Does soap repel water?

How do I align (1) and (2)?

Is there a way to save my career from absolute disaster?

Prepend last line of stdin to entire stdin

Why does standard notation not preserve intervals (visually)

Why, when going from special to general relativity, do we just replace partial derivatives with covariant derivatives?

"misplaced omit" error when >centering columns

0 rank tensor vs 1D vector

Easy to read palindrome checker

A Man With a Stainless Steel Endoskeleton (like The Terminator) Fighting Cloaked Aliens Only He Can See

Domestic-to-international connection at Orlando (MCO)

Is French Guiana a (hard) EU border?

WOW air has ceased operation, can I get my tickets refunded?



Fixed column width and align on decimal with siunitx



The Next CEO of Stack OverflowSiunitx - significant stars (***) far awayalign numbers based on the decimal point with textbf and stars in the tableAlign decimal marker with thousands separator using siunitxsiunitx: Decimal alignment with 'less than' signAlign numbers by decimal point using siunitx and bfseriessiunitx and missing decimal pointUsing siunitx, fixed column width with arrayreducing siunitx column widthsiunitx removes a decimal zeroDuplicate decimal marker (siunitx)Problems with column width and text alignment using siunitxsiunitx - bold decimal separator










2















I have the following Latex table I generated with the KableExtra package in R. What I want to do now is make all columns the same/fixed width and align on decimals. The second of these is not to be supported by KableExtra so I will need to do this in Latex directly. The siunitx package seems a good choice for this, but I can't get it to work.



documentclass[12pt,a4paper]article
usepackagegeometry
usepackageamsmath
usepackagebooktabs
usepackagefloat
usepackagesiunitx
begindocument

begintable[H]
centering
begintabularccccccccc
toprule
multicolumn1c & multicolumn4cCumulative change & multicolumn4cMarginal change \
cmidrule(lr)2-5 cmidrule(lr)6-9
$k$ & $(Cons.)$ & $Spread_t$ & $overlineR^2$ & $SEE$ & $(Cons.)$ & $Spread_t$ & $overlineR^2$ & $SEE$\
midrule
$1$ & $1.76^**$ & $2.09^**$ & $0.18$ & $4.05$ & $1.76^**$ & $2.09^**$ & $0.18$ & $4.05$\
& $(0.56)$ & $(0.40)$ & & & $(0.56)$ & $(0.40)$ & & \
$2$ & $1.73^**$ & $2.06^**$ & $0.28$ & $3.02$ & $1.78^**$ & $2.06^**$ & $0.17$ & $4.06$\
& $(0.39)$ & $(0.29)$ & & & $(0.52)$ & $(0.39)$ & & \
$8$ & $2.65^**$ & $0.96^**$ & $0.18$ & $1.70$ & $ 4.21^**$ & $-0.59 $ & $0.00$ & $4.45$\
& $(0.26)$ & $(0.16)$ & & & $(0.64)$ & $(0.53)$ & & \
$12$ & $3.31^**$ & $0.35^*$ & $0.04$ & $1.39$ & $ 4.52^**$ & $-0.93^**$ & $0.07$ & $2.66$\
& $(0.19)$ & $(0.14)$ & & & $(0.32)$ & $(0.30)$ & & \
bottomrule
multicolumn9ltextitNote: \
multicolumn9lRobust standard errors in parentheses.\
multicolumn9l$^*$ $p < 0.05$, $^**$ $p < 0.01$ in a two-tailed test.\
endtabular
endtable

enddocument


The fixed column width I tried to achieve with *9S[table-column-width = 2 cm], but this gave me a lot of "! Extra , or forgotten $." type errors.



For the alignment I tried to make something out of this and other answers and the siunutx manual, but I got a whole bunch of errors and problems where my significance stars disappeared, etc. I want to center all columns, but aligned on the decimal. The first columns should be aligned on the implicit decimal.



Thanks!










share|improve this question






















  • Could you add an image of what your code currently produces and a visual example of what you want it to look like (use paint on the what it currently produces)

    – Vinccool96
    7 hours ago











  • You might want to have a look at: tex.stackexchange.com/a/180009/134144

    – leandriis
    7 hours ago















2















I have the following Latex table I generated with the KableExtra package in R. What I want to do now is make all columns the same/fixed width and align on decimals. The second of these is not to be supported by KableExtra so I will need to do this in Latex directly. The siunitx package seems a good choice for this, but I can't get it to work.



documentclass[12pt,a4paper]article
usepackagegeometry
usepackageamsmath
usepackagebooktabs
usepackagefloat
usepackagesiunitx
begindocument

begintable[H]
centering
begintabularccccccccc
toprule
multicolumn1c & multicolumn4cCumulative change & multicolumn4cMarginal change \
cmidrule(lr)2-5 cmidrule(lr)6-9
$k$ & $(Cons.)$ & $Spread_t$ & $overlineR^2$ & $SEE$ & $(Cons.)$ & $Spread_t$ & $overlineR^2$ & $SEE$\
midrule
$1$ & $1.76^**$ & $2.09^**$ & $0.18$ & $4.05$ & $1.76^**$ & $2.09^**$ & $0.18$ & $4.05$\
& $(0.56)$ & $(0.40)$ & & & $(0.56)$ & $(0.40)$ & & \
$2$ & $1.73^**$ & $2.06^**$ & $0.28$ & $3.02$ & $1.78^**$ & $2.06^**$ & $0.17$ & $4.06$\
& $(0.39)$ & $(0.29)$ & & & $(0.52)$ & $(0.39)$ & & \
$8$ & $2.65^**$ & $0.96^**$ & $0.18$ & $1.70$ & $ 4.21^**$ & $-0.59 $ & $0.00$ & $4.45$\
& $(0.26)$ & $(0.16)$ & & & $(0.64)$ & $(0.53)$ & & \
$12$ & $3.31^**$ & $0.35^*$ & $0.04$ & $1.39$ & $ 4.52^**$ & $-0.93^**$ & $0.07$ & $2.66$\
& $(0.19)$ & $(0.14)$ & & & $(0.32)$ & $(0.30)$ & & \
bottomrule
multicolumn9ltextitNote: \
multicolumn9lRobust standard errors in parentheses.\
multicolumn9l$^*$ $p < 0.05$, $^**$ $p < 0.01$ in a two-tailed test.\
endtabular
endtable

enddocument


The fixed column width I tried to achieve with *9S[table-column-width = 2 cm], but this gave me a lot of "! Extra , or forgotten $." type errors.



For the alignment I tried to make something out of this and other answers and the siunutx manual, but I got a whole bunch of errors and problems where my significance stars disappeared, etc. I want to center all columns, but aligned on the decimal. The first columns should be aligned on the implicit decimal.



Thanks!










share|improve this question






















  • Could you add an image of what your code currently produces and a visual example of what you want it to look like (use paint on the what it currently produces)

    – Vinccool96
    7 hours ago











  • You might want to have a look at: tex.stackexchange.com/a/180009/134144

    – leandriis
    7 hours ago













2












2








2








I have the following Latex table I generated with the KableExtra package in R. What I want to do now is make all columns the same/fixed width and align on decimals. The second of these is not to be supported by KableExtra so I will need to do this in Latex directly. The siunitx package seems a good choice for this, but I can't get it to work.



documentclass[12pt,a4paper]article
usepackagegeometry
usepackageamsmath
usepackagebooktabs
usepackagefloat
usepackagesiunitx
begindocument

begintable[H]
centering
begintabularccccccccc
toprule
multicolumn1c & multicolumn4cCumulative change & multicolumn4cMarginal change \
cmidrule(lr)2-5 cmidrule(lr)6-9
$k$ & $(Cons.)$ & $Spread_t$ & $overlineR^2$ & $SEE$ & $(Cons.)$ & $Spread_t$ & $overlineR^2$ & $SEE$\
midrule
$1$ & $1.76^**$ & $2.09^**$ & $0.18$ & $4.05$ & $1.76^**$ & $2.09^**$ & $0.18$ & $4.05$\
& $(0.56)$ & $(0.40)$ & & & $(0.56)$ & $(0.40)$ & & \
$2$ & $1.73^**$ & $2.06^**$ & $0.28$ & $3.02$ & $1.78^**$ & $2.06^**$ & $0.17$ & $4.06$\
& $(0.39)$ & $(0.29)$ & & & $(0.52)$ & $(0.39)$ & & \
$8$ & $2.65^**$ & $0.96^**$ & $0.18$ & $1.70$ & $ 4.21^**$ & $-0.59 $ & $0.00$ & $4.45$\
& $(0.26)$ & $(0.16)$ & & & $(0.64)$ & $(0.53)$ & & \
$12$ & $3.31^**$ & $0.35^*$ & $0.04$ & $1.39$ & $ 4.52^**$ & $-0.93^**$ & $0.07$ & $2.66$\
& $(0.19)$ & $(0.14)$ & & & $(0.32)$ & $(0.30)$ & & \
bottomrule
multicolumn9ltextitNote: \
multicolumn9lRobust standard errors in parentheses.\
multicolumn9l$^*$ $p < 0.05$, $^**$ $p < 0.01$ in a two-tailed test.\
endtabular
endtable

enddocument


The fixed column width I tried to achieve with *9S[table-column-width = 2 cm], but this gave me a lot of "! Extra , or forgotten $." type errors.



For the alignment I tried to make something out of this and other answers and the siunutx manual, but I got a whole bunch of errors and problems where my significance stars disappeared, etc. I want to center all columns, but aligned on the decimal. The first columns should be aligned on the implicit decimal.



Thanks!










share|improve this question














I have the following Latex table I generated with the KableExtra package in R. What I want to do now is make all columns the same/fixed width and align on decimals. The second of these is not to be supported by KableExtra so I will need to do this in Latex directly. The siunitx package seems a good choice for this, but I can't get it to work.



documentclass[12pt,a4paper]article
usepackagegeometry
usepackageamsmath
usepackagebooktabs
usepackagefloat
usepackagesiunitx
begindocument

begintable[H]
centering
begintabularccccccccc
toprule
multicolumn1c & multicolumn4cCumulative change & multicolumn4cMarginal change \
cmidrule(lr)2-5 cmidrule(lr)6-9
$k$ & $(Cons.)$ & $Spread_t$ & $overlineR^2$ & $SEE$ & $(Cons.)$ & $Spread_t$ & $overlineR^2$ & $SEE$\
midrule
$1$ & $1.76^**$ & $2.09^**$ & $0.18$ & $4.05$ & $1.76^**$ & $2.09^**$ & $0.18$ & $4.05$\
& $(0.56)$ & $(0.40)$ & & & $(0.56)$ & $(0.40)$ & & \
$2$ & $1.73^**$ & $2.06^**$ & $0.28$ & $3.02$ & $1.78^**$ & $2.06^**$ & $0.17$ & $4.06$\
& $(0.39)$ & $(0.29)$ & & & $(0.52)$ & $(0.39)$ & & \
$8$ & $2.65^**$ & $0.96^**$ & $0.18$ & $1.70$ & $ 4.21^**$ & $-0.59 $ & $0.00$ & $4.45$\
& $(0.26)$ & $(0.16)$ & & & $(0.64)$ & $(0.53)$ & & \
$12$ & $3.31^**$ & $0.35^*$ & $0.04$ & $1.39$ & $ 4.52^**$ & $-0.93^**$ & $0.07$ & $2.66$\
& $(0.19)$ & $(0.14)$ & & & $(0.32)$ & $(0.30)$ & & \
bottomrule
multicolumn9ltextitNote: \
multicolumn9lRobust standard errors in parentheses.\
multicolumn9l$^*$ $p < 0.05$, $^**$ $p < 0.01$ in a two-tailed test.\
endtabular
endtable

enddocument


The fixed column width I tried to achieve with *9S[table-column-width = 2 cm], but this gave me a lot of "! Extra , or forgotten $." type errors.



For the alignment I tried to make something out of this and other answers and the siunutx manual, but I got a whole bunch of errors and problems where my significance stars disappeared, etc. I want to center all columns, but aligned on the decimal. The first columns should be aligned on the implicit decimal.



Thanks!







siunitx






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 7 hours ago









Alexander91Alexander91

203




203












  • Could you add an image of what your code currently produces and a visual example of what you want it to look like (use paint on the what it currently produces)

    – Vinccool96
    7 hours ago











  • You might want to have a look at: tex.stackexchange.com/a/180009/134144

    – leandriis
    7 hours ago

















  • Could you add an image of what your code currently produces and a visual example of what you want it to look like (use paint on the what it currently produces)

    – Vinccool96
    7 hours ago











  • You might want to have a look at: tex.stackexchange.com/a/180009/134144

    – leandriis
    7 hours ago
















Could you add an image of what your code currently produces and a visual example of what you want it to look like (use paint on the what it currently produces)

– Vinccool96
7 hours ago





Could you add an image of what your code currently produces and a visual example of what you want it to look like (use paint on the what it currently produces)

– Vinccool96
7 hours ago













You might want to have a look at: tex.stackexchange.com/a/180009/134144

– leandriis
7 hours ago





You might want to have a look at: tex.stackexchange.com/a/180009/134144

– leandriis
7 hours ago










1 Answer
1






active

oldest

votes


















1














with use of S column type from package siunitx:



enter image description here



(red lines indicate text borders)



i would also use threepartablex package for simpler writing table notes (...tnote** instead of $...^**$). it also provide command note for tablenotes environment:



documentclass[12pt,a4paper]article
usepackagegeometry
usepackageamsmath
usepackagebooktabs
usepackage[referable]threeparttablex % <--- for note, source
usepackagesiunitx

begindocument

begintable[htb]
centering
beginthreeparttable
captionTable title
labeltab:statistic
begintabular*linewidth@hskiptabcolsepextracolsepfill
c *8S[table-format=1.2,
input-symbols=( ),
table-space-text-post=**
]
toprule
multicolumn1c
& multicolumn4cCumulative change
& multicolumn4cMarginal change \
cmidrule(lr)2-5 cmidrule(lr)6-9
$k$ & (Cons.) & Spread$_t$ & $overlineR^2$& SEE
& (Cons.) & Spread$_t$ & $overlineR^2$& SEE \
midrule
1 & 1.76tnote** & 2.09tnote** & 0.18 & 4.05
& 1.76tnote** & 2.09tnote** & 0.18 & 4.05 \
& (0.56) & (0.40) & &
& (0.56) & (0.40) & & \
2 & 1.73tnote** & 2.06tnote** & 0.28 & 3.02
& 1.78tnote** & 2.06tnote** & 0.17 & 4.06 \
& (0.39) & (0.29) & &
& (0.52) & (0.39) & & \
bottomrule
endtabular*
begintablenotes[para, flushleft]footnotesize
note: Robust standard errors in parentheses.\
item[*] $p < 0.05$,
item[**] $p < 0.01$ in a two-tailed test.
endtablenotes
endthreeparttable
endtable

enddocument


edit:
i miss requirement that all column should have equal width. this can be achieved for example with use of tabularx table environment where for column headers is used command mcx defined in preamble as:



newcommandmcx[2]multicolumn1>centeringarraybackslashX#1


to my taste this requirement not result in a better looking table:



enter image description here



documentclass[12pt,a4paper]article
usepackagegeometry
usepackageamsmath
usepackagebooktabs, tabularx
newcommandmcx[1]multicolumn1>centeringarraybackslashX#1
usepackage[referable]threeparttablex
usepackagesiunitx

begindocument

begintable[htb]
centering
sisetuptable-format=1.2, input-symbols=( )
beginthreeparttable
captionTable title
labeltab:statistic
begintabularxlinewidth@hskiptabcolsepextracolsepfill
>centeringarraybackslashX
*2S[table-space-text-post=**]
*2S
*2S[table-space-text-post=**]
*2S

toprule
multicolumn1c
& multicolumn4cCumulative change
& multicolumn4cMarginal change \
cmidrule(lr)2-5 cmidrule(lr)6-9
$k$ & mcx(Cons.) & mcxSpread$_t$
& mcx$overlineR^2$ & SEE
& mcx(Cons.) & mcxSpread$_t$
& mcx$overlineR^2$ & mcxSEE \
midrule
1 & 1.76tnote** & 2.09tnote** & 0.18 & 4.05
& 1.76tnote** & 2.09tnote** & 0.18 & 4.05 \
& (0.56) & (0.40) & &
& (0.56) & (0.40) & & \
2 & 1.73tnote** & 2.06tnote** & 0.28 & 3.02
& 1.78tnote** & 2.06tnote** & 0.17 & 4.06 \
& (0.39) & (0.29) & &
& (0.52) & (0.39) & & \
bottomrule
endtabularx
begintablenotes[para, flushleft]footnotesize
note Robust standard errors in parentheses.\
item[*] $p < 0.05$,
item[**] $p < 0.01$ in a two-tailed test.
endtablenotes
endthreeparttable
endtable

enddocument





share|improve this answer

























  • I managed to set the fixed column with using table-column-width=1.5cm in the S column options.

    – Alexander91
    5 hours ago











  • @Alexander91, very good!

    – Zarko
    5 hours ago











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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482306%2ffixed-column-width-and-align-on-decimal-with-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









1














with use of S column type from package siunitx:



enter image description here



(red lines indicate text borders)



i would also use threepartablex package for simpler writing table notes (...tnote** instead of $...^**$). it also provide command note for tablenotes environment:



documentclass[12pt,a4paper]article
usepackagegeometry
usepackageamsmath
usepackagebooktabs
usepackage[referable]threeparttablex % <--- for note, source
usepackagesiunitx

begindocument

begintable[htb]
centering
beginthreeparttable
captionTable title
labeltab:statistic
begintabular*linewidth@hskiptabcolsepextracolsepfill
c *8S[table-format=1.2,
input-symbols=( ),
table-space-text-post=**
]
toprule
multicolumn1c
& multicolumn4cCumulative change
& multicolumn4cMarginal change \
cmidrule(lr)2-5 cmidrule(lr)6-9
$k$ & (Cons.) & Spread$_t$ & $overlineR^2$& SEE
& (Cons.) & Spread$_t$ & $overlineR^2$& SEE \
midrule
1 & 1.76tnote** & 2.09tnote** & 0.18 & 4.05
& 1.76tnote** & 2.09tnote** & 0.18 & 4.05 \
& (0.56) & (0.40) & &
& (0.56) & (0.40) & & \
2 & 1.73tnote** & 2.06tnote** & 0.28 & 3.02
& 1.78tnote** & 2.06tnote** & 0.17 & 4.06 \
& (0.39) & (0.29) & &
& (0.52) & (0.39) & & \
bottomrule
endtabular*
begintablenotes[para, flushleft]footnotesize
note: Robust standard errors in parentheses.\
item[*] $p < 0.05$,
item[**] $p < 0.01$ in a two-tailed test.
endtablenotes
endthreeparttable
endtable

enddocument


edit:
i miss requirement that all column should have equal width. this can be achieved for example with use of tabularx table environment where for column headers is used command mcx defined in preamble as:



newcommandmcx[2]multicolumn1>centeringarraybackslashX#1


to my taste this requirement not result in a better looking table:



enter image description here



documentclass[12pt,a4paper]article
usepackagegeometry
usepackageamsmath
usepackagebooktabs, tabularx
newcommandmcx[1]multicolumn1>centeringarraybackslashX#1
usepackage[referable]threeparttablex
usepackagesiunitx

begindocument

begintable[htb]
centering
sisetuptable-format=1.2, input-symbols=( )
beginthreeparttable
captionTable title
labeltab:statistic
begintabularxlinewidth@hskiptabcolsepextracolsepfill
>centeringarraybackslashX
*2S[table-space-text-post=**]
*2S
*2S[table-space-text-post=**]
*2S

toprule
multicolumn1c
& multicolumn4cCumulative change
& multicolumn4cMarginal change \
cmidrule(lr)2-5 cmidrule(lr)6-9
$k$ & mcx(Cons.) & mcxSpread$_t$
& mcx$overlineR^2$ & SEE
& mcx(Cons.) & mcxSpread$_t$
& mcx$overlineR^2$ & mcxSEE \
midrule
1 & 1.76tnote** & 2.09tnote** & 0.18 & 4.05
& 1.76tnote** & 2.09tnote** & 0.18 & 4.05 \
& (0.56) & (0.40) & &
& (0.56) & (0.40) & & \
2 & 1.73tnote** & 2.06tnote** & 0.28 & 3.02
& 1.78tnote** & 2.06tnote** & 0.17 & 4.06 \
& (0.39) & (0.29) & &
& (0.52) & (0.39) & & \
bottomrule
endtabularx
begintablenotes[para, flushleft]footnotesize
note Robust standard errors in parentheses.\
item[*] $p < 0.05$,
item[**] $p < 0.01$ in a two-tailed test.
endtablenotes
endthreeparttable
endtable

enddocument





share|improve this answer

























  • I managed to set the fixed column with using table-column-width=1.5cm in the S column options.

    – Alexander91
    5 hours ago











  • @Alexander91, very good!

    – Zarko
    5 hours ago















1














with use of S column type from package siunitx:



enter image description here



(red lines indicate text borders)



i would also use threepartablex package for simpler writing table notes (...tnote** instead of $...^**$). it also provide command note for tablenotes environment:



documentclass[12pt,a4paper]article
usepackagegeometry
usepackageamsmath
usepackagebooktabs
usepackage[referable]threeparttablex % <--- for note, source
usepackagesiunitx

begindocument

begintable[htb]
centering
beginthreeparttable
captionTable title
labeltab:statistic
begintabular*linewidth@hskiptabcolsepextracolsepfill
c *8S[table-format=1.2,
input-symbols=( ),
table-space-text-post=**
]
toprule
multicolumn1c
& multicolumn4cCumulative change
& multicolumn4cMarginal change \
cmidrule(lr)2-5 cmidrule(lr)6-9
$k$ & (Cons.) & Spread$_t$ & $overlineR^2$& SEE
& (Cons.) & Spread$_t$ & $overlineR^2$& SEE \
midrule
1 & 1.76tnote** & 2.09tnote** & 0.18 & 4.05
& 1.76tnote** & 2.09tnote** & 0.18 & 4.05 \
& (0.56) & (0.40) & &
& (0.56) & (0.40) & & \
2 & 1.73tnote** & 2.06tnote** & 0.28 & 3.02
& 1.78tnote** & 2.06tnote** & 0.17 & 4.06 \
& (0.39) & (0.29) & &
& (0.52) & (0.39) & & \
bottomrule
endtabular*
begintablenotes[para, flushleft]footnotesize
note: Robust standard errors in parentheses.\
item[*] $p < 0.05$,
item[**] $p < 0.01$ in a two-tailed test.
endtablenotes
endthreeparttable
endtable

enddocument


edit:
i miss requirement that all column should have equal width. this can be achieved for example with use of tabularx table environment where for column headers is used command mcx defined in preamble as:



newcommandmcx[2]multicolumn1>centeringarraybackslashX#1


to my taste this requirement not result in a better looking table:



enter image description here



documentclass[12pt,a4paper]article
usepackagegeometry
usepackageamsmath
usepackagebooktabs, tabularx
newcommandmcx[1]multicolumn1>centeringarraybackslashX#1
usepackage[referable]threeparttablex
usepackagesiunitx

begindocument

begintable[htb]
centering
sisetuptable-format=1.2, input-symbols=( )
beginthreeparttable
captionTable title
labeltab:statistic
begintabularxlinewidth@hskiptabcolsepextracolsepfill
>centeringarraybackslashX
*2S[table-space-text-post=**]
*2S
*2S[table-space-text-post=**]
*2S

toprule
multicolumn1c
& multicolumn4cCumulative change
& multicolumn4cMarginal change \
cmidrule(lr)2-5 cmidrule(lr)6-9
$k$ & mcx(Cons.) & mcxSpread$_t$
& mcx$overlineR^2$ & SEE
& mcx(Cons.) & mcxSpread$_t$
& mcx$overlineR^2$ & mcxSEE \
midrule
1 & 1.76tnote** & 2.09tnote** & 0.18 & 4.05
& 1.76tnote** & 2.09tnote** & 0.18 & 4.05 \
& (0.56) & (0.40) & &
& (0.56) & (0.40) & & \
2 & 1.73tnote** & 2.06tnote** & 0.28 & 3.02
& 1.78tnote** & 2.06tnote** & 0.17 & 4.06 \
& (0.39) & (0.29) & &
& (0.52) & (0.39) & & \
bottomrule
endtabularx
begintablenotes[para, flushleft]footnotesize
note Robust standard errors in parentheses.\
item[*] $p < 0.05$,
item[**] $p < 0.01$ in a two-tailed test.
endtablenotes
endthreeparttable
endtable

enddocument





share|improve this answer

























  • I managed to set the fixed column with using table-column-width=1.5cm in the S column options.

    – Alexander91
    5 hours ago











  • @Alexander91, very good!

    – Zarko
    5 hours ago













1












1








1







with use of S column type from package siunitx:



enter image description here



(red lines indicate text borders)



i would also use threepartablex package for simpler writing table notes (...tnote** instead of $...^**$). it also provide command note for tablenotes environment:



documentclass[12pt,a4paper]article
usepackagegeometry
usepackageamsmath
usepackagebooktabs
usepackage[referable]threeparttablex % <--- for note, source
usepackagesiunitx

begindocument

begintable[htb]
centering
beginthreeparttable
captionTable title
labeltab:statistic
begintabular*linewidth@hskiptabcolsepextracolsepfill
c *8S[table-format=1.2,
input-symbols=( ),
table-space-text-post=**
]
toprule
multicolumn1c
& multicolumn4cCumulative change
& multicolumn4cMarginal change \
cmidrule(lr)2-5 cmidrule(lr)6-9
$k$ & (Cons.) & Spread$_t$ & $overlineR^2$& SEE
& (Cons.) & Spread$_t$ & $overlineR^2$& SEE \
midrule
1 & 1.76tnote** & 2.09tnote** & 0.18 & 4.05
& 1.76tnote** & 2.09tnote** & 0.18 & 4.05 \
& (0.56) & (0.40) & &
& (0.56) & (0.40) & & \
2 & 1.73tnote** & 2.06tnote** & 0.28 & 3.02
& 1.78tnote** & 2.06tnote** & 0.17 & 4.06 \
& (0.39) & (0.29) & &
& (0.52) & (0.39) & & \
bottomrule
endtabular*
begintablenotes[para, flushleft]footnotesize
note: Robust standard errors in parentheses.\
item[*] $p < 0.05$,
item[**] $p < 0.01$ in a two-tailed test.
endtablenotes
endthreeparttable
endtable

enddocument


edit:
i miss requirement that all column should have equal width. this can be achieved for example with use of tabularx table environment where for column headers is used command mcx defined in preamble as:



newcommandmcx[2]multicolumn1>centeringarraybackslashX#1


to my taste this requirement not result in a better looking table:



enter image description here



documentclass[12pt,a4paper]article
usepackagegeometry
usepackageamsmath
usepackagebooktabs, tabularx
newcommandmcx[1]multicolumn1>centeringarraybackslashX#1
usepackage[referable]threeparttablex
usepackagesiunitx

begindocument

begintable[htb]
centering
sisetuptable-format=1.2, input-symbols=( )
beginthreeparttable
captionTable title
labeltab:statistic
begintabularxlinewidth@hskiptabcolsepextracolsepfill
>centeringarraybackslashX
*2S[table-space-text-post=**]
*2S
*2S[table-space-text-post=**]
*2S

toprule
multicolumn1c
& multicolumn4cCumulative change
& multicolumn4cMarginal change \
cmidrule(lr)2-5 cmidrule(lr)6-9
$k$ & mcx(Cons.) & mcxSpread$_t$
& mcx$overlineR^2$ & SEE
& mcx(Cons.) & mcxSpread$_t$
& mcx$overlineR^2$ & mcxSEE \
midrule
1 & 1.76tnote** & 2.09tnote** & 0.18 & 4.05
& 1.76tnote** & 2.09tnote** & 0.18 & 4.05 \
& (0.56) & (0.40) & &
& (0.56) & (0.40) & & \
2 & 1.73tnote** & 2.06tnote** & 0.28 & 3.02
& 1.78tnote** & 2.06tnote** & 0.17 & 4.06 \
& (0.39) & (0.29) & &
& (0.52) & (0.39) & & \
bottomrule
endtabularx
begintablenotes[para, flushleft]footnotesize
note Robust standard errors in parentheses.\
item[*] $p < 0.05$,
item[**] $p < 0.01$ in a two-tailed test.
endtablenotes
endthreeparttable
endtable

enddocument





share|improve this answer















with use of S column type from package siunitx:



enter image description here



(red lines indicate text borders)



i would also use threepartablex package for simpler writing table notes (...tnote** instead of $...^**$). it also provide command note for tablenotes environment:



documentclass[12pt,a4paper]article
usepackagegeometry
usepackageamsmath
usepackagebooktabs
usepackage[referable]threeparttablex % <--- for note, source
usepackagesiunitx

begindocument

begintable[htb]
centering
beginthreeparttable
captionTable title
labeltab:statistic
begintabular*linewidth@hskiptabcolsepextracolsepfill
c *8S[table-format=1.2,
input-symbols=( ),
table-space-text-post=**
]
toprule
multicolumn1c
& multicolumn4cCumulative change
& multicolumn4cMarginal change \
cmidrule(lr)2-5 cmidrule(lr)6-9
$k$ & (Cons.) & Spread$_t$ & $overlineR^2$& SEE
& (Cons.) & Spread$_t$ & $overlineR^2$& SEE \
midrule
1 & 1.76tnote** & 2.09tnote** & 0.18 & 4.05
& 1.76tnote** & 2.09tnote** & 0.18 & 4.05 \
& (0.56) & (0.40) & &
& (0.56) & (0.40) & & \
2 & 1.73tnote** & 2.06tnote** & 0.28 & 3.02
& 1.78tnote** & 2.06tnote** & 0.17 & 4.06 \
& (0.39) & (0.29) & &
& (0.52) & (0.39) & & \
bottomrule
endtabular*
begintablenotes[para, flushleft]footnotesize
note: Robust standard errors in parentheses.\
item[*] $p < 0.05$,
item[**] $p < 0.01$ in a two-tailed test.
endtablenotes
endthreeparttable
endtable

enddocument


edit:
i miss requirement that all column should have equal width. this can be achieved for example with use of tabularx table environment where for column headers is used command mcx defined in preamble as:



newcommandmcx[2]multicolumn1>centeringarraybackslashX#1


to my taste this requirement not result in a better looking table:



enter image description here



documentclass[12pt,a4paper]article
usepackagegeometry
usepackageamsmath
usepackagebooktabs, tabularx
newcommandmcx[1]multicolumn1>centeringarraybackslashX#1
usepackage[referable]threeparttablex
usepackagesiunitx

begindocument

begintable[htb]
centering
sisetuptable-format=1.2, input-symbols=( )
beginthreeparttable
captionTable title
labeltab:statistic
begintabularxlinewidth@hskiptabcolsepextracolsepfill
>centeringarraybackslashX
*2S[table-space-text-post=**]
*2S
*2S[table-space-text-post=**]
*2S

toprule
multicolumn1c
& multicolumn4cCumulative change
& multicolumn4cMarginal change \
cmidrule(lr)2-5 cmidrule(lr)6-9
$k$ & mcx(Cons.) & mcxSpread$_t$
& mcx$overlineR^2$ & SEE
& mcx(Cons.) & mcxSpread$_t$
& mcx$overlineR^2$ & mcxSEE \
midrule
1 & 1.76tnote** & 2.09tnote** & 0.18 & 4.05
& 1.76tnote** & 2.09tnote** & 0.18 & 4.05 \
& (0.56) & (0.40) & &
& (0.56) & (0.40) & & \
2 & 1.73tnote** & 2.06tnote** & 0.28 & 3.02
& 1.78tnote** & 2.06tnote** & 0.17 & 4.06 \
& (0.39) & (0.29) & &
& (0.52) & (0.39) & & \
bottomrule
endtabularx
begintablenotes[para, flushleft]footnotesize
note Robust standard errors in parentheses.\
item[*] $p < 0.05$,
item[**] $p < 0.01$ in a two-tailed test.
endtablenotes
endthreeparttable
endtable

enddocument






share|improve this answer














share|improve this answer



share|improve this answer








edited 6 hours ago

























answered 6 hours ago









ZarkoZarko

128k868168




128k868168












  • I managed to set the fixed column with using table-column-width=1.5cm in the S column options.

    – Alexander91
    5 hours ago











  • @Alexander91, very good!

    – Zarko
    5 hours ago

















  • I managed to set the fixed column with using table-column-width=1.5cm in the S column options.

    – Alexander91
    5 hours ago











  • @Alexander91, very good!

    – Zarko
    5 hours ago
















I managed to set the fixed column with using table-column-width=1.5cm in the S column options.

– Alexander91
5 hours ago





I managed to set the fixed column with using table-column-width=1.5cm in the S column options.

– Alexander91
5 hours ago













@Alexander91, very good!

– Zarko
5 hours ago





@Alexander91, very good!

– Zarko
5 hours ago

















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482306%2ffixed-column-width-and-align-on-decimal-with-siunitx%23new-answer', 'question_page');

);

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







Popular posts from this blog

Wikipedia:Contact us Navigation menu Navigation menuLeave a Reply Cancel reply Post navigationRecent PostsRecent CommentsArchivesCategoriesMeta

Farafra Inhaltsverzeichnis Geschichte | Badr-Museum Farafra | Nationalpark Weiße Wüste (as-Sahra al-baida) | Literatur | Weblinks | Navigationsmenü27° 3′ N, 27° 58′ OCommons: Farafra

Tórshavn Kliima | Partnerstääden | Luke uk diar | Nawigatsjuun62° 1′ N, 6° 46′ W62° 1′ 0″ N, 6° 46′ 0″ WWMOTórshavn