I want to uncover/draw a picture bit by bit for beamer slides. I imagined that using \only inside a \foreach loop should work, for instance:  \documentclass{beamer} \usepackage{tikz}  \begin{document}   \begin{frame}     \begin{tikzpicture}[every node/.style={draw,circle}]       \node (n0) {$0$};       \foreach \i [evaluate=\i as \j using \i-1] in {1,...,3} {%         \only&lt;\i-&gt;{%           \node[right of=n\j] (n\i) {$\i$};         }       }     \end{tikzpicture}   \end{frame} \end{document}   Unfortunately, two problems occur.   Something goes wrong with node names; I get errors of the form  Package pgf Error: No shape named n0.0 is known.  When using \j in the parameter of \only, I get hundreds of errors and pages.   What is going on here?
38916
I have the following code:  \documentclass[11pt]{article} \usepackage[a4paper]{geometry} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture}[node distance = 0.5cm, auto] \node (0) {Block 0}; \node (1) [below= of 0.south] {Block 1}; \node (2) [below= of 1.south] {Block 2}; \end{tikzpicture} \end{document}   It prints this:    I tried to do the same with pgf loop, but don't know how to decrease the counter:  \foreach \x in {0,...,2} {   \ifnum\x=0\relax       \node (\x) {Block \x};   \else       %\prev=\x - 1 &lt;- ???       \node (\x) [below= of \prev.south] {Block \x};   \fi }
48018
I want to plot several curves with a \foreach command in pgfplots. I don't want any markers, and I can't find a way to get colored plots without markers in a \foreach loop. Using no markers gets rid of markers and colors.  \documentclass[12pt]{article} \usepackage{pgfplots} \usepackage{tikz}  \begin{document} \begin{tikzpicture} \begin{axis} \foreach \pas in {1,2,...,10}  { \addplot[mark=none] expression {\pas*\x}; } \end{axis}  \end{tikzpicture} \end{document}
41724
For use as a headline in beamer, I would like to scale the following tikz image to \paperwidth, preserving the x-y-ratio. I seem to be too dumb to find this (easy?!) solution... Thanks for any help!  Example:  \documentclass{beamer} \usepackage{tikz} \begin{document} \begin{frame}{A Frame} \begin{tikzpicture} % \draw[color=blue, fill=blue] (0,0) .. controls (5.30, 1.76) and (10.55, 1.32) .. (10.61, 1.32) -- (10.61, 1.75) -- (0,1.75) -- (0,0);         \end{tikzpicture} \end{frame} \end{document}
76791
I have a set of two nodes and I would like to draw tight ellipses around them in my tikz picture. Note that this is part of a beamer presentation.    I have attached an image that illustrates the wanted effect.    Here is what I have so far:  \documentclass[10pt,aspectratio=1610]{beamer} \usepackage{tikz} \usetikzlibrary{shapes,arrows,backgrounds,fit,positioning}  \begin{document}  \tikzset{res/.style={ellipse,draw,minimum height=0.5cm,minimum width=0.8cm}} \tikzset{literal/.style={rectangle,draw,minimum height=0.5cm,minimum width=0.8cm,text width = 1.2 cm, align = center}}  \begin{frame}[fragile]{Example}{} \begin{tikzpicture}[node distance = 2 cm,auto, ] \node[res,] (obs1) {\footnotesize :obs1} ; \node[res, left = 1cm of obs1] (shop1) {\footnotesize :shop1} ; \node[literal, left = 1cm of shop1] (shopName1) {\footnotesize ``Barnes \&amp; Noble''} ; \node[res, above of = shop1] (book1) {\footnotesize :book1} ; \node[literal, left = 1cm of book1] (bookName1) {\footnotesize ``Dune''} ; \node[res, below of = obs1] (obs2) {\footnotesize :obs2} ; \node[res, left = 1cm of obs2] (shop2) {\footnotesize :shop2} ; \node[literal, left = 1cm of shop2] (shopName2) {\footnotesize ``Amazon''} ; \node[res, below of = shop2] (book2) {\footnotesize :book2} ; \node[literal, left = 1cm of book2] (bookName2) {\footnotesize ``Dracula''} ; \node[literal, below of = obs2] (measure2) {\footnotesize 12} ; \node[literal, above of = obs1] (measure1) {\footnotesize 7} ; \node[literal, right = 1cm of obs1] (monthName) {\footnotesize ``January''} ; \node[literal, right = 1cm of measure1] (yearNum) {\footnotesize ``2016''} ; \node[res, right = 1cm of monthName] (month) {\footnotesize :january2016} ; \node[res, above of = month] (year) {\footnotesize :2016} ; \node[res, below of = month] (day) {\footnotesize :date31012016} ;  \path[-&gt;,draw]     (obs1) edge node[midway,above=-6pt,fill=white,inner sep=0pt] {\footnotesize :shop} (shop1)     (obs2) edge node[midway,above=-6pt,fill=white,inner sep=0pt] {\footnotesize :shop} (shop2)      (obs1) edge node[midway,above=-6pt,fill=white] {\footnotesize :book} (book1)     (obs2) edge node[midway,above=-6pt,fill=white] {\footnotesize :book} (book2)      (book1) edge node[midway,above=-6pt,fill=white,inner sep=0pt] {\footnotesize :name} (bookName1)     (book2) edge node[midway,above=-6pt,fill=white,inner sep=0pt] {\footnotesize :name} (bookName2)      (shop1) edge node[midway,above=-6pt,fill=white] (title1) {\footnotesize :title} (shopName1)     (shop2) edge node[midway,above=-6pt,fill=white] (title2) {\footnotesize :title} (shopName2)      (obs1) edge node[midway,above=-6pt,fill=white] {\footnotesize :price} (measure1)     (obs2) edge node[midway,above=-6pt,fill=white] {\footnotesize :price} (measure2)      (obs1) edge node[midway,above=-6pt,fill=white]  {\footnotesize :date} (day)     (obs2) edge node[midway,above=-6pt,fill=white] {\footnotesize :date} (day)      (day) edge node[midway,above=-6pt,fill=white] {\footnotesize skos:broader} (month)     (month) edge node[midway,above=-6pt,fill=white] {\footnotesize skos:broader} (year)      (month) edge node[midway,above=-6pt,fill=white,inner sep=0pt] {\footnotesize :month} (monthName)     (year) edge node[midway,above=-6pt,fill=white] {\footnotesize :year} (yearNum)     ;  \begin{pgfonlayer}{background}   \node[fit=(shopName1)(shop1), fill=violet!30,ellipse] {};   \node[fit=(shopName2)(shop2), fill=violet!30,ellipse] {};   \node[fit=(bookName2)(book2), fill=violet!30,ellipse] {};   \node[fit=(bookName1)(book1), fill=violet!30,ellipse] {};   \node[fit=(measure1)(obs1), fill=blue!30,ellipse] {};   \node[fit=(measure2)(obs2), fill=blue!30,ellipse] {};   \node[fit=(year)(yearNum), fill=green!30,ellipse] {};   \node[fit=(month)(monthName), fill=green!30,ellipse] {}; \end{pgfonlayer} \end{tikzpicture} \end{frame} \end{document}   Here is the result that it produce    Note how the ellipses do not fit the nodes but cover much more. How can I create a tight ellipse around a pair of nodes?
87214
I have a problem with tikz-cd. When I try to compile in beamer it doesn't work and I no have idea why. Can someone help-me, please?  \documentclass[aspectratio=169]{beamer}  \usetheme{Warsaw} \theoremstyle{plain} \setbeamercovered{transparent} \usefonttheme[onlymath]{serif}  \usepackage[brazil]{babel} \usepackage{tikz-cd}  \tikzset{   every picture/.prefix style={     execute at begin picture=\shorthandoff{"}   } }  \begin{document}  \frame{\titlepage} \section{Motivation}  \begin{frame} \[\begin{tikzcd}[column sep=small] Y \ar[dr, "\displaystyle{p_G}"'] \ar[rr, "\displaystyle{p}"]&amp; &amp;  X \\ &amp; Aut(Y|X)\bs Y \ar[ur, "\displaystyle{\widetilde{p}_G}"'] &amp; \end{tikzcd}\] \end{frame}  \end{document}
93660
I'm finding some weird behavior with TikZ's \foreach within an \begin{axis} environment.  This works:  \foreach \x in {-2,-1,...,2} {   \addplot[thick, domain=0.05+(\x*2-1)*pi/2:+(\x*2+1)*pi/2-0.05] (x, {tan(deg(x))});  }   but this doesn't:  \foreach \x in {-2,-1,...,2} {   \draw (\x,-5) -- (\x,5); }   It gives the error  ! Undefined control sequence. &lt;argument&gt; \x                ,-5 l.771     \end{axis}   Here's the really weird part: it only fails when the axis has defined bounds. For example, here's a MWE that works (but doesn't draw anything):  \documentclass{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}   \begin{axis} % [ ymin=-3, ymax=3, xmin=-5, xmax=5]     \foreach \q in {-2,-1,...,2} {       \draw (axis cs: \q,-5) -- (axis cs: \q,5);     }   \end{axis} \end{tikzpicture} \end{document}   but removing the comment causes it to fail.  Why is this and how can I prevent it?  (My end goal is to draw five segments of the tangent function and their verical symptotes.)
33776
I am trying to mark two inflection points using a foreach loop in a pgfplot, but it isn't working.  \documentclass[tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat = 1.10}  \begin{document} \begin{tikzpicture}   \pgfmathsetmacro{\infx}{1/sqrt(2)}   \pgfmathsetmacro{\infy}{exp(-.5)}   \begin{axis}[     xmin = -3,     xmax = 3,     ymin = -0.1,     ymax = 1.05,     domain = -4:4     ]     \addplot[blue, samples = 500, smooth] gnuplot {exp(-x^2)};      \foreach \x/\y in {\infx/\infy, -\infx/\infy}{       \draw[red] (axis cs: \x, \y) circle[radius = .025];     }   \end{axis} \end{tikzpicture} \end{document}   I am being told:  Undefined control sequence.^M &lt;argument&gt; axis cs: \x ^M                        , \y ^M l.34   \end{axis}^M
9795
This code:  \documentclass[10pt]{beamer} \setbeamertemplate{itemize item}[circle] \setbeamertemplate{itemize subitem}[triangle] \setbeamertemplate{itemize subsubitem}[square]   \begin{document} \begin{frame} \begin{itemize} \item first level     \begin{itemize}     \item second level         \begin{itemize}         \item third level         \end{itemize}     \end{itemize} \end{itemize} \end{frame} \end{document}    produces this output:    I expected the symbol of the first level item to be a circle, not a square. Is there an error in my code? The log file was too long to include in the question, so I .
17692
I created a presentation using the beamer class with texmaker. Right now it looks like this:    Now I would like to include a jpg where the red circle is located, so basically inside a palette. Can anybody help me how to do that?  The code:  \documentclass[t,compress,10pt,xcolor=dvipsnames]{beamer}  \usepackage{lmodern} \usepackage[labelformat=empty,labelsep=none]{subfig} \usepackage{caption} \usepackage{float} \usepackage{wrapfig}  \newcommand*\oldmacro{}% \let\oldmacro\insertshorttitle%  \renewcommand*\insertshorttitle{%   \oldmacro\hfill%  \insertframenumber\,/\,\inserttotalframenumber}  \definecolor{UniDunkel}{RGB}{73,142,137} \definecolor{UniHell}{RGB}{142,184,182}  \setbeamertemplate{blocks}[rounded][shadow=true] \setbeamercolor{structure}{fg=UniDunkel}  \setbeamercolor{block body}{parent=normal text,use=block title, bg=block title.bg!10!bg} \setbeamercolor{block body alerted}{parent=normal text,use=block title  alerted,bg=block title alerted.bg!10!bg} \setbeamercolor{block body example}{parent=normal text,use=block title  example,bg=block title example.bg!10!bg}  \setbeamercolor*{palette primary}{use=structure,fg=white,bg=UniDunkel!115} \setbeamercolor*{palette secondary}{use=structure, fg=UniHell,  bg=UniHell} \setbeamercolor*{palette tertiary}{use=structure,fg=white,bg=UniDunkel!115} \setbeamercolor*{palette quaternary}{fg=Orange}  \setbeamercolor*{sidebar}{use=structure,bg=structure.fg} \setbeamercolor*{palette sidebar primary}{use=structure,fg=structure.fg!10} \setbeamercolor*{palette sidebar secondary}{fg=white} \setbeamercolor*{palette sidebar quaternary}{fg=white} \setbeamercolor*{titlelike}{parent=palette primary}  \setbeamercolor*{fine separation line}{}  \setbeamercolor{block title}{use=structure,fg=white,bg=structure.fg!0!red} \setbeamercolor{block title alerted}{use=alerted text,fg=white,bg=alerted text.fg!0!white} \setbeamercolor{block title example}{use=example text,fg=white,bg=example text.fg!0!white}  \useoutertheme{miniframes} \useinnertheme{circles} \setbeamertemplate{footline}[frame number]  \beamertemplatenavigationsymbolsempty  \begin{document}  \section{Section1} \subsection{Subsection1} \frame { \frametitle{Frame1} }  \section{Section2} \subsection{Subsection2} \frame { \frametitle{Frame2} }   \end{document}
82385
How come that in the code below, \foreach is unable to give me round numbers?  \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots}  \usetikzlibrary{positioning, calc}  \begin{document}     \begin{tikzpicture} \foreach\x in {0.1,0.2,...,0.9}\node at (0,{-2*\x}){\tiny\x};     \end{tikzpicture} \end{document}
119619
I'm trying to draw a stack of arrows at different angles in a \foreach loop in TikZ.  I don't want to have to declare every z coordinate and angle manually so I was using the {1,2,...,10} syntax but this doesn't seem to work in the example below with two variables in the for loop.  \documentclass{standalone} \usepackage{tikz} \usepackage{tikz-3dplot} \usetikzlibrary{arrows} \usetikzlibrary{3d} \tikzset{&gt;=latex}  \begin{document}  \tdplotsetmaincoords{90}{90} \tdplotsetrotatedcoords{0}{20}{70}  \begin{tikzpicture}[tdplot_rotated_coords,scale=0.5]  \foreach \x/\y in {7/0, 8/10, ..., 10/30} { \draw (2, 2, \x) circle(2) node[right]{\y}; \draw[-&gt;, ultra thick, red] (2, 2, \x) --++ (\y:2) --++ (\y+180:4); }  \end{tikzpicture} \end{document}   Does anyone know how to get around this?  The code above gives the error ! Illegal unit of measure (pt inserted).  Thanks.
8295
I have a PNG plot with a couple of black patches in it, and I'd like to refer to it in the \caption of the figure. According to the TikZ manual, I'd have to  \tikz \fill[black] (1ex,1ex) circle (1ex);   which works perfectly outside a \caption. Using this inside a \caption, though, leaves me with the compile error  ! Use of \use@pgflibrary doesn't match its definition. \pgfutil@ifnextchar ...1\def \pgfutil@reserved@a {                                               #2}\def \pgfutil@reserved@... l.375 ...blah blah.}  ?   The following produces the compile error  \documentclass{article} \usepackage{tikz}  \begin{document} \tikz \fill[orange] (1ex,1ex) circle (1ex); \begin{figure} \caption{\tikz \fill[orange] (1ex,1ex) circle (1ex);} \end{figure} \end{document}   Any hints here?
99858
I did a commutative diagram with tikz in the article class and everything works. The next code is the MWE in article class.  \documentclass{article}  \usepackage{tikz} \usetikzlibrary{matrix}  \begin{document} \begin{center} \begin{tikzpicture}   \matrix(m)[matrix of math nodes,row sep=2em,column sep=4em,minimum width=2em]   { A &amp; B \\     C &amp; D \\};   \path[-stealth]     (m-1-1) edge node [above] {e} (m-1-2) edge node [left] {f} (m-2-1)     (m-1-2) edge node [right] {g} (m-2-2)     (m-2-1) edge node [below] {h} (m-2-2); \end{tikzpicture} \end{center} \end{document}   But, when I copy the code in a Beamer document, something is wrong, as the following code.  \documentclass{beamer}  \usepackage{tikz} \usetikzlibrary{matrix}  \begin{document} \begin{frame} \begin{center} \begin{tikzpicture}   \matrix(m)[matrix of math nodes,row sep=2em,column sep=4em,minimum width=2em]   { A &amp; B \\     C &amp; D \\};   \path[-stealth]     (m-1-1) edge node [above] {e} (m-1-2) edge node [left] {f} (m-2-1)     (m-1-2) edge node [right] {g} (m-2-2)     (m-2-1) edge node [below] {h} (m-2-2); \end{tikzpicture} \end{center} \end{frame} \end{document}   Any idea? Am I doing something wrong?
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? ...
11087
I was wondering if anyone ever tried to typeset slides with a grid layout, ie. something like (see below the tikz grid showing it).  Expected functionalities:   ability to write text or place image across several columns on the fly (ie. provide kind of start coordinate/ size of frame containing text or image + text aligned on a grid) compatibility with [c] option for frame (or similar) I don't care about the crappy blocks from beamer (less is better) would appreciate to get something in the vein of    Starting point code (but no need to stick to it), where the grey block could be text and the yellow block an image:  \documentclass{beamer} \usepackage[utf8]{inputenc} \usepackage{tikz} \usetikzlibrary{calc}  \setbeamertemplate{headline}{}  \setbeamertemplate{navigation symbols}{}  \usebackgroundtemplate% {%     \begin{tikzpicture}[overlay,remember picture]         \draw[step=.4cm,gray,thin] (current page.south east) grid (current page.north west);         \draw[thick] ($(current page.north west)+(.4cm,-.4cm)$) rectangle ($(current page.north west)+(6cm,-1.6cm)$); % frametitle        \draw[thick] ($(current page.south west)+(0cm,.4cm)$) rectangle (current page.south east); % footer         \draw[thick] ($(current page.south west)+(1cm,.8cm)$) rectangle ($(current page.north west)+(3.4cm,-2.4cm)$);         \draw[thick] ($(current page.south west)+(3.8cm,.8cm)$) rectangle ($(current page.north west)+(6.2cm,-2.4cm)$);         \draw[thick] ($(current page.south west)+(6.6cm,.8cm)$) rectangle ($(current page.north west)+(9cm,-2.4cm)$);         \draw[thick] ($(current page.south east)+(-3.4cm,.8cm)$) rectangle ($(current page.north east)+(-1cm,-2.4cm)$);     \end{tikzpicture} }  \setbeamercolor{footline}{fg=white,bg=black}  \begin{document}  \begin{frame} \begin{tikzpicture}[overlay,remember picture]     \fill[yellow] ($(current page.center)+(.2,1.6cm)$) rectangle ($(current page.east)+(-1cm,-1.6cm)$);     \fill[gray] ($(current page.center)+(-.2,2.4cm)$) rectangle ($(current page.west)+(1cm,-2.4cm)$); \end{tikzpicture} \end{frame}  \end{document}     Note: if a ConTeXt solution is much convenient to use (less code to type), please feel free to share.
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.
9381
The example bellow comes from the  (p610). It does not work my computer. Note that it works when I comment the option [prefix=figures/]. Any idea of what could go wrong here?  \documentclass{article} % main document, called main.tex \usepackage{tikz} \usetikzlibrary{external} \tikzexternalize[prefix=figures/] % activate  \begin{document} \tikzsetnextfilename{trees} \begin{tikzpicture} % will be written to ’figures/trees.pdf’ \node {root} child {node {left}} child {node {right} child {node {child}} child {node {child}} }; \end{tikzpicture} \tikzsetnextfilename{simple} A simple image is \tikz \fill (0,0) circle(5pt);. % will be written to ’figures/simple.pdf’ \begin{tikzpicture} % will be written to ’figures/main-figure0.pdf’ \draw[help lines] (0,0) grid (5,5); \end{tikzpicture} \end{document}