Set outline first and fill colors later
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have the following code
documentclass[border=5mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.10,
ticks=none}
usepgfplotslibrary{fillbetween}
usetikzlibrary{backgrounds,
calc,
patterns}
begin{document}
begin{tikzpicture}[scale=4, transform shape]
tikzset{
myc/.pic={
draw[line width=2mm] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
}
}
path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
end{tikzpicture}
end{document}
The code defines the outline of a tile in the line starting with tikzset{
I want to put this tile at various places and I want to use different colors to fill the tile. The above code is one of the attempts to get this done, which however does not work.
The output I get is the following:
I very recently learnt about the tikzset
command (thanks to TeXstackexchange) and have no understanding of it. Can somebody please help me here and also, if possible, suggest a reference.
tikz-pgf
add a comment |
I have the following code
documentclass[border=5mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.10,
ticks=none}
usepgfplotslibrary{fillbetween}
usetikzlibrary{backgrounds,
calc,
patterns}
begin{document}
begin{tikzpicture}[scale=4, transform shape]
tikzset{
myc/.pic={
draw[line width=2mm] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
}
}
path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
end{tikzpicture}
end{document}
The code defines the outline of a tile in the line starting with tikzset{
I want to put this tile at various places and I want to use different colors to fill the tile. The above code is one of the attempts to get this done, which however does not work.
The output I get is the following:
I very recently learnt about the tikzset
command (thanks to TeXstackexchange) and have no understanding of it. Can somebody please help me here and also, if possible, suggest a reference.
tikz-pgf
add a comment |
I have the following code
documentclass[border=5mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.10,
ticks=none}
usepgfplotslibrary{fillbetween}
usetikzlibrary{backgrounds,
calc,
patterns}
begin{document}
begin{tikzpicture}[scale=4, transform shape]
tikzset{
myc/.pic={
draw[line width=2mm] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
}
}
path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
end{tikzpicture}
end{document}
The code defines the outline of a tile in the line starting with tikzset{
I want to put this tile at various places and I want to use different colors to fill the tile. The above code is one of the attempts to get this done, which however does not work.
The output I get is the following:
I very recently learnt about the tikzset
command (thanks to TeXstackexchange) and have no understanding of it. Can somebody please help me here and also, if possible, suggest a reference.
tikz-pgf
I have the following code
documentclass[border=5mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.10,
ticks=none}
usepgfplotslibrary{fillbetween}
usetikzlibrary{backgrounds,
calc,
patterns}
begin{document}
begin{tikzpicture}[scale=4, transform shape]
tikzset{
myc/.pic={
draw[line width=2mm] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
}
}
path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
end{tikzpicture}
end{document}
The code defines the outline of a tile in the line starting with tikzset{
I want to put this tile at various places and I want to use different colors to fill the tile. The above code is one of the attempts to get this done, which however does not work.
The output I get is the following:
I very recently learnt about the tikzset
command (thanks to TeXstackexchange) and have no understanding of it. Can somebody please help me here and also, if possible, suggest a reference.
tikz-pgf
tikz-pgf
asked May 20 at 12:39
caffeinemachinecaffeinemachine
2491 silver badge7 bronze badges
2491 silver badge7 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Just use pic actions
.
documentclass[tikz,border=3.14mm]{standalone}
begin{document}
begin{tikzpicture}[scale=4, transform shape]
tikzset{
myc/.pic={
draw[line width=2mm,pic actions] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
}
}
path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
end{tikzpicture}
end{document}
2
@caffeinemachine I personally preferpic actions
over an argument in the pic in this case because you can then adddashed
and/ordraw=red
and so on which you cannot do in the same simple way if you use arguments of thepic
s.
– user121799
May 20 at 12:54
add a comment |
Your pic
can have arguments.
documentclass[border=5mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.10,
ticks=none}
usepgfplotslibrary{fillbetween}
usetikzlibrary{backgrounds,
calc,
patterns}
begin{document}
begin{tikzpicture}[scale=4, transform shape]
tikzset{
myc/.pic={
draw[line width=2mm,fill=#1] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
}
}
path (0,0) pic {myc=red} (1,3) pic {myc=green} (2,6) pic {myc=blue};
end{tikzpicture}
end{document}
Yeah I looked at the manual. But it's big. Can you tell me under what heading should I look? Thanks.
– caffeinemachine
May 20 at 12:51
2
@caffeinemachine Alright, it is in section 18, especially 18.3. It tells you how to define newpic
s. Reading about the key handler and the example on page 264, you will know thatpic
is, literally, a kind of style. So you read about.style
key handler in section 87.4.4, page 966, and boom, you know how to add one, or two, or even nine arguments to apic
.
– user156344
May 20 at 12:54
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%2f491746%2fset-outline-first-and-fill-colors-later%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
Just use pic actions
.
documentclass[tikz,border=3.14mm]{standalone}
begin{document}
begin{tikzpicture}[scale=4, transform shape]
tikzset{
myc/.pic={
draw[line width=2mm,pic actions] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
}
}
path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
end{tikzpicture}
end{document}
2
@caffeinemachine I personally preferpic actions
over an argument in the pic in this case because you can then adddashed
and/ordraw=red
and so on which you cannot do in the same simple way if you use arguments of thepic
s.
– user121799
May 20 at 12:54
add a comment |
Just use pic actions
.
documentclass[tikz,border=3.14mm]{standalone}
begin{document}
begin{tikzpicture}[scale=4, transform shape]
tikzset{
myc/.pic={
draw[line width=2mm,pic actions] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
}
}
path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
end{tikzpicture}
end{document}
2
@caffeinemachine I personally preferpic actions
over an argument in the pic in this case because you can then adddashed
and/ordraw=red
and so on which you cannot do in the same simple way if you use arguments of thepic
s.
– user121799
May 20 at 12:54
add a comment |
Just use pic actions
.
documentclass[tikz,border=3.14mm]{standalone}
begin{document}
begin{tikzpicture}[scale=4, transform shape]
tikzset{
myc/.pic={
draw[line width=2mm,pic actions] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
}
}
path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
end{tikzpicture}
end{document}
Just use pic actions
.
documentclass[tikz,border=3.14mm]{standalone}
begin{document}
begin{tikzpicture}[scale=4, transform shape]
tikzset{
myc/.pic={
draw[line width=2mm,pic actions] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
}
}
path (0,0) pic[fill=green] {myc} (1,3) pic[fill=blue] {myc} (2,6) pic[fill=blue] {myc};
end{tikzpicture}
end{document}
answered May 20 at 12:47
user121799user121799
127k6 gold badges192 silver badges357 bronze badges
127k6 gold badges192 silver badges357 bronze badges
2
@caffeinemachine I personally preferpic actions
over an argument in the pic in this case because you can then adddashed
and/ordraw=red
and so on which you cannot do in the same simple way if you use arguments of thepic
s.
– user121799
May 20 at 12:54
add a comment |
2
@caffeinemachine I personally preferpic actions
over an argument in the pic in this case because you can then adddashed
and/ordraw=red
and so on which you cannot do in the same simple way if you use arguments of thepic
s.
– user121799
May 20 at 12:54
2
2
@caffeinemachine I personally prefer
pic actions
over an argument in the pic in this case because you can then add dashed
and/or draw=red
and so on which you cannot do in the same simple way if you use arguments of the pic
s.– user121799
May 20 at 12:54
@caffeinemachine I personally prefer
pic actions
over an argument in the pic in this case because you can then add dashed
and/or draw=red
and so on which you cannot do in the same simple way if you use arguments of the pic
s.– user121799
May 20 at 12:54
add a comment |
Your pic
can have arguments.
documentclass[border=5mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.10,
ticks=none}
usepgfplotslibrary{fillbetween}
usetikzlibrary{backgrounds,
calc,
patterns}
begin{document}
begin{tikzpicture}[scale=4, transform shape]
tikzset{
myc/.pic={
draw[line width=2mm,fill=#1] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
}
}
path (0,0) pic {myc=red} (1,3) pic {myc=green} (2,6) pic {myc=blue};
end{tikzpicture}
end{document}
Yeah I looked at the manual. But it's big. Can you tell me under what heading should I look? Thanks.
– caffeinemachine
May 20 at 12:51
2
@caffeinemachine Alright, it is in section 18, especially 18.3. It tells you how to define newpic
s. Reading about the key handler and the example on page 264, you will know thatpic
is, literally, a kind of style. So you read about.style
key handler in section 87.4.4, page 966, and boom, you know how to add one, or two, or even nine arguments to apic
.
– user156344
May 20 at 12:54
add a comment |
Your pic
can have arguments.
documentclass[border=5mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.10,
ticks=none}
usepgfplotslibrary{fillbetween}
usetikzlibrary{backgrounds,
calc,
patterns}
begin{document}
begin{tikzpicture}[scale=4, transform shape]
tikzset{
myc/.pic={
draw[line width=2mm,fill=#1] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
}
}
path (0,0) pic {myc=red} (1,3) pic {myc=green} (2,6) pic {myc=blue};
end{tikzpicture}
end{document}
Yeah I looked at the manual. But it's big. Can you tell me under what heading should I look? Thanks.
– caffeinemachine
May 20 at 12:51
2
@caffeinemachine Alright, it is in section 18, especially 18.3. It tells you how to define newpic
s. Reading about the key handler and the example on page 264, you will know thatpic
is, literally, a kind of style. So you read about.style
key handler in section 87.4.4, page 966, and boom, you know how to add one, or two, or even nine arguments to apic
.
– user156344
May 20 at 12:54
add a comment |
Your pic
can have arguments.
documentclass[border=5mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.10,
ticks=none}
usepgfplotslibrary{fillbetween}
usetikzlibrary{backgrounds,
calc,
patterns}
begin{document}
begin{tikzpicture}[scale=4, transform shape]
tikzset{
myc/.pic={
draw[line width=2mm,fill=#1] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
}
}
path (0,0) pic {myc=red} (1,3) pic {myc=green} (2,6) pic {myc=blue};
end{tikzpicture}
end{document}
Your pic
can have arguments.
documentclass[border=5mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.10,
ticks=none}
usepgfplotslibrary{fillbetween}
usetikzlibrary{backgrounds,
calc,
patterns}
begin{document}
begin{tikzpicture}[scale=4, transform shape]
tikzset{
myc/.pic={
draw[line width=2mm,fill=#1] (0, 0) -| (2, 1) -| (1, 2) -| (2, 3) -| cycle;
}
}
path (0,0) pic {myc=red} (1,3) pic {myc=green} (2,6) pic {myc=blue};
end{tikzpicture}
end{document}
edited May 20 at 12:50
answered May 20 at 12:49
user156344
Yeah I looked at the manual. But it's big. Can you tell me under what heading should I look? Thanks.
– caffeinemachine
May 20 at 12:51
2
@caffeinemachine Alright, it is in section 18, especially 18.3. It tells you how to define newpic
s. Reading about the key handler and the example on page 264, you will know thatpic
is, literally, a kind of style. So you read about.style
key handler in section 87.4.4, page 966, and boom, you know how to add one, or two, or even nine arguments to apic
.
– user156344
May 20 at 12:54
add a comment |
Yeah I looked at the manual. But it's big. Can you tell me under what heading should I look? Thanks.
– caffeinemachine
May 20 at 12:51
2
@caffeinemachine Alright, it is in section 18, especially 18.3. It tells you how to define newpic
s. Reading about the key handler and the example on page 264, you will know thatpic
is, literally, a kind of style. So you read about.style
key handler in section 87.4.4, page 966, and boom, you know how to add one, or two, or even nine arguments to apic
.
– user156344
May 20 at 12:54
Yeah I looked at the manual. But it's big. Can you tell me under what heading should I look? Thanks.
– caffeinemachine
May 20 at 12:51
Yeah I looked at the manual. But it's big. Can you tell me under what heading should I look? Thanks.
– caffeinemachine
May 20 at 12:51
2
2
@caffeinemachine Alright, it is in section 18, especially 18.3. It tells you how to define new
pic
s. Reading about the key handler and the example on page 264, you will know that pic
is, literally, a kind of style. So you read about .style
key handler in section 87.4.4, page 966, and boom, you know how to add one, or two, or even nine arguments to a pic
.– user156344
May 20 at 12:54
@caffeinemachine Alright, it is in section 18, especially 18.3. It tells you how to define new
pic
s. Reading about the key handler and the example on page 264, you will know that pic
is, literally, a kind of style. So you read about .style
key handler in section 87.4.4, page 966, and boom, you know how to add one, or two, or even nine arguments to a pic
.– user156344
May 20 at 12:54
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%2f491746%2fset-outline-first-and-fill-colors-later%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