summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/extract/extract.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-19 03:00:38 +0000
committerNorbert Preining <norbert@preining.info>2019-09-19 03:00:38 +0000
commit344e74a832ad49360aa4e08c467ff783c1f02f66 (patch)
tree40f366f591a98147966bf890234761e337aaac61 /macros/latex/contrib/extract/extract.dtx
parent841a985f019b145be416f24859bcd1e0833ddb76 (diff)
CTAN sync 201909190300
Diffstat (limited to 'macros/latex/contrib/extract/extract.dtx')
-rw-r--r--macros/latex/contrib/extract/extract.dtx91
1 files changed, 65 insertions, 26 deletions
diff --git a/macros/latex/contrib/extract/extract.dtx b/macros/latex/contrib/extract/extract.dtx
index 42aa96f4c5..801a983433 100644
--- a/macros/latex/contrib/extract/extract.dtx
+++ b/macros/latex/contrib/extract/extract.dtx
@@ -16,7 +16,7 @@
% extract.sty
%
%% ---------------------------------------
-%% Copyright (C) 2004-2005 Hendri Adriaens
+%% Copyright (C) 2004-2019 Hendri Adriaens
%% ---------------------------------------
%%
%% This work may be distributed and/or modified under the
@@ -109,7 +109,7 @@ of the package.
%
% \GetFileInfo{extract.sty}
%
-% \CheckSum{1011}
+% \CheckSum{1069}
%
% \DoNotIndex{\@backslashchar,\@bsphack,\@checkend,\@currenvir,
% \@currenvline,\@doendpe,\@eha,\@ehc,\@empty,\@endpefalse,\@esphack,
@@ -920,7 +920,7 @@ of the package.
%<*extract>
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{extract}
- [2019/09/17 v1.9 extract content from document (HA)]
+ [2019/09/18 v1.9a extract content from document (HA)]
\RequirePackage{verbatim}
\RequirePackage{xkeyval}
\newwrite\XTR@out
@@ -1086,47 +1086,50 @@ of the package.
% \end{macro}
% \begin{macro}{\begin}
% \marg{environment}\\
-% \changes{v1.9}{2019/09/17}{Changed definition to robust version}
+% \changes{v1.9a}{2019/09/18}{Added definitions for robust versions of \cs{begin} and \cs{end}}
% Modify the macro |\begin| to allow adding code to a level specific
% hook which can be executed after |\endgroup| in |\end|. See for
-% more info on this macro the \LaTeX\ source~\cite{LaTeXbase}.
-% \begin{macrocode}
-\@namedef{begin}#1{%
- \@ifundefined{#1}%
- {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}%
- {\def\reserved@a{\def\@currenvir{#1}%
- \edef\@currenvline{\on@line}%
- \csname #1\endcsname}}%
- \@ignorefalse
- \begingroup\@endpefalse
+% more info on this macro the \LaTeX\ source~\cite{LaTeXbase}. We first do this
+% for the new \LaTeX\ format, which defines robust versions of |\begin| and |\end|.
+% \begin{macrocode}
+\@ifl@t@r\fmtversion{2019/10/01}%
+{% new format
+ \@namedef{begin }#1{%
+ \@ifundefined{#1}%
+ {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}%
+ {\def\reserved@a{\def\@currenvir{#1}%
+ \edef\@currenvline{\on@line}%
+ \csname #1\endcsname}}%
+ \@ignorefalse
+ \begingroup\@endpefalse
% \end{macrocode}
% Advance depth level.
% \begin{macrocode}
- \global\advance\@envdepth\@ne
+ \global\advance\@envdepth\@ne
% \end{macrocode}
% Initialize the hook for this level.
% \begin{macrocode}
- \global\@namedef{@afterendenvhook@\romannumeral\@envdepth}{}%
- \reserved@a}
+ \global\@namedef{@afterendenvhook@\romannumeral\@envdepth}{}%
+ \reserved@a
+ }%
% \end{macrocode}
% \end{macro}
% \begin{macro}{\end}
% \marg{environment}\\
-% \changes{v1.9}{2019/09/17}{Changed definition to robust version}
% Modify |\end| to execute the code collected in the hook.
% \begin{macrocode}
-\@namedef{end}#1{%
- \csname end#1\endcsname\@checkend{#1}%
- \expandafter\endgroup\if@endpe\@doendpe\fi
+ \@namedef{end }#1{%
+ \csname end#1\endcsname\@checkend{#1}%
+ \expandafter\endgroup\if@endpe\@doendpe\fi
% \end{macrocode}
% Copy current hook code to a temporary macro.
% \begin{macrocode}
- \expandafter\let\expandafter\reserved@a
- \csname @afterendenvhook@\romannumeral\@envdepth\endcsname
+ \expandafter\let\expandafter\reserved@a
+ \csname @afterendenvhook@\romannumeral\@envdepth\endcsname
% \end{macrocode}
% Decrease the depth.
% \begin{macrocode}
- \global\advance\@envdepth\m@ne
+ \global\advance\@envdepth\m@ne
% \end{macrocode}
% Execute the hook of the current environment. This is done after
% decreasing the depth as to avoid level mixing problems when the
@@ -1135,8 +1138,44 @@ of the package.
% defined since it is executed after the group and does not belong
% anymore to the environment in which the hook was defined.
% \begin{macrocode}
- \reserved@a\relax
- \if@ignore\@ignorefalse\ignorespaces\fi}
+ \reserved@a\relax
+ \if@ignore\@ignorefalse\ignorespaces\fi
+ }%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\begin}
+% \marg{environment}\\
+% This is the code for the old format of \LaTeX.
+% \begin{macrocode}
+}{% old format
+ \def\begin#1{%
+ \@ifundefined{#1}%
+ {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}%
+ {\def\reserved@a{\def\@currenvir{#1}%
+ \edef\@currenvline{\on@line}%
+ \csname #1\endcsname}}%
+ \@ignorefalse
+ \begingroup\@endpefalse
+ \global\advance\@envdepth\@ne
+ \global\@namedef{@afterendenvhook@\romannumeral\@envdepth}{}%
+ \reserved@a
+ }%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\end}
+% \marg{environment}
+% This is the code for the old format of \LaTeX.
+% \begin{macrocode}
+ \def\end#1{%
+ \csname end#1\endcsname\@checkend{#1}%
+ \expandafter\endgroup\if@endpe\@doendpe\fi
+ \expandafter\let\expandafter\reserved@a
+ \csname @afterendenvhook@\romannumeral\@envdepth\endcsname
+ \global\advance\@envdepth\m@ne
+ \reserved@a\relax
+ \if@ignore\@ignorefalse\ignorespaces\fi
+ }%
+}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\AfterEndEnv}