Hello how are you? I have an extensive document which is from my teacher and I need to make a list of equations as they are in the image. Being extensive I would like it to be something automatic, something easy to implement with \label{} or similar. (what they do here does not serve me) I do not know where to start but I do know that I want it to work when I change sections

enter image description here

This is my code



\filleft UNIDAD \thesection \ }
\usepackage{amsthm} %para usar \theoremstyle

spaceabove=7pt,  spacebelow=7pt,
notefont=\mdseries\bfseries\itshape, notebraces={(}{)},
postheadspace=.5em, %
headformat=\NAME~\NUMBER \NOTE %




\begin{teo}[Igualdad de las derivadas cruzadas o Clairaut] \label{Clairaut} 
Sea $f: \Omega \rightarrow \mathbb{R}$ una función de dos variables definida en un conjunto abierto $\Omega \subseteq \mathbb{R}^{2}$, si existen las segundas derivadas cruzadas y son continuas en $\Omega$, esto es, $f \in \mathcal{C}^{2}(\Omega)$ entonces estas son iguales, es decir:
\begin{equation*}\label{formula 1}
\frac{\partial^{2} f}{\partial x \partial y}=\frac{\partial^{2} f}{\partial y \partial x}. 
\begin{teo}[Primer teorema fundamental del calculo]\label{ptfc}
Sea $f$ una función integrable en el intervalo $[a, b]$, definimos $F$ en $[a, b]$ como
F(x)=\int_{a}^{x} f(t) d t \label{formula 2}
si $f$ es continua en $c \in(a, b)$, entonces $F$ es diferenciable en $c$ y $F^{\prime}(c)=f(c)
\begin{teo}[Regla de Barrow] \label{barrow}
Si $f$ es continua en $[a, b]$ y $f=g^{\prime}$ para alguna función $g$ entonces
\int_{a}^{b} f(t) d t=g(b)-g(a)    \label{formula 3}



Thank you so much.


Hm, just for clarification, especially on what you want or need to do. Here is one way to do it.

1 ) The code you posted seems to be from the long document you have, which turns out to be the Anexo you posted as image. If it's only that, do some manual edits. Else, continue here:

2 ) Latex is ASCII-text, you'd like to grep environments, like this one, which is somewhere in the file:

F(x)=\int_{a}^{x} f(t) d t \label{formula 2}

I'm not aware, if you can do this with some Latex-tool. However, writing a script which extracts all those "blocks" is not difficult. Best would be using Perl, as it's made for that (PERL = Practical Extraction and Report Language). But also PHP run from the command line would do this job. So would others, like C or C++ (well ...).

Running grep or some other regular expressions from a command line will probably become too clumsy and will most likely meet problems from irregularities in the original Latex-doc.

3 ) Once you have these code-snippets extracted, you'd need to reassemble them as a Latex document. Though I'm not very experienced with the ams-package, looks like you can do much of it by just inserting one or more & characters. Perhaps you have to substitute some keywords or so. Looks like you only need to introduce minimal changes, if any, to accomplish your task on the equations. Again, a perfect task for Perl, which you can master also with PHP.

From a practical point of view it's probably quite easy and advantageous to put them as one ore more separate codeSnippets.tex files, which you include via \input{codeSnippets} in a new main Latex-doc. The idea is to have all the preamble things there and the extracted equations elsewhere. That's of course a matter of taste and convenience ;-)

Best wishes

P.S.: Please find an elaborated solution with Perl here: How to extract equation-environemnts (or other blocks) inside a Latex document? .

P.S.: If you don't use Perl, but would like to go with Latex macros, just mimic the matching part in the middle of the perl script (# ~~~ finding ...).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.