Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Foreach operation's syntax is incorrectly documented #1039

Closed
Symbol1 opened this issue Aug 10, 2021 · 1 comment · Fixed by #1041
Closed

Foreach operation's syntax is incorrectly documented #1039

Symbol1 opened this issue Aug 10, 2021 · 1 comment · Fixed by #1041

Comments

@Symbol1
Copy link

Symbol1 commented Aug 10, 2021

Version: 3.1.9a

On page 167, the document reads

\path ... foreach⟨variables⟩[⟨options⟩] in {⟨path commands⟩} ...;

which suggest that the syntax is
\path (0,0) foreach \x in { -- (\x, \x^2) };
while in reality you have to specify a list
\path (0,0) foreach \x in {1, 2, 3, 4, 5} { -- (\x, \x^2) };

For comparison, foreach statement's syntax is documented on page 1001 as follows

\foreach ⟨variables⟩ [⟨options⟩] in ⟨list⟩ ⟨commands⟩

which brings up a question:
Isn't ⟨list⟩ always enclosed by curly braces?
So we should have \marg{list} in both tikz-paths.tex#L1123 and pgffor.tex#L23.

(I am not pull-requesting this because I don't know what should I use.
\marg{list} or \meta{list}?)

@Symbol1 Symbol1 added the manual label Aug 10, 2021
@muzimuzhi
Copy link
Member

I think \meta{list} is enough, in which

Again, in the easiest case, \meta{list} is either a comma-separated list of
values surrounded by curly braces or it is the name of a macro that contain
such a list of values. Anything can be used as a value, but numbers are
most likely.

muzimuzhi added a commit to muzimuzhi/pgf that referenced this issue Aug 10, 2021
muzimuzhi added a commit to muzimuzhi/pgf that referenced this issue Aug 10, 2021
muzimuzhi added a commit to muzimuzhi/pgf that referenced this issue Aug 10, 2021
muzimuzhi added a commit to muzimuzhi/pgf that referenced this issue Aug 10, 2021
hmenke added a commit that referenced this issue Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants