foreach's questions - Chinese 1answer

0 foreach questions.

I am looking to create simple number lines. I have asked a similar question: Resetting numerical labels in \foreach commands on a numberline. But now I am in a different situation. I know how to ...

I need to calculate the mean of a bunch of values generated by a function inside a loop. Is it possible? \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \begin{...

How can I use arithmetic inside a node's curly brackets? I have this, and it prints for example "0+1" in a circle. I would like to have circles that show the sum of their coordinates. \begin{...

How to remove/suppress the edge from node 3 to node 4 in the following code using chains and join? Do I have to split the foreach into two smaller ones? \documentclass[tikz]{standalone} \...

How to fix the error in referring to a node using \x-1? It works in [below left = \x-1] but does not work in \draw[->] (\x-1) to (\x). \documentclass[tikz]{standalone} \usepackage{pgffor,pgfmath}...

I need to update a variable defined in a pgfmathsetmacro command inside a foreach loop. Apparently, the var is only updated when it is used after the update command. Here is a MWE: \begin{tikzpicture}...

In a square of edge length 5*sqrt(2), I have 45 congruent squares of edge length sqrt(2) drawn. I would like to shade 25 of them - 5 of them in each row. I shaded the 5 squares in the bottom row and ...

In the following diagram, I have three views of an equilateral triangle partitioned by smaller congruent equilateral triangles. May I have a suggestion for using \foreach to reduce the repetitive ...

I have a drawing of a curved-plate capacitor: \documentclass[]{standalone} \usepackage{tikz} \usetikzlibrary{arrows} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture}[ ...

I'm looking to create a macro that takes a list of key-value lists as an argument. I don't know the right data structure that can be used for this kind of situation in LaTeX and also didn't find it ...

Edit: I can't delete this question despite it being based on a silly mistake. Please don't waste time reading/answering. I'm trying to draw a row of boxes which alternate colours, and I'm using a \...

I'm trying to color the cells in a few columns with different colors, depending on bounds passed as an argument. I would like to have one macro that takes two arguments: a .csv file and a comma ...

I'm having trouble understanding why \pgfplotsforeachungrouped is breaking in certain spots. Why does this work: \documentclass{article} \usepackage{pgfplotstable} \def\macroOne#1{ #1 } \...

I'm trying to load images from a directory but I can't because I don't know why \i does not indicate the number, code searches the directory and the files were not found.. \documentclass{beamer} \...

Disclaimer: I've barely started to learn LaTeX so bear with me. Problem: I use a lot of matrices like this Which I absolutely hate to code manually. Obvious solution would be a nested for loop, ...

I want to add a bunch of evenly spaced vertical lines to a plot using \foreach. I can do it like this: \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.10} \...

How do I draw a 4x4 grid over the following TikZ diagram using \foreach? Is it preferable to do so with one \foreach command? \documentclass{amsart} \usepackage{mathtools} \usepackage{tikz} \...

Text flash effect is the purpose of the following simple code. Some text should flash for a given times(here is nine times) by a \foreach loop command. However, it can not pass compile. This error ...

I need to draw a curve from a list of points whose coordinates have been calculated beforehand in a foreach loop I manage to generate my points and to use them independently, I think to manage to ...

I'm pretty new to LaTex, so please forgive my sloppy code. I'm trying to create a table from a csv file, and pass a list of colors in so that LaTex will color each cell of the a column of the table ...

I'm attempting to iteratively define a coordinate system in TikZ. Essentially, I'd want to replicate the following using a \foreach command: \begin{tikzpicture} \coordinate (A1) at (0,0); \...

I want to run this command \foreach \x [count = \xi] in {L,1} \matrix [matrix of math nodes,left delimiter={[},right delimiter={]},fill=white,ampersand replacement=\&] (mm\x)%give the ...

It seems to me that the following two pieces of tikz code should be equivalent; why do they produce different output? Is there a way I can get the output of the hard-coded variant using a loop? \...

I am drawing a nice diagram with Tikz. The following works perfectly: \foreach \m [ evaluate=\m as \nstart using ((\m - 1) * 4) + 1, evaluate=\m as \nstep using ((\m - 1) * 4) + 2, evaluate=\m as \...

I would like to add all my certificates in my LaTeX document as pictures. Is there any way that lets me insert multiple images without captions as follows: Each image fits on one page for example ...

I have a macro that does exactly what I want when I used it with a literal sequence, but not with a sequence that has been defined for reuse: \documentclass[tikz,14pt,border=10pt]{standalone} %%%< ...

I'm trying to get TikZ to make a sort of experience bar command where I can just call it and enter a number out of say, 6, and it will return that many "filled" dots, and 6 minus that many "unfilled" ...

I often find myself wanting to use some feature that allows me to loop through several sets where the nth item in each list is paired together with the nth item in the other lists. \begin{tikzpicture}...

I have a bunch of variables defined with similar names, e.g.: \def\wstepsA{1/2/0,2/3.5/1}; All variables have a name wsteps + a letter, and I want to iterate over them using tikz's foreach: \...

I am trying to plot several column pairs using the \foreach loop command with pgfplotstable in the following way. \documentclass[tikz]{standalone} \usepackage{pgfplots,pgfplotstable} \begin{document} ...

When I use \pgfresult to get a node label in a \foreach, I have no problem. However, I can't seem to get the syntax right to create a coordinate with the same method. \documentclass{article} \...

I've looked around and can't seem to find anywhere, but I was wondering if there is somewhere you can do something like the following: \newcommand{\loopy}[1]{ \begin{tikzpicture} \foreach ...

I am creating a set of nodes with a foreach. After that i am drawing a edge between them that should show a value in the middle above the line. Unfortunately there are some situations where the line ...

Given a figure of two lines with x and y coordinates, I want to duplicate the figure and increase all x coordinates by the same integer (in this example by 3). I was trying to use a foreach loop, but ...

I draw two circles and name their path inside a \foreach loop. Trying to name intersections of these two paths throws an error unless I name a third path. \documentclass{article} \usepackage{tikz} \...

I have a rigid body formed by one disc (D) and one rod (T): -i want to draw the rotation of the disc around the j_1 axis -i want the to make a scope for moving the disc on the stem and rotate it ...

I was blocked on this point, I'm going to compile a code in which I'm using the command foreach: \pgfmathtruncatemacro{\iar}{{\RodLength*\iBngle/180}}%L=\iBngle*x=\RodLength*\iBngle/360%360 ou 180 ...

The use of \tikzmark in a \foreach loop leads to this error message : ! Undefined control sequence. \tikzmark ...reid \@undefined \let \tikzmark@next ...

! Missing \endcsname inserted. \countuno l.67 } From what I've seen about this error the fact that it is a tex error makes it very difficult to pinpoint its origins. Hopefully ...

I have two diagrams (both are supposed to be the same), one with explicit draw and node commands, the other one with foreach loops. Obviously, I don't understand foreach loops, as I can only get one ...

I suspect that these errors are coming from a section of code in which I loop through a master data file and restructure it so that I can give the newly made file as an argument to pgfplots. If I ...

What I want to do is draw a line between points that are defined in a command like this but without the connect to (0,0): \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{...

\documentclass{article} \usepackage{pgfplots, pgfplotstable} \usepackage{filecontents} \usepackage{indentfirst} \usepackage{amsmath} \usepackage{float} \usepackage{hhline} \usepackage{multirow} \...

I am beginner with tikz-3dplot, I want to draw this figure I used the explanation given in John Kormylo, \documentclass[tikz]{standalone} \usepackage{tikz,tikz-3dplot} \usetikzlibrary{patterns}% ...

I want to define a macro that feeds its contents into a tikz \foreach statement, for example: \newcommand\Macro[1]{ \foreach \x in {#1} {x=\x.} } which is then used as \Macro{1,2,3,4}. Sometimes, I ...

The code below shows the problem. There are two tikzpictures. The first is the code expanded and this works. The second is the same code but put within a \foreach loop. This doesn't work. I assume ...

Is there any way to define a new value that is a counter + a constant? e.g. \foreach\k in {0,1,...,7} { \def\m % ???? I want to make m=k+4 \draw[->] (box\k) -- (box\m); }

I'm trying to manipulate bibtex files using biber in tool mode: given the source file source.bib: @article{key1, group = {A} } @article{key2, group = {A, B} } I need to produce: @article{key1, ...

Language

Popular Tags