Table caption in the middle of the tableWhy does an environment's label have to appear after the caption?How to get multiple multirows in a table?Paragraph column in tabular working only in the first columnCentering a table while ignoring the 1st column in centering procedureRotated Text in Table Extending into Rows in Lyxtabu package - gaps in vertical linesTable - APA6 class - rotating (with caption and table notes)Horizontal lines in nested tabular environmentAdding 3 multi-columns upside in a tableHow to set longtable width to text width so that the text in cell wraps around automatically?Wrapping text within a multirow cell
Configurable API Version for Anonymous Blocks?
In an emergency, how do I find and share my position?
What is the hex versus octal timeline?
Bankers with rancor
Brexit and backstop: would changes require unanimous approval by all EU countries? Does Ireland hold a veto?
Why is observed clock rate < 3MHz on Arduino Uno?
Why does my house heat up, even when it's cool outside?
Why aren't RCS openings an issue for spacecraft heat shields?
Script that helps people make better choices
Why we don't have vaccination against all diseases which are caused by microbes?
Concatenation of the result of a function with a mutable default argument in python
If all stars rotate, why was there a theory developed, that requires non-rotating stars?
Quickly evaluating this limit
Is a butterfly one or two animals?
What is wrong about this application of Kirchhoffs Current Law?
Table caption in the middle of the table
Is it safe to remove the bottom chords of a series of garage roof trusses?
Defense against attacks using dictionaries
Why is Boris Johnson visiting only Paris & Berlin if every member of the EU needs to agree on a withdrawal deal?
Shouldn't the "credit score" prevent Americans from going deeper and deeper into personal debt?
Why can't an Airbus A330 dump fuel in an emergency?
Are illustrations in novels frowned upon?
Is it possible to create a golf ball sized star?
How to refer to a regex group in awk regex?
Table caption in the middle of the table
Why does an environment's label have to appear after the caption?How to get multiple multirows in a table?Paragraph column in tabular working only in the first columnCentering a table while ignoring the 1st column in centering procedureRotated Text in Table Extending into Rows in Lyxtabu package - gaps in vertical linesTable - APA6 class - rotating (with caption and table notes)Horizontal lines in nested tabular environmentAdding 3 multi-columns upside in a tableHow to set longtable width to text width so that the text in cell wraps around automatically?Wrapping text within a multirow cell
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I managed to make a table but the caption (or any text I add after it) is in the middle of the table, as if the table ended after the second row. I couldn't find a similar question so I decided to ask myself.
Without the caption, or any text before/after it, the table looks almost how I would want it to look.
documentclassreport
usepackagemultirow
begindocument
This is some text and here is a reference to Table reftable:mytable.
begintable [h]
centering
begintabular c c c \
textbfColumn A & textbfColumn B & textbfColumn C \
hline
multirow3*textbfTest1
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \
multirow6*textbfTest2
& multicolumn2c multirow6*shortstack[l]line1 \ line2 \ line3 \
multirow9*textbfTest3
& multirow9*shortstack[l]line1 \ line2 \ line3
& multirow9*shortstack[l]line1 \ line2 \ line3 \
multirow12*textbfTest4
& multirow12*shortstack[l]line1 \ line2 \ line3
& multirow12*shortstack[l]line1 \ line2 \ line3 \
endtabular
labeltable:mytable
captionThis is the caption.
endtable
enddocument
As a side note, the referencing also isn't working properly for some reason?. I wanted the sentence to say
[...] here is a reference to Table 1.
and instead it just says
[...] here is a reference to Table .
I've managed to use ref
with other tables but not this one.
tables cross-referencing captions multirow
New contributor
add a comment |
I managed to make a table but the caption (or any text I add after it) is in the middle of the table, as if the table ended after the second row. I couldn't find a similar question so I decided to ask myself.
Without the caption, or any text before/after it, the table looks almost how I would want it to look.
documentclassreport
usepackagemultirow
begindocument
This is some text and here is a reference to Table reftable:mytable.
begintable [h]
centering
begintabular c c c \
textbfColumn A & textbfColumn B & textbfColumn C \
hline
multirow3*textbfTest1
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \
multirow6*textbfTest2
& multicolumn2c multirow6*shortstack[l]line1 \ line2 \ line3 \
multirow9*textbfTest3
& multirow9*shortstack[l]line1 \ line2 \ line3
& multirow9*shortstack[l]line1 \ line2 \ line3 \
multirow12*textbfTest4
& multirow12*shortstack[l]line1 \ line2 \ line3
& multirow12*shortstack[l]line1 \ line2 \ line3 \
endtabular
labeltable:mytable
captionThis is the caption.
endtable
enddocument
As a side note, the referencing also isn't working properly for some reason?. I wanted the sentence to say
[...] here is a reference to Table 1.
and instead it just says
[...] here is a reference to Table .
I've managed to use ref
with other tables but not this one.
tables cross-referencing captions multirow
New contributor
Do you know howmultirow
works? For example, what does the first argument inmultirow12
mean. Once you figure that out, I'm sure you'll understand what's going on.
– Werner
8 hours ago
From what I understand, it's the number of rows I want the multirow block to be. In this case, it's 3 rows. So the first multirow is rows 1-3, the second one is 3-6 and so on.
– NATS
8 hours ago
Will there always bw three lines in colum B and C?
– leandriis
8 hours ago
@NATS You have programmed last multirow to span 12 column, not 3. If you add all the spanning, you get 3+6+9+12=30 rows, and you have 12 rows in your table. I suggest you reread the multirow manual.
– Sveinung
7 hours ago
add a comment |
I managed to make a table but the caption (or any text I add after it) is in the middle of the table, as if the table ended after the second row. I couldn't find a similar question so I decided to ask myself.
Without the caption, or any text before/after it, the table looks almost how I would want it to look.
documentclassreport
usepackagemultirow
begindocument
This is some text and here is a reference to Table reftable:mytable.
begintable [h]
centering
begintabular c c c \
textbfColumn A & textbfColumn B & textbfColumn C \
hline
multirow3*textbfTest1
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \
multirow6*textbfTest2
& multicolumn2c multirow6*shortstack[l]line1 \ line2 \ line3 \
multirow9*textbfTest3
& multirow9*shortstack[l]line1 \ line2 \ line3
& multirow9*shortstack[l]line1 \ line2 \ line3 \
multirow12*textbfTest4
& multirow12*shortstack[l]line1 \ line2 \ line3
& multirow12*shortstack[l]line1 \ line2 \ line3 \
endtabular
labeltable:mytable
captionThis is the caption.
endtable
enddocument
As a side note, the referencing also isn't working properly for some reason?. I wanted the sentence to say
[...] here is a reference to Table 1.
and instead it just says
[...] here is a reference to Table .
I've managed to use ref
with other tables but not this one.
tables cross-referencing captions multirow
New contributor
I managed to make a table but the caption (or any text I add after it) is in the middle of the table, as if the table ended after the second row. I couldn't find a similar question so I decided to ask myself.
Without the caption, or any text before/after it, the table looks almost how I would want it to look.
documentclassreport
usepackagemultirow
begindocument
This is some text and here is a reference to Table reftable:mytable.
begintable [h]
centering
begintabular c c c \
textbfColumn A & textbfColumn B & textbfColumn C \
hline
multirow3*textbfTest1
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \
multirow6*textbfTest2
& multicolumn2c multirow6*shortstack[l]line1 \ line2 \ line3 \
multirow9*textbfTest3
& multirow9*shortstack[l]line1 \ line2 \ line3
& multirow9*shortstack[l]line1 \ line2 \ line3 \
multirow12*textbfTest4
& multirow12*shortstack[l]line1 \ line2 \ line3
& multirow12*shortstack[l]line1 \ line2 \ line3 \
endtabular
labeltable:mytable
captionThis is the caption.
endtable
enddocument
As a side note, the referencing also isn't working properly for some reason?. I wanted the sentence to say
[...] here is a reference to Table 1.
and instead it just says
[...] here is a reference to Table .
I've managed to use ref
with other tables but not this one.
tables cross-referencing captions multirow
tables cross-referencing captions multirow
New contributor
New contributor
edited 8 hours ago
Werner
460k77 gold badges1029 silver badges1772 bronze badges
460k77 gold badges1029 silver badges1772 bronze badges
New contributor
asked 8 hours ago
NATSNATS
183 bronze badges
183 bronze badges
New contributor
New contributor
Do you know howmultirow
works? For example, what does the first argument inmultirow12
mean. Once you figure that out, I'm sure you'll understand what's going on.
– Werner
8 hours ago
From what I understand, it's the number of rows I want the multirow block to be. In this case, it's 3 rows. So the first multirow is rows 1-3, the second one is 3-6 and so on.
– NATS
8 hours ago
Will there always bw three lines in colum B and C?
– leandriis
8 hours ago
@NATS You have programmed last multirow to span 12 column, not 3. If you add all the spanning, you get 3+6+9+12=30 rows, and you have 12 rows in your table. I suggest you reread the multirow manual.
– Sveinung
7 hours ago
add a comment |
Do you know howmultirow
works? For example, what does the first argument inmultirow12
mean. Once you figure that out, I'm sure you'll understand what's going on.
– Werner
8 hours ago
From what I understand, it's the number of rows I want the multirow block to be. In this case, it's 3 rows. So the first multirow is rows 1-3, the second one is 3-6 and so on.
– NATS
8 hours ago
Will there always bw three lines in colum B and C?
– leandriis
8 hours ago
@NATS You have programmed last multirow to span 12 column, not 3. If you add all the spanning, you get 3+6+9+12=30 rows, and you have 12 rows in your table. I suggest you reread the multirow manual.
– Sveinung
7 hours ago
Do you know how
multirow
works? For example, what does the first argument in multirow12
mean. Once you figure that out, I'm sure you'll understand what's going on.– Werner
8 hours ago
Do you know how
multirow
works? For example, what does the first argument in multirow12
mean. Once you figure that out, I'm sure you'll understand what's going on.– Werner
8 hours ago
From what I understand, it's the number of rows I want the multirow block to be. In this case, it's 3 rows. So the first multirow is rows 1-3, the second one is 3-6 and so on.
– NATS
8 hours ago
From what I understand, it's the number of rows I want the multirow block to be. In this case, it's 3 rows. So the first multirow is rows 1-3, the second one is 3-6 and so on.
– NATS
8 hours ago
Will there always bw three lines in colum B and C?
– leandriis
8 hours ago
Will there always bw three lines in colum B and C?
– leandriis
8 hours ago
@NATS You have programmed last multirow to span 12 column, not 3. If you add all the spanning, you get 3+6+9+12=30 rows, and you have 12 rows in your table. I suggest you reread the multirow manual.
– Sveinung
7 hours ago
@NATS You have programmed last multirow to span 12 column, not 3. If you add all the spanning, you get 3+6+9+12=30 rows, and you have 12 rows in your table. I suggest you reread the multirow manual.
– Sveinung
7 hours ago
add a comment |
3 Answers
3
active
oldest
votes
multirow<nrows><width><text>
spreads text (vertically) across <nrows>
rows of width <width>
. If <width>
is given as *
, it uses the natural width of <text>
. So, for example, using multirow12*<...>
means you want to spread that specific cell over 12 rows. It's obviously incorrect since each TestX
you want to spread over only 3 rows.
Here's a slightly different implementation (since you don't need multirow
here) using makecell
:
documentclassreport
usepackagemakecell
begindocument
This is some text and here is a reference to Table~reftable:mytable.
begintable [h]
centering
begintabular c c c
textbfColumn A & textbfColumn B & textbfColumn C \
hline
textbfTest1
& makecellline1 \ line2 \ line3
& makecellline1 \ line2 \ line3 \
textbfTest2
& multicolumn2cmakecellline1 \ line2 \ line3 \
textbfTest3
& makecellline1 \ line2 \ line3
& makecellline1 \ line2 \ line3 \
textbfTest4
& makecellline1 \ line2 \ line3
& makecellline1 \ line2 \ line3
endtabular
captionThis is the caption.
labeltable:mytable
endtable
enddocument
Note how the label
comes after caption
in order to achieve the correct ref
erence. See Why does an environment's label have to appear after the caption?.
If you always have 3 rows/elements in Column B & Column C, you don't needmakecell
either. Just place the Column A entry on the second row of each "block."
– Werner
8 hours ago
add a comment |
As I write in the comment to the question, you have misunderstood how multirow calculate spanning of rows, but it is easily fixed. Just add 3 all places (i.e instead of 6, 9 and 12).
To fix the misplaced caption, and if you want to use your original code, you have to add extra space after the multirow
row to create enough space for the spanned rows. Since you span three rows, you may either add two rows (&&\
) or extra height at the end-of-row
command (\[<height>]
. I added two normalbaselineskip
s so you have space equal three rows.
The safest place for the label is inside the caption command. Then it will not fail.
documentclassreport
usepackagemultirow
begindocument
This is some text and here is a reference to Table reftable:mytable. As you see, the table is a float, and since you have available space, it is place at top of the page. Do not mess around with placing floats before you have finished all creative writing. Everting you do, will be invalid when you add more text.
begintable
centering
begintabular c c c \
textbfColumn A & textbfColumn B & textbfColumn C \
hline
multirow3*textbfTest1
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip] % Add more space
multirow3*textbfTest2
& multicolumn2c multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip] multirow3*textbfTest3
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip]
multirow3*textbfTest4
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip]
endtabular
captionThis is the caption.labeltable:mytable
endtable
enddocument
add a comment |
A variant code, also based on makecell
, combined with multirow
– and booktabs
, to add some padding around rules. I added some vertical spacing to separate the groups of three lines. Also, a reference to requires a label
command (after the caption) to work.
documentclassreport
usepackagemultirow
usepackagemakecell, booktabs
renewcommandtheadfontnormalsizebfseries
begindocument
This is some text and here is a reference to Table reftable:mytable.
begintable [h]
centering
begintabular c c c \
textbfColumn A & textbfColumn B & textbfColumn C \
midrule
multirowthead3Test1 & line1 & line1 \
& line2 & line2 \
& line3 & line 3\
addlinespace
textbfTest2 & multicolumn2cmakecellline1 \ line2 \ line3 \
addlinespace
multirowthead3Test 3 & line1 & line1 \
& line2 & line2 \
& line3 & line 3\
addlinespace
multirowthead3Test 4 & line1 & line1 \
& line2 & line2 \
& line3 & line 3\
bottomrule
endtabular
labeltable:mytable
captionThis is the caption.labeltable:mytable
endtable
enddocument
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
);
);
NATS is a new contributor. Be nice, and check out our Code of Conduct.
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%2f505159%2ftable-caption-in-the-middle-of-the-table%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
multirow<nrows><width><text>
spreads text (vertically) across <nrows>
rows of width <width>
. If <width>
is given as *
, it uses the natural width of <text>
. So, for example, using multirow12*<...>
means you want to spread that specific cell over 12 rows. It's obviously incorrect since each TestX
you want to spread over only 3 rows.
Here's a slightly different implementation (since you don't need multirow
here) using makecell
:
documentclassreport
usepackagemakecell
begindocument
This is some text and here is a reference to Table~reftable:mytable.
begintable [h]
centering
begintabular c c c
textbfColumn A & textbfColumn B & textbfColumn C \
hline
textbfTest1
& makecellline1 \ line2 \ line3
& makecellline1 \ line2 \ line3 \
textbfTest2
& multicolumn2cmakecellline1 \ line2 \ line3 \
textbfTest3
& makecellline1 \ line2 \ line3
& makecellline1 \ line2 \ line3 \
textbfTest4
& makecellline1 \ line2 \ line3
& makecellline1 \ line2 \ line3
endtabular
captionThis is the caption.
labeltable:mytable
endtable
enddocument
Note how the label
comes after caption
in order to achieve the correct ref
erence. See Why does an environment's label have to appear after the caption?.
If you always have 3 rows/elements in Column B & Column C, you don't needmakecell
either. Just place the Column A entry on the second row of each "block."
– Werner
8 hours ago
add a comment |
multirow<nrows><width><text>
spreads text (vertically) across <nrows>
rows of width <width>
. If <width>
is given as *
, it uses the natural width of <text>
. So, for example, using multirow12*<...>
means you want to spread that specific cell over 12 rows. It's obviously incorrect since each TestX
you want to spread over only 3 rows.
Here's a slightly different implementation (since you don't need multirow
here) using makecell
:
documentclassreport
usepackagemakecell
begindocument
This is some text and here is a reference to Table~reftable:mytable.
begintable [h]
centering
begintabular c c c
textbfColumn A & textbfColumn B & textbfColumn C \
hline
textbfTest1
& makecellline1 \ line2 \ line3
& makecellline1 \ line2 \ line3 \
textbfTest2
& multicolumn2cmakecellline1 \ line2 \ line3 \
textbfTest3
& makecellline1 \ line2 \ line3
& makecellline1 \ line2 \ line3 \
textbfTest4
& makecellline1 \ line2 \ line3
& makecellline1 \ line2 \ line3
endtabular
captionThis is the caption.
labeltable:mytable
endtable
enddocument
Note how the label
comes after caption
in order to achieve the correct ref
erence. See Why does an environment's label have to appear after the caption?.
If you always have 3 rows/elements in Column B & Column C, you don't needmakecell
either. Just place the Column A entry on the second row of each "block."
– Werner
8 hours ago
add a comment |
multirow<nrows><width><text>
spreads text (vertically) across <nrows>
rows of width <width>
. If <width>
is given as *
, it uses the natural width of <text>
. So, for example, using multirow12*<...>
means you want to spread that specific cell over 12 rows. It's obviously incorrect since each TestX
you want to spread over only 3 rows.
Here's a slightly different implementation (since you don't need multirow
here) using makecell
:
documentclassreport
usepackagemakecell
begindocument
This is some text and here is a reference to Table~reftable:mytable.
begintable [h]
centering
begintabular c c c
textbfColumn A & textbfColumn B & textbfColumn C \
hline
textbfTest1
& makecellline1 \ line2 \ line3
& makecellline1 \ line2 \ line3 \
textbfTest2
& multicolumn2cmakecellline1 \ line2 \ line3 \
textbfTest3
& makecellline1 \ line2 \ line3
& makecellline1 \ line2 \ line3 \
textbfTest4
& makecellline1 \ line2 \ line3
& makecellline1 \ line2 \ line3
endtabular
captionThis is the caption.
labeltable:mytable
endtable
enddocument
Note how the label
comes after caption
in order to achieve the correct ref
erence. See Why does an environment's label have to appear after the caption?.
multirow<nrows><width><text>
spreads text (vertically) across <nrows>
rows of width <width>
. If <width>
is given as *
, it uses the natural width of <text>
. So, for example, using multirow12*<...>
means you want to spread that specific cell over 12 rows. It's obviously incorrect since each TestX
you want to spread over only 3 rows.
Here's a slightly different implementation (since you don't need multirow
here) using makecell
:
documentclassreport
usepackagemakecell
begindocument
This is some text and here is a reference to Table~reftable:mytable.
begintable [h]
centering
begintabular c c c
textbfColumn A & textbfColumn B & textbfColumn C \
hline
textbfTest1
& makecellline1 \ line2 \ line3
& makecellline1 \ line2 \ line3 \
textbfTest2
& multicolumn2cmakecellline1 \ line2 \ line3 \
textbfTest3
& makecellline1 \ line2 \ line3
& makecellline1 \ line2 \ line3 \
textbfTest4
& makecellline1 \ line2 \ line3
& makecellline1 \ line2 \ line3
endtabular
captionThis is the caption.
labeltable:mytable
endtable
enddocument
Note how the label
comes after caption
in order to achieve the correct ref
erence. See Why does an environment's label have to appear after the caption?.
answered 8 hours ago
WernerWerner
460k77 gold badges1029 silver badges1772 bronze badges
460k77 gold badges1029 silver badges1772 bronze badges
If you always have 3 rows/elements in Column B & Column C, you don't needmakecell
either. Just place the Column A entry on the second row of each "block."
– Werner
8 hours ago
add a comment |
If you always have 3 rows/elements in Column B & Column C, you don't needmakecell
either. Just place the Column A entry on the second row of each "block."
– Werner
8 hours ago
If you always have 3 rows/elements in Column B & Column C, you don't need
makecell
either. Just place the Column A entry on the second row of each "block."– Werner
8 hours ago
If you always have 3 rows/elements in Column B & Column C, you don't need
makecell
either. Just place the Column A entry on the second row of each "block."– Werner
8 hours ago
add a comment |
As I write in the comment to the question, you have misunderstood how multirow calculate spanning of rows, but it is easily fixed. Just add 3 all places (i.e instead of 6, 9 and 12).
To fix the misplaced caption, and if you want to use your original code, you have to add extra space after the multirow
row to create enough space for the spanned rows. Since you span three rows, you may either add two rows (&&\
) or extra height at the end-of-row
command (\[<height>]
. I added two normalbaselineskip
s so you have space equal three rows.
The safest place for the label is inside the caption command. Then it will not fail.
documentclassreport
usepackagemultirow
begindocument
This is some text and here is a reference to Table reftable:mytable. As you see, the table is a float, and since you have available space, it is place at top of the page. Do not mess around with placing floats before you have finished all creative writing. Everting you do, will be invalid when you add more text.
begintable
centering
begintabular c c c \
textbfColumn A & textbfColumn B & textbfColumn C \
hline
multirow3*textbfTest1
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip] % Add more space
multirow3*textbfTest2
& multicolumn2c multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip] multirow3*textbfTest3
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip]
multirow3*textbfTest4
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip]
endtabular
captionThis is the caption.labeltable:mytable
endtable
enddocument
add a comment |
As I write in the comment to the question, you have misunderstood how multirow calculate spanning of rows, but it is easily fixed. Just add 3 all places (i.e instead of 6, 9 and 12).
To fix the misplaced caption, and if you want to use your original code, you have to add extra space after the multirow
row to create enough space for the spanned rows. Since you span three rows, you may either add two rows (&&\
) or extra height at the end-of-row
command (\[<height>]
. I added two normalbaselineskip
s so you have space equal three rows.
The safest place for the label is inside the caption command. Then it will not fail.
documentclassreport
usepackagemultirow
begindocument
This is some text and here is a reference to Table reftable:mytable. As you see, the table is a float, and since you have available space, it is place at top of the page. Do not mess around with placing floats before you have finished all creative writing. Everting you do, will be invalid when you add more text.
begintable
centering
begintabular c c c \
textbfColumn A & textbfColumn B & textbfColumn C \
hline
multirow3*textbfTest1
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip] % Add more space
multirow3*textbfTest2
& multicolumn2c multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip] multirow3*textbfTest3
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip]
multirow3*textbfTest4
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip]
endtabular
captionThis is the caption.labeltable:mytable
endtable
enddocument
add a comment |
As I write in the comment to the question, you have misunderstood how multirow calculate spanning of rows, but it is easily fixed. Just add 3 all places (i.e instead of 6, 9 and 12).
To fix the misplaced caption, and if you want to use your original code, you have to add extra space after the multirow
row to create enough space for the spanned rows. Since you span three rows, you may either add two rows (&&\
) or extra height at the end-of-row
command (\[<height>]
. I added two normalbaselineskip
s so you have space equal three rows.
The safest place for the label is inside the caption command. Then it will not fail.
documentclassreport
usepackagemultirow
begindocument
This is some text and here is a reference to Table reftable:mytable. As you see, the table is a float, and since you have available space, it is place at top of the page. Do not mess around with placing floats before you have finished all creative writing. Everting you do, will be invalid when you add more text.
begintable
centering
begintabular c c c \
textbfColumn A & textbfColumn B & textbfColumn C \
hline
multirow3*textbfTest1
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip] % Add more space
multirow3*textbfTest2
& multicolumn2c multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip] multirow3*textbfTest3
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip]
multirow3*textbfTest4
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip]
endtabular
captionThis is the caption.labeltable:mytable
endtable
enddocument
As I write in the comment to the question, you have misunderstood how multirow calculate spanning of rows, but it is easily fixed. Just add 3 all places (i.e instead of 6, 9 and 12).
To fix the misplaced caption, and if you want to use your original code, you have to add extra space after the multirow
row to create enough space for the spanned rows. Since you span three rows, you may either add two rows (&&\
) or extra height at the end-of-row
command (\[<height>]
. I added two normalbaselineskip
s so you have space equal three rows.
The safest place for the label is inside the caption command. Then it will not fail.
documentclassreport
usepackagemultirow
begindocument
This is some text and here is a reference to Table reftable:mytable. As you see, the table is a float, and since you have available space, it is place at top of the page. Do not mess around with placing floats before you have finished all creative writing. Everting you do, will be invalid when you add more text.
begintable
centering
begintabular c c c \
textbfColumn A & textbfColumn B & textbfColumn C \
hline
multirow3*textbfTest1
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip] % Add more space
multirow3*textbfTest2
& multicolumn2c multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip] multirow3*textbfTest3
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip]
multirow3*textbfTest4
& multirow3*shortstack[l]line1 \ line2 \ line3
& multirow3*shortstack[l]line1 \ line2 \ line3 \[2normalbaselineskip]
endtabular
captionThis is the caption.labeltable:mytable
endtable
enddocument
edited 7 hours ago
answered 7 hours ago
SveinungSveinung
13.6k2 gold badges36 silver badges63 bronze badges
13.6k2 gold badges36 silver badges63 bronze badges
add a comment |
add a comment |
A variant code, also based on makecell
, combined with multirow
– and booktabs
, to add some padding around rules. I added some vertical spacing to separate the groups of three lines. Also, a reference to requires a label
command (after the caption) to work.
documentclassreport
usepackagemultirow
usepackagemakecell, booktabs
renewcommandtheadfontnormalsizebfseries
begindocument
This is some text and here is a reference to Table reftable:mytable.
begintable [h]
centering
begintabular c c c \
textbfColumn A & textbfColumn B & textbfColumn C \
midrule
multirowthead3Test1 & line1 & line1 \
& line2 & line2 \
& line3 & line 3\
addlinespace
textbfTest2 & multicolumn2cmakecellline1 \ line2 \ line3 \
addlinespace
multirowthead3Test 3 & line1 & line1 \
& line2 & line2 \
& line3 & line 3\
addlinespace
multirowthead3Test 4 & line1 & line1 \
& line2 & line2 \
& line3 & line 3\
bottomrule
endtabular
labeltable:mytable
captionThis is the caption.labeltable:mytable
endtable
enddocument
add a comment |
A variant code, also based on makecell
, combined with multirow
– and booktabs
, to add some padding around rules. I added some vertical spacing to separate the groups of three lines. Also, a reference to requires a label
command (after the caption) to work.
documentclassreport
usepackagemultirow
usepackagemakecell, booktabs
renewcommandtheadfontnormalsizebfseries
begindocument
This is some text and here is a reference to Table reftable:mytable.
begintable [h]
centering
begintabular c c c \
textbfColumn A & textbfColumn B & textbfColumn C \
midrule
multirowthead3Test1 & line1 & line1 \
& line2 & line2 \
& line3 & line 3\
addlinespace
textbfTest2 & multicolumn2cmakecellline1 \ line2 \ line3 \
addlinespace
multirowthead3Test 3 & line1 & line1 \
& line2 & line2 \
& line3 & line 3\
addlinespace
multirowthead3Test 4 & line1 & line1 \
& line2 & line2 \
& line3 & line 3\
bottomrule
endtabular
labeltable:mytable
captionThis is the caption.labeltable:mytable
endtable
enddocument
add a comment |
A variant code, also based on makecell
, combined with multirow
– and booktabs
, to add some padding around rules. I added some vertical spacing to separate the groups of three lines. Also, a reference to requires a label
command (after the caption) to work.
documentclassreport
usepackagemultirow
usepackagemakecell, booktabs
renewcommandtheadfontnormalsizebfseries
begindocument
This is some text and here is a reference to Table reftable:mytable.
begintable [h]
centering
begintabular c c c \
textbfColumn A & textbfColumn B & textbfColumn C \
midrule
multirowthead3Test1 & line1 & line1 \
& line2 & line2 \
& line3 & line 3\
addlinespace
textbfTest2 & multicolumn2cmakecellline1 \ line2 \ line3 \
addlinespace
multirowthead3Test 3 & line1 & line1 \
& line2 & line2 \
& line3 & line 3\
addlinespace
multirowthead3Test 4 & line1 & line1 \
& line2 & line2 \
& line3 & line 3\
bottomrule
endtabular
labeltable:mytable
captionThis is the caption.labeltable:mytable
endtable
enddocument
A variant code, also based on makecell
, combined with multirow
– and booktabs
, to add some padding around rules. I added some vertical spacing to separate the groups of three lines. Also, a reference to requires a label
command (after the caption) to work.
documentclassreport
usepackagemultirow
usepackagemakecell, booktabs
renewcommandtheadfontnormalsizebfseries
begindocument
This is some text and here is a reference to Table reftable:mytable.
begintable [h]
centering
begintabular c c c \
textbfColumn A & textbfColumn B & textbfColumn C \
midrule
multirowthead3Test1 & line1 & line1 \
& line2 & line2 \
& line3 & line 3\
addlinespace
textbfTest2 & multicolumn2cmakecellline1 \ line2 \ line3 \
addlinespace
multirowthead3Test 3 & line1 & line1 \
& line2 & line2 \
& line3 & line 3\
addlinespace
multirowthead3Test 4 & line1 & line1 \
& line2 & line2 \
& line3 & line 3\
bottomrule
endtabular
labeltable:mytable
captionThis is the caption.labeltable:mytable
endtable
enddocument
answered 7 hours ago
BernardBernard
189k7 gold badges85 silver badges224 bronze badges
189k7 gold badges85 silver badges224 bronze badges
add a comment |
add a comment |
NATS is a new contributor. Be nice, and check out our Code of Conduct.
NATS is a new contributor. Be nice, and check out our Code of Conduct.
NATS is a new contributor. Be nice, and check out our Code of Conduct.
NATS is a new contributor. Be nice, and check out our Code of Conduct.
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%2f505159%2ftable-caption-in-the-middle-of-the-table%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
Do you know how
multirow
works? For example, what does the first argument inmultirow12
mean. Once you figure that out, I'm sure you'll understand what's going on.– Werner
8 hours ago
From what I understand, it's the number of rows I want the multirow block to be. In this case, it's 3 rows. So the first multirow is rows 1-3, the second one is 3-6 and so on.
– NATS
8 hours ago
Will there always bw three lines in colum B and C?
– leandriis
8 hours ago
@NATS You have programmed last multirow to span 12 column, not 3. If you add all the spanning, you get 3+6+9+12=30 rows, and you have 12 rows in your table. I suggest you reread the multirow manual.
– Sveinung
7 hours ago