{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
1answer
11 views

pgffor `foreach` loop over databib macro-generated list

The databib package from the datatool bundle allows one to import BibTeX databases and work with them from within LaTeX. The author field can be accessed as \DTLbibfield{Author}, which returns data ...
3
votes
2answers
134 views

Loop to create new counters

I want to create counters in a loop like this (with the packages multido, totcount) : \newcounter{compteurChi}% first counter \regtotcounter{compteurChi}% define the first counter as a ...
3
votes
2answers
77 views

How do I create different math problems and their answers?

(How to extract elements from a loop in an array?) I'm trying to create "n" versions of a homework and their answers in the last page changing or increasing each variable every loop. So far I can ...
2
votes
1answer
37 views

Problem using macro with TikZ foreach

I am using a simple macro adapted from an answer to the following SO question: http://stackoverflow.com/questions/3951392/latex-space-after-every-letter The modified macro simply takes a string and ...
11
votes
3answers
241 views

3n arguments in a macro (n is an even number) for curves whose thicknesses increase or decrease

For some mathematical figures it's nice to be able to vary curve thickness smoothly along a path, to reproduce hand drawn mathematical figures made with inking liners for instance. One way to do it ...
0
votes
0answers
22 views

Take input from csv file and use it to create a custom-made table in tikz

I have a csv file that looks like this: Scott, William, Todd,Esben, Martin, Jesper, Alexander W.L Right now, the names are written this line \aebuildtable{20}{Scott,William,Todd,Esben, Martin, ...
3
votes
3answers
231 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
42 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
85 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
178 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
68 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
664 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
41 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
90 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
185 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
185 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
70 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
30 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
59 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
49 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
364 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
91 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
48 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
24 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
82 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
63 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
86 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: ...
22
votes
3answers
849 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
79 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
79 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
71 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
34 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
68 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
119 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
99 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
56 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
70 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
136 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
205 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
416 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
192 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
106 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
300 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
78 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
89 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. ...