summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2006-11-09 13:48:06 +0000
committerNorbert Preining <preining@logic.at>2006-11-09 13:48:06 +0000
commite09feaf065b824f1b81e47f36557822cfcf6ad87 (patch)
tree43a65c944b0ea1bafd116789d3146d5409511495 /Master/texmf-dist/tex/latex
parent12c77bc3ded49cb9c5585b1ed92cb1ce8ca5fa5f (diff)
extra updates
git-svn-id: svn://tug.org/texlive/trunk@2413 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/extract/extract.sty158
1 files changed, 105 insertions, 53 deletions
diff --git a/Master/texmf-dist/tex/latex/extract/extract.sty b/Master/texmf-dist/tex/latex/extract/extract.sty
index 994ba5c6f1c..46a653bf85d 100644
--- a/Master/texmf-dist/tex/latex/extract/extract.sty
+++ b/Master/texmf-dist/tex/latex/extract/extract.sty
@@ -31,34 +31,35 @@
%% extract.sty.
%%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\ProvidesPackage{extract}[2005/02/14 v1.6 extract content from document (HA)]
+\ProvidesPackage{extract}
+ [2005/05/07 v1.8 extract content from document (HA)]
\RequirePackage{verbatim}
\RequirePackage{xkeyval}
\newwrite\XTR@out
\newwrite\XTR@tmp
\newif\ifXTR@st
\newif\ifXTR@skip
-\newif\ifXTR@active
\newif\ifXTR@extract
-\newif\ifXTR@header\XTR@headertrue
-\newif\ifXTR@handles\XTR@handlestrue
\def\XTR@err#1{\PackageError{extract}{#1}\@ehc}
-\def\XTR@namelet#1#2{\expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname}
-\DeclareOptionX[XTR]{active}{\XTR@activetrue}
+\def\XTR@namelet#1#2{%
+ \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname
+}
+\define@boolkey[XTR]{extract.sty}[XTR@]{active}[true]{}
+\define@boolkey[XTR]{extract.sty}[XTR@]{header}[true]{}
+\define@boolkey[XTR]{extract.sty}[XTR@]{handles}[true]{}
+\define@boolkey[XTR]{extract.sty}[XTR@]{copydocumentclass}[true]{}
\DeclareOptionX[XTR]{generate}{\lowercase{\def\XTR@file{#1}}}
-\DeclareOptionX[XTR]{no-header}[false]{\XKV@setbool{XTR@header}{#1}}
-\DeclareOptionX[XTR]{document-handles}[true]{\XKV@setbool{XTR@handles}{#1}}
\DeclareOptionX[XTR]{extract-env}{%
\def\XTR@envs{#1}%
- \@for\XTR@tempa:=\XTR@envs\do\XTR@tempb
+ \XKV@for@n{#1}\XTR@tempa\XTR@tempb
}
\DeclareOptionX[XTR]{extract-cmd}{%
\def\XTR@cmdsargs{#1}%
- \@for\XTR@tempa:=\XTR@cmdsargs\do\XTR@tempb
+ \XKV@for@n{#1}\XTR@tempa\XTR@tempb
}
\DeclareOptionX[XTR]{extract-cmdline}{%
\def\XTR@cmdsline{#1}%
- \@for\XTR@tempa:=\XTR@cmdsline\do\XTR@tempb
+ \XKV@for@n{#1}\XTR@tempa\XTR@tempb
}
\def\XTR@tempb{%
\DeclareOptionX[XTR]{\XTR@tempa-nrs}{%
@@ -73,6 +74,7 @@
\def\XTR@tempa{extract}\XTR@tempb
\def\XTR@tempa{extractskip}\XTR@tempb
\DeclareOptionX*{\XTR@err{Unknown option `\CurrentOption'}}
+\ExecuteOptionsX[XTR]{header=true,handles=true,copydocumentclass=true}
\ProcessOptionsX[XTR]
\def\XTR@opentmp{\immediate\openout\XTR@tmp\jobname.xtr\relax}
\def\XTR@writetmp{\immediate\write\XTR@tmp}
@@ -84,7 +86,9 @@
\XTR@err{no file to generate; extract deactivated}
}{}
\XTR@opentmp
- \XTR@writetmp{\string\lowercase{\string\def\string\XTR@tempa{\jobname}}}
+ \XTR@writetmp{%
+ \string\lowercase{\string\def\string\XTR@tempa{\jobname}}%
+ }
\XTR@closetmp
\input{\jobname.xtr}
\ifx\XTR@tempa\XTR@file
@@ -132,7 +136,8 @@
\@nameuse{ifXTR@#1}\else
\XKV@ifundefined{XTR@#2-labels}{}{%
\ifx\XTR@currentlabel\relax\else
- \@expandtwoargs\in@{,\XTR@currentlabel,}{,\csname XTR@#2-labels\endcsname,}%
+ \@expandtwoargs\in@{,\XTR@currentlabel,}%
+ {,\csname XTR@#2-labels\endcsname,}%
\ifin@\XTR@maketrue\fi
\fi
}%
@@ -146,7 +151,7 @@
\global\let\XTR@currentlabel\relax
}
\def\XTR@ch@ckxtr#1#2{%
- \@for\XTR@resa:=#1\do{\expandafter\XTR@ch@ck@tr\XTR@resa--\@nil#2}%
+ \XKV@for@o#1\XTR@resa{\expandafter\XTR@ch@ck@tr\XTR@resa--\@nil#2}%
}
\def\XTR@ch@ck@tr#1-#2-#3\@nil#4{%
\ifx\@empty#1\@empty
@@ -191,8 +196,9 @@
\lowercase{\endgroup
\def\XTR@processline@begin{%
\@temptokena{}%
- \expandafter\verbatim@line\expandafter{\expandafter}\expandafter
- \XTR@testbegin\the\verbatim@line!begin(extractskip)\@nil
+ \edef\XTR@orig@line{\the\verbatim@line}%
+ \verbatim@line{}%
+ \expandafter\XTR@testbegin\XTR@orig@line!begin(extractskip)\@nil
}
\def\XTR@testbegin#1!begin(extractskip)#2\@nil{%
\@temptokena\expandafter{\the\@temptokena#1}%
@@ -224,11 +230,14 @@
\fi
}
\def\XTR@sk@plabel#1[]\@nil{\def\XTR@tempa{#1}}
-\def\XTR@t@stbegin#1!begin(extractskip)\@nil{\XTR@testend#1!end(extractskip)\@nil}
+\def\XTR@t@stbegin#1!begin(extractskip)\@nil{%
+ \XTR@testend#1!end(extractskip)\@nil
+}
\def\XTR@processline@end{%
\@temptokena{}%
- \expandafter\verbatim@line\expandafter{\expandafter}\expandafter
- \XTR@testend\the\verbatim@line!end(extractskip)\@nil
+ \edef\XTR@orig@line{\the\verbatim@line}%
+ \verbatim@line{}%
+ \expandafter\XTR@testend\XTR@orig@line!end(extractskip)\@nil
}
\def\XTR@testend#1!end(extractskip)#2\@nil{%
\@temptokena\expandafter{\the\@temptokena#1}%
@@ -239,15 +248,18 @@
\XTR@t@stend#2\@nil
\fi
}
-\def\XTR@t@stend#1!end(extractskip)\@nil{\XTR@testbegin#1!begin(extractskip)\@nil}
+\def\XTR@t@stend#1!end(extractskip)\@nil{%
+ \XTR@testbegin#1!begin(extractskip)\@nil
+}}
\def\XTR@processline@write{%
\ifXTR@st\ifcat$\the\@temptokena$\else
- \XTR@writetmp{\the\@temptokena}%
+ \XTR@writetmp{\the\@temptokena}%
\fi\fi
\ifXTR@extract\ifcat$\the\verbatim@line$\else
- \XTR@writeout{\the\verbatim@line}%
+ \XTR@writeout{\the\verbatim@line}%
\fi\fi
-}}
+ \ifx\XTR@orig@line\@empty\XTR@writetmp{}\XTR@writeout{}\fi
+}
\def\endextract{\XTR@stfalse\XTR@endextract}
\@namedef{endextract*}{\XTR@sttrue\XTR@endextract}
\def\XTR@endextract{%
@@ -260,7 +272,8 @@
\@namedef{extractskip}{\XTR@activefalse\@nameuse{extract*}}
\XTR@namelet{endextractskip}{endextract*}
\def\extractline{%
- \XKV@ifstar{\XTR@sttrue\XTR@extractline}{\XTR@stfalse\XTR@extractline}%
+ \XKV@ifstar{\XTR@sttrue\XTR@extractline}%
+ {\XTR@stfalse\XTR@extractline}%
}
\def\XTR@extractline{%
\begingroup
@@ -291,42 +304,65 @@
\ifXTR@active
\immediate\openout\XTR@out\XTR@file\relax
\ifXTR@header
+ \@tempcnta\time
+ \divide\@tempcnta 60
+ \edef\XTR@tempb{%
+ \the\year/\ifnum\the\month<10 0\fi\the\month/%
+ \ifnum\the\day<10 0\fi\the\day,\the\@tempcnta:%
+ }
+ \multiply\@tempcnta 60
+ \@tempcntb\time
+ \advance\@tempcntb-\@tempcnta
+ \ifnum\@tempcntb<10
+ \xdef\XTR@tempb{\XTR@tempb0\the\@tempcntb}
+ \else
+ \xdef\XTR@tempb{\XTR@tempb\the\@tempcntb}
+ \fi
\begingroup
\catcode`\%=12
\gdef\XTR@tempa{%%\space}
- \@tempcnta\time
- \divide\@tempcnta 60
- \edef\XTR@tempb{\the\year/\the\month/\the\day, \the\@tempcnta:}
- \multiply\@tempcnta 60
- \@tempcntb\time
- \advance\@tempcntb-\@tempcnta
- \ifnum\@tempcntb<10
- \xdef\XTR@tempb{\XTR@tempb0\the\@tempcntb}
- \else
- \xdef\XTR@tempb{\XTR@tempb\the\@tempcntb}
- \fi
\endgroup
\XTR@writeout{\XTR@tempa}
\filename@parse\XTR@file
\ifx\filename@ext\relax\def\filename@ext{tex}\fi
- \XTR@writeout{\XTR@tempa This is file, `\filename@base.\filename@ext',}
- \XTR@writeout{\XTR@tempa generated with the extract package.^^J\XTR@tempa}
+ \XTR@writeout{%
+ \XTR@tempa This is file, `\filename@base.\filename@ext',%
+ }
+ \XTR@writeout{%
+ \XTR@tempa generated with the extract package.^^J\XTR@tempa
+ }
\XTR@writeout{\XTR@tempa Generated on : \space\XTR@tempb}
\filename@parse\jobname
\ifx\filename@ext\relax\def\filename@ext{tex}\fi
- \XTR@writeout{\XTR@tempa From source \space: \space\filename@base.\filename@ext}
- \XTR@writeout{\XTR@tempa Using options: \space\csname opt@extract.sty\endcsname}
+ \XTR@writeout{%
+ \XTR@tempa From source \space: \space\filename@base.\filename@ext
+ }
+ \XTR@writeout{%
+ \XTR@tempa Using options: \space\csname opt@extract.sty\endcsname
+ }
\XTR@writeout{\XTR@tempa}
\fi
+\ifXTR@copydocumentclass
+ \def\XTR@tempa#1.cls\@nil{\def\XTR@tempa{#1}}
+ \expandafter\XTR@tempa\XKV@documentclass\@nil
+ \ifx\XKV@classoptionslist\@empty
+ \XTR@writeout{\string\documentclass{\XTR@tempa}}
+ \else
+ \@temptokena\expandafter{\XKV@classoptionslist}%
+ \XTR@writeout{\string\documentclass[\the\@temptokena]{\XTR@tempa}}
+ \fi
+\fi
\AtBeginDocument{%
\ifXTR@handles
\XTR@writeout{}%
\XTR@writeout{\string\begin{document}}%
\fi
\XKV@ifundefined{XTR@envs}{}{%
- \@for\XTR@tempa:=\XTR@envs\do{%
+ \XKV@for@o\XTR@envs\XTR@tempa{%
\XKV@ifundefined\XTR@tempa{%
- \XTR@err{environment `\XTR@tempa' not defined; extraction canceled}%
+ \XTR@err{%
+ environment `\XTR@tempa' not defined; extraction canceled%
+ }%
}{%
\XTR@namelet{XTR\XTR@tempa}{\XTR@tempa}%
\@namedef{\XTR@tempa\expandafter}\expandafter{\expandafter
@@ -338,8 +374,12 @@
\let\do\@makeother\dospecials\catcode`\^^M\active
\def\verbatim@processline{%
\let\verbatim@processline\XTR@processline@begin
- \XTR@writeout{\string\begin{\XTR@tempa}\the\verbatim@line}%
- \XTR@writetmp{\string\begin{XTR\XTR@tempa}\the\verbatim@line}%
+ \XTR@writeout{%
+ \string\begin{\XTR@tempa}\the\verbatim@line
+ }%
+ \XTR@writetmp{%
+ \string\begin{XTR\XTR@tempa}\the\verbatim@line
+ }%
}%
\XTR@sttrue\let\XTR@tempb\verbatim@
\else
@@ -368,11 +408,14 @@
\let\XTR@sect\@sect
\let\XTR@chapter\@chapter
\def\XTR@tempb{chapter}%
- \@for\XTR@tempa:=\XTR@cmdsargs\do{%
+ \XKV@for@o\XTR@cmdsargs\XTR@tempa{%
\XKV@ifundefined\XTR@tempa{%
- \XTR@err{command `\@backslashchar\XTR@tempa' not defined; extraction canceled}%
+ \XTR@err{command `\@backslashchar\XTR@tempa' not defined;
+ extraction canceled%
+ }%
}{%
- \@expandtwoargs\in@{,\XTR@tempa,}{,chapter,section,subsection,subsubsection,}%
+ \@expandtwoargs\in@{,\XTR@tempa,}%
+ {,chapter,section,subsection,subsubsection,}%
\ifin@
\ifx\XTR@tempa\XTR@tempb
\def\@chapter[#1]#2{%
@@ -412,19 +455,24 @@
}%
\fi
\else
- \XTR@err{unsupported command `\XTR@tempa'; try the `extract-cmdline option}%
+ \XTR@err{unsupported command `\XTR@tempa';
+ try the `extract-cmdline option}%
\fi
}%
}%
}%
\XKV@ifundefined{XTR@cmdsline}{}{%
- \@for\XTR@tempa:=\XTR@cmdsline\do{%
+ \XKV@for@o\XTR@cmdsline\XTR@tempa{%
\XKV@ifundefined\XTR@tempa{%
- \XTR@err{command `\@backslashchar\XTR@tempa' not defined; extraction canceled}%
+ \XTR@err{command `\@backslashchar\XTR@tempa' not defined;
+ extraction canceled}%
}{%
- \@expandtwoargs\in@{,\XTR@tempa,}{,chapter,section,subsection,subsubsection,}%
+ \@expandtwoargs\in@{,\XTR@tempa,}%
+ {,chapter,section,subsection,subsubsection,}%
\ifin@
- \XTR@err{use the `extract-cmd' option for command `\XTR@tempa'}%
+ \XTR@err{%
+ use the `extract-cmd' option for command `\XTR@tempa'%
+ }%
\else
\XTR@namelet{XTR\XTR@tempa}{\XTR@tempa}%
\@namedef{\XTR@tempa\expandafter}\expandafter{\expandafter
@@ -444,9 +492,13 @@
}%
\def\XTR@@xtractcmdline{%
\XTR@writeout{}%
- \XTR@writeout{\expandafter\string\csname\XTR@tempa\endcsname\the\verbatim@line}%
+ \XTR@writeout{\expandafter\string\csname\XTR@tempa
+ \endcsname\the\verbatim@line
+ }%
\XTR@opentmp
- \XTR@writetmp{\expandafter\string\csname XTR\XTR@tempa\endcsname\the\verbatim@line}%
+ \XTR@writetmp{\expandafter\string\csname XTR\XTR@tempa
+ \endcsname\the\verbatim@line
+ }%
\XTR@closetmp
\endgroup
\input{\jobname.xtr}%