Table alignment (make the content centre)What are the various units (ex, em, in, pt, bp, dd, pc) expressed in mm?Column with fixed width and centre alignmentHelp to make table of contentMake a linewidth table with booktabsTable: cmidrule alignment problem when working with tabular* environmentsMake the table look betterpositioning and alignment of table contentCan't centre tabular tableAlignment issues with rotated table contentVertically-centre content of a TableTable content alignment to centre using tabular
Using font to highlight a god's speech in dialogue
How to find better food in airports
Tasha's Hideous Laughter used on a deaf person?
Can my UK debt be collected because I have to return to US?
Cheap oscilloscope showing 16 MHz square wave
Why is Mitch McConnell blocking nominees to the Federal Election Commission?
Is it good practice to speed up and slow down where not written in a song?
Why do fuses burn at a specific current?
Divide Numbers by 0
Heuristic argument for the Riemann Hypothesis
What is the definition of Product
Using large parts of a research paper
Calculate Landau's function
How to have the "Restore Missing Files" function from Nautilus without installing Nautilus?
Why didn't Thatcher give Hong Kong to Taiwan?
Get rows that exist exactly once per day for a given period
Can a system of three stars exist?
Blogging in LaTeX
Would someone mind just getting me started with my Russian homework?
How are the cards determined in an incomplete deck of many things?
How do you manage to study and have a balance in your life at the same time?
Turn off Google Chrome's Notification for "Flash Player will no longer be supported after December 2020."
Blender - Alpha is Luminance equivalent
Doesn't the concept of marginal utility speak to a cardinal utility function?
Table alignment (make the content centre)
What are the various units (ex, em, in, pt, bp, dd, pc) expressed in mm?Column with fixed width and centre alignmentHelp to make table of contentMake a linewidth table with booktabsTable: cmidrule alignment problem when working with tabular* environmentsMake the table look betterpositioning and alignment of table contentCan't centre tabular tableAlignment issues with rotated table contentVertically-centre content of a TableTable content alignment to centre using tabular
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to make the content center, i have out of idea what else I can change.
documentclass[12pt,oneside]book
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
usepackagemakecell,siunitx
usepackagebooktabs
begindocument
begintable[htp!]
centering
begintabular
l
S[table-format=2.2,table-space-text-post=%]
S[table-format=3.2,,table-space-text-post=%]
toprule
& multicolumn2ctheadmakebox[0pt]textbfDescriptive Analysis 1\
cmidrule2-3
& textbfMM
& textbfCM \
midrule
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
tables booktabs
add a comment |
I want to make the content center, i have out of idea what else I can change.
documentclass[12pt,oneside]book
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
usepackagemakecell,siunitx
usepackagebooktabs
begindocument
begintable[htp!]
centering
begintabular
l
S[table-format=2.2,table-space-text-post=%]
S[table-format=3.2,,table-space-text-post=%]
toprule
& multicolumn2ctheadmakebox[0pt]textbfDescriptive Analysis 1\
cmidrule2-3
& textbfMM
& textbfCM \
midrule
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
tables booktabs
add a comment |
I want to make the content center, i have out of idea what else I can change.
documentclass[12pt,oneside]book
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
usepackagemakecell,siunitx
usepackagebooktabs
begindocument
begintable[htp!]
centering
begintabular
l
S[table-format=2.2,table-space-text-post=%]
S[table-format=3.2,,table-space-text-post=%]
toprule
& multicolumn2ctheadmakebox[0pt]textbfDescriptive Analysis 1\
cmidrule2-3
& textbfMM
& textbfCM \
midrule
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
tables booktabs
I want to make the content center, i have out of idea what else I can change.
documentclass[12pt,oneside]book
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
usepackagemakecell,siunitx
usepackagebooktabs
begindocument
begintable[htp!]
centering
begintabular
l
S[table-format=2.2,table-space-text-post=%]
S[table-format=3.2,,table-space-text-post=%]
toprule
& multicolumn2ctheadmakebox[0pt]textbfDescriptive Analysis 1\
cmidrule2-3
& textbfMM
& textbfCM \
midrule
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
tables booktabs
tables booktabs
asked 8 hours ago
aanaan
3361 silver badge7 bronze badges
3361 silver badge7 bronze badges
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
You should fix the number of digits for the S
column and two pairs of are required around the two
textbf...
. You may consider also removing the braces around 10
but I'll leave it for you to decide.
documentclassarticle
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
usepackagemakecell,siunitx
usepackagebooktabs
begindocument
begintable[htp!]
setlengthtabcolsep1em
centering
begintabular
l
S[table-format=2.2,table-space-text-post=%]
S[table-format=2.2,table-space-text-post=%]
toprule
& multicolumn2ctheadmakebox[0pt]textbfDescriptive Analysis 1\
cmidrule2-3
& textbfMM
& textbfCM \
midrule
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
Thanks. Could you explain more what is the meaning ofsetlengthtabcolsep1em
? thanks.
– aan
7 hours ago
@aan:tabcolsep
is half of teh horizontal white space between teh contents of adjacent cells. The commandsetlengthtabcolsep1em
sets this space to be as wide as1em
. (See also What are the various units (ex, em, in, pt, bp, dd, pc) expressed in mm?)
– leandriis
6 hours ago
@aantabcolsep
is half the space between two columns, i.e from the right margin of one cell to the Ieft margin in same cell in the next column, it is two tabcolsep.1em
is approximatly the same as the width of the letterm
, or 12 pt here. The standard is 6pt and this example double it. The recommendation in some textbook I have, is0.5em
. It is better to set it relative to the fontsize usingem
than a fixed number of points.
– Sveinung
5 hours ago
add a comment |
Here is how I interpret your table. Since you have aligned the table at decimal point, the number without decimal is set to the left. You may overcome this by enclosing the two nunbers 10
in curly brackets (10
) or using multicolumn1c10
, but this is typographically probably not correct.
documentclass[12pt,oneside]book
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
usepackagemakecell,siunitx
usepackagebooktabs
begindocument
begintable
centering
begintabular@
l
S[table-format=2.2,table-space-text-post=%]
S[table-format=2.2,table-space-text-post=%] % As @Zarko says, reduce this numer to 1.1 if number 10 is centred, else 2.2
@
toprule
& multicolumn2@c@theadtextbfDescriptive Analysis 1\
cmidrule2-3
& multicolumn1ctextbfMM
& multicolumn1ctextbfCM \
midrule
%N & 10 & 10 \ % Enclose in brackets to centre the content
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
add a comment |
You need to override the S
column to a c
in all places where you don't have a percentage (and the numbers in the first column should be 4.2):
begintabular
l
S[table-format=4.2,table-space-text-post=%]
S[table-format=3.2,,table-space-text-post=%]
toprule
& multicolumn2ctheadmakebox[0pt]textbfDescriptive Analysis 1\
cmidrule2-3
& multicolumn1ctextbfMM & multicolumn1ctextbfCM \
midrule
N & multicolumn1c10 & multicolumn1c10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
"and the numbers in the first column should be 4.2" Could you please explain why? As far as I can see the numbers have only 2 digits before and 2 after the decimal separator. Why use4.2
which corresponds to four digits before and two after the decimal separator?
– leandriis
6 hours ago
@leandriis Yep, I was wrong. Thinking too much in C format descriptors...
– Rmano
5 hours ago
add a comment |
One more variation ...
Your problem arise from the fact that text in multicolumn
cell is wider than natural width of the spanned columns. Problem is solved, if you make those column has equal wider width, for example with determine their widths enough large as it is done in the following MWE:
documentclass[12pt,oneside]book
usepackagebooktabs, makecell
renewcommandtheadfontsmallbfseries
renewcommandtheadgape
usepackagesiunitx
begindocument
begintable
centering
sisetuptable-format=2.2,
table-space-text-post=%,
table-column-width=5em % <-----
begintabular@ l S S @
toprule
& multicolumn2@c@theadDescriptive Analysis 1 \
cmidrule2-3
& theadMM & theadCM \
midrule
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
I have zero overfull hboxes in my example. And the numbers 10 centre if I enclose them in curly brackets.
– Sveinung
5 hours ago
@Sveinung, sorry, I didn't test your solution :-(. I will do this asap. However, it has bigger reservation for integers in the last column and consequently work as you said. For this kind of tables number of sample are (usual) centered (since they are different type of data), so doing this is not typographical problematic.
– Zarko
5 hours ago
@Sveinung, I just test your answer. It also work without any warning , if you for the last column declareS[table-format=1.2,table-space-text-post=%]
. In this case you obtain better result, of course if you enclose number of samples in curly braces :-)
– Zarko
5 hours ago
Good observation, your are absolutely right, and I should have spotted it myself. Thank you. This assume the the figure 10 is centred. If not, it should be 2.2.
– Sveinung
4 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%2f506590%2ftable-alignment-make-the-content-centre%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
You should fix the number of digits for the S
column and two pairs of are required around the two
textbf...
. You may consider also removing the braces around 10
but I'll leave it for you to decide.
documentclassarticle
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
usepackagemakecell,siunitx
usepackagebooktabs
begindocument
begintable[htp!]
setlengthtabcolsep1em
centering
begintabular
l
S[table-format=2.2,table-space-text-post=%]
S[table-format=2.2,table-space-text-post=%]
toprule
& multicolumn2ctheadmakebox[0pt]textbfDescriptive Analysis 1\
cmidrule2-3
& textbfMM
& textbfCM \
midrule
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
Thanks. Could you explain more what is the meaning ofsetlengthtabcolsep1em
? thanks.
– aan
7 hours ago
@aan:tabcolsep
is half of teh horizontal white space between teh contents of adjacent cells. The commandsetlengthtabcolsep1em
sets this space to be as wide as1em
. (See also What are the various units (ex, em, in, pt, bp, dd, pc) expressed in mm?)
– leandriis
6 hours ago
@aantabcolsep
is half the space between two columns, i.e from the right margin of one cell to the Ieft margin in same cell in the next column, it is two tabcolsep.1em
is approximatly the same as the width of the letterm
, or 12 pt here. The standard is 6pt and this example double it. The recommendation in some textbook I have, is0.5em
. It is better to set it relative to the fontsize usingem
than a fixed number of points.
– Sveinung
5 hours ago
add a comment |
You should fix the number of digits for the S
column and two pairs of are required around the two
textbf...
. You may consider also removing the braces around 10
but I'll leave it for you to decide.
documentclassarticle
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
usepackagemakecell,siunitx
usepackagebooktabs
begindocument
begintable[htp!]
setlengthtabcolsep1em
centering
begintabular
l
S[table-format=2.2,table-space-text-post=%]
S[table-format=2.2,table-space-text-post=%]
toprule
& multicolumn2ctheadmakebox[0pt]textbfDescriptive Analysis 1\
cmidrule2-3
& textbfMM
& textbfCM \
midrule
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
Thanks. Could you explain more what is the meaning ofsetlengthtabcolsep1em
? thanks.
– aan
7 hours ago
@aan:tabcolsep
is half of teh horizontal white space between teh contents of adjacent cells. The commandsetlengthtabcolsep1em
sets this space to be as wide as1em
. (See also What are the various units (ex, em, in, pt, bp, dd, pc) expressed in mm?)
– leandriis
6 hours ago
@aantabcolsep
is half the space between two columns, i.e from the right margin of one cell to the Ieft margin in same cell in the next column, it is two tabcolsep.1em
is approximatly the same as the width of the letterm
, or 12 pt here. The standard is 6pt and this example double it. The recommendation in some textbook I have, is0.5em
. It is better to set it relative to the fontsize usingem
than a fixed number of points.
– Sveinung
5 hours ago
add a comment |
You should fix the number of digits for the S
column and two pairs of are required around the two
textbf...
. You may consider also removing the braces around 10
but I'll leave it for you to decide.
documentclassarticle
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
usepackagemakecell,siunitx
usepackagebooktabs
begindocument
begintable[htp!]
setlengthtabcolsep1em
centering
begintabular
l
S[table-format=2.2,table-space-text-post=%]
S[table-format=2.2,table-space-text-post=%]
toprule
& multicolumn2ctheadmakebox[0pt]textbfDescriptive Analysis 1\
cmidrule2-3
& textbfMM
& textbfCM \
midrule
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
You should fix the number of digits for the S
column and two pairs of are required around the two
textbf...
. You may consider also removing the braces around 10
but I'll leave it for you to decide.
documentclassarticle
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
usepackagemakecell,siunitx
usepackagebooktabs
begindocument
begintable[htp!]
setlengthtabcolsep1em
centering
begintabular
l
S[table-format=2.2,table-space-text-post=%]
S[table-format=2.2,table-space-text-post=%]
toprule
& multicolumn2ctheadmakebox[0pt]textbfDescriptive Analysis 1\
cmidrule2-3
& textbfMM
& textbfCM \
midrule
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
answered 7 hours ago
AboAmmarAboAmmar
36.4k3 gold badges31 silver badges87 bronze badges
36.4k3 gold badges31 silver badges87 bronze badges
Thanks. Could you explain more what is the meaning ofsetlengthtabcolsep1em
? thanks.
– aan
7 hours ago
@aan:tabcolsep
is half of teh horizontal white space between teh contents of adjacent cells. The commandsetlengthtabcolsep1em
sets this space to be as wide as1em
. (See also What are the various units (ex, em, in, pt, bp, dd, pc) expressed in mm?)
– leandriis
6 hours ago
@aantabcolsep
is half the space between two columns, i.e from the right margin of one cell to the Ieft margin in same cell in the next column, it is two tabcolsep.1em
is approximatly the same as the width of the letterm
, or 12 pt here. The standard is 6pt and this example double it. The recommendation in some textbook I have, is0.5em
. It is better to set it relative to the fontsize usingem
than a fixed number of points.
– Sveinung
5 hours ago
add a comment |
Thanks. Could you explain more what is the meaning ofsetlengthtabcolsep1em
? thanks.
– aan
7 hours ago
@aan:tabcolsep
is half of teh horizontal white space between teh contents of adjacent cells. The commandsetlengthtabcolsep1em
sets this space to be as wide as1em
. (See also What are the various units (ex, em, in, pt, bp, dd, pc) expressed in mm?)
– leandriis
6 hours ago
@aantabcolsep
is half the space between two columns, i.e from the right margin of one cell to the Ieft margin in same cell in the next column, it is two tabcolsep.1em
is approximatly the same as the width of the letterm
, or 12 pt here. The standard is 6pt and this example double it. The recommendation in some textbook I have, is0.5em
. It is better to set it relative to the fontsize usingem
than a fixed number of points.
– Sveinung
5 hours ago
Thanks. Could you explain more what is the meaning of
setlengthtabcolsep1em
? thanks.– aan
7 hours ago
Thanks. Could you explain more what is the meaning of
setlengthtabcolsep1em
? thanks.– aan
7 hours ago
@aan:
tabcolsep
is half of teh horizontal white space between teh contents of adjacent cells. The command setlengthtabcolsep1em
sets this space to be as wide as 1em
. (See also What are the various units (ex, em, in, pt, bp, dd, pc) expressed in mm?)– leandriis
6 hours ago
@aan:
tabcolsep
is half of teh horizontal white space between teh contents of adjacent cells. The command setlengthtabcolsep1em
sets this space to be as wide as 1em
. (See also What are the various units (ex, em, in, pt, bp, dd, pc) expressed in mm?)– leandriis
6 hours ago
@aan
tabcolsep
is half the space between two columns, i.e from the right margin of one cell to the Ieft margin in same cell in the next column, it is two tabcolsep. 1em
is approximatly the same as the width of the letter m
, or 12 pt here. The standard is 6pt and this example double it. The recommendation in some textbook I have, is 0.5em
. It is better to set it relative to the fontsize using em
than a fixed number of points.– Sveinung
5 hours ago
@aan
tabcolsep
is half the space between two columns, i.e from the right margin of one cell to the Ieft margin in same cell in the next column, it is two tabcolsep. 1em
is approximatly the same as the width of the letter m
, or 12 pt here. The standard is 6pt and this example double it. The recommendation in some textbook I have, is 0.5em
. It is better to set it relative to the fontsize using em
than a fixed number of points.– Sveinung
5 hours ago
add a comment |
Here is how I interpret your table. Since you have aligned the table at decimal point, the number without decimal is set to the left. You may overcome this by enclosing the two nunbers 10
in curly brackets (10
) or using multicolumn1c10
, but this is typographically probably not correct.
documentclass[12pt,oneside]book
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
usepackagemakecell,siunitx
usepackagebooktabs
begindocument
begintable
centering
begintabular@
l
S[table-format=2.2,table-space-text-post=%]
S[table-format=2.2,table-space-text-post=%] % As @Zarko says, reduce this numer to 1.1 if number 10 is centred, else 2.2
@
toprule
& multicolumn2@c@theadtextbfDescriptive Analysis 1\
cmidrule2-3
& multicolumn1ctextbfMM
& multicolumn1ctextbfCM \
midrule
%N & 10 & 10 \ % Enclose in brackets to centre the content
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
add a comment |
Here is how I interpret your table. Since you have aligned the table at decimal point, the number without decimal is set to the left. You may overcome this by enclosing the two nunbers 10
in curly brackets (10
) or using multicolumn1c10
, but this is typographically probably not correct.
documentclass[12pt,oneside]book
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
usepackagemakecell,siunitx
usepackagebooktabs
begindocument
begintable
centering
begintabular@
l
S[table-format=2.2,table-space-text-post=%]
S[table-format=2.2,table-space-text-post=%] % As @Zarko says, reduce this numer to 1.1 if number 10 is centred, else 2.2
@
toprule
& multicolumn2@c@theadtextbfDescriptive Analysis 1\
cmidrule2-3
& multicolumn1ctextbfMM
& multicolumn1ctextbfCM \
midrule
%N & 10 & 10 \ % Enclose in brackets to centre the content
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
add a comment |
Here is how I interpret your table. Since you have aligned the table at decimal point, the number without decimal is set to the left. You may overcome this by enclosing the two nunbers 10
in curly brackets (10
) or using multicolumn1c10
, but this is typographically probably not correct.
documentclass[12pt,oneside]book
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
usepackagemakecell,siunitx
usepackagebooktabs
begindocument
begintable
centering
begintabular@
l
S[table-format=2.2,table-space-text-post=%]
S[table-format=2.2,table-space-text-post=%] % As @Zarko says, reduce this numer to 1.1 if number 10 is centred, else 2.2
@
toprule
& multicolumn2@c@theadtextbfDescriptive Analysis 1\
cmidrule2-3
& multicolumn1ctextbfMM
& multicolumn1ctextbfCM \
midrule
%N & 10 & 10 \ % Enclose in brackets to centre the content
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
Here is how I interpret your table. Since you have aligned the table at decimal point, the number without decimal is set to the left. You may overcome this by enclosing the two nunbers 10
in curly brackets (10
) or using multicolumn1c10
, but this is typographically probably not correct.
documentclass[12pt,oneside]book
usepackageshowframe
renewcommandShowFrameLinethickness0.15pt
renewcommand*ShowFrameColorcolorred
usepackagemakecell,siunitx
usepackagebooktabs
begindocument
begintable
centering
begintabular@
l
S[table-format=2.2,table-space-text-post=%]
S[table-format=2.2,table-space-text-post=%] % As @Zarko says, reduce this numer to 1.1 if number 10 is centred, else 2.2
@
toprule
& multicolumn2@c@theadtextbfDescriptive Analysis 1\
cmidrule2-3
& multicolumn1ctextbfMM
& multicolumn1ctextbfCM \
midrule
%N & 10 & 10 \ % Enclose in brackets to centre the content
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
edited 4 hours ago
answered 7 hours ago
SveinungSveinung
14.1k2 gold badges38 silver badges63 bronze badges
14.1k2 gold badges38 silver badges63 bronze badges
add a comment |
add a comment |
You need to override the S
column to a c
in all places where you don't have a percentage (and the numbers in the first column should be 4.2):
begintabular
l
S[table-format=4.2,table-space-text-post=%]
S[table-format=3.2,,table-space-text-post=%]
toprule
& multicolumn2ctheadmakebox[0pt]textbfDescriptive Analysis 1\
cmidrule2-3
& multicolumn1ctextbfMM & multicolumn1ctextbfCM \
midrule
N & multicolumn1c10 & multicolumn1c10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
"and the numbers in the first column should be 4.2" Could you please explain why? As far as I can see the numbers have only 2 digits before and 2 after the decimal separator. Why use4.2
which corresponds to four digits before and two after the decimal separator?
– leandriis
6 hours ago
@leandriis Yep, I was wrong. Thinking too much in C format descriptors...
– Rmano
5 hours ago
add a comment |
You need to override the S
column to a c
in all places where you don't have a percentage (and the numbers in the first column should be 4.2):
begintabular
l
S[table-format=4.2,table-space-text-post=%]
S[table-format=3.2,,table-space-text-post=%]
toprule
& multicolumn2ctheadmakebox[0pt]textbfDescriptive Analysis 1\
cmidrule2-3
& multicolumn1ctextbfMM & multicolumn1ctextbfCM \
midrule
N & multicolumn1c10 & multicolumn1c10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
"and the numbers in the first column should be 4.2" Could you please explain why? As far as I can see the numbers have only 2 digits before and 2 after the decimal separator. Why use4.2
which corresponds to four digits before and two after the decimal separator?
– leandriis
6 hours ago
@leandriis Yep, I was wrong. Thinking too much in C format descriptors...
– Rmano
5 hours ago
add a comment |
You need to override the S
column to a c
in all places where you don't have a percentage (and the numbers in the first column should be 4.2):
begintabular
l
S[table-format=4.2,table-space-text-post=%]
S[table-format=3.2,,table-space-text-post=%]
toprule
& multicolumn2ctheadmakebox[0pt]textbfDescriptive Analysis 1\
cmidrule2-3
& multicolumn1ctextbfMM & multicolumn1ctextbfCM \
midrule
N & multicolumn1c10 & multicolumn1c10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
You need to override the S
column to a c
in all places where you don't have a percentage (and the numbers in the first column should be 4.2):
begintabular
l
S[table-format=4.2,table-space-text-post=%]
S[table-format=3.2,,table-space-text-post=%]
toprule
& multicolumn2ctheadmakebox[0pt]textbfDescriptive Analysis 1\
cmidrule2-3
& multicolumn1ctextbfMM & multicolumn1ctextbfCM \
midrule
N & multicolumn1c10 & multicolumn1c10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
answered 7 hours ago
RmanoRmano
10.1k2 gold badges17 silver badges54 bronze badges
10.1k2 gold badges17 silver badges54 bronze badges
"and the numbers in the first column should be 4.2" Could you please explain why? As far as I can see the numbers have only 2 digits before and 2 after the decimal separator. Why use4.2
which corresponds to four digits before and two after the decimal separator?
– leandriis
6 hours ago
@leandriis Yep, I was wrong. Thinking too much in C format descriptors...
– Rmano
5 hours ago
add a comment |
"and the numbers in the first column should be 4.2" Could you please explain why? As far as I can see the numbers have only 2 digits before and 2 after the decimal separator. Why use4.2
which corresponds to four digits before and two after the decimal separator?
– leandriis
6 hours ago
@leandriis Yep, I was wrong. Thinking too much in C format descriptors...
– Rmano
5 hours ago
"and the numbers in the first column should be 4.2" Could you please explain why? As far as I can see the numbers have only 2 digits before and 2 after the decimal separator. Why use
4.2
which corresponds to four digits before and two after the decimal separator?– leandriis
6 hours ago
"and the numbers in the first column should be 4.2" Could you please explain why? As far as I can see the numbers have only 2 digits before and 2 after the decimal separator. Why use
4.2
which corresponds to four digits before and two after the decimal separator?– leandriis
6 hours ago
@leandriis Yep, I was wrong. Thinking too much in C format descriptors...
– Rmano
5 hours ago
@leandriis Yep, I was wrong. Thinking too much in C format descriptors...
– Rmano
5 hours ago
add a comment |
One more variation ...
Your problem arise from the fact that text in multicolumn
cell is wider than natural width of the spanned columns. Problem is solved, if you make those column has equal wider width, for example with determine their widths enough large as it is done in the following MWE:
documentclass[12pt,oneside]book
usepackagebooktabs, makecell
renewcommandtheadfontsmallbfseries
renewcommandtheadgape
usepackagesiunitx
begindocument
begintable
centering
sisetuptable-format=2.2,
table-space-text-post=%,
table-column-width=5em % <-----
begintabular@ l S S @
toprule
& multicolumn2@c@theadDescriptive Analysis 1 \
cmidrule2-3
& theadMM & theadCM \
midrule
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
I have zero overfull hboxes in my example. And the numbers 10 centre if I enclose them in curly brackets.
– Sveinung
5 hours ago
@Sveinung, sorry, I didn't test your solution :-(. I will do this asap. However, it has bigger reservation for integers in the last column and consequently work as you said. For this kind of tables number of sample are (usual) centered (since they are different type of data), so doing this is not typographical problematic.
– Zarko
5 hours ago
@Sveinung, I just test your answer. It also work without any warning , if you for the last column declareS[table-format=1.2,table-space-text-post=%]
. In this case you obtain better result, of course if you enclose number of samples in curly braces :-)
– Zarko
5 hours ago
Good observation, your are absolutely right, and I should have spotted it myself. Thank you. This assume the the figure 10 is centred. If not, it should be 2.2.
– Sveinung
4 hours ago
add a comment |
One more variation ...
Your problem arise from the fact that text in multicolumn
cell is wider than natural width of the spanned columns. Problem is solved, if you make those column has equal wider width, for example with determine their widths enough large as it is done in the following MWE:
documentclass[12pt,oneside]book
usepackagebooktabs, makecell
renewcommandtheadfontsmallbfseries
renewcommandtheadgape
usepackagesiunitx
begindocument
begintable
centering
sisetuptable-format=2.2,
table-space-text-post=%,
table-column-width=5em % <-----
begintabular@ l S S @
toprule
& multicolumn2@c@theadDescriptive Analysis 1 \
cmidrule2-3
& theadMM & theadCM \
midrule
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
I have zero overfull hboxes in my example. And the numbers 10 centre if I enclose them in curly brackets.
– Sveinung
5 hours ago
@Sveinung, sorry, I didn't test your solution :-(. I will do this asap. However, it has bigger reservation for integers in the last column and consequently work as you said. For this kind of tables number of sample are (usual) centered (since they are different type of data), so doing this is not typographical problematic.
– Zarko
5 hours ago
@Sveinung, I just test your answer. It also work without any warning , if you for the last column declareS[table-format=1.2,table-space-text-post=%]
. In this case you obtain better result, of course if you enclose number of samples in curly braces :-)
– Zarko
5 hours ago
Good observation, your are absolutely right, and I should have spotted it myself. Thank you. This assume the the figure 10 is centred. If not, it should be 2.2.
– Sveinung
4 hours ago
add a comment |
One more variation ...
Your problem arise from the fact that text in multicolumn
cell is wider than natural width of the spanned columns. Problem is solved, if you make those column has equal wider width, for example with determine their widths enough large as it is done in the following MWE:
documentclass[12pt,oneside]book
usepackagebooktabs, makecell
renewcommandtheadfontsmallbfseries
renewcommandtheadgape
usepackagesiunitx
begindocument
begintable
centering
sisetuptable-format=2.2,
table-space-text-post=%,
table-column-width=5em % <-----
begintabular@ l S S @
toprule
& multicolumn2@c@theadDescriptive Analysis 1 \
cmidrule2-3
& theadMM & theadCM \
midrule
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
One more variation ...
Your problem arise from the fact that text in multicolumn
cell is wider than natural width of the spanned columns. Problem is solved, if you make those column has equal wider width, for example with determine their widths enough large as it is done in the following MWE:
documentclass[12pt,oneside]book
usepackagebooktabs, makecell
renewcommandtheadfontsmallbfseries
renewcommandtheadgape
usepackagesiunitx
begindocument
begintable
centering
sisetuptable-format=2.2,
table-space-text-post=%,
table-column-width=5em % <-----
begintabular@ l S S @
toprule
& multicolumn2@c@theadDescriptive Analysis 1 \
cmidrule2-3
& theadMM & theadCM \
midrule
N & 10 & 10 \
Mean & 91.45% & 8.55% \
Median & 94.74% & 5.26% \
bottomrule
endtabular
endtable
enddocument
edited 5 hours ago
answered 6 hours ago
ZarkoZarko
146k8 gold badges82 silver badges193 bronze badges
146k8 gold badges82 silver badges193 bronze badges
I have zero overfull hboxes in my example. And the numbers 10 centre if I enclose them in curly brackets.
– Sveinung
5 hours ago
@Sveinung, sorry, I didn't test your solution :-(. I will do this asap. However, it has bigger reservation for integers in the last column and consequently work as you said. For this kind of tables number of sample are (usual) centered (since they are different type of data), so doing this is not typographical problematic.
– Zarko
5 hours ago
@Sveinung, I just test your answer. It also work without any warning , if you for the last column declareS[table-format=1.2,table-space-text-post=%]
. In this case you obtain better result, of course if you enclose number of samples in curly braces :-)
– Zarko
5 hours ago
Good observation, your are absolutely right, and I should have spotted it myself. Thank you. This assume the the figure 10 is centred. If not, it should be 2.2.
– Sveinung
4 hours ago
add a comment |
I have zero overfull hboxes in my example. And the numbers 10 centre if I enclose them in curly brackets.
– Sveinung
5 hours ago
@Sveinung, sorry, I didn't test your solution :-(. I will do this asap. However, it has bigger reservation for integers in the last column and consequently work as you said. For this kind of tables number of sample are (usual) centered (since they are different type of data), so doing this is not typographical problematic.
– Zarko
5 hours ago
@Sveinung, I just test your answer. It also work without any warning , if you for the last column declareS[table-format=1.2,table-space-text-post=%]
. In this case you obtain better result, of course if you enclose number of samples in curly braces :-)
– Zarko
5 hours ago
Good observation, your are absolutely right, and I should have spotted it myself. Thank you. This assume the the figure 10 is centred. If not, it should be 2.2.
– Sveinung
4 hours ago
I have zero overfull hboxes in my example. And the numbers 10 centre if I enclose them in curly brackets.
– Sveinung
5 hours ago
I have zero overfull hboxes in my example. And the numbers 10 centre if I enclose them in curly brackets.
– Sveinung
5 hours ago
@Sveinung, sorry, I didn't test your solution :-(. I will do this asap. However, it has bigger reservation for integers in the last column and consequently work as you said. For this kind of tables number of sample are (usual) centered (since they are different type of data), so doing this is not typographical problematic.
– Zarko
5 hours ago
@Sveinung, sorry, I didn't test your solution :-(. I will do this asap. However, it has bigger reservation for integers in the last column and consequently work as you said. For this kind of tables number of sample are (usual) centered (since they are different type of data), so doing this is not typographical problematic.
– Zarko
5 hours ago
@Sveinung, I just test your answer. It also work without any warning , if you for the last column declare
S[table-format=1.2,table-space-text-post=%]
. In this case you obtain better result, of course if you enclose number of samples in curly braces :-)– Zarko
5 hours ago
@Sveinung, I just test your answer. It also work without any warning , if you for the last column declare
S[table-format=1.2,table-space-text-post=%]
. In this case you obtain better result, of course if you enclose number of samples in curly braces :-)– Zarko
5 hours ago
Good observation, your are absolutely right, and I should have spotted it myself. Thank you. This assume the the figure 10 is centred. If not, it should be 2.2.
– Sveinung
4 hours ago
Good observation, your are absolutely right, and I should have spotted it myself. Thank you. This assume the the figure 10 is centred. If not, it should be 2.2.
– Sveinung
4 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.
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%2f506590%2ftable-alignment-make-the-content-centre%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