GeneralI want an environment that saves its contents to a macro.

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
gbrunick
Posts: 1
Joined: Fri Apr 04, 2008 10:46 pm

I want an environment that saves its contents to a macro.

Post by gbrunick »

I would like an environment that saves its contents into a macro. The obvious thing
to try:

""
\newenvironment{defmacro}[0]{\def \mymacro \bgroup}{\egroup}

\begin{defmacro}
this is inside
\end{defmacro}

mymacro: \mymacro
"""

but latex says "\begin{defmacro} ended by \end{document}". Does anyone have any ideas?
-Gerard

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

I want an environment that saves its contents to a macro.

Post by gmedina »

A possible solution was given in this thread from another forum. Please inform when you post in more than one board.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply