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
    2 days ago






  • 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
    2 days ago


















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
    2 days ago






  • 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
    2 days ago
















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 2 days ago









Eric SunEric Sun

1647




1647








  • 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
    2 days ago






  • 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
    2 days ago
















  • 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
    2 days ago






  • 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
    2 days ago










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
2 days ago





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
2 days ago




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
2 days ago







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
2 days ago












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
    2 days ago











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

    – Raaja
    2 days ago






  • 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
    2 days ago











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
    2 days ago











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

    – Raaja
    2 days ago






  • 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
    2 days ago
















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
    2 days ago











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

    – Raaja
    2 days ago






  • 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
    2 days ago














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 2 days ago

























answered 2 days ago









RaajaRaaja

2,4552732




2,4552732








  • 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
    2 days ago











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

    – Raaja
    2 days ago






  • 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
    2 days ago














  • 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
    2 days ago











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

    – Raaja
    2 days ago






  • 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
    2 days ago








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
2 days ago





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
2 days ago













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

– Raaja
2 days ago





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

– Raaja
2 days ago




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
2 days ago





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
2 days ago


















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

If I really need a card on my start hand, how many mulligans make sense? [duplicate]

Alcedinidae

Can an atomic nucleus contain both particles and antiparticles? [duplicate]