Shading apply to label unexpected in matrix environment












4















I am trying to add shadow to node. For normal node, the shade will not impact the label. However, for nodes inside a matrix, the labels are shadowed too.



MWE below



documentclass[border=5mm, convert]{standalone}
usepackage{tikz}
usetikzlibrary{shapes, positioning, matrix, shadows}

begin{document}
begin{tikzpicture}[auto]
tikzset{myrect/.style={draw, rectangle, font=ttfamily, fill=white, drop shadow}}
tikzset{mylabel/.style={color=blue, font=tiny ttfamily}}
node[myrect, label={[mylabel]above:normal label}] (ele) {Single Element};

matrix (layer) [matrix of nodes, nodes={myrect, anchor=center}, column sep = 1cm, below = of ele] {
|[label={[mylabel]:matrix label 1}]|matrix element 1 &
|[label={[mylabel]:matrix label 2}]|matrix element 2 &
|[label={[mylabel]:matrix label 3}]|matrix element 3 \
};
end{tikzpicture}
end{document}


The output is as the following:enter image description here



How this happen and is there way to avoid it?










share|improve this question


















  • 2





    The nodes= key for the matrix is like a shortcut for every node/.style= and since labels are also nodes, they also get the drop shadow. I suspect that some keys, like draw are reset within a label, but others like drop shadow are not.

    – Max
    Jan 11 at 9:54






  • 2





    You could use the no shadows key from solution B from this answer and add it to your mylabel style. That would delete all preactions added to the labels, including the drop shadow.

    – Max
    Jan 11 at 10:06


















4















I am trying to add shadow to node. For normal node, the shade will not impact the label. However, for nodes inside a matrix, the labels are shadowed too.



MWE below



documentclass[border=5mm, convert]{standalone}
usepackage{tikz}
usetikzlibrary{shapes, positioning, matrix, shadows}

begin{document}
begin{tikzpicture}[auto]
tikzset{myrect/.style={draw, rectangle, font=ttfamily, fill=white, drop shadow}}
tikzset{mylabel/.style={color=blue, font=tiny ttfamily}}
node[myrect, label={[mylabel]above:normal label}] (ele) {Single Element};

matrix (layer) [matrix of nodes, nodes={myrect, anchor=center}, column sep = 1cm, below = of ele] {
|[label={[mylabel]:matrix label 1}]|matrix element 1 &
|[label={[mylabel]:matrix label 2}]|matrix element 2 &
|[label={[mylabel]:matrix label 3}]|matrix element 3 \
};
end{tikzpicture}
end{document}


The output is as the following:enter image description here



How this happen and is there way to avoid it?










share|improve this question


















  • 2





    The nodes= key for the matrix is like a shortcut for every node/.style= and since labels are also nodes, they also get the drop shadow. I suspect that some keys, like draw are reset within a label, but others like drop shadow are not.

    – Max
    Jan 11 at 9:54






  • 2





    You could use the no shadows key from solution B from this answer and add it to your mylabel style. That would delete all preactions added to the labels, including the drop shadow.

    – Max
    Jan 11 at 10:06
















4












4








4








I am trying to add shadow to node. For normal node, the shade will not impact the label. However, for nodes inside a matrix, the labels are shadowed too.



MWE below



documentclass[border=5mm, convert]{standalone}
usepackage{tikz}
usetikzlibrary{shapes, positioning, matrix, shadows}

begin{document}
begin{tikzpicture}[auto]
tikzset{myrect/.style={draw, rectangle, font=ttfamily, fill=white, drop shadow}}
tikzset{mylabel/.style={color=blue, font=tiny ttfamily}}
node[myrect, label={[mylabel]above:normal label}] (ele) {Single Element};

matrix (layer) [matrix of nodes, nodes={myrect, anchor=center}, column sep = 1cm, below = of ele] {
|[label={[mylabel]:matrix label 1}]|matrix element 1 &
|[label={[mylabel]:matrix label 2}]|matrix element 2 &
|[label={[mylabel]:matrix label 3}]|matrix element 3 \
};
end{tikzpicture}
end{document}


The output is as the following:enter image description here



How this happen and is there way to avoid it?










share|improve this question














I am trying to add shadow to node. For normal node, the shade will not impact the label. However, for nodes inside a matrix, the labels are shadowed too.



MWE below



documentclass[border=5mm, convert]{standalone}
usepackage{tikz}
usetikzlibrary{shapes, positioning, matrix, shadows}

begin{document}
begin{tikzpicture}[auto]
tikzset{myrect/.style={draw, rectangle, font=ttfamily, fill=white, drop shadow}}
tikzset{mylabel/.style={color=blue, font=tiny ttfamily}}
node[myrect, label={[mylabel]above:normal label}] (ele) {Single Element};

matrix (layer) [matrix of nodes, nodes={myrect, anchor=center}, column sep = 1cm, below = of ele] {
|[label={[mylabel]:matrix label 1}]|matrix element 1 &
|[label={[mylabel]:matrix label 2}]|matrix element 2 &
|[label={[mylabel]:matrix label 3}]|matrix element 3 \
};
end{tikzpicture}
end{document}


The output is as the following:enter image description here



How this happen and is there way to avoid it?







tikz-pgf labels tikz-matrix shadows






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 11 at 9:32









Eric SunEric Sun

1697




1697








  • 2





    The nodes= key for the matrix is like a shortcut for every node/.style= and since labels are also nodes, they also get the drop shadow. I suspect that some keys, like draw are reset within a label, but others like drop shadow are not.

    – Max
    Jan 11 at 9:54






  • 2





    You could use the no shadows key from solution B from this answer and add it to your mylabel style. That would delete all preactions added to the labels, including the drop shadow.

    – Max
    Jan 11 at 10:06
















  • 2





    The nodes= key for the matrix is like a shortcut for every node/.style= and since labels are also nodes, they also get the drop shadow. I suspect that some keys, like draw are reset within a label, but others like drop shadow are not.

    – Max
    Jan 11 at 9:54






  • 2





    You could use the no shadows key from solution B from this answer and add it to your mylabel style. That would delete all preactions added to the labels, including the drop shadow.

    – Max
    Jan 11 at 10:06










2




2





The nodes= key for the matrix is like a shortcut for every node/.style= and since labels are also nodes, they also get the drop shadow. I suspect that some keys, like draw are reset within a label, but others like drop shadow are not.

– Max
Jan 11 at 9:54





The nodes= key for the matrix is like a shortcut for every node/.style= and since labels are also nodes, they also get the drop shadow. I suspect that some keys, like draw are reset within a label, but others like drop shadow are not.

– Max
Jan 11 at 9:54




2




2





You could use the no shadows key from solution B from this answer and add it to your mylabel style. That would delete all preactions added to the labels, including the drop shadow.

– Max
Jan 11 at 10:06







You could use the no shadows key from solution B from this answer and add it to your mylabel style. That would delete all preactions added to the labels, including the drop shadow.

– Max
Jan 11 at 10:06












1 Answer
1






active

oldest

votes


















5














One way is to adjust the your style-set definitions (as done by @marmot):



 documentclass[tikz, margin=3mm]{standalone}
usetikzlibrary{shadows, shapes, positioning, matrix}
makeatletter % from https://tex.stackexchange.com/a/129322/121799
tikzset{no shadows/.code=lettikz@preactionspgfutil@empty}
makeatother
%https://tex.stackexchange.com/questions/422782/labels-of-nodes-with-drop-shadow
begin{document}
begin{tikzpicture}[
every node/.style = {font= ttfamily, draw, fill=white, drop shadow},
every label/.append style = {
font=tiny ttfamily,
color = blue,
}
]
node [label={[no shadows]foobar}] (ele) {node with shadow};
matrix (layer) [no shadows, matrix of nodes, draw = none, column sep = 1cm, below = of ele] {
|[label={[no shadows]:matrix label 1}]|matrix element 1 &
|[label={[no shadows]:matrix label 2}]|matrix element 2 &
|[label={[no shadows]:matrix label 3}]|matrix element 3 \
};
end{tikzpicture}
end{document}


This should give you:



enter image description here






share|improve this answer





















  • 1





    Thank you, both you and @Max point me to solution of disable preactions. I am still wondering if there can be options in matrix to avoid polluting the label

    – Eric Sun
    Jan 11 at 10:26











  • @EricSun Also, as far as not to pollute the matrix environment, I dont know. May be I can look it up.

    – Raaja
    Jan 11 at 10:30






  • 1





    Don't mark accepted because I am afraid people may stop entering this post when they find there has already been an answer. Anyway I have checked it now :)

    – Eric Sun
    Jan 11 at 10:31











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f469666%2fshading-apply-to-label-unexpected-in-matrix-environment%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









5














One way is to adjust the your style-set definitions (as done by @marmot):



 documentclass[tikz, margin=3mm]{standalone}
usetikzlibrary{shadows, shapes, positioning, matrix}
makeatletter % from https://tex.stackexchange.com/a/129322/121799
tikzset{no shadows/.code=lettikz@preactionspgfutil@empty}
makeatother
%https://tex.stackexchange.com/questions/422782/labels-of-nodes-with-drop-shadow
begin{document}
begin{tikzpicture}[
every node/.style = {font= ttfamily, draw, fill=white, drop shadow},
every label/.append style = {
font=tiny ttfamily,
color = blue,
}
]
node [label={[no shadows]foobar}] (ele) {node with shadow};
matrix (layer) [no shadows, matrix of nodes, draw = none, column sep = 1cm, below = of ele] {
|[label={[no shadows]:matrix label 1}]|matrix element 1 &
|[label={[no shadows]:matrix label 2}]|matrix element 2 &
|[label={[no shadows]:matrix label 3}]|matrix element 3 \
};
end{tikzpicture}
end{document}


This should give you:



enter image description here






share|improve this answer





















  • 1





    Thank you, both you and @Max point me to solution of disable preactions. I am still wondering if there can be options in matrix to avoid polluting the label

    – Eric Sun
    Jan 11 at 10:26











  • @EricSun Also, as far as not to pollute the matrix environment, I dont know. May be I can look it up.

    – Raaja
    Jan 11 at 10:30






  • 1





    Don't mark accepted because I am afraid people may stop entering this post when they find there has already been an answer. Anyway I have checked it now :)

    – Eric Sun
    Jan 11 at 10:31
















5














One way is to adjust the your style-set definitions (as done by @marmot):



 documentclass[tikz, margin=3mm]{standalone}
usetikzlibrary{shadows, shapes, positioning, matrix}
makeatletter % from https://tex.stackexchange.com/a/129322/121799
tikzset{no shadows/.code=lettikz@preactionspgfutil@empty}
makeatother
%https://tex.stackexchange.com/questions/422782/labels-of-nodes-with-drop-shadow
begin{document}
begin{tikzpicture}[
every node/.style = {font= ttfamily, draw, fill=white, drop shadow},
every label/.append style = {
font=tiny ttfamily,
color = blue,
}
]
node [label={[no shadows]foobar}] (ele) {node with shadow};
matrix (layer) [no shadows, matrix of nodes, draw = none, column sep = 1cm, below = of ele] {
|[label={[no shadows]:matrix label 1}]|matrix element 1 &
|[label={[no shadows]:matrix label 2}]|matrix element 2 &
|[label={[no shadows]:matrix label 3}]|matrix element 3 \
};
end{tikzpicture}
end{document}


This should give you:



enter image description here






share|improve this answer





















  • 1





    Thank you, both you and @Max point me to solution of disable preactions. I am still wondering if there can be options in matrix to avoid polluting the label

    – Eric Sun
    Jan 11 at 10:26











  • @EricSun Also, as far as not to pollute the matrix environment, I dont know. May be I can look it up.

    – Raaja
    Jan 11 at 10:30






  • 1





    Don't mark accepted because I am afraid people may stop entering this post when they find there has already been an answer. Anyway I have checked it now :)

    – Eric Sun
    Jan 11 at 10:31














5












5








5







One way is to adjust the your style-set definitions (as done by @marmot):



 documentclass[tikz, margin=3mm]{standalone}
usetikzlibrary{shadows, shapes, positioning, matrix}
makeatletter % from https://tex.stackexchange.com/a/129322/121799
tikzset{no shadows/.code=lettikz@preactionspgfutil@empty}
makeatother
%https://tex.stackexchange.com/questions/422782/labels-of-nodes-with-drop-shadow
begin{document}
begin{tikzpicture}[
every node/.style = {font= ttfamily, draw, fill=white, drop shadow},
every label/.append style = {
font=tiny ttfamily,
color = blue,
}
]
node [label={[no shadows]foobar}] (ele) {node with shadow};
matrix (layer) [no shadows, matrix of nodes, draw = none, column sep = 1cm, below = of ele] {
|[label={[no shadows]:matrix label 1}]|matrix element 1 &
|[label={[no shadows]:matrix label 2}]|matrix element 2 &
|[label={[no shadows]:matrix label 3}]|matrix element 3 \
};
end{tikzpicture}
end{document}


This should give you:



enter image description here






share|improve this answer















One way is to adjust the your style-set definitions (as done by @marmot):



 documentclass[tikz, margin=3mm]{standalone}
usetikzlibrary{shadows, shapes, positioning, matrix}
makeatletter % from https://tex.stackexchange.com/a/129322/121799
tikzset{no shadows/.code=lettikz@preactionspgfutil@empty}
makeatother
%https://tex.stackexchange.com/questions/422782/labels-of-nodes-with-drop-shadow
begin{document}
begin{tikzpicture}[
every node/.style = {font= ttfamily, draw, fill=white, drop shadow},
every label/.append style = {
font=tiny ttfamily,
color = blue,
}
]
node [label={[no shadows]foobar}] (ele) {node with shadow};
matrix (layer) [no shadows, matrix of nodes, draw = none, column sep = 1cm, below = of ele] {
|[label={[no shadows]:matrix label 1}]|matrix element 1 &
|[label={[no shadows]:matrix label 2}]|matrix element 2 &
|[label={[no shadows]:matrix label 3}]|matrix element 3 \
};
end{tikzpicture}
end{document}


This should give you:



enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 11 at 10:21

























answered Jan 11 at 10:15









RaajaRaaja

3,47521037




3,47521037








  • 1





    Thank you, both you and @Max point me to solution of disable preactions. I am still wondering if there can be options in matrix to avoid polluting the label

    – Eric Sun
    Jan 11 at 10:26











  • @EricSun Also, as far as not to pollute the matrix environment, I dont know. May be I can look it up.

    – Raaja
    Jan 11 at 10:30






  • 1





    Don't mark accepted because I am afraid people may stop entering this post when they find there has already been an answer. Anyway I have checked it now :)

    – Eric Sun
    Jan 11 at 10:31














  • 1





    Thank you, both you and @Max point me to solution of disable preactions. I am still wondering if there can be options in matrix to avoid polluting the label

    – Eric Sun
    Jan 11 at 10:26











  • @EricSun Also, as far as not to pollute the matrix environment, I dont know. May be I can look it up.

    – Raaja
    Jan 11 at 10:30






  • 1





    Don't mark accepted because I am afraid people may stop entering this post when they find there has already been an answer. Anyway I have checked it now :)

    – Eric Sun
    Jan 11 at 10:31








1




1





Thank you, both you and @Max point me to solution of disable preactions. I am still wondering if there can be options in matrix to avoid polluting the label

– Eric Sun
Jan 11 at 10:26





Thank you, both you and @Max point me to solution of disable preactions. I am still wondering if there can be options in matrix to avoid polluting the label

– Eric Sun
Jan 11 at 10:26













@EricSun Also, as far as not to pollute the matrix environment, I dont know. May be I can look it up.

– Raaja
Jan 11 at 10:30





@EricSun Also, as far as not to pollute the matrix environment, I dont know. May be I can look it up.

– Raaja
Jan 11 at 10:30




1




1





Don't mark accepted because I am afraid people may stop entering this post when they find there has already been an answer. Anyway I have checked it now :)

– Eric Sun
Jan 11 at 10:31





Don't mark accepted because I am afraid people may stop entering this post when they find there has already been an answer. Anyway I have checked it now :)

– Eric Sun
Jan 11 at 10:31


















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f469666%2fshading-apply-to-label-unexpected-in-matrix-environment%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

A Topological Invariant for $pi_3(U(n))$