2

I'm using the memoir document class.

I have problems storing a \footnote command using \setarrayelement.

Here's a simple document:

\documentclass{memoir}

\newarray{aaa}{1}{1}
\setarrayelement{aaa}{1}{name\footnote{fn}}

\begin{document}

\getarrayelement{aaa}{1}{\x}

\x

\end{document}

I want the \x to expand to name\footnote{fn}, but I never get that far. I get this error message in \setarrayelement:

! Use of \@pr@videpackage doesn't match its definition.
\@ifnextchar ... \reserved@d =#1\def \reserved@a {
                                                  #2}\def \reserved@b {#3}\f...
l.4 \setarrayelement{aaa}{1}{name\footnote{fn}}

Curiously, if I add \usepackage{forloop}, which I'm also going to use in my document, after \documentclass{memoir}, the error message changes to

! Argument of \reserved@a has an extra }.
<inserted text> 
                \par 
l.5 \setarrayelement{aaa}{1}{name\footnote{fn}}

How can I store a footnote in \setarrayelement? I presume that I need to somehow postpone the expansion of \footnote until \x is used, but how do I do that?

1 Answer 1

2

use

\setarrayelement{aaa}{1}{name\protect\footnote{fn}}


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .