How to set column width that table aligns automatic with merged cells?
What I want to do is make a table in the format that I have showed below. At the moment the width of the columns is different and the table is to wide for the page. It looks as following:

What I am trying to do is
1) set the table to be as wide as the text, so that it takes up maximum space within the margins
2) set that column 2, 3 and 4 that contain the results are the same width.
begin{table}[H] centering caption{X} label{X}
begin{tabular}{cccc}
textbf{References} & textbf{Results 1} & textbf{Results 2} & textbf{Results 3} \hlinehline
Author (Year)
&
Answer Answer
&
Answer Answer Answer Answer
&
begin{tabular}{c}
Answer Answer Answer Answer Answer Answer \
Answer Answer Answer \
end{tabular}
\hline
Author (Year) &
begin{tabular}{c}
Answer \
Answer \
end{tabular}
&
Answer Answer
&
begin{tabular}{c}
Answer Answer Answer \
Answer Answer Answer \
end{tabular}
\hline
Author (Year) &
begin{tabular}{c}
Answer \
Answer \
Answer \
end{tabular}
&
multicolumn{2}{c}{Answer Answer Answer Answer Answer Answer Answer Answer }
\hline
end{tabular}
end{table}
tables
add a comment |
What I want to do is make a table in the format that I have showed below. At the moment the width of the columns is different and the table is to wide for the page. It looks as following:

What I am trying to do is
1) set the table to be as wide as the text, so that it takes up maximum space within the margins
2) set that column 2, 3 and 4 that contain the results are the same width.
begin{table}[H] centering caption{X} label{X}
begin{tabular}{cccc}
textbf{References} & textbf{Results 1} & textbf{Results 2} & textbf{Results 3} \hlinehline
Author (Year)
&
Answer Answer
&
Answer Answer Answer Answer
&
begin{tabular}{c}
Answer Answer Answer Answer Answer Answer \
Answer Answer Answer \
end{tabular}
\hline
Author (Year) &
begin{tabular}{c}
Answer \
Answer \
end{tabular}
&
Answer Answer
&
begin{tabular}{c}
Answer Answer Answer \
Answer Answer Answer \
end{tabular}
\hline
Author (Year) &
begin{tabular}{c}
Answer \
Answer \
Answer \
end{tabular}
&
multicolumn{2}{c}{Answer Answer Answer Answer Answer Answer Answer Answer }
\hline
end{tabular}
end{table}
tables
Welcome to TeX-SE! Are you looking fortabularx?
– marmot
Feb 27 at 4:17
add a comment |
What I want to do is make a table in the format that I have showed below. At the moment the width of the columns is different and the table is to wide for the page. It looks as following:

What I am trying to do is
1) set the table to be as wide as the text, so that it takes up maximum space within the margins
2) set that column 2, 3 and 4 that contain the results are the same width.
begin{table}[H] centering caption{X} label{X}
begin{tabular}{cccc}
textbf{References} & textbf{Results 1} & textbf{Results 2} & textbf{Results 3} \hlinehline
Author (Year)
&
Answer Answer
&
Answer Answer Answer Answer
&
begin{tabular}{c}
Answer Answer Answer Answer Answer Answer \
Answer Answer Answer \
end{tabular}
\hline
Author (Year) &
begin{tabular}{c}
Answer \
Answer \
end{tabular}
&
Answer Answer
&
begin{tabular}{c}
Answer Answer Answer \
Answer Answer Answer \
end{tabular}
\hline
Author (Year) &
begin{tabular}{c}
Answer \
Answer \
Answer \
end{tabular}
&
multicolumn{2}{c}{Answer Answer Answer Answer Answer Answer Answer Answer }
\hline
end{tabular}
end{table}
tables
What I want to do is make a table in the format that I have showed below. At the moment the width of the columns is different and the table is to wide for the page. It looks as following:

What I am trying to do is
1) set the table to be as wide as the text, so that it takes up maximum space within the margins
2) set that column 2, 3 and 4 that contain the results are the same width.
begin{table}[H] centering caption{X} label{X}
begin{tabular}{cccc}
textbf{References} & textbf{Results 1} & textbf{Results 2} & textbf{Results 3} \hlinehline
Author (Year)
&
Answer Answer
&
Answer Answer Answer Answer
&
begin{tabular}{c}
Answer Answer Answer Answer Answer Answer \
Answer Answer Answer \
end{tabular}
\hline
Author (Year) &
begin{tabular}{c}
Answer \
Answer \
end{tabular}
&
Answer Answer
&
begin{tabular}{c}
Answer Answer Answer \
Answer Answer Answer \
end{tabular}
\hline
Author (Year) &
begin{tabular}{c}
Answer \
Answer \
Answer \
end{tabular}
&
multicolumn{2}{c}{Answer Answer Answer Answer Answer Answer Answer Answer }
\hline
end{tabular}
end{table}
tables
tables
edited Feb 27 at 4:43
Zarko
126k868165
126k868165
asked Feb 27 at 4:11
AlexAlex
153
153
Welcome to TeX-SE! Are you looking fortabularx?
– marmot
Feb 27 at 4:17
add a comment |
Welcome to TeX-SE! Are you looking fortabularx?
– marmot
Feb 27 at 4:17
Welcome to TeX-SE! Are you looking for
tabularx?– marmot
Feb 27 at 4:17
Welcome to TeX-SE! Are you looking for
tabularx?– marmot
Feb 27 at 4:17
add a comment |
1 Answer
1
active
oldest
votes
with tabularx is no need to nest tables:
documentclass{article}
usepackage{geometry}
usepackage{booktabs, tabularx}
usepackage[skip=1ex]{caption}
begin{document}
begin{table}[htb]
caption{X}
label{X}
begin{tabularx}{linewidth}{@{} l *{3}{>{centeringarraybackslash}X} @{}}
toprule
textbf{References} & textbf{Results 1} & textbf{Results 2} & textbf{Results 3} \
midrule
Author (Year)
& Answer Answer
& Answer Answer Answer Answer
& Answer Answer Answer Answer Answer Answer
Answer Answer Answer \
midrule
Author (Year)
& Answer
Answer
& Answer Answer
& Answer Answer Answer
Answer Answer Answer \
midrule
Author (Year)
& Answer
Answer
Answer
& multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolseprelax
centeringarraybackslash}X}{%
Answer Answer Answer Answer Answer Answer Answer Answer } \
bottomrule
end{tabularx}
end{table}
end{document}

instead of horizontally centered cells text i would rather have left aligned, i.e. instead of >{centeringarraybackslash}X use >{raggedrightarraybackslash}X
+1. Since there are no vertical rules in the table, one can (should...) omit thearrayrulewidthadjustment.
– Mico
Feb 27 at 7:12
@Mico, during tests it was there, but then i erase it and forget to correct calculation of columns width. thank you very much!
– Zarko
Feb 27 at 9:03
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%2f476868%2fhow-to-set-column-width-that-table-aligns-automatic-with-merged-cells%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
with tabularx is no need to nest tables:
documentclass{article}
usepackage{geometry}
usepackage{booktabs, tabularx}
usepackage[skip=1ex]{caption}
begin{document}
begin{table}[htb]
caption{X}
label{X}
begin{tabularx}{linewidth}{@{} l *{3}{>{centeringarraybackslash}X} @{}}
toprule
textbf{References} & textbf{Results 1} & textbf{Results 2} & textbf{Results 3} \
midrule
Author (Year)
& Answer Answer
& Answer Answer Answer Answer
& Answer Answer Answer Answer Answer Answer
Answer Answer Answer \
midrule
Author (Year)
& Answer
Answer
& Answer Answer
& Answer Answer Answer
Answer Answer Answer \
midrule
Author (Year)
& Answer
Answer
Answer
& multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolseprelax
centeringarraybackslash}X}{%
Answer Answer Answer Answer Answer Answer Answer Answer } \
bottomrule
end{tabularx}
end{table}
end{document}

instead of horizontally centered cells text i would rather have left aligned, i.e. instead of >{centeringarraybackslash}X use >{raggedrightarraybackslash}X
+1. Since there are no vertical rules in the table, one can (should...) omit thearrayrulewidthadjustment.
– Mico
Feb 27 at 7:12
@Mico, during tests it was there, but then i erase it and forget to correct calculation of columns width. thank you very much!
– Zarko
Feb 27 at 9:03
add a comment |
with tabularx is no need to nest tables:
documentclass{article}
usepackage{geometry}
usepackage{booktabs, tabularx}
usepackage[skip=1ex]{caption}
begin{document}
begin{table}[htb]
caption{X}
label{X}
begin{tabularx}{linewidth}{@{} l *{3}{>{centeringarraybackslash}X} @{}}
toprule
textbf{References} & textbf{Results 1} & textbf{Results 2} & textbf{Results 3} \
midrule
Author (Year)
& Answer Answer
& Answer Answer Answer Answer
& Answer Answer Answer Answer Answer Answer
Answer Answer Answer \
midrule
Author (Year)
& Answer
Answer
& Answer Answer
& Answer Answer Answer
Answer Answer Answer \
midrule
Author (Year)
& Answer
Answer
Answer
& multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolseprelax
centeringarraybackslash}X}{%
Answer Answer Answer Answer Answer Answer Answer Answer } \
bottomrule
end{tabularx}
end{table}
end{document}

instead of horizontally centered cells text i would rather have left aligned, i.e. instead of >{centeringarraybackslash}X use >{raggedrightarraybackslash}X
+1. Since there are no vertical rules in the table, one can (should...) omit thearrayrulewidthadjustment.
– Mico
Feb 27 at 7:12
@Mico, during tests it was there, but then i erase it and forget to correct calculation of columns width. thank you very much!
– Zarko
Feb 27 at 9:03
add a comment |
with tabularx is no need to nest tables:
documentclass{article}
usepackage{geometry}
usepackage{booktabs, tabularx}
usepackage[skip=1ex]{caption}
begin{document}
begin{table}[htb]
caption{X}
label{X}
begin{tabularx}{linewidth}{@{} l *{3}{>{centeringarraybackslash}X} @{}}
toprule
textbf{References} & textbf{Results 1} & textbf{Results 2} & textbf{Results 3} \
midrule
Author (Year)
& Answer Answer
& Answer Answer Answer Answer
& Answer Answer Answer Answer Answer Answer
Answer Answer Answer \
midrule
Author (Year)
& Answer
Answer
& Answer Answer
& Answer Answer Answer
Answer Answer Answer \
midrule
Author (Year)
& Answer
Answer
Answer
& multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolseprelax
centeringarraybackslash}X}{%
Answer Answer Answer Answer Answer Answer Answer Answer } \
bottomrule
end{tabularx}
end{table}
end{document}

instead of horizontally centered cells text i would rather have left aligned, i.e. instead of >{centeringarraybackslash}X use >{raggedrightarraybackslash}X
with tabularx is no need to nest tables:
documentclass{article}
usepackage{geometry}
usepackage{booktabs, tabularx}
usepackage[skip=1ex]{caption}
begin{document}
begin{table}[htb]
caption{X}
label{X}
begin{tabularx}{linewidth}{@{} l *{3}{>{centeringarraybackslash}X} @{}}
toprule
textbf{References} & textbf{Results 1} & textbf{Results 2} & textbf{Results 3} \
midrule
Author (Year)
& Answer Answer
& Answer Answer Answer Answer
& Answer Answer Answer Answer Answer Answer
Answer Answer Answer \
midrule
Author (Year)
& Answer
Answer
& Answer Answer
& Answer Answer Answer
Answer Answer Answer \
midrule
Author (Year)
& Answer
Answer
Answer
& multicolumn{2}{>{hsize=dimexpr2hsize+2tabcolseprelax
centeringarraybackslash}X}{%
Answer Answer Answer Answer Answer Answer Answer Answer } \
bottomrule
end{tabularx}
end{table}
end{document}

instead of horizontally centered cells text i would rather have left aligned, i.e. instead of >{centeringarraybackslash}X use >{raggedrightarraybackslash}X
edited Feb 27 at 9:00
answered Feb 27 at 4:58
ZarkoZarko
126k868165
126k868165
+1. Since there are no vertical rules in the table, one can (should...) omit thearrayrulewidthadjustment.
– Mico
Feb 27 at 7:12
@Mico, during tests it was there, but then i erase it and forget to correct calculation of columns width. thank you very much!
– Zarko
Feb 27 at 9:03
add a comment |
+1. Since there are no vertical rules in the table, one can (should...) omit thearrayrulewidthadjustment.
– Mico
Feb 27 at 7:12
@Mico, during tests it was there, but then i erase it and forget to correct calculation of columns width. thank you very much!
– Zarko
Feb 27 at 9:03
+1. Since there are no vertical rules in the table, one can (should...) omit the
arrayrulewidth adjustment.– Mico
Feb 27 at 7:12
+1. Since there are no vertical rules in the table, one can (should...) omit the
arrayrulewidth adjustment.– Mico
Feb 27 at 7:12
@Mico, during tests it was there, but then i erase it and forget to correct calculation of columns width. thank you very much!
– Zarko
Feb 27 at 9:03
@Mico, during tests it was there, but then i erase it and forget to correct calculation of columns width. thank you very much!
– Zarko
Feb 27 at 9:03
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%2f476868%2fhow-to-set-column-width-that-table-aligns-automatic-with-merged-cells%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
Welcome to TeX-SE! Are you looking for
tabularx?– marmot
Feb 27 at 4:17