TeX - LaTeX Asked on April 14, 2021
I want to mark my closed curves with {Latex[length=4mm, cyan]}
like this. Usually, to mark a curve, I use intersections then mark a new custom mark by isosceles triangle
and rotate and shift with trial and error. But it’s not efficient. I’d like to use something simple like decorations.marking
or else because I just need to adjust the position of arrow and it’s efficient to use. But since my curve is closed, I got a lot of errors when using decorations.markings
. Is it possible? Please share your knowledge. Thanks in advance.
Here is my MWE:
documentclass[tikz, border=1mm]{standalone}
usetikzlibrary{arrows.meta, decorations.markings}
begin{document}
begin{tikzpicture}
begin{scope}[>={Stealth[length=4mm]}]
draw[<->, thick] (-4,0)--(4,0) node[below,shift={(-.2,-.2)}]{Large $x$};
draw[<->, thick] (0,-4)--(0,4) node[left, shift={(-.1,-.2)}]{Large $y$};
end{scope}
begin{scope}[]
draw[line width=1.5pt] (0,0) circle [radius=3cm];
draw [red, line width=1.3pt]
(.1,.4) .. controls (1.2,1.8) and (.4,2.3) .. (-.5,1.9)
.. controls (-1.2,1.3) and (-1.8,1.5) .. (-2,1.4)
to[out=180,in=180] (-2,.2)
.. controls (-1.8,.1) and (0,.1) .. (.1,.4) -- cycle;
end{scope}
end{tikzpicture}
end{document}
You may simply define a mark
decoration for each path and set the position of its arrow using the number associated with that decoration once you call it.
documentclass[border=1mm]{standalone}
usepackage[dvipsnames]{xcolor}
usepackage{tikz}
usetikzlibrary{arrows.meta, decorations.markings}
begin{document}
begin{tikzpicture}
begin{scope}[>={Stealth[length=4mm]}]
draw[<->, thick] (-4,0)--(4,0) node[below,shift={(-.2,-.2)}]{Large $x$};
draw[<->, thick] (0,-4)--(0,4) node[left, shift={(-.1,-.2)}]{Large $y$};
end{scope}
begin{scope}[thick,decoration={
markings,
mark=at position 0.35 with {arrow[Cyan]{<}}}]
draw[line width=1.5pt, postaction={decorate}] (0,0) circle [radius=3cm];
end{scope}
begin{scope}[thick,decoration={
markings,
mark=at position 0.65 with {arrow[Cyan]{>}}}]
draw [red, line width=1.3pt, postaction={decorate}]
(.1,.4) .. controls (1.2,1.8) and (.4,2.3) .. (-.5,1.9)
.. controls (-1.2,1.3) and (-1.8,1.5) .. (-2,1.4)
to[out=180,in=180] (-2,.2)
.. controls (-1.8,.1) and (0,.1) .. (.1,.4) -- cycle;
end{scope}
end{tikzpicture}
end{document}
Correct answer by Roboticist on April 14, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP