summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/oberdiek/atbegshi.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/atbegshi.dtx')
-rw-r--r--Master/texmf-dist/source/latex/oberdiek/atbegshi.dtx264
1 files changed, 247 insertions, 17 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/atbegshi.dtx b/Master/texmf-dist/source/latex/oberdiek/atbegshi.dtx
index 9a21e37af89..957f435d134 100644
--- a/Master/texmf-dist/source/latex/oberdiek/atbegshi.dtx
+++ b/Master/texmf-dist/source/latex/oberdiek/atbegshi.dtx
@@ -17,7 +17,8 @@
% This work consists of the main source file atbegshi.dtx
% and the derived files
% atbegshi.sty, atbegshi.pdf, atbegshi.ins, atbegshi.drv,
-% atbegshi-test1.tex, atbegshi-test2.tex.
+% atbegshi-example.tex, atbegshi-test1.tex,
+% atbegshi-test2.tex.
%
% Distribution:
% CTAN:macros/latex/contrib/oberdiek/atbegshi.dtx
@@ -52,6 +53,7 @@
% Installation:
% TDS:tex/generic/oberdiek/atbegshi.sty
% TDS:doc/latex/oberdiek/atbegshi.pdf
+% TDS:doc/latex/oberdiek/atbegshi-example.tex
% TDS:doc/latex/oberdiek/atbegshi-test1.tex
% TDS:doc/latex/oberdiek/atbegshi-test2.tex
% TDS:source/latex/oberdiek/atbegshi.dtx
@@ -69,7 +71,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: atbegshi 2007/04/27 v1.4 At begin shipout hook (HO)}
+\Msg{* Package: atbegshi 2007/06/06 v1.5 At begin shipout hook (HO)}
\Msg{************************************************************************}
\keepsilent
@@ -96,7 +98,8 @@ This Current Maintainer of this work is Heiko Oberdiek.
This work consists of the main source file atbegshi.dtx
and the derived files
atbegshi.sty, atbegshi.pdf, atbegshi.ins, atbegshi.drv,
- atbegshi-test1.tex, atbegshi-test2.tex.
+ atbegshi-example.tex, atbegshi-test1.tex,
+ atbegshi-test2.tex.
\endpreamble
@@ -106,6 +109,7 @@ and the derived files
\usedir{tex/generic/oberdiek}%
\file{atbegshi.sty}{\from{atbegshi.dtx}{package}}%
\usedir{doc/latex/oberdiek}%
+ \file{atbegshi-example.tex}{\from{atbegshi.dtx}{example}}%
\file{atbegshi-test1.tex}{\from{atbegshi.dtx}{test1}}%
\file{atbegshi-test2.tex}{\from{atbegshi.dtx}{test2}}%
}
@@ -133,7 +137,7 @@ and the derived files
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{atbegshi.drv}%
- [2007/04/27 v1.4 At begin shipout hook (HO)]%
+ [2007/06/06 v1.5 At begin shipout hook (HO)]%
\documentclass{ltxdoc}
\usepackage{holtxdoc}
\begin{document}
@@ -142,7 +146,7 @@ and the derived files
%</driver>
% \fi
%
-% \CheckSum{1120}
+% \CheckSum{1239}
%
% \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
@@ -163,7 +167,7 @@ and the derived files
% \GetFileInfo{atbegshi.drv}
%
% \title{The \xpackage{atbegshi} package}
-% \date{2007/04/27 v1.4}
+% \date{2007/06/06 v1.5}
% \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}}
%
% \maketitle
@@ -258,6 +262,80 @@ and the derived files
% \cs{AtBeginShipoutInit} forces the immediate redefinition
% of \cs{shipout}.
%
+% \begin{declcs}{AtBeginShipoutUpperLeft} \M{background material}
+% \end{declcs}
+% This is a macro that puts material in the background of
+% box \cs{AtBeginShipoutbox}.
+% The \meta{background material} is set in an \cs{hbox}, the
+% reference point is the upper left corner of the output page.
+% In case of \pdfTeX\ in PDF mode, the settings of
+% \cs{pdfhorigin} and \cs{pdfvorigin} are respected.
+%
+% For \LaTeX\ users the \meta{background material} is set
+% inside a \texttt{picture} environment:
+% \begin{quote}
+% |\begin{picture}(0,0)|\\
+% \mbox{}\quad |\setlength{\unitlength}{1pt}%|\\
+% \mbox{}\quad \meta{background material}\\
+% |\end{picture}|
+% \end{quote}
+%
+% \subsection{Example}
+%
+% In this example we put a circle in the background in the middle
+% of the paper.
+%
+% \begin{macrocode}
+%<*example>
+% \end{macrocode}
+% \begin{macrocode}
+\documentclass[a4paper]{article}
+\usepackage{color}
+\usepackage{atbegshi}
+% \end{macrocode}
+% Package \xpackage{picture} makes life a little easier, because
+% we can now also use length specifications in |picture|'s commands.
+% \begin{macrocode}
+\usepackage{picture}
+% \end{macrocode}
+% Now we draw the circle in the middle of the paper.
+% \cs{put} moves downwards, because the origin is at the top
+% of the page, not at its bottom.
+% \begin{macrocode}
+\AtBeginShipout{%
+ \AtBeginShipoutUpperLeft{%
+ \put(0.5\paperwidth,-0.5\paperheight){\circle{10}}%
+ }%
+}
+\begin{document}
+\section{Hello World}
+\newpage
+\AtBeginShipoutNext{%
+ \AtBeginShipoutUpperLeft{%
+ \color{red}%
+ \put(0,-0.5\paperheight){\line(1,0){\paperwidth}}%
+ \put(0.5\paperwidth, 0){\line(0,-1){\paperheight}}%
+ }%
+}
+Only on this page we add a red cross.
+\newpage
+This page has the circle only.
+\par
+\vspace{\fill}
+The next page will be discarded.
+\newpage
+\AtBeginShipoutNext{%
+ \AtBeginShipoutDiscard
+}
+This page is discarded.
+\newpage
+The last page.
+\end{document}
+% \end{macrocode}
+% \begin{macrocode}
+%</example>
+% \end{macrocode}
+%
% \section{Method of \cs{shipout} overloading}
%
% \subsection{\cs{shipout}}
@@ -638,6 +716,7 @@ and the derived files
%\end{verbatim}
%\end{quote}
%
+%
% \StopEventually{
% }
%
@@ -685,9 +764,12 @@ and the derived files
% Package identification:
% \begin{macrocode}
\begingroup
+ \catcode40 12 % (
+ \catcode41 12 % )
\catcode44 12 % ,
\catcode45 12 % -
\catcode46 12 % .
+ \catcode47 12 % /
\catcode58 12 % :
\catcode64 11 % @
\expandafter\ifx\csname ProvidesPackage\endcsname\relax
@@ -705,7 +787,7 @@ and the derived files
\fi
\expandafter\x\csname ver@atbegshi.sty\endcsname
\ProvidesPackage{atbegshi}%
- [2007/04/27 v1.4 At begin shipout hook (HO)]
+ [2007/06/06 v1.5 At begin shipout hook (HO)]
% \end{macrocode}
%
% \subsection{Catcodes}
@@ -738,7 +820,6 @@ and the derived files
%
% \subsection{Preparations}
%
-% \begin{macro}{\AtBegShi@Warning}
% \begin{macrocode}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname RequirePackage\endcsname\relax
@@ -747,7 +828,6 @@ and the derived files
\RequirePackage{infwarerr}%
\fi
% \end{macrocode}
-% \end{macro}
%
% \begin{macro}{\AtBegShi@CheckDefinable}
% \begin{macrocode}
@@ -1007,6 +1087,90 @@ X \endgroup
\fi
% \end{macrocode}
%
+% \subsection{Positioning}
+%
+% \begin{macrocode}
+\begingroup\expandafter\expandafter\expandafter\endgroup
+\expandafter\ifx\csname RequirePackage\endcsname\relax
+ \input ifpdf.sty\relax
+\else
+ \RequirePackage{ifpdf}\relax
+\fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+\ifpdf
+ \def\AtBegShi@horigin{\pdfhorigin}%
+ \def\AtBegShi@vorigin{\pdfvorigin}%
+\else
+ \def\AtBegShi@horigin{72.27pt}%
+ \def\AtBegShi@vorigin{72.27pt}%
+\fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+\begingroup
+\ifcase
+ \expandafter\ifx\csname picture\endcsname\relax
+ 1%
+ \else
+ \expandafter\ifx\csname endpicture\endcsname\relax
+ 1%
+ \else
+ 0%
+ \fi
+ \fi
+ \endgroup
+ \def\AtBegShi@BeginPicture{%
+ \begingroup
+ \picture(0,0)\relax
+ \begingroup\expandafter\expandafter\expandafter\endgroup
+ \expandafter\ifx\csname unitlength\endcsname\relax
+ \else
+ \unitlength=1pt\relax
+ \fi
+ \ignorespaces
+ }%
+ \def\AtBegShi@EndPicture{%
+ \endpicture
+ \endgroup
+ }%
+\else
+ \endgroup
+ \def\AtBegShi@BeginPicture{%
+ \setbox0=\hbox\bgroup
+ \begingroup
+ \ignorespaces
+ }%
+ \def\AtBegShi@EndPicture{%
+ \endgroup
+ \egroup
+ \ht0=0pt\relax
+ \dp0=0pt\relax
+ \copy0 %
+ }%
+\fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+\def\AtBeginShipoutUpperLeft#1{%
+ \global\setbox\AtBeginShipoutBox=\hbox{%
+ \rlap{%
+ \kern-\AtBegShi@horigin\relax
+ \vbox to 0pt{%
+ \kern-\AtBegShi@vorigin\relax
+ \kern-\ht\AtBeginShipoutBox
+ \AtBegShi@BeginPicture
+ #1%
+ \AtBegShi@EndPicture
+ \vss
+ }%
+ }%
+ \box\AtBeginShipoutBox
+ }%
+}
+% \end{macrocode}
+%
% \subsection{Patches}
%
% Patches for \LaTeX\ packages that redefine \cs{shipout}.
@@ -1307,7 +1471,7 @@ X \endgroup
%<*test1>
\input atbegshi.sty\relax
\def\msg#{\immediate\write16}
-\msg{File: atbegshi-test1.tex 2007/04/27 v1.4 Test file for plain-TeX}
+\msg{File: atbegshi-test1.tex 2007/06/06 v1.5 Test file for plain-TeX}
\def\testmsg#1#2{%
\msg{}%
\msg{*** Test with box (#1), expected page output [#2]}%
@@ -1404,7 +1568,7 @@ Hello World
% \begin{macrocode}
%<*test2>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesFile{atbegshi-test2.tex}[2007/04/27 v1.4 Test file for LaTeX]
+\ProvidesFile{atbegshi-test2.tex}[2007/06/06 v1.5 Test file for LaTeX]
\RequirePackage{color}
\pagecolor{yellow}
\documentclass[a5paper,showtrims]{memoir}
@@ -1438,6 +1602,12 @@ Hello World
\hspace{.48\paperwidth}%
}%
}
+% \end{macrocode}
+% Newer versions of class \xclass{memoir} emulate package
+% \xpackage{crop} and prevents its loading. This is undone
+% in next line for this test file.
+% \begin{macrocode}
+\expandafter\let\csname ver@crop.sty\endcsname\relax
\usepackage[color=red,cross,a4,center]{crop}
\begin{document}
\shipout\null
@@ -1500,19 +1670,71 @@ Hello World
% the different directories in your installation TDS tree
% (also known as \xfile{texmf} tree):
% \begin{quote}
-% \sbox0{^^A
-% \begin{tabular}{@{}>{\ttfamily}l@{$\quad\rightarrow\quad$}>{\ttfamily}l@{}}
+% \def\t{^^A
+% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
% atbegshi.sty & tex/generic/oberdiek/atbegshi.sty\\
% atbegshi.pdf & doc/latex/oberdiek/atbegshi.pdf\\
+% atbegshi-example.tex & doc/latex/oberdiek/atbegshi-example.tex\\
% atbegshi-test1.tex & doc/latex/oberdiek/atbegshi-test1.tex\\
% atbegshi-test2.tex & doc/latex/oberdiek/atbegshi-test2.tex\\
% atbegshi.dtx & source/latex/oberdiek/atbegshi.dtx\\
% \end{tabular}^^A
-% }%
+% }^^A
+% \sbox0{\t}^^A
% \ifdim\wd0>\linewidth
-% \mbox{}\nobreak\hskip0pt minus\leftmargin
-% \usebox0
-% \nobreak\hskip0pt minus\rightmargin
+% \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
@@ -1605,6 +1827,14 @@ Hello World
% \item
% Small optimizations.
% \end{Version}
+% \begin{Version}{2007/06/06 v1.5}
+% \item
+% \cs{AtBeginShipoutUpperLeft} added.
+% \item
+% Example added.
+% \item
+% Fix in second test file for newer version of \xclass{memoir}.
+% \end{Version}
% \end{History}
%
% \PrintIndex