5

I'm using the package extract and I'm facing the following problem:

I try to extract only equation in align environnement (only A and not B, see the code), but it does not work. I have read the extract documentation but didn't find any answer. I would appreciate your help.

P.S. The code works well when there is no align* environement (but unfortunately I need it).

\documentclass[a4paper]{report}

\usepackage[active,
generate=test,
extract-env={align}]{extract}
\usepackage{amsthm} 
\usepackage{amsmath}

\begin{document}

% % % %    A
\begin{align}
x^2 + y^2 &= 1
\\ y &= \sqrt{1 - x^2}.
\end{align}

% % % % B               
\begin{align*}
x^2 + y^2 &= 1
\\ y &= \sqrt{1 - x^2}.
\end{align*}
\end{document}

In the error log I got this message:

\begin{align*} on input line 23 ended by \end{XTRalign}. \end{align*}

P.S. I'm wondering if it is maybe a limitation because with the equation environment the following code works:

\documentclass[a4paper]{report}
\usepackage[active,
generate=test,
extract-env={equation}]{extract}
\usepackage{amsthm}
\usepackage{amsmath} 

\begin{document}

% % % %    A
\begin{equation}
x^2 + y^2           
\end{equation}

% % % % B
\begin{equation*}
x^2 + y^2       
\end{equation*}
\end{document}
2
  • Welcome to TeX.SX! It seems to be a limitation of the extract package. Jan 17, 2014 at 6:33
  • First of all I;ve never heard for the extract package before, so I have no idea what it does, but the align construction is rather special in that AFAIR it explicitly looks for the string \end{align} to end it, so what ever `extract is doing may mess this up.
    – daleif
    Jan 17, 2014 at 9:12

1 Answer 1

2

i finally find a way to overcome this limitation.

To recall the problem was the following : -impossible to extract align environment using the extract package when there are some align* environment in the original file. --> so impossible to extract only numbered aligned equation.

Solution :

  • Replace all align environment by equation environment then add aligned environment ,

Concretely:

1-Search and replace all: \begin{align} with \begin{equation}\begin{aligned}

2-Search and replace all: \end{align} with \end{aligned}\end{equation}

And the "extract" package will works like a charm :) hope this can help,

Below the code to compare with question's code :

        \documentclass[a4paper]{report}

        \usepackage[ 
        active,
        generate=test,
        extract-env={equation},
        ]{extract}

        \begin{document}

        % % % %    A
        \begin{equation}\begin{aligned}
        x^2 + y^2 &= 1
        \\ y &= \sqrt{1 - x^2}.
        \end{aligned}\end{equation}

        % % % % B               
        \begin{equation*}\begin{aligned}
        x^2 + y^2 &= 1
        \\ y &= \sqrt{1 - x^2}.
        \end{aligned}\end{equation*}

        \end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .