Make an option to turn off repeat behavior of \foreach
when variable values are missing.
#1329
Labels
\foreach
when variable values are missing.
#1329
Brief outline of the proposed feature
The
\foreach
command allows users to specify several variables separated by slashes. The manual gives the exampleThere is also a behavior if some variables are not specified, namely
The manual gives this nice example:
However, I frequently run into situations where I would prefer a different fallback behavior, namely that unspecified variables should be left empty. For example, suppose I want to make a bunch of blue circles, with some getting a special color.
At the moment, one way to do this would be
However, it's annoying having to always have to specify the "default" color
blue!20
. It would be nice to only need to specify it in cases when the color is "special". Ifpgffor
would provide an option to turn off the "repeat" behavior, this would be possible together with anif
, for example:Counterargument to the need for such a
repeat=false
option: the same effect can already be achieved by providing a final end-slash, i.e.,{1/,2/,3/pink,4/,5/}
which would set\nodecolor
to be empty. But this is still a bit annoying, especially if I'm wrapping this code as a macro like\circlelist{1,2,3,4,5}
where the user quite frequently wants none of the nodes to be special.For one way to implement this option, see this diff:
12f1783...DominikPeters:pgf-tikz-html-manual:pgffor-repeat
Usage example
No response
The text was updated successfully, but these errors were encountered: