This question already has an answer here:

I have a document with a lot of equations that use commands to maintain consistency. For example, it looks like this


\newcommand{\someComplexCommand}[1]{\sum_{i = #1}^{#1+5} i}


This is $\numberOfDocuments = 1$ document with equations
\someSimpleCommand \approx \someComplexCommand{\numberOfDocuments}


In order to use the resulting equations for example at MathOverflow or other places where I can not provide a complex document, I want to extract the plain TeX equations like

\mathcal{N} = 1
\mathcal{F} \approx \sum_{i = \mathcal{N}}^{\mathcal{N}+5} i

Is there any way to do this? Is there maybe an intermediate step in the LaTeX compilation process that I could access? It does not really matter if I get the whole document with the expanded equations or only the equations itself.

marked as duplicate by Community May 24 '18 at 8:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • There isn't, you'll need an external tool to make the replacements. There might be available scripts, but since latex is a language thst can change it self, there are no universal script – daleif May 23 '18 at 18:54
  • The de-macro works like a charm for the given example. – koalo May 24 '18 at 8:31