Shading apply to label unexpected in matrix environment
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:
How this happen and is there way to avoid it?
tikz-pgf labels tikz-matrix shadows
add a comment |
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:
How this happen and is there way to avoid it?
tikz-pgf labels tikz-matrix shadows
2
Thenodes=
key for the matrix is like a shortcut forevery node/.style=
and since labels are also nodes, they also get thedrop shadow
. I suspect that some keys, likedraw
are reset within a label, but others likedrop shadow
are not.
– Max
2 days ago
2
You could use theno shadows
key from solution B from this answer and add it to yourmylabel
style. That would delete all preactions added to the labels, including thedrop shadow
.
– Max
2 days ago
add a comment |
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:
How this happen and is there way to avoid it?
tikz-pgf labels tikz-matrix shadows
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:
How this happen and is there way to avoid it?
tikz-pgf labels tikz-matrix shadows
tikz-pgf labels tikz-matrix shadows
asked 2 days ago
Eric SunEric Sun
1647
1647
2
Thenodes=
key for the matrix is like a shortcut forevery node/.style=
and since labels are also nodes, they also get thedrop shadow
. I suspect that some keys, likedraw
are reset within a label, but others likedrop shadow
are not.
– Max
2 days ago
2
You could use theno shadows
key from solution B from this answer and add it to yourmylabel
style. That would delete all preactions added to the labels, including thedrop shadow
.
– Max
2 days ago
add a comment |
2
Thenodes=
key for the matrix is like a shortcut forevery node/.style=
and since labels are also nodes, they also get thedrop shadow
. I suspect that some keys, likedraw
are reset within a label, but others likedrop shadow
are not.
– Max
2 days ago
2
You could use theno shadows
key from solution B from this answer and add it to yourmylabel
style. That would delete all preactions added to the labels, including thedrop 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
add a comment |
1 Answer
1
active
oldest
votes
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:
1
Thank you, both you and @Max point me to solution of disablepreactions
. I am still wondering if there can be options in matrix to avoid polluting thelabel
– Eric Sun
2 days ago
@EricSun Also, as far as not topollute
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
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%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
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:
1
Thank you, both you and @Max point me to solution of disablepreactions
. I am still wondering if there can be options in matrix to avoid polluting thelabel
– Eric Sun
2 days ago
@EricSun Also, as far as not topollute
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
add a comment |
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:
1
Thank you, both you and @Max point me to solution of disablepreactions
. I am still wondering if there can be options in matrix to avoid polluting thelabel
– Eric Sun
2 days ago
@EricSun Also, as far as not topollute
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
add a comment |
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:
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:
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 disablepreactions
. I am still wondering if there can be options in matrix to avoid polluting thelabel
– Eric Sun
2 days ago
@EricSun Also, as far as not topollute
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
add a comment |
1
Thank you, both you and @Max point me to solution of disablepreactions
. I am still wondering if there can be options in matrix to avoid polluting thelabel
– Eric Sun
2 days ago
@EricSun Also, as far as not topollute
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
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%2f469666%2fshading-apply-to-label-unexpected-in-matrix-environment%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
The
nodes=
key for the matrix is like a shortcut forevery node/.style=
and since labels are also nodes, they also get thedrop shadow
. I suspect that some keys, likedraw
are reset within a label, but others likedrop 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 yourmylabel
style. That would delete all preactions added to the labels, including thedrop shadow
.– Max
2 days ago