[OS X TeX] Non-strictly OS X related. Expanding in TeX/LaTeX

Roberto Avanzi roberto.avanzi at gmail.com
Sun Jul 6 09:35:54 EDT 2008


I have a problem with expansion.

I am trying to get some text fully expanded in LaTeX, but maybe I did  
not understand properly \def, \edef, \xdef and the \protected at edef,  
\protected at xdef variants

The follwing snippet compiles


%%!TEX TS-program = pdflatex
\documentclass{article}

\RequirePackage{amsthm}

\newtheorem{mAtiere}{Definition}[section]
\newtheorem{theorem}[mAtiere]{Theorem}

\begin{document}

\section{Important result}

\makeatletter

\def\pippo{%
\begin{theorem}
The integer $2$ comes after $1$.
\end{theorem}}

\pippo
\pippo

\end{document}


but of course I get something like

Theorem 1.1. The integer 2 comes after 1.
Theorem 1.2. The integer 2 comes after 1.

OTOH, I could try to replace \def with \edef, and hope to get

Theorem 1.1. The integer 2 comes after 1.
Theorem 1.1. The integer 2 comes after 1.

for instance, I could output the second instance to an external file  
to be included later in a theorem index.

But, it does not work (error: argument of \@sect has an extra }).
Is there a solution/workaround?

  best
   Roberto




More information about the MacOSX-TeX mailing list