How to vertically centre a cell spanning multiple rows with the p column type
Bit of a mouthful of a question title
I have the following table:
I'm not completely convinced it's the absolute best way to display this information, but I'm reproducing a table that is laid out like this, with a few minor improvements, such as removing ugly vertical lines. I would be open to suggestions as to how I could improve the look though.
Anyway, my question is how to get "Train formation" to be vertically centred.
You can see the problem is that it spans two rows, the permissible speed row and the row underneath. But the row underneath is a p
type row consisting of three lines, but not three rows.
I have produced the above image using:
multirow{4}{*}{textbf{Train formation}}
But I'm not too sure whether that takes into account that there aren't actually four rows, there are only two. It's just that the second row is three lines long. I've also set renewcommand{arraystretch}{1.25}
And similarly I wouldn't be sure how to vertically align the two 10 mph (15 kph) entries. As you can see, I have made use of the fact that I happen to have three rows, each of which is two lines long. But If one of those rows were to be only one line long, how would I vertically centre the second and third column?
documentclass[12pt]{article}
pagestyle{plain}
usepackage[margin=1.8cm]{geometry}
geometry{a4paper}
usepackage[parfill]{parskip}
usepackage[detect-weight=true]{siunitx}
DeclareSIUnit{mph}{mph}
usepackage{array}
usepackage{booktabs}
usepackage{multirow}
renewcommand{arraystretch}{1.25}
setlength{tabcolsep}{0.8em}
begin{document}
begin{center}
begin{tabular}{@{}>{raggedrightarraybackslash}p{0.4textwidth}
>{centeringarraybackslash}p{0.15textwidth}
>{centeringarraybackslash}p{0.15textwidth}@{}}
toprule
multicolumn{1}{@{}c}{multirow{4}{*}{textbf{Train formation}}} &
multicolumn{2}{c@{}}{textbf{Permissible speed}} \ cmidrule{2-3}
& textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or above} &
textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or less} \ midrule
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad &
SI{10}{mph} (SI{15}{kilometreperhour}) &
SI{10}{mph} (SI{15}{kilometreperhour}) \
minim veniam, quis nostrud exercitation ullamco laboris nisi ut \
bottomrule
end{tabular}
end{center}
end{document}
tables vertical-alignment multirow
add a comment |
Bit of a mouthful of a question title
I have the following table:
I'm not completely convinced it's the absolute best way to display this information, but I'm reproducing a table that is laid out like this, with a few minor improvements, such as removing ugly vertical lines. I would be open to suggestions as to how I could improve the look though.
Anyway, my question is how to get "Train formation" to be vertically centred.
You can see the problem is that it spans two rows, the permissible speed row and the row underneath. But the row underneath is a p
type row consisting of three lines, but not three rows.
I have produced the above image using:
multirow{4}{*}{textbf{Train formation}}
But I'm not too sure whether that takes into account that there aren't actually four rows, there are only two. It's just that the second row is three lines long. I've also set renewcommand{arraystretch}{1.25}
And similarly I wouldn't be sure how to vertically align the two 10 mph (15 kph) entries. As you can see, I have made use of the fact that I happen to have three rows, each of which is two lines long. But If one of those rows were to be only one line long, how would I vertically centre the second and third column?
documentclass[12pt]{article}
pagestyle{plain}
usepackage[margin=1.8cm]{geometry}
geometry{a4paper}
usepackage[parfill]{parskip}
usepackage[detect-weight=true]{siunitx}
DeclareSIUnit{mph}{mph}
usepackage{array}
usepackage{booktabs}
usepackage{multirow}
renewcommand{arraystretch}{1.25}
setlength{tabcolsep}{0.8em}
begin{document}
begin{center}
begin{tabular}{@{}>{raggedrightarraybackslash}p{0.4textwidth}
>{centeringarraybackslash}p{0.15textwidth}
>{centeringarraybackslash}p{0.15textwidth}@{}}
toprule
multicolumn{1}{@{}c}{multirow{4}{*}{textbf{Train formation}}} &
multicolumn{2}{c@{}}{textbf{Permissible speed}} \ cmidrule{2-3}
& textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or above} &
textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or less} \ midrule
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad &
SI{10}{mph} (SI{15}{kilometreperhour}) &
SI{10}{mph} (SI{15}{kilometreperhour}) \
minim veniam, quis nostrud exercitation ullamco laboris nisi ut \
bottomrule
end{tabular}
end{center}
end{document}
tables vertical-alignment multirow
add a comment |
Bit of a mouthful of a question title
I have the following table:
I'm not completely convinced it's the absolute best way to display this information, but I'm reproducing a table that is laid out like this, with a few minor improvements, such as removing ugly vertical lines. I would be open to suggestions as to how I could improve the look though.
Anyway, my question is how to get "Train formation" to be vertically centred.
You can see the problem is that it spans two rows, the permissible speed row and the row underneath. But the row underneath is a p
type row consisting of three lines, but not three rows.
I have produced the above image using:
multirow{4}{*}{textbf{Train formation}}
But I'm not too sure whether that takes into account that there aren't actually four rows, there are only two. It's just that the second row is three lines long. I've also set renewcommand{arraystretch}{1.25}
And similarly I wouldn't be sure how to vertically align the two 10 mph (15 kph) entries. As you can see, I have made use of the fact that I happen to have three rows, each of which is two lines long. But If one of those rows were to be only one line long, how would I vertically centre the second and third column?
documentclass[12pt]{article}
pagestyle{plain}
usepackage[margin=1.8cm]{geometry}
geometry{a4paper}
usepackage[parfill]{parskip}
usepackage[detect-weight=true]{siunitx}
DeclareSIUnit{mph}{mph}
usepackage{array}
usepackage{booktabs}
usepackage{multirow}
renewcommand{arraystretch}{1.25}
setlength{tabcolsep}{0.8em}
begin{document}
begin{center}
begin{tabular}{@{}>{raggedrightarraybackslash}p{0.4textwidth}
>{centeringarraybackslash}p{0.15textwidth}
>{centeringarraybackslash}p{0.15textwidth}@{}}
toprule
multicolumn{1}{@{}c}{multirow{4}{*}{textbf{Train formation}}} &
multicolumn{2}{c@{}}{textbf{Permissible speed}} \ cmidrule{2-3}
& textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or above} &
textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or less} \ midrule
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad &
SI{10}{mph} (SI{15}{kilometreperhour}) &
SI{10}{mph} (SI{15}{kilometreperhour}) \
minim veniam, quis nostrud exercitation ullamco laboris nisi ut \
bottomrule
end{tabular}
end{center}
end{document}
tables vertical-alignment multirow
Bit of a mouthful of a question title
I have the following table:
I'm not completely convinced it's the absolute best way to display this information, but I'm reproducing a table that is laid out like this, with a few minor improvements, such as removing ugly vertical lines. I would be open to suggestions as to how I could improve the look though.
Anyway, my question is how to get "Train formation" to be vertically centred.
You can see the problem is that it spans two rows, the permissible speed row and the row underneath. But the row underneath is a p
type row consisting of three lines, but not three rows.
I have produced the above image using:
multirow{4}{*}{textbf{Train formation}}
But I'm not too sure whether that takes into account that there aren't actually four rows, there are only two. It's just that the second row is three lines long. I've also set renewcommand{arraystretch}{1.25}
And similarly I wouldn't be sure how to vertically align the two 10 mph (15 kph) entries. As you can see, I have made use of the fact that I happen to have three rows, each of which is two lines long. But If one of those rows were to be only one line long, how would I vertically centre the second and third column?
documentclass[12pt]{article}
pagestyle{plain}
usepackage[margin=1.8cm]{geometry}
geometry{a4paper}
usepackage[parfill]{parskip}
usepackage[detect-weight=true]{siunitx}
DeclareSIUnit{mph}{mph}
usepackage{array}
usepackage{booktabs}
usepackage{multirow}
renewcommand{arraystretch}{1.25}
setlength{tabcolsep}{0.8em}
begin{document}
begin{center}
begin{tabular}{@{}>{raggedrightarraybackslash}p{0.4textwidth}
>{centeringarraybackslash}p{0.15textwidth}
>{centeringarraybackslash}p{0.15textwidth}@{}}
toprule
multicolumn{1}{@{}c}{multirow{4}{*}{textbf{Train formation}}} &
multicolumn{2}{c@{}}{textbf{Permissible speed}} \ cmidrule{2-3}
& textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or above} &
textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or less} \ midrule
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad &
SI{10}{mph} (SI{15}{kilometreperhour}) &
SI{10}{mph} (SI{15}{kilometreperhour}) \
minim veniam, quis nostrud exercitation ullamco laboris nisi ut \
bottomrule
end{tabular}
end{center}
end{document}
tables vertical-alignment multirow
tables vertical-alignment multirow
asked Jan 31 at 15:33
Au101Au101
7,15832254
7,15832254
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
A slightly improved layout (from my point of view), using a decimal number for the number of ‘rows’ (which are actually lines, as you noticed), and the m{...}
specifier in the place of p{...}
. I also simplified the code with the km
abbreviation and the {=}
width argument for multirow
.
documentclass[12pt]{article}
pagestyle{plain}
usepackage[margin=1.8cm]{geometry}
geometry{a4paper}
usepackage[parfill]{parskip}
usepackage[detect-weight=true]{siunitx}
DeclareSIUnit{mph}{mph}
usepackage{array}
usepackage{booktabs}
usepackage{multirow}
renewcommand{arraystretch}{1.25}
setlength{tabcolsep}{0.8em}
begin{document}
begin{center}
begin{tabular}{@{}>{raggedrightarraybackslash}m{0.4textwidth}
>{centeringarraybackslash}m{0.15textwidth}
>{centeringarraybackslash}m{0.15textwidth}@{}}
toprule
multirow{4.5}{=}{centeringtextbf{Train formation}}
&
multicolumn{2}{c@{}}{textbf{Permissible speed}} \ cmidrule{2-3}
& textbf{SI{10}{mph} (SI{15}{kmperhour}) or above} &
textbf{SI{10}{mph} (SI{15}{kmperhour}) or less} \ midrule
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad &
SI{10}{mph} (SI{15}{kmperhour}) &
SI{10}{mph} (SI{15}{kmperhour}) \
minim veniam, quis nostrud exercitation ullamco laboris nisi ut \
bottomrule
end{tabular}
end{center}
end{document}
Really nice thanks!
– Au101
Jan 31 at 16:17
How did you generate the4.5
value for yourmultirow
? I have a second table, similarly laid out, but with two rows of two lines each (so just get rid of minim veniam, quis nostrud exercitation ullamco laboris nisi ut). Would2.5
do just as well here?
– Au101
Jan 31 at 20:01
By trial and error (taking into account the values of aboverule sep and belowrulesep, and thecmidrule
thickness).
– Bernard
Jan 31 at 20:06
okay, thanks for your help!
– Au101
Jan 31 at 20:17
add a comment |
Since we know the widths of the columns, one can put a tabular inside a tabular and get the columns to align.
documentclass[12pt]{article}
pagestyle{plain}
usepackage[margin=1.8cm]{geometry}
geometry{a4paper}
usepackage[parfill]{parskip}
usepackage[detect-weight=true]{siunitx}
DeclareSIUnit{mph}{mph}
usepackage{array}
usepackage{booktabs}
usepackage{multirow}
renewcommand{arraystretch}{1.25}
setlength{tabcolsep}{0.8em}
begin{document}
begin{center}
begin{tabular}{@{}>{raggedrightarraybackslash}p{0.4textwidth}
>{centeringarraybackslash}p{0.15textwidth}
>{centeringarraybackslash}p{0.15textwidth}@{}}
toprule
centeringtextbf{Train formation} &
multicolumn{2}{c@{}}{begin{tabular}{@{}>{centeringarraybackslash}p{0.15textwidth}
>{centeringarraybackslash}p{0.15textwidth}@{}}
multicolumn{2}{c@{}}{textbf{Permissible speed}} \ midrule
textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or above} &
textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or less}
end{tabular}} \ midrule
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad &
SI{10}{mph} (SI{15}{kilometreperhour}) &
SI{10}{mph} (SI{15}{kilometreperhour}) \
minim veniam, quis nostrud exercitation ullamco laboris nisi ut \
bottomrule
end{tabular}
end{center}
end{document}
Ended up using a bit of both answers, thanks!
– Au101
Jan 31 at 21:59
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%2f472739%2fhow-to-vertically-centre-a-cell-spanning-multiple-rows-with-the-p-column-type%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
A slightly improved layout (from my point of view), using a decimal number for the number of ‘rows’ (which are actually lines, as you noticed), and the m{...}
specifier in the place of p{...}
. I also simplified the code with the km
abbreviation and the {=}
width argument for multirow
.
documentclass[12pt]{article}
pagestyle{plain}
usepackage[margin=1.8cm]{geometry}
geometry{a4paper}
usepackage[parfill]{parskip}
usepackage[detect-weight=true]{siunitx}
DeclareSIUnit{mph}{mph}
usepackage{array}
usepackage{booktabs}
usepackage{multirow}
renewcommand{arraystretch}{1.25}
setlength{tabcolsep}{0.8em}
begin{document}
begin{center}
begin{tabular}{@{}>{raggedrightarraybackslash}m{0.4textwidth}
>{centeringarraybackslash}m{0.15textwidth}
>{centeringarraybackslash}m{0.15textwidth}@{}}
toprule
multirow{4.5}{=}{centeringtextbf{Train formation}}
&
multicolumn{2}{c@{}}{textbf{Permissible speed}} \ cmidrule{2-3}
& textbf{SI{10}{mph} (SI{15}{kmperhour}) or above} &
textbf{SI{10}{mph} (SI{15}{kmperhour}) or less} \ midrule
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad &
SI{10}{mph} (SI{15}{kmperhour}) &
SI{10}{mph} (SI{15}{kmperhour}) \
minim veniam, quis nostrud exercitation ullamco laboris nisi ut \
bottomrule
end{tabular}
end{center}
end{document}
Really nice thanks!
– Au101
Jan 31 at 16:17
How did you generate the4.5
value for yourmultirow
? I have a second table, similarly laid out, but with two rows of two lines each (so just get rid of minim veniam, quis nostrud exercitation ullamco laboris nisi ut). Would2.5
do just as well here?
– Au101
Jan 31 at 20:01
By trial and error (taking into account the values of aboverule sep and belowrulesep, and thecmidrule
thickness).
– Bernard
Jan 31 at 20:06
okay, thanks for your help!
– Au101
Jan 31 at 20:17
add a comment |
A slightly improved layout (from my point of view), using a decimal number for the number of ‘rows’ (which are actually lines, as you noticed), and the m{...}
specifier in the place of p{...}
. I also simplified the code with the km
abbreviation and the {=}
width argument for multirow
.
documentclass[12pt]{article}
pagestyle{plain}
usepackage[margin=1.8cm]{geometry}
geometry{a4paper}
usepackage[parfill]{parskip}
usepackage[detect-weight=true]{siunitx}
DeclareSIUnit{mph}{mph}
usepackage{array}
usepackage{booktabs}
usepackage{multirow}
renewcommand{arraystretch}{1.25}
setlength{tabcolsep}{0.8em}
begin{document}
begin{center}
begin{tabular}{@{}>{raggedrightarraybackslash}m{0.4textwidth}
>{centeringarraybackslash}m{0.15textwidth}
>{centeringarraybackslash}m{0.15textwidth}@{}}
toprule
multirow{4.5}{=}{centeringtextbf{Train formation}}
&
multicolumn{2}{c@{}}{textbf{Permissible speed}} \ cmidrule{2-3}
& textbf{SI{10}{mph} (SI{15}{kmperhour}) or above} &
textbf{SI{10}{mph} (SI{15}{kmperhour}) or less} \ midrule
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad &
SI{10}{mph} (SI{15}{kmperhour}) &
SI{10}{mph} (SI{15}{kmperhour}) \
minim veniam, quis nostrud exercitation ullamco laboris nisi ut \
bottomrule
end{tabular}
end{center}
end{document}
Really nice thanks!
– Au101
Jan 31 at 16:17
How did you generate the4.5
value for yourmultirow
? I have a second table, similarly laid out, but with two rows of two lines each (so just get rid of minim veniam, quis nostrud exercitation ullamco laboris nisi ut). Would2.5
do just as well here?
– Au101
Jan 31 at 20:01
By trial and error (taking into account the values of aboverule sep and belowrulesep, and thecmidrule
thickness).
– Bernard
Jan 31 at 20:06
okay, thanks for your help!
– Au101
Jan 31 at 20:17
add a comment |
A slightly improved layout (from my point of view), using a decimal number for the number of ‘rows’ (which are actually lines, as you noticed), and the m{...}
specifier in the place of p{...}
. I also simplified the code with the km
abbreviation and the {=}
width argument for multirow
.
documentclass[12pt]{article}
pagestyle{plain}
usepackage[margin=1.8cm]{geometry}
geometry{a4paper}
usepackage[parfill]{parskip}
usepackage[detect-weight=true]{siunitx}
DeclareSIUnit{mph}{mph}
usepackage{array}
usepackage{booktabs}
usepackage{multirow}
renewcommand{arraystretch}{1.25}
setlength{tabcolsep}{0.8em}
begin{document}
begin{center}
begin{tabular}{@{}>{raggedrightarraybackslash}m{0.4textwidth}
>{centeringarraybackslash}m{0.15textwidth}
>{centeringarraybackslash}m{0.15textwidth}@{}}
toprule
multirow{4.5}{=}{centeringtextbf{Train formation}}
&
multicolumn{2}{c@{}}{textbf{Permissible speed}} \ cmidrule{2-3}
& textbf{SI{10}{mph} (SI{15}{kmperhour}) or above} &
textbf{SI{10}{mph} (SI{15}{kmperhour}) or less} \ midrule
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad &
SI{10}{mph} (SI{15}{kmperhour}) &
SI{10}{mph} (SI{15}{kmperhour}) \
minim veniam, quis nostrud exercitation ullamco laboris nisi ut \
bottomrule
end{tabular}
end{center}
end{document}
A slightly improved layout (from my point of view), using a decimal number for the number of ‘rows’ (which are actually lines, as you noticed), and the m{...}
specifier in the place of p{...}
. I also simplified the code with the km
abbreviation and the {=}
width argument for multirow
.
documentclass[12pt]{article}
pagestyle{plain}
usepackage[margin=1.8cm]{geometry}
geometry{a4paper}
usepackage[parfill]{parskip}
usepackage[detect-weight=true]{siunitx}
DeclareSIUnit{mph}{mph}
usepackage{array}
usepackage{booktabs}
usepackage{multirow}
renewcommand{arraystretch}{1.25}
setlength{tabcolsep}{0.8em}
begin{document}
begin{center}
begin{tabular}{@{}>{raggedrightarraybackslash}m{0.4textwidth}
>{centeringarraybackslash}m{0.15textwidth}
>{centeringarraybackslash}m{0.15textwidth}@{}}
toprule
multirow{4.5}{=}{centeringtextbf{Train formation}}
&
multicolumn{2}{c@{}}{textbf{Permissible speed}} \ cmidrule{2-3}
& textbf{SI{10}{mph} (SI{15}{kmperhour}) or above} &
textbf{SI{10}{mph} (SI{15}{kmperhour}) or less} \ midrule
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad &
SI{10}{mph} (SI{15}{kmperhour}) &
SI{10}{mph} (SI{15}{kmperhour}) \
minim veniam, quis nostrud exercitation ullamco laboris nisi ut \
bottomrule
end{tabular}
end{center}
end{document}
edited Jan 31 at 22:01
answered Jan 31 at 16:06
BernardBernard
171k775202
171k775202
Really nice thanks!
– Au101
Jan 31 at 16:17
How did you generate the4.5
value for yourmultirow
? I have a second table, similarly laid out, but with two rows of two lines each (so just get rid of minim veniam, quis nostrud exercitation ullamco laboris nisi ut). Would2.5
do just as well here?
– Au101
Jan 31 at 20:01
By trial and error (taking into account the values of aboverule sep and belowrulesep, and thecmidrule
thickness).
– Bernard
Jan 31 at 20:06
okay, thanks for your help!
– Au101
Jan 31 at 20:17
add a comment |
Really nice thanks!
– Au101
Jan 31 at 16:17
How did you generate the4.5
value for yourmultirow
? I have a second table, similarly laid out, but with two rows of two lines each (so just get rid of minim veniam, quis nostrud exercitation ullamco laboris nisi ut). Would2.5
do just as well here?
– Au101
Jan 31 at 20:01
By trial and error (taking into account the values of aboverule sep and belowrulesep, and thecmidrule
thickness).
– Bernard
Jan 31 at 20:06
okay, thanks for your help!
– Au101
Jan 31 at 20:17
Really nice thanks!
– Au101
Jan 31 at 16:17
Really nice thanks!
– Au101
Jan 31 at 16:17
How did you generate the
4.5
value for your multirow
? I have a second table, similarly laid out, but with two rows of two lines each (so just get rid of minim veniam, quis nostrud exercitation ullamco laboris nisi ut). Would 2.5
do just as well here?– Au101
Jan 31 at 20:01
How did you generate the
4.5
value for your multirow
? I have a second table, similarly laid out, but with two rows of two lines each (so just get rid of minim veniam, quis nostrud exercitation ullamco laboris nisi ut). Would 2.5
do just as well here?– Au101
Jan 31 at 20:01
By trial and error (taking into account the values of aboverule sep and belowrulesep, and the
cmidrule
thickness).– Bernard
Jan 31 at 20:06
By trial and error (taking into account the values of aboverule sep and belowrulesep, and the
cmidrule
thickness).– Bernard
Jan 31 at 20:06
okay, thanks for your help!
– Au101
Jan 31 at 20:17
okay, thanks for your help!
– Au101
Jan 31 at 20:17
add a comment |
Since we know the widths of the columns, one can put a tabular inside a tabular and get the columns to align.
documentclass[12pt]{article}
pagestyle{plain}
usepackage[margin=1.8cm]{geometry}
geometry{a4paper}
usepackage[parfill]{parskip}
usepackage[detect-weight=true]{siunitx}
DeclareSIUnit{mph}{mph}
usepackage{array}
usepackage{booktabs}
usepackage{multirow}
renewcommand{arraystretch}{1.25}
setlength{tabcolsep}{0.8em}
begin{document}
begin{center}
begin{tabular}{@{}>{raggedrightarraybackslash}p{0.4textwidth}
>{centeringarraybackslash}p{0.15textwidth}
>{centeringarraybackslash}p{0.15textwidth}@{}}
toprule
centeringtextbf{Train formation} &
multicolumn{2}{c@{}}{begin{tabular}{@{}>{centeringarraybackslash}p{0.15textwidth}
>{centeringarraybackslash}p{0.15textwidth}@{}}
multicolumn{2}{c@{}}{textbf{Permissible speed}} \ midrule
textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or above} &
textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or less}
end{tabular}} \ midrule
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad &
SI{10}{mph} (SI{15}{kilometreperhour}) &
SI{10}{mph} (SI{15}{kilometreperhour}) \
minim veniam, quis nostrud exercitation ullamco laboris nisi ut \
bottomrule
end{tabular}
end{center}
end{document}
Ended up using a bit of both answers, thanks!
– Au101
Jan 31 at 21:59
add a comment |
Since we know the widths of the columns, one can put a tabular inside a tabular and get the columns to align.
documentclass[12pt]{article}
pagestyle{plain}
usepackage[margin=1.8cm]{geometry}
geometry{a4paper}
usepackage[parfill]{parskip}
usepackage[detect-weight=true]{siunitx}
DeclareSIUnit{mph}{mph}
usepackage{array}
usepackage{booktabs}
usepackage{multirow}
renewcommand{arraystretch}{1.25}
setlength{tabcolsep}{0.8em}
begin{document}
begin{center}
begin{tabular}{@{}>{raggedrightarraybackslash}p{0.4textwidth}
>{centeringarraybackslash}p{0.15textwidth}
>{centeringarraybackslash}p{0.15textwidth}@{}}
toprule
centeringtextbf{Train formation} &
multicolumn{2}{c@{}}{begin{tabular}{@{}>{centeringarraybackslash}p{0.15textwidth}
>{centeringarraybackslash}p{0.15textwidth}@{}}
multicolumn{2}{c@{}}{textbf{Permissible speed}} \ midrule
textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or above} &
textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or less}
end{tabular}} \ midrule
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad &
SI{10}{mph} (SI{15}{kilometreperhour}) &
SI{10}{mph} (SI{15}{kilometreperhour}) \
minim veniam, quis nostrud exercitation ullamco laboris nisi ut \
bottomrule
end{tabular}
end{center}
end{document}
Ended up using a bit of both answers, thanks!
– Au101
Jan 31 at 21:59
add a comment |
Since we know the widths of the columns, one can put a tabular inside a tabular and get the columns to align.
documentclass[12pt]{article}
pagestyle{plain}
usepackage[margin=1.8cm]{geometry}
geometry{a4paper}
usepackage[parfill]{parskip}
usepackage[detect-weight=true]{siunitx}
DeclareSIUnit{mph}{mph}
usepackage{array}
usepackage{booktabs}
usepackage{multirow}
renewcommand{arraystretch}{1.25}
setlength{tabcolsep}{0.8em}
begin{document}
begin{center}
begin{tabular}{@{}>{raggedrightarraybackslash}p{0.4textwidth}
>{centeringarraybackslash}p{0.15textwidth}
>{centeringarraybackslash}p{0.15textwidth}@{}}
toprule
centeringtextbf{Train formation} &
multicolumn{2}{c@{}}{begin{tabular}{@{}>{centeringarraybackslash}p{0.15textwidth}
>{centeringarraybackslash}p{0.15textwidth}@{}}
multicolumn{2}{c@{}}{textbf{Permissible speed}} \ midrule
textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or above} &
textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or less}
end{tabular}} \ midrule
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad &
SI{10}{mph} (SI{15}{kilometreperhour}) &
SI{10}{mph} (SI{15}{kilometreperhour}) \
minim veniam, quis nostrud exercitation ullamco laboris nisi ut \
bottomrule
end{tabular}
end{center}
end{document}
Since we know the widths of the columns, one can put a tabular inside a tabular and get the columns to align.
documentclass[12pt]{article}
pagestyle{plain}
usepackage[margin=1.8cm]{geometry}
geometry{a4paper}
usepackage[parfill]{parskip}
usepackage[detect-weight=true]{siunitx}
DeclareSIUnit{mph}{mph}
usepackage{array}
usepackage{booktabs}
usepackage{multirow}
renewcommand{arraystretch}{1.25}
setlength{tabcolsep}{0.8em}
begin{document}
begin{center}
begin{tabular}{@{}>{raggedrightarraybackslash}p{0.4textwidth}
>{centeringarraybackslash}p{0.15textwidth}
>{centeringarraybackslash}p{0.15textwidth}@{}}
toprule
centeringtextbf{Train formation} &
multicolumn{2}{c@{}}{begin{tabular}{@{}>{centeringarraybackslash}p{0.15textwidth}
>{centeringarraybackslash}p{0.15textwidth}@{}}
multicolumn{2}{c@{}}{textbf{Permissible speed}} \ midrule
textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or above} &
textbf{SI{10}{mph} (SI{15}{kilometreperhour}) or less}
end{tabular}} \ midrule
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad &
SI{10}{mph} (SI{15}{kilometreperhour}) &
SI{10}{mph} (SI{15}{kilometreperhour}) \
minim veniam, quis nostrud exercitation ullamco laboris nisi ut \
bottomrule
end{tabular}
end{center}
end{document}
edited Jan 31 at 19:26
answered Jan 31 at 19:08
John KormyloJohn Kormylo
44.6k12568
44.6k12568
Ended up using a bit of both answers, thanks!
– Au101
Jan 31 at 21:59
add a comment |
Ended up using a bit of both answers, thanks!
– Au101
Jan 31 at 21:59
Ended up using a bit of both answers, thanks!
– Au101
Jan 31 at 21:59
Ended up using a bit of both answers, thanks!
– Au101
Jan 31 at 21:59
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%2f472739%2fhow-to-vertically-centre-a-cell-spanning-multiple-rows-with-the-p-column-type%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