Moving a point along a “multi-node path”How can I fix jumping TikZ pictures in beamer?Draw an animated gif of trigonometry functionIncrease the thickness of node border in TikZHow to define the default vertical distance between nodes?Preserve node and font size when scalingTikZ scaling graphic and adjust node position and keep font sizeInput/Output Nodes - Specification and Description LanguageTikZ: Drawing an arc from an intersection to an intersectionDraw nodes with path in tikzLine up nested tikz enviroments or how to get rid of themThe order of execution of options (draw & font), pgfextra, and a node along a TikZ pathInclude node at end point tikz decorations
What does it mean by "d-ism of Leibniz" and "dotage of Newton" in simple English?
Is there a rule that prohibits us from using 2 possessives in a row?
Computing the differentials in the Adams spectral sequence
What is the correct expression of 10/20, 20/30, 30/40 etc?
Will dual-learning in a glider make my airplane learning safer?
How can Iron Man's suit withstand this?
Can an old DSLR be upgraded to match modern smartphone image quality
Credit card offering 0.5 miles for every cent rounded up. Too good to be true?
What happens if you do emergency landing on a US base in middle of the ocean?
Access to all elements on the page
Accidentally cashed a check twice
Is it OK to bring delicacies from hometown as tokens of gratitude for an out-of-town interview?
PhD student with mental health issues and bad performance
Chopin: marche funèbre bar 15 impossible place
Could a guilty Boris Johnson be used to cancel Brexit?
Anyone teach web development? How do you assess it?
Is it a problem that pull requests are approved without any comments
Why were the Night's Watch required to be celibate?
Unconventional Opposites
You've spoiled/damaged the card
Setting extra bits in a bool makes it true and false at the same time
What is a simple, physical situation where complex numbers emerge naturally?
Explain Ant-Man's "not it" scene from Avengers: Endgame
Get value of the passed argument to script importing variables from another script
Moving a point along a “multi-node path”
How can I fix jumping TikZ pictures in beamer?Draw an animated gif of trigonometry functionIncrease the thickness of node border in TikZHow to define the default vertical distance between nodes?Preserve node and font size when scalingTikZ scaling graphic and adjust node position and keep font sizeInput/Output Nodes - Specification and Description LanguageTikZ: Drawing an arc from an intersection to an intersectionDraw nodes with path in tikzLine up nested tikz enviroments or how to get rid of themThe order of execution of options (draw & font), pgfextra, and a node along a TikZ pathInclude node at end point tikz decorations
I would like to create a gif (as explained in this answer) of a point moving along a crooked "multi-node path". I would like this path to be specified as below: a sequence of nodes connected by edges. In the iteration I would like to specify nodes along this "multi-node path" as in node[pos=n, above] x
.
I have a solution but it's not easily scalable: if I want more nodes along the path I have to change it by hand. Also there is a problem with the window shifting up and down as the point moves along the path.
I could do this by having as many for loops as there are edges, and placing the node[pos=n, above] x
on the relevant edge every time, but I'd like to have a more generic solution where I don't have to know in advance how long the "multi-node path" will be, something like the following (which doesn't work):
documentclass[tikz]standalone
usepackagetikz
usetikzlibraryintersections
begindocument
foreach n in 0,0.05,...,1
begintikzpicture
draw[name path=mypath]
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
draw (mypath) node [draw=black, fill=red, circle]
node [pos=n, above] x;
endtikzpicture
enddocument
My current solution is ugly :( :
documentclass[tikz, border=.5cm]standalone
usepackagetikz
begindocument
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,-4);
endtikzpicture
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- node [circle, fill=red, draw=black, pos=1, inner sep = 0, minimum size = 4pt] node [pos=1, above] x ++ (1,-4);
endtikzpicture
enddocument
tikz-pgf positioning tikz-path
add a comment |
I would like to create a gif (as explained in this answer) of a point moving along a crooked "multi-node path". I would like this path to be specified as below: a sequence of nodes connected by edges. In the iteration I would like to specify nodes along this "multi-node path" as in node[pos=n, above] x
.
I have a solution but it's not easily scalable: if I want more nodes along the path I have to change it by hand. Also there is a problem with the window shifting up and down as the point moves along the path.
I could do this by having as many for loops as there are edges, and placing the node[pos=n, above] x
on the relevant edge every time, but I'd like to have a more generic solution where I don't have to know in advance how long the "multi-node path" will be, something like the following (which doesn't work):
documentclass[tikz]standalone
usepackagetikz
usetikzlibraryintersections
begindocument
foreach n in 0,0.05,...,1
begintikzpicture
draw[name path=mypath]
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
draw (mypath) node [draw=black, fill=red, circle]
node [pos=n, above] x;
endtikzpicture
enddocument
My current solution is ugly :( :
documentclass[tikz, border=.5cm]standalone
usepackagetikz
begindocument
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,-4);
endtikzpicture
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- node [circle, fill=red, draw=black, pos=1, inner sep = 0, minimum size = 4pt] node [pos=1, above] x ++ (1,-4);
endtikzpicture
enddocument
tikz-pgf positioning tikz-path
add a comment |
I would like to create a gif (as explained in this answer) of a point moving along a crooked "multi-node path". I would like this path to be specified as below: a sequence of nodes connected by edges. In the iteration I would like to specify nodes along this "multi-node path" as in node[pos=n, above] x
.
I have a solution but it's not easily scalable: if I want more nodes along the path I have to change it by hand. Also there is a problem with the window shifting up and down as the point moves along the path.
I could do this by having as many for loops as there are edges, and placing the node[pos=n, above] x
on the relevant edge every time, but I'd like to have a more generic solution where I don't have to know in advance how long the "multi-node path" will be, something like the following (which doesn't work):
documentclass[tikz]standalone
usepackagetikz
usetikzlibraryintersections
begindocument
foreach n in 0,0.05,...,1
begintikzpicture
draw[name path=mypath]
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
draw (mypath) node [draw=black, fill=red, circle]
node [pos=n, above] x;
endtikzpicture
enddocument
My current solution is ugly :( :
documentclass[tikz, border=.5cm]standalone
usepackagetikz
begindocument
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,-4);
endtikzpicture
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- node [circle, fill=red, draw=black, pos=1, inner sep = 0, minimum size = 4pt] node [pos=1, above] x ++ (1,-4);
endtikzpicture
enddocument
tikz-pgf positioning tikz-path
I would like to create a gif (as explained in this answer) of a point moving along a crooked "multi-node path". I would like this path to be specified as below: a sequence of nodes connected by edges. In the iteration I would like to specify nodes along this "multi-node path" as in node[pos=n, above] x
.
I have a solution but it's not easily scalable: if I want more nodes along the path I have to change it by hand. Also there is a problem with the window shifting up and down as the point moves along the path.
I could do this by having as many for loops as there are edges, and placing the node[pos=n, above] x
on the relevant edge every time, but I'd like to have a more generic solution where I don't have to know in advance how long the "multi-node path" will be, something like the following (which doesn't work):
documentclass[tikz]standalone
usepackagetikz
usetikzlibraryintersections
begindocument
foreach n in 0,0.05,...,1
begintikzpicture
draw[name path=mypath]
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
draw (mypath) node [draw=black, fill=red, circle]
node [pos=n, above] x;
endtikzpicture
enddocument
My current solution is ugly :( :
documentclass[tikz, border=.5cm]standalone
usepackagetikz
begindocument
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,0)
-- ++ (1,-4);
endtikzpicture
foreach n in 0,0.1,...,.9
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- node [circle, fill=red, draw=black, pos=n, inner sep = 0, minimum size = 4pt] node [pos=n, above] x ++ (1,-4);
endtikzpicture
begintikzpicture
draw
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- node [circle, fill=red, draw=black, pos=1, inner sep = 0, minimum size = 4pt] node [pos=1, above] x ++ (1,-4);
endtikzpicture
enddocument
tikz-pgf positioning tikz-path
tikz-pgf positioning tikz-path
edited May 25 at 0:13
Olivier Bégassat
asked May 24 at 23:59
Olivier BégassatOlivier Bégassat
91721019
91721019
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Use decorations.markings
and the overlay
option. The overlay
option pretends that the object has zero size and therefore doesn't add to the bounding box. Because the nodes are now going outside the bounding box of the path, you have to add a border around the drawing so it doesn't fall off the page.
documentclass[tikz,border=10pt]standalone
usepackagetikz
usetikzlibrarydecorations.markings
begindocument
foreach n in 0,0.05,...,1
begintikzpicture
draw
[postaction=decorate,
decoration=
markings,
mark=at position n with
draw [overlay, draw=black, fill=red] circle (2pt);
node [overlay, above] x;
]
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
enddocument
Excellent :) Thank you!
– Olivier Bégassat
May 25 at 8:58
add a comment |
Very similar to Henri Menke's great answer with a small tilt: the bounding box gets recorded and the maximal bounding box of all iterations gets applied. You need to compile twice that it works. The code is more complex but the bounding box gets only increased in the directions in which it is needed. This code is somewhat similar to this nice answer which addresses a similar problem.
documentclass[tikz]standalone
usetikzlibrarydecorations.markings,calc
begindocument
pgfmathsetmacroxmin0
pgfmathsetmacroxmax0
pgfmathsetmacroymin0
pgfmathsetmacroymax0
foreach X in 0,0.05,...,1
begintikzpicture
ifdefinedfigbbrelax
path figbb;
fi
draw
[postaction=decorate,
decoration=
markings,
mark=at position X with
node [circle,inner sep=2pt,draw,fill=red,label=above:$x$];
]
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
path let p1=(current bounding box.south west),
p2=(current bounding box.north east)
in pgfextra%
pgfmathsetmacroxminmin(x1,xmin)
pgfmathsetmacroxmaxmax(x2,xmax)
pgfmathsetmacroyminmin(y1,ymin)
pgfmathsetmacroymaxmax(y2,ymax)
xdefxminxmin pt
xdefxmaxxmax pt
xdefyminymin pt
xdefymaxymax pt
;
endtikzpicture
makeatletter
edeffigbb(xmin,ymin) rectangle (xmax,ymax)
immediatewrite@mainauxxdefstringfigbbfigbbrelax
makeatother
enddocument
Thank you marmot :)
– Olivier Bégassat
May 25 at 8:59
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%2f492532%2fmoving-a-point-along-a-multi-node-path%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
Use decorations.markings
and the overlay
option. The overlay
option pretends that the object has zero size and therefore doesn't add to the bounding box. Because the nodes are now going outside the bounding box of the path, you have to add a border around the drawing so it doesn't fall off the page.
documentclass[tikz,border=10pt]standalone
usepackagetikz
usetikzlibrarydecorations.markings
begindocument
foreach n in 0,0.05,...,1
begintikzpicture
draw
[postaction=decorate,
decoration=
markings,
mark=at position n with
draw [overlay, draw=black, fill=red] circle (2pt);
node [overlay, above] x;
]
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
enddocument
Excellent :) Thank you!
– Olivier Bégassat
May 25 at 8:58
add a comment |
Use decorations.markings
and the overlay
option. The overlay
option pretends that the object has zero size and therefore doesn't add to the bounding box. Because the nodes are now going outside the bounding box of the path, you have to add a border around the drawing so it doesn't fall off the page.
documentclass[tikz,border=10pt]standalone
usepackagetikz
usetikzlibrarydecorations.markings
begindocument
foreach n in 0,0.05,...,1
begintikzpicture
draw
[postaction=decorate,
decoration=
markings,
mark=at position n with
draw [overlay, draw=black, fill=red] circle (2pt);
node [overlay, above] x;
]
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
enddocument
Excellent :) Thank you!
– Olivier Bégassat
May 25 at 8:58
add a comment |
Use decorations.markings
and the overlay
option. The overlay
option pretends that the object has zero size and therefore doesn't add to the bounding box. Because the nodes are now going outside the bounding box of the path, you have to add a border around the drawing so it doesn't fall off the page.
documentclass[tikz,border=10pt]standalone
usepackagetikz
usetikzlibrarydecorations.markings
begindocument
foreach n in 0,0.05,...,1
begintikzpicture
draw
[postaction=decorate,
decoration=
markings,
mark=at position n with
draw [overlay, draw=black, fill=red] circle (2pt);
node [overlay, above] x;
]
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
enddocument
Use decorations.markings
and the overlay
option. The overlay
option pretends that the object has zero size and therefore doesn't add to the bounding box. Because the nodes are now going outside the bounding box of the path, you have to add a border around the drawing so it doesn't fall off the page.
documentclass[tikz,border=10pt]standalone
usepackagetikz
usetikzlibrarydecorations.markings
begindocument
foreach n in 0,0.05,...,1
begintikzpicture
draw
[postaction=decorate,
decoration=
markings,
mark=at position n with
draw [overlay, draw=black, fill=red] circle (2pt);
node [overlay, above] x;
]
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
endtikzpicture
enddocument
answered May 25 at 2:42
Henri MenkeHenri Menke
79.7k9175288
79.7k9175288
Excellent :) Thank you!
– Olivier Bégassat
May 25 at 8:58
add a comment |
Excellent :) Thank you!
– Olivier Bégassat
May 25 at 8:58
Excellent :) Thank you!
– Olivier Bégassat
May 25 at 8:58
Excellent :) Thank you!
– Olivier Bégassat
May 25 at 8:58
add a comment |
Very similar to Henri Menke's great answer with a small tilt: the bounding box gets recorded and the maximal bounding box of all iterations gets applied. You need to compile twice that it works. The code is more complex but the bounding box gets only increased in the directions in which it is needed. This code is somewhat similar to this nice answer which addresses a similar problem.
documentclass[tikz]standalone
usetikzlibrarydecorations.markings,calc
begindocument
pgfmathsetmacroxmin0
pgfmathsetmacroxmax0
pgfmathsetmacroymin0
pgfmathsetmacroymax0
foreach X in 0,0.05,...,1
begintikzpicture
ifdefinedfigbbrelax
path figbb;
fi
draw
[postaction=decorate,
decoration=
markings,
mark=at position X with
node [circle,inner sep=2pt,draw,fill=red,label=above:$x$];
]
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
path let p1=(current bounding box.south west),
p2=(current bounding box.north east)
in pgfextra%
pgfmathsetmacroxminmin(x1,xmin)
pgfmathsetmacroxmaxmax(x2,xmax)
pgfmathsetmacroyminmin(y1,ymin)
pgfmathsetmacroymaxmax(y2,ymax)
xdefxminxmin pt
xdefxmaxxmax pt
xdefyminymin pt
xdefymaxymax pt
;
endtikzpicture
makeatletter
edeffigbb(xmin,ymin) rectangle (xmax,ymax)
immediatewrite@mainauxxdefstringfigbbfigbbrelax
makeatother
enddocument
Thank you marmot :)
– Olivier Bégassat
May 25 at 8:59
add a comment |
Very similar to Henri Menke's great answer with a small tilt: the bounding box gets recorded and the maximal bounding box of all iterations gets applied. You need to compile twice that it works. The code is more complex but the bounding box gets only increased in the directions in which it is needed. This code is somewhat similar to this nice answer which addresses a similar problem.
documentclass[tikz]standalone
usetikzlibrarydecorations.markings,calc
begindocument
pgfmathsetmacroxmin0
pgfmathsetmacroxmax0
pgfmathsetmacroymin0
pgfmathsetmacroymax0
foreach X in 0,0.05,...,1
begintikzpicture
ifdefinedfigbbrelax
path figbb;
fi
draw
[postaction=decorate,
decoration=
markings,
mark=at position X with
node [circle,inner sep=2pt,draw,fill=red,label=above:$x$];
]
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
path let p1=(current bounding box.south west),
p2=(current bounding box.north east)
in pgfextra%
pgfmathsetmacroxminmin(x1,xmin)
pgfmathsetmacroxmaxmax(x2,xmax)
pgfmathsetmacroyminmin(y1,ymin)
pgfmathsetmacroymaxmax(y2,ymax)
xdefxminxmin pt
xdefxmaxxmax pt
xdefyminymin pt
xdefymaxymax pt
;
endtikzpicture
makeatletter
edeffigbb(xmin,ymin) rectangle (xmax,ymax)
immediatewrite@mainauxxdefstringfigbbfigbbrelax
makeatother
enddocument
Thank you marmot :)
– Olivier Bégassat
May 25 at 8:59
add a comment |
Very similar to Henri Menke's great answer with a small tilt: the bounding box gets recorded and the maximal bounding box of all iterations gets applied. You need to compile twice that it works. The code is more complex but the bounding box gets only increased in the directions in which it is needed. This code is somewhat similar to this nice answer which addresses a similar problem.
documentclass[tikz]standalone
usetikzlibrarydecorations.markings,calc
begindocument
pgfmathsetmacroxmin0
pgfmathsetmacroxmax0
pgfmathsetmacroymin0
pgfmathsetmacroymax0
foreach X in 0,0.05,...,1
begintikzpicture
ifdefinedfigbbrelax
path figbb;
fi
draw
[postaction=decorate,
decoration=
markings,
mark=at position X with
node [circle,inner sep=2pt,draw,fill=red,label=above:$x$];
]
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
path let p1=(current bounding box.south west),
p2=(current bounding box.north east)
in pgfextra%
pgfmathsetmacroxminmin(x1,xmin)
pgfmathsetmacroxmaxmax(x2,xmax)
pgfmathsetmacroyminmin(y1,ymin)
pgfmathsetmacroymaxmax(y2,ymax)
xdefxminxmin pt
xdefxmaxxmax pt
xdefyminymin pt
xdefymaxymax pt
;
endtikzpicture
makeatletter
edeffigbb(xmin,ymin) rectangle (xmax,ymax)
immediatewrite@mainauxxdefstringfigbbfigbbrelax
makeatother
enddocument
Very similar to Henri Menke's great answer with a small tilt: the bounding box gets recorded and the maximal bounding box of all iterations gets applied. You need to compile twice that it works. The code is more complex but the bounding box gets only increased in the directions in which it is needed. This code is somewhat similar to this nice answer which addresses a similar problem.
documentclass[tikz]standalone
usetikzlibrarydecorations.markings,calc
begindocument
pgfmathsetmacroxmin0
pgfmathsetmacroxmax0
pgfmathsetmacroymin0
pgfmathsetmacroymax0
foreach X in 0,0.05,...,1
begintikzpicture
ifdefinedfigbbrelax
path figbb;
fi
draw
[postaction=decorate,
decoration=
markings,
mark=at position X with
node [circle,inner sep=2pt,draw,fill=red,label=above:$x$];
]
(0,0) -- ++ (1,2)
-- ++ (1,.5)
-- ++ (1,-1)
-- ++ (1,0)
-- ++ (1,-4);
path let p1=(current bounding box.south west),
p2=(current bounding box.north east)
in pgfextra%
pgfmathsetmacroxminmin(x1,xmin)
pgfmathsetmacroxmaxmax(x2,xmax)
pgfmathsetmacroyminmin(y1,ymin)
pgfmathsetmacroymaxmax(y2,ymax)
xdefxminxmin pt
xdefxmaxxmax pt
xdefyminymin pt
xdefymaxymax pt
;
endtikzpicture
makeatletter
edeffigbb(xmin,ymin) rectangle (xmax,ymax)
immediatewrite@mainauxxdefstringfigbbfigbbrelax
makeatother
enddocument
answered May 25 at 5:25
marmotmarmot
131k6166316
131k6166316
Thank you marmot :)
– Olivier Bégassat
May 25 at 8:59
add a comment |
Thank you marmot :)
– Olivier Bégassat
May 25 at 8:59
Thank you marmot :)
– Olivier Bégassat
May 25 at 8:59
Thank you marmot :)
– Olivier Bégassat
May 25 at 8:59
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%2f492532%2fmoving-a-point-along-a-multi-node-path%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