Call for node distance as a variable in TikZ
Is it possible to use the node distance as a variable while expressing coordinates of new nodes with Calc and Positioning libraries? What I want to have is everything within a single piece of code for tikz picture.
This is what I have now.
documentclass[12pt, a4paper]{article}
usepackage{tikz}
usetikzlibrary{automata, positioning, arrows,calc}
begin{document}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,node distance=2cm,semithick,on grid]
tikzstyle{every state}=[minimum size=20pt, fill=none,draw=black]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(1/3)*4*(0:1cm) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(1/3)*4*(-60:1cm)$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
end{document}
I would like to be able to change the below expression with something like:
$(a) + sqrt(1/3)*2*(1:nodedistance)$
Then if I would be copying the code elsewhere, such as a presentations, I would be able to change all these distances at once. Is that possible? If not, introducing a variable in the first line of the TikZ code, and using it afterwards instead the "nodedistance", would also do.
Sorry if it's a dull question, I'm pretty new to TikZ.
tikz-pgf positioning nodes calc
New contributor
add a comment |
Is it possible to use the node distance as a variable while expressing coordinates of new nodes with Calc and Positioning libraries? What I want to have is everything within a single piece of code for tikz picture.
This is what I have now.
documentclass[12pt, a4paper]{article}
usepackage{tikz}
usetikzlibrary{automata, positioning, arrows,calc}
begin{document}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,node distance=2cm,semithick,on grid]
tikzstyle{every state}=[minimum size=20pt, fill=none,draw=black]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(1/3)*4*(0:1cm) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(1/3)*4*(-60:1cm)$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
end{document}
I would like to be able to change the below expression with something like:
$(a) + sqrt(1/3)*2*(1:nodedistance)$
Then if I would be copying the code elsewhere, such as a presentations, I would be able to change all these distances at once. Is that possible? If not, introducing a variable in the first line of the TikZ code, and using it afterwards instead the "nodedistance", would also do.
Sorry if it's a dull question, I'm pretty new to TikZ.
tikz-pgf positioning nodes calc
New contributor
Welcome to TeX.SE! This is not at all a dumb question. Are you aware of this post, I guess that/tikz/node distance/.append code={...}
does what you want. This allows you to store the distance in a key that you can use.
– marmot
6 hours ago
add a comment |
Is it possible to use the node distance as a variable while expressing coordinates of new nodes with Calc and Positioning libraries? What I want to have is everything within a single piece of code for tikz picture.
This is what I have now.
documentclass[12pt, a4paper]{article}
usepackage{tikz}
usetikzlibrary{automata, positioning, arrows,calc}
begin{document}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,node distance=2cm,semithick,on grid]
tikzstyle{every state}=[minimum size=20pt, fill=none,draw=black]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(1/3)*4*(0:1cm) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(1/3)*4*(-60:1cm)$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
end{document}
I would like to be able to change the below expression with something like:
$(a) + sqrt(1/3)*2*(1:nodedistance)$
Then if I would be copying the code elsewhere, such as a presentations, I would be able to change all these distances at once. Is that possible? If not, introducing a variable in the first line of the TikZ code, and using it afterwards instead the "nodedistance", would also do.
Sorry if it's a dull question, I'm pretty new to TikZ.
tikz-pgf positioning nodes calc
New contributor
Is it possible to use the node distance as a variable while expressing coordinates of new nodes with Calc and Positioning libraries? What I want to have is everything within a single piece of code for tikz picture.
This is what I have now.
documentclass[12pt, a4paper]{article}
usepackage{tikz}
usetikzlibrary{automata, positioning, arrows,calc}
begin{document}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,node distance=2cm,semithick,on grid]
tikzstyle{every state}=[minimum size=20pt, fill=none,draw=black]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(1/3)*4*(0:1cm) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(1/3)*4*(-60:1cm)$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
end{document}
I would like to be able to change the below expression with something like:
$(a) + sqrt(1/3)*2*(1:nodedistance)$
Then if I would be copying the code elsewhere, such as a presentations, I would be able to change all these distances at once. Is that possible? If not, introducing a variable in the first line of the TikZ code, and using it afterwards instead the "nodedistance", would also do.
Sorry if it's a dull question, I'm pretty new to TikZ.
tikz-pgf positioning nodes calc
tikz-pgf positioning nodes calc
New contributor
New contributor
New contributor
asked 7 hours ago
garigari
262
262
New contributor
New contributor
Welcome to TeX.SE! This is not at all a dumb question. Are you aware of this post, I guess that/tikz/node distance/.append code={...}
does what you want. This allows you to store the distance in a key that you can use.
– marmot
6 hours ago
add a comment |
Welcome to TeX.SE! This is not at all a dumb question. Are you aware of this post, I guess that/tikz/node distance/.append code={...}
does what you want. This allows you to store the distance in a key that you can use.
– marmot
6 hours ago
Welcome to TeX.SE! This is not at all a dumb question. Are you aware of this post, I guess that
/tikz/node distance/.append code={...}
does what you want. This allows you to store the distance in a key that you can use.– marmot
6 hours ago
Welcome to TeX.SE! This is not at all a dumb question. Are you aware of this post, I guess that
/tikz/node distance/.append code={...}
does what you want. This allows you to store the distance in a key that you can use.– marmot
6 hours ago
add a comment |
2 Answers
2
active
oldest
votes
AFAIK you cannot simply read off the value of /tikz/node distance
. However, in this great answer by @Jake there is a simple way to amend node distance
by a pgf key that you can use.
documentclass[12pt, a4paper]{article}
usepackage{tikz}
usetikzlibrary{automata, positioning, arrows,calc}
tikzset{node distance/.append code={
pgfkeyssetvalue{/tikz/node distance value}{#1}
}}
begin{document}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,node
distance=2cm,semithick,on grid,
every state/.style={minimum size=20pt, fill=none,draw=black}]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(4/3)*(0:pgfkeysvalueof{/tikz/node distance value}) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(4/3)*(-60:pgfkeysvalueof{/tikz/node distance value})$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
end{document}
add a comment |
You can create a macro defnodedistance{1cm}
at the begining of the tikzpicture
. Later if needed this macro could be redefined .
documentclass[12pt, a4paper]{article}
usepackage{tikz}
usetikzlibrary{automata, positioning, arrows,calc}
begin{document}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,semithick,on grid]
defnodedistance{1cm} % <------------
tikzstyle{every state}=[minimum size=20pt, fill=none,draw=black]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(1/3)*4*(0:nodedistance) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(1/3)*4*(-60:nodedistance)$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,semithick,on grid]
defnodedistance{2cm} % <----------------
tikzstyle{every state}=[minimum size=20pt, fill=none,draw=black]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(1/3)*4*(0:nodedistance) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(1/3)*4*(-60:nodedistance)$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
end{document}
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
});
}
});
gari is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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%2f473114%2fcall-for-node-distance-as-a-variable-in-tikz%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
AFAIK you cannot simply read off the value of /tikz/node distance
. However, in this great answer by @Jake there is a simple way to amend node distance
by a pgf key that you can use.
documentclass[12pt, a4paper]{article}
usepackage{tikz}
usetikzlibrary{automata, positioning, arrows,calc}
tikzset{node distance/.append code={
pgfkeyssetvalue{/tikz/node distance value}{#1}
}}
begin{document}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,node
distance=2cm,semithick,on grid,
every state/.style={minimum size=20pt, fill=none,draw=black}]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(4/3)*(0:pgfkeysvalueof{/tikz/node distance value}) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(4/3)*(-60:pgfkeysvalueof{/tikz/node distance value})$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
end{document}
add a comment |
AFAIK you cannot simply read off the value of /tikz/node distance
. However, in this great answer by @Jake there is a simple way to amend node distance
by a pgf key that you can use.
documentclass[12pt, a4paper]{article}
usepackage{tikz}
usetikzlibrary{automata, positioning, arrows,calc}
tikzset{node distance/.append code={
pgfkeyssetvalue{/tikz/node distance value}{#1}
}}
begin{document}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,node
distance=2cm,semithick,on grid,
every state/.style={minimum size=20pt, fill=none,draw=black}]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(4/3)*(0:pgfkeysvalueof{/tikz/node distance value}) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(4/3)*(-60:pgfkeysvalueof{/tikz/node distance value})$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
end{document}
add a comment |
AFAIK you cannot simply read off the value of /tikz/node distance
. However, in this great answer by @Jake there is a simple way to amend node distance
by a pgf key that you can use.
documentclass[12pt, a4paper]{article}
usepackage{tikz}
usetikzlibrary{automata, positioning, arrows,calc}
tikzset{node distance/.append code={
pgfkeyssetvalue{/tikz/node distance value}{#1}
}}
begin{document}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,node
distance=2cm,semithick,on grid,
every state/.style={minimum size=20pt, fill=none,draw=black}]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(4/3)*(0:pgfkeysvalueof{/tikz/node distance value}) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(4/3)*(-60:pgfkeysvalueof{/tikz/node distance value})$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
end{document}
AFAIK you cannot simply read off the value of /tikz/node distance
. However, in this great answer by @Jake there is a simple way to amend node distance
by a pgf key that you can use.
documentclass[12pt, a4paper]{article}
usepackage{tikz}
usetikzlibrary{automata, positioning, arrows,calc}
tikzset{node distance/.append code={
pgfkeyssetvalue{/tikz/node distance value}{#1}
}}
begin{document}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,node
distance=2cm,semithick,on grid,
every state/.style={minimum size=20pt, fill=none,draw=black}]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(4/3)*(0:pgfkeysvalueof{/tikz/node distance value}) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(4/3)*(-60:pgfkeysvalueof{/tikz/node distance value})$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
end{document}
answered 6 hours ago
marmotmarmot
96.7k4111213
96.7k4111213
add a comment |
add a comment |
You can create a macro defnodedistance{1cm}
at the begining of the tikzpicture
. Later if needed this macro could be redefined .
documentclass[12pt, a4paper]{article}
usepackage{tikz}
usetikzlibrary{automata, positioning, arrows,calc}
begin{document}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,semithick,on grid]
defnodedistance{1cm} % <------------
tikzstyle{every state}=[minimum size=20pt, fill=none,draw=black]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(1/3)*4*(0:nodedistance) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(1/3)*4*(-60:nodedistance)$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,semithick,on grid]
defnodedistance{2cm} % <----------------
tikzstyle{every state}=[minimum size=20pt, fill=none,draw=black]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(1/3)*4*(0:nodedistance) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(1/3)*4*(-60:nodedistance)$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
end{document}
add a comment |
You can create a macro defnodedistance{1cm}
at the begining of the tikzpicture
. Later if needed this macro could be redefined .
documentclass[12pt, a4paper]{article}
usepackage{tikz}
usetikzlibrary{automata, positioning, arrows,calc}
begin{document}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,semithick,on grid]
defnodedistance{1cm} % <------------
tikzstyle{every state}=[minimum size=20pt, fill=none,draw=black]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(1/3)*4*(0:nodedistance) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(1/3)*4*(-60:nodedistance)$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,semithick,on grid]
defnodedistance{2cm} % <----------------
tikzstyle{every state}=[minimum size=20pt, fill=none,draw=black]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(1/3)*4*(0:nodedistance) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(1/3)*4*(-60:nodedistance)$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
end{document}
add a comment |
You can create a macro defnodedistance{1cm}
at the begining of the tikzpicture
. Later if needed this macro could be redefined .
documentclass[12pt, a4paper]{article}
usepackage{tikz}
usetikzlibrary{automata, positioning, arrows,calc}
begin{document}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,semithick,on grid]
defnodedistance{1cm} % <------------
tikzstyle{every state}=[minimum size=20pt, fill=none,draw=black]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(1/3)*4*(0:nodedistance) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(1/3)*4*(-60:nodedistance)$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,semithick,on grid]
defnodedistance{2cm} % <----------------
tikzstyle{every state}=[minimum size=20pt, fill=none,draw=black]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(1/3)*4*(0:nodedistance) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(1/3)*4*(-60:nodedistance)$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
end{document}
You can create a macro defnodedistance{1cm}
at the begining of the tikzpicture
. Later if needed this macro could be redefined .
documentclass[12pt, a4paper]{article}
usepackage{tikz}
usetikzlibrary{automata, positioning, arrows,calc}
begin{document}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,semithick,on grid]
defnodedistance{1cm} % <------------
tikzstyle{every state}=[minimum size=20pt, fill=none,draw=black]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(1/3)*4*(0:nodedistance) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(1/3)*4*(-60:nodedistance)$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
begin{tikzpicture}[>=stealth',shorten >=0.5pt,auto,semithick,on grid]
defnodedistance{2cm} % <----------------
tikzstyle{every state}=[minimum size=20pt, fill=none,draw=black]
node[state,label=center:$a$,inner sep=0pt] (a) {};
node[state,label=center:$b$] (b) at ($(a) + sqrt(1/3)*4*(0:nodedistance) $) {};
node[state,label=center:$c$] (c) at ($(a) + sqrt(1/3)*4*(-60:nodedistance)$) {};
path[->] (a) edge node {$1$} (b)
(c) edge node[right] {$1$} (b)
(b) edge [loop right] node[above] {$0,1$} (b);
path[shorten <=0.5pt,<->] (a) edge node[left]{$0$} (c);
end{tikzpicture}
end{document}
edited 18 mins ago
answered 26 mins ago
Hafid BoukhouldaHafid Boukhoulda
2,9271520
2,9271520
add a comment |
add a comment |
gari is a new contributor. Be nice, and check out our Code of Conduct.
gari is a new contributor. Be nice, and check out our Code of Conduct.
gari is a new contributor. Be nice, and check out our Code of Conduct.
gari is a new contributor. Be nice, and check out our Code of Conduct.
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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%2f473114%2fcall-for-node-distance-as-a-variable-in-tikz%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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
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
Welcome to TeX.SE! This is not at all a dumb question. Are you aware of this post, I guess that
/tikz/node distance/.append code={...}
does what you want. This allows you to store the distance in a key that you can use.– marmot
6 hours ago