diff options
author | Norbert Preining <preining@logic.at> | 2006-11-09 13:48:06 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2006-11-09 13:48:06 +0000 |
commit | e09feaf065b824f1b81e47f36557822cfcf6ad87 (patch) | |
tree | 43a65c944b0ea1bafd116789d3146d5409511495 /Master/texmf-dist | |
parent | 12c77bc3ded49cb9c5585b1ed92cb1ce8ca5fa5f (diff) |
extra updates
git-svn-id: svn://tug.org/texlive/trunk@2413 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/extract/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/extract/extract.pdf | bin | 193121 -> 201813 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/extract/extract.dtx | 522 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/extract/extract.sty | 158 | ||||
-rw-r--r-- | Master/texmf-dist/tpm/extract.tpm | 8 |
5 files changed, 432 insertions, 260 deletions
diff --git a/Master/texmf-dist/doc/latex/extract/README b/Master/texmf-dist/doc/latex/extract/README index e211b46f804..7cc0a467797 100644 --- a/Master/texmf-dist/doc/latex/extract/README +++ b/Master/texmf-dist/doc/latex/extract/README @@ -1,4 +1,4 @@ -extract v1.5 +extract v1.8 ------------ This package can be used to (conditionally) extract specific @@ -25,7 +25,7 @@ after installing the files. CTAN:/macros/latex/contrib/extract: official location | - |- readme : /doc/latex/extract + |- readme : should not be installed |- extract.dtx: /source/latex/extract |- extract.pdf: /doc/latex/extract `- extract.sty: /tex/latex/extract diff --git a/Master/texmf-dist/doc/latex/extract/extract.pdf b/Master/texmf-dist/doc/latex/extract/extract.pdf Binary files differindex f0cf208b153..3176259e8e0 100644 --- a/Master/texmf-dist/doc/latex/extract/extract.pdf +++ b/Master/texmf-dist/doc/latex/extract/extract.pdf diff --git a/Master/texmf-dist/source/latex/extract/extract.dtx b/Master/texmf-dist/source/latex/extract/extract.dtx index c525fdbef48..b4b74776bef 100644 --- a/Master/texmf-dist/source/latex/extract/extract.dtx +++ b/Master/texmf-dist/source/latex/extract/extract.dtx @@ -68,8 +68,13 @@ \let\Section\section\def\section*#1{\Section*{#1}\addcontentsline{toc}{section}{#1}} \bibliographystyle{plain} \bibliography{extract} -\PrintChangesX -\PrintIndex +\section*{Acknowledgements} +Thanks go to David Carlisle for proposing the technique implemented +in this package to solve my initial problem.\footnote{See +section~\ref{sec:intro}.} Thanks also go to Michael Kohlhase and +Johannes Luber for reporting bugs and providing ideas for extensions +of the package. +\PrintChangesX\PrintIndexX \end{document} %</driver> % \fi @@ -77,17 +82,17 @@ % \changes{v1.0}{2004/12/19}{Initial release} % \changes{v1.1}{2005/01/01}{Added conditional extraction using labels} % \changes{v1.1}{2005/01/01}{Revised documentation} -% \changes{v1.2}{2005/01/06}{Fixed \ci{AfterEndEnv} hook for nested environments} +% \changes{v1.2}{2005/01/06}{Fixed \cs{AfterEndEnv} hook for nested environments} % \changes{v1.2}{2005/01/06}{Simplified optional argument check for \texttt{extract} environment} % \changes{v1.2}{2005/01/06}{Increased efficiency of the package} % \changes{v1.3}{2005/01/12}{Removed some input checks for more flexibility} -% \changes{v1.3}{2005/01/12}{Added \ci{extractline}} +% \changes{v1.3}{2005/01/12}{Added \cs{extractline}} % \changes{v1.3}{2005/01/12}{Added line extraction method for commands} % \changes{v1.3}{2005/01/12}{Simplified package} % \changes{v1.3}{2005/01/12}{Added \texttt{document-handles} option} % \changes{v1.3}{2005/01/12}{Added examples and documentation} % \changes{v1.3}{2005/01/12}{Updated license information} -% \changes{v1.4}{2005/02/06}{Adjusted options section for \pf{xkeyval} (\ci{XKV@tkey} not defined anymore)} +% \changes{v1.4}{2005/02/06}{Adjusted options section for \pf{xkeyval} (\cs{XKV@tkey} not defined anymore)} % \changes{v1.4}{2005/02/06}{Added \texttt{extractskip} environment} % \changes{v1.4}{2005/02/06}{Allow for any filename} % \changes{v1.4}{2005/02/06}{Changed temp extension to \texttt{.xtr}} @@ -95,26 +100,36 @@ % \changes{v1.5}{2005/02/08}{Avoid using counters for conditional extraction with numbers} % \changes{v1.6}{2005/02/14}{Improved options section} % \changes{v1.6}{2005/02/14}{Added optional header for extracted files} +% \changes{v1.7}{2005/03/31}{Solved small bug with `no-header' option} +% \changes{v1.7}{2005/03/31}{Revised documentation} +% \changes{v1.8}{2005/05/07}{Added \texttt{copydocumentclass} option} +% \changes{v1.8}{2005/05/07}{Changed name of option \texttt{no-header} to \texttt{header}} +% \changes{v1.8}{2005/05/07}{Changed name of option \texttt{document-handles} to \texttt{handles}} +% \changes{v1.8}{2005/05/07}{Revised documentation and examples} % % \GetFileInfo{extract.sty} % -% \CheckSum{989} +% \CheckSum{1013} % % \DoNotIndex{\@backslashchar,\@bsphack,\@checkend,\@currenvir, % \@currenvline,\@doendpe,\@eha,\@ehc,\@empty,\@endpefalse,\@esphack, -% \@expandtwoargs,\@for,\@ifundefined,\@ignorefalse,\@latex@error, +% \@expandtwoargs,\@ifundefined,\@ignorefalse,\@latex@error,\do, % \@makeother,\@namedef,\@ne,\@nil,\@nnil,\@temptokena,\@testopt, % \active,\advance,\AtBeginDocument,\AtEndDocument,\begin,\begingroup, -% \catcode,\closeout,\csname,\CurrentOption,\DeclareOptionX,\def,\do, +% \catcode,\closeout,\csname,\CurrentOption,\DeclareOptionX,\def, % \dospecials,\edef,\else,\end,\endcsname,\endgroup,\expandafter,\fi, % \g@addto@macro,\global,\if@endpe,\if@ignore,\ifcat,\ifin@,\ifnum,\ifx, % \ignorespaces,\immediate,\in@,\input,\jobname,\lccode,\let,\lowercase, % \m@ne,\NeedsTeXFormat,\newcount,\newif,\newwrite,\noexpand,\on@line, -% \openout,\ProcessOptionsXi,\ProvidesPackage,\relax,\RequirePackage, +% \openout,\ProcessOptionsX,\ProvidesPackage,\relax,\RequirePackage, % \reserved@a,\romannumeral,\string,\the,\write,\XTR@activefalse, % \XTR@activetrue,\XTR@handlestrue,\XTR@resa,\XTR@tempa,\XTR@tempb,\z@, % \PackageError,\gdef,\count@,\day,\divide,\month,\multiply,\space, -% \time,\xdef,\year} +% \time,\xdef,\year,\@nameuse,\@tempcnta,\@tempcntb,\\,\!,\(,\), +% \define@boolkey,\XTR@sttrue,\XTR@stfalse,\documentclass,\filename@base, +% \filename@ext,\filename@parse,\KV@@sp@def,\XKV@afterelsefi,\XKV@afterfi, +% \XKV@classoptionslist,\XKV@documentclass,\XKV@for@n,\XKV@for@o, +% \XKV@ifstar,\XKV@ifundefined,\XKV@sp@deflist,\XKV@tkey,\chapter} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -158,11 +173,13 @@ %\section{Introduction}\label{sec:intro} %I created this package when I was working on some lecture notes with %exercises in the text and wanted to generate an exercises book on -%the fly. The package heavily uses the \pf{verbatim} package -%\cite{verbatim} by Rainer Sch\"opf and uses the \pf{xkeyval} package -%\cite{xkeyval} to provide a simple and easy interface\footnote{And -%some tools like \ci{XKV@ifundefined} and \ci{XKV@sp@deflist}. See -%section~\ref{sec:imple} for more information.}. +%the fly. David Carlisle put forward the idea to use a technique as +%is now implemented in this package. The package heavily uses the +%\pf{verbatim} package \cite{verbatim} by Rainer Sch\"opf and uses +%the \pf{xkeyval} package \cite{xkeyval} to provide a simple and easy +%interface\footnote{And some tools like \cs{XKV@ifundefined} and +%\cs{XKV@sp@deflist}. See section~\ref{sec:imple} for more +%information.}. % %There are other packages around that provide tools for conditionally %typesetting material or writing material to an external file. Let me list a few. @@ -209,23 +226,24 @@ % ]{extract} %\end{example} %\DescribeOptions{active,generate,extract-env} -%If the |active| option is not specified, the package does nothing -%and no files are generated. If the option is specified, the package -%will redefine the environments |figure| and |table| so that they -%write their bodies (the content of the environment) to the file -%indicated with the |generate| option, here |file.tex|\footnote{If a -%file extension is lacking, \texttt{.tex} will be used.}, including -%the |\begin{figure}| and |\end{figure}| commands. Besides that, the -%environments will be executed as usual. Most environments are -%supported (known exception is the |document| environment). When the -%package encounters |\begin{document}| or |\end{document}| in the -%source file, by default\footnote{See section~\ref{sec:misc} for the -%the \texttt{document-handles} option.}, it will also write these -%commands to the target file, such that, if a suitable preamble is -%added, the file is ready to be run by \LaTeX. See -%listing~\vref{list:env} for an example.\footnote{See -%section~\ref{sec:tools} for the \texttt{extract} environment and -%section~\ref{sec:sande} how to obtain example files.} +%If the |active| option is not specified (or set to |false|), the +%package does nothing and no files are generated. If the option is +%specified, the package will redefine the environments |figure| and +%|table| so that they write their bodies (the content of the +%environment) to the file indicated with the |generate| option, here +%|file.tex|\footnote{If a file extension is lacking, \texttt{.tex} +%will be used.}, including the |\begin{figure}| and |\end{figure}| +%commands. Besides that, the environments will be executed as usual. +%Most environments are supported (known exception is the |document| +%environment). When the package encounters |\begin{document}| or +%|\end{document}| in the source file, by default\footnote{See +%section~\ref{sec:misc} for the \texttt{handles} +%option.}, it will also write these commands to the target file, such +%that, if a suitable preamble is added, the file is ready to be run +%by \LaTeX. See listing~\vref{list:env} for an example.\footnote{See +%section~\ref{sec:manual} for the \texttt{extract} environment, +%section~\ref{sec:misc} for the \texttt{copydocumentclass} option and +%section~\ref{sec:sande} how to obtain the example files.} %\begin{Listing}\caption{Environment extraction.}\label{list:env} %\begin{minipage}[t]{.49\linewidth} %\hfill |xtrex1.tex| @@ -234,6 +252,7 @@ % \usepackage[ % active, % generate=file, +% copydocumentclass=false, % extract-env=equation % ]{extract} % \begin{extract} @@ -311,7 +330,8 @@ %style file, your document might fail to run. In particular, one %should not redefine one of the commands supported by the first %method with this method. See listing~\vref{list:cmd} for a working -%example of both methods. +%example of both methods.\footnote{See section~\ref{sec:manual} for +%the \texttt{extract*} environment.} %\begin{Listing}\caption{Command extraction.}\label{list:cmd} %\begin{minipage}[t]{.49\linewidth} %\hfill |xtrex2.tex| @@ -324,10 +344,9 @@ % extract-cmd=section, % extract-cmdline=label % ]{extract} +% \begin{extract*} % \newtheorem{exercise}{Exercise} -% \begin{extract} -% \documentclass{article} -% \end{extract} +% \end{extract*} % \begin{document} % \section{Theory} % \label{sec:1} @@ -346,6 +365,7 @@ %\hfill |file.tex| %\begin{example} % \documentclass{article} +% \newtheorem{exercise}{Exercise} % % \begin{document} % @@ -375,7 +395,7 @@ %environment or command and the |-nrs| postfix. This option can take %a comma separated list in which you can specify which environments %or macros (counting from the |\usepackage{extract}| -%command\footnote{Notice that starred commands like \ci{chapter*}, +%command\footnote{Notice that starred commands like \cs{chapter*}, %which won't be redefined by the \texttt{extract-cmd} option, will %also not be counted.}) should be extracted. Table~\vref{tab:syntax} lists %the syntax that can be used in the comma separated list. The term @@ -408,8 +428,7 @@ %\end{example} %This example, when completed with content, will extract all |table| %environments, |figure| environments 1, 2, and all figures from (and -%including) figure 4. It will also extract chapters 3 to 5 and -%chapter 7. +%including) figure 4. It will also extract chapter commands 3 to 5 and 7. % %\subsection{Extraction with labels} %\DescribeOptions{-labels} @@ -419,9 +438,10 @@ %that one needs to modify the source document and add labels in the %text. % +%\DescribeMacro{\extractionlabel} %Labels are declared with the following command. %\begin{command} -% `\ci{extractionlabel}\marg{name}' +% `\cs{extractionlabel}\marg{name}' %\end{command} %A label should be declared just before the command or environment %that you want to extract. For instance @@ -465,9 +485,6 @@ % figure-nrs={1,3}, % figure-labels={fig-a,fig-b} % ]{extract} -% \begin{extract} -% \documentclass{article} -% \end{extract} % \begin{document} % Some text. % \begin{figure} @@ -517,32 +534,32 @@ %\end{Listing} % %\section{Extraction tools}\label{sec:tools} -%\subsection{Manual extraction} +%\subsection{Manual extraction}\label{sec:manual} %\DescribeEnv{extract} -%The package provides the environment |extract| +%The package provides the environment |extract|. %\begin{command} -% `\ci{begin\char`\{extract\char`\}}' +% `\cs{begin\char`\{extract\char`\}}' % `\meta{body}' -% `\ci{end\char`\{extract\char`\}}' +% `\cs{end\char`\{extract\char`\}}' %\end{command} -%This environment writes only its body to the target file. This can +%This environment writes its body only to the target file. This can %be used to generate a preamble in the target file so that you can %run the generated file through \LaTeX\ immediately after creation. -%See the examples in sections~\ref{sec:envxtr} and~\ref{sec:cmdxtr} -%and the example below. +%See the example in listing~\vref{list:env} and the example below. % %\DescribeEnv{extract*} -%There exists also a starred version of the |extract| environment. +%There also exists a starred version of the |extract| environment. %\begin{command} -% `\ci{begin\char`\{extract*\char`\}}' +% `\cs{begin\char`\{extract*\char`\}}' % `\meta{body}' -% `\ci{end\char`\{extract*\char`\}}' +% `\cs{end\char`\{extract*\char`\}}' %\end{command} %This environment will not only write the body to the target file, %but will also execute the code in the source document. This can be %used to create a common preamble which holds packages and commands %that will be used in both the source and the target file. See -%listing~\vref{list:xtrenv} for an example. +%listing~\vref{list:cmd} and listing~\vref{list:xtrenv} for examples. +%Notice that the `answer' will not appear in |xtrex4.dvi|. %\begin{Listing}\caption{Extract environments.}\label{list:xtrenv} %\begin{minipage}[t]{.49\linewidth} %\hfill |xtrex4.tex| @@ -553,9 +570,6 @@ % generate=file, % extract-env=equation* % ]{extract} -% \begin{extract} -% \documentclass{article} -% \end{extract} % \begin{extract*} % \usepackage{amsmath} % \end{extract*} @@ -564,7 +578,10 @@ % \begin{equation*} % x^2+y^2=z^2 % \end{equation*} -% Some text. +% \begin{extract} +% $x=3$, $y=4$ and $z=5$ +% satisfy this equation. +% \end{extract} % \end{document} %\end{example} %\end{minipage} @@ -580,50 +597,51 @@ % \begin{equation*} % x^2+y^2=z^2 % \end{equation*} +% $x=3$, $y=4$ and $z=5$ +% satisfy this equation. % % \end{document} %\end{example} %\end{minipage} %\end{Listing} % -%\DescribeMacro{\extractline} -%\DescribeMacro{\extractline*} +%\DescribeMacros{\extractline,\extractline*} %The package also provides a command that extracts the current line. %\begin{command} -% `\ci{extractline}' -% `\ci{extractline*}' +% `\cs{extractline}' +% `\cs{extractline*}' %\end{command} %The starred version also executes the code at that line. See the %example below. %\begin{example} -% \extractline This should be extracted. -% \extractline*This should be executed and extracted. +% \extractline This line should be extracted. +% \extractline*This line should be extracted and executed. %\end{example} -%Notice that a space is following |\extractline| and that no space is -%following |\extractline*|. In the first line, \LaTeX\ will eat this +%Notice that a space is following the command |\extractline| and that no space is +%following the command |\extractline*|. In the first line, \LaTeX\ will eat this %space, but it won't do that in the second line. If we add a space %there in between the |*| and |This|, this space will be executed and %extracted as well. % -%\newpage\DescribeMacro{\extractline} -%\DescribeMacro{\extractline*} +%\DescribeMacros{\extractline,\extractline*} %\DescribeEnvs{extract,extract*} -%The |extract| and |extract*| environments and the commands +%The |extract| and |extract*| environments and the macros %|\extractionlabel| and |\extractionlabel*| have an optional argument %for specifying the label directly. %\begin{command} -% `\ci{begin\char`\{extract\char`\}}\oarg{name}' -% `\ci{begin\char`\{extract*\char`\}}\oarg{name}' -% `\ci{extractlabel}\oarg{name}' -% `\ci{extractlabel*}\oarg{name}' +% `\cs{begin\char`\{extract\char`\}}\oarg{name}' +% `\cs{begin\char`\{extract*\char`\}}\oarg{name}' +% `\cs{extractline}\oarg{name}' +% `\cs{extractline*}\oarg{name}' %\end{command} -% -%\DescribeOptions{extract-labels,line-labels,extract-nrs,line-nrs} -%The options |extract-labels| and |line-labels| can be used to +%\newpage +%\DescribeOptions{extract-nrs,line-nrs,extract-labels,line-labels} +%The options |extract-nrs| and |line-nrs| can be used to %control conditional extraction of these environments and commands -%using labels. Moreover, one can do conditional extractions with -%numbers for these commands and environments as well. Use the options -%|extract-nrs| and |line-nrs| for that purpose. +%using numbers. Moreover, one can do conditional extractions with +%labels for these commands and environments as well. Use the options +%|extract-labels| and |line-labels| for that purpose. See also +%section~\ref{sec:conditional} for information about conditional extraction. % %See an example in listing~\vref{list:optlab}. %This example will demonstrate that only certain lines and environments @@ -642,6 +660,7 @@ % \usepackage[ % active, % generate=file, +% copydocumentclass=false, % extract-labels=type-a, % line-labels={type-a,type-c}, % line-nrs=3 @@ -680,20 +699,20 @@ %\end{minipage} %\end{Listing} % -%\subsection{Skipping content} +%\subsection{Skipping extraction} %\DescribeEnv{extractskip} %The package also provides the |extractskip| environment. %\begin{command} -% `\ci{begin\char`\{extractskip\char`\}}\oarg{name}' +% `\cs{begin\char`\{extractskip\char`\}}\oarg{name}' % `\meta{body}' -% `\ci{end\char`\{extractskip\char`\}}' +% `\cs{end\char`\{extractskip\char`\}}' %\end{command} %The body of this environment will not be written to the target file, %but will be executed. This environment can be used to skip material %in an environment which extracts its entire body. This could be the %|extract| environment, but also an environment that has been %redefined to be extracted using the |extract-env| option. The argument -%\meta{name} is optional and contains the label; see below. +%\meta{name} is optional and contains the label. % %\DescribeOptions{extractskip-nrs,extractskip-labels} %This environment can also operate conditionally as has been @@ -710,9 +729,6 @@ % generate=file, % extract-env=figure % ]{extract} -% \begin{extract} -% \documentclass{article} -% \end{extract} % \begin{document} % \begin{figure}[!h] % \begin{extractskip} @@ -769,9 +785,6 @@ % generate=file, % extractskip-labels=skipb % ]{extract} -% \begin{extract} -% \documentclass{article} -% \end{extract} % \begin{document} % \begin{extract*} % \begin{itemize} @@ -807,20 +820,26 @@ %\end{Listing} % %\subsection{Miscellaneous options}\label{sec:misc} -%\DescribeOption{document-handles} The package provides the -%option |document-handles|. This option can be set to |true| or -%|false| and controls whether the package will write +%\DescribeOption{header} When setting the |header| option to +%|false|, no header will be written to the target file. If the option +%is not specified or set to |true|, the package will write a header +%to the target file including information on when the target file was +%generated and which source file was used. +% +%\DescribeOption{handles} +%This option controls whether the package will write %|\begin{document}| and |\end{document}| to the target file when it %encounters these commands in the source document. By default, this %option is set to |true|. When the option is set to |false|, the %generated file can be |\input|ed or |\include|d by another file %immediately after production. % -%\DescribeOption{no-header} When specifying the |no-header| option, -%no header will be written to the target file. If the option is not -%specified or set to |true|, the package will write a header to the -%target file including information on when the target file was generated -%and which source file was used. +%\DescribeOption{copydocumentclass} +%This option control whether the target file should get the same +%|\documentclass| command as the source document (including class +%options). If set to |false|, you should specify another document class +%for the target file, for instance using the |extract| environment. +%See listing~\vref{list:env} for an example. % %\section{How it works, limitations}\label{sec:how} %The package works as follows. When an environment is asked to be @@ -851,14 +870,15 @@ %distorting its original behavior, is not possible in general. I have %chosen to support the most basic document structure commands as %provided by standard \LaTeX\ classes, like \pf{book} and -%\pf{article}. Other classes, like provided by the \pf{koma-script} -%bundle, might work, but there is no guarantee. +%\pf{article}. Extraction of commands from other classes, like +%provided by the \pf{koma-script} bundle, might work, but there is no +%guarantee. % %To be more precise: when requested, the macros |\@chapter| and %|\@sect| will be redefined. These commands are at the basis of all -%chapters and sections. When \pf{extract} redefines one of these -%commands, it first makes a backup, like |\XTR@chapter|. After that, -%it will redefine the original command to read its argument(s), +%chapter and section commands. When \pf{extract} redefines one of +%these commands, it first makes a backup, like |\XTR@chapter|. After +%that, it will redefine the original command to read its argument(s), %export them to the target file and execute the backup with the %proper arguments. % @@ -899,57 +919,64 @@ % \begin{macrocode} %<*extract> \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 % \end{macrocode} % \begin{macro}{\XTR@err} +% \marg{text}\\ % Error macro. % \begin{macrocode} \def\XTR@err#1{\PackageError{extract}{#1}\@ehc} % \end{macrocode} % \end{macro} % \begin{macro}{\XTR@namelet} +% \marg{cmd1}\marg{cmd2}\\ % Version of |\let| for two command sequence names. % \begin{macrocode} -\def\XTR@namelet#1#2{\expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname} +\def\XTR@namelet#1#2{% + \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname +} % \end{macrocode} % \end{macro} % Options section, powered by \pf{xkeyval}. % \DescribeOption{active} % Control extraction with one switch. % \begin{macrocode} -\DeclareOptionX[XTR]{active}{\XTR@activetrue} -% \end{macrocode} -% \DescribeOption{generate} -% Entry point for the target file name. -% \begin{macrocode} -\DeclareOptionX[XTR]{generate}{\lowercase{\def\XTR@file{#1}}} +\define@boolkey[XTR]{extract.sty}[XTR@]{active}[true]{} % \end{macrocode} -% \DescribeOption{no-header} +% \DescribeOption{header} % Do not create a header in the target file. % \begin{macrocode} -\DeclareOptionX[XTR]{no-header}[false]{\XKV@setbool{XTR@header}{#1}} +\define@boolkey[XTR]{extract.sty}[XTR@]{header}[true]{} % \end{macrocode} -% \DescribeOption{document-handles} +% \DescribeOption{handles} % Extract |\begin{document}| and |\end{document}| or not. % \begin{macrocode} -\DeclareOptionX[XTR]{document-handles}[true]{\XKV@setbool{XTR@handles}{#1}} +\define@boolkey[XTR]{extract.sty}[XTR@]{handles}[true]{} +% \end{macrocode} +% \DescribeOption{copydocumentclass} +% Copy the |\documentclass| command to the target file. +% \begin{macrocode} +\define@boolkey[XTR]{extract.sty}[XTR@]{copydocumentclass}[true]{} +% \end{macrocode} +% \DescribeOption{generate} +% Entry point for the target file name. +% \begin{macrocode} +\DeclareOptionX[XTR]{generate}{\lowercase{\def\XTR@file{#1}}} % \end{macrocode} % \DescribeOption{extract-env} % Environments that should be extracted. % \begin{macrocode} \DeclareOptionX[XTR]{extract-env}{% \def\XTR@envs{#1}% - \@for\XTR@tempa:=\XTR@envs\do\XTR@tempb + \XKV@for@n{#1}\XTR@tempa\XTR@tempb } % \end{macrocode} % \DescribeOption{extract-cmd} @@ -957,7 +984,7 @@ % \begin{macrocode} \DeclareOptionX[XTR]{extract-cmd}{% \def\XTR@cmdsargs{#1}% - \@for\XTR@tempa:=\XTR@cmdsargs\do\XTR@tempb + \XKV@for@n{#1}\XTR@tempa\XTR@tempb } % \end{macrocode} % \DescribeOption{extract-cmdline} @@ -965,7 +992,7 @@ % \begin{macrocode} \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{% % \end{macrocode} @@ -1005,6 +1032,10 @@ % \begin{macrocode} \DeclareOptionX*{\XTR@err{Unknown option `\CurrentOption'}} % \end{macrocode} +% Initialize options. +% \begin{macrocode} +\ExecuteOptionsX[XTR]{header=true,handles=true,copydocumentclass=true} +% \end{macrocode} % Process options. % \begin{macrocode} \ProcessOptionsX[XTR] @@ -1036,7 +1067,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 @@ -1052,6 +1085,7 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\begin} +% \marg{environment}\\ % 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}. @@ -1076,6 +1110,7 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\end} +% \marg{environment}\\ % Modify |\end| to execute the code collected in the hook. % \begin{macrocode} \def\end#1{% @@ -1113,7 +1148,10 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\XTR@checkxtr} -% Checks whether a certain environment or command should be extracted. +% \marg{type}\marg{item}\\ +% Checks whether a certain environment or command should be extracted or skipped. +% \meta{type} is the type of check: for extraction or for skipping +% content. \meta{item} is the name of a command or an environment. % \begin{macrocode} \def\XTR@checkxtr#1#2{% \@nameuse{XTR@#1false}% @@ -1141,7 +1179,8 @@ % If the current label is in the list for extraction, extract it. % \begin{macrocode} \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 }% @@ -1164,15 +1203,18 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\XTR@ch@ckxtr} -% Parse the list and compare each item with the counter in |#2|. +% \meta{list}\meta{counter}\\ +% Parse the \meta{list} of numbers and compare each item with the +%\meta{counter} holding the number of the current item. % \begin{macrocode} \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}% } % \end{macrocode} % \end{macro} % \begin{macro}{\XTR@ch@ck@tr} -% Parse an element of the list. Basically, decide whether we have |x| +% \meta{x}|-|\meta{y}|-|\meta{z}|\@nil|\meta{counter}\\ +% Parse an element of the list. Basically, decide whether we have |x|, % |x-y|, |x-| or |-y| and act accordingly. % \begin{macrocode} \def\XTR@ch@ck@tr#1-#2-#3\@nil#4{% @@ -1193,7 +1235,7 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\extractionlabel} -% \changes{v1.3}{2005/01/12}{Was \ci{extractlabel}} +% \changes{v1.3}{2005/01/12}{Was \cs{extractlabel}} % \begin{macro}{\XTR@currentlabel} % |\extractionlabel| saves its argument (after removing redundant spaces). % This label will be used for conditional extraction. |\XTR@currentlabel| @@ -1230,6 +1272,7 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\XTR@@xtract} +% \oarg{label}\\ % Process the optional label, define line processing and start reading % verbatim. Do not extract when the package is not active. Use a % temporary file to extract the body to in case this needs to be @@ -1267,15 +1310,18 @@ \def\XTR@processline@begin{% % \end{macrocode} % Initialize |\@temptokena| (used for temp file) and |\verbatim@line| -% (used for output file). +% (used for output file). Save the original content of |\verbatim@line| +% for later use. % \begin{macrocode} \@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 } % \end{macrocode} % \end{macro} % \begin{macro}{\XTR@testbegin} +% \meta{text1}|\begin{extractskip}|\meta{text2}|\@nil|\\ % Checks whether |\begin{extractskip}| occurs. % \begin{macrocode} \def\XTR@testbegin#1!begin(extractskip)#2\@nil{% @@ -1283,7 +1329,7 @@ \verbatim@line\expandafter{\the\verbatim@line#1}% \def\XTR@tempa{#2}% % \end{macrocode} -% If |#2| empty, there is no |\begin{extractskip}|. Just write the +% If \meta{text2} empty, there is no |\begin{extractskip}|. Just write the % content to file. % \begin{macrocode} \ifx\XTR@tempa\@empty\XTR@processline@write\else\XKV@afterfi @@ -1312,7 +1358,8 @@ } % \end{macrocode} % \end{macro} -% \begin{macro}{\XKV@skiplabel} +% \begin{macro}{\XTR@skiplabel} +% \meta{text1}\oarg{label}\meta{text2}|\@nil|\\ % This macro checks whether a label is present and sets |\XTR@currentlabel| % if necessary. % \begin{macrocode} @@ -1333,30 +1380,36 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\XTR@sk@plabel} +% \meta{text}|[]\@nil|\\ % Remove extra brackets from input. % \begin{macrocode} \def\XTR@sk@plabel#1[]\@nil{\def\XTR@tempa{#1}} % \end{macrocode} % \end{macro} % \begin{macro}{\XTR@t@stbegin} +% \meta{text}|\begin{extractskip}\@nil|\\ % Remove the extra |\begin{extractskip}| and start scanning for % |\end{extractskip}| in the current line. % \begin{macrocode} -\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 +} % \end{macrocode} % \end{macro} % \begin{macro}{\XTR@processline@end} % Starts scanning for |\end{extractskip}| in case this was not on one -% line with |\begin{extractskip}|. +% line together with |\begin{extractskip}|. Comparable to |\XTR@processline@begin|. % \begin{macrocode} \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 } % \end{macrocode} % \end{macro} % \begin{macro}{\XTR@testend} +% \meta{text1}|\end{extractskip}|\meta{text2}|\@nil|\\ % Check whether |\end{extractskip}| occurs in the line. % \begin{macrocode} \def\XTR@testend#1!end(extractskip)#2\@nil{% @@ -1380,23 +1433,32 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\XTR@t@stend} +% \meta{text}|\end{extractskip}\@nil|\\ % Remove the redundant |\end{extractskip}| and continue scanning for -% |\begin{extractskip}| in this line. +% for the string |\begin{extractskip}| in this line. % \begin{macrocode} -\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 +}} % \end{macrocode} % \end{macro} % \begin{macro}{\XTR@processline@write} -% Writes the material to the appropriate file. +% \changes{v1.8}{2005/05/07}{Solved bug of not copying empty lines to the target file} +% Writes the material to the appropriate file. If one of the tokens +% has become empty, it might be because the line was empty originally +% or because the parsing and removal of |\begin{extractskip}| and +% |\end{extractskip}| made it empty. In the latter case, do not write +% the empty line. In the former case, do write it. % \begin{macrocode} \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 +} % \end{macrocode} % \end{macro} % \begin{macro}{\endextract} @@ -1433,7 +1495,8 @@ % First we check for an optional star. % \begin{macrocode} \def\extractline{% - \XKV@ifstar{\XTR@sttrue\XTR@extractline}{\XTR@stfalse\XTR@extractline}% + \XKV@ifstar{\XTR@sttrue\XTR@extractline}% + {\XTR@stfalse\XTR@extractline}% } % \end{macrocode} % \end{macro} @@ -1454,6 +1517,7 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\XTR@@xtractline} +% \oarg{label}\meta{text}\meta{eol}\\ % The workhorse that reads input until the end of the line. Use the % |\lowercase| trick for the definition. % \begin{macrocode} @@ -1504,26 +1568,29 @@ % Write header to the target file. % \begin{macrocode} \ifXTR@header +% \end{macrocode} +% Compute the time. +% \begin{macrocode} + \@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 % \end{macrocode} % Save the \% character. % \begin{macrocode} \catcode`\%=12 \gdef\XTR@tempa{%%\space} -% \end{macrocode} -% Compute the time. -% \begin{macrocode} - \@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 % \end{macrocode} % Write all information to the target file. @@ -1531,16 +1598,38 @@ \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 % \end{macrocode} +% If requested, reconstruct the |\documentclass| command using +% information from \pf{xkeyval}. +% \begin{macrocode} +\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 +% \end{macrocode} % Perform redefinitions at the beginning of the document. % \begin{macrocode} \AtBeginDocument{% @@ -1552,12 +1641,14 @@ % Redefine environments. % \begin{macrocode} \XKV@ifundefined{XTR@envs}{}{% - \@for\XTR@tempa:=\XTR@envs\do{% + \XKV@for@o\XTR@envs\XTR@tempa{% % \end{macrocode} % Check whether the environment is defined. % \begin{macrocode} \XKV@ifundefined\XTR@tempa{% - \XTR@err{environment `\XTR@tempa' not defined; extraction canceled}% + \XTR@err{% + environment `\XTR@tempa' not defined; extraction canceled% + }% }{% % \end{macrocode} % Backup the beginning of the environment. @@ -1597,8 +1688,12 @@ % \end{macrocode} % Write the content to the files. % \begin{macrocode} - \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 + }% }% % \end{macrocode} % \end{macro} @@ -1660,14 +1755,17 @@ % is reused at several places inside other macros, taking none-character % input in its argument. % \begin{macrocode} - \@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% + }% }{% % \end{macrocode} % Check whether allowed or not. % \begin{macrocode} - \@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{% @@ -1719,7 +1817,8 @@ }% \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 }% }% @@ -1729,19 +1828,23 @@ % Redefine a list of commands to write themselves and the text on the % same line to the target file. This works similar to |\extractline|. % \begin{macrocode} - \@for\XTR@tempa:=\XTR@cmdsline\do{% + \XKV@for@o\XTR@cmdsline\XTR@tempa{% \XKV@ifundefined\XTR@tempa{% % \end{macrocode} % Check whether the command is defined. % \begin{macrocode} - \XTR@err{command `\@backslashchar\XTR@tempa' not defined; extraction canceled}% + \XTR@err{command `\@backslashchar\XTR@tempa' not defined; + extraction canceled}% }{% % \end{macrocode} % Check whether allowed or not. % \begin{macrocode} - \@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 % \end{macrocode} % Backup the command. @@ -1769,6 +1872,7 @@ % \end{macrocode} % \begin{macro}{\XTR@extractcmdline} % \changes{v1.4}{2005/02/06}{Changed temp macro to token register} +% \meta{text}\meta{eol}\\ % Workhorse for the command line extraction method. This macros reads % until the next end of line and saves the content in |\XTR@tempb|. % \begin{macrocode} @@ -1785,9 +1889,13 @@ % \begin{macrocode} \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}% @@ -1816,6 +1924,7 @@ \usepackage[ active, generate=file, + copydocumentclass=false, extract-env=equation ]{extract} \begin{extract} @@ -1843,10 +1952,9 @@ Some text. extract-cmd=section, extract-cmdline=label ]{extract} +\begin{extract*} \newtheorem{exercise}{Exercise} -\begin{extract} -\documentclass{article} -\end{extract} +\end{extract*} \begin{document} \section{Theory} \label{sec:1} @@ -1869,9 +1977,6 @@ Some text. figure-nrs={1,3}, figure-labels={fig-a,fig-b} ]{extract} -\begin{extract} -\documentclass{article} -\end{extract} \begin{document} Some text. \begin{figure} @@ -1902,9 +2007,6 @@ Figure 4. generate=file, extract-env=equation* ]{extract} -\begin{extract} -\documentclass{article} -\end{extract} \begin{extract*} \usepackage{amsmath} \end{extract*} @@ -1913,7 +2015,10 @@ Some text. \begin{equation*} x^2+y^2=z^2 \end{equation*} -Some text. +\begin{extract} +$x=3$, $y=4$ and $z=5$ +satisfy this equation. +\end{extract} \end{document} %</xtrex4> % @@ -1922,6 +2027,7 @@ Some text. \usepackage[ active, generate=file, + copydocumentclass=false, extract-labels=type-a, line-labels={type-a,type-c}, line-nrs=3 @@ -1950,9 +2056,6 @@ Some text. generate=file, extract-env=figure ]{extract} -\begin{extract} -\documentclass{article} -\end{extract} \begin{document} \begin{figure}[!h] \begin{extractskip} @@ -1983,9 +2086,6 @@ c\end{extractskip}d generate=file, extractskip-labels=skipb ]{extract} -\begin{extract} -\documentclass{article} -\end{extract} \begin{document} \begin{extract*} \begin{itemize} @@ -2007,6 +2107,7 @@ c\end{extractskip}d \usepackage{url} \usepackage{extract} \usepackage{xcolor} +\usepackage{fourier} \usepackage{varioref} \def\reftextafter{on page~\thevpagerefnum} \def\reftextbefore{on page~\thevpagerefnum} @@ -2014,7 +2115,7 @@ c\end{extractskip}d \def\reftextfacebefore{on page~\thevpagerefnum} \usepackage{listings} \lstnewenvironment{command}{% - \lstset{columns=flexible,frame=single,backgroundcolor=\color{yellow},% + \lstset{columns=flexible,frame=single,backgroundcolor=\color{blue!20},% xleftmargin=\fboxsep,xrightmargin=\fboxsep,escapeinside=`',gobble=1}}{} \lstnewenvironment{example}{% \lstset{basicstyle=\footnotesize\ttfamily,columns=flexible,frame=single,% @@ -2046,6 +2147,18 @@ c\end{extractskip}d }% \@tempa\endgroup\@esphack } +\def\DescribeMacros{\leavevmode\@bsphack + \begingroup\MakePrivateLetters\Describe@Macros} +\def\Describe@Macros#1{\endgroup\strut + \marginpar{\raggedleft + \def\@tempa{#1}\count@\z@ + \@for\@tempa:=\@tempa\do{% + \ifnum\count@>\z@\\\fi\advance\count@\@ne + \MacroFont\expandafter\string\@tempa + \expandafter\SpecialUsageIndex\expandafter{\@tempa}% + }}% + \@esphack\ignorespaces +} \def\DescribeOption#1{\leavevmode\@bsphack \marginpar{\raggedleft\PrintDescribeOption{#1}}% \SpecialOptionIndex{#1}\@esphack\ignorespaces} @@ -2081,18 +2194,26 @@ c\end{extractskip}d \@for\@tempa:=#1\do{% \\\strut\MacroFont\@tempa\SpecialEnvIndex\@tempa }}\@esphack\ignorespaces} +\renewenvironment{theglossary}{% + \glossary@prologue + \GlossaryParms \let\item\@idxitem \ignorespaces + }{}% \makeatother \def\PrintChangesX{% \begingroup - \let\efill\relax - \setlength{\columnsep}{18pt}% - \setlength{\columnseprule}{.4pt}% - \PrintChanges + \let\efill\relax + \PrintChanges + \endgroup +} +\def\PrintIndexX{% + \begingroup + \setcounter{IndexColumns}{2} + \setlength{\columnsep}{18pt}% + \setlength{\columnseprule}{.4pt}% + \PrintIndex \endgroup } \def\pf#1{\textsf{#1}} -\def\bs{\symbol{'134}} -\def\ci#1{\texttt{\bs#1}} \def\descriptionlabel{\hspace\labelsep\normalfont} \EnableCrossrefs \RecordChanges @@ -2111,9 +2232,8 @@ c\end{extractskip}d @MISC{xkeyval, author = {Hendri Adriaens}, - title = {\pf{xkeyval} package, 2.1}, - howpublished = {\url{CTAN:/macros/latex/contrib/xkeyval}}, - year = {2005/02/08} + title = {\pf{xkeyval} package}, + howpublished = {\url{CTAN:/macros/latex/contrib/xkeyval}} } @MISC{verbatim, 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}% diff --git a/Master/texmf-dist/tpm/extract.tpm b/Master/texmf-dist/tpm/extract.tpm index 1690533221f..fe6134ed3b9 100644 --- a/Master/texmf-dist/tpm/extract.tpm +++ b/Master/texmf-dist/tpm/extract.tpm @@ -3,7 +3,7 @@ <rdf:Description about="http://texlive.dante.de/texlive/Package/extract.zip"> <TPM:Name>extract</TPM:Name> <TPM:Type>Package</TPM:Type> - <TPM:Date>2006/01/11 23:53:09</TPM:Date> + <TPM:Date>2005/05/07 12:39:04</TPM:Date> <TPM:Version>1.0</TPM:Version> <TPM:Creator>rahtz</TPM:Creator> <TPM:Title> @@ -32,15 +32,15 @@ slides from a presentation and use them in a new file. <TPM:Author>unknown</TPM:Author> <TPM:Size>283041</TPM:Size> <TPM:Build/> - <TPM:RunFiles size="17047"> + <TPM:RunFiles size="17802"> texmf-dist/tex/latex/extract/extract.sty texmf-dist/tpm/extract.tpm </TPM:RunFiles> - <TPM:DocFiles size="195683"> + <TPM:DocFiles size="204380"> texmf-dist/doc/latex/extract/README texmf-dist/doc/latex/extract/extract.pdf </TPM:DocFiles> - <TPM:SourceFiles size="70311">texmf-dist/source/latex/extract/extract.dtx</TPM:SourceFiles> + <TPM:SourceFiles size="74829">texmf-dist/source/latex/extract/extract.dtx</TPM:SourceFiles> <TPM:Provides>Package/extract</TPM:Provides> </rdf:Description> </rdf:RDF> |