2022 Developer Survey is open! Take survey.

# Tag Info

Accepted

### \foreach not behaving in axis environment

According to pages 470-471 of the pgfplots documentation: (Note: in pgfplots documentation v1.17, the page range has changed to 544-545.) Keep in mind that inside of an axis environment, all loop ...
• 12k
Accepted

### Make fireworks with only text

2016 Christmas Edition I experimented here with trying to produce a geometric figure near the firework core, by using simple glyphs like + and -. When duplicated with rotation and shift, I think the ...
Accepted

### Repeating the same column type

No pgffor package is required for this; just write your table preamble as: \begin{tabular}{l *{6}{n{2}{3}}} The general syntax is: *{n}{column(s) pattern} where n is the number of repetitions, ...
• 259k
Accepted

### Repeat characters n times

No packages: \documentclass{article} \makeatletter \newcount\my@repeat@count \newcommand{\myrepeat}[2]{% \begingroup \my@repeat@count=\z@ \@whilenum\my@repeat@count<#1\do{#2\advance\my@...
• 985k

### How to define von Neumann natural numbers (newcommand, with for loop)?

I think its more natural to use recursion than a loop, something like \documentclass{article} \usepackage{amssymb} \newcommand\nnatset[1]{% \ifnum#1=0 \varnothing \else \ifnum#1>1 \nnatset{\...
• 665k
Accepted

### Make my infinite squares math-proof

Update The issue with scaling in graphicx is fixed in the development sources for the next release (probably January 2017) and the issue with the xetex driver discussed in the comments is fixed and ...
• 665k
Accepted

### How to repeat over all characters in a string?

You can use \@tfor. I provide also a better redefinition of the dot under according to your wish: \documentclass{article} \usepackage{graphicx} \let\d\relax \DeclareRobustCommand{\d}[1]{% \oalign{#...
• 985k

• 665k
Accepted

### Foreach loop between two lists

Here is a very simple solution: \documentclass{article} \usepackage{tikz} \def\firstlist{0,1,2} \def\secondlist{0,1,2} \newcommand{\testa}{ \foreach \x [count=\c,evaluate=\c as \y using {{\...
• 67.8k

### a circular figure with lines behind a disc going off in all directions like a sun

You don't need to connect nodes. First draw background lines. All starting from (0,0). \foreach \angle in {0,1,...,359} \draw[cyan!50!black] (0,0)--++(\angle:4); Second, draw a circular node white ...
• 127k
Accepted

### New Pentagonal Tiling

I'm not sure what you are seeking in the end, but on this, the penultimate Eve of Christmas, a few nested \stackinsets make for a wonderfully festive stained glass imitation. God bless us, every one! ...

### Make fireworks with only text

Fireworks, in any flavor of TeX, but only text? Then the old package happy4th meets the requirements. Really is only an little obfuscated TeX file: % Author: Brian Blackmore <blb8@po.cwru.edu&...
• 73k
Accepted

### Generate the n-th letter of the alphabet in a tikz loop

One possibility: \documentclass[a4paper,10pt,landscape]{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach [count=\i] \j in {a,b,...,j}{ \node (\i) at (\...
• 198k
Accepted

### Use array in loop in tikz

The problem here is that arrayjob does some nasty stuff to get the value out of the array and this is not compatible with how \includegraphics handles its arguments. There are two solutions: 1. ...
• 14.6k

### Preparing a special exam sheet for every student

You can use the odsfile package, which supports manipulations with OpenDocument Spreadsheet files. You need to convert your excel file to ODS using LibreOffice (Excel can do this as well, but ...
• 44.9k
Accepted

### Power of number in loop in TikZ

Just do the math before the inner loop. foreach doesn't parse math in the iterable list \begin{tikzpicture} \foreach \a in {1,2,3} { \pgfmathtruncatemacro\aa{2^\a} \foreach \b in {1,2,...,\...
• 154k
Accepted

### Triangulation in tikz

Example, which uses both smart stuff (grid), \foreach loops and manual elements: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw (0, 0) grid[step=1cm] (3, 3)...
• 261k
Accepted

### a circular figure with lines behind a disc going off in all directions like a sun

To connect the edges of the circle you can use the border anchors of nodes (A.120) and the to Operator to connect it to the outer square. \documentclass[tikz, border=5mm]{standalone} \begin{...
• 7,507
Accepted

### Looping over strings

If I modify your test a bit to make a shorter argument for tracing \documentclass{article} \def\test#1{{ \tracingonline=1 \tracingmacros=1 \markletters{#1} } \typeout{TYPEOUT: \markletters{#1}} } \...
• 665k
Accepted

### How can I fill an arbitrarily sized matrix with asterisks?

with \pAutoNiceMatrix of nicematrix. \documentclass{article} \usepackage{nicematrix} \begin{document} $\pAutoNiceMatrix{7-7}{*}$ \end{document}
• 25.1k

### Calling several tex files with a loop?

There are numerous ways to do this, but the simplest given what you've described is to use the pgffor package which provides a simple syntax for such loops: \documentclass{article} \usepackage{pgffor}...
• 201k

### Empty document, only pagenumber, 500 pages needed

A variant with package multido (50 bytes): \documentclass[DIV=20, fontsize=16]{scrartcl} \usepackage{lmodern} \usepackage[automark]{scrlayer-scrpage} \pagestyle{scrheadings} \cfoot{} \ofoot[\pagemark]...
• 261k

### Triangulation in tikz

A (hopefully accurate) scalable version for arbitrary size (can't say if it's mathematically useful but was fun to make). alphalph used to generate arbitrary number of labels some increased spacing ...
• 4,082
Accepted

### How to create a for loop in math mode

\documentclass{article} \usepackage{tikz} \begin{document} $F_x = q\left[\foreach \i/\p in {x/, y/+, z/+} {\p\frac{\partial E_\i}{\partial \i}\mathrm{d}\i} \right]$ \end{document} Note: ...
• 13.2k