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):

\draw (0,0)
  \foreach \y [count = \xi ] in \new {-- (\xi,\y*10)};

The points in \new are auto generated by another program, so I cannot hard code the first coordinate into the first point. Is there a way to solve this without splitting the list beforehand?

  • 1
    please provide complete small document with your deffinitins in its preamble needed for compilation of your code snippet. – Zarko Feb 19 '18 at 20:08
  • but i ask you for complete document ... is so difficult to extend your code snippet to it? – Zarko Feb 19 '18 at 20:12
  • @Zarko it should be a working example now – user19760 Feb 19 '18 at 20:14
  • yes, now it is :-) – Zarko Feb 19 '18 at 20:17

You may want to include an \if clause (see here):



\begin{tikzpicture}[dot/.append style=fill]

\foreach \y [count = \xi] in \new {
 \ifnum\xi>1--\fi (\xi,\y*10) node[dot](point\xi){}



enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.