Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to pass a numeric set to the list argument of the \pgfplotsinvokeforeach command? I need something like this:

\newcommand{\a}{1,2,...,10}
\pgfplotsinvokeforeach{\a} {<...>}

Thank you

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

You'll have to expand the list macro first:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}

\newcommand{\mylist}{1,2,...,10}
\expandafter\pgfplotsinvokeforeach\expandafter{\mylist}{%
    #1 \par%
}%


\end{document}

share|improve this answer
1  
\expandafter\pgfplotsinvokeforeach\expandafter{\mylist}{<...>} is easier. –  egreg May 1 '12 at 13:31
    
@egreg: Hehe, thanks, you're right. \expandafters make my head hurt. –  Jake May 1 '12 at 13:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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