# Tag Info

## Hot answers tagged tikz-path

14

One way is to redefine decoration with this option in place or you can nest decorations with an arrowhead added as a markings decoration. % with \usetikzlibrary{decorations.markings} in the preamble \draw[postaction=decorate, decoration={markings,mark=at position 1 with {\arrow[blue]{>}}} ] decorate[decoration={brace,...

9

A dirty way to straighten out the end. \documentclass[a4paper,12pt]{article} \usepackage{tikz,tikz-cd} \usetikzlibrary{decorations.pathreplacing} \pagestyle{empty} \begin{document} \begin{center} \begin{tikzpicture} \draw [->] (0,0) -- (10,0); \draw (0,0.2) -- (0,-0.2); \draw (1.5,0.2) -- (1.5,-0.2); \draw (3,...

8

In a path, you should use foreach. For historical reasons, you can also write \foreach instead of foreach (cf. section "14.14 The Foreach Operation", p.167, pgfmanual v3.1.9a). There are two ways of specifying a node on a line or a curve: Either explicitly by using the pos option or implicitly by placing the node “inside” a path operation (cf. ...

7

Replacing the absolute (f) by the relative (0,0) gives the desired result (here also with the variant using scope): \documentclass[tikz,12pt]{standalone} \usetikzlibrary{hobby} \begin{document} \begin{tikzpicture} % \path [draw=red] (0,0) coordinate (f) to[curve through={+(.125,-.5) +(-.5,-1) +(0,-1.5) +(.5,-.75) }, save Hobby path={ff1}] (f); \path [draw=...

7

The following example draws the area by clipping. Then it is not necessary to calculate the intersection points. The four functions are paired, that one pair makes the left and right boundary and the other pair the upper and lower boundary of the area: \begin{scope}[samples=100] \clip (1, 0) -- plot[domain=2:3] (\x, {sqrt(\x^2-4)}) ...

7

Along the lines of percusse's answer, you could do something like \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations.markings,decorations.pathreplacing} \begin{document} \begin{tikzpicture} \begin{scope} \clip (0,0.0) rectangle(9.5,2.0); \draw [decorate,decoration={brace,amplitude=10pt}] (0,0.7) to (10,0.7); \end{scope} \path[...

7

You can use spath3 library to save the node path with save spath=..., and then to reuse it with restore spath=.... \documentclass[tikz,border=7pt]{standalone} \usepackage{spath3} \usetikzlibrary{fit,shapes.misc} \begin{document} \begin{tikzpicture}[ mybox/.style={fill=#1!30,draw=#1,rounded corners} ] \node[mybox=green] at (0,0) (a) {A}; \...

6

Update 2021-07-13: A more recent version of this code is at https://tex.stackexchange.com/a/567029/86 Firstly, spath3 is on CTAN and is part of TeXLive so doesn't need to be separately downloaded. Secondly, it does feel slightly overkill to be using it in this context, but I don't know enough about how fadings work to be able to extract only the needed ...

6

\node is an abbreviation of \path[node], cf. section 15.1 in the manual, so I don't think it should be a surprise. An alternative might be to add every node/.append style={sharp corners} to the tikzpicture options. It doesn't seem like this would override a rounded corners in a node style. \documentclass[border=4pt]{standalone} \usepackage{tikz} \...

6

It is enough to use the Line-To operation (< coordinate > -- < coordinate >) instead of the To-Path operation (< coordinate > to < coordinate >): \documentclass{article} \usepackage{tikz} \usetikzlibrary{shadows,arrows,calc,backgrounds,fit,shapes,snakes,shapes.multipart,decorations.pathreplacing,shapes.misc,patterns,positioning} \usepackage{...

6

You can let TikZ do these things, regardless of whether you have positioned the nodes by hand or via a chain. You only need to dial some appropriate to path. The important ingredient in this example is \ifdim\n1>2pt, which changes the path depending on whether or not the levels of start and target are (roughly) the same. \n1 is the vertical distance, ...

6

I don't know why it doesn't work with a to command - I'll have to investigate that - but with an explicit bézier curve then it does. The target coordinate has to go before the foreach The foreach is a key word, not a command I modified your node style to take an argument as the fill colour with default blue \documentclass {standalone} \usepackage{tikz} \...

6

> = latex is an arrow tip without bounding box. (This arrow head is defined in pgfcorearrows.code.tex and is available regardless of whether arrows.meta is included.) With > = Latex, the arrow tip has a bounding box. (This arrow head is defined in arrows.meta with proper bounding box.)

5

This is basically the same as Dr. Manuel Kuehner's answer but illustrates how the svg path can be input directly into TikZ (note that it is advisable to make sure there are spaces between numbers) and uses a postaction to do the drawing all at once: \documentclass[tikz,border=5]{standalone} \usetikzlibrary{svg.path,decorations} \makeatletter \tikzset{% ...

5

like this? i combine your code and looks of provided image. of course, you can easily change node style (to rounded corners or to white fill): \documentclass[tikz, margin=3mm]{standalone} \usetikzlibrary{arrows.meta, calc, chains, positioning, shadows} \makeatletter \tikzset{suppress join/.code={\def\tikz@lib@on@chain{}}} \makeatother \begin{document} ...

5

Here is a solution inspired by this answer. Add the following lines to your preamble: \newcommand\double[3][10]{% \draw (#2) edge [bend left=#1,draw=none] coordinate[at start](#2-#3-s) coordinate[at end](#2-#3-e) (#3) edge [bend right=#1,draw=none] coordinate[at start](#3-#2-e) coordinate[at end](#3-#2-s) (#3); } It is ...

5

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} \usepackage{...

5

I wouldn't say using an additional \draw is any less correct, but you can play with the looseness parameter, in addition to the in and out angles. For example, edge["{$2,0$} ", out=230, in=180, looseness=1.4] (6) Alternatively, specify a custom path with to path, e.g. edge["{$2,0$} ", to path={(\tikztostart) .. controls +(-4,-5) and +(-4,...

5

Here is another methode where all the arrows are drawn twice with two different colors path fading from different directions. \documentclass[tikz, border=1 cm]{standalone} \usetikzlibrary{shapes, fadings} \begin{document} \begin{tikzpicture} \node[red,draw,thick,ellipse] (S) at (-3,0) {Solide}; \node[blue,draw,thick,ellipse] (L) at (3,0) {Liquide}; \node[...

5

You can use the methode in this answer: Draw additional parallel paths in TikZ -or as it is just lines, you can calculate the shift with calc notation. Line join to circle nodes will never be nice, when the line width is much larger than the node boundary width. I avoid this by drawing the lines in the background. Instead of understanding your code, I ...

4

Inspired by https://graphicdesign.stackexchange.com/questions/82671 (one of my questions on another stackexchange server) I used a custom dash pattern with very large values in order to get the desired effect: \begin{tikzpicture}[ y = 0.80pt, x = 0.80pt, yscale = -1, xscale = 1, dash pattern = on 1500pt off 3000pt % <-- here the ...

4

According to pgfmanual (section 2.14 Shading) \shade (instead of \fill) is the way to go: \documentclass[border=10pt,multi,tikz]{standalone} \begin{document} \begin{tikzpicture} \begin{scope}[blend group=overlay, xshift=35mm] \node [circle, ball color=red, minimum size=20mm] at (90:.6) {}; \node [circle, ball color=green, minimum size=20mm] ...

4

As I have learned here (German) it is possible to use the pgfplotslibrary fillbetween with TikZ. \documentclass[border=2mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \usepgfplotslibrary{fillbetween} % \begin{document} \begin{tikzpicture} \draw[very thin,color=gray] (1,0) grid (3,3); \path[name path=A,draw,blue, domain=...

4

If you look at the source code in tikz.code.tex you find the definition for the code that is executed when \pgfextra is encountered on a path: \def\tikz@extra{\pgfutil@ifnextchar\bgroup\tikz@@extra\relax} \long\def\tikz@@extra#1{#1\tikz@scan@next@command} \let\endpgfextra=\tikz@scan@next@command Basically, whatever is the argument to \pgfextra is executed ...

4

Here is an example demonstrating why your questions are almost always impossible to answer with simple arguments. This one features an expansion delay such that we change the color of a node after it is placed. which is not possible in usual syntax but then possible with abusing and hacking. \documentclass{article} \usepackage{tikz} \def\mymacro{\...

4

Perhaps you could position each character/number manually using polar coordinates. \documentclass[11pt]{article} \usepackage{tikz} \usepackage{lmodern} \begin{document} \begin{tikzpicture} \foreach [count=\i from 97,evaluate=\i as \Ang using 270-(\i-97)*360/26.5] \letter in {a,...,z} { \node [anchor=base,font=\fontsize{53pt}{60pt}\ttfamily,rotate=\Ang-...

4

Just for completeness, another solution which use show path construction decoration, in place of spath3, to save a high level presentation of the path in a global macro \savedtikzpath. \documentclass[tikz,border=7pt]{standalone} \usetikzlibrary{fit,shapes.misc} \usetikzlibrary{decorations.pathreplacing} \tikzset{ append tikz path/.style = { decoration=...

4

Here is an example if using the hobby package that can draw smooth curve through some given points. I defined some intermediate points (A'), (A'') and (D'), (D'') that help to shape near the two points that are connected via a straight line. You can adjust those points to obtain the desired shape. Code: \documentclass[border=2pt]{standalone} \usepackage{...

Only top voted, non community-wiki answers of a minimum length are eligible