I define a new command taking an arguments, e.g., \mycmd{some text here}
.
This command is used many times in the documents like:
\documentclass{a-latex-class}
\begin{document}
\mycmd{text number 1}
\mycmd{text number 2}
\mycmd{text number 3}
\end{document}
Here is my question.
How do I define another command, \whatiwant
, that print all of texts given as arguments in \mycmd
?
Moreover, I expect to use the command \whatiwant
before using of any \mycmd
, for example:
\documentclass{a-latex-class}
\begin{document}
\whatiwant
\mycmd{text number 1}
\mycmd{text number 2}
\mycmd{text number 3}
\end{document}
What I have try is using a temporary/auxiliary file storing the texts I want. However, it seems that I need to typeset the document before using the temporary file which is not convenient to do in that way.