Do you know a simple way to use the current counter value to call the argument in a macro?
In myPackage I have this
Note: I have the for loop defined as
% \forloop[step]{counter}{initial_value}{conditional}{code_block}
The problem is in the following code
\newcounter{foo}
\newenvironment{myEnvironment}[1]{
\newcommand{\myLocalMacro}[#1]{% number of arguments depends on the value inserted in myEnvironment (this works fine)
\forloop[1]{foo}{1}{\numexpr\value{foo}-1<#1}{
##\value{foo} % HERE I need to return ##1 if foo is 1, ##2 if foo is 2 etc. (this doesn't work)
- % some separator
}%end forloop
}%end myLocalMacro
}
{}%end myEnvironment
I tested the variable number of arguments in \myLocalMacro and it works.
I also tested the nesting of arguments in \forloop - writing ##1, ##2 etc. inside the for loop gives 1st and 2nd value. Now I need it dependent on foo counter.
The main document will look like this
\documentclass{article}
\usepackage{myPackage}
\begin{document}
\begin{myEnvironment}{7}
\myLocalMacro{F}{O}{O}{B}{A}{R}{1} % this separation into arguments will be written manually
\myLocalMacro{F}{O}{O}{B}{A}{R}{2}
\myLocalMacro{F}{O}{O}{B}{A}{R}{3}
\end{myEnvironment}
or
\begin{myEnvironment}{3}
\myLocalMacro{T}{e}{X}
\myLocalMacro{a}{b}{c}
\end{myEnvironment}
\end{document}
The expected output should look like
F - O - O - B - A - R - 1 -
F - O - O - B - A - R - 2 -
F - O - O - B - A - R - 3 -
or
T - e - X -
a - b - c -
Well, this is only an example, the real formating will be more complex, which is why I defined an environment for it and don't do it manually for every single character.
Thanks.


\documentclass{...}and ending with\end{document}. – Sep 09 '14 at 08:53#inactive for the macro definition – Sep 09 '14 at 09:21\arabic{foo}do you? – JPi Sep 09 '14 at 11:48\#? But this will print the hashtag, this is not what I need. – Václav Pavlík Sep 09 '14 at 12:10\#;-) – Sep 09 '14 at 18:44