Is there an easy and efficient way to put multiple venn-diagrams in a single line? Either force the compiler to ignore the line break or shift all of the coordinates in the second one? I'm open to any solution.  \documentclass{article} \usepackage{tikz} \def \setA{ (0,0) circle (1cm) node {$A$}} \def \setB{ (1.5,0) circle (1cm) node {$B$}} \def \myrectangle{ (-2, -1.5) rectangle (3.5, 1.5) }  \begin{document} \begin{center} \begin{tikzpicture}[scale=0.6] \draw \myrectangle node[below left]{$U$}; \fill[gray] (0,0) circle (1cm); \fill[gray] (1.5,0) circle (1cm); \draw \setA; \draw \setB; \end{tikzpicture}  \begin{tikzpicture}[scale=0.6] \draw \myrectangle node[below left]{$U$}; \begin{scope} \clip \setA ; \fill[gray] \setB ; \end{scope} \draw \setA; \draw \setB; \end{tikzpicture} \end{center}  \end{document}
123559
I like my code to look like this:  \documentclass{article} \begin{document}  \begin{enumerate}   \item test text    \begin{enumerate}     \item 1     \item 2     \item 3     \item 4     \item 5   \end{enumerate} \end{enumerate}  \end{document}   For the sake of readability I like to put a blank line before a new environment starts. In the particular case I'm considering, the blank line adds some vertical space between the item from the first level enumerate and the first item from the second level enumerate.  So my question is: is there a best practice to format code related to blank lines before environments start? Should I avoid it? Should I comment out the blank line?  Clarification:  I'm talking about the vertical space between "test text" and "1". But, I'm not asking for a way to remove the extra space added by the blank like, I already know how to do that. My reasoning is the following:  Since adding a blank like before a new enumerate adds vertical space, it means that that blank line is meaningful for TeX. Since it is meaningful for TeX, is it OK to use it for the mere purpose of formatting code or should I avoid it?
106338
I want to make various copies of a graph in tikz. The graph I want has 10 vertices. But only has the edges between the vertices a_i,a_(i+1),t,b.  I would like to automatically create 8 copies of this graph. and draw them. I just don't know how to code it. Here is my current code, but it adds all of the edges to the same copy of the graph:  \begin{tikzpicture} [main_node/.style={circle,fill=blue!20,draw,minimum size=2em,inner sep=3pt]}] \node[main_node] (8) at (0:0.5) {b}; \node[main_node] (9) at (180:0.5) {t}; \foreach \x in {0,1,...,7}     \node[main_node] (\x) at (360/8*\x:2) {$a_{\x}$}; \foreach \x in {0,1,...,7}{     \pgfmathsetmacro{\y}{int(mod(\x+1,8))}     \path[draw,thick] (\x) edge node {} (8);     \path[draw,thick] (\x) edge node {} (9);     \path[draw,thick] (\x) edge node {} (\y);     \path[draw,thick] (8) edge node {} (9);     \path[draw,thick] (8) edge node {} (\y);     \path[draw,thick] (9) edge node {} (\y);    }   I want each of the edge sets to be drawn seperately.
21267
I have used the following code:      \begin{figure}[h]   \begin{tikzpicture}          \draw[-&gt;] (-0.5,0) -- (4,0) node[right] {$x$};         \draw[-&gt;] (0,-0.5) -- (0,4) node[above] {$y$};         \draw (0,0.5) -- (4,2);         \draw [dashed] (0,1.5) -- (4,4);   \end{tikzpicture}   \caption{No Interaction} \label{fig:M1}    \begin{tikzpicture}         \draw[-&gt;] (-0.5,0) -- (4,0) node[right] {$x$};         \draw[-&gt;] (0,-0.5) -- (0,4) node[above] {$y$};         \draw (0,0.5) -- (4,2.5);         \draw [dashed] (0,1.5) -- (4,3.5);   \end{tikzpicture}.  \caption{Interaction} \label{fig:M2}   \end{figure}     to insert two figures, however it places them one on top of the other and I would like them next to each other but labelled independently, is this possible?
77934
I would like to create a TikZ style that adds a thick outline to the node text using the \contour{&lt;colour&gt;}{&lt;text&gt;} macro from the contour package (as in the answer to the question ), i.e. I want to define a style halo so that  \node [halo] {Text};   is equivalent to  \node {\contour{red}{Text}};   My problem is that I cannot tell TikZ to use the node text as an argument for a macro.  The font option only works with switches like \itshape (as opposed to \textit{}, which requires the text to be italicised to be provided in the argument).  There are two keys execute at begin node={&lt;code&gt;} and execute at end node={&lt;code&gt;} that can be used to call code at the beginning and end of the node, but I can't split the \contour command up using execute at begin node={\contour{red{} and execute at end node={}} because the brackets don't match. Replacing { with \bgroup and } with \egroup fails with Missing } inserted.  Here's am MWE to play with:  \documentclass{article}  \usepackage{tikz} \usepackage[outline]{contour} \contourlength{1.2pt}   \begin{document}      \begin{tikzpicture}     \node {\contour{red}{Text}}; %    \node [font=\contour{red}{}] {Text}; % Doesn't change the text %    \node [execute at begin node={\contour{red}{},execute at end node={}}] {Text};  % Fails with ``Runaway argument?'' %    \node [execute at begin node={\contour{red}\bgroup},execute at end node={\egroup}] {Text};  % Fails with ``Missing } inserted''     \end{tikzpicture} \end{document}
20624
I apologize if this has already been covered in some other posts, but I couldn't find it anywhere and I'm not even sure if "brace diagram" is the correct name in English.  I have found some examples of probability trees, and some others that are close (like this: ), but while playing with them I couldn't get the correct output (The part of the first "text here" when out of boundaries into the brace).  What I'm trying to do is something like this with TikZ:    I know there are some ways to do this with mathmode, but I'm really interested in learning a little more about TikZ and how it works for diagrams like this.
67591
I'm trying to draw two arrows between nodes as follows:  A ------&gt; B   &lt;--/---   The arrows should be parallel, in opposite directions but not on top of each other. (I can bend the arrows but that's not what I'm after.)  What's the cleanest way to do this in TikZ? And can I have just one of the arrows "struck out" as in the example?
91164
What is the  difference between \node and \coordinate in TikZ? Exchanging them does no visual effect in my (to be honest: still simple) pictures.  When to use what?
90595
I have created some TikZ code to produce the diagram below (slightly simplified). This is my first real shot at TikZ and its taken me about 8 hours now to get this far. But I don't really begrudge the time, time spent learning is time well spent.  It is loosely based on .  I would like to have a different (variable) number of nodes in each layer, and would like to maintain the connection.  My current idea was to have a list of lists like {{1..3},{1..5},{1..7},{1..4},{1..3}} then I guesss i could use a nested for-each off the index. But that has 2 problems: I would lose my layer number, which I could get around by using count. Secondly, more majorly, I don't seen a good way of knowing how big the next layer is (to make the connections).     \documentclass{article} \usepackage{mathptmx} \usepackage{tikz} \usetikzlibrary{arrows} \usetikzlibrary{calc} \begin{document}   \def\layersep{3.5cm} \def\topnum{5} %\font\nullfont=cmr10 \begin{tikzpicture}[shorten &gt;=1pt,-&gt;,draw=black!50, node distance=\layersep]     \tikzstyle{neuron}=[circle,draw,fill=white!25,minimum size=25pt,inner sep=0pt]     \tikzstyle{bias neuron}=[neuron,dashed]       \foreach \y in {2,...,4}                 \foreach \x in {1,...,5}             \path   node[neuron] (L_\y_\x) at (\x cm,\y*\layersep) {$\sigma(\cdot)$};   %      \foreach  \x in {1,...,5}             \path  node[neuron] (L_1_\x) at (\x cm,1*\layersep) {$x_\x$};      \foreach  \x in {1,...,5}             \path  node[neuron] (L_5_\x) at (\x cm,5*\layersep) {$s_{m}(\cdot)$};       %Add Biases     \foreach \y in {1,...,4}     {         \path node[bias neuron] (B_\y) at (6 cm, 0.55*\layersep+\y*\layersep) {1};         \pgfmathtruncatemacro\nextlayer{\y+1}         \foreach \dest in {1,...,5}             \path (B_\y) edge[dashed] (L_\nextlayer_\dest.south);     }       % Connect every node in the input layer with every node in the     % hidden layer.     \foreach \layer in {1,...,4}         \pgfmathtruncatemacro\nextlayer{\layer+1}         \foreach \source in {1,...,5}             \foreach \dest in {1,...,5}                 \path (L_\layer_\source) edge (L_\nextlayer_\dest);   \end{tikzpicture} \end{document}
111830
Here is my problematic code:  \begin{tikzpicture} \draw  (0,0)  to [bend left=20] (3,3) node[midway] {midway label}; \end{tikzpicture}   I wanted to put a label midway of the line, but instead the label is at (0,0).  If I remove [bend left=20], the line is not bent, and the label still misplaced. If I remove to and replace it by --, then it works fine, but my line is not bent any more.  \begin{tikzpicture} \draw (0,0) -- (3,3) node[midway] {midway label}; \end{tikzpicture}   Works fine.  The problem occurs with MacTeX 2011 and MacTeX 2012.
99007
For an example relation R: A -> B, I have the following TikZ code:  \documentclass[tikz]{standalone} \usepackage{tikz} \usetikzlibrary{shapes,backgrounds,decorations.text,patterns} \usetikzlibrary{plotmarks}  \begin{document} \begin{tikzpicture}   \begin{scope}[mark=*,mark size=1pt] % sets A &amp; B   \draw (0,0) node[ellipse, minimum height=50pt,minimum width=30pt,draw,label=above:A]{};   \draw (2,0) node[ellipse, minimum height=50pt,minimum width=30pt,draw,label=above:B]{}; % draw line and label origin a to c   \draw[-&gt;] plot coordinates {(0,10pt)} (0,10pt) node[above]{a} -- (1.9,16pt); % add end point   \node at (2,16pt) {\pgfuseplotmark{*}}; % add end label   \node[above] at (2,16pt) {c}; % draw line and label origin a to e   \draw[-&gt;] plot coordinates {(0,10pt)} (0,10pt) node[above]{a} -- (1.9,-15pt); % add end point   \node at (2,-15pt) {\pgfuseplotmark{*}}; % add end label   \node[above] at (2,-15pt) {e}; % draw line and label origin b to d   \draw[-&gt;] plot coordinates {(0,-10pt)} (0,-10pt) node[above]{b} -- (1.6,2pt);  % add end point   \node at (1.7,2pt) {\pgfuseplotmark{*}}; % add end label   \node[above] at (1.7,2pt) {d};   \end{scope} \end{tikzpicture} \end{document}   Produces:    Is there a simpler way of accomplishing this in TikZ?  It seems like a lot of work.
68659
I am teaching how to convert from one base to another base, however, I can't find a way to do something like this:    I know little about Tikz, the only thing I have been able to produce is a simple square with a couple of lines over it, so I don't even know where to start. Any suggestions? I don't mind typing all the numbers, what I want to do is to automatize the process of creating the lines.
80681
How can parallel lines elegantly be added to an existing path? I am looking for a solution or hint to, how a general style can be made, that works with any path.  Example path:  \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}   \draw (0,0) -- (1,1) -| (2,2) -- (3,2) -- (3,1); \end{tikzpicture} \end{document}     Same path, with customizable extra lines:    Here I have drawn two extra lines, just to show, what I mean. Ideally a solution should only add one extra line, but somehow be expandable to any number of lines.  The question: , where my solution is less than elegant, has inspired me to ask this question.
80119
I have the following tikzpictures, and I would like to present them in two columns. However, no matter what I try, whether it be multicol or minipage or subcaption, they stubbornly stay in one column. You may think this is a duplicate question, but I've tried all the others and they don't work!  \documentclass[11pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{graphicx}  \usepackage{tikz} \usetikzlibrary{positioning}  \usepackage{float}  \begin{document}     \begin{figure} [b]         \centering         \begin{tikzpicture}         [pool/.style={circle, draw=blue!50, fill=blue!20, thick,             inner sep=0pt, minimum size=10mm}]         \node[pool] (A)              {A};         \node[pool] (B) [right=of A] {B};         \draw [&lt;-&gt;] (A) -- (B);         \end{tikzpicture}         \caption{Two-site exchange.}         \label{fig:simple2}     \end{figure}      \begin{figure} %[h]         \centering         \begin{tikzpicture}         [pool/.style={circle, draw=blue!50, fill=blue!20, thick,             inner sep=0pt, minimum size=10mm}]         \node[pool] (A) {A};         \node[pool] (B) [below left=of A] {B};         \node[pool] (C) [below right=of A]{C};         \draw [&lt;-&gt;] (A) -- (B);         \draw [&lt;-&gt;] (A) -- (C);         \end{tikzpicture}         \caption{Partial three-site exchange.}         \label{fig:partial3}     \end{figure}      \begin{figure} %[h]         \centering         \begin{tikzpicture}         [pool/.style={circle, draw=blue!50, fill=blue!20, thick,             inner sep=0pt, minimum size=10mm}]         \node[pool] (A) {A};         \node[pool] (B) [below left=of A] {B};         \node[pool] (C) [below=of A]{C};         \node[pool] (D) [below right=of A]{D};         \draw [&lt;-&gt;] (A) -- (B);         \draw [&lt;-&gt;] (A) -- (C);         \draw [&lt;-&gt;] (A) -- (D);         \end{tikzpicture}         \caption{Partial four-site exchange.}         \label{fig:partial4}     \end{figure}      \begin{figure} %[h]         \centering         \begin{tikzpicture}         [pool/.style={circle, draw=blue!50, fill=blue!20, thick,             inner sep=0pt, minimum size=10mm}]         \node[pool] (A) {A};         \node[pool] (B) [below left=of A] {B};         \node[pool] (C) [below right=of A]{C};         \draw [&lt;-&gt;] (A) -- (B);         \draw [&lt;-&gt;] (A) -- (C);         \draw [&lt;-&gt;] (B) -- (C);         \end{tikzpicture}         \caption{General three-site exchange.}         \label{fig:general3}     \end{figure}  \end{document}
11547
\begin{tikzpicture} \node [draw=black, anchor=south west] (label) at (0,0){\includegraphics[width=300mm]{th.jpg}}; \coordinate (ZX) at (157mm,104mm); \coordinate (YB) at (249mm,39mm); \coordinate (YY) at ($(ZX)!1.5!(YB)$); \coordinate (ZZ) at ($(YB)!2.5!(ZX)$); \draw[blue!20,very thick] (ZZ)--(YY); \draw[red!20,very thick, rotate around={90:(ZX)}] (157mm,104mm)--(249mm,39mm);%It works \draw[red!20,very thick, rotate around={-90:(ZX)}] (ZX)--(YB);%It doesn't work \filldraw[white] (ZX) circle (2mm); \filldraw[white] (YB) circle (2mm); \end{tikzpicture}   a working example       \documentclass{minimal} \usepackage{tikz,tikz-3dplot}  \begin{document}    \tdplotsetmaincoords{70}{115}    \begin{tikzpicture}[scale=4,tdplot_main_coords] \pgfmathsetmacro{\rvec}{.8} \pgfmathsetmacro{\thetavec}{30} \pgfmathsetmacro{\phivec}{60}  \tdplotsetrotatedcoords{\phivec}{\thetavec}{0}   \coordinate (O) at (1,1,1);   %these 2 lines overlap \draw[thick,-&gt;] (O) -- (0,.5,0); \draw[thick,tdplot_rotated_coords,-&gt;] (O) -- (0,.5,0);   %these 2 lines dont overlap \draw[thick,-&gt;] (1,1,1) -- (0,.5,0); \draw[thick,tdplot_rotated_coords,-&gt;] (1,1,1) -- (0,.5,0); \end{tikzpicture} \end{document}
71248
I'm using TikZ to plotting some functions for a document. For example, I want to plot 1/(x+1). So I did something like this:  \begin{tikzpicture}[&gt;=stealth,x=3mm,y=3mm] \draw (0,5) node[above]{\fimg $y=f(x+1)=\dfrac{1}{x+1}$}; \clip (-5,-5) rectangle (5,5); \ejes[1]{-4}{4}{-4}{4} \draw[samples=100] plot(\x,{1/(\x+1)}); \end{tikzpicture}   where \ejes[style]{xmin}{xmax}{ymin}{ymax} is command, that I have defined before to draw the axes (join with \fimg). My expected output for the code below was just the function, but I get this:    So, TikZ automagically put the vertical asymptote at x=-1. That isn't a bad thing, but now I want to have some control over it. For example I want dotted lines for vertical asymptotes. How can I do that?
73873
Sorry if duplicate (I'm sure duplicate) but I really can't find the way to do it in manual. I have created next block chain.     Here you can see curved line between last and third blocks. But I want something like this:  And the question: how can I сonnect them in this way? I'm sure that it is pretty simple. MWE:  \documentclass{article}  \usepackage{tikz} \usetikzlibrary{shapes,arrows,positioning,automata}  \begin{document} \begin{tikzpicture} \node[draw, thick, rectangle] (0) {Data arrival}; \node[draw, thick, rectangle, below of=0] (1) {Coks backoff procedure}; \node[draw, thick, rectangle, below of= 1] (2) {Get trigger-frame?}; \node[draw, thick, rectangle, below of= 2] (3) {Performs backoff procedure}; \node[draw, thick, shape aspect=2.7, diamond, below =0.5cm of 3] (4) {$b&lt;0$?};   \path[&gt;=latex, auto = right,every loop]  (0) edge[] node {} (1) (1) edge node {} (2) (2) edge node {} (3) (3) edge node {} (4) (4.east) edge[in=0, out=0, looseness=3] node[right] {N} (2.east) ;      \end{tikzpicture} \end{document}
118737
Is it possible to change the line style in a tikz figure in the same \draw command?  I am looking for something like:  \documentclass[tikz]{standalone} \begin{document}     \begin{tikzpicture}         \draw[style1] (0,0) -- ++(1,0)  **CHANGE STYLE** -- ++(1,0);     \end{tikzpicture} \end{document}   The main motivation is that I don't want to loose the relative coordinate as I go on with a long \draw command.