Tikzset with with more than one defaultsRotate a node but not its content: the case of the ellipse...

If all harmonics are generated by plucking, how does a guitar string produce a pure frequency sound?

Inventor that creates machine that grabs man from future

Metadata API deployments are failing in Spring '19

Why does the DC-9-80 have this cusp in its fuselage?

How do Japanese speakers determine the implied topic when none has been mentioned?

Eww, those bytes are gross

Word to be used for "standing with your toes pointing out"

Why is c4 a better move in this position?

Using AWS Fargate as web server

For Loop and Sum

Connecting top and bottom of adjacent circles

Meth dealer reference in Family Guy

Walking in a rotating spacecraft and Newton's 3rd Law of Motion

Can chords be played on the flute?

Crystal compensation for temp and voltage

How can I mix up weapons for large groups of similar monsters/characters?

Can I retract my name from an already published manuscript?

What is better: yes / no radio, or simple checkbox?

Why is my solution for the partial pressures of two different gases incorrect?

Incompressible fluid definition

raspberry pi change directory (cd) command not working with USB drive

Is the theory of the category of topological spaces computable?

4 Spheres all touching each other??

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?



Tikzset with with more than one defaults


Rotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?Circle with more than one “marking”TikZ scaling graphic and adjust node position and keep font size“below of=” ? more than one block?Filling rectangle in TikZ with more than one colorTikZ/ERD: node (=Entity) label on the insideParametric tikzset style with argumentLine up nested tikz enviroments or how to get rid of themMore than one tikz block chain













2















documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone/.style={%
decoration={markings, mark= at position #1 with
{arrow[line width=0.5mm, stealth-]{Latex[length=2.5mm, width=2mm]}}},
postaction={decorate}
},
parallelone/.default=0.5,
}

begin{tikzpicture}
draw[parallelone] (0,0)--(4,4);
end{tikzpicture}

end{document}


(I am aware that similar questions have already been asked.)



To deal with more than one argument, I think I need to have pgfkeys, but I am still confused (for example, in the above example, things are somewhat nested). Is there a simple tutorial about it? Or can someone provide step by step explanation for the above case? (That is creating as many keys as I may need to change while using it (such as arrow line width, arrow type, length, width, etc.).)










share|improve this question




















  • 1





    Maybe you can link similar questions (that you mention in your question), that would make it easier for others to help.

    – Dr. Manuel Kuehner
    12 hours ago






  • 1





    Which parameters do you want to modify? You can always say /.style args={...}{...} or /.style n args={3}{....}.

    – marmot
    12 hours ago
















2















documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone/.style={%
decoration={markings, mark= at position #1 with
{arrow[line width=0.5mm, stealth-]{Latex[length=2.5mm, width=2mm]}}},
postaction={decorate}
},
parallelone/.default=0.5,
}

begin{tikzpicture}
draw[parallelone] (0,0)--(4,4);
end{tikzpicture}

end{document}


(I am aware that similar questions have already been asked.)



To deal with more than one argument, I think I need to have pgfkeys, but I am still confused (for example, in the above example, things are somewhat nested). Is there a simple tutorial about it? Or can someone provide step by step explanation for the above case? (That is creating as many keys as I may need to change while using it (such as arrow line width, arrow type, length, width, etc.).)










share|improve this question




















  • 1





    Maybe you can link similar questions (that you mention in your question), that would make it easier for others to help.

    – Dr. Manuel Kuehner
    12 hours ago






  • 1





    Which parameters do you want to modify? You can always say /.style args={...}{...} or /.style n args={3}{....}.

    – marmot
    12 hours ago














2












2








2








documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone/.style={%
decoration={markings, mark= at position #1 with
{arrow[line width=0.5mm, stealth-]{Latex[length=2.5mm, width=2mm]}}},
postaction={decorate}
},
parallelone/.default=0.5,
}

begin{tikzpicture}
draw[parallelone] (0,0)--(4,4);
end{tikzpicture}

end{document}


(I am aware that similar questions have already been asked.)



To deal with more than one argument, I think I need to have pgfkeys, but I am still confused (for example, in the above example, things are somewhat nested). Is there a simple tutorial about it? Or can someone provide step by step explanation for the above case? (That is creating as many keys as I may need to change while using it (such as arrow line width, arrow type, length, width, etc.).)










share|improve this question
















documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone/.style={%
decoration={markings, mark= at position #1 with
{arrow[line width=0.5mm, stealth-]{Latex[length=2.5mm, width=2mm]}}},
postaction={decorate}
},
parallelone/.default=0.5,
}

begin{tikzpicture}
draw[parallelone] (0,0)--(4,4);
end{tikzpicture}

end{document}


(I am aware that similar questions have already been asked.)



To deal with more than one argument, I think I need to have pgfkeys, but I am still confused (for example, in the above example, things are somewhat nested). Is there a simple tutorial about it? Or can someone provide step by step explanation for the above case? (That is creating as many keys as I may need to change while using it (such as arrow line width, arrow type, length, width, etc.).)







tikz-pgf pgfkeys






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 12 hours ago







blackened

















asked 13 hours ago









blackenedblackened

1,576714




1,576714








  • 1





    Maybe you can link similar questions (that you mention in your question), that would make it easier for others to help.

    – Dr. Manuel Kuehner
    12 hours ago






  • 1





    Which parameters do you want to modify? You can always say /.style args={...}{...} or /.style n args={3}{....}.

    – marmot
    12 hours ago














  • 1





    Maybe you can link similar questions (that you mention in your question), that would make it easier for others to help.

    – Dr. Manuel Kuehner
    12 hours ago






  • 1





    Which parameters do you want to modify? You can always say /.style args={...}{...} or /.style n args={3}{....}.

    – marmot
    12 hours ago








1




1





Maybe you can link similar questions (that you mention in your question), that would make it easier for others to help.

– Dr. Manuel Kuehner
12 hours ago





Maybe you can link similar questions (that you mention in your question), that would make it easier for others to help.

– Dr. Manuel Kuehner
12 hours ago




1




1





Which parameters do you want to modify? You can always say /.style args={...}{...} or /.style n args={3}{....}.

– marmot
12 hours ago





Which parameters do you want to modify? You can always say /.style args={...}{...} or /.style n args={3}{....}.

– marmot
12 hours ago










1 Answer
1






active

oldest

votes


















1














Since you are asking about a tutorial, I answer the question in two steps. (IMHO the pgfmanual is an excellent tutorial, in particular when you use it to understand examples that you can find on this site.) You can make an style depend on several parameters. But then you always need to specify all of them if you want to change just one. Therefore, I would like to argue that it is easier to store the parameters in pgfkeys with default value. This leads to



documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone arrow length/.initial=2.5mm,
parallelone arrow width/.initial=2mm,
parallelone arrow type/.initial=Latex,
parallelone/.style={%
decoration={markings, mark= at position #1 with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow type}[length=pgfkeysvalueof{/tikz/parallelone arrow length},
width=pgfkeysvalueof{/tikz/parallelone arrow width}]}}},
postaction={decorate}
},
parallelone/.default=0.5
}

begin{tikzpicture}
draw[parallelone] (0,0)--(4,4);
% change the length and poisition
draw[parallelone=0.7,parallelone arrow length=5mm] (1,0)--(5,4);
% change the type. the length is back to its initial or default values
draw[parallelone,parallelone arrow type=Stealth] (2,0)--(6,4);
% change the width. the other paraneters are at their initial or deault values
draw[parallelone,parallelone arrow width=5mm] (3,0)--(7,4);
end{tikzpicture}
end{document}


enter image description here



Of course, at a given point you may decide that you do not want to always type parallelone arrow before type, length and so on. This is what key families are for. Then you may only say draw[parallelone={type=Stealth}] if you want to change the type and leave everything else at their default values.



documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone/.style={%
/utils/exec=tikzset{parallelone arrow/.cd,#1},
decoration={markings, mark= at position pgfkeysvalueof{/tikz/parallelone arrow/pos} with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]}}},
postaction={decorate}
},
parallelone/.default={pos=0.5},
parallelone arrow/.is family,
parallelone arrow/.cd,
pos/.initial=0.5,
length/.initial=2.5mm,
width/.initial=2mm,
type/.initial=Latex,
}

begin{tikzpicture}
draw[parallelone] (0,0)--(4,4);
% change the length and poisition
draw[parallelone={pos=0.7,length=5mm}] (1,0)--(5,4);
% change the type. the length is back to its initial or default values
draw[parallelone={type=Stealth}] (2,0)--(6,4);
% change the width. the other parameters are at their initial or deault values
draw[parallelone={width=5mm}] (3,0)--(7,4);
end{tikzpicture}
end{document}


enter image description here



If you want two arrows with the same functionality, you could try



documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone/.style={%
/utils/exec=tikzset{parallelone arrow/.cd,#1},
decoration={markings, mark= at position pgfkeysvalueof{/tikz/parallelone arrow/pos} with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]}}},
postaction={decorate}
},
paralleltwo/.style={%
/utils/exec=tikzset{parallelone arrow/.cd,#1},
decoration={markings, mark= at position pgfkeysvalueof{/tikz/parallelone arrow/pos} with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]%
pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]}}},
postaction={decorate}
},
parallelone/.default={pos=0.5},
parallelone arrow/.is family,
parallelone arrow/.cd,
pos/.initial=0.5,
length/.initial=2.5mm,
width/.initial=2mm,
type/.initial=Latex,
}

begin{tikzpicture}
draw[paralleltwo] (0,0)--(4,4);
% change the length and poisition
draw[parallelone={pos=0.7,length=5mm}] (1,0)--(5,4);
% change the type. the length is back to its initial or default values
draw[parallelone={type=Stealth}] (2,0)--(6,4);
% change the width. the other parameters are at their initial or deault values
draw[parallelone={width=5mm}] (3,0)--(7,4);
end{tikzpicture}
end{document}


enter image description here






share|improve this answer





















  • 1





    I think the OP wants to have something like parallelone=0.3 and 0.7, because as I can see parallelone arrow length is totally not related to parallelone.

    – JouleV
    12 hours ago













  • @JouleV One can do that, yes, but I wouldn't want to do that because you will always have to add the information on all the arrow details if you just want to move the position.

    – marmot
    12 hours ago











  • @marmot Just to clarify: (1) Is arrow[line width=0.5mm] included in the keys? (2) How do I change > to >> ?

    – blackened
    9 hours ago






  • 1





    @blackened [line width=0.5mm] is not included, but it has no effect, I just forgot to drop that key. The arrow is completely determined by the other parameters (in this example). And a double arrow can be obtained as usual, i.e. by repeating arrow, see e.g. at the bottom of p. 210 of the pgfmanual.

    – marmot
    9 hours 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%2f477565%2ftikzset-with-with-more-than-one-defaults%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









1














Since you are asking about a tutorial, I answer the question in two steps. (IMHO the pgfmanual is an excellent tutorial, in particular when you use it to understand examples that you can find on this site.) You can make an style depend on several parameters. But then you always need to specify all of them if you want to change just one. Therefore, I would like to argue that it is easier to store the parameters in pgfkeys with default value. This leads to



documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone arrow length/.initial=2.5mm,
parallelone arrow width/.initial=2mm,
parallelone arrow type/.initial=Latex,
parallelone/.style={%
decoration={markings, mark= at position #1 with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow type}[length=pgfkeysvalueof{/tikz/parallelone arrow length},
width=pgfkeysvalueof{/tikz/parallelone arrow width}]}}},
postaction={decorate}
},
parallelone/.default=0.5
}

begin{tikzpicture}
draw[parallelone] (0,0)--(4,4);
% change the length and poisition
draw[parallelone=0.7,parallelone arrow length=5mm] (1,0)--(5,4);
% change the type. the length is back to its initial or default values
draw[parallelone,parallelone arrow type=Stealth] (2,0)--(6,4);
% change the width. the other paraneters are at their initial or deault values
draw[parallelone,parallelone arrow width=5mm] (3,0)--(7,4);
end{tikzpicture}
end{document}


enter image description here



Of course, at a given point you may decide that you do not want to always type parallelone arrow before type, length and so on. This is what key families are for. Then you may only say draw[parallelone={type=Stealth}] if you want to change the type and leave everything else at their default values.



documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone/.style={%
/utils/exec=tikzset{parallelone arrow/.cd,#1},
decoration={markings, mark= at position pgfkeysvalueof{/tikz/parallelone arrow/pos} with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]}}},
postaction={decorate}
},
parallelone/.default={pos=0.5},
parallelone arrow/.is family,
parallelone arrow/.cd,
pos/.initial=0.5,
length/.initial=2.5mm,
width/.initial=2mm,
type/.initial=Latex,
}

begin{tikzpicture}
draw[parallelone] (0,0)--(4,4);
% change the length and poisition
draw[parallelone={pos=0.7,length=5mm}] (1,0)--(5,4);
% change the type. the length is back to its initial or default values
draw[parallelone={type=Stealth}] (2,0)--(6,4);
% change the width. the other parameters are at their initial or deault values
draw[parallelone={width=5mm}] (3,0)--(7,4);
end{tikzpicture}
end{document}


enter image description here



If you want two arrows with the same functionality, you could try



documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone/.style={%
/utils/exec=tikzset{parallelone arrow/.cd,#1},
decoration={markings, mark= at position pgfkeysvalueof{/tikz/parallelone arrow/pos} with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]}}},
postaction={decorate}
},
paralleltwo/.style={%
/utils/exec=tikzset{parallelone arrow/.cd,#1},
decoration={markings, mark= at position pgfkeysvalueof{/tikz/parallelone arrow/pos} with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]%
pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]}}},
postaction={decorate}
},
parallelone/.default={pos=0.5},
parallelone arrow/.is family,
parallelone arrow/.cd,
pos/.initial=0.5,
length/.initial=2.5mm,
width/.initial=2mm,
type/.initial=Latex,
}

begin{tikzpicture}
draw[paralleltwo] (0,0)--(4,4);
% change the length and poisition
draw[parallelone={pos=0.7,length=5mm}] (1,0)--(5,4);
% change the type. the length is back to its initial or default values
draw[parallelone={type=Stealth}] (2,0)--(6,4);
% change the width. the other parameters are at their initial or deault values
draw[parallelone={width=5mm}] (3,0)--(7,4);
end{tikzpicture}
end{document}


enter image description here






share|improve this answer





















  • 1





    I think the OP wants to have something like parallelone=0.3 and 0.7, because as I can see parallelone arrow length is totally not related to parallelone.

    – JouleV
    12 hours ago













  • @JouleV One can do that, yes, but I wouldn't want to do that because you will always have to add the information on all the arrow details if you just want to move the position.

    – marmot
    12 hours ago











  • @marmot Just to clarify: (1) Is arrow[line width=0.5mm] included in the keys? (2) How do I change > to >> ?

    – blackened
    9 hours ago






  • 1





    @blackened [line width=0.5mm] is not included, but it has no effect, I just forgot to drop that key. The arrow is completely determined by the other parameters (in this example). And a double arrow can be obtained as usual, i.e. by repeating arrow, see e.g. at the bottom of p. 210 of the pgfmanual.

    – marmot
    9 hours ago


















1














Since you are asking about a tutorial, I answer the question in two steps. (IMHO the pgfmanual is an excellent tutorial, in particular when you use it to understand examples that you can find on this site.) You can make an style depend on several parameters. But then you always need to specify all of them if you want to change just one. Therefore, I would like to argue that it is easier to store the parameters in pgfkeys with default value. This leads to



documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone arrow length/.initial=2.5mm,
parallelone arrow width/.initial=2mm,
parallelone arrow type/.initial=Latex,
parallelone/.style={%
decoration={markings, mark= at position #1 with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow type}[length=pgfkeysvalueof{/tikz/parallelone arrow length},
width=pgfkeysvalueof{/tikz/parallelone arrow width}]}}},
postaction={decorate}
},
parallelone/.default=0.5
}

begin{tikzpicture}
draw[parallelone] (0,0)--(4,4);
% change the length and poisition
draw[parallelone=0.7,parallelone arrow length=5mm] (1,0)--(5,4);
% change the type. the length is back to its initial or default values
draw[parallelone,parallelone arrow type=Stealth] (2,0)--(6,4);
% change the width. the other paraneters are at their initial or deault values
draw[parallelone,parallelone arrow width=5mm] (3,0)--(7,4);
end{tikzpicture}
end{document}


enter image description here



Of course, at a given point you may decide that you do not want to always type parallelone arrow before type, length and so on. This is what key families are for. Then you may only say draw[parallelone={type=Stealth}] if you want to change the type and leave everything else at their default values.



documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone/.style={%
/utils/exec=tikzset{parallelone arrow/.cd,#1},
decoration={markings, mark= at position pgfkeysvalueof{/tikz/parallelone arrow/pos} with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]}}},
postaction={decorate}
},
parallelone/.default={pos=0.5},
parallelone arrow/.is family,
parallelone arrow/.cd,
pos/.initial=0.5,
length/.initial=2.5mm,
width/.initial=2mm,
type/.initial=Latex,
}

begin{tikzpicture}
draw[parallelone] (0,0)--(4,4);
% change the length and poisition
draw[parallelone={pos=0.7,length=5mm}] (1,0)--(5,4);
% change the type. the length is back to its initial or default values
draw[parallelone={type=Stealth}] (2,0)--(6,4);
% change the width. the other parameters are at their initial or deault values
draw[parallelone={width=5mm}] (3,0)--(7,4);
end{tikzpicture}
end{document}


enter image description here



If you want two arrows with the same functionality, you could try



documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone/.style={%
/utils/exec=tikzset{parallelone arrow/.cd,#1},
decoration={markings, mark= at position pgfkeysvalueof{/tikz/parallelone arrow/pos} with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]}}},
postaction={decorate}
},
paralleltwo/.style={%
/utils/exec=tikzset{parallelone arrow/.cd,#1},
decoration={markings, mark= at position pgfkeysvalueof{/tikz/parallelone arrow/pos} with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]%
pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]}}},
postaction={decorate}
},
parallelone/.default={pos=0.5},
parallelone arrow/.is family,
parallelone arrow/.cd,
pos/.initial=0.5,
length/.initial=2.5mm,
width/.initial=2mm,
type/.initial=Latex,
}

begin{tikzpicture}
draw[paralleltwo] (0,0)--(4,4);
% change the length and poisition
draw[parallelone={pos=0.7,length=5mm}] (1,0)--(5,4);
% change the type. the length is back to its initial or default values
draw[parallelone={type=Stealth}] (2,0)--(6,4);
% change the width. the other parameters are at their initial or deault values
draw[parallelone={width=5mm}] (3,0)--(7,4);
end{tikzpicture}
end{document}


enter image description here






share|improve this answer





















  • 1





    I think the OP wants to have something like parallelone=0.3 and 0.7, because as I can see parallelone arrow length is totally not related to parallelone.

    – JouleV
    12 hours ago













  • @JouleV One can do that, yes, but I wouldn't want to do that because you will always have to add the information on all the arrow details if you just want to move the position.

    – marmot
    12 hours ago











  • @marmot Just to clarify: (1) Is arrow[line width=0.5mm] included in the keys? (2) How do I change > to >> ?

    – blackened
    9 hours ago






  • 1





    @blackened [line width=0.5mm] is not included, but it has no effect, I just forgot to drop that key. The arrow is completely determined by the other parameters (in this example). And a double arrow can be obtained as usual, i.e. by repeating arrow, see e.g. at the bottom of p. 210 of the pgfmanual.

    – marmot
    9 hours ago
















1












1








1







Since you are asking about a tutorial, I answer the question in two steps. (IMHO the pgfmanual is an excellent tutorial, in particular when you use it to understand examples that you can find on this site.) You can make an style depend on several parameters. But then you always need to specify all of them if you want to change just one. Therefore, I would like to argue that it is easier to store the parameters in pgfkeys with default value. This leads to



documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone arrow length/.initial=2.5mm,
parallelone arrow width/.initial=2mm,
parallelone arrow type/.initial=Latex,
parallelone/.style={%
decoration={markings, mark= at position #1 with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow type}[length=pgfkeysvalueof{/tikz/parallelone arrow length},
width=pgfkeysvalueof{/tikz/parallelone arrow width}]}}},
postaction={decorate}
},
parallelone/.default=0.5
}

begin{tikzpicture}
draw[parallelone] (0,0)--(4,4);
% change the length and poisition
draw[parallelone=0.7,parallelone arrow length=5mm] (1,0)--(5,4);
% change the type. the length is back to its initial or default values
draw[parallelone,parallelone arrow type=Stealth] (2,0)--(6,4);
% change the width. the other paraneters are at their initial or deault values
draw[parallelone,parallelone arrow width=5mm] (3,0)--(7,4);
end{tikzpicture}
end{document}


enter image description here



Of course, at a given point you may decide that you do not want to always type parallelone arrow before type, length and so on. This is what key families are for. Then you may only say draw[parallelone={type=Stealth}] if you want to change the type and leave everything else at their default values.



documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone/.style={%
/utils/exec=tikzset{parallelone arrow/.cd,#1},
decoration={markings, mark= at position pgfkeysvalueof{/tikz/parallelone arrow/pos} with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]}}},
postaction={decorate}
},
parallelone/.default={pos=0.5},
parallelone arrow/.is family,
parallelone arrow/.cd,
pos/.initial=0.5,
length/.initial=2.5mm,
width/.initial=2mm,
type/.initial=Latex,
}

begin{tikzpicture}
draw[parallelone] (0,0)--(4,4);
% change the length and poisition
draw[parallelone={pos=0.7,length=5mm}] (1,0)--(5,4);
% change the type. the length is back to its initial or default values
draw[parallelone={type=Stealth}] (2,0)--(6,4);
% change the width. the other parameters are at their initial or deault values
draw[parallelone={width=5mm}] (3,0)--(7,4);
end{tikzpicture}
end{document}


enter image description here



If you want two arrows with the same functionality, you could try



documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone/.style={%
/utils/exec=tikzset{parallelone arrow/.cd,#1},
decoration={markings, mark= at position pgfkeysvalueof{/tikz/parallelone arrow/pos} with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]}}},
postaction={decorate}
},
paralleltwo/.style={%
/utils/exec=tikzset{parallelone arrow/.cd,#1},
decoration={markings, mark= at position pgfkeysvalueof{/tikz/parallelone arrow/pos} with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]%
pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]}}},
postaction={decorate}
},
parallelone/.default={pos=0.5},
parallelone arrow/.is family,
parallelone arrow/.cd,
pos/.initial=0.5,
length/.initial=2.5mm,
width/.initial=2mm,
type/.initial=Latex,
}

begin{tikzpicture}
draw[paralleltwo] (0,0)--(4,4);
% change the length and poisition
draw[parallelone={pos=0.7,length=5mm}] (1,0)--(5,4);
% change the type. the length is back to its initial or default values
draw[parallelone={type=Stealth}] (2,0)--(6,4);
% change the width. the other parameters are at their initial or deault values
draw[parallelone={width=5mm}] (3,0)--(7,4);
end{tikzpicture}
end{document}


enter image description here






share|improve this answer















Since you are asking about a tutorial, I answer the question in two steps. (IMHO the pgfmanual is an excellent tutorial, in particular when you use it to understand examples that you can find on this site.) You can make an style depend on several parameters. But then you always need to specify all of them if you want to change just one. Therefore, I would like to argue that it is easier to store the parameters in pgfkeys with default value. This leads to



documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone arrow length/.initial=2.5mm,
parallelone arrow width/.initial=2mm,
parallelone arrow type/.initial=Latex,
parallelone/.style={%
decoration={markings, mark= at position #1 with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow type}[length=pgfkeysvalueof{/tikz/parallelone arrow length},
width=pgfkeysvalueof{/tikz/parallelone arrow width}]}}},
postaction={decorate}
},
parallelone/.default=0.5
}

begin{tikzpicture}
draw[parallelone] (0,0)--(4,4);
% change the length and poisition
draw[parallelone=0.7,parallelone arrow length=5mm] (1,0)--(5,4);
% change the type. the length is back to its initial or default values
draw[parallelone,parallelone arrow type=Stealth] (2,0)--(6,4);
% change the width. the other paraneters are at their initial or deault values
draw[parallelone,parallelone arrow width=5mm] (3,0)--(7,4);
end{tikzpicture}
end{document}


enter image description here



Of course, at a given point you may decide that you do not want to always type parallelone arrow before type, length and so on. This is what key families are for. Then you may only say draw[parallelone={type=Stealth}] if you want to change the type and leave everything else at their default values.



documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone/.style={%
/utils/exec=tikzset{parallelone arrow/.cd,#1},
decoration={markings, mark= at position pgfkeysvalueof{/tikz/parallelone arrow/pos} with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]}}},
postaction={decorate}
},
parallelone/.default={pos=0.5},
parallelone arrow/.is family,
parallelone arrow/.cd,
pos/.initial=0.5,
length/.initial=2.5mm,
width/.initial=2mm,
type/.initial=Latex,
}

begin{tikzpicture}
draw[parallelone] (0,0)--(4,4);
% change the length and poisition
draw[parallelone={pos=0.7,length=5mm}] (1,0)--(5,4);
% change the type. the length is back to its initial or default values
draw[parallelone={type=Stealth}] (2,0)--(6,4);
% change the width. the other parameters are at their initial or deault values
draw[parallelone={width=5mm}] (3,0)--(7,4);
end{tikzpicture}
end{document}


enter image description here



If you want two arrows with the same functionality, you could try



documentclass[tikz,border=10pt]{standalone}
usepackage{tikz}
usetikzlibrary{decorations.markings}
usetikzlibrary{arrows.meta}
begin{document}

tikzset{%
parallelone/.style={%
/utils/exec=tikzset{parallelone arrow/.cd,#1},
decoration={markings, mark= at position pgfkeysvalueof{/tikz/parallelone arrow/pos} with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]}}},
postaction={decorate}
},
paralleltwo/.style={%
/utils/exec=tikzset{parallelone arrow/.cd,#1},
decoration={markings, mark= at position pgfkeysvalueof{/tikz/parallelone arrow/pos} with
{arrow{pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]%
pgfkeysvalueof{/tikz/parallelone arrow/type}[%
length=pgfkeysvalueof{/tikz/parallelone arrow/length},%
width=pgfkeysvalueof{/tikz/parallelone arrow/width}]}}},
postaction={decorate}
},
parallelone/.default={pos=0.5},
parallelone arrow/.is family,
parallelone arrow/.cd,
pos/.initial=0.5,
length/.initial=2.5mm,
width/.initial=2mm,
type/.initial=Latex,
}

begin{tikzpicture}
draw[paralleltwo] (0,0)--(4,4);
% change the length and poisition
draw[parallelone={pos=0.7,length=5mm}] (1,0)--(5,4);
% change the type. the length is back to its initial or default values
draw[parallelone={type=Stealth}] (2,0)--(6,4);
% change the width. the other parameters are at their initial or deault values
draw[parallelone={width=5mm}] (3,0)--(7,4);
end{tikzpicture}
end{document}


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 9 hours ago

























answered 12 hours ago









marmotmarmot

105k4126241




105k4126241








  • 1





    I think the OP wants to have something like parallelone=0.3 and 0.7, because as I can see parallelone arrow length is totally not related to parallelone.

    – JouleV
    12 hours ago













  • @JouleV One can do that, yes, but I wouldn't want to do that because you will always have to add the information on all the arrow details if you just want to move the position.

    – marmot
    12 hours ago











  • @marmot Just to clarify: (1) Is arrow[line width=0.5mm] included in the keys? (2) How do I change > to >> ?

    – blackened
    9 hours ago






  • 1





    @blackened [line width=0.5mm] is not included, but it has no effect, I just forgot to drop that key. The arrow is completely determined by the other parameters (in this example). And a double arrow can be obtained as usual, i.e. by repeating arrow, see e.g. at the bottom of p. 210 of the pgfmanual.

    – marmot
    9 hours ago
















  • 1





    I think the OP wants to have something like parallelone=0.3 and 0.7, because as I can see parallelone arrow length is totally not related to parallelone.

    – JouleV
    12 hours ago













  • @JouleV One can do that, yes, but I wouldn't want to do that because you will always have to add the information on all the arrow details if you just want to move the position.

    – marmot
    12 hours ago











  • @marmot Just to clarify: (1) Is arrow[line width=0.5mm] included in the keys? (2) How do I change > to >> ?

    – blackened
    9 hours ago






  • 1





    @blackened [line width=0.5mm] is not included, but it has no effect, I just forgot to drop that key. The arrow is completely determined by the other parameters (in this example). And a double arrow can be obtained as usual, i.e. by repeating arrow, see e.g. at the bottom of p. 210 of the pgfmanual.

    – marmot
    9 hours ago










1




1





I think the OP wants to have something like parallelone=0.3 and 0.7, because as I can see parallelone arrow length is totally not related to parallelone.

– JouleV
12 hours ago







I think the OP wants to have something like parallelone=0.3 and 0.7, because as I can see parallelone arrow length is totally not related to parallelone.

– JouleV
12 hours ago















@JouleV One can do that, yes, but I wouldn't want to do that because you will always have to add the information on all the arrow details if you just want to move the position.

– marmot
12 hours ago





@JouleV One can do that, yes, but I wouldn't want to do that because you will always have to add the information on all the arrow details if you just want to move the position.

– marmot
12 hours ago













@marmot Just to clarify: (1) Is arrow[line width=0.5mm] included in the keys? (2) How do I change > to >> ?

– blackened
9 hours ago





@marmot Just to clarify: (1) Is arrow[line width=0.5mm] included in the keys? (2) How do I change > to >> ?

– blackened
9 hours ago




1




1





@blackened [line width=0.5mm] is not included, but it has no effect, I just forgot to drop that key. The arrow is completely determined by the other parameters (in this example). And a double arrow can be obtained as usual, i.e. by repeating arrow, see e.g. at the bottom of p. 210 of the pgfmanual.

– marmot
9 hours ago







@blackened [line width=0.5mm] is not included, but it has no effect, I just forgot to drop that key. The arrow is completely determined by the other parameters (in this example). And a double arrow can be obtained as usual, i.e. by repeating arrow, see e.g. at the bottom of p. 210 of the pgfmanual.

– marmot
9 hours 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%2f477565%2ftikzset-with-with-more-than-one-defaults%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

Why does my Macbook overheat and use so much CPU and energy when on YouTube?Why do so many insist on using...

Puerta de Hutt Referencias Enlaces externos Menú de navegación15°58′00″S 5°42′00″O /...

How to prevent page numbers from appearing on glossaries?How to remove a dot and a page number in the...