Control width of columns in a tabular environment
I would like the pieces of texts in the right column to be closer to the pieces of text in the left column. At the same time, I want the table to accommodate long pieces of text nicely, as it does now. One way to achieve this result would be to restrict the width of the left column, augment the width of the right column, and move the left margin of the right column to the left. But I do not know how to do it.
Here is a MWE of what I got so far:
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{booktabs}
begin{document}
begin{table}
centering
begin{tabular}{*{2}{p{.425linewidth}}}
toprule
first & second second second second second second second second second second\
midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth fourth fourth \
bottomrule
end{tabular}
end{table}
end{document}
Thanks for your help.
tables booktabs
add a comment |
I would like the pieces of texts in the right column to be closer to the pieces of text in the left column. At the same time, I want the table to accommodate long pieces of text nicely, as it does now. One way to achieve this result would be to restrict the width of the left column, augment the width of the right column, and move the left margin of the right column to the left. But I do not know how to do it.
Here is a MWE of what I got so far:
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{booktabs}
begin{document}
begin{table}
centering
begin{tabular}{*{2}{p{.425linewidth}}}
toprule
first & second second second second second second second second second second\
midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth fourth fourth \
bottomrule
end{tabular}
end{table}
end{document}
Thanks for your help.
tables booktabs
2
You're probably looking for a setup likebegin{tabularx}{linewidth}{ l X }
...end{tabularx}
(requiresusepackage{tabularx}
in your preamble).
– Werner
Mar 19 at 15:27
Thanks very much. This indeed achieves the goal.
– orient
Mar 19 at 15:50
add a comment |
I would like the pieces of texts in the right column to be closer to the pieces of text in the left column. At the same time, I want the table to accommodate long pieces of text nicely, as it does now. One way to achieve this result would be to restrict the width of the left column, augment the width of the right column, and move the left margin of the right column to the left. But I do not know how to do it.
Here is a MWE of what I got so far:
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{booktabs}
begin{document}
begin{table}
centering
begin{tabular}{*{2}{p{.425linewidth}}}
toprule
first & second second second second second second second second second second\
midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth fourth fourth \
bottomrule
end{tabular}
end{table}
end{document}
Thanks for your help.
tables booktabs
I would like the pieces of texts in the right column to be closer to the pieces of text in the left column. At the same time, I want the table to accommodate long pieces of text nicely, as it does now. One way to achieve this result would be to restrict the width of the left column, augment the width of the right column, and move the left margin of the right column to the left. But I do not know how to do it.
Here is a MWE of what I got so far:
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{booktabs}
begin{document}
begin{table}
centering
begin{tabular}{*{2}{p{.425linewidth}}}
toprule
first & second second second second second second second second second second\
midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth fourth fourth \
bottomrule
end{tabular}
end{table}
end{document}
Thanks for your help.
tables booktabs
tables booktabs
edited Mar 19 at 15:35
Mico
284k31388778
284k31388778
asked Mar 19 at 15:24
orientorient
1445
1445
2
You're probably looking for a setup likebegin{tabularx}{linewidth}{ l X }
...end{tabularx}
(requiresusepackage{tabularx}
in your preamble).
– Werner
Mar 19 at 15:27
Thanks very much. This indeed achieves the goal.
– orient
Mar 19 at 15:50
add a comment |
2
You're probably looking for a setup likebegin{tabularx}{linewidth}{ l X }
...end{tabularx}
(requiresusepackage{tabularx}
in your preamble).
– Werner
Mar 19 at 15:27
Thanks very much. This indeed achieves the goal.
– orient
Mar 19 at 15:50
2
2
You're probably looking for a setup like
begin{tabularx}{linewidth}{ l X }
... end{tabularx}
(requires usepackage{tabularx}
in your preamble).– Werner
Mar 19 at 15:27
You're probably looking for a setup like
begin{tabularx}{linewidth}{ l X }
... end{tabularx}
(requires usepackage{tabularx}
in your preamble).– Werner
Mar 19 at 15:27
Thanks very much. This indeed achieves the goal.
– orient
Mar 19 at 15:50
Thanks very much. This indeed achieves the goal.
– orient
Mar 19 at 15:50
add a comment |
2 Answers
2
active
oldest
votes
As far as I understand the question, I would try
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{booktabs}
begin{document}
begin{table}
centering
begin{tabular}{l p{0.5linewidth}}
toprule
first & second second second second second second second second second second\
midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth fourth fourth \
bottomrule
end{tabular}
end{table}
end{document}
to obtain
Thanks, Denis. Your solution also works and is indeed using just the package booktabs.
– orient
Mar 19 at 15:51
add a comment |
As @Werner has already pointed out in a comment, a good candidate solution for your formatting objective would be to load the tabularx
package and to employ a tabularx
environment (with overall width set to textwidth
) instead of tabular
. Then, change the first column specification from p{...}
to l
, and change the second column specification from p{...}
to X
.
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{booktabs}
usepackage{tabularx} % for "tabularx" env. and "X" column type
begin{document}
begin{table}
begin{tabularx}{textwidth}{@{} l X @{}}
toprule
first & second second second second second second second
second second second second second second second second \
midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth
fourth fourth fourth fourth \
bottomrule
end{tabularx}
end{table}
end{document}
Thanks very much, Mico. Your idea does provide the solution.
– orient
Mar 19 at 15:51
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%2f480296%2fcontrol-width-of-columns-in-a-tabular-environment%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
As far as I understand the question, I would try
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{booktabs}
begin{document}
begin{table}
centering
begin{tabular}{l p{0.5linewidth}}
toprule
first & second second second second second second second second second second\
midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth fourth fourth \
bottomrule
end{tabular}
end{table}
end{document}
to obtain
Thanks, Denis. Your solution also works and is indeed using just the package booktabs.
– orient
Mar 19 at 15:51
add a comment |
As far as I understand the question, I would try
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{booktabs}
begin{document}
begin{table}
centering
begin{tabular}{l p{0.5linewidth}}
toprule
first & second second second second second second second second second second\
midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth fourth fourth \
bottomrule
end{tabular}
end{table}
end{document}
to obtain
Thanks, Denis. Your solution also works and is indeed using just the package booktabs.
– orient
Mar 19 at 15:51
add a comment |
As far as I understand the question, I would try
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{booktabs}
begin{document}
begin{table}
centering
begin{tabular}{l p{0.5linewidth}}
toprule
first & second second second second second second second second second second\
midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth fourth fourth \
bottomrule
end{tabular}
end{table}
end{document}
to obtain
As far as I understand the question, I would try
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{booktabs}
begin{document}
begin{table}
centering
begin{tabular}{l p{0.5linewidth}}
toprule
first & second second second second second second second second second second\
midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth fourth fourth \
bottomrule
end{tabular}
end{table}
end{document}
to obtain
answered Mar 19 at 15:39
DenisDenis
2,638520
2,638520
Thanks, Denis. Your solution also works and is indeed using just the package booktabs.
– orient
Mar 19 at 15:51
add a comment |
Thanks, Denis. Your solution also works and is indeed using just the package booktabs.
– orient
Mar 19 at 15:51
Thanks, Denis. Your solution also works and is indeed using just the package booktabs.
– orient
Mar 19 at 15:51
Thanks, Denis. Your solution also works and is indeed using just the package booktabs.
– orient
Mar 19 at 15:51
add a comment |
As @Werner has already pointed out in a comment, a good candidate solution for your formatting objective would be to load the tabularx
package and to employ a tabularx
environment (with overall width set to textwidth
) instead of tabular
. Then, change the first column specification from p{...}
to l
, and change the second column specification from p{...}
to X
.
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{booktabs}
usepackage{tabularx} % for "tabularx" env. and "X" column type
begin{document}
begin{table}
begin{tabularx}{textwidth}{@{} l X @{}}
toprule
first & second second second second second second second
second second second second second second second second \
midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth
fourth fourth fourth fourth \
bottomrule
end{tabularx}
end{table}
end{document}
Thanks very much, Mico. Your idea does provide the solution.
– orient
Mar 19 at 15:51
add a comment |
As @Werner has already pointed out in a comment, a good candidate solution for your formatting objective would be to load the tabularx
package and to employ a tabularx
environment (with overall width set to textwidth
) instead of tabular
. Then, change the first column specification from p{...}
to l
, and change the second column specification from p{...}
to X
.
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{booktabs}
usepackage{tabularx} % for "tabularx" env. and "X" column type
begin{document}
begin{table}
begin{tabularx}{textwidth}{@{} l X @{}}
toprule
first & second second second second second second second
second second second second second second second second \
midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth
fourth fourth fourth fourth \
bottomrule
end{tabularx}
end{table}
end{document}
Thanks very much, Mico. Your idea does provide the solution.
– orient
Mar 19 at 15:51
add a comment |
As @Werner has already pointed out in a comment, a good candidate solution for your formatting objective would be to load the tabularx
package and to employ a tabularx
environment (with overall width set to textwidth
) instead of tabular
. Then, change the first column specification from p{...}
to l
, and change the second column specification from p{...}
to X
.
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{booktabs}
usepackage{tabularx} % for "tabularx" env. and "X" column type
begin{document}
begin{table}
begin{tabularx}{textwidth}{@{} l X @{}}
toprule
first & second second second second second second second
second second second second second second second second \
midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth
fourth fourth fourth fourth \
bottomrule
end{tabularx}
end{table}
end{document}
As @Werner has already pointed out in a comment, a good candidate solution for your formatting objective would be to load the tabularx
package and to employ a tabularx
environment (with overall width set to textwidth
) instead of tabular
. Then, change the first column specification from p{...}
to l
, and change the second column specification from p{...}
to X
.
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{booktabs}
usepackage{tabularx} % for "tabularx" env. and "X" column type
begin{document}
begin{table}
begin{tabularx}{textwidth}{@{} l X @{}}
toprule
first & second second second second second second second
second second second second second second second second \
midrule
third & fourth fourth fourth fourth fourth fourth fourth fourth
fourth fourth fourth fourth \
bottomrule
end{tabularx}
end{table}
end{document}
answered Mar 19 at 15:39
MicoMico
284k31388778
284k31388778
Thanks very much, Mico. Your idea does provide the solution.
– orient
Mar 19 at 15:51
add a comment |
Thanks very much, Mico. Your idea does provide the solution.
– orient
Mar 19 at 15:51
Thanks very much, Mico. Your idea does provide the solution.
– orient
Mar 19 at 15:51
Thanks very much, Mico. Your idea does provide the solution.
– orient
Mar 19 at 15:51
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%2f480296%2fcontrol-width-of-columns-in-a-tabular-environment%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
2
You're probably looking for a setup like
begin{tabularx}{linewidth}{ l X }
...end{tabularx}
(requiresusepackage{tabularx}
in your preamble).– Werner
Mar 19 at 15:27
Thanks very much. This indeed achieves the goal.
– orient
Mar 19 at 15:50