Tag Info

New answers tagged

7

TikZ has its own parser for creating paths and a slightly different parser for children in trees. So it isn't possible to stick arbitrary code just anywhere. Inside normal paths code can be wrapped inside the \pgfextra command, but this isn't allowed in trees. If it is simply evaluation required then the (possibly still undocumented) evaluate key can be ...


2

How about using the TikZ math library?. If provides a for loop that doesn't use a TeX scope, plus some other useful stuff. I does, however, require the latest release of PGF: \documentclass[tikz,border=5]{standalone} \usetikzlibrary{math} \begin{document} \begin{tikzpicture}[% titmarg/.style={yshift=4cm}, textmarg/.style={yshift=-5cm}, ...


6

The syntax of \pgfmathaddtocount is \pgfmathaddtocount{<TeX counter>}{<expression>} so, with \newcount\checkuno in the preamble, \pgfmathaddtocount{\checkuno}{1} works. But you still have to remember that \foreach cycles are performed in a group, so the setting to \checkuno will be forgotten as soon as the cycle ends. Using ...


6

Counter issue you are facing with is a TeX vs LaTeX counter settings. You can read more here What are the differences between TeX counts and LaTeX counters? PGF/TikZ does the TeX way and a foreach loop sets up a group at each spin hence outside the group the modifications don't survive. You can use what Peter Grill suggested or declare the counting ...



Top 50 recent answers are included