2

I want to store values, texts, commands... in variables to use them later. For example, I would like to have something like

\documentclass{article}
<preamble>
\begin{document}
\parta{A}
\partc{C}
\partb{B}
\partd{D}
\printit
\end{document}

where the commands \partx should be defined in the preamble and the arguments A,B,C,D are passed to variables that are used in the command \printit. More precisely, the \printit command could be to print the arguments A,B,C,D in a certain style and a certain order (not neccesarily the one given in the document). I am aware of \newcommand but I am not sure if this can be of help here?

4

this seems to be the same model as as \author{...} , \title{...} etc which save their arguments for use by \maketitle.

For that you just need

\newcommand\parta[1]{\newcommand\zzparta{#1}}
\newcommand\partb[1]{\newcommand\zzpartb{#1}}

\newcommand\printit{ blah \zzpartb\ and foobar \zzparta.}
  • Hi, I vote your answer +1. I vote always positive for my friends. – Sebastiano Oct 12 '17 at 17:33

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.