I want to save blocks of code/info in a LaTeX file using commands, but I have no way to know how many blocks will be needed. I am wondering if there is a way to create dynamic names of commands so that I can call them later. For example I want something like the following to work:
(Minimal Pseudo Code)
\newcommand{\questionrnd}[1]{
\setcounter{QuestionsForRandomizing}{\arabic{QuestionsForRandomizing}+1}
\newcommand{\QuestionContent\Roman{QuestionsForRandomizing}}{#1}
}
This would take in a block of info (specifically a question, and commands that take in answer choices and randomize them and a variety of other things) and save them in the "next" command. Thus I would end up with commands like \QuestionContentI and \QuestionContentII etc that would contain all the info from questions 1, 2 etc.
Problem being, I can't pregenerate these command names as I have no way of knowing how many questions might be put into the form (this is a CLS file), so I need to create the command (or whatever else would work) dynamically, and then recall them similarly.
I'm giving here a specific example I would like this to work for (saving question content) but I've been trying to figure out a way to store blocks of code dynamically like this for a while, so any general information would help. Ideally the block would need to be able to be executed as LaTeX code itself (meaning all internal function commands still work when the code is called for example).
