The package pgffor implements the foreach module of tikz-pgf in a standalone package.

learn more… | top users | synonyms

10
votes
2answers
244 views

\foreach with \newcommand how to use them together?

What I want to do is to shorten this \newcommand with a \foreach since this is just a very little part of what I will use. \newcommand{\CC}{{\mathbb C}} % the set of complex numbers ...
5
votes
5answers
878 views

How can I multiply two numbers?

I use pgffor package and I have \foreach \n in {1,...,10}{**something I want**} How can I print n*(n+1) for each n? When I write just \n*(\n+1) instead of **something I want**, ...
6
votes
1answer
354 views

Feature (bug?) of dots notation in foreach-statement

I want to draw something in tikz where the range of an inner loop depends on an outer loop (by construction of the math involved). I need to differentiate between even and odd number in the inner ...
3
votes
1answer
51 views

Make catchfile work with pgffor's foreach

Consider the following MWE, extracted from my solution to this question: \begin{filecontents*}{demolist1.dat} 1,2,3 \end{filecontents*} \begin{filecontents*}{demolist2.dat} {1,0,2},{0,3},{1,1} ...
6
votes
1answer
78 views

Why is the `pgffor` package messing with my scope?

I have a several rather lengthy documents with numbered points (catechism questions) that I would like to be able to selectively include in other documents using a utility function that uses a range ...
3
votes
1answer
62 views

PGF foreach: elegant way to handle empty list

I am writing a simple animation in beamer using tikz. The code is as follows \documentclass{beamer} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document} \begin{frame}[fragile]\relax ...
4
votes
1answer
84 views

Extract from a token containing a list with math content

I have a token which contains a list consisting of: a date in YYYY-MM-DD format, followed by a colon, and some text which may contain math. The text will consist of a sentence or two (i.e., no ...
5
votes
2answers
175 views

Error with chronology and babel packages : “! Paragraph ended before \pgffor@next was complete.”

I am trying to use the chronology package in a report that includes babel. My distribution : pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) On below my MWE : \documentclass{article} ...
11
votes
1answer
121 views

PGF's `foreach` recognises when there are no list items and doesn't run the code. Is this guaranteed?

The PGF \foreach macro behaves differently when the item list is totally empty than it does when a single item happens to be empty. \documentclass{article} \usepackage{pgffor} \begin{document} ...
3
votes
2answers
76 views

\newcommand for bmatrix of features using pgffor throws missing \endgroup error

There are two parts to this question. Mainly, I'm interested in implementing a \newcommand that can take an arbitrary number of arguments to be set in a single column of a matrix. I tried the ...
6
votes
3answers
130 views

How to escape /None in \foreach iterator?

The last compiler to invoke is ps2pdf -dAutoRotatePages#/None frames.ps for Windows or ps2pdf -dAutoRotatePages=/None frames.ps for non-Windows. The code snippet I want to invoke is as follows. ...
27
votes
2answers
343 views

What's the difference between the various methods for producing for loops?

I've been wondering about the various methods available for looping over a comma separated list and the like. In particular, I was wondering about their various strengths and weaknesses. In other ...
7
votes
1answer
130 views

I'm confused about how expansion is happening here

I was really pleased that I could come up with a means of building the contents of a tabular environment using \foreach \x in {...} {...} structure. But I was curious about what exactly it would take ...
3
votes
1answer
137 views

TikZ multiple coordinate frame implementation not working

I'm attempting to use TikZ to draw three different coordinate frames. I have successfully done it already. However, in an attempt to make my code more readable, I tried breaking it down into a more ...
5
votes
1answer
187 views

Is there a way to use pgffor to build the rows for a tabular environment?

I was trying to build a tabular environment that is auto-generated through the use of pgffor's \foreach macro. But I can't seem to get it right. Here's a MWE for generating a multiplication table: ...
3
votes
1answer
64 views

How can I use `pgffor` to iterate through a database of keys and properly retrieve them

I would like to create a command that stores a database. I then want to iterate over the database and print out the results to the document. This MWE shows two different approaches I've taken. But ...