Centre cell vertically in tabularx across multiple multiline rows Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)Vertical alignment in tabularx X column typeCenter vertically in tabularx with multiple font size and arraystretchVertically center text across two rowsVertically align multirow in tabularx environmenttabu package - gaps in vertical linesBreak cell into multiple rowsVertically centered cell with rotatebox and tabularxCentre column contents in tabularxHow to vertically centre a cell spanning multiple rows with the p column typeCentre cell contents verticallyCentre cell vertically in tabularx
New Order #6: Easter Egg
How to make an animal which can only breed for a certain number of generations?
What does Sonny Burch mean by, "S.H.I.E.L.D. and HYDRA don't even exist anymore"?
How to get a flat-head nail out of a piece of wood?
Why can't fire hurt Daenerys but it did to Jon Snow in season 1?
Why complex landing gears are used instead of simple, reliable and light weight muscle wire or shape memory alloys?
What did Turing mean when saying that "machines cannot give rise to surprises" is due to a fallacy?
Inverse square law not accurate for non-point masses?
Understanding piped commands in GNU/Linux
"Destructive power" carried by a B-52?
Changing order of draw operation in PGFPlots
How do you cope with tons of web fonts when copying and pasting from web pages?
As a dual citizen, my US passport will expire one day after traveling to the US. Will this work?
Weaponising the Grasp-at-a-Distance spell
How to name indistinguishable henchmen in a screenplay?
By what mechanism was the 2017 UK General Election called?
Can I take recommendation from someone I met at a conference?
draw a pulley system
.bashrc alias for a command with fixed second parameter
Should man-made satellites feature an intelligent inverted "cow catcher"?
Improvising over quartal voicings
3D Masyu - A Die
How do I say "this must not happen"?
Centre cell vertically in tabularx across multiple multiline rows
Centre cell vertically in tabularx across multiple multiline rows
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)Vertical alignment in tabularx X column typeCenter vertically in tabularx with multiple font size and arraystretchVertically center text across two rowsVertically align multirow in tabularx environmenttabu package - gaps in vertical linesBreak cell into multiple rowsVertically centered cell with rotatebox and tabularxCentre column contents in tabularxHow to vertically centre a cell spanning multiple rows with the p column typeCentre cell contents verticallyCentre cell vertically in tabularx
Consider this example:
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
renewcommandtabularxcolumn[1]m#1
begindocument
begintabularx0.5linewidthllX
multirow2*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
enddocument
The output is

I have used Vertical alignment in tabularx X column type to centre cells vertically.
However, I am not pleased the way "A" is centred. It uses multirow. How to centre "A" vertically in the middle of the table?
Solution that avoids the use of multirow is also accepted.
tables vertical-alignment tabularx multirow
|
show 2 more comments
Consider this example:
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
renewcommandtabularxcolumn[1]m#1
begindocument
begintabularx0.5linewidthllX
multirow2*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
enddocument
The output is

I have used Vertical alignment in tabularx X column type to centre cells vertically.
However, I am not pleased the way "A" is centred. It uses multirow. How to centre "A" vertically in the middle of the table?
Solution that avoids the use of multirow is also accepted.
tables vertical-alignment tabularx multirow
Maybe you can try withmultirow8*A.
– leandriis
1 hour ago
Since you mademthe underlying column type, since the cells in column 3 occupy 12 rows in all, and since one half of 12 is 6, you should replacemultirow2*Awithmultirow6*A.
– Mico
1 hour ago
@Mico: Wouldn't one typically usemultirow12in order to vertically center a cell adjacent to a cell that contains 12 lines of text? However, in the OP's case the redefinition of theXtype column usingrenewcommandtabularxcolumn[1]m#1seems to interfere with that.
– leandriis
1 hour ago
@leandriis, then I need to manually count rows. So laborious when dealing with many tables, changing text.
– Viesturs
1 hour ago
@leandriis - Indeed, if therenewcommandtabularxcolumn[1]m#1directive weren't there, one would have to use12, not6, as the first argument ofmultirow.
– Mico
1 hour ago
|
show 2 more comments
Consider this example:
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
renewcommandtabularxcolumn[1]m#1
begindocument
begintabularx0.5linewidthllX
multirow2*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
enddocument
The output is

I have used Vertical alignment in tabularx X column type to centre cells vertically.
However, I am not pleased the way "A" is centred. It uses multirow. How to centre "A" vertically in the middle of the table?
Solution that avoids the use of multirow is also accepted.
tables vertical-alignment tabularx multirow
Consider this example:
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
renewcommandtabularxcolumn[1]m#1
begindocument
begintabularx0.5linewidthllX
multirow2*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
enddocument
The output is

I have used Vertical alignment in tabularx X column type to centre cells vertically.
However, I am not pleased the way "A" is centred. It uses multirow. How to centre "A" vertically in the middle of the table?
Solution that avoids the use of multirow is also accepted.
tables vertical-alignment tabularx multirow
tables vertical-alignment tabularx multirow
edited 50 mins ago
Viesturs
asked 1 hour ago
ViestursViesturs
2,06241327
2,06241327
Maybe you can try withmultirow8*A.
– leandriis
1 hour ago
Since you mademthe underlying column type, since the cells in column 3 occupy 12 rows in all, and since one half of 12 is 6, you should replacemultirow2*Awithmultirow6*A.
– Mico
1 hour ago
@Mico: Wouldn't one typically usemultirow12in order to vertically center a cell adjacent to a cell that contains 12 lines of text? However, in the OP's case the redefinition of theXtype column usingrenewcommandtabularxcolumn[1]m#1seems to interfere with that.
– leandriis
1 hour ago
@leandriis, then I need to manually count rows. So laborious when dealing with many tables, changing text.
– Viesturs
1 hour ago
@leandriis - Indeed, if therenewcommandtabularxcolumn[1]m#1directive weren't there, one would have to use12, not6, as the first argument ofmultirow.
– Mico
1 hour ago
|
show 2 more comments
Maybe you can try withmultirow8*A.
– leandriis
1 hour ago
Since you mademthe underlying column type, since the cells in column 3 occupy 12 rows in all, and since one half of 12 is 6, you should replacemultirow2*Awithmultirow6*A.
– Mico
1 hour ago
@Mico: Wouldn't one typically usemultirow12in order to vertically center a cell adjacent to a cell that contains 12 lines of text? However, in the OP's case the redefinition of theXtype column usingrenewcommandtabularxcolumn[1]m#1seems to interfere with that.
– leandriis
1 hour ago
@leandriis, then I need to manually count rows. So laborious when dealing with many tables, changing text.
– Viesturs
1 hour ago
@leandriis - Indeed, if therenewcommandtabularxcolumn[1]m#1directive weren't there, one would have to use12, not6, as the first argument ofmultirow.
– Mico
1 hour ago
Maybe you can try with
multirow8*A.– leandriis
1 hour ago
Maybe you can try with
multirow8*A.– leandriis
1 hour ago
Since you made
m the underlying column type, since the cells in column 3 occupy 12 rows in all, and since one half of 12 is 6, you should replace multirow2*A with multirow6*A.– Mico
1 hour ago
Since you made
m the underlying column type, since the cells in column 3 occupy 12 rows in all, and since one half of 12 is 6, you should replace multirow2*A with multirow6*A.– Mico
1 hour ago
@Mico: Wouldn't one typically use
multirow12 in order to vertically center a cell adjacent to a cell that contains 12 lines of text? However, in the OP's case the redefinition of the X type column using renewcommandtabularxcolumn[1]m#1 seems to interfere with that.– leandriis
1 hour ago
@Mico: Wouldn't one typically use
multirow12 in order to vertically center a cell adjacent to a cell that contains 12 lines of text? However, in the OP's case the redefinition of the X type column using renewcommandtabularxcolumn[1]m#1 seems to interfere with that.– leandriis
1 hour ago
@leandriis, then I need to manually count rows. So laborious when dealing with many tables, changing text.
– Viesturs
1 hour ago
@leandriis, then I need to manually count rows. So laborious when dealing with many tables, changing text.
– Viesturs
1 hour ago
@leandriis - Indeed, if the
renewcommandtabularxcolumn[1]m#1 directive weren't there, one would have to use 12, not 6, as the first argument of multirow.– Mico
1 hour ago
@leandriis - Indeed, if the
renewcommandtabularxcolumn[1]m#1 directive weren't there, one would have to use 12, not 6, as the first argument of multirow.– Mico
1 hour ago
|
show 2 more comments
3 Answers
3
active
oldest
votes
As Ulrike said in a comment, to avoid manual adjustment, nesting tabulars could be a solution.
I would put a tabular with an m column of appropriate width in the main tabular.
I added the lines just to show the "A" is vertically centered.
documentclassreport
usepackagetabularx
usepackagearray
usepackagelipsum
begindocument
noindentbegintabular
hline
A &
begintabular@lm.352linewidth@
B & lipsum[1][1-2]\
C & lipsum[2][1-3]\
endtabular\
hline
endtabular
vspace4exnoindentbegintabularx.5linewidthllX
hline
A & B & Just for benchmark\
hline
endtabularx
enddocument

In case of multiple multirow cells nesting in a nesting would be required.
– Viesturs
36 mins ago
@Viesturs Yes, it may be
– CarLaTeX
35 mins ago
add a comment |
Here is a possibe solution using a minipage and a tabularx:
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
renewcommandtabularxcolumn[1]m#1
usepackagecalc
begindocument
beginminipage2em
A
endminipage%
begintabularx0.5linewidth-2emlX
B & lipsum[1][1-2] \
C & lipsum[2][1-3]\
endtabularx
enddocument

add a comment |
In this case you can use a 1-row multicolumn as the baseline of the m-column is there. In other cases you will have to use the vmode-option described in the documentation. Imho while multirow works okay with 1-line cells it is imho rather a pain with m- and p-columns and I use it seldom.
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
begindocument
% with X as p-column 5 works:
begintabularx0.5linewidthllX
multirow5*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
%X as m-column:
renewcommandtabularxcolumn[1]m#1
begintabularx0.5linewidthllX
multirow1*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
enddocument

To center the A over both cells use a value of 8.5 or 9 works (that's the number of lines below the baseline of the first cell.
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
renewcommandtabularxcolumn[1]m#1
begindocument
begintabularx0.5linewidthllX
multirow9*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
enddocument

Where is the improvement? Apparently I was not clear in my question, but by nicely I mean "A" centred vertically in the middle of the table. I updated my question.
– Viesturs
1 hour ago
Ah sorry, I added an edit.
– Ulrike Fischer
1 hour ago
Now there are 6 lines above and 5 below "A".7works for me. This solution requires a tedious counting of lines manually.
– Viesturs
1 hour ago
1
Yes, but the A is aligned to a line. It is up to you to decide what is visual more pleasing. And yes, it is a pain - I already wrote in the answer. I wouldn't use multirow but nested tabulars or even simple boxes for such a layout.
– Ulrike Fischer
1 hour ago
it could be worthwhile to provide your solution with nested tabulars or simple boxes.
– Viesturs
59 mins ago
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%2f486010%2fcentre-cell-vertically-in-tabularx-across-multiple-multiline-rows%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
As Ulrike said in a comment, to avoid manual adjustment, nesting tabulars could be a solution.
I would put a tabular with an m column of appropriate width in the main tabular.
I added the lines just to show the "A" is vertically centered.
documentclassreport
usepackagetabularx
usepackagearray
usepackagelipsum
begindocument
noindentbegintabular
hline
A &
begintabular@lm.352linewidth@
B & lipsum[1][1-2]\
C & lipsum[2][1-3]\
endtabular\
hline
endtabular
vspace4exnoindentbegintabularx.5linewidthllX
hline
A & B & Just for benchmark\
hline
endtabularx
enddocument

In case of multiple multirow cells nesting in a nesting would be required.
– Viesturs
36 mins ago
@Viesturs Yes, it may be
– CarLaTeX
35 mins ago
add a comment |
As Ulrike said in a comment, to avoid manual adjustment, nesting tabulars could be a solution.
I would put a tabular with an m column of appropriate width in the main tabular.
I added the lines just to show the "A" is vertically centered.
documentclassreport
usepackagetabularx
usepackagearray
usepackagelipsum
begindocument
noindentbegintabular
hline
A &
begintabular@lm.352linewidth@
B & lipsum[1][1-2]\
C & lipsum[2][1-3]\
endtabular\
hline
endtabular
vspace4exnoindentbegintabularx.5linewidthllX
hline
A & B & Just for benchmark\
hline
endtabularx
enddocument

In case of multiple multirow cells nesting in a nesting would be required.
– Viesturs
36 mins ago
@Viesturs Yes, it may be
– CarLaTeX
35 mins ago
add a comment |
As Ulrike said in a comment, to avoid manual adjustment, nesting tabulars could be a solution.
I would put a tabular with an m column of appropriate width in the main tabular.
I added the lines just to show the "A" is vertically centered.
documentclassreport
usepackagetabularx
usepackagearray
usepackagelipsum
begindocument
noindentbegintabular
hline
A &
begintabular@lm.352linewidth@
B & lipsum[1][1-2]\
C & lipsum[2][1-3]\
endtabular\
hline
endtabular
vspace4exnoindentbegintabularx.5linewidthllX
hline
A & B & Just for benchmark\
hline
endtabularx
enddocument

As Ulrike said in a comment, to avoid manual adjustment, nesting tabulars could be a solution.
I would put a tabular with an m column of appropriate width in the main tabular.
I added the lines just to show the "A" is vertically centered.
documentclassreport
usepackagetabularx
usepackagearray
usepackagelipsum
begindocument
noindentbegintabular
hline
A &
begintabular@lm.352linewidth@
B & lipsum[1][1-2]\
C & lipsum[2][1-3]\
endtabular\
hline
endtabular
vspace4exnoindentbegintabularx.5linewidthllX
hline
A & B & Just for benchmark\
hline
endtabularx
enddocument

edited 38 mins ago
answered 51 mins ago
CarLaTeXCarLaTeX
35.3k554152
35.3k554152
In case of multiple multirow cells nesting in a nesting would be required.
– Viesturs
36 mins ago
@Viesturs Yes, it may be
– CarLaTeX
35 mins ago
add a comment |
In case of multiple multirow cells nesting in a nesting would be required.
– Viesturs
36 mins ago
@Viesturs Yes, it may be
– CarLaTeX
35 mins ago
In case of multiple multirow cells nesting in a nesting would be required.
– Viesturs
36 mins ago
In case of multiple multirow cells nesting in a nesting would be required.
– Viesturs
36 mins ago
@Viesturs Yes, it may be
– CarLaTeX
35 mins ago
@Viesturs Yes, it may be
– CarLaTeX
35 mins ago
add a comment |
Here is a possibe solution using a minipage and a tabularx:
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
renewcommandtabularxcolumn[1]m#1
usepackagecalc
begindocument
beginminipage2em
A
endminipage%
begintabularx0.5linewidth-2emlX
B & lipsum[1][1-2] \
C & lipsum[2][1-3]\
endtabularx
enddocument

add a comment |
Here is a possibe solution using a minipage and a tabularx:
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
renewcommandtabularxcolumn[1]m#1
usepackagecalc
begindocument
beginminipage2em
A
endminipage%
begintabularx0.5linewidth-2emlX
B & lipsum[1][1-2] \
C & lipsum[2][1-3]\
endtabularx
enddocument

add a comment |
Here is a possibe solution using a minipage and a tabularx:
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
renewcommandtabularxcolumn[1]m#1
usepackagecalc
begindocument
beginminipage2em
A
endminipage%
begintabularx0.5linewidth-2emlX
B & lipsum[1][1-2] \
C & lipsum[2][1-3]\
endtabularx
enddocument

Here is a possibe solution using a minipage and a tabularx:
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
renewcommandtabularxcolumn[1]m#1
usepackagecalc
begindocument
beginminipage2em
A
endminipage%
begintabularx0.5linewidth-2emlX
B & lipsum[1][1-2] \
C & lipsum[2][1-3]\
endtabularx
enddocument

answered 23 mins ago
leandriisleandriis
11.7k1733
11.7k1733
add a comment |
add a comment |
In this case you can use a 1-row multicolumn as the baseline of the m-column is there. In other cases you will have to use the vmode-option described in the documentation. Imho while multirow works okay with 1-line cells it is imho rather a pain with m- and p-columns and I use it seldom.
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
begindocument
% with X as p-column 5 works:
begintabularx0.5linewidthllX
multirow5*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
%X as m-column:
renewcommandtabularxcolumn[1]m#1
begintabularx0.5linewidthllX
multirow1*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
enddocument

To center the A over both cells use a value of 8.5 or 9 works (that's the number of lines below the baseline of the first cell.
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
renewcommandtabularxcolumn[1]m#1
begindocument
begintabularx0.5linewidthllX
multirow9*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
enddocument

Where is the improvement? Apparently I was not clear in my question, but by nicely I mean "A" centred vertically in the middle of the table. I updated my question.
– Viesturs
1 hour ago
Ah sorry, I added an edit.
– Ulrike Fischer
1 hour ago
Now there are 6 lines above and 5 below "A".7works for me. This solution requires a tedious counting of lines manually.
– Viesturs
1 hour ago
1
Yes, but the A is aligned to a line. It is up to you to decide what is visual more pleasing. And yes, it is a pain - I already wrote in the answer. I wouldn't use multirow but nested tabulars or even simple boxes for such a layout.
– Ulrike Fischer
1 hour ago
it could be worthwhile to provide your solution with nested tabulars or simple boxes.
– Viesturs
59 mins ago
add a comment |
In this case you can use a 1-row multicolumn as the baseline of the m-column is there. In other cases you will have to use the vmode-option described in the documentation. Imho while multirow works okay with 1-line cells it is imho rather a pain with m- and p-columns and I use it seldom.
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
begindocument
% with X as p-column 5 works:
begintabularx0.5linewidthllX
multirow5*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
%X as m-column:
renewcommandtabularxcolumn[1]m#1
begintabularx0.5linewidthllX
multirow1*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
enddocument

To center the A over both cells use a value of 8.5 or 9 works (that's the number of lines below the baseline of the first cell.
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
renewcommandtabularxcolumn[1]m#1
begindocument
begintabularx0.5linewidthllX
multirow9*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
enddocument

Where is the improvement? Apparently I was not clear in my question, but by nicely I mean "A" centred vertically in the middle of the table. I updated my question.
– Viesturs
1 hour ago
Ah sorry, I added an edit.
– Ulrike Fischer
1 hour ago
Now there are 6 lines above and 5 below "A".7works for me. This solution requires a tedious counting of lines manually.
– Viesturs
1 hour ago
1
Yes, but the A is aligned to a line. It is up to you to decide what is visual more pleasing. And yes, it is a pain - I already wrote in the answer. I wouldn't use multirow but nested tabulars or even simple boxes for such a layout.
– Ulrike Fischer
1 hour ago
it could be worthwhile to provide your solution with nested tabulars or simple boxes.
– Viesturs
59 mins ago
add a comment |
In this case you can use a 1-row multicolumn as the baseline of the m-column is there. In other cases you will have to use the vmode-option described in the documentation. Imho while multirow works okay with 1-line cells it is imho rather a pain with m- and p-columns and I use it seldom.
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
begindocument
% with X as p-column 5 works:
begintabularx0.5linewidthllX
multirow5*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
%X as m-column:
renewcommandtabularxcolumn[1]m#1
begintabularx0.5linewidthllX
multirow1*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
enddocument

To center the A over both cells use a value of 8.5 or 9 works (that's the number of lines below the baseline of the first cell.
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
renewcommandtabularxcolumn[1]m#1
begindocument
begintabularx0.5linewidthllX
multirow9*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
enddocument

In this case you can use a 1-row multicolumn as the baseline of the m-column is there. In other cases you will have to use the vmode-option described in the documentation. Imho while multirow works okay with 1-line cells it is imho rather a pain with m- and p-columns and I use it seldom.
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
begindocument
% with X as p-column 5 works:
begintabularx0.5linewidthllX
multirow5*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
%X as m-column:
renewcommandtabularxcolumn[1]m#1
begintabularx0.5linewidthllX
multirow1*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
enddocument

To center the A over both cells use a value of 8.5 or 9 works (that's the number of lines below the baseline of the first cell.
documentclassreport
usepackagetabularx
usepackagelipsum
usepackagemultirow
renewcommandtabularxcolumn[1]m#1
begindocument
begintabularx0.5linewidthllX
multirow9*A & B & lipsum[1][1-2] \
& C & lipsum[2][1-3]\
endtabularx
enddocument

edited 1 hour ago
answered 1 hour ago
Ulrike FischerUlrike Fischer
200k9306693
200k9306693
Where is the improvement? Apparently I was not clear in my question, but by nicely I mean "A" centred vertically in the middle of the table. I updated my question.
– Viesturs
1 hour ago
Ah sorry, I added an edit.
– Ulrike Fischer
1 hour ago
Now there are 6 lines above and 5 below "A".7works for me. This solution requires a tedious counting of lines manually.
– Viesturs
1 hour ago
1
Yes, but the A is aligned to a line. It is up to you to decide what is visual more pleasing. And yes, it is a pain - I already wrote in the answer. I wouldn't use multirow but nested tabulars or even simple boxes for such a layout.
– Ulrike Fischer
1 hour ago
it could be worthwhile to provide your solution with nested tabulars or simple boxes.
– Viesturs
59 mins ago
add a comment |
Where is the improvement? Apparently I was not clear in my question, but by nicely I mean "A" centred vertically in the middle of the table. I updated my question.
– Viesturs
1 hour ago
Ah sorry, I added an edit.
– Ulrike Fischer
1 hour ago
Now there are 6 lines above and 5 below "A".7works for me. This solution requires a tedious counting of lines manually.
– Viesturs
1 hour ago
1
Yes, but the A is aligned to a line. It is up to you to decide what is visual more pleasing. And yes, it is a pain - I already wrote in the answer. I wouldn't use multirow but nested tabulars or even simple boxes for such a layout.
– Ulrike Fischer
1 hour ago
it could be worthwhile to provide your solution with nested tabulars or simple boxes.
– Viesturs
59 mins ago
Where is the improvement? Apparently I was not clear in my question, but by nicely I mean "A" centred vertically in the middle of the table. I updated my question.
– Viesturs
1 hour ago
Where is the improvement? Apparently I was not clear in my question, but by nicely I mean "A" centred vertically in the middle of the table. I updated my question.
– Viesturs
1 hour ago
Ah sorry, I added an edit.
– Ulrike Fischer
1 hour ago
Ah sorry, I added an edit.
– Ulrike Fischer
1 hour ago
Now there are 6 lines above and 5 below "A".
7 works for me. This solution requires a tedious counting of lines manually.– Viesturs
1 hour ago
Now there are 6 lines above and 5 below "A".
7 works for me. This solution requires a tedious counting of lines manually.– Viesturs
1 hour ago
1
1
Yes, but the A is aligned to a line. It is up to you to decide what is visual more pleasing. And yes, it is a pain - I already wrote in the answer. I wouldn't use multirow but nested tabulars or even simple boxes for such a layout.
– Ulrike Fischer
1 hour ago
Yes, but the A is aligned to a line. It is up to you to decide what is visual more pleasing. And yes, it is a pain - I already wrote in the answer. I wouldn't use multirow but nested tabulars or even simple boxes for such a layout.
– Ulrike Fischer
1 hour ago
it could be worthwhile to provide your solution with nested tabulars or simple boxes.
– Viesturs
59 mins ago
it could be worthwhile to provide your solution with nested tabulars or simple boxes.
– Viesturs
59 mins ago
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%2f486010%2fcentre-cell-vertically-in-tabularx-across-multiple-multiline-rows%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
Maybe you can try with
multirow8*A.– leandriis
1 hour ago
Since you made
mthe underlying column type, since the cells in column 3 occupy 12 rows in all, and since one half of 12 is 6, you should replacemultirow2*Awithmultirow6*A.– Mico
1 hour ago
@Mico: Wouldn't one typically use
multirow12in order to vertically center a cell adjacent to a cell that contains 12 lines of text? However, in the OP's case the redefinition of theXtype column usingrenewcommandtabularxcolumn[1]m#1seems to interfere with that.– leandriis
1 hour ago
@leandriis, then I need to manually count rows. So laborious when dealing with many tables, changing text.
– Viesturs
1 hour ago
@leandriis - Indeed, if the
renewcommandtabularxcolumn[1]m#1directive weren't there, one would have to use12, not6, as the first argument ofmultirow.– Mico
1 hour ago