Both horizontal and vertical centering in tabularx?
How to set a width of columns to be centered in vertical direction? Or in vertical and horizontal direction and the cells bellow as well?
Thank you
documentclass[12pt,a4paper]{report}
usepackage{booktabs, makecell, tabularx}
setlengthtextwidth{145mm}
setlengthtextheight{247mm}
setlengthoddsidemargin{15mm}
setlengthevensidemargin{15mm}
setlengthtopmargin{0mm}
setlengthheadsep{0mm}
setlengthheadheight{0mm}
letopenright=clearpage
begin{document}
begin{table}
small
renewcommand{arraystretch}{1.2}
begin{tabularx}{textwidth}{>{hsize=0.2hsize}X
>{hsize=0.25hsize}X
>{hsize=0.25hsize}X
>{hsize=0.3hsize}X}
Xhline{1.2pt}noalign{vskip 0.4ex}Xhline{1.2pt}%
Název souboru& Průměrná hodnota chyby& makecell{Odchylka určení \ průměrné chyby}& makecell{Počet středovaných \ bodů}\
Xhline{1.2pt}noalign{vskip 0.4ex}
B & A& C& D\
Xhline{1.2pt}
end{tabularx}
end{table}
end{document}
tables
add a comment |
How to set a width of columns to be centered in vertical direction? Or in vertical and horizontal direction and the cells bellow as well?
Thank you
documentclass[12pt,a4paper]{report}
usepackage{booktabs, makecell, tabularx}
setlengthtextwidth{145mm}
setlengthtextheight{247mm}
setlengthoddsidemargin{15mm}
setlengthevensidemargin{15mm}
setlengthtopmargin{0mm}
setlengthheadsep{0mm}
setlengthheadheight{0mm}
letopenright=clearpage
begin{document}
begin{table}
small
renewcommand{arraystretch}{1.2}
begin{tabularx}{textwidth}{>{hsize=0.2hsize}X
>{hsize=0.25hsize}X
>{hsize=0.25hsize}X
>{hsize=0.3hsize}X}
Xhline{1.2pt}noalign{vskip 0.4ex}Xhline{1.2pt}%
Název souboru& Průměrná hodnota chyby& makecell{Odchylka určení \ průměrné chyby}& makecell{Počet středovaných \ bodů}\
Xhline{1.2pt}noalign{vskip 0.4ex}
B & A& C& D\
Xhline{1.2pt}
end{tabularx}
end{table}
end{document}
tables
1
Do you like the tables :-)? Why do not use the geometry package to set the page?
– Sebastiano
Jan 2 at 20:41
add a comment |
How to set a width of columns to be centered in vertical direction? Or in vertical and horizontal direction and the cells bellow as well?
Thank you
documentclass[12pt,a4paper]{report}
usepackage{booktabs, makecell, tabularx}
setlengthtextwidth{145mm}
setlengthtextheight{247mm}
setlengthoddsidemargin{15mm}
setlengthevensidemargin{15mm}
setlengthtopmargin{0mm}
setlengthheadsep{0mm}
setlengthheadheight{0mm}
letopenright=clearpage
begin{document}
begin{table}
small
renewcommand{arraystretch}{1.2}
begin{tabularx}{textwidth}{>{hsize=0.2hsize}X
>{hsize=0.25hsize}X
>{hsize=0.25hsize}X
>{hsize=0.3hsize}X}
Xhline{1.2pt}noalign{vskip 0.4ex}Xhline{1.2pt}%
Název souboru& Průměrná hodnota chyby& makecell{Odchylka určení \ průměrné chyby}& makecell{Počet středovaných \ bodů}\
Xhline{1.2pt}noalign{vskip 0.4ex}
B & A& C& D\
Xhline{1.2pt}
end{tabularx}
end{table}
end{document}
tables
How to set a width of columns to be centered in vertical direction? Or in vertical and horizontal direction and the cells bellow as well?
Thank you
documentclass[12pt,a4paper]{report}
usepackage{booktabs, makecell, tabularx}
setlengthtextwidth{145mm}
setlengthtextheight{247mm}
setlengthoddsidemargin{15mm}
setlengthevensidemargin{15mm}
setlengthtopmargin{0mm}
setlengthheadsep{0mm}
setlengthheadheight{0mm}
letopenright=clearpage
begin{document}
begin{table}
small
renewcommand{arraystretch}{1.2}
begin{tabularx}{textwidth}{>{hsize=0.2hsize}X
>{hsize=0.25hsize}X
>{hsize=0.25hsize}X
>{hsize=0.3hsize}X}
Xhline{1.2pt}noalign{vskip 0.4ex}Xhline{1.2pt}%
Název souboru& Průměrná hodnota chyby& makecell{Odchylka určení \ průměrné chyby}& makecell{Počet středovaných \ bodů}\
Xhline{1.2pt}noalign{vskip 0.4ex}
B & A& C& D\
Xhline{1.2pt}
end{tabularx}
end{table}
end{document}
tables
tables
edited Jan 2 at 20:58
AboAmmar
34.5k32985
34.5k32985
asked Jan 2 at 20:37
ElisabethElisabeth
5027
5027
1
Do you like the tables :-)? Why do not use the geometry package to set the page?
– Sebastiano
Jan 2 at 20:41
add a comment |
1
Do you like the tables :-)? Why do not use the geometry package to set the page?
– Sebastiano
Jan 2 at 20:41
1
1
Do you like the tables :-)? Why do not use the geometry package to set the page?
– Sebastiano
Jan 2 at 20:41
Do you like the tables :-)? Why do not use the geometry package to set the page?
– Sebastiano
Jan 2 at 20:41
add a comment |
2 Answers
2
active
oldest
votes
Combining renewcommandtabularxcolumn[1]{m{#1}}
(from Vertical centering of all columns in tabularx environment) and newcolumntype{C}{>{centeringarraybackslash}X}
(from Centering in tabularx and X columns) you can achieve the following:
documentclass[12pt,a4paper]{report}
usepackage{booktabs, makecell, tabularx}
renewcommandtabularxcolumn[1]{m{#1}}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
begin{table}
small
renewcommand{arraystretch}{1.2}
begin{tabularx}{textwidth}{>{hsize=0.2hsize}C
>{hsize=0.25hsize}C
>{hsize=0.25hsize}C
>{hsize=0.3hsize}C}
Xhline{1.2pt}noalign{vskip 0.4ex}Xhline{1.2pt}%
Název souboru& Průměrná hodnota chyby& Odchylka určení průměrné chyby& Počet středovaných bodů\
Xhline{1.2pt}noalign{vskip 0.4ex}
B & A& C& D\
Xhline{1.2pt}
end{tabularx}
end{table}
end{document}
Please keep in mind that I have removed the makecell
cmmands as they distorted the vertical alignment. If you need to place the linebreaks manually, you can either use makecell[cc]{<text>}
in every column header (as suggested by Paul Stanley in the comments) or replace newcolumntype{C}{>{centeringarraybackslash}X}
by newcolumntype{C}{>{centeringletnewline\arraybackslash}X}
and use newline
where you want the linebreak to appear.
I ment centering like in the solution. Thank you. And please is the third column vertical centred? I mean that third and forth columns are lower
– Elisabeth
Jan 2 at 20:56
1
@Elisabeth:makecell
seems to have interfered with the vertical centering of them
type columns. I have therefor removed it.
– leandriis
Jan 2 at 21:01
@leandriis Now you have eliminated themakecell
s, which corrects the vertical spacing, but alters the substance. Probably better to put all the headings inmakecells
or add an optional vertical positioning argument to them?
– Paul Stanley
Jan 2 at 21:04
Thank you very much. It is exactly what I expected.
– Elisabeth
Jan 2 at 21:05
@PaulStanley: What do you mean by 'alter the substance'?
– leandriis
Jan 2 at 21:08
|
show 4 more comments
Improving a bit upon the nice solution of @leandriis, I would also remove all manual rule width manipulations and just use booktabs
macros, they take care of widths and separation nicely. No need for makecell
as also stated by leandriis.
If you want to break lines at certain points and used makecell
to do that, then you can still use newline
for that.
documentclass[12pt,a4paper]{report}
usepackage{booktabs, tabularx}
renewcommandtabularxcolumn[1]{m{#1}}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
begin{table}
small
renewcommand{arraystretch}{1.2}
begin{tabularx}{textwidth}{>{hsize=0.2hsize}C
>{hsize=0.25hsize}C
>{hsize=0.25hsize}C
>{hsize=0.3hsize}C}
toprule%
Název souboru & Průměrná hodnota chyby & Odchylka určení průměrné chyby & Počet středovaných bodů \
midrule
B & A & C & D \
bottomrule
end{tabularx}
end{table}
end{document}
Did you test the part aboutnewline
with your above example? If I add this to your code, the first line is not horizontally centered: i.stack.imgur.com/SIJx3.png You can bypass this usingnewcolumntype{C}{>{centeringletnewline\arraybackslash}X}
instead.
– leandriis
Jan 2 at 21:22
1
par
can be used instead.
– AboAmmar
Jan 2 at 22:04
add a comment |
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%2f468318%2fboth-horizontal-and-vertical-centering-in-tabularx%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Combining renewcommandtabularxcolumn[1]{m{#1}}
(from Vertical centering of all columns in tabularx environment) and newcolumntype{C}{>{centeringarraybackslash}X}
(from Centering in tabularx and X columns) you can achieve the following:
documentclass[12pt,a4paper]{report}
usepackage{booktabs, makecell, tabularx}
renewcommandtabularxcolumn[1]{m{#1}}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
begin{table}
small
renewcommand{arraystretch}{1.2}
begin{tabularx}{textwidth}{>{hsize=0.2hsize}C
>{hsize=0.25hsize}C
>{hsize=0.25hsize}C
>{hsize=0.3hsize}C}
Xhline{1.2pt}noalign{vskip 0.4ex}Xhline{1.2pt}%
Název souboru& Průměrná hodnota chyby& Odchylka určení průměrné chyby& Počet středovaných bodů\
Xhline{1.2pt}noalign{vskip 0.4ex}
B & A& C& D\
Xhline{1.2pt}
end{tabularx}
end{table}
end{document}
Please keep in mind that I have removed the makecell
cmmands as they distorted the vertical alignment. If you need to place the linebreaks manually, you can either use makecell[cc]{<text>}
in every column header (as suggested by Paul Stanley in the comments) or replace newcolumntype{C}{>{centeringarraybackslash}X}
by newcolumntype{C}{>{centeringletnewline\arraybackslash}X}
and use newline
where you want the linebreak to appear.
I ment centering like in the solution. Thank you. And please is the third column vertical centred? I mean that third and forth columns are lower
– Elisabeth
Jan 2 at 20:56
1
@Elisabeth:makecell
seems to have interfered with the vertical centering of them
type columns. I have therefor removed it.
– leandriis
Jan 2 at 21:01
@leandriis Now you have eliminated themakecell
s, which corrects the vertical spacing, but alters the substance. Probably better to put all the headings inmakecells
or add an optional vertical positioning argument to them?
– Paul Stanley
Jan 2 at 21:04
Thank you very much. It is exactly what I expected.
– Elisabeth
Jan 2 at 21:05
@PaulStanley: What do you mean by 'alter the substance'?
– leandriis
Jan 2 at 21:08
|
show 4 more comments
Combining renewcommandtabularxcolumn[1]{m{#1}}
(from Vertical centering of all columns in tabularx environment) and newcolumntype{C}{>{centeringarraybackslash}X}
(from Centering in tabularx and X columns) you can achieve the following:
documentclass[12pt,a4paper]{report}
usepackage{booktabs, makecell, tabularx}
renewcommandtabularxcolumn[1]{m{#1}}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
begin{table}
small
renewcommand{arraystretch}{1.2}
begin{tabularx}{textwidth}{>{hsize=0.2hsize}C
>{hsize=0.25hsize}C
>{hsize=0.25hsize}C
>{hsize=0.3hsize}C}
Xhline{1.2pt}noalign{vskip 0.4ex}Xhline{1.2pt}%
Název souboru& Průměrná hodnota chyby& Odchylka určení průměrné chyby& Počet středovaných bodů\
Xhline{1.2pt}noalign{vskip 0.4ex}
B & A& C& D\
Xhline{1.2pt}
end{tabularx}
end{table}
end{document}
Please keep in mind that I have removed the makecell
cmmands as they distorted the vertical alignment. If you need to place the linebreaks manually, you can either use makecell[cc]{<text>}
in every column header (as suggested by Paul Stanley in the comments) or replace newcolumntype{C}{>{centeringarraybackslash}X}
by newcolumntype{C}{>{centeringletnewline\arraybackslash}X}
and use newline
where you want the linebreak to appear.
I ment centering like in the solution. Thank you. And please is the third column vertical centred? I mean that third and forth columns are lower
– Elisabeth
Jan 2 at 20:56
1
@Elisabeth:makecell
seems to have interfered with the vertical centering of them
type columns. I have therefor removed it.
– leandriis
Jan 2 at 21:01
@leandriis Now you have eliminated themakecell
s, which corrects the vertical spacing, but alters the substance. Probably better to put all the headings inmakecells
or add an optional vertical positioning argument to them?
– Paul Stanley
Jan 2 at 21:04
Thank you very much. It is exactly what I expected.
– Elisabeth
Jan 2 at 21:05
@PaulStanley: What do you mean by 'alter the substance'?
– leandriis
Jan 2 at 21:08
|
show 4 more comments
Combining renewcommandtabularxcolumn[1]{m{#1}}
(from Vertical centering of all columns in tabularx environment) and newcolumntype{C}{>{centeringarraybackslash}X}
(from Centering in tabularx and X columns) you can achieve the following:
documentclass[12pt,a4paper]{report}
usepackage{booktabs, makecell, tabularx}
renewcommandtabularxcolumn[1]{m{#1}}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
begin{table}
small
renewcommand{arraystretch}{1.2}
begin{tabularx}{textwidth}{>{hsize=0.2hsize}C
>{hsize=0.25hsize}C
>{hsize=0.25hsize}C
>{hsize=0.3hsize}C}
Xhline{1.2pt}noalign{vskip 0.4ex}Xhline{1.2pt}%
Název souboru& Průměrná hodnota chyby& Odchylka určení průměrné chyby& Počet středovaných bodů\
Xhline{1.2pt}noalign{vskip 0.4ex}
B & A& C& D\
Xhline{1.2pt}
end{tabularx}
end{table}
end{document}
Please keep in mind that I have removed the makecell
cmmands as they distorted the vertical alignment. If you need to place the linebreaks manually, you can either use makecell[cc]{<text>}
in every column header (as suggested by Paul Stanley in the comments) or replace newcolumntype{C}{>{centeringarraybackslash}X}
by newcolumntype{C}{>{centeringletnewline\arraybackslash}X}
and use newline
where you want the linebreak to appear.
Combining renewcommandtabularxcolumn[1]{m{#1}}
(from Vertical centering of all columns in tabularx environment) and newcolumntype{C}{>{centeringarraybackslash}X}
(from Centering in tabularx and X columns) you can achieve the following:
documentclass[12pt,a4paper]{report}
usepackage{booktabs, makecell, tabularx}
renewcommandtabularxcolumn[1]{m{#1}}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
begin{table}
small
renewcommand{arraystretch}{1.2}
begin{tabularx}{textwidth}{>{hsize=0.2hsize}C
>{hsize=0.25hsize}C
>{hsize=0.25hsize}C
>{hsize=0.3hsize}C}
Xhline{1.2pt}noalign{vskip 0.4ex}Xhline{1.2pt}%
Název souboru& Průměrná hodnota chyby& Odchylka určení průměrné chyby& Počet středovaných bodů\
Xhline{1.2pt}noalign{vskip 0.4ex}
B & A& C& D\
Xhline{1.2pt}
end{tabularx}
end{table}
end{document}
Please keep in mind that I have removed the makecell
cmmands as they distorted the vertical alignment. If you need to place the linebreaks manually, you can either use makecell[cc]{<text>}
in every column header (as suggested by Paul Stanley in the comments) or replace newcolumntype{C}{>{centeringarraybackslash}X}
by newcolumntype{C}{>{centeringletnewline\arraybackslash}X}
and use newline
where you want the linebreak to appear.
edited Jan 2 at 21:27
answered Jan 2 at 20:43
leandriisleandriis
11k1732
11k1732
I ment centering like in the solution. Thank you. And please is the third column vertical centred? I mean that third and forth columns are lower
– Elisabeth
Jan 2 at 20:56
1
@Elisabeth:makecell
seems to have interfered with the vertical centering of them
type columns. I have therefor removed it.
– leandriis
Jan 2 at 21:01
@leandriis Now you have eliminated themakecell
s, which corrects the vertical spacing, but alters the substance. Probably better to put all the headings inmakecells
or add an optional vertical positioning argument to them?
– Paul Stanley
Jan 2 at 21:04
Thank you very much. It is exactly what I expected.
– Elisabeth
Jan 2 at 21:05
@PaulStanley: What do you mean by 'alter the substance'?
– leandriis
Jan 2 at 21:08
|
show 4 more comments
I ment centering like in the solution. Thank you. And please is the third column vertical centred? I mean that third and forth columns are lower
– Elisabeth
Jan 2 at 20:56
1
@Elisabeth:makecell
seems to have interfered with the vertical centering of them
type columns. I have therefor removed it.
– leandriis
Jan 2 at 21:01
@leandriis Now you have eliminated themakecell
s, which corrects the vertical spacing, but alters the substance. Probably better to put all the headings inmakecells
or add an optional vertical positioning argument to them?
– Paul Stanley
Jan 2 at 21:04
Thank you very much. It is exactly what I expected.
– Elisabeth
Jan 2 at 21:05
@PaulStanley: What do you mean by 'alter the substance'?
– leandriis
Jan 2 at 21:08
I ment centering like in the solution. Thank you. And please is the third column vertical centred? I mean that third and forth columns are lower
– Elisabeth
Jan 2 at 20:56
I ment centering like in the solution. Thank you. And please is the third column vertical centred? I mean that third and forth columns are lower
– Elisabeth
Jan 2 at 20:56
1
1
@Elisabeth:
makecell
seems to have interfered with the vertical centering of the m
type columns. I have therefor removed it.– leandriis
Jan 2 at 21:01
@Elisabeth:
makecell
seems to have interfered with the vertical centering of the m
type columns. I have therefor removed it.– leandriis
Jan 2 at 21:01
@leandriis Now you have eliminated the
makecell
s, which corrects the vertical spacing, but alters the substance. Probably better to put all the headings in makecells
or add an optional vertical positioning argument to them?– Paul Stanley
Jan 2 at 21:04
@leandriis Now you have eliminated the
makecell
s, which corrects the vertical spacing, but alters the substance. Probably better to put all the headings in makecells
or add an optional vertical positioning argument to them?– Paul Stanley
Jan 2 at 21:04
Thank you very much. It is exactly what I expected.
– Elisabeth
Jan 2 at 21:05
Thank you very much. It is exactly what I expected.
– Elisabeth
Jan 2 at 21:05
@PaulStanley: What do you mean by 'alter the substance'?
– leandriis
Jan 2 at 21:08
@PaulStanley: What do you mean by 'alter the substance'?
– leandriis
Jan 2 at 21:08
|
show 4 more comments
Improving a bit upon the nice solution of @leandriis, I would also remove all manual rule width manipulations and just use booktabs
macros, they take care of widths and separation nicely. No need for makecell
as also stated by leandriis.
If you want to break lines at certain points and used makecell
to do that, then you can still use newline
for that.
documentclass[12pt,a4paper]{report}
usepackage{booktabs, tabularx}
renewcommandtabularxcolumn[1]{m{#1}}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
begin{table}
small
renewcommand{arraystretch}{1.2}
begin{tabularx}{textwidth}{>{hsize=0.2hsize}C
>{hsize=0.25hsize}C
>{hsize=0.25hsize}C
>{hsize=0.3hsize}C}
toprule%
Název souboru & Průměrná hodnota chyby & Odchylka určení průměrné chyby & Počet středovaných bodů \
midrule
B & A & C & D \
bottomrule
end{tabularx}
end{table}
end{document}
Did you test the part aboutnewline
with your above example? If I add this to your code, the first line is not horizontally centered: i.stack.imgur.com/SIJx3.png You can bypass this usingnewcolumntype{C}{>{centeringletnewline\arraybackslash}X}
instead.
– leandriis
Jan 2 at 21:22
1
par
can be used instead.
– AboAmmar
Jan 2 at 22:04
add a comment |
Improving a bit upon the nice solution of @leandriis, I would also remove all manual rule width manipulations and just use booktabs
macros, they take care of widths and separation nicely. No need for makecell
as also stated by leandriis.
If you want to break lines at certain points and used makecell
to do that, then you can still use newline
for that.
documentclass[12pt,a4paper]{report}
usepackage{booktabs, tabularx}
renewcommandtabularxcolumn[1]{m{#1}}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
begin{table}
small
renewcommand{arraystretch}{1.2}
begin{tabularx}{textwidth}{>{hsize=0.2hsize}C
>{hsize=0.25hsize}C
>{hsize=0.25hsize}C
>{hsize=0.3hsize}C}
toprule%
Název souboru & Průměrná hodnota chyby & Odchylka určení průměrné chyby & Počet středovaných bodů \
midrule
B & A & C & D \
bottomrule
end{tabularx}
end{table}
end{document}
Did you test the part aboutnewline
with your above example? If I add this to your code, the first line is not horizontally centered: i.stack.imgur.com/SIJx3.png You can bypass this usingnewcolumntype{C}{>{centeringletnewline\arraybackslash}X}
instead.
– leandriis
Jan 2 at 21:22
1
par
can be used instead.
– AboAmmar
Jan 2 at 22:04
add a comment |
Improving a bit upon the nice solution of @leandriis, I would also remove all manual rule width manipulations and just use booktabs
macros, they take care of widths and separation nicely. No need for makecell
as also stated by leandriis.
If you want to break lines at certain points and used makecell
to do that, then you can still use newline
for that.
documentclass[12pt,a4paper]{report}
usepackage{booktabs, tabularx}
renewcommandtabularxcolumn[1]{m{#1}}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
begin{table}
small
renewcommand{arraystretch}{1.2}
begin{tabularx}{textwidth}{>{hsize=0.2hsize}C
>{hsize=0.25hsize}C
>{hsize=0.25hsize}C
>{hsize=0.3hsize}C}
toprule%
Název souboru & Průměrná hodnota chyby & Odchylka určení průměrné chyby & Počet středovaných bodů \
midrule
B & A & C & D \
bottomrule
end{tabularx}
end{table}
end{document}
Improving a bit upon the nice solution of @leandriis, I would also remove all manual rule width manipulations and just use booktabs
macros, they take care of widths and separation nicely. No need for makecell
as also stated by leandriis.
If you want to break lines at certain points and used makecell
to do that, then you can still use newline
for that.
documentclass[12pt,a4paper]{report}
usepackage{booktabs, tabularx}
renewcommandtabularxcolumn[1]{m{#1}}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
begin{table}
small
renewcommand{arraystretch}{1.2}
begin{tabularx}{textwidth}{>{hsize=0.2hsize}C
>{hsize=0.25hsize}C
>{hsize=0.25hsize}C
>{hsize=0.3hsize}C}
toprule%
Název souboru & Průměrná hodnota chyby & Odchylka určení průměrné chyby & Počet středovaných bodů \
midrule
B & A & C & D \
bottomrule
end{tabularx}
end{table}
end{document}
edited Jan 2 at 21:17
answered Jan 2 at 21:11
AboAmmarAboAmmar
34.5k32985
34.5k32985
Did you test the part aboutnewline
with your above example? If I add this to your code, the first line is not horizontally centered: i.stack.imgur.com/SIJx3.png You can bypass this usingnewcolumntype{C}{>{centeringletnewline\arraybackslash}X}
instead.
– leandriis
Jan 2 at 21:22
1
par
can be used instead.
– AboAmmar
Jan 2 at 22:04
add a comment |
Did you test the part aboutnewline
with your above example? If I add this to your code, the first line is not horizontally centered: i.stack.imgur.com/SIJx3.png You can bypass this usingnewcolumntype{C}{>{centeringletnewline\arraybackslash}X}
instead.
– leandriis
Jan 2 at 21:22
1
par
can be used instead.
– AboAmmar
Jan 2 at 22:04
Did you test the part about
newline
with your above example? If I add this to your code, the first line is not horizontally centered: i.stack.imgur.com/SIJx3.png You can bypass this using newcolumntype{C}{>{centeringletnewline\arraybackslash}X}
instead.– leandriis
Jan 2 at 21:22
Did you test the part about
newline
with your above example? If I add this to your code, the first line is not horizontally centered: i.stack.imgur.com/SIJx3.png You can bypass this using newcolumntype{C}{>{centeringletnewline\arraybackslash}X}
instead.– leandriis
Jan 2 at 21:22
1
1
par
can be used instead.– AboAmmar
Jan 2 at 22:04
par
can be used instead.– AboAmmar
Jan 2 at 22:04
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%2f468318%2fboth-horizontal-and-vertical-centering-in-tabularx%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
1
Do you like the tables :-)? Why do not use the geometry package to set the page?
– Sebastiano
Jan 2 at 20:41