New answers tagged

4

I'd suggest making a macro with just two arguments, where the second argument has a comma separated list of numbers. Then you can use \foreach [count=\i] \txt in {#2} ... to make the nodes. I also changed how the border is drawn and the filling, to improve the look of the vertices. \documentclass[12pt,a4paper]{article} \usepackage[left=10mm, top=15mm, right=...


2

This is the example under the documentation of option /tikz/intersection/sort by=<path name> in PGF manual. Without any \foreach, the left side can be drawn by \begin{tikzpicture} \draw[->, name path=curve] (1,1.5) .. controls (-1,1) and (2,0.5) .. (0,0); \draw[->, name path=line] (0,-.5) -- (1,2); \fill [name intersections={of=line ...


2

The syntax of the foreach loop allows to iterate on several variables. Here, the loop iterates on two variables named \pathname and \shift. This latter variable defines the horizontal shift to the right through \tikzset{xshift=\shift}. The name chosen in the loop {line/0cm, curve/2cm} is actually unrelated to the path names name path=curve and name path=...


4

You can use the undocumented discard layer of PGF for this as described in tikz: construct a phantom path. I wrapped it into a nice environment (which can't be nested). \documentclass[margin=5pt, tikz]{standalone} \usepackage{tikz} \let\showonlyend\relax \newenvironment{showonly}[2]{% \ifnum#1=#2\else% \let\showonlyend\endpgfonlayer \pgfonlayer{discard}\...


2

You can use if: \documentclass[margin=5pt, tikz]{standalone} \usepackage{tikz} \begin{document} \foreach \part in {1,...,3}{ \begin{tikzpicture}[ mystyle/.style={->, thin, font=\sffamily\tiny, blue, text=black, inner sep=0.5pt, very near start}, ] % 1: \ifnum\part=1 \draw[mystyle] (140:1.2) -- +(0.6,0.05) node[mystyle, above]{1}; \fi % 2: \ifnum\...


Top 50 recent answers are included