Problem with setting up vertical lines in booktabs tables
up vote
1
down vote
favorite
As pointed out here it is important to use
multicolumn{3}{|l|}{}
in the following line of multicolumn
.
Nevertheless I am struggling around with the same issue (unconnected vertical lines) and can't find a solution for it:
Here is how far I got. Any ideas would be great.
usepackage{booktabs}
usepackage{multirow}
usepackage{makecell}
{renewcommand{arraystretch}{2}%
begin{table}
centering
begin{tabular}{@{}ll|cc@{}} toprule
multicolumn{2}{c|}{multirow{2}{*}{}} & multicolumn{2}{c}{Text} \
cmidrule(r){3-4}
multicolumn{2}{c|}{} & A & B\ midrule
multicolumn{1}{c|}{multirow{2}{*}{thead{Text1 and \ Text2}}} & C & thead{1\and 1}& 2 \
multicolumn{1}{c|}{} & D & 3 & thead{4\ and 4} \
bottomrule
end{tabular}
end{table}} quad
tables multirow multicolumn booktabs
add a comment |
up vote
1
down vote
favorite
As pointed out here it is important to use
multicolumn{3}{|l|}{}
in the following line of multicolumn
.
Nevertheless I am struggling around with the same issue (unconnected vertical lines) and can't find a solution for it:
Here is how far I got. Any ideas would be great.
usepackage{booktabs}
usepackage{multirow}
usepackage{makecell}
{renewcommand{arraystretch}{2}%
begin{table}
centering
begin{tabular}{@{}ll|cc@{}} toprule
multicolumn{2}{c|}{multirow{2}{*}{}} & multicolumn{2}{c}{Text} \
cmidrule(r){3-4}
multicolumn{2}{c|}{} & A & B\ midrule
multicolumn{1}{c|}{multirow{2}{*}{thead{Text1 and \ Text2}}} & C & thead{1\and 1}& 2 \
multicolumn{1}{c|}{} & D & 3 & thead{4\ and 4} \
bottomrule
end{tabular}
end{table}} quad
tables multirow multicolumn booktabs
The line between Text1andText2 and C / D maybe should stay as it is.
– KLJ
Dec 4 at 17:57
5
The issue is not the same as the linked question. The gaps you see is because you are using vertical rules withbooktabs
. Thebooktabs
documentation emphasizes "Never, ever use vertical rules". If you replace thetoprule
,bottomrule
andmidrule
byhline
the gaps will close. Better to remove the vertical rules, though.
– Phelype Oleinik
Dec 4 at 17:59
1
please look at the documentation for booktabs, the package author makes it clear he thinks vertical rules are evil and by design the package makes them unusable
– David Carlisle
Dec 4 at 18:23
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
As pointed out here it is important to use
multicolumn{3}{|l|}{}
in the following line of multicolumn
.
Nevertheless I am struggling around with the same issue (unconnected vertical lines) and can't find a solution for it:
Here is how far I got. Any ideas would be great.
usepackage{booktabs}
usepackage{multirow}
usepackage{makecell}
{renewcommand{arraystretch}{2}%
begin{table}
centering
begin{tabular}{@{}ll|cc@{}} toprule
multicolumn{2}{c|}{multirow{2}{*}{}} & multicolumn{2}{c}{Text} \
cmidrule(r){3-4}
multicolumn{2}{c|}{} & A & B\ midrule
multicolumn{1}{c|}{multirow{2}{*}{thead{Text1 and \ Text2}}} & C & thead{1\and 1}& 2 \
multicolumn{1}{c|}{} & D & 3 & thead{4\ and 4} \
bottomrule
end{tabular}
end{table}} quad
tables multirow multicolumn booktabs
As pointed out here it is important to use
multicolumn{3}{|l|}{}
in the following line of multicolumn
.
Nevertheless I am struggling around with the same issue (unconnected vertical lines) and can't find a solution for it:
Here is how far I got. Any ideas would be great.
usepackage{booktabs}
usepackage{multirow}
usepackage{makecell}
{renewcommand{arraystretch}{2}%
begin{table}
centering
begin{tabular}{@{}ll|cc@{}} toprule
multicolumn{2}{c|}{multirow{2}{*}{}} & multicolumn{2}{c}{Text} \
cmidrule(r){3-4}
multicolumn{2}{c|}{} & A & B\ midrule
multicolumn{1}{c|}{multirow{2}{*}{thead{Text1 and \ Text2}}} & C & thead{1\and 1}& 2 \
multicolumn{1}{c|}{} & D & 3 & thead{4\ and 4} \
bottomrule
end{tabular}
end{table}} quad
tables multirow multicolumn booktabs
tables multirow multicolumn booktabs
edited Dec 5 at 8:26
asked Dec 4 at 17:55
KLJ
255
255
The line between Text1andText2 and C / D maybe should stay as it is.
– KLJ
Dec 4 at 17:57
5
The issue is not the same as the linked question. The gaps you see is because you are using vertical rules withbooktabs
. Thebooktabs
documentation emphasizes "Never, ever use vertical rules". If you replace thetoprule
,bottomrule
andmidrule
byhline
the gaps will close. Better to remove the vertical rules, though.
– Phelype Oleinik
Dec 4 at 17:59
1
please look at the documentation for booktabs, the package author makes it clear he thinks vertical rules are evil and by design the package makes them unusable
– David Carlisle
Dec 4 at 18:23
add a comment |
The line between Text1andText2 and C / D maybe should stay as it is.
– KLJ
Dec 4 at 17:57
5
The issue is not the same as the linked question. The gaps you see is because you are using vertical rules withbooktabs
. Thebooktabs
documentation emphasizes "Never, ever use vertical rules". If you replace thetoprule
,bottomrule
andmidrule
byhline
the gaps will close. Better to remove the vertical rules, though.
– Phelype Oleinik
Dec 4 at 17:59
1
please look at the documentation for booktabs, the package author makes it clear he thinks vertical rules are evil and by design the package makes them unusable
– David Carlisle
Dec 4 at 18:23
The line between Text1andText2 and C / D maybe should stay as it is.
– KLJ
Dec 4 at 17:57
The line between Text1andText2 and C / D maybe should stay as it is.
– KLJ
Dec 4 at 17:57
5
5
The issue is not the same as the linked question. The gaps you see is because you are using vertical rules with
booktabs
. The booktabs
documentation emphasizes "Never, ever use vertical rules". If you replace the toprule
, bottomrule
and midrule
by hline
the gaps will close. Better to remove the vertical rules, though.– Phelype Oleinik
Dec 4 at 17:59
The issue is not the same as the linked question. The gaps you see is because you are using vertical rules with
booktabs
. The booktabs
documentation emphasizes "Never, ever use vertical rules". If you replace the toprule
, bottomrule
and midrule
by hline
the gaps will close. Better to remove the vertical rules, though.– Phelype Oleinik
Dec 4 at 17:59
1
1
please look at the documentation for booktabs, the package author makes it clear he thinks vertical rules are evil and by design the package makes them unusable
– David Carlisle
Dec 4 at 18:23
please look at the documentation for booktabs, the package author makes it clear he thinks vertical rules are evil and by design the package makes them unusable
– David Carlisle
Dec 4 at 18:23
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
Booktabs
sets a vertical padding above and below its rules. You can set this padding to 0, and enjoy the other functionalities. Anyway, with arraystretch
set to 2
, do you really need it? If necessary, you can replace it with the setcellgapes
command from makecell
. I took the opportunity to slightly simplify the code of your table, with the multirowthead
command:
documentclass{article}
usepackage{booktabs}
usepackage{multirow}
usepackage{makecell}
begin{document}
begin{table}
renewcommand{arraystretch}{2}%
centering
aboverulesep = 0pt
belowrulesep = 0pt
begin{tabular}{@{}ll|cc@{}} toprule
multicolumn{2}{c|}{multirow{2}{*}{}} & multicolumn{2}{c}{Text} \
cmidrule(r){3-4}
multicolumn{2}{c|}{} & A & B\ midrule
multicolumn{1}{c|}{multirowthead{2}[-1ex]{Text1 and \ Text2}} & C & thead{1\and 1}& 2 \
multicolumn{1}{c|}{} & D & 3 & thead{4\ and 4} \
bottomrule
end{tabular}
end{table} quad
end{document}
Thanks for the support and simplification as well!
– KLJ
Dec 5 at 7:31
Interesting to see that there is no "multicolumnthead"
– KLJ
Dec 5 at 7:51
@KLJ: Yes, that's a mystery to me.
– Bernard
Dec 5 at 9:31
add a comment |
up vote
1
down vote
As mentioned in the booktabs
documentation (and with that in the comments above) I tried it without the vertical lines and have to admit that it looks better now:
documentclass{article}
usepackage{booktabs}
usepackage{multirow}
usepackage{makecell}
begin{document}
{renewcommand{arraystretch}{2}%
begin{table}
centering
begin{tabular}{@{}ccc@{}}
toprule
& multicolumn{2}{c}{Text} \
cmidrule(r){2-3}
thead{Text1 and \ Text2} & A & B\
midrule
C & thead{1\and 1}& 2 \
D & 3 & thead{4\ and 4} \
bottomrule
end{tabular}
end{table}} quad
end{document}
often it also (if space permits) looks better if you space it out, aka add more horizontal space
– daleif
Dec 5 at 8:59
That is true. I my case it doesn't. But if other (also) wonder how to add horizontal spcae: {setlength{tabcolsep}{2em} TABLE }
– KLJ
Dec 5 at 12:01
That is not a good way, this evenly added space everywhere, not really what we want. Often we want space between columns. I have a tendency to introduce extra columns just for this.
– daleif
Dec 5 at 12:39
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Booktabs
sets a vertical padding above and below its rules. You can set this padding to 0, and enjoy the other functionalities. Anyway, with arraystretch
set to 2
, do you really need it? If necessary, you can replace it with the setcellgapes
command from makecell
. I took the opportunity to slightly simplify the code of your table, with the multirowthead
command:
documentclass{article}
usepackage{booktabs}
usepackage{multirow}
usepackage{makecell}
begin{document}
begin{table}
renewcommand{arraystretch}{2}%
centering
aboverulesep = 0pt
belowrulesep = 0pt
begin{tabular}{@{}ll|cc@{}} toprule
multicolumn{2}{c|}{multirow{2}{*}{}} & multicolumn{2}{c}{Text} \
cmidrule(r){3-4}
multicolumn{2}{c|}{} & A & B\ midrule
multicolumn{1}{c|}{multirowthead{2}[-1ex]{Text1 and \ Text2}} & C & thead{1\and 1}& 2 \
multicolumn{1}{c|}{} & D & 3 & thead{4\ and 4} \
bottomrule
end{tabular}
end{table} quad
end{document}
Thanks for the support and simplification as well!
– KLJ
Dec 5 at 7:31
Interesting to see that there is no "multicolumnthead"
– KLJ
Dec 5 at 7:51
@KLJ: Yes, that's a mystery to me.
– Bernard
Dec 5 at 9:31
add a comment |
up vote
1
down vote
accepted
Booktabs
sets a vertical padding above and below its rules. You can set this padding to 0, and enjoy the other functionalities. Anyway, with arraystretch
set to 2
, do you really need it? If necessary, you can replace it with the setcellgapes
command from makecell
. I took the opportunity to slightly simplify the code of your table, with the multirowthead
command:
documentclass{article}
usepackage{booktabs}
usepackage{multirow}
usepackage{makecell}
begin{document}
begin{table}
renewcommand{arraystretch}{2}%
centering
aboverulesep = 0pt
belowrulesep = 0pt
begin{tabular}{@{}ll|cc@{}} toprule
multicolumn{2}{c|}{multirow{2}{*}{}} & multicolumn{2}{c}{Text} \
cmidrule(r){3-4}
multicolumn{2}{c|}{} & A & B\ midrule
multicolumn{1}{c|}{multirowthead{2}[-1ex]{Text1 and \ Text2}} & C & thead{1\and 1}& 2 \
multicolumn{1}{c|}{} & D & 3 & thead{4\ and 4} \
bottomrule
end{tabular}
end{table} quad
end{document}
Thanks for the support and simplification as well!
– KLJ
Dec 5 at 7:31
Interesting to see that there is no "multicolumnthead"
– KLJ
Dec 5 at 7:51
@KLJ: Yes, that's a mystery to me.
– Bernard
Dec 5 at 9:31
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Booktabs
sets a vertical padding above and below its rules. You can set this padding to 0, and enjoy the other functionalities. Anyway, with arraystretch
set to 2
, do you really need it? If necessary, you can replace it with the setcellgapes
command from makecell
. I took the opportunity to slightly simplify the code of your table, with the multirowthead
command:
documentclass{article}
usepackage{booktabs}
usepackage{multirow}
usepackage{makecell}
begin{document}
begin{table}
renewcommand{arraystretch}{2}%
centering
aboverulesep = 0pt
belowrulesep = 0pt
begin{tabular}{@{}ll|cc@{}} toprule
multicolumn{2}{c|}{multirow{2}{*}{}} & multicolumn{2}{c}{Text} \
cmidrule(r){3-4}
multicolumn{2}{c|}{} & A & B\ midrule
multicolumn{1}{c|}{multirowthead{2}[-1ex]{Text1 and \ Text2}} & C & thead{1\and 1}& 2 \
multicolumn{1}{c|}{} & D & 3 & thead{4\ and 4} \
bottomrule
end{tabular}
end{table} quad
end{document}
Booktabs
sets a vertical padding above and below its rules. You can set this padding to 0, and enjoy the other functionalities. Anyway, with arraystretch
set to 2
, do you really need it? If necessary, you can replace it with the setcellgapes
command from makecell
. I took the opportunity to slightly simplify the code of your table, with the multirowthead
command:
documentclass{article}
usepackage{booktabs}
usepackage{multirow}
usepackage{makecell}
begin{document}
begin{table}
renewcommand{arraystretch}{2}%
centering
aboverulesep = 0pt
belowrulesep = 0pt
begin{tabular}{@{}ll|cc@{}} toprule
multicolumn{2}{c|}{multirow{2}{*}{}} & multicolumn{2}{c}{Text} \
cmidrule(r){3-4}
multicolumn{2}{c|}{} & A & B\ midrule
multicolumn{1}{c|}{multirowthead{2}[-1ex]{Text1 and \ Text2}} & C & thead{1\and 1}& 2 \
multicolumn{1}{c|}{} & D & 3 & thead{4\ and 4} \
bottomrule
end{tabular}
end{table} quad
end{document}
edited Dec 4 at 21:17
answered Dec 4 at 19:14
Bernard
164k769192
164k769192
Thanks for the support and simplification as well!
– KLJ
Dec 5 at 7:31
Interesting to see that there is no "multicolumnthead"
– KLJ
Dec 5 at 7:51
@KLJ: Yes, that's a mystery to me.
– Bernard
Dec 5 at 9:31
add a comment |
Thanks for the support and simplification as well!
– KLJ
Dec 5 at 7:31
Interesting to see that there is no "multicolumnthead"
– KLJ
Dec 5 at 7:51
@KLJ: Yes, that's a mystery to me.
– Bernard
Dec 5 at 9:31
Thanks for the support and simplification as well!
– KLJ
Dec 5 at 7:31
Thanks for the support and simplification as well!
– KLJ
Dec 5 at 7:31
Interesting to see that there is no "multicolumnthead"
– KLJ
Dec 5 at 7:51
Interesting to see that there is no "multicolumnthead"
– KLJ
Dec 5 at 7:51
@KLJ: Yes, that's a mystery to me.
– Bernard
Dec 5 at 9:31
@KLJ: Yes, that's a mystery to me.
– Bernard
Dec 5 at 9:31
add a comment |
up vote
1
down vote
As mentioned in the booktabs
documentation (and with that in the comments above) I tried it without the vertical lines and have to admit that it looks better now:
documentclass{article}
usepackage{booktabs}
usepackage{multirow}
usepackage{makecell}
begin{document}
{renewcommand{arraystretch}{2}%
begin{table}
centering
begin{tabular}{@{}ccc@{}}
toprule
& multicolumn{2}{c}{Text} \
cmidrule(r){2-3}
thead{Text1 and \ Text2} & A & B\
midrule
C & thead{1\and 1}& 2 \
D & 3 & thead{4\ and 4} \
bottomrule
end{tabular}
end{table}} quad
end{document}
often it also (if space permits) looks better if you space it out, aka add more horizontal space
– daleif
Dec 5 at 8:59
That is true. I my case it doesn't. But if other (also) wonder how to add horizontal spcae: {setlength{tabcolsep}{2em} TABLE }
– KLJ
Dec 5 at 12:01
That is not a good way, this evenly added space everywhere, not really what we want. Often we want space between columns. I have a tendency to introduce extra columns just for this.
– daleif
Dec 5 at 12:39
add a comment |
up vote
1
down vote
As mentioned in the booktabs
documentation (and with that in the comments above) I tried it without the vertical lines and have to admit that it looks better now:
documentclass{article}
usepackage{booktabs}
usepackage{multirow}
usepackage{makecell}
begin{document}
{renewcommand{arraystretch}{2}%
begin{table}
centering
begin{tabular}{@{}ccc@{}}
toprule
& multicolumn{2}{c}{Text} \
cmidrule(r){2-3}
thead{Text1 and \ Text2} & A & B\
midrule
C & thead{1\and 1}& 2 \
D & 3 & thead{4\ and 4} \
bottomrule
end{tabular}
end{table}} quad
end{document}
often it also (if space permits) looks better if you space it out, aka add more horizontal space
– daleif
Dec 5 at 8:59
That is true. I my case it doesn't. But if other (also) wonder how to add horizontal spcae: {setlength{tabcolsep}{2em} TABLE }
– KLJ
Dec 5 at 12:01
That is not a good way, this evenly added space everywhere, not really what we want. Often we want space between columns. I have a tendency to introduce extra columns just for this.
– daleif
Dec 5 at 12:39
add a comment |
up vote
1
down vote
up vote
1
down vote
As mentioned in the booktabs
documentation (and with that in the comments above) I tried it without the vertical lines and have to admit that it looks better now:
documentclass{article}
usepackage{booktabs}
usepackage{multirow}
usepackage{makecell}
begin{document}
{renewcommand{arraystretch}{2}%
begin{table}
centering
begin{tabular}{@{}ccc@{}}
toprule
& multicolumn{2}{c}{Text} \
cmidrule(r){2-3}
thead{Text1 and \ Text2} & A & B\
midrule
C & thead{1\and 1}& 2 \
D & 3 & thead{4\ and 4} \
bottomrule
end{tabular}
end{table}} quad
end{document}
As mentioned in the booktabs
documentation (and with that in the comments above) I tried it without the vertical lines and have to admit that it looks better now:
documentclass{article}
usepackage{booktabs}
usepackage{multirow}
usepackage{makecell}
begin{document}
{renewcommand{arraystretch}{2}%
begin{table}
centering
begin{tabular}{@{}ccc@{}}
toprule
& multicolumn{2}{c}{Text} \
cmidrule(r){2-3}
thead{Text1 and \ Text2} & A & B\
midrule
C & thead{1\and 1}& 2 \
D & 3 & thead{4\ and 4} \
bottomrule
end{tabular}
end{table}} quad
end{document}
edited Dec 5 at 8:12
answered Dec 5 at 8:03
KLJ
255
255
often it also (if space permits) looks better if you space it out, aka add more horizontal space
– daleif
Dec 5 at 8:59
That is true. I my case it doesn't. But if other (also) wonder how to add horizontal spcae: {setlength{tabcolsep}{2em} TABLE }
– KLJ
Dec 5 at 12:01
That is not a good way, this evenly added space everywhere, not really what we want. Often we want space between columns. I have a tendency to introduce extra columns just for this.
– daleif
Dec 5 at 12:39
add a comment |
often it also (if space permits) looks better if you space it out, aka add more horizontal space
– daleif
Dec 5 at 8:59
That is true. I my case it doesn't. But if other (also) wonder how to add horizontal spcae: {setlength{tabcolsep}{2em} TABLE }
– KLJ
Dec 5 at 12:01
That is not a good way, this evenly added space everywhere, not really what we want. Often we want space between columns. I have a tendency to introduce extra columns just for this.
– daleif
Dec 5 at 12:39
often it also (if space permits) looks better if you space it out, aka add more horizontal space
– daleif
Dec 5 at 8:59
often it also (if space permits) looks better if you space it out, aka add more horizontal space
– daleif
Dec 5 at 8:59
That is true. I my case it doesn't. But if other (also) wonder how to add horizontal spcae: {setlength{tabcolsep}{2em} TABLE }
– KLJ
Dec 5 at 12:01
That is true. I my case it doesn't. But if other (also) wonder how to add horizontal spcae: {setlength{tabcolsep}{2em} TABLE }
– KLJ
Dec 5 at 12:01
That is not a good way, this evenly added space everywhere, not really what we want. Often we want space between columns. I have a tendency to introduce extra columns just for this.
– daleif
Dec 5 at 12:39
That is not a good way, this evenly added space everywhere, not really what we want. Often we want space between columns. I have a tendency to introduce extra columns just for this.
– daleif
Dec 5 at 12:39
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f463193%2fproblem-with-setting-up-vertical-lines-in-booktabs-tables%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
The line between Text1andText2 and C / D maybe should stay as it is.
– KLJ
Dec 4 at 17:57
5
The issue is not the same as the linked question. The gaps you see is because you are using vertical rules with
booktabs
. Thebooktabs
documentation emphasizes "Never, ever use vertical rules". If you replace thetoprule
,bottomrule
andmidrule
byhline
the gaps will close. Better to remove the vertical rules, though.– Phelype Oleinik
Dec 4 at 17:59
1
please look at the documentation for booktabs, the package author makes it clear he thinks vertical rules are evil and by design the package makes them unusable
– David Carlisle
Dec 4 at 18:23