How do I avoid and entry being shifted when using multirow and rowcolor at the same time?rowcolor for a multirowHow to get multiple multirows in a table?Misalignment of table columns when using multirowHow to avoid text overlap when using `multirow` in `longtable`?Misplaced omit when using multicolumn within multirowTable rowcolor columncolor multirow and multicolumn AlignmentTable: white spacing with rowcolor, multicolumn and multirowUsing the Latex multirow featureMisplaced noalign when using rowcolortext is overwritten when using multirowUsing multirow and makecell
Paper status "Accept with Shepherd". What does it really mean?
How to give a rationality-inducing drug to an entire software company?
What is this game with a red cricket pushing a ball?
Trying to add electrical outlets off of a junction box but the junction box has a lot more wires than Ive been shown so which ones to run it off?
I got this nail stuck in my tire, should I plug or replace?
What does the British parliament hope to achieve by requesting a third Brexit extension?
Legality of creating a SE replica using SE's content
Will the size of Bitcoin core full-node be too big to run on a normal computer?
Incorrect mmap behavior when assembly files in included in the project
Skewer removal without quick release
What is the German word for: "It only works when I try to show you how it does not work"?
Can you set fire to beer barrels?
I'm trying to graph a rational function
Why are KDFs slow? Is using a KDF more secure than using the original secret?
How to respond to "Why didn't you do a postdoc after your PhD?"
Is there any restriction in entering the South American countries multiple times in one year?
What is the design rationale for having armor and magic penetration mechanics?
'provocative' vs 'sexy'
Is it plausible that an interrupted Windows update can cause the motherboard to fail?
Why is beatboxing called 「ヒューマンビートボックス」?
If the music alphabet had more than 7 letters would octaves still sound like the same note?
Displaying characteristics of the Hero in a console game
What is this white sheet behind the insulation?
Some interesting and elementary topics with connections to the representation theory?
How do I avoid and entry being shifted when using multirow and rowcolor at the same time?
rowcolor for a multirowHow to get multiple multirows in a table?Misalignment of table columns when using multirowHow to avoid text overlap when using `multirow` in `longtable`?Misplaced omit when using multicolumn within multirowTable rowcolor columncolor multirow and multicolumn AlignmentTable: white spacing with rowcolor, multicolumn and multirowUsing the Latex multirow featureMisplaced noalign when using rowcolortext is overwritten when using multirowUsing multirow and makecell
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
I have been looking around for and answer a while now and figured out how to make the entry in the multirow
visible. But now the entry is being shifted for some reason. Can you please help me? Down here I have a minimal working example.
documentclass[12pt]article
usepackage[utf8]inputenc
usepackage[swedish]babel
usepackagemultirow
usepackagecolor, colortbl
definecolorLightCyanrgb0.88,1,1
begindocument
begintable[h!]
centering
begintabularl
hline
Känsla & Elevgrupp & ''Gillade det ofta'' ($%$) & ''Övriga svar'' ($%$) &
$U$-värde ($p<0.05$) \
hline
rowcolorLightCyan
Gillade Det & $1$ & $75$ & $25$ & \
rowcolorLightCyan
& $2$ & $37$ & $62$ & multirow2*$12.5$ \
hline
Fann det Vackert & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
Var Imponerad & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
Fascinerade Mig & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
endtabular
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
And this is what it looks like:
multirow rowcolor
|
show 1 more comment
I have been looking around for and answer a while now and figured out how to make the entry in the multirow
visible. But now the entry is being shifted for some reason. Can you please help me? Down here I have a minimal working example.
documentclass[12pt]article
usepackage[utf8]inputenc
usepackage[swedish]babel
usepackagemultirow
usepackagecolor, colortbl
definecolorLightCyanrgb0.88,1,1
begindocument
begintable[h!]
centering
begintabularl
hline
Känsla & Elevgrupp & ''Gillade det ofta'' ($%$) & ''Övriga svar'' ($%$) &
$U$-värde ($p<0.05$) \
hline
rowcolorLightCyan
Gillade Det & $1$ & $75$ & $25$ & \
rowcolorLightCyan
& $2$ & $37$ & $62$ & multirow2*$12.5$ \
hline
Fann det Vackert & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
Var Imponerad & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
Fascinerade Mig & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
endtabular
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
And this is what it looks like:
multirow rowcolor
2
Try with-2
instead of2
as inmultirow-2*$12.5$
.
– leandriis
9 hours ago
Unrelated to the issue, but you might want to keep in mind that your table is a lot wider than the current textwidth. You might have to adjust the margins or introduce linebreaks to make the table fit into the textwidth.
– leandriis
9 hours ago
@DG': Moving the command into the previous row works if there is norowcolor
involved. Withrowcolor
however, the lover half of the text will disappear: i.stack.imgur.com/aCxJW.png
– leandriis
9 hours ago
@leandriis I just saw that in Heiko's answer here: tex.stackexchange.com/a/269549/29873
– DG'
9 hours ago
@leandriis You should make your comment an answer
– DG'
9 hours ago
|
show 1 more comment
I have been looking around for and answer a while now and figured out how to make the entry in the multirow
visible. But now the entry is being shifted for some reason. Can you please help me? Down here I have a minimal working example.
documentclass[12pt]article
usepackage[utf8]inputenc
usepackage[swedish]babel
usepackagemultirow
usepackagecolor, colortbl
definecolorLightCyanrgb0.88,1,1
begindocument
begintable[h!]
centering
begintabularl
hline
Känsla & Elevgrupp & ''Gillade det ofta'' ($%$) & ''Övriga svar'' ($%$) &
$U$-värde ($p<0.05$) \
hline
rowcolorLightCyan
Gillade Det & $1$ & $75$ & $25$ & \
rowcolorLightCyan
& $2$ & $37$ & $62$ & multirow2*$12.5$ \
hline
Fann det Vackert & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
Var Imponerad & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
Fascinerade Mig & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
endtabular
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
And this is what it looks like:
multirow rowcolor
I have been looking around for and answer a while now and figured out how to make the entry in the multirow
visible. But now the entry is being shifted for some reason. Can you please help me? Down here I have a minimal working example.
documentclass[12pt]article
usepackage[utf8]inputenc
usepackage[swedish]babel
usepackagemultirow
usepackagecolor, colortbl
definecolorLightCyanrgb0.88,1,1
begindocument
begintable[h!]
centering
begintabularl
hline
Känsla & Elevgrupp & ''Gillade det ofta'' ($%$) & ''Övriga svar'' ($%$) &
$U$-värde ($p<0.05$) \
hline
rowcolorLightCyan
Gillade Det & $1$ & $75$ & $25$ & \
rowcolorLightCyan
& $2$ & $37$ & $62$ & multirow2*$12.5$ \
hline
Fann det Vackert & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
Var Imponerad & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
Fascinerade Mig & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
endtabular
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
And this is what it looks like:
multirow rowcolor
multirow rowcolor
asked 10 hours ago
Victor GaleanoVictor Galeano
363 bronze badges
363 bronze badges
2
Try with-2
instead of2
as inmultirow-2*$12.5$
.
– leandriis
9 hours ago
Unrelated to the issue, but you might want to keep in mind that your table is a lot wider than the current textwidth. You might have to adjust the margins or introduce linebreaks to make the table fit into the textwidth.
– leandriis
9 hours ago
@DG': Moving the command into the previous row works if there is norowcolor
involved. Withrowcolor
however, the lover half of the text will disappear: i.stack.imgur.com/aCxJW.png
– leandriis
9 hours ago
@leandriis I just saw that in Heiko's answer here: tex.stackexchange.com/a/269549/29873
– DG'
9 hours ago
@leandriis You should make your comment an answer
– DG'
9 hours ago
|
show 1 more comment
2
Try with-2
instead of2
as inmultirow-2*$12.5$
.
– leandriis
9 hours ago
Unrelated to the issue, but you might want to keep in mind that your table is a lot wider than the current textwidth. You might have to adjust the margins or introduce linebreaks to make the table fit into the textwidth.
– leandriis
9 hours ago
@DG': Moving the command into the previous row works if there is norowcolor
involved. Withrowcolor
however, the lover half of the text will disappear: i.stack.imgur.com/aCxJW.png
– leandriis
9 hours ago
@leandriis I just saw that in Heiko's answer here: tex.stackexchange.com/a/269549/29873
– DG'
9 hours ago
@leandriis You should make your comment an answer
– DG'
9 hours ago
2
2
Try with
-2
instead of 2
as in multirow-2*$12.5$
.– leandriis
9 hours ago
Try with
-2
instead of 2
as in multirow-2*$12.5$
.– leandriis
9 hours ago
Unrelated to the issue, but you might want to keep in mind that your table is a lot wider than the current textwidth. You might have to adjust the margins or introduce linebreaks to make the table fit into the textwidth.
– leandriis
9 hours ago
Unrelated to the issue, but you might want to keep in mind that your table is a lot wider than the current textwidth. You might have to adjust the margins or introduce linebreaks to make the table fit into the textwidth.
– leandriis
9 hours ago
@DG': Moving the command into the previous row works if there is no
rowcolor
involved. With rowcolor
however, the lover half of the text will disappear: i.stack.imgur.com/aCxJW.png– leandriis
9 hours ago
@DG': Moving the command into the previous row works if there is no
rowcolor
involved. With rowcolor
however, the lover half of the text will disappear: i.stack.imgur.com/aCxJW.png– leandriis
9 hours ago
@leandriis I just saw that in Heiko's answer here: tex.stackexchange.com/a/269549/29873
– DG'
9 hours ago
@leandriis I just saw that in Heiko's answer here: tex.stackexchange.com/a/269549/29873
– DG'
9 hours ago
@leandriis You should make your comment an answer
– DG'
9 hours ago
@leandriis You should make your comment an answer
– DG'
9 hours ago
|
show 1 more comment
2 Answers
2
active
oldest
votes
If you replace 2
with -2
as in multirow-2*$12.5$
you will get the desired result.
With multirow2
you merge the cell in the current row with the cell in the following row. This is why your text overlaps with the horizontal line. Shifting the command ine row upwards is no solution since you are using rowcolor
. So, instead you can use multirow-2
to merge the cell in the current wor with the cell in the previous row.
I'd also suggest to replace usepackagecolor,colortbl
with usepackage[table]xcolor
. Also, there is no need to use math mode for all the numbers. I have also removed that in the following MWE:
documentclass[12pt]article
usepackage[utf8]inputenc
usepackage[swedish]babel
usepackagemultirow
usepackage[table]xcolor
definecolorLightCyanrgb0.88,1,1
begindocument
begintable[h!]
centering
begintabularl
hline
Känsla & Elevgrupp & ''Gillade det ofta'' ($%$) & ''Övriga svar'' ($%$) &
$U$-värde ($p<0.05$) \
hline
rowcolorLightCyan
Gillade Det & 1 & 75 & 25 &multirow2*12.5 \
rowcolorLightCyan
& 2 & 37 & 62 & \
hline
Fann det Vackert & 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ &\
hline
Var Imponerad & 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ &\
hline
Fascinerade Mig & 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ &\
hline
endtabular
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
Here is a second version of the MWE that uses tabularx
and makecell
to make the table fit into the textwidth:
documentclass[12pt]article
usepackage[utf8]inputenc
usepackage[swedish]babel
usepackagemultirow
usepackage[table]xcolor
usepackagemakecell
usepackagetabularx
definecolorLightCyanrgb0.88,1,1
begindocument
begintable[h!]
centering
begintabularxtextwidthl
hline
Känsla & Elevgrupp & makecell''Gillade det ofta''\ ($%$) & makecell''Övriga svar''\ ($%$) &
makecell$U$-värde\ ($p<0.05$) \
hline
rowcolorLightCyan
& $1$ & $75$ & $25$ & \
rowcolorLightCyan
multirow-2=Gillade Det & $2$ & $37$ & $62$ & multirow-2*$12.5$ \
hline
multirow2=Fann det Vackert & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
multirow2=Var Imponerad & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
multirow2=Fascinerade Mig & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
endtabularx
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
add a comment
|
I would redesign your table as follows:
Used are:
- removed vertical rules
- for horizontal rules are used rules from
booktabs
table; its numbers are significantly reduced - columns with numbers are of
S
type (defined insiunitx
package)
Edit:
- for aligning numbers in the last row is considered
tablenum
macro defined in thesiunitx
package
documentclass[12pt]article
usepackage[swedish]babel
usepackage[table]xcolor
usepackagebooktabs, makecell, multirow, tabularx
renewcommandtheadfontnormalsize
definecolorLightCyanrgb0.88,1,1
usepackagesiunitx
begindocument
begintable[ht!]
centering
sisetuptable-format=2.2
begintabularxtextwidth X cSSc % <---
toprule
theadKänsla
& theadElevgrupp
& thead''Gillade det ofta''\ ($%$)
& thead''Övriga svar''\ ($%$)
& thead$U$-värde\ ($p<0.05$) \
specialrulelightrulewidthaboverulesep0pt
rowcolorLightCyan
& 1 & 75 & 25 & \
rowcolorLightCyan
multirow-2=Gillade Det
& 2 & 37 & 62 & multirow-2*mrtf3.212.5 \ % <---
specialrulelightrulewidth0ptbelowrulesep
multirow2=Fann det Vackert
& 1 & $cdots$ & $cdots$ & multirow2*mrtf3.2123.45 \ % <---
& 2 & $cdots$ & $cdots$ & \
addlinespace
multirow2=Var Imponerad
& 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \ % insert mrft macro
% when cdot is replaced by number
& 2 & $cdots$ & $cdots$ & \ addlinespace
multirow2=Fascinerade Mig
& 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ & \
bottomrule
endtabularx
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
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/4.0/"u003ecc by-sa 4.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%2f511211%2fhow-do-i-avoid-and-entry-being-shifted-when-using-multirow-and-rowcolor-at-the%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
If you replace 2
with -2
as in multirow-2*$12.5$
you will get the desired result.
With multirow2
you merge the cell in the current row with the cell in the following row. This is why your text overlaps with the horizontal line. Shifting the command ine row upwards is no solution since you are using rowcolor
. So, instead you can use multirow-2
to merge the cell in the current wor with the cell in the previous row.
I'd also suggest to replace usepackagecolor,colortbl
with usepackage[table]xcolor
. Also, there is no need to use math mode for all the numbers. I have also removed that in the following MWE:
documentclass[12pt]article
usepackage[utf8]inputenc
usepackage[swedish]babel
usepackagemultirow
usepackage[table]xcolor
definecolorLightCyanrgb0.88,1,1
begindocument
begintable[h!]
centering
begintabularl
hline
Känsla & Elevgrupp & ''Gillade det ofta'' ($%$) & ''Övriga svar'' ($%$) &
$U$-värde ($p<0.05$) \
hline
rowcolorLightCyan
Gillade Det & 1 & 75 & 25 &multirow2*12.5 \
rowcolorLightCyan
& 2 & 37 & 62 & \
hline
Fann det Vackert & 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ &\
hline
Var Imponerad & 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ &\
hline
Fascinerade Mig & 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ &\
hline
endtabular
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
Here is a second version of the MWE that uses tabularx
and makecell
to make the table fit into the textwidth:
documentclass[12pt]article
usepackage[utf8]inputenc
usepackage[swedish]babel
usepackagemultirow
usepackage[table]xcolor
usepackagemakecell
usepackagetabularx
definecolorLightCyanrgb0.88,1,1
begindocument
begintable[h!]
centering
begintabularxtextwidthl
hline
Känsla & Elevgrupp & makecell''Gillade det ofta''\ ($%$) & makecell''Övriga svar''\ ($%$) &
makecell$U$-värde\ ($p<0.05$) \
hline
rowcolorLightCyan
& $1$ & $75$ & $25$ & \
rowcolorLightCyan
multirow-2=Gillade Det & $2$ & $37$ & $62$ & multirow-2*$12.5$ \
hline
multirow2=Fann det Vackert & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
multirow2=Var Imponerad & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
multirow2=Fascinerade Mig & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
endtabularx
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
add a comment
|
If you replace 2
with -2
as in multirow-2*$12.5$
you will get the desired result.
With multirow2
you merge the cell in the current row with the cell in the following row. This is why your text overlaps with the horizontal line. Shifting the command ine row upwards is no solution since you are using rowcolor
. So, instead you can use multirow-2
to merge the cell in the current wor with the cell in the previous row.
I'd also suggest to replace usepackagecolor,colortbl
with usepackage[table]xcolor
. Also, there is no need to use math mode for all the numbers. I have also removed that in the following MWE:
documentclass[12pt]article
usepackage[utf8]inputenc
usepackage[swedish]babel
usepackagemultirow
usepackage[table]xcolor
definecolorLightCyanrgb0.88,1,1
begindocument
begintable[h!]
centering
begintabularl
hline
Känsla & Elevgrupp & ''Gillade det ofta'' ($%$) & ''Övriga svar'' ($%$) &
$U$-värde ($p<0.05$) \
hline
rowcolorLightCyan
Gillade Det & 1 & 75 & 25 &multirow2*12.5 \
rowcolorLightCyan
& 2 & 37 & 62 & \
hline
Fann det Vackert & 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ &\
hline
Var Imponerad & 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ &\
hline
Fascinerade Mig & 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ &\
hline
endtabular
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
Here is a second version of the MWE that uses tabularx
and makecell
to make the table fit into the textwidth:
documentclass[12pt]article
usepackage[utf8]inputenc
usepackage[swedish]babel
usepackagemultirow
usepackage[table]xcolor
usepackagemakecell
usepackagetabularx
definecolorLightCyanrgb0.88,1,1
begindocument
begintable[h!]
centering
begintabularxtextwidthl
hline
Känsla & Elevgrupp & makecell''Gillade det ofta''\ ($%$) & makecell''Övriga svar''\ ($%$) &
makecell$U$-värde\ ($p<0.05$) \
hline
rowcolorLightCyan
& $1$ & $75$ & $25$ & \
rowcolorLightCyan
multirow-2=Gillade Det & $2$ & $37$ & $62$ & multirow-2*$12.5$ \
hline
multirow2=Fann det Vackert & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
multirow2=Var Imponerad & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
multirow2=Fascinerade Mig & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
endtabularx
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
add a comment
|
If you replace 2
with -2
as in multirow-2*$12.5$
you will get the desired result.
With multirow2
you merge the cell in the current row with the cell in the following row. This is why your text overlaps with the horizontal line. Shifting the command ine row upwards is no solution since you are using rowcolor
. So, instead you can use multirow-2
to merge the cell in the current wor with the cell in the previous row.
I'd also suggest to replace usepackagecolor,colortbl
with usepackage[table]xcolor
. Also, there is no need to use math mode for all the numbers. I have also removed that in the following MWE:
documentclass[12pt]article
usepackage[utf8]inputenc
usepackage[swedish]babel
usepackagemultirow
usepackage[table]xcolor
definecolorLightCyanrgb0.88,1,1
begindocument
begintable[h!]
centering
begintabularl
hline
Känsla & Elevgrupp & ''Gillade det ofta'' ($%$) & ''Övriga svar'' ($%$) &
$U$-värde ($p<0.05$) \
hline
rowcolorLightCyan
Gillade Det & 1 & 75 & 25 &multirow2*12.5 \
rowcolorLightCyan
& 2 & 37 & 62 & \
hline
Fann det Vackert & 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ &\
hline
Var Imponerad & 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ &\
hline
Fascinerade Mig & 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ &\
hline
endtabular
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
Here is a second version of the MWE that uses tabularx
and makecell
to make the table fit into the textwidth:
documentclass[12pt]article
usepackage[utf8]inputenc
usepackage[swedish]babel
usepackagemultirow
usepackage[table]xcolor
usepackagemakecell
usepackagetabularx
definecolorLightCyanrgb0.88,1,1
begindocument
begintable[h!]
centering
begintabularxtextwidthl
hline
Känsla & Elevgrupp & makecell''Gillade det ofta''\ ($%$) & makecell''Övriga svar''\ ($%$) &
makecell$U$-värde\ ($p<0.05$) \
hline
rowcolorLightCyan
& $1$ & $75$ & $25$ & \
rowcolorLightCyan
multirow-2=Gillade Det & $2$ & $37$ & $62$ & multirow-2*$12.5$ \
hline
multirow2=Fann det Vackert & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
multirow2=Var Imponerad & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
multirow2=Fascinerade Mig & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
endtabularx
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
If you replace 2
with -2
as in multirow-2*$12.5$
you will get the desired result.
With multirow2
you merge the cell in the current row with the cell in the following row. This is why your text overlaps with the horizontal line. Shifting the command ine row upwards is no solution since you are using rowcolor
. So, instead you can use multirow-2
to merge the cell in the current wor with the cell in the previous row.
I'd also suggest to replace usepackagecolor,colortbl
with usepackage[table]xcolor
. Also, there is no need to use math mode for all the numbers. I have also removed that in the following MWE:
documentclass[12pt]article
usepackage[utf8]inputenc
usepackage[swedish]babel
usepackagemultirow
usepackage[table]xcolor
definecolorLightCyanrgb0.88,1,1
begindocument
begintable[h!]
centering
begintabularl
hline
Känsla & Elevgrupp & ''Gillade det ofta'' ($%$) & ''Övriga svar'' ($%$) &
$U$-värde ($p<0.05$) \
hline
rowcolorLightCyan
Gillade Det & 1 & 75 & 25 &multirow2*12.5 \
rowcolorLightCyan
& 2 & 37 & 62 & \
hline
Fann det Vackert & 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ &\
hline
Var Imponerad & 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ &\
hline
Fascinerade Mig & 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ &\
hline
endtabular
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
Here is a second version of the MWE that uses tabularx
and makecell
to make the table fit into the textwidth:
documentclass[12pt]article
usepackage[utf8]inputenc
usepackage[swedish]babel
usepackagemultirow
usepackage[table]xcolor
usepackagemakecell
usepackagetabularx
definecolorLightCyanrgb0.88,1,1
begindocument
begintable[h!]
centering
begintabularxtextwidthl
hline
Känsla & Elevgrupp & makecell''Gillade det ofta''\ ($%$) & makecell''Övriga svar''\ ($%$) &
makecell$U$-värde\ ($p<0.05$) \
hline
rowcolorLightCyan
& $1$ & $75$ & $25$ & \
rowcolorLightCyan
multirow-2=Gillade Det & $2$ & $37$ & $62$ & multirow-2*$12.5$ \
hline
multirow2=Fann det Vackert & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
multirow2=Var Imponerad & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
multirow2=Fascinerade Mig & $1$ & $cdots$ & $cdots$ & multirow2*$cdots$ \
& $2$ & $cdots$ & $cdots$ &\
hline
endtabularx
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
edited 9 hours ago
answered 9 hours ago
leandriisleandriis
21.5k1 gold badge12 silver badges41 bronze badges
21.5k1 gold badge12 silver badges41 bronze badges
add a comment
|
add a comment
|
I would redesign your table as follows:
Used are:
- removed vertical rules
- for horizontal rules are used rules from
booktabs
table; its numbers are significantly reduced - columns with numbers are of
S
type (defined insiunitx
package)
Edit:
- for aligning numbers in the last row is considered
tablenum
macro defined in thesiunitx
package
documentclass[12pt]article
usepackage[swedish]babel
usepackage[table]xcolor
usepackagebooktabs, makecell, multirow, tabularx
renewcommandtheadfontnormalsize
definecolorLightCyanrgb0.88,1,1
usepackagesiunitx
begindocument
begintable[ht!]
centering
sisetuptable-format=2.2
begintabularxtextwidth X cSSc % <---
toprule
theadKänsla
& theadElevgrupp
& thead''Gillade det ofta''\ ($%$)
& thead''Övriga svar''\ ($%$)
& thead$U$-värde\ ($p<0.05$) \
specialrulelightrulewidthaboverulesep0pt
rowcolorLightCyan
& 1 & 75 & 25 & \
rowcolorLightCyan
multirow-2=Gillade Det
& 2 & 37 & 62 & multirow-2*mrtf3.212.5 \ % <---
specialrulelightrulewidth0ptbelowrulesep
multirow2=Fann det Vackert
& 1 & $cdots$ & $cdots$ & multirow2*mrtf3.2123.45 \ % <---
& 2 & $cdots$ & $cdots$ & \
addlinespace
multirow2=Var Imponerad
& 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \ % insert mrft macro
% when cdot is replaced by number
& 2 & $cdots$ & $cdots$ & \ addlinespace
multirow2=Fascinerade Mig
& 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ & \
bottomrule
endtabularx
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
add a comment
|
I would redesign your table as follows:
Used are:
- removed vertical rules
- for horizontal rules are used rules from
booktabs
table; its numbers are significantly reduced - columns with numbers are of
S
type (defined insiunitx
package)
Edit:
- for aligning numbers in the last row is considered
tablenum
macro defined in thesiunitx
package
documentclass[12pt]article
usepackage[swedish]babel
usepackage[table]xcolor
usepackagebooktabs, makecell, multirow, tabularx
renewcommandtheadfontnormalsize
definecolorLightCyanrgb0.88,1,1
usepackagesiunitx
begindocument
begintable[ht!]
centering
sisetuptable-format=2.2
begintabularxtextwidth X cSSc % <---
toprule
theadKänsla
& theadElevgrupp
& thead''Gillade det ofta''\ ($%$)
& thead''Övriga svar''\ ($%$)
& thead$U$-värde\ ($p<0.05$) \
specialrulelightrulewidthaboverulesep0pt
rowcolorLightCyan
& 1 & 75 & 25 & \
rowcolorLightCyan
multirow-2=Gillade Det
& 2 & 37 & 62 & multirow-2*mrtf3.212.5 \ % <---
specialrulelightrulewidth0ptbelowrulesep
multirow2=Fann det Vackert
& 1 & $cdots$ & $cdots$ & multirow2*mrtf3.2123.45 \ % <---
& 2 & $cdots$ & $cdots$ & \
addlinespace
multirow2=Var Imponerad
& 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \ % insert mrft macro
% when cdot is replaced by number
& 2 & $cdots$ & $cdots$ & \ addlinespace
multirow2=Fascinerade Mig
& 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ & \
bottomrule
endtabularx
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
add a comment
|
I would redesign your table as follows:
Used are:
- removed vertical rules
- for horizontal rules are used rules from
booktabs
table; its numbers are significantly reduced - columns with numbers are of
S
type (defined insiunitx
package)
Edit:
- for aligning numbers in the last row is considered
tablenum
macro defined in thesiunitx
package
documentclass[12pt]article
usepackage[swedish]babel
usepackage[table]xcolor
usepackagebooktabs, makecell, multirow, tabularx
renewcommandtheadfontnormalsize
definecolorLightCyanrgb0.88,1,1
usepackagesiunitx
begindocument
begintable[ht!]
centering
sisetuptable-format=2.2
begintabularxtextwidth X cSSc % <---
toprule
theadKänsla
& theadElevgrupp
& thead''Gillade det ofta''\ ($%$)
& thead''Övriga svar''\ ($%$)
& thead$U$-värde\ ($p<0.05$) \
specialrulelightrulewidthaboverulesep0pt
rowcolorLightCyan
& 1 & 75 & 25 & \
rowcolorLightCyan
multirow-2=Gillade Det
& 2 & 37 & 62 & multirow-2*mrtf3.212.5 \ % <---
specialrulelightrulewidth0ptbelowrulesep
multirow2=Fann det Vackert
& 1 & $cdots$ & $cdots$ & multirow2*mrtf3.2123.45 \ % <---
& 2 & $cdots$ & $cdots$ & \
addlinespace
multirow2=Var Imponerad
& 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \ % insert mrft macro
% when cdot is replaced by number
& 2 & $cdots$ & $cdots$ & \ addlinespace
multirow2=Fascinerade Mig
& 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ & \
bottomrule
endtabularx
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
I would redesign your table as follows:
Used are:
- removed vertical rules
- for horizontal rules are used rules from
booktabs
table; its numbers are significantly reduced - columns with numbers are of
S
type (defined insiunitx
package)
Edit:
- for aligning numbers in the last row is considered
tablenum
macro defined in thesiunitx
package
documentclass[12pt]article
usepackage[swedish]babel
usepackage[table]xcolor
usepackagebooktabs, makecell, multirow, tabularx
renewcommandtheadfontnormalsize
definecolorLightCyanrgb0.88,1,1
usepackagesiunitx
begindocument
begintable[ht!]
centering
sisetuptable-format=2.2
begintabularxtextwidth X cSSc % <---
toprule
theadKänsla
& theadElevgrupp
& thead''Gillade det ofta''\ ($%$)
& thead''Övriga svar''\ ($%$)
& thead$U$-värde\ ($p<0.05$) \
specialrulelightrulewidthaboverulesep0pt
rowcolorLightCyan
& 1 & 75 & 25 & \
rowcolorLightCyan
multirow-2=Gillade Det
& 2 & 37 & 62 & multirow-2*mrtf3.212.5 \ % <---
specialrulelightrulewidth0ptbelowrulesep
multirow2=Fann det Vackert
& 1 & $cdots$ & $cdots$ & multirow2*mrtf3.2123.45 \ % <---
& 2 & $cdots$ & $cdots$ & \
addlinespace
multirow2=Var Imponerad
& 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \ % insert mrft macro
% when cdot is replaced by number
& 2 & $cdots$ & $cdots$ & \ addlinespace
multirow2=Fascinerade Mig
& 1 & $cdots$ & $cdots$ & multirow2*$cdots$ \
& 2 & $cdots$ & $cdots$ & \
bottomrule
endtabularx
captionExempel på beskrivande statistik med ett signifikanstest på elevers
svar om hur ofta de kände att gillade problemet.
labeltabkors3
endtable
enddocument
edited 6 hours ago
answered 8 hours ago
ZarkoZarko
149k8 gold badges85 silver badges196 bronze badges
149k8 gold badges85 silver badges196 bronze badges
add a comment
|
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%2f511211%2fhow-do-i-avoid-and-entry-being-shifted-when-using-multirow-and-rowcolor-at-the%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Try with
-2
instead of2
as inmultirow-2*$12.5$
.– leandriis
9 hours ago
Unrelated to the issue, but you might want to keep in mind that your table is a lot wider than the current textwidth. You might have to adjust the margins or introduce linebreaks to make the table fit into the textwidth.
– leandriis
9 hours ago
@DG': Moving the command into the previous row works if there is no
rowcolor
involved. Withrowcolor
however, the lover half of the text will disappear: i.stack.imgur.com/aCxJW.png– leandriis
9 hours ago
@leandriis I just saw that in Heiko's answer here: tex.stackexchange.com/a/269549/29873
– DG'
9 hours ago
@leandriis You should make your comment an answer
– DG'
9 hours ago