New answers tagged foreach
1
vote
TikZ - foreach substitution inside coordinate name not working
Maybe you misspelled the nodes?
\documentclass[a4paper,10pt]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% defines nodes directly or within a loop
\node (a1) at (0, 0) {$...
- 3,916
1
vote
Accepted
Drawing loops around an ellipse in Tikz
Your idea is fine, but your use of \def is not. Instead use the evaluate option for \foreach:
\foreach \i[evaluate=\i as \x using -3*cos((180*\i)/4),
evaluate=\i as \y using sin((180*\i)/...
- 31.1k
8
votes
Accepted
How to loop through every character of an argument in TeX
I see only Expl3 examples here, but this task is very suitable for using TeX primitives only. We define the \spell macro which gets a single word and prints the first letter by the format given by \...
- 62k
6
votes
How to loop through every character of an argument in TeX
tl;dr
If you want to just insert a hyphen between graphemes, this works.
\documentclass{article}
\usepackage{iftex}
\iftutex
\usepackage{fontsetup}
\fi
\ExplSyntaxOn
\NewDocumentCommand{\...
- 1.0m
6
votes
How to loop through every character of an argument in TeX
The following implements both. The variant including the last character is straight forward using the expl3 function \text_map_inline:nn, the variant ignoring the last character needs to loop over the ...
- 52.3k
2
votes
Why does this code need the tcolorbox package?
As Ulrike Fischer told, what you need is pgffor and graphicx packages. This is the minimal code.
\documentclass[]{article}
\usepackage{pgffor}
\usepackage{graphicx}
\def\Image{\includegraphics[scale=...
- 132k
4
votes
Accepted
Foreach with different label
Below a solution that uses \foreach.
Moreover, I see that you have two different scales in your diagram. In this case, it is useful to use xscale (or yscale if needed), so that you can use the actual ...
- 2,740
Top 50 recent answers are included
Related Tags
foreach × 791tikz-pgf × 496
loops × 117
pgfplots × 86
macros × 66
tables × 27
pgfmath × 26
pgffor × 22
beamer × 20
expansion × 18
nodes × 17
pgfplotstable × 16
comma-separated-list × 14
graphics × 13
color × 13
errors × 12
lists × 12
conditionals × 12
tikz-styles × 11
coordinates × 11
diagrams × 10
counters × 10
tikz-matrix × 10
intersections × 10
programming × 9