Questions tagged [for-loop]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
114 views

Part 2: Custom Tags and Questions in Exam Class

This is an expansion of the problem I posted, which @John Kormylo has provided a solution for. https://tex.stackexchange.com/questions/640726/create-custom-tags-for-questions-in-exam-class Here is ...
user avatar
4 votes
2 answers
108 views

Dynamic number interval conversion table

I am a teacher and I need to use for all of my exams a table converting intervals of so called "value points" to points comprised between 0 and 20. I use the following table: \documentclass[...
user avatar
  • 43
2 votes
1 answer
62 views

Create table with for loop (\Numpoint loops) and formula

Im trying to get a table added to my exam tex file that shows the grade earned based on all possible amounts of scorable points. I am running intwo two issues: The amount of \numpoints of the {exam} ...
user avatar
6 votes
2 answers
518 views

Why doesn't this \foreach work?

I don't understand why this doesn't work. I changed x to y and z but it didn't work. Any ideas? \documentclass[11pt]{article} \usepackage{pgfplots,pgfplotstable} \pgfplotsset{compat=newest} \begin{...
user avatar
  • 213
1 vote
1 answer
141 views

How to procedually set column type in pgfplotstable for each column individually?

For a project I am working on, I would like to write a wrapper macro \fancyTable, which communicates with pgfplotstable in the background. The user should be able to specify the column alignment as a ...
user avatar
  • 95
5 votes
2 answers
122 views

Concatenate a variable with a string in a loop

I want to use subfile within a loop to add new pages to a document, depending on the number of lines in a .txt file. The .txt may look like this: 000100020003 The .tex Subfiles are A0001.tex, A0002....
user avatar
  • 53
1 vote
1 answer
34 views

How to use a loop for labels on line graphs in pgfplots

I want to do a graph like below. Showing the duration of an intervention in a country. generated by this code: \begin{tikzpicture} \begin{axis}[ date coordinates in=x, xticklabel={\day/\month}...
user avatar
1 vote
1 answer
196 views

Updating R Counter in for loop

I have written a for loop in LaTeX using the forloop package, and on each iteration, I would like to use a different subset of a vector that is defined in an R chunk above. However, each iteration of ...
user avatar
2 votes
2 answers
68 views

Braces in a \@for loop

While writing macros to manipulate the items of a list with a \@for loop, I have found that braced items behave differently depending on whether they have a leading space or not: \documentclass{...
user avatar
0 votes
0 answers
34 views

For loop in tabular with multicolumn

Can I do this without adding a new line and then remove the new line? I would like to skip \\[-0.4cm]. It just feels wrong \documentclass[12pt]{article} \usepackage[utf8]{inputenc} \usepackage{float} \...
user avatar
  • 1
1 vote
2 answers
42 views

Looking up strings by an index [closed]

I'm using \pgfplotsinvokeforeach{0,1,2} {...} and would like to somehow dispatch on #1 to get one of three strings: $s_A$ if #1 == 0 $s_B$ if #1 == 1 $s_C$ if #1 == 2 Is there an easy way to do ...
user avatar
  • 2,512
0 votes
2 answers
342 views

How to include many images with a for-loop?

I would like to add many images to my document. The images are located in a folder named ./assets/images/ and are numbered as follows 0.png, 1.png, ..., 100.png. How can I include them using a for-...
user avatar
  • 1,125
3 votes
2 answers
151 views

Scan characters in Xe(La)TeX

What I want to do is take a string, slice it up into characters, scan them individually, and produce output. Something like this: \for\char\in#1 \ifx\char\textbackslash ... \fi ... \fi
user avatar
  • 447
4 votes
3 answers
273 views

parallel iteration over elements of separate lists

I guess this is a simple problem, but I don't know how to do it in TeX/LaTeX/tikz. What I'd like to do is to iterate over several lists in parallel, and do something with the respective values. One of ...
user avatar
  • 645
4 votes
3 answers
549 views

Read file contents to variable and iterate over each character in file (hexdump)

I need to read file content as string (binary file) to variable, then iterate over each character in that string, convert each character to its hexadecimal representation, use comma (or any other ...
user avatar
2 votes
1 answer
135 views

algorithm Logic: Make Loop for each 3 rows in datatools

i want to make loop with process: Current: (with below code) each row create one page Box A, B, C: Same data from one row of datatool Need update: Create one page only \Break=break or each 3 ...
user avatar
  • 1,921
6 votes
1 answer
222 views

How to write a loop to reflect a path (Asymptote)?

I am trying to shorten a code that contains a lot of reflections by writing a loop: [asy] unitsize(1.5 cm); pair A,B,C; real alpha=(20); real beta=(10); real gamma=(180-alpha-beta); real rad=(pi/180)...
user avatar
2 votes
1 answer
439 views

How to put texts on a newline in an algorithm (in a nested for-loop)?

I am making an algorithm with a nested for loop, and there are multiple in the loop. They are presented on the same line, but I want them to start on a newline. Any ideas how I can do this? This is ...
user avatar
  • 21
1 vote
1 answer
224 views

Adding additional text to some elements of a loop?

The following question stinks a bit of crazed micro-optimization. But I had written it, and I was a bit curious, so I thought I might as well post it. The following loop iterates over inserting some ...
user avatar
  • 7,394
0 votes
1 answer
93 views

Looping for Two-column Signature Blocks

I'm trying to create a two-column area for signatures, so folks signing the document are listed in the left column or right column, and there are enough rows to accommodate everyone's signature. Under ...
user avatar
  • 111
1 vote
1 answer
179 views

The construction of Rooty helix, code explanation

Could someone please explain some parts of this code? I'm newbie on LaTeX and could not understand some parts. What does this \foreach \y in {86,38,15} means? Could you explain with details what is ...
user avatar
2 votes
2 answers
118 views

Why does this document add empty pages?

I have this document and it adds ONE empty page at the beginning and TWO empty pages at the end - why is that and how can I get rid of those? So, instead of only 2 pages, I end up with 5! \...
user avatar
  • 656
2 votes
1 answer
255 views

\ForEach fails with underscores

For the automatic generation of reports I'm using the \ForEach loop of the forarray package. This is just great as it saves me lots of time. However, there is one issue: When the items I iterate ...
user avatar
  • 33
0 votes
1 answer
82 views

\DTLfetch not working with Variable

I have csv database loaded in data variable. I am trying to fetch value from particular column given an another column name and its value. I am using following code \forloop{i}{1}{\value{i} < 30} {...
user avatar
1 vote
1 answer
455 views

\forloop problem(undefined control sequence)

(/usr/local/texlive/2018/texmf-dist/tex/latex/fontspec/fontspec.sty (/usr/local/texlive/2018/texmf-dist/tex/latex/l3packages/xparse/xparse.sty (/usr/local/texlive/2018/texmf-dist/tex/latex/l3kernel/...
user avatar
  • 2,251
1 vote
1 answer
302 views

How to put bengali serial no on making empty table using for loop?

\documentclass{article} \usepackage{forloop} \usepackage{polyglossia} \setmainlanguage[numerals=Devanagari]{bengali} \setmainlanguage{bengali} \setotherlanguage{english} \newfontfamily\bengalifont[...
user avatar
  • 2,251
1 vote
1 answer
43 views

Repetition inside tabular

Are there any simple way to perform repetition inside a tabular environment? This is what I intended to do: \documentclass[a4paper,10pt]{scrartcl} \usepackage[utf8]{inputenc} \usepackage{tikz} \...
user avatar
  • 229
5 votes
3 answers
839 views

etoolbox for loop over range

Is there a way to run a command on a range of consecutive integers (say, 11, 12, 13, 14, 15), specifying only the first and last numbers (11 and 15)? Basically I'm looking for the general LaTeX ...
user avatar
  • 267
3 votes
2 answers
103 views

Narrowing a minus sign in math mode (allowable in for loop)

I want to fit the "N-1" into the box below if possible; if I use the solution \text{-}, namely 3/{N\text{-}1}, it gives me an error: Undefined control sequence: } (followed by: ) Is there a way to ...
user avatar
  • 2,512