I am trying to access a node defined inside a pic definition outside its scope. I found this example in the PGF manual v3.0.1a on page 254. The example given is as follows.  \documentclass{standalone} \usepackage{tikz} \begin{document}     \tikzset{         seagull/.pic={             % Code for a "seagull". Do you see it?...             \coordinate (-left wing) at (-3mm,0);             \coordinate (-head) at (0,0);             \coordinate (-right wing) at (3mm,0);             \draw (-left wing) to [bend left] (0,0) (-head) to [bend left] (-right wing);         }     }     \tikz {         \pic (Emma) {seagull};         \pic (Alexandra) at (0,1) {seagull};         \draw (Emma-left wing) -- (Alexandra-right wing);     } \end{document}   But I get an error on compiling: No shape named EmmaEmma-leftwing is known. Does anyone know what's wrong in this code and how one can access nodes defined inside a pic outside their scope.
52532
I read instruction how to use \pic in PGF 3.0.0 manual, but description how to give names to \pic are not clear to me and given example generate error:     "No shape named EmmaEmma-left is known."  Example in manual (pp. 255):  \documentclass[tikz,border=3mm]{standalone} \tikzset{ seagull/.pic={ % Code for a "seagull". Do you see it?... \coordinate (-left wing) at (-3mm,0); \coordinate (-head) at (0,0); \coordinate (-right wing) at (3mm,0); \draw (-left wing) to [bend left] (0,0) (-head) to [bend left] (-right wing); } }         \begin{document}     \begin{tikzpicture}%\small\sffamily \pic (Emma) {seagull}; \pic (Alexandra) at (0,1) {seagull}; \draw (Emma-left wing) -- (Alexandra-right wing);     \end{tikzpicture}         \end{document}   It's obvious that something is missing in above example. Please enlighten me, what I missed.
30281
Why the shape (sB) is unknown in the following code ? How to avoid this ?  \documentclass[]{standalone} \usepackage{tikz,xparse} \usetikzlibrary{calc}  \tikzset{pics/.cd,     % Marque croix     Cross/.style args={#1 and #2}{%         code = {%         \draw[#2,rotate=45,scale=1.4] (0,#1 pt) -- (0,-#1 pt) ;         \draw[#2,rotate=-45,scale=1.4] (0,#1 pt) -- (0,-#1 pt) ;         }     },     Cross/.default={2 and black} }  \NewDocumentCommand{\Segment}{mO{}}{%     \begin{scope}[#2]     \path    (0,0) coordinate (sA) pic {Cross={1.5 and gray}}         -- (#1,0) coordinate (sB) pic {Cross={1.5 and gray}} ;     \draw (sA)--(sB) ; % Can't reuse (sB)     \end{scope} }   \begin{document}     \begin{tikzpicture}     \Segment{1.5}     \end{tikzpicture} \end{document}
103740
I'm trying to visualize some data with TikZ datavisualization library. Given foo.tex  \documentclass{article} \usepackage{tikz} \usetikzlibrary{datavisualization}  \begin{document} \begin{tikzpicture}   \datavisualization [ scientific axes, visualize as scatter ] data [ read from file=foo.dat ]; \end{tikzpicture} \end{document}   and foo.dat:  x, y 1, 2 3, 4 5, 6   It fails with the following error (repeated multiple times):  ! Package PGF Math Error: Sorry, an internal routine of the floating point unit got an ill-formatted floating point number `'. The unreadable part was near ''..  See the PGF Math package documentation for explanation. Type  H &lt;return&gt;  for immediate help.  ...                                                l.7 ... scatter ] data [ read from file=foo.dat ];   If I'd rather include data from foo.dat inline the document compiles normally.  What am I missing and how can I fix the problem?  I'm running TeXLive 2014 on Windows 7. All files use Unix line ending.  EDIT: I've removed all commas in my data file and explicitly set separator to \space, now it works.  One more quertion: TikZ documentation says:     /pgf/data/separator=&lt;character&gt; (no default, initially ,)   What does this mean? What is the difference between initial value and default value?
100691
Taking from the PGF manual,  \begin{tikzpicture}   \draw [help lines] (0,0) grid (3,3);   \coordinate (a) at (rnd,rnd);   \coordinate (b) at (3-rnd,3-rnd);   \draw (a) -- (b);   \node (c) at (1,2) {x};   \draw let \p1 = ($ (a)!(c)!(b) - (c) $),             \n1 = {veclen(\x1,\y1)}         in circle [at=(c), radius=\n1]; \end{tikzpicture}   I'd like to increase the size of x. The problem is that I have multiple circles in the same diagram. Some of them require a larger sized font, while others are okay at default. How do I do this?
86390
Why doesn't the pos = x option work when the node is used in the plot command?  \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture}   \draw plot[domain = 0:2, samples = 100] ({\x}, {(\x)^2}) node[pos = 1.1]    {\(y = x^2\)}; \end{tikzpicture} \end{document}   In this picture, f_{quad} is my node that should be at pos = 1.1.    Additionally, it doesn't matter what I make pos equal to.  It is always at the origin.
12927
I am trying to use \pgfmathsetmacro inside a foreach loop to connect nodes which are adjacent and named according to position as follows:  \foreach \src in {0,...,\T}{     \pgfmathsetmacro{\dest}{\src+1};     \path (n-\src-1) edge[&lt;-] (n-\dest-1); };   This however leads to the following error during compilation:  ./nn.tex:54: Package pgf Error: No shape named n-1 is known. [    }] ./nn.tex:54: Package pgf Error: No shape named n-2 is known. [    }] ./nn.tex:54: Package pgf Error: No shape named n-3 is known. [    }] ./nn.tex:54: Package pgf Error: No shape named n-4 is known. [    }]   which makes it seem as though the \dest value is not available. How do I get around this issue?  Thanks in advance!
49105
I'm using 3dplot to draw in 3D. Now I want to define my own environment, called pose, that is supposed to be used inside a tikzpicture-environment. It should perform a coordinate system tansformation according x,y,z,roll,pitch and yaw, that are passed to my pose-environment via pgfkeys.  Here is the code:  \documentclass{article}  \usepackage{tikz} \usepackage{tikz-3dplot} \usetikzlibrary{3d}  % fix wrong implementation of xy canvas \makeatletter \tikzoption{canvas is xy plane at z}[]{%   \def\tikz@plane@origin{\pgfpointxyz{0}{0}{#1}}%   \def\tikz@plane@x{\pgfpointxyz{1}{0}{#1}}%   \def\tikz@plane@y{\pgfpointxyz{0}{1}{#1}}%   \tikz@canvas@is@plane } \makeatother  \pgfkeys{% /poseenv/.is family, /poseenv,% % set the defaut values default/.style = {%     x = 0,%     y = 0,%     z = 0,%     roll = 0,%     pitch = 0,%     yaw = 0%     },%     x/.estore in = \poseenvx,%     y/.estore in = \poseenvy,%     z/.estore in = \poseenvz,%     roll/.estore in = \poseenvroll,%     pitch/.estore in = \poseenvpitch,%     yaw/.estore in = \poseenvyaw,%     origin/.code n args={1}{%         #1% ### MODIFY CODE HERE ###     }% }%  \newenvironment{pose}[1][]% {%     % parse arguments     \pgfkeys{/poseenv, default, #1}%     % modify 3dplot's rotated coords according to \poseenv{x,y,z,roll,pitch,yaw}     \coordinate (origin) at (\poseenvx,\poseenvy,\poseenvz);     \tdplotsetrotatedcoordsorigin{(origin)}     % todo: do rotation      % begin the scope     \begin{scope}[tdplot_rotated_coords,transform shape] }% {%     % end the scope     \end{scope} }%  \begin{document}     \tdplotsetmaincoords{80}{45}     \begin{tikzpicture}[tdplot_main_coords]         % draw a coordinate system in black at the origin         \draw[-&gt;] (0,0,0) -- (1,0,0);         \draw[-&gt;] (0,0,0) -- (0,1,0);         \draw[-&gt;] (0,0,0) -- (0,0,1);         \draw[canvas is xy plane at z=0,lightgray] (0,0) grid (3,3);          % define where the red coordinate system should be         \coordinate (A) at (1,1,0);          % draw the red coordinate system at (A)                  \begin{pose}[origin=(A)]             \draw[-&gt;,red] (0,0,0) -- (1,0,0);             \draw[-&gt;,red] (0,0,0) -- (0,1,0);             \draw[-&gt;,red] (0,0,0) -- (0,0,1);             \draw[-&gt;,red] (0,0,0) -- (1,1,1);         \end{pose}          % draw the green coordinate system at (1,1,0)         \begin{pose}[x=1,y=1,z=0]             \draw[-&gt;,green] (0,0,0) -- (1,0,0);             \draw[-&gt;,green] (0,0,0) -- (0,1,0);             \draw[-&gt;,green] (0,0,0) -- (0,0,1);             \draw[-&gt;,green] (0,0,0) -- (1,1,1);         \end{pose}     \end{tikzpicture} \end{document}   Except for the rotational part the environment is working in principle, but the rotation is not part of the question here. You see, that the green coordinate system is correctly painted at (1,1,0). But the red coordinate system is painted at (0,0,0) instead of (A). This is because the implementation is not yet finished. Obviously, the implementation at the line, marked with ### MODIFY CODE HERE ### is not correct.  What do I have to replace that code with?
96095
I have a small problem with the TikZ \foreach loop whenever the list, over which we loop, is defined my a macro. The following code example will show my problem:  \documentclass{scrartcl} \usepackage[utf8]{inputenc} \usepackage{tikz}  \begin{document} Picture one:  \begin{tikzpicture} \foreach \x/\y in {1.0/2.0, 3.0/4.0} \node[draw] at (\x,\y) {\x--\y}; \end{tikzpicture}  Picture two:  \newcommand{\mymacro}{1.0/2.0, 3.0/4.0} \begin{tikzpicture} \foreach \x/\y in {\mymacro} \node[draw] at (\x,\y) {\x--\y}; \end{tikzpicture} \end{document}   The expected result is that both images should look the same. But in the second image, I only get one node - and both \x and \y are each time expanded to 1.0/2.0, 3.0/4.0. I hope someone can help.
82504
I would like to draw a picture that reflects some file structure. Below code works almost as expected. I need to adjust the connections between nodes so they don't start from the center of the bottom of the parent node but from near the left bottom corner.  How can I do this?  Code:  \documentclass[11pt, oneside]{article} \usepackage{tikz}                           % super package for complex and awesome drawing  \begin{document}  \usetikzlibrary{trees} \tikzstyle{every node}=[draw=black,thick,anchor=west,inner sep=2pt,minimum size=1pt] \tikzstyle{selected}=[draw=cyan,fill=cyan!30] \begin{tikzpicture}[   grow via three points={one child at (0.5,-0.7) and   two children at (0.5,-0.7) and (0.5,-1.4)},      edge from parent path={(\tikzparentnode.south) |- (\tikzchildnode.west)}]   \node {MainFolder-\{version\}}     child { node [label={[xshift=6.0cm, yshift=-0.58cm, color=gray] Documentation for developers}] {References and Documentation/}         child { node [draw=none] {main.html} }         child { node {reference/}             child { node [draw=none] {...}}         }         child [missing] {}     }     child [missing] {}     child [missing] {}     child [missing] {}     child { node {release/}         child { node [draw=none] {libAwesome.a} }         child { node [draw=none] {libAwesome.dylib} }     }; \end{tikzpicture} \tikzstyle{every node}=[] % resets borders of tables \tikzstyle{selected}=[] % resets selected  \end{document}     Ouput:    Ideal:    Any help is appreciated.
3491
I like TikZ's capability to traverse multiple variables separated by a slash in the foreach (as in the example below). I am looking for something equivalent in PGFplots? I saw in the documentation that say you can't nest the foreach in PGFplots as you can in TikZ, but that only make this kind of feature more important.    Two other small issues:    I like the \x notation so that is why I am using \pgfplotsforeachungrouped. Is there a reason why I should be using pgfplotsinvokeforeach instead?  Also, what is the correct syntax to be able to use a variable to define the list instead of having the actual list in the code. In the following I'd like to be able to reference \ListWithLabels in the foreach.    \documentclass{minimal} \usepackage{pgfplots}  \newcommand*{\ListWithLabels}{-2/a, -1/b, 1/c, 2/d} \newcommand*{\ListWithoutLabels}{-2, -1, 1, 2}  \begin{document} \begin{tikzpicture} \draw [-&gt;][gray, thin](-3,0) -- (3,0) node[blue, right] {$x$};  \draw [-&gt;][gray, thin](0,-3) -- (0,3) node[blue, above] {$y$};  %\foreach \x/\l in \ListWithLabels {  % works \foreach \x/\l in {-2/a, -1/b, 1/c, 2/d} {     \draw [thick, red]         (\x,-2pt) -- (\x,2pt)         node [red, above] {\l}; } \end{tikzpicture}  \begin{tikzpicture} \begin{axis}[     minor tick num=0, axis y line=center, axis x line=middle,      xmin=-3, xmax=3, ymin=-3, ymax=3, xlabel=$x$, ylabel=$y$,     xtick={0},  xticklabels={}     ]  %\pgfplotsinvokeforeach{-2, -1, 1, 2}{             % works %   \addplot [mark=none,color=red, thin, samples=2] %       coordinates{(#1,-0.05) (#1,0.05) }; %}  %\pgfplotsforeachungrouped \x in {\ListWithoutLabels}{  % does not work \pgfplotsforeachungrouped \x in {-2, -1, 1, 2}{    % works     \addplot [mark=none,color=red, thick, samples=2]%         coordinates{ (\x,-0.08) (\x,0.08) }; }   %\pgfplotsforeachungrouped \x/\l in {-2/a, -1/b, 1/c, 2/d}{ % does not work %   \addplot [mark=none,color=red, thin, samples=2]% %       coordinates{ (\x,-0.05) (\x,0.05) } %        node [red, below] {\l}; %}  \end{axis} \end{tikzpicture} \end{document}   Update: I saw  post which explains that the macro in TikZ needs to be not be sourrouned by {}. But that does not work for the PGF commands.  Here is another related post on
88976
Say I have a triangle with vertices defined using  \coordinate (a) at (0,0); \coordinate (b) at (1,0); \coordinate (c) at (0,1);   Let us denote by T(x,y) the triangle defined by (a),(b) and (c) which is translated by a vector (x,y). I can now easily draw T(0,0) as follows:  \draw (a) -- (b) -- (c) -- cycle;   So far so good. Now, lets say that I want to plot the triangle T(2,3). Ideally, I would like to do something like:  \begin{scope}[shift={(2,3)}]     \draw (a) -- (b) -- (c) -- cycle; \end{scope}   However, as the coordinates were defined outside of the scope the transformation (translation in this case) won't effect them. See . What would be the smart way to do it? Or more generally:  What is the best way to reuse coordinates that are defined once under varying transformations?  Possible solution: Basing on the comment of @Qrrbrbirlbel I posted an answer. This answer however, is very limited and local - is the something more general?
104509
The following are my code. I used the axis environment for better axis style. I try to add nodes at g^W=g^L, which is a point on the y-axis, but the axis environment seemes to cut off anything outside the axis. What should I do?  \documentclass[11pt]{article} \usepackage{pgfplots} \begin{document}  \begin{figure} \centering \begin{tikzpicture}[scale = 1.2]      \begin{axis}[xmin=0,xmax=10,ymin=0,ymax=7,         axis lines = left, axis line style = thick,  unit vector ratio=1 1 1, xtick={0,8},         xticklabels = {$p^w=0$, $p^w=1$},         ytick={1.5,3,5.5},         yticklabels = {$g^L-\beta$,$g^W=g^L$,$g^w+\alpha$}]         \addplot[mark=none, dashed] coordinates {(8, 0) (8, 7)};          \addplot[domain=0:8, dashed] {1.5};         \addplot[domain=0:8, dashed] {3};          \node[black,right] at (axis cs:8,1.5){\small{$W=0$}};         \node at (axis cs:8,1.5) [circle, scale=0.3, draw=black!80,fill=black!80] {};         \node at (axis cs:8,3) [circle, scale=0.3, draw=black!80,fill=black!80] {};         \node at (0,3.5) [circle, scale=0.3, draw=black!80,fill=black!80] {};       \end{axis} \end{tikzpicture} \caption{A caption.} \end{figure}   \end{document}
34770
I'm trying to calculate the size of a tikzpicture using the current bounding box, but every time I try to extract the coordinates I get 0pt (for everything).    \documentclass{article} \usepackage{tikz}  \newlength{\mywidth} \newlength{\myheight}  % computes width and height of tikzpicture  \newcommand{\pgfsize}[2]{ % #1 = width, #2 = height  \pgfextractx{#1}{\pgfpointdiff{\pgfpointanchor{current bounding box}{south west}}  {\pgfpointanchor{current bounding box}{north east}}}  \pgfextracty{#2}{\pgfpointdiff{\pgfpointanchor{current bounding box}{south west}}  {\pgfpointanchor{current bounding box}{north east}}} }  \begin{document}  \noindent \begin{tikzpicture} \draw node[rotate=90]{  \framebox{  \begin{tabular}{c|c}  first column &amp; second column\\  \hline  1 &amp; A\\  2 &amp; B\\  $\vdots$ &amp; $\vdots$  \end{tabular} }}; \draw[color=red] (current bounding box.south west) -- (current bounding box.north east); \pgfsize{\mywidth}{\myheight} \end{tikzpicture}  \noindent Width = \the\mywidth \\ Height = \the\myheight \end{document}   As you can see, one can draw a line across the bounding box, so it exists and is non-trivial.  I'm thinking I may have to use \pgfgettransformentries, but when?
101386
I have the two PGF nodes foo and bar positioned in a row.  \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document}   \begin{tikzpicture}[node distance=0.2cm,mynode/.style={rectangle,draw}]     \node[mynode] (foo)                {foo};     \node[mynode] (bar) [right=of foo] {bar};   \end{tikzpicture} \end{document}   How can I create a third node below those two nodes with the width of foo, bar and the node distance between them? Is there a way to do this with the fit library or is this the wrong approach?
68803
update i discovered lately  where Nickolay Kolev uses  \tikz inside a tikzpicture environment. A lot of users think that is a wrong practice and I agree that is very strange but sometimes very useful. I agree too that it's preferable to avoid this kind of situation. I use this possibility in  pgfornament.  I don't understand why if I invert the two lines of the tikzpicture (the wrapper) I get different results. overlay I think, resets the bounding box but why inside the second tikzpicture, the overlay resests the general bounding box. When I use a scope, the problem disappears ?   update I suppose that tikz's experts think it's preferable to use a scope and the question is stupid ...  Or in the pgfmanual, I read      All graphic options are local to the {tikzpicture} to which they   apply.   The picture in red has no bounding box.  \documentclass[11pt]{scrartcl} \usepackage{tikz}     \begin{document}  baseline\begin{tikzpicture}[baseline=(current bounding box.north west)]   \tikz[overlay] \path (0,0) --  (1,1) node  {\color{blue}$\bullet$};  \draw[help lines,blue!20] (0,0) grid (2,2) ; \end{tikzpicture}baseline% %  \begin{tikzpicture}[baseline=(current bounding box.south west)]    \draw[help lines,red!20] (0,0) grid (2,2) ;   \tikz[overlay] \path (0,0) --  (1,1) node  {\color{red}$\bullet$};  \end{tikzpicture}baseline     \end{document}   With pgfinterruptboundingbox     Picture in green. The bounding box is correct. The first bounding box is protected.  The solution is to place the line with overlay inside a pgfinterruptboundingbox environment so the problem is linked to the current bounding box.    baseline\begin{tikzpicture}[baseline=(current bounding box.south west)]       \draw[help lines,green!50] (0,0) grid (2,2) ;   \begin{pgfinterruptboundingbox}    \tikz[overlay] \path (0,0) --  (1,1) node  {\color{green}$\bullet$};    \end{pgfinterruptboundingbox} \end{tikzpicture}baseline       No problem with a scope   \documentclass[11pt]{scrartcl} \usepackage{tikz}  \begin{document} baseline\begin{tikzpicture}[baseline=(current bounding box.north west)]   \tikz[overlay] \path (0,0) --  (1,1) node  {\color{blue}$\bullet$};  \draw[help lines,blue!20] (0,0) grid (2,2) ; \end{tikzpicture}baseline  \begin{tikzpicture}[baseline=(current bounding box.south west)]    \draw[help lines,red!20] (0,0) grid (2,2) ;  \begin{scope} [overlay] \path (0,0) --  (1,1) node  {\color{red}$\bullet$}; \end{scope}   \end{tikzpicture}baseline  \end{document}    ( What is the real differences between a scope and a tikzpicture ?)  update The question is perhaps too general, better is How tikz performs overlay ?
122982
I just found the pin option to drawing, and it looks useful in some of the things I want to draw. How do I format it though? I've tried pin=[red]60:{Hey!} and I get the error Cannot parse this coordinate.  \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{shapes,arrows,positioning} \begin{document} \begin{tikzpicture}[node distance=2cm,&gt;=latex, every node/.style={     font=\sffamily\scriptsize     },       circtext/.style={draw,circle,minimum size=8pt,inner sep=2pt},     dot/.style={draw,circle,fill=black,minimum size=0.6mm,inner sep=0pt} ] { \node[rectangle, fill=green!10!white!90!black, minimum width=6cm, minimum height=3cm] at (2,0){}; \node[circtext, fill=yellow](A) at (0,0) {A}; \node[circtext, fill=yellow, right=of A](B){B}; \draw[-&gt;] (A) -- node[dot, pos=0.5, pin=[red]60:{Hey!}](C){}(B); } \end{tikzpicture} \end{document}     The default style looks like it's a gray thin arrow, and I want to change it to a black thin dotted line with no arrow.    update: I figured out how to add style to the pin node:  pin={[red]60:Hey!}]  But I can't figure out how to change the linestyle though.
95450
Here is the minimum working example:  \documentclass{article} \usepackage{tikz} \usepackage{float} \usepackage{listings} \usepackage{color} \usepackage{textcomp} \usetikzlibrary{shapes,positioning} \begin{document} \centering \begin{tikzpicture}   \node[draw] (PersonLocation Graph) {     \begin{minipage}{.85\linewidth} \begin{lstlisting}[language=XML,escapechar=!]   &lt;collection name=PersonLocation BiMap&gt;   &lt;edge&gt;    &lt;ref&gt;//collection[name=Locations]/loc[name=XXYY]   ! \tikz \node[shape=circle,draw](srchead) {H};!   &lt;/ref&gt;   &lt;ref&gt;//collection[name=Persons]/person[id=4564]   ! \tikz \node[shape=circle,draw](deshead) {E};      %(srchead) edge[&lt;-&gt;, bend left] (deshead.south);    !     &lt;/ref&gt;    &lt;/edge&gt;   ...   ...   ...   &lt;/collection&gt; \end{lstlisting} \end{minipage}  }; \end{tikzpicture} \end{document}   I want to draw an edge from node H to E. I tried  using statement srchead) edge[&lt;->, bend left] (deshead.south); (commented out in the code). Thanks in advance for your input.