diff options
author | Karl Berry <karl@freefriends.org> | 2009-12-11 01:07:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-12-11 01:07:09 +0000 |
commit | c6ddbfa56ffeb39f08fef67b1f9fc97778cd70bd (patch) | |
tree | c3312443c40388c8eeb3f515454f9a2e666c15de /Master/texmf-dist/source/latex/oberdiek/atveryend.dtx | |
parent | 01aade3322bbb50b565fbb94ed1bade7a0726478 (diff) |
oberdiek update (10dec09)
git-svn-id: svn://tug.org/texlive/trunk@16352 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/atveryend.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/oberdiek/atveryend.dtx | 1170 |
1 files changed, 1170 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/atveryend.dtx b/Master/texmf-dist/source/latex/oberdiek/atveryend.dtx new file mode 100644 index 00000000000..a08a5bd6e10 --- /dev/null +++ b/Master/texmf-dist/source/latex/oberdiek/atveryend.dtx @@ -0,0 +1,1170 @@ +% \iffalse meta-comment +% +% Copyright (C) 2009 by Heiko Oberdiek <oberdiek@uni-freiburg.de> +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% This Current Maintainer of this work is Heiko Oberdiek. +% +% This work consists of the main source file atveryend.dtx +% and the derived files +% atveryend.sty, atveryend.pdf, atveryend.ins, atveryend.drv, +% atveryend-test1.tex. +% +% Distribution: +% CTAN:macros/latex/contrib/oberdiek/atveryend.dtx +% CTAN:macros/latex/contrib/oberdiek/atveryend.pdf +% +% Unpacking: +% (a) If atveryend.ins is present: +% tex atveryend.ins +% (b) Without atveryend.ins: +% tex atveryend.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{atveryend.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (a) If atveryend.drv is present: +% latex atveryend.drv +% (b) Without atveryend.drv: +% latex atveryend.dtx; ... +% The class ltxdoc loads the configuration file ltxdoc.cfg +% if available. Here you can specify further options, e.g. +% use A4 as paper format: +% \PassOptionsToClass{a4paper}{article} +% +% Programm calls to get the documentation (example): +% pdflatex atveryend.dtx +% makeindex -s gind.ist atveryend.idx +% pdflatex atveryend.dtx +% makeindex -s gind.ist atveryend.idx +% pdflatex atveryend.dtx +% +% Installation: +% TDS:tex/generic/oberdiek/atveryend.sty +% TDS:doc/latex/oberdiek/atveryend.pdf +% TDS:doc/latex/oberdiek/test/atveryend-test1.tex +% TDS:source/latex/oberdiek/atveryend.dtx +% +%<*ignore> +\begingroup + \def\x{LaTeX2e}% +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +%</ignore> +%<*install> +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: atveryend 2009/12/09 v1.2 Hooks at very end of document (HO)} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\let\MetaPrefix\relax +\preamble + +This is a generated file. + +Copyright (C) 2009 by Heiko Oberdiek <oberdiek@uni-freiburg.de> + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of +LaTeX version 2005/12/01 or later. + +This work has the LPPL maintenance status "maintained". + +This Current Maintainer of this work is Heiko Oberdiek. + +This work consists of the main source file atveryend.dtx +and the derived files + atveryend.sty, atveryend.pdf, atveryend.ins, atveryend.drv, + atveryend-test1.tex. + +\endpreamble +\let\MetaPrefix\DoubleperCent + +\generate{% + \file{atveryend.ins}{\from{atveryend.dtx}{install}}% + \file{atveryend.drv}{\from{atveryend.dtx}{driver}}% + \usedir{tex/generic/oberdiek}% + \file{atveryend.sty}{\from{atveryend.dtx}{package}}% + \usedir{doc/latex/oberdiek/test}% + \file{atveryend-test1.tex}{\from{atveryend.dtx}{test1}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* atveryend.sty} +\Msg{*} +\Msg{* And install the following script file:} +\Msg{*} +\Msg{* } +\Msg{*} +\Msg{* To produce the documentation run the file `atveryend.drv'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +%</install> +%<*ignore> +\fi +%</ignore> +%<*driver> +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{atveryend.drv}% + [2009/12/09 v1.2 Hooks at very end of document (HO)]% +\documentclass{ltxdoc} +\usepackage{holtxdoc}[2008/08/11] +\begin{document} + \DocInput{atveryend.dtx}% +\end{document} +%</driver> +% \fi +% +% \CheckSum{791} +% +% \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 +% Lower-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 +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% \GetFileInfo{atveryend.drv} +% +% \title{The \xpackage{atveryend} package} +% \date{2009/12/09 v1.2} +% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} +% +% \maketitle +% +% \begin{abstract} +% This \LaTeX\ package provides two hooks for \verb|\end{document}| +% that are executed after the hook of \cs{AtEndDocument}. +% \cs{AfterLastShipout} can be used for code that is to be executed +% right after the last \cs{clearpage} before the \xext{.aux} file +% is closed. \cs{AtVeryEndDocument} is used for code after closing +% and final reading of the \xext{.aux} file. +% \end{abstract} +% +% \tableofcontents +% +% \section{Documentation} +% +% There are packages (e.g. \xpackage{hyperref} \cite{hyperref}, +% \xpackage{lastpage} \cite{lastpage}) +% that want to call code after the typesetting is done, for example +% to remember the last page number. \LaTeX\ provides the hook +% \cs{AtEndDocument} (\xpackage{clsguide} \cite{clsguide}). +% There are packages that use this hook to do their job for +% typesetting pages (e.g. \xpackage{endfloat} emits the floats here +% \cite{endfloat}). +% Also a user might provide additional code in \cs{AtEndDocument}. +% Therefore packages have to call \clearpage in \cs{AtEndDocument} +% to get after the last shipout page. But this is not too reliable, +% because the right timing is important between packages that want +% or have to do things before the last page is output and packages +% that only work properly if they can reach the point after the +% last shipout. +% +% Therefore the task of this package is to provide two hooks +% that are called after the last page is shipped out: +% \begin{declcs}{AfterLastShipout} \M{code} +% \end{declcs} +% The code is called after the final \cs{clearpage} of \cs{enddocument} +% before the main \xext{.aux} file is closed. This is the right place +% to remember the last page in the \xext{.aux} file, for instance. +% +% \begin{declcs}{AtVeryEndDocument} \M{code} +% \end{declcs} +% The code is called after the \xext{.aux} file is closed and read in again. +% It is the place for final checks, rerun hints, final messages. +% +% \subsection{Related work} +% +% \begin{description} +% \item[Package \xpackage{scrfile}:] +% Markus Kohm has written package \xpackage{scrlfile} +% (part of KOMA-Script \cite{koma}) +% that provides +% hooks \cs{BeforeClosingMainAux} and after \cs{AfterReadingMainAux}. +% They have the same function as the hooks of this package. In fact +% this package uses them, if they are available. +% \item[Class \xclass{revtex4-1}:] +% This class calls \cs{clear@document} in \cs{enddocument} +% that wraps the final call of \cs{clearpage}. +% Thus it can be used as hook to call stuff after that \cs{clearpage}. +% This is also done by this package. +% \item[Package \xpackage{etoolbox}:] +% It provides \cs{AfterEndDocument}, a hook right before +% \cs{deadcycles} or \cs{@@end} \cite{etoolbox}. +% \end{description} +% This package tries to combine as many approaches as possible: +% \begin{itemize} +% \item It looks for a known \cs{enddocument} and redefines it. +% \item Hooks that are provided by others are used (package +% \xpackage{scrlfile} or class \xclass{revtex4-1}. +% \item It redefines \cs{@checkend} and \cs{@dofilelist} to insert +% the hooks similar to package{scrlfile}. +% \item The hook execution is wrapped in a macro that +% is redefined by its first call to prevent calling the hook +% more than once. +% \end{itemize} +% +% \StopEventually{ +% } +% +% \section{Implementation} +% \begin{macrocode} +%<*package> +% \end{macrocode} +% Reload check, especially if the package is not used with \LaTeX. +% \begin{macrocode} +\begingroup + \catcode44 12 % , + \catcode45 12 % - + \catcode46 12 % . + \catcode58 12 % : + \catcode64 11 % @ + \catcode123 1 % { + \catcode125 2 % } + \expandafter\let\expandafter\x\csname ver@atveryend.sty\endcsname + \ifx\x\relax % plain-TeX, first loading + \else + \def\empty{}% + \ifx\x\empty % LaTeX, first loading, + % variable is initialized, but \ProvidesPackage not yet seen + \else + \catcode35 6 % # + \expandafter\ifx\csname PackageInfo\endcsname\relax + \def\x#1#2{% + \immediate\write-1{Package #1 Info: #2.}% + }% + \else + \def\x#1#2{\PackageInfo{#1}{#2, stopped}}% + \fi + \x{atveryend}{The package is already loaded}% + \aftergroup\endinput + \fi + \fi +\endgroup +% \end{macrocode} +% Package identification: +% \begin{macrocode} +\begingroup + \catcode35 6 % # + \catcode40 12 % ( + \catcode41 12 % ) + \catcode44 12 % , + \catcode45 12 % - + \catcode46 12 % . + \catcode47 12 % / + \catcode58 12 % : + \catcode64 11 % @ + \catcode91 12 % [ + \catcode93 12 % ] + \catcode123 1 % { + \catcode125 2 % } + \expandafter\ifx\csname ProvidesPackage\endcsname\relax + \def\x#1#2#3[#4]{\endgroup + \immediate\write-1{Package: #3 #4}% + \xdef#1{#4}% + }% + \else + \def\x#1#2[#3]{\endgroup + #2[{#3}]% + \ifx#1\@undefined + \xdef#1{#3}% + \fi + \ifx#1\relax + \xdef#1{#3}% + \fi + }% + \fi +\expandafter\x\csname ver@atveryend.sty\endcsname +\ProvidesPackage{atveryend}% + [2009/12/09 v1.2 Hooks at very end of document (HO)] +% \end{macrocode} +% +% \begin{macrocode} +\begingroup + \catcode123 1 % { + \catcode125 2 % } + \def\x{\endgroup + \expandafter\edef\csname AtVeryEnd@AtEnd\endcsname{% + \catcode35 \the\catcode35\relax + \catcode64 \the\catcode64\relax + \catcode123 \the\catcode123\relax + \catcode125 \the\catcode125\relax + }% + }% +\x +\catcode35 6 % # +\catcode64 11 % @ +\catcode123 1 % { +\catcode125 2 % } +\def\TMP@EnsureCode#1#2{% + \edef\AtVeryEnd@AtEnd{% + \AtVeryEnd@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +} +\TMP@EnsureCode{9}{10}% (tab) +\TMP@EnsureCode{39}{12}% ' +\TMP@EnsureCode{40}{12}% ( +\TMP@EnsureCode{41}{12}% ) +\TMP@EnsureCode{42}{12}% * +\TMP@EnsureCode{45}{12}% - +\TMP@EnsureCode{46}{12}% . +\TMP@EnsureCode{47}{12}% / +\TMP@EnsureCode{61}{12}% = +\TMP@EnsureCode{62}{12}% > +\TMP@EnsureCode{96}{12}% ` +% \end{macrocode} +% +% \subsection{Hooks} +% +% \begin{macro}{\AtVeryEnd@AfterLastShipoutHook} +% \begin{macrocode} +\let\AtVeryEnd@AfterLastShipoutHook\@empty +% \end{macrocode} +% \end{macro} +% \begin{macro}{\AtVeryEnd@AtVeryEndDocumentHook} +% \begin{macrocode} +\let\AtVeryEnd@AtVeryEndDocumentHook\@empty +% \end{macrocode} +% \end{macro} +% \begin{macro}{\AfterLastShipout} +% \begin{macrocode} +\newcommand*{\AfterLastShipout}{% + \g@addto@macro\AtVeryEnd@AfterLastShipoutHook +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\AtVeryEndDocument} +% \begin{macrocode} +\newcommand*{\AtVeryEndDocument}{% + \g@addto@macro\AtVeryEnd@AtVeryEndDocumentHook +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Call@AfterLastShipout} +% \begin{macrocode} +\newcommand*{\Call@AfterLastShipout}{% + \let\AfterLastShipout\@firstofone + \ifx\AtVeryEnd@AfterLastShipoutHook\@empty + \PackageInfo{atveryend}{Empty hook `AfterLastShipout'}% + \else + \PackageInfo{atveryend}{Executing hook `AfterLastShipout'}% + \AtVeryEnd@AfterLastShipoutHook + \fi + \global\let\AtVeryEnd@AfterLastShipoutHook\@undefined + \global\let\Call@AfterLastShipout\relax +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Call@AtVeryEndDocument} +% \begin{macrocode} +\newcommand*{\Call@AtVeryEndDocument}{% + \let\AtVeryEndDocument\@firstofone + \ifx\AtVeryEnd@AtVeryEndDocumentHook\@empty + \PackageInfo{atveryend}{Empty hook `AtVeryEndDocument'}% + \else + \PackageInfo{atveryend}{Executing hook `AtVeryEndDocument'}% + \AtVeryEnd@AtVeryEndDocumentHook + \fi + \global\let\AtVeryEnd@AtVeryEndDocumentHook\@undefined + \global\let\Call@AtVeryEndDocument\relax +} +% \end{macrocode} +% \end{macro} +% +% \subsection{Redefining \cs{enddocument}} +% +% This approach looks for known versions of \cs{enddocument} +% and redefines it. Class \xclass{seminar} +% and package \xpackage{slidesec} are not checked, because +% there would be too much combinations to check. +% +% \subsubsection{\LaTeX\ kernel} +% +% \begin{macro}{\AtVeryEnd@test@standard} +% \begin{macrocode} +\def\AtVeryEnd@test@standard{% + \let\AtEndDocument\@firstofone + \@enddocumenthook + \@checkend{document}% + \clearpage + \begingroup + \if@filesw + \immediate\closeout\@mainaux + \let\@setckpt\@gobbletwo + \let\@newl@bel\@testdef + \@tempswafalse + \makeatletter + \input\jobname.aux % + \fi + \@dofilelist + \ifdim \font@submax >\fontsubfuzz\relax + \@font@warning{Size substitutions with differences\MessageBreak + up to \font@submax\space have occurred.\@gobbletwo}% + \fi + \@defaultsubs + \@refundefined + \if@filesw + \ifx \@multiplelabels \relax + \if@tempswa + \@latex@warning@no@line{Label(s) may have changed. % + Rerun to get cross-references right}% + \fi + \else + \@multiplelabels + \fi + \fi + \endgroup + \deadcycles\z@ + \@@end +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\AtVeryEnd@enddocument@standard} +% \begin{macrocode} +\def\AtVeryEnd@enddocument@standard{% + \let\AtEndDocument\@firstofone + \@enddocumenthook + \@checkend{document}% + \clearpage + \Call@AfterLastShipout + \begingroup + \if@filesw + \immediate\closeout\@mainaux + \let\@setckpt\@gobbletwo + \let\@newl@bel\@testdef + \@tempswafalse + \makeatletter + \input\jobname.aux % + \fi + \Call@AtVeryEndDocument + \@dofilelist + \ifdim \font@submax >\fontsubfuzz\relax + \@font@warning{Size substitutions with differences\MessageBreak + up to \font@submax\space have occurred.\@gobbletwo}% + \fi + \@defaultsubs + \@refundefined + \if@filesw + \ifx \@multiplelabels \relax + \if@tempswa + \@latex@warning@no@line{Label(s) may have changed. % + Rerun to get cross-references right}% + \fi + \else + \@multiplelabels + \fi + \fi + \endgroup + \deadcycles\z@ + \@@end +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Package \xpackage{booklet}, file \xpackage{2up.tex}} +% +% \begin{macro}{\AtVeryEnd@test@booklet} +% \begin{macrocode} +\expandafter\def\expandafter\AtVeryEnd@test@booklet\expandafter{% + \expandafter\twoupclearpage + \AtVeryEnd@test@standard +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\AtVeryEnd@enddocument@booklet} +% \begin{macrocode} +\expandafter\def\expandafter\AtVeryEnd@enddocument@booklet\expandafter{% + \expandafter\twoclearpage + \AtVeryEnd@enddocument@standard +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Class \xclass{dinbrief}} +% +% \begin{macro}{\AtVeryEnd@test@dinbrief} +% \begin{macrocode} +\def\AtVeryEnd@test@dinbrief{% + \@checkend{document} % + \newpage + \begingroup + \if@filesw + \ifnum\c@labelgen>0 % + \immediate\closeout\@mainlbl + \makeatletter + \input \jobname@lbl\relax + \clearpage + \fi + \immediate\closeout\@mainaux + \fi + \endgroup + \deadcycles\z@ + \@@end +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\AtVeryEnd@enddocument@dinbrief} +% \begin{macrocode} +\def\AtVeryEnd@enddocument@dinbrief{% + \@checkend{document}% + \newpage + \Call@AfterLastShipout + \begingroup + \if@filesw + \ifnum\c@labelgen>\z@ + \immediate\closeout\@mainlbl + \makeatletter + \input \jobname@lbl\relax + \clearpage + \fi + \immediate\closeout\@mainaux + \fi + \Call@AtVeryEndDocument + \endgroup + \deadcycles\z@ + \@@end +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Class \xclass{combine}} +% +% \begin{macro}{\AtVeryEnd@test@combine} +% \begin{macrocode} +\def\AtVeryEnd@test@combine{% + \@enddocumenthook + \@checkend{document}% + \clearpage + \begingroup + \if@filesw + \immediate\closeout\@mainaux + \immediate\closeout\@partaux + \let\@setckpt\@gobbletwo + \let\@newl@bel\@testdef + \@tempswafalse + \makeatletter \input\c@lmainauxfile %% change here + \fi + \c@lenddoca %% a replacement + \@refundefined + \endgroup + \deadcycles\z@ + \@@end +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\AtVeryEnd@enddocument@combine} +% \begin{macrocode} +\def\AtVeryEnd@enddocument@combine{% + \@enddocumenthook + \@checkend{document}% + \clearpage + \Call@AfterLastShipout + \begingroup + \if@filesw + \immediate\closeout\@mainaux + \immediate\closeout\@partaux + \let\@setckpt\@gobbletwo + \let\@newl@bel\@testdef + \@tempswafalse + \makeatletter \input\c@lmainauxfile %% change here + \fi + \Call@AtVeryEndDocument + \c@lenddoca %% a replacement + \@refundefined + \endgroup + \deadcycles\z@ + \@@end +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Class \xpackage{jpsj2}} +% +% \begin{macro}{\AtVeryEnd@test@jpsj} +% \begin{macrocode} +\def\AtVeryEnd@test@jpsj{% + \if@lastpagebalancing + \global\let\@outputdblcol=\balancing@outputdblcol + \fi + \@checkend{document}% + \clearpage + \begingroup + \if@filesw + \immediate\closeout\@mainaux + \def\global\@namedef##1##2{}% + \def\newlabel{\@testdef r}% + \def\bibcite{\@testdef b}% + \@tempswafalse + \makeatletter + \input \jobname.aux % + \if@tempswa + \@warning{% + Label(s) may have changed. % + Rerun to get cross-references right% + }% + \fi + \fi + \endgroup + \deadcycles\z@ + \@@end +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\AtVeryEnd@enddocument@jpsj} +% \begin{macrocode} +\def\AtVeryEnd@enddocument@jpsj{% + \if@lastpagebalancing + \global\let\@outputdblcol=\balancing@outputdblcol + \fi + \@checkend{document}% + \clearpage + \Call@AfterLastShipout + \begingroup + \if@filesw + \immediate\closeout\@mainaux + \def\global\@namedef##1##2{}% + \def\newlabel{\@testdef r}% + \def\bibcite{\@testdef b}% + \@tempswafalse + \makeatletter + \input \jobname.aux % + \if@tempswa + \@warning{% + Label(s) may have changed. % + Rerun to get cross-references right% + }% + \fi + \fi + \Call@AtVeryEndDocument + \endgroup + \deadcycles\z@ + \@@end +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Testing and redefining} +% +% \begin{macro}{\AtVeryEnd@Test} +% \begin{macrocode} +\def\AtVeryEnd@Test#1#2{% + \expandafter\ifx\csname AtVeryEnd@test@#2\endcsname#1% + \expandafter\let\expandafter#1% + \csname AtVeryEnd@enddocument@#2\endcsname + \begingroup + \let\on@line\@empty + \PackageInfo{atveryend}{% + \string#1 detected (#2)% + }% + \endgroup + \expandafter\AtVeryEnd@SkipToNil + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\AtVeryEnd@SkipToNil} +% \begin{macrocode} +\def\AtVeryEnd@SkipToNil#1\@nil{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\AtVeryEnd@RedefEndDocument} +% \begin{macrocode} +\def\AtVeryEnd@RedefEndDocument#1{% + \ifx#1\@undefined + \else + \AtVeryEnd@Test#1{standard}% + \AtVeryEnd@Test#1{booklet}% + \AtVeryEnd@Test#1{dinbrief}% + \AtVeryEnd@Test#1{combine}% + \AtVeryEnd@Test#1{jpsj}% + \AtVeryEnd@SkipToNil + \@nil + \fi +} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} +\AtVeryEnd@RedefEndDocument\enddocument +\AtVeryEnd@RedefEndDocument\AP@enddocument % afterpage.sty +\AtVeryEnd@RedefEndDocument\hyper@back@cite@enddocument % htx-bc.sty +\AtVeryEnd@RedefEndDocument\hyper@enddocument % hyper.sty +\AtVeryEnd@RedefEndDocument\hyper@fn@enddocument % hyper.sty +\AtVeryEnd@RedefEndDocument\cweb@save@enddocument % cweb.cls +\AtVeryEnd@RedefEndDocument\prev@enddocument % flushend.sty +\AtVeryEnd@RedefEndDocument\endorigdocument % gaceta.cls +\AtVeryEnd@RedefEndDocument\keependdoc % aguplus.sty +\AtVeryEnd@RedefEndDocument\EMenddocument % t-angles.sty +\AtVeryEnd@RedefEndDocument\docmute@enddocument % docmute.sty +\AtVeryEnd@RedefEndDocument\a@enddocument % alatex.sty +\AtVeryEnd@RedefEndDocument\enddocumentasusual % frenchle.sty +\AtVeryEnd@RedefEndDocument\old@enddocument % uwthesis.cls +% \end{macrocode} +% +% \subsection{Using hooks of other packages} +% +% \subsubsection{Package \xpackage{scrlfile}} +% +% \begin{macrocode} +\AtBeginDocument{% + \@ifpackageloaded{scrlfile}{% + \@ifundefined{BeforeClosingMainAux}{}{% + \BeforeClosingMainAux{\Call@AfterLastShipout}% + }% + \@ifundefined{AfterReadingMainAux}{}{% + \AfterReadingMainAux{\Call@AtVeryEndDocument}% + }% + }{}% +% \end{macrocode} +% +% \subsubsection{Package \xpackage{etoolbox}} +% +% \begin{macrocode} +\AtBeginDocument{% + \@ifpackageloaded{etoolbox}{% + \@ifundefined{AfterEndDocument}{}{% + \AfterEndDocument{\Call@AtVeryEndDocument}% + }% + }{}% +} +% \end{macrocode} +% +% \subsection{Hack into \cs{enddocument}} +% +% Class \xclass{revtex} provides ``hook'' \cs{clear@document}. +% \begin{macrocode} + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname clear@document\endcsname\relax + \def\AtVeryEnd@document{document}% + \def\AtVeryEnd@RedefCheckend{% + \expandafter\def\expandafter\@checkend + \expandafter##\expandafter1\expandafter{% + \@checkend{##1}% + \def\AtVeryEnd@temp{##1}% + \ifx\AtVeryEnd@temp\AtVeryEnd@document + \let\AtVeryEnd@OrgClearpage\clearpage + \def\clearpage{% + \let\clearpage\AtVeryEnd@OrgClearpage + \clearpage + \Call@AfterLastShipout + }% + \fi + }% + \aftergroup\AtVeryEnd@RedefCheckend + }% + \AtEndDocument{% + \AtVeryEnd@RedefCheckend + }% + \else + \g@addto@macro\clear@document{\Call@AfterLastShipout}% + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\AtEndDocument{% + \@ifundefined{@dofilelist}{% + \gdef\@dofilelist{\Call@AtVeryEndDocument}% + }{% + \begingroup + \toks@\expandafter{\@dofilelist}% + \xdef\@dofilelist{% + \noexpand\Call@AtVeryEndDocument + \the\toks@ + }% + \endgroup + }% +} +% \end{macrocode} +% +% \begin{macrocode} +\AtVeryEnd@AtEnd +%</package> +% \end{macrocode} +% +% \section{Test} +% +% \subsection{Catcode checks for loading} +% +% \begin{macrocode} +%<*test1> +% \end{macrocode} +% \begin{macrocode} +\catcode`\{=1 % +\catcode`\}=2 % +\catcode`\#=6 % +\catcode`\@=11 % +\expandafter\ifx\csname count@\endcsname\relax + \countdef\count@=255 % +\fi +\expandafter\ifx\csname @gobble\endcsname\relax + \long\def\@gobble#1{}% +\fi +\expandafter\ifx\csname @firstofone\endcsname\relax + \long\def\@firstofone#1{#1}% +\fi +\expandafter\ifx\csname loop\endcsname\relax + \expandafter\@firstofone +\else + \expandafter\@gobble +\fi +{% + \def\loop#1\repeat{% + \def\body{#1}% + \iterate + }% + \def\iterate{% + \body + \let\next\iterate + \else + \let\next\relax + \fi + \next + }% + \let\repeat=\fi +}% +\def\RestoreCatcodes{} +\count@=0 % +\loop + \edef\RestoreCatcodes{% + \RestoreCatcodes + \catcode\the\count@=\the\catcode\count@\relax + }% +\ifnum\count@<255 % + \advance\count@ 1 % +\repeat + +\def\RangeCatcodeInvalid#1#2{% + \count@=#1\relax + \loop + \catcode\count@=15 % + \ifnum\count@<#2\relax + \advance\count@ 1 % + \repeat +} +\expandafter\ifx\csname LoadCommand\endcsname\relax + \def\LoadCommand{\input atveryend.sty\relax}% +\fi +\def\Test{% + \RangeCatcodeInvalid{0}{47}% + \RangeCatcodeInvalid{58}{64}% + \RangeCatcodeInvalid{91}{96}% + \RangeCatcodeInvalid{123}{255}% + \catcode`\@=12 % + \catcode`\\=0 % + \catcode`\{=1 % + \catcode`\}=2 % + \catcode`\#=6 % + \catcode`\[=12 % + \catcode`\]=12 % + \catcode`\%=14 % + \catcode`\ =10 % + \catcode13=5 % + \LoadCommand + \RestoreCatcodes +} +\Test +\csname @@end\endcsname +\end +% \end{macrocode} +% \begin{macrocode} +%</test1> +% \end{macrocode} +% +% \section{Installation} +% +% \subsection{Download} +% +% \paragraph{Package.} This package is available on +% CTAN\footnote{\url{ftp://ftp.ctan.org/tex-archive/}}: +% \begin{description} +% \item[\CTAN{macros/latex/contrib/oberdiek/atveryend.dtx}] The source file. +% \item[\CTAN{macros/latex/contrib/oberdiek/atveryend.pdf}] Documentation. +% \end{description} +% +% +% \paragraph{Bundle.} All the packages of the bundle `oberdiek' +% are also available in a TDS compliant ZIP archive. There +% the packages are already unpacked and the documentation files +% are generated. The files and directories obey the TDS standard. +% \begin{description} +% \item[\CTAN{install/macros/latex/contrib/oberdiek.tds.zip}] +% \end{description} +% \emph{TDS} refers to the standard ``A Directory Structure +% for \TeX\ Files'' (\CTAN{tds/tds.pdf}). Directories +% with \xfile{texmf} in their name are usually organized this way. +% +% \subsection{Bundle installation} +% +% \paragraph{Unpacking.} Unpack the \xfile{oberdiek.tds.zip} in the +% TDS tree (also known as \xfile{texmf} tree) of your choice. +% Example (linux): +% \begin{quote} +% |unzip oberdiek.tds.zip -d ~/texmf| +% \end{quote} +% +% \paragraph{Script installation.} +% Check the directory \xfile{TDS:scripts/oberdiek/} for +% scripts that need further installation steps. +% Package \xpackage{attachfile2} comes with the Perl script +% \xfile{pdfatfi.pl} that should be installed in such a way +% that it can be called as \texttt{pdfatfi}. +% Example (linux): +% \begin{quote} +% |chmod +x scripts/oberdiek/pdfatfi.pl|\\ +% |cp scripts/oberdiek/pdfatfi.pl /usr/local/bin/| +% \end{quote} +% +% \subsection{Package installation} +% +% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting +% \docstrip\ archive. The files are extracted by running the +% \xfile{.dtx} through \plainTeX: +% \begin{quote} +% \verb|tex atveryend.dtx| +% \end{quote} +% +% \paragraph{TDS.} Now the different files must be moved into +% the different directories in your installation TDS tree +% (also known as \xfile{texmf} tree): +% \begin{quote} +% \def\t{^^A +% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} +% atveryend.sty & tex/generic/oberdiek/atveryend.sty\\ +% atveryend.pdf & doc/latex/oberdiek/atveryend.pdf\\ +% test/atveryend-test1.tex & doc/latex/oberdiek/test/atveryend-test1.tex\\ +% atveryend.dtx & source/latex/oberdiek/atveryend.dtx\\ +% \end{tabular}^^A +% }^^A +% \sbox0{\t}^^A +% \ifdim\wd0>\linewidth +% \begingroup +% \advance\linewidth by\leftmargin +% \advance\linewidth by\rightmargin +% \edef\x{\endgroup +% \def\noexpand\lw{\the\linewidth}^^A +% }\x +% \def\lwbox{^^A +% \leavevmode +% \hbox to \linewidth{^^A +% \kern-\leftmargin\relax +% \hss +% \usebox0 +% \hss +% \kern-\rightmargin\relax +% }^^A +% }^^A +% \ifdim\wd0>\lw +% \sbox0{\small\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\footnotesize\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\scriptsize\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\tiny\t}^^A +% \ifdim\wd0>\linewidth +% \lwbox +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \end{quote} +% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's +% TDS installing feature, then some files can already be in the right +% place, see the documentation of \docstrip. +% +% \subsection{Refresh file name databases} +% +% If your \TeX~distribution +% (\teTeX, \mikTeX, \dots) relies on file name databases, you must refresh +% these. For example, \teTeX\ users run \verb|texhash| or +% \verb|mktexlsr|. +% +% \subsection{Some details for the interested} +% +% \paragraph{Attached source.} +% +% The PDF documentation on CTAN also includes the +% \xfile{.dtx} source file. It can be extracted by +% AcrobatReader 6 or higher. Another option is \textsf{pdftk}, +% e.g. unpack the file into the current directory: +% \begin{quote} +% \verb|pdftk atveryend.pdf unpack_files output .| +% \end{quote} +% +% \paragraph{Unpacking with \LaTeX.} +% The \xfile{.dtx} chooses its action depending on the format: +% \begin{description} +% \item[\plainTeX:] Run \docstrip\ and extract the files. +% \item[\LaTeX:] Generate the documentation. +% \end{description} +% If you insist on using \LaTeX\ for \docstrip\ (really, +% \docstrip\ does not need \LaTeX), then inform the autodetect routine +% about your intention: +% \begin{quote} +% \verb|latex \let\install=y\input{atveryend.dtx}| +% \end{quote} +% Do not forget to quote the argument according to the demands +% of your shell. +% +% \paragraph{Generating the documentation.} +% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate +% the documentation. The process can be configured by the +% configuration file \xfile{ltxdoc.cfg}. For instance, put this +% line into this file, if you want to have A4 as paper format: +% \begin{quote} +% \verb|\PassOptionsToClass{a4paper}{article}| +% \end{quote} +% An example follows how to generate the +% documentation with pdf\LaTeX: +% \begin{quote} +%\begin{verbatim} +%pdflatex atveryend.dtx +%makeindex -s gind.ist atveryend.idx +%pdflatex atveryend.dtx +%makeindex -s gind.ist atveryend.idx +%pdflatex atveryend.dtx +%\end{verbatim} +% \end{quote} +% +% \section{Acknowledgement} +% +% \begin{description} +% \item[Arthur Ogawa:] He proposed the new API with \cs{AfterLastShipout}. +% For version 1.2 he provided a comprehensive class/package list that +% deal with \cs{enddocument}. +% \end{description} +% +% \begin{thebibliography}{9} +% +% \bibitem{clsguide} +% The \LaTeX3 Project: +% \textit{\LaTeX2e\ for class and package writers} +% 2006/02/15; +% \CTAN{macros/latex/doc/clsguide.pdf}. +% +% \bibitem{endfloat} +% James Darrell McCauley, Jeff Goldberg: +% \textit{The \xpackage{endfloat} package}; +% 1995/10/11 v2.4i; +% \CTAN{macros/latex/contrib/endfloat/endfloat.pdf}. +% +% \bibitem{etoolbox} +% Philipp Lehmann: +% \textit{The \xpackage{etoolbox} package}; +% 2009/08/06 v1.8; +% \CTAN{macros/latex/contrib/etoolbox/etoolbox.pdf}. +% +% \bibitem{hyperref} +% Sebastian Rahtz, Heiko Oberdiek: +% \textit{The \xpackage{hyperref} package}; +% 2009/12/05 v6.79l; +% \CTAN{macros/latex/contrib/hyperref/}. +% +% \bibitem{koma} +% Markus Kohm: +% \textit{KOMA-Script}; +% 2009/07/24 v3.04a; +% \url{http://www.komascript.de/}. +% +% \bibitem{lastpage} +% Jeff Goldberg: +% \textit{The \xpackage{lastpage} package}; +% 1994/07/20 v0.1b; +% \CTAN{macros/latex/contrib/lastpage/lastpage.pdf}. +% +% \bibitem{revtex} +% APS, AIP, Arthur Orgawa; +% ReVTeX 4.1; +% 2009/10/13 v4.1; +% \url{http://authors.aps.org/revtex4/}. +% +% \end{thebibliography} +% +% \begin{History} +% \begin{Version}{2009/12/06 v1.0} +% \item +% The first version. +% \end{Version} +% \begin{Version}{2009/12/07 v1.1} +% \item +% Bug fixes. +% \end{Version} +% \begin{Version}{2009/12/09 v1.2} +% \item +% Additional support of classes and packages. +% \end{Version} +% \end{History} +% +% \PrintIndex +% +% \Finale +\endinput |