3
votes
3answers
192 views

Summation of a list of numbers

The next code gives : 1 1.2 3 But 1 2.2 5.2 is expected. What is wrong ? \documentclass[tikz]{standalone} \begin{document} \xdef\Sum{0} \foreach \i in {1,1.2,3} { \pgfmathsetmacro\Sum{\Sum+\i} ...
6
votes
1answer
775 views

tikz label coordinates using mathematical expression from foreach variables

\documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach \x [count=\xi from 1] in {-3.0,-2.8,...,1.8} \draw[thin] (0,0) ++(\x,2) rectangle ++(0.2, 0.2) ...
9
votes
1answer
4k views

simple arithmetic on index of foreach statement in tikz

Is foreach really a tikz statement or is derived from some other package? I would like to draw a horizontal axis with 7 ticks spaced 1 cm apart. I'd like to place a label under each tick that is the ...