Bug or feature: tikz interprets color specification differently for rectangles
When drawing a rectangle, Tikz interprets color in two different ways, depending on in which order it is specified among the options.
In the example below: When color is specified first, as in the first two example, it is used to color the frame of the rectangle---as I'd expect. But in the third rectangle, the red color specification actually fills the rectangle with red. Is this expected?
documentclass{article}
usepackage{tikz}
begin{document}
begin{tikzpicture}
draw[color=red,very thick] (0,0) rectangle (1,1);
draw[color=red,very thick,fill=blue] (2,0) rectangle (3,1);
draw[very thick,fill=blue,color=red] (4,0) rectangle (5,1);
end{tikzpicture}
end{document}
tikz-pgf color
add a comment |
When drawing a rectangle, Tikz interprets color in two different ways, depending on in which order it is specified among the options.
In the example below: When color is specified first, as in the first two example, it is used to color the frame of the rectangle---as I'd expect. But in the third rectangle, the red color specification actually fills the rectangle with red. Is this expected?
documentclass{article}
usepackage{tikz}
begin{document}
begin{tikzpicture}
draw[color=red,very thick] (0,0) rectangle (1,1);
draw[color=red,very thick,fill=blue] (2,0) rectangle (3,1);
draw[very thick,fill=blue,color=red] (4,0) rectangle (5,1);
end{tikzpicture}
end{document}
tikz-pgf color
add a comment |
When drawing a rectangle, Tikz interprets color in two different ways, depending on in which order it is specified among the options.
In the example below: When color is specified first, as in the first two example, it is used to color the frame of the rectangle---as I'd expect. But in the third rectangle, the red color specification actually fills the rectangle with red. Is this expected?
documentclass{article}
usepackage{tikz}
begin{document}
begin{tikzpicture}
draw[color=red,very thick] (0,0) rectangle (1,1);
draw[color=red,very thick,fill=blue] (2,0) rectangle (3,1);
draw[very thick,fill=blue,color=red] (4,0) rectangle (5,1);
end{tikzpicture}
end{document}
tikz-pgf color
When drawing a rectangle, Tikz interprets color in two different ways, depending on in which order it is specified among the options.
In the example below: When color is specified first, as in the first two example, it is used to color the frame of the rectangle---as I'd expect. But in the third rectangle, the red color specification actually fills the rectangle with red. Is this expected?
documentclass{article}
usepackage{tikz}
begin{document}
begin{tikzpicture}
draw[color=red,very thick] (0,0) rectangle (1,1);
draw[color=red,very thick,fill=blue] (2,0) rectangle (3,1);
draw[very thick,fill=blue,color=red] (4,0) rectangle (5,1);
end{tikzpicture}
end{document}
tikz-pgf color
tikz-pgf color
asked 45 mins ago
Máté Wierdl
44428
44428
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
You are using the wrong key. color
sets fill
and draw
(if they are set to a color, i.e. it will not add a fill color if you do not specify fill
). Use draw
to change the frame.
documentclass{article}
usepackage{tikz}
begin{document}
begin{tikzpicture}
draw[color=red,very thick] (0,0) rectangle (1,1);
draw[color=red,very thick,fill=blue] (2,0) rectangle (3,1);
draw[very thick,fill=blue,draw=red] (4,0) rectangle (5,1);
end{tikzpicture}
end{document}
add a comment |
Yes because this option rewrites the colors on the draw
, fill
operations, i quote the 3.0.1a manual on page 165:
/tikz/color=<color name> (no default)
This option sets the color that
is used for fill, drawing, and text inside the current scope.
add a comment |
This is a feature, not a bug.
- In a
path
command thecolor=red
is equivalent totext=red
. - In a
draw
command thecolor=red
is equivalent todraw=red,text=red
. - In a
fill
command thecolor=red
is equivalent tofill=red,text=red
. - In a
filldraw
command thecolor=red
is equivalent tofill=red,draw=red,text=red
.
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%2f468439%2fbug-or-feature-tikz-interprets-color-specification-differently-for-rectangles%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You are using the wrong key. color
sets fill
and draw
(if they are set to a color, i.e. it will not add a fill color if you do not specify fill
). Use draw
to change the frame.
documentclass{article}
usepackage{tikz}
begin{document}
begin{tikzpicture}
draw[color=red,very thick] (0,0) rectangle (1,1);
draw[color=red,very thick,fill=blue] (2,0) rectangle (3,1);
draw[very thick,fill=blue,draw=red] (4,0) rectangle (5,1);
end{tikzpicture}
end{document}
add a comment |
You are using the wrong key. color
sets fill
and draw
(if they are set to a color, i.e. it will not add a fill color if you do not specify fill
). Use draw
to change the frame.
documentclass{article}
usepackage{tikz}
begin{document}
begin{tikzpicture}
draw[color=red,very thick] (0,0) rectangle (1,1);
draw[color=red,very thick,fill=blue] (2,0) rectangle (3,1);
draw[very thick,fill=blue,draw=red] (4,0) rectangle (5,1);
end{tikzpicture}
end{document}
add a comment |
You are using the wrong key. color
sets fill
and draw
(if they are set to a color, i.e. it will not add a fill color if you do not specify fill
). Use draw
to change the frame.
documentclass{article}
usepackage{tikz}
begin{document}
begin{tikzpicture}
draw[color=red,very thick] (0,0) rectangle (1,1);
draw[color=red,very thick,fill=blue] (2,0) rectangle (3,1);
draw[very thick,fill=blue,draw=red] (4,0) rectangle (5,1);
end{tikzpicture}
end{document}
You are using the wrong key. color
sets fill
and draw
(if they are set to a color, i.e. it will not add a fill color if you do not specify fill
). Use draw
to change the frame.
documentclass{article}
usepackage{tikz}
begin{document}
begin{tikzpicture}
draw[color=red,very thick] (0,0) rectangle (1,1);
draw[color=red,very thick,fill=blue] (2,0) rectangle (3,1);
draw[very thick,fill=blue,draw=red] (4,0) rectangle (5,1);
end{tikzpicture}
end{document}
answered 39 mins ago
TeXnician
24.5k63086
24.5k63086
add a comment |
add a comment |
Yes because this option rewrites the colors on the draw
, fill
operations, i quote the 3.0.1a manual on page 165:
/tikz/color=<color name> (no default)
This option sets the color that
is used for fill, drawing, and text inside the current scope.
add a comment |
Yes because this option rewrites the colors on the draw
, fill
operations, i quote the 3.0.1a manual on page 165:
/tikz/color=<color name> (no default)
This option sets the color that
is used for fill, drawing, and text inside the current scope.
add a comment |
Yes because this option rewrites the colors on the draw
, fill
operations, i quote the 3.0.1a manual on page 165:
/tikz/color=<color name> (no default)
This option sets the color that
is used for fill, drawing, and text inside the current scope.
Yes because this option rewrites the colors on the draw
, fill
operations, i quote the 3.0.1a manual on page 165:
/tikz/color=<color name> (no default)
This option sets the color that
is used for fill, drawing, and text inside the current scope.
answered 38 mins ago
AndréC
7,83011441
7,83011441
add a comment |
add a comment |
This is a feature, not a bug.
- In a
path
command thecolor=red
is equivalent totext=red
. - In a
draw
command thecolor=red
is equivalent todraw=red,text=red
. - In a
fill
command thecolor=red
is equivalent tofill=red,text=red
. - In a
filldraw
command thecolor=red
is equivalent tofill=red,draw=red,text=red
.
add a comment |
This is a feature, not a bug.
- In a
path
command thecolor=red
is equivalent totext=red
. - In a
draw
command thecolor=red
is equivalent todraw=red,text=red
. - In a
fill
command thecolor=red
is equivalent tofill=red,text=red
. - In a
filldraw
command thecolor=red
is equivalent tofill=red,draw=red,text=red
.
add a comment |
This is a feature, not a bug.
- In a
path
command thecolor=red
is equivalent totext=red
. - In a
draw
command thecolor=red
is equivalent todraw=red,text=red
. - In a
fill
command thecolor=red
is equivalent tofill=red,text=red
. - In a
filldraw
command thecolor=red
is equivalent tofill=red,draw=red,text=red
.
This is a feature, not a bug.
- In a
path
command thecolor=red
is equivalent totext=red
. - In a
draw
command thecolor=red
is equivalent todraw=red,text=red
. - In a
fill
command thecolor=red
is equivalent tofill=red,text=red
. - In a
filldraw
command thecolor=red
is equivalent tofill=red,draw=red,text=red
.
answered 9 mins ago
Kpym
15.7k23984
15.7k23984
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f468439%2fbug-or-feature-tikz-interprets-color-specification-differently-for-rectangles%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