[ This is more, I think, a \LaTeX question than a Sagemath question. But since it's centered on the use of Sagetex, it is probably the right place to ask... ]
I'd like to be able to do some (boring but necessary) computation without printing it, use its results, then, in an appendix, show the computation (without re-running it).
The obvious solution would be to run the computation in a sagesilent
block, use its results, then later insert a sageverbatim
environment with the same code :
\begin{sageblock}
## Boring computation
\end{sageblock}
%% Lotsa discussion
\appendix
\begin{sageverbatim}
## Boring computation again
\end{sageverbatim}
The problem is that now, I have two copies of the same code, with no consistency guarantee (as illustrated in the example, BTW). I tried :
\let\foo={\begin{sageblock}
## boring computation
\end{sageblock}}
% Lotsadiscussion
\appendix
\foo
But that doesn't work : The boring computation is still printed before the discussion and nothing is printed in the appendix.
I'm not really surprised : the \LaTeX verbatim
environments are full of such traps. And, no, using \protect
is not enough.
Any idea ?