{loops} is about looping constructs which allow a programmer to apply the same operation multiple times, each time with possibly different parameters.

learn more… | top users | synonyms (1)

2
votes
3answers
213 views

Using loops with chains?

Is there a smarter way to achieve the same result as the one from the following MWE: 1) by using some kind of loop instead of hand typing every node, 2) by drawing the arrows with tikz instead of ...
1
vote
1answer
27 views

In-line graphics in text to represent a loading bar for language skills in a CV

I would like to add my language skills to my CV in the following manner: I could of course create an image in Inkscape for every language, and put it in in a most straightforward way, maybe as ...
1
vote
1answer
74 views

Text on rectangular spiral with automatic sizing to fill page

I'm wondering how this could be done in TeX: This is along the lines of Text spirals with TikZ but in a rectangle, with all text the same size, and all text should be at right angles (unlike the ...
6
votes
5answers
170 views

How to get the number of occurrences of characters in a string

How to get the number of occurrences of characters in a string? \documentclass[14pt]{extarticle} \usepackage{xstring} \usepackage{forloop} \usepackage{ifthen} \usepackage{pgfkeys} ...
2
votes
1answer
53 views

Vertical Bubble (Loop) Diagrams with FeynMF

I want to produce the following Feynman diagram with FeynMF; the problems is how to render the loops (particle-hole bubble) in the vertical direction; furthermore, how to fill a vertical bubble with ...
12
votes
6answers
655 views

command for writing a sequence of numbers

While writing a document with many sequences of numbers (and various lower and upper boundaries), I would like to define a command such as \myscale{1}{6} that would produce: 1 2 3 4 5 6 What ...
1
vote
1answer
38 views

How to building on pstricks the flowchart shape?

I need to building several flowcharts with pstricks and I have problems to get the symbol as the below. Can somebody help me? \newcommand\psBucler[3]{% \pspolygon(-1,0.1)(1.2,0.1)(1.2,1)(-1,1) % ...
4
votes
1answer
84 views

Repeating the same column type

I'm using package numprint to create a table which automatically formats its columns. However, the table has many columns. Right now, my table definition looks like this: \begin{tabular}{l n{2}{3} ...
6
votes
2answers
180 views

How can I use a list stored in aux and insert its output into a tikz node?

# Update 2015-03-19 Better Answer Found This question is part of a trail of questions. The goal mine was to use this list inside of a tikz node, but I removed that from previous questions in the ...
3
votes
2answers
180 views

How can I loop thru a list of inputs that come after \maketitle, yet use that list as part of the \maketitle command?

Multilingual Document Question I would like to follow the principle of "don't repeat yourself" and create a single list of inputs, which are actually various versions of the same document in ...
2
votes
1answer
64 views

Fill line with asterisks [duplicate]

I want to fill a line with asterisks just like as with \cdots or \ldots that can be used in tables, \leaders solution doesn't work well. I'm working in a fixed columns width table, where at the end ...
1
vote
2answers
27 views

Loop over a list with delimiter different from comma

I am trying to iterate over a list, the delimiter of which is not a comma. The reason for not using commas as delimiters is that they are part of the payload. Is there a way to iterate over a list in ...
2
votes
1answer
56 views

Frontispiece for thesis UK

I am writing the title page of my thesis, but the frontispizo package described elsewhere on this website doesn't really suit my needs. I am sure the frontispiece I require below can be easily ...
4
votes
2answers
45 views

Redefining a Command in a Loop Over a Comma Separated List

I want to redefine the glossaries package’s \gls commands to include an index entry and an optional argument for formatting the index entry. However, there are so many variants of this command (\gls, ...
4
votes
2answers
363 views

Is it a convenient way to write longer program codes in LaTeX?

Before I only used ifthenelse and for loops, but not complicated data structures. I don't know what is the convenient way to write longer codes. As an example I would like to generate a random ...
4
votes
2answers
86 views

loop in tabular that uses \the\count to access current line number

I would like to generate an autmatic table using loop. As suggested here before, it is best to first generate the lines in a toks and then pass them to tabular. However, I have problems with accessing ...
1
vote
2answers
47 views

Converting a number into a character and then using it in a filename

I am trying to create a loop that will print out a list of image files. All of these image files have a filename like this: fa-x.jpg (where x is a character from a - h). I've made a loop, but the ...
4
votes
1answer
23 views

How do I define an excludecomment environment in a for loop?

I'm using the forloop and comment packages to define environments prob1 through prob5 that exclude portions of my document. Here's a MWE: \documentclass[12pt]{article} \usepackage{comment} ...
0
votes
0answers
27 views

How to cite this in revtex4-1?

I have trouble to achieve the following citation style: Tam, K. C. , M. L. Farmer , R. D. Jenkins , and D. R. Bassett It's not standard APA or MLA styles.
2
votes
1answer
80 views

Why this loop with “evaluate” does not work?

\documentclass[margin=5pt]{standalone} \usepackage{tikz} \usetikzlibrary{shapes,calc} \begin{document} \begin{tikzpicture} \foreach \x [evaluate=\x as \name using \x*20] in{0,0.05,0.1,0.15,...,5} ...
2
votes
1answer
97 views

Programmatically expand my image in TikZ

I've got an image made of a number of slowly expanding arcs. Now I want to add another 10 wedges, over the same total angle (so each arc will be ~14º). I'm trying to use the following code, but I'm ...
4
votes
0answers
62 views

TikZ: \foreach loop not executing expected number of iterations [duplicate]

I am trying to draw a Bézier curve defined by five control points following the algorithm discussed here. I generate the points of the curve with a \foreach loop: one point per iteration (also, from ...
3
votes
1answer
74 views

Nested CSV with csvsimple

I have two csv files. I want to use the first (countries.csv) to generate sections, and then filter the second (bottles.csv) by the name of the section. Below is an MWE - you can see that the nested ...
0
votes
0answers
29 views

How to load input file with given starting string but unknown end?

In the directory of my latex source there are input files: input_01.tex, input_02.tex, etc. It is very easy to load them with a for cycle. But how to load them if their names are: ...
21
votes
3answers
833 views

Make fireworks with only text

For the holidays, I wanted to follow up to the question about making fireworks with tikz (How can we display fireworks?): How can we make fireworks with only text? I have made a crude attempt below. ...
2
votes
1answer
73 views

How to make Loop?

I need to make for loop analog in LaTeX. My code has following form \documentclass[9pt]{article} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}[scale=1.2, font=\tiny] ...
8
votes
2answers
75 views

Loop until the end of a page

I want to fill a page with a single word or phrase repeated over and over and over again. I will then print out this page. For example, \documentclass[12pt]{article} ...
2
votes
0answers
66 views

dynamically generating tabular columns

Consider a table (regular tabular environment) with a fixed number of columns. I want to create a command that accepts a comma-separated list of strings, where the number of strings may differ between ...
3
votes
1answer
31 views

Within the .tex file, a loop to compile to multiple PDFs recycling content according to language

I bet there are lots of loops using external processing, but I was hoping to get a preamble hack that would pdflatex out three outputs - suffixed according to Language selected - of the following ...
3
votes
2answers
63 views

Loops and Tables

I'm trying to use LaTex to produce our family diary for next year. It's a page per week with a column for each person. I have the basic layout working: \documentclass[10pt]{article} ...
4
votes
1answer
116 views

incomplete ifnum

I am using a loop to define keys with the xkeyval package, as well as to actually read out the keys inside some self-defined command. Everything works perfectly - but for some reason, as soon as I ...
2
votes
3answers
92 views

Concatenating commands with arguments in a macro?

I want to read some lines from a text file, wrap a "style" which in this case is \texttt around each line, and as such concatenate it to a macro that I can use in the document. I came up with this ...
4
votes
1answer
54 views

Defining xkeyval keys within a loop

I have a project for which I make extensive use of the great xkeyval package. However, I'm still struggling with some more extravagant things. For example, I want to use enumerated keys (key1 to keyN, ...
3
votes
1answer
84 views

tabular environment: incrementing the headings

Is it possible to let LaTeX increment the headings in a table environment? If so, how could I do this? For example, I would like to have 7 columns and 7 rows where the columns except the first are ...
0
votes
0answers
63 views

`pdfpages` `\includepdf`'s page list input options

I'd like to use pdfpages to make a print layout of my documents, in order to print them in A4 paper, but with 2 pages per page. The problem is setting the page order in a way I can cut the printed A4 ...
5
votes
1answer
133 views

Creating procedurally generated nodes in TikZ

I am relatively new to TikZ, and have been hacking together figures as I need them for uni assignments from various examples on the internet. Now I am moving into research, I am having to write a lot ...
5
votes
3answers
203 views

Defining a command with variable number of primes

I want to construct a new command which allows me to write somthing like: \env{3} Which would then expand to: σ''' I.e. a sigma with the specified number of primes. I however have not been able ...
8
votes
5answers
414 views

A command which concatenates a string an arbitrary number of times

I'm trying to define a command \repeatstring{#1}{#2} which repeats the string #2 #1 times. Here is what I tried: (it is based on what I found in How to concatenate strings into a single command?) ...
10
votes
1answer
190 views

Cover whole page with squares arranged in a “spiral”

I'm trying to cover a whole landscape A4 paper with small squares – drawn in TikZ – starting from the bottom left corner of the page and moving towards to the center of the page in a ...
3
votes
1answer
104 views

Loops in dot2tex. Or easely draw complex graphs

My original question : Is it possible to use loops in dot2tex? I would like to type something like: \documentclass[]{article} \usepackage{tikz} ...
9
votes
3answers
289 views

Completely expandable loop macro that also works in tabular

Since I normally use tikz in my documents, I mostly use the \foreach \x in \list loop to repeat things. However, this famously fails in tabular environments and also everywhere where things must be ...
4
votes
1answer
2k views

Simple if statement latex

Having difficulties understanding basic latex operations I want to use: if not (number between x and y): next iteration in loop Can anyone help me with a simple if statement for this? \newread\reader ...
2
votes
1answer
74 views

How to iterate a list of colors with two additional counters more elegantly?

A part of my code (especially iterating a list of colors with 2 additional counters) below does not seem straightforward. \documentclass[pstricks,border=12pt,dvipsnames]{standalone} ...
3
votes
1answer
87 views

conditional loop printing text and icon

I'm new in the Latex world. I'm writing a little guide and I've choose Latex, in particular Texmaker for writing it. I'm trying to do a loop for printing some instruction as File -> Save as -> Ok. ...
16
votes
4answers
683 views

Foreach loop between two lists

\documentclass{article} \usepackage{tikz} \def\firstlist{0,1,2} \def\secondlist{0,1,2} \newcommand{\testa}{ \foreach \x/\y in {\firstlist/\secondlist} { \draw(0,\x)--(1,\y); } } ...
2
votes
2answers
87 views

Strange extra line after forloop in a tabular table

I'm trying to generate table lines (tabular environment) with forloop macro. I've got strange extra line after forloop. \documentclass {article} \usepackage [utf8] {inputenc} \usepackage [english] ...
2
votes
1answer
125 views

Iterate over pages and set variable

I am looking for a way to take the output of a pageref, iterating through, and assigning a property to each of those pages. Specifically, I want to take this: \documentclass{article} ...
11
votes
3answers
218 views

tikz foreach loops: is there an equivalent of metapost's step?

I apologise if I'm using and searching with incorrect terminology. This seems an obvious question (to me) so I'm surprised I've not found anything (and so assume I'm missing something). In metapost, ...
5
votes
2answers
612 views

Pascal's triangle in tikz with row headers

I am interested in creating Pascal's triangle with Tikz and LaTeX. I would like to add a column of text on the left of the triangle, with header "Row Number" and then the entries of each row. I am new ...
4
votes
1answer
96 views

loop macro fails if wrapped in conditional

The following code is a subset of the answer in this question. The code provided in the answer works fine, but fails if I add a conditional \IfPackageLoaded. I post this error as a new question, ...