Having this in the preamble:  \usepackage{tikz} \usetikzlibrary{chains,shapes.multipart} \usetikzlibrary{scopes} \usetikzlibrary{decorations.markings} \usetikzlibrary{shapes,calc} \usetikzlibrary{automata,positioning}   I have the following figure:  \begin{figure}        \centering        \begin{tikzpicture}[start chain=going right,&gt;=latex,node distance=0pt]          \node[draw,rectangle,on chain,minimum size=1.5cm] (rr) {$I$};          \node[draw,rectangle,on chain,draw=white,minimum size=0.8cm]{};          % the rectangular shape with vertical lines         \node[rectangle split, rectangle split parts=5,         draw, rectangle split horizontal,text height=1cm,text depth=0.5cm,on chain,inner ysep=0pt] (wa) {};          \fill[white] ([xshift=-\pgflinewidth,yshift=-\pgflinewidth]wa.north west) rectangle ([xshift=-15pt,yshift=\pgflinewidth]wa.south);         \node at (wa.east) (A){};         \draw [-latex] (A) --+(30:1.5) coordinate (B1);         \draw [-latex] (A) --+(-30:1.5) coordinate (B2);          % the circle          \node [draw,circle,on chain,minimum size=1cm] at (B1) (se1) {$U_1$};          \draw [-latex] (se1) --+(0:1.3) coordinate (BB1);          \node [draw,circle,on chain,minimum size=1cm] at (B2) (se2) {$U_2$};          \draw [-latex] (se2) --+(0:1.3) coordinate (BB2);          \node [draw,diamond,on chain,minimum size=0.2cm] at (BB1) (C3){};          \draw [-latex] (C3)--+(0:1)node[midway,above] {$\mu$};          % the arrows and labels          \draw[&lt;-] (wa.west) -- +(-20pt,0) node[midway,below] {$\lambda$};          \draw[-&gt;] (C3.north) to[out=120, in=145] ([shift=(up:.3)] wa.west);        \end{tikzpicture}           \caption{The model represented as a queuing system.}              \label{fig:queue}        \end{figure}   How to put labels on arrows where there are none (the picture below shows the edges where i want to put labels)?
111016
\fbox{ \begin{tikzpicture}[scale=1,auto=center]   \node[circle,fill=gray!20] (n1) at (2,8) {Node A};   \node[circle,fill=gray!20] (n2) at (8,8) {Node B};   \foreach \from/\to in {n1/n2}   \draw (\from) -- (\to) node[draw=none,fill=none,font=\scriptsize,midway,below] {text below}; \end{tikzpicture} }   The example show how to put text below the line in middle, but how to write the text below and above the line in middle (simultaneously) between two nodes? ...
22304
Hi All: I have a code snippet below which works beautifully and was provided by someone on this list to me a while back.  But now I want to change it so that I draw one long rectangle instead of the adjacent five boxes. The text inside the rectangle should just be at the far right of it and could say $Y^{*}_{whatever}$. I'm thinking that I need to define a rectnode instead of a squared node with different things in it.  But I don't understand how to make it the same length as the length of the boxes and in the same position. &quot;minimum size&quot; currently inside the definition of squarednode isn't making sense to me. EDIT: I have edited this question by including a handwritten drawing in order to express the fact that I need the rectangles to line up with the horizontal axis as shown. So, the first rectangle travels from 0 to 5. The second rectangle travels from 1 to 6, etc all the way to the 6th rectangle travelling from 5 to 10. Also, all the rectangles should be the same width and length even though it may not seem that way by the picture. I also don't need a y-axis. Thanks and I'm sorry for not being clearer the first time.  \begin{tikzpicture}[ squarednode/.style={draw=black, minimum size=9.9mm}, y=1.5cm ]    %boxes      \draw (0.5, 5.5) node[squarednode] {$X_{1}^{*}$};     \draw (1.5, 5.5) node[squarednode] {$X_{2}^{*}$};     \draw (2.5, 5.5) node[squarednode] {$X_{3}^{*}$};     \draw (3.5, 5.5) node[squarednode] {$X_{4}^{*}$};     \draw (4.5, 5.5) node[squarednode] {$X_{5}^{*}$};                  \draw (1.5, 4.5) node[squarednode] {$X_{2}^{*}$};     \draw (2.5, 4.5) node[squarednode] {$X_{3}^{*}$};     \draw (3.5, 4.5) node[squarednode] {$X_{4}^{*}$};     \draw (4.5, 4.5) node[squarednode] {$X_{5}^{*}$};     \draw (5.5, 4.5) node[squarednode,dashed] {0};      \draw (2.5, 3.5) node[squarednode] {$X_{3}^{*}$};     \draw (3.5, 3.5) node[squarednode] {$X_{4}^{*}$};     \draw (4.5, 3.5) node[squarednode] {$X_{5}^{*}$};     \draw (5.5, 3.5) node[squarednode,dashed] {0};     \draw (6.5, 3.5) node[squarednode,dashed] {0};          \draw (3.5, 2.5) node[squarednode] {$X_{4}^{*}$};     \draw (4.5, 2.5) node[squarednode] {$X_{5}^{*}$};     \draw (5.5, 2.5) node[squarednode,dashed] {0};     \draw (6.5, 2.5) node[squarednode,dashed] {0};     \draw (7.5, 2.5) node[squarednode,dashed] {0};          \draw (4.5, 1.5) node[squarednode] {$X_{5}^{*}$};     \draw (5.5, 1.5) node[squarednode,dashed] {0};     \draw (6.5, 1.5) node[squarednode,dashed] {0};     \draw (7.5, 1.5) node[squarednode,dashed] {0};     \draw (8.5, 1.5) node[squarednode,dashed] {0};          \draw (5.5, 0.5) node[squarednode,dashed] {0};     \draw (6.5, 0.5) node[squarednode,dashed] {0};     \draw (7.5, 0.5) node[squarednode,dashed] {0};     \draw (8.5, 0.5) node[squarednode,dashed] {0};     \draw (9.5, 0.5) node[squarednode,dashed] {0};                      \end{tikzpicture}
59406
Suppose I have a complex figure made ​​with TikZ. How do I use it several times without having to repeat all the commands?  \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{tikz}  \begin{document}  Base figure  \begin{tikzpicture}   \draw[blue] circle (2);   \foreach \i in {0,10,...,350}     \draw[blue] (\i:1.9) -- (\i:2.1); \end{tikzpicture}  Using base figure.  \begin{tikzpicture}   \draw[blue] circle (2);   \foreach \i in {0,10,...,350}     \draw[blue] (\i:1.9) -- (\i:2.1);   \foreach \i in {0,10,...,350}     \node at (\i:2.7) {\tiny $\i^\circ$}; \end{tikzpicture}  Using base figure.  \begin{tikzpicture}   \draw[blue] circle (2);   \foreach \i in {0,10,...,350}     \draw[blue] (\i:1.9) -- (\i:2.1);   \foreach \i in {0,10,...,350}     \draw (0,0) -- (\i:2); \end{tikzpicture}  \end{document}
37681
This code works correctly:  \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning,calc} \begin{document}  \begin{tikzpicture}   \tikzset{     every picture/.prefix style={       execute at begin picture=\shorthandoff{;}     }   }   \def\names{{"1", "2"}}   \foreach \i in {0,1} {%     \ifnum\i=0\relax       \node (\i) [draw] {\pgfmathparse{\names[\i]}\pgfmathresult};     \else       \pgfmathparse{int(\i-1)}       \node (\i) [draw,right= 1cm of \pgfmathresult]             {\pgfmathparse{\names[\i]}\pgfmathresult};       \draw[dotted] ($(\pgfmathresult.south east) !.5! (\i.south west)$)             -- +(0,1cm);   \fi } \end{tikzpicture} \end{document}   But when I add  \usepackage[utf8]{inputenc} \usepackage[german]{babel}   to the preamble, it starts giving an error:  ! Argument of \language@active@arg" has an extra }. &lt;inserted text&gt;                  \par  l.25 }   the same for russian. It is somehow related to the quotes in the array:   \def\names{{"1", "2"}}   I tried the tricks, shown here for the french, but they don't work.
42905
I have the following piece of tikz code:  \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[&gt;=latex] \draw (2,2) circle [radius=2pt]; \draw (3,3) circle [radius=2pt]; \path[inner sep=0pt] (2,2) ++(45:2pt) node (A) {}; \path[inner sep=0pt] (3,3) ++(225:2pt) node (B) {}; \draw[-] (A) -- (B); \end{tikzpicture} \end{document}   where I want to connect two connect the circles with a line. Points A and B should be on the circles, but unfortunately they are slighty off. How can I fix the existing code?
107943
I've looked to another example but struggle to adapt it to my needs. Tikz is new to me.    \begin{center}   \begin{tikzpicture}[every edge/.style={shorten &lt;=1pt, shorten &gt;=1pt}]   \draw (0,0)  node [below] {0} -- (1,0) node [below] {1};   % draw the tick marks   \coordinate (p) at (0,2pt);   \foreach \myprop/\mytext [count=\n] in {0.06/$p_1$,0.06/$p_2$,0.06/$p_3$,0.06/$p_4$,0.06/$p_5$,0.15/$p_6$,0.13/$p_7$,0.14/$p_8$,0.15/$p_9$,0.13/$p_10$}   \draw [decorate,decoration={brace,amplitude=2}] (p)  edge [draw] +(0,-4pt) -- ++(\myprop,0) coordinate (p) node [midway, above=2pt, anchor=south] {\mytext} ;   \path (1,2pt) edge [draw]  ++(0,-4pt); \end{tikzpicture} \end{center}     Latex squeeze all the values together instead of spreading them over the 0 to 1 axis.
120542
I'm trying to use the method outline in   to create a graph of the area between two curves to insert into a solution sheet. However, when I do, the box is placed incorrectly. The tikzpicture ends up way higher than it should be, rather than being in line, and so covers up text, or other pictures placed above it. My code is as follows:  \documentclass[11pt]{article}  \usepackage{tikz} \usepackage{pgfplots}  \usepgfplotslibrary{fillbetween} \usetikzlibrary{patterns}  \begin{document} The box for the tikzpicture appears to be much higher than it should be.\\ {\begin{tikzpicture}[scale=0.75] \begin{axis}[ xmin=0,xmax=5,     ymin=-1, ymax=6,         xtick = {-1,1},     ytick = {1,2,3,4,5,6},     axis lines=center,     axis line style = &lt;-&gt;,         ticklabel style = {font=\small} ]  \addplot[name path=F,domain={0:5}] {x}; \addplot[name path=G,domain={0:5}] {(x-2)^2}; \addplot[pattern=north west lines, pattern color=gray!50]fill between[of=F and G, soft clip={domain=1:4}]; \end{axis} \end{tikzpicture}} \end{document}
63680
I am interested in outputting  this graph in  latex using tikz:    So far I got this:    and my tikz code is   \begin{tikzpicture}     \node[shape=circle,draw=black] (A) at (0,0) {A};     \node[shape=circle,draw=black] (B) at (0,3) {B};     \node[shape=circle,draw=black] (C) at (2.5,4) {C};     \node[shape=circle,draw=black] (D) at (2.5,1) {D};     \node[shape=circle,draw=black] (E) at (2.5,-3) {E};     \node[shape=circle,draw=black] (F) at (5,3) {F} ;      \path [-&gt;] (A) edge node[left] {$5$} (B);     \path [-&gt;](B) edge node[left] {$3$} (C);     \path [-&gt;](A) edge node[left] {$4$} (D);     \path [-&gt;](D) edge node[left] {$3$} (C);     \path [-&gt;](A) edge node[right] {$3$} (E);     \path [-&gt;](D) edge node[left] {$3$} (E);     \path [-&gt;](D) edge node[top] {$3$} (F);     \path [-&gt;](C) edge node[top] {$5$} (F);     \path [-&gt;](E) edge node[right] {$8$} (F);    \end{tikzpicture}   I want to know how to draw the arc between nodes B and E and also thicker  arcs with their lengths in center. Any help is appreciated
48666
I need to connect the rectangles by labeled arrows (rights) in this case:        \documentclass[tikz,border=2mm]{standalone}      \usetikzlibrary{arrows, chains}       \begin{document}          \begin{tikzpicture}[        node distance = 0mm,          start chain = going right,           box/.style = {draw, semithick, minimum size=1cm,                 outer sep = 3mm, on chain,}                     ]      \foreach \i  in {{\Huge S_0}, S_1, S_2, S_3, S_4, S_5, S_6, S_7, S_8}         \node[box,label=below:] {$\i$};       \end{tikzpicture}      \end{document}   I need also label arrows with \lambda_n where n is number from 0 to 7. Labels should be placed above the arrows.
29311
How do I pass two parameters to a tikz style?  I would like to do something like this:  \begin{tikzpicture}[     transformer/.style={draw, cylinder, gray!80, rotate=90, minimum height=#1, minimum width=#2},   And then, I want to use this style in a node:  \node [transformer{2.3cm}{1cm}] () at (0,0.6) {};
107743
I'm drawing a automaton figure, and I want to name it says 'M1' below the figure? A minimal example would be greatly appreciated. Thank you.  \begin{tikzpicture}[shorten &gt;=1pt,node distance=2cm,on grid,auto]      \node[state,initial]    (q_0)                   {$q_0$};      \node[state,accepting]  (q_1)   [right=of q_0]  {$q_1$};      \node[state]            (q_2)   [right=of q_1]  {$q_2$};       \path[-&gt;]     (q_0) edge                  node {a}            (q_1)     (q_1) edge                  node {$\lambda$}    (q_2)     (q_2) edge  [bend right]    node {$\lambda$}    (q_0)     ; %end path  \end{tikzpicture}
30527
The MWE:  \documentclass{standalone}  %====================================== \usepackage{tikz} \usetikzlibrary{graphdrawing} \usetikzlibrary{arrows} \usetikzlibrary{graphs} \usegdlibrary{force, layered, trees} %======================================  \begin{document}  \tikz  \graph [spring layout, nodes = draw] {     a/"dispersive\newline collision";     b/"non-dispersive\newline  collision";      a -&gt; b };  \end{document}   The output:    The question:  As you can see above, the \newline command does nothing. Trying to use \\ instead of \newline, like how the pgfmanual does in some examples (see pg. 386) has the same effect. Why? What can I do in order to have the words appear on separate "lines"?
18322
I have the following image    that was created with this code:  \documentclass[varwidth=true, border=2pt]{standalone} \usepackage{tikz} \usepackage{tkz-euclide}  \begin{document} \usetkzobj{all} \begin{tikzpicture}     \tkzSetUpPoint[shape=circle,size=10,color=black,fill=black]     \tkzSetUpLine[line width=1]     \tkzDefPoints{0/0/A, 3/0/B', 2/2/C, 4/4/C'}     \tkzDefLine[parallel=through C](B',C') \tkzGetPoint{Phelper}     \tkzInterLL(A,B')(C,Phelper) \tkzGetPoint{B}     \tkzDrawLine[add=0 and 0.2](A,B')     \tkzDrawLine[add=0 and 0.2](A,C')     \tkzDrawSegment(B',C')      \node at ($(A)+(-0.1,-0.2)$)  {$A$};     \node at ($(B')+(0.2,-0.2)$)  {$B'$};     \node at ($(C')+(0,0.4)$)  {$C'$};     \node at ($(B)+(0.2,-0.2)$)  {$B$};     \node at ($(C)+(0.28,0.5)$)  {$C$};     \tkzDrawPolygon[ultra thick,color=blue,fill=blue!20](A,B',C')      \tkzDrawPolygon[line width=0.3pt,color=red,fill=red!20](A,B,C)      \tkzDrawPoints(A,B',C',B,C)     \tkzLabelSegment[below,red](A,B){$c$}     \tkzLabelSegment[left,red](A,C){$b$}     \tkzLabelSegment[right,red](B,C){$a$}     \tkzLabelSegment[below,blue,pos=0.8](A,B'){$c'$}     \tkzLabelSegment[left,blue,pos=0.8](A,C'){$b'$}     \tkzLabelSegment[right,blue](B',C'){$a'$} \end{tikzpicture} \end{document}   As you might notice, the space above C' is bigger than necessary. This is because of Phelper. I need Phelper for the construction, but it should not influence the image size in any way. I've tried to get Phelper closer to C, but that seems not to be possible.  How can I stop defined (but not visible) points from influencing image size?  Please note: I wrap code like this in a figure. So images like the one above are only a part of the whole document. So working with standalone does not solve my problem.
30129
I want to make following Software architecture inside TikZ:    See below my code:  \documentclass[border=2px]{standalone} \usepackage[utf8]{inputenc} \usepackage{tikz} \usetikzlibrary{shapes.geometric, arrows}  \tikzset{     green/.style  = {draw, rectangle, minimum width=1cm, minimum height=1cm, text centered, text width=1.2cm, font=\footnotesize, draw=black, fill=green!30},     blue/.style   = {draw, rectangle, minimum width=6cm, minimum height=1cm, text centered, text width=5.0cm, font=\footnotesize, draw=black, fill=blue!30},     yellow/.style = {draw, rectangle, minimum width=6cm, minimum height=1cm, text centered, text width=5.0cm, font=\footnotesize, draw=black, fill=yellow!30}, }  \begin{document} \begin{tikzpicture}[node distance=1.1cm]     \node (r1c1) [green] {VC++};     \node (r1c2) [green, right of=r1c1, xshift=0.5cm] {VB.NET};     \node (r1c3) [green, right of=r1c2, xshift=0.5cm] {C\#.NET};     \node (r1c4) [green, right of=r1c3, xshift=0.5cm] {Others};     \node (r2c1) [blue,  below of=r1c2, xshift=0.8cm] {COM-API Interface};     \node (r3c1) [yellow, below of=r2c1] {Autodesk Inventor Application};      \draw (r1c1);     \draw (r1c2);     \draw (r1c3);     \draw (r1c4);     \draw (r2c1);     \draw (r3c1); \end{tikzpicture} \end{document}   Below is the generated diagram:    The modules inside generated diagram are not properly aligned. Any suggestions please?
38370
I'm creating a beamer presentation, in which I use TikZ.  I am making a figure, on which I would like to highlight something (using \only&lt;&gt; command). My figure contains an ellipse that is decorated with random steps:  ... \node[ellipse,minimum width=1cm,black!30,decorate,decoration={random steps,segment length=0.2cm,amplitude=.1cm}] {};  \only&lt;1&gt;{ \node (n) at (0,0) {A}; } \only&lt;2&gt;{ \node (n) at (0,0) {B}; }   The ellipse is rendered in differenlty. How can I make it to render the same? or what other decoration can I use to get a similar effect to random steps?
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?
105338
I want to reproduce the following figure with tikz (because there is a typo in the text in this figure).   My tikz code is (borrowed from )  \documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{decorations.text} \definecolor{mygray}{RGB}{208,208,208} \definecolor{mymagenta}{RGB}{226,0,116} \newcommand*{\mytextstyle}{\sffamily\Large\bfseries\color{black!85}} \newcommand{\arcarrow}[3]{%    % inner radius, middle radius, outer radius, start angle,    % end angle, tip protusion angle, options, text    \pgfmathsetmacro{\rin}{1.7}    \pgfmathsetmacro{\rmid}{2.2}    \pgfmathsetmacro{\rout}{2.7}    \pgfmathsetmacro{\astart}{#1}    \pgfmathsetmacro{\aend}{#2}    \pgfmathsetmacro{\atip}{5}    \fill[mygray, very thick] (\astart+\atip:\rin)                          arc (\astart+\atip:\aend:\rin)       -- (\aend-\atip:\rmid)       -- (\aend:\rout)   arc (\aend:\astart+\atip:\rout)       -- (\astart:\rmid) -- cycle;    \path[       decoration = {          text along path,          text = {|\mytextstyle|#3},          text align = {align = center},          raise = -1.0ex       },       decorate    ](\astart+\atip:\rmid) arc (\astart+\atip:\aend+\atip:\rmid); }  \begin{document}  \begin{tikzpicture}    \fill[even odd rule, mymagenta] circle (1.5);     \node at (0,0) [       font  = \mytextstyle,       color = white,       align = center    ]{       Learn\\       $6\sigma$    };     \arcarrow{ 85}{3}{Define}    \arcarrow{290}{357}{Measure}    \arcarrow{210}{289}{Analyze}    \arcarrow{206}{146}{Improve}    \arcarrow{130}{96}{Control}  \end{tikzpicture}  \end{document}   and the output is     I need hints to get my figure more close the original one. Thanks