diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/eso-pic/eso-pic.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/eso-pic/eso-pic.dtx | 285 |
1 files changed, 177 insertions, 108 deletions
diff --git a/Master/texmf-dist/source/latex/eso-pic/eso-pic.dtx b/Master/texmf-dist/source/latex/eso-pic/eso-pic.dtx index f551b28c65f..443258ae40f 100644 --- a/Master/texmf-dist/source/latex/eso-pic/eso-pic.dtx +++ b/Master/texmf-dist/source/latex/eso-pic/eso-pic.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 1998-2005 by Rolf Niepraschk <Rolf.Niepraschk@ptb.de> +% Copyright (C) 1998-2009 by Rolf Niepraschk <Rolf.Niepraschk@gmx.de> % ------------------------------------------------------------------- % % This file may be distributed and/or modified under the @@ -18,14 +18,14 @@ % This work has the LPPL maintenance status "author-maintained". % % Please send error reports and suggestions for improvements to -% Rolf Niepraschk <Rolf.Niepraschk@ptb.de>. +% Rolf Niepraschk <Rolf.Niepraschk@gmx.de>. % % \fi % % \iffalse %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{eso-pic} -%<package> [2006/07/14 v1.1d eso-pic (RN)] +%<package> [2009/10/07 v2.0a eso-pic (RN)] % %<*driver> \documentclass[a4paper]{ltxdoc} @@ -37,7 +37,7 @@ %</driver> % \fi % -% \CheckSum{619} +% \CheckSum{681} % % \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 @@ -59,15 +59,15 @@ % =================================================================== % @LaTeX-package-file{ % author = {Rolf Niepraschk}, -% version = "v1.1d", -% date = "14 July 2006", +% version = "v2.0a", +% date = "07 Oct 2009", % filename = "eso-pic.sty", % address = "", % telephone = "", -% email = "Rolf.Niepraschk@ptb.de", +% email = "Rolf.Niepraschk@gmx.de", % codetable = "ISO/ASCII", % keywords = "LaTeX2e, \shipout, picture", -% dependences = "everyshi", +% dependences = "atbegshi", % supported = "yes", % docstring = "LaTeX package which makes it easy to add some % picture commands to every page." @@ -104,25 +104,18 @@ % % \title{The \pkgname{eso-pic} package\thanks{This document % corresponds to \pkgname{eso-pic}~\fileversion, dated \filedate.}} -% \author{Rolf Niepraschk \\ \texttt{Rolf.Niepraschk@ptb.de}} +% \author{Rolf Niepraschk \\ \texttt{Rolf.Niepraschk@gmx.de}} % % \date{} % % \maketitle % -% \begin{abstract} -% This package makes it easy to add some picture commands to every page. -% \end{abstract} -% % \section{Introduction} % -% This package is an extension to Martin Schr\"oder's \pkgname{everyshi} -% package. Using \pkgname{every\-shi}'s \cs{EveryShipout} command -% \pkgname{eso-pic} adds one or more userdefined \texttt{picture} commands to -% \LaTeX's shipout routine. -% +% This package makes it easy to add some picture commands to every page +% at absolute positions. % \section{Usage} -% See also the example \LaTeX\ documents |eso-ex?.tex|. +% See also the example \LaTeX\ documents (|eso-*.tex|). % % \subsection{Basic commands for adding \LaTeX{} stuff to the page background} % \DescribeMacro{\AddToShipoutPicture} All the picture commands which are @@ -152,7 +145,10 @@ % \DescribeMacro{\AtPageCenter} % \DescribeMacro{\AtTextUpperLeft} % \DescribeMacro{\AtTextLowerLeft} -% \DescribeMacro{\AtTextCenter} +% \DescribeMacro{\AtTextCenter} +% \DescribeMacro{\AtStockUpperLeft} +% \DescribeMacro{\AtStockLowerLeft} +% \DescribeMacro{\AtStockCenter} % Helper macros for easier positioning on the page. \vfill\mbox{} % % \subsection{Package options} @@ -192,7 +188,7 @@ % \subsection{The main functionality} % % \begin{macrocode} -\RequirePackage{everyshi} +\RequirePackage{atbegshi} % \end{macrocode} % \begin{macro}{\LenToUnit} % \changes{v1.0d}{2006/07/14}{Using \cmd{\providecommand} instead of @@ -201,10 +197,17 @@ \providecommand*\LenToUnit[1]{#1\@gobble} % \end{macrocode} % \end{macro} +% \begin{macro}{\ESO@isMEMOIR} +% Support for the \clsname{memoir} class. +% \begin{macrocode} +\newcommand\ESO@isMEMOIR[2]{#2} +\@ifclassloaded{memoir}{\renewcommand\ESO@isMEMOIR[2]{#1}}{} +% \end{macrocode} +% \end{macro} % \begin{macro}{\AtPageUpperLeft} % \begin{macrocode} \newcommand\AtPageUpperLeft[1]{% - \put(0,\LenToUnit{\ESO@yoffsetI}){#1}% + \put(0,\LenToUnit{-\ESO@yoffsetI}){#1}% } % \end{macrocode} % \end{macro} @@ -221,21 +224,99 @@ } % \end{macrocode} % \end{macro} +% \begin{macro}{\AtStockLowerLeft} +% \changes{v2.0a}{2009/10/07}{New} +% \begin{macrocode} +\newcommand\AtStockLowerLeft{} +\ESO@isMEMOIR{% + \renewcommand\AtStockLowerLeft[1]{% + \begingroup + \@tempdima=-\stockwidth + \advance\@tempdima\trimedge + \advance\@tempdima\paperwidth + \if@twoside\ifodd\c@page\else + \@tempdima=-\trimedge + \fi\fi + \@tempdimb=-\stockheight + \advance\@tempdimb\paperheight + \advance\@tempdimb\trimtop + \AtPageLowerLeft{% + \put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdimb}){#1}% + }% + \endgroup + } +}{% + \let\AtStockLowerLeft=\AtPageLowerLeft +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\AtStockUpperLeft} +% \changes{v2.0a}{2009/10/07}{New} +% \begin{macrocode} +\newcommand\AtStockUpperLeft{} +\ESO@isMEMOIR{% + \renewcommand\AtStockUpperLeft[1]{% + \AtStockLowerLeft{% + \put(0,\LenToUnit{\stockheight}){#1}% + }% + }% +}{% + \let\AtStockUpperLeft=\AtPageUpperLeft +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\AtStockCenter} +% \changes{v2.0a}{2009/10/07}{New} +% \begin{macrocode} +\newcommand\AtStockCenter{} +\ESO@isMEMOIR{% + \renewcommand\AtStockCenter[1]{% + \AtStockLowerLeft{% + \put(\LenToUnit{.5\stockwidth},\LenToUnit{.5\stockheight}){#1}% + }% + }% +}{% + \let\AtStockCenter=\AtPageCenter +} +% \end{macrocode} +% \end{macro} % \begin{macro}{\AtTextUpperLeft} +% \changes{v2.0a}{2009/10/07}{Works now for class \clsname{memoir}} % \begin{macrocode} -\newcommand\AtTextUpperLeft[1]{% - \begingroup - \setlength\@tempdima{1in}% - \ifodd\c@page% - \advance\@tempdima\oddsidemargin% - \else% - \advance\@tempdima\evensidemargin% - \fi% - \@tempdimb=\ESO@yoffsetI\relax\advance\@tempdimb-1in\relax% - \advance\@tempdimb-\topmargin% - \advance\@tempdimb-\headheight\advance\@tempdimb-\headsep% - \put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdimb}){#1}% - \endgroup +\ESO@isMEMOIR{% + \newcommand\AtTextUpperLeft[1]{% + \begingroup + \ifodd\c@page + \@tempdima=\spinemargin + \else + \@tempdima=\paperwidth + \advance\@tempdima-\textwidth + \advance\@tempdima-\spinemargin + \fi + \@tempdimb=-\uppermargin + \AtPageUpperLeft{% + \put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdimb}){#1}% + }% + \endgroup + } +}{% + \newcommand\AtTextUpperLeft[1]{% + \begingroup + \@tempdima=1in\relax + \ifodd\c@page + \advance\@tempdima\oddsidemargin + \else + \advance\@tempdima\evensidemargin + \fi + \@tempdimb=-1in\relax + \advance\@tempdimb-\topmargin + \advance\@tempdimb-\headheight + \advance\@tempdimb-\headsep + \AtPageUpperLeft{% + \put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdimb}){#1}% + }% + \endgroup + } } % \end{macrocode} % \end{macro} @@ -254,7 +335,8 @@ % \DescribeMacro{\ESO@HookI}\DescribeMacro{\ESO@HookII} % \DescribeMacro{\ESO@HookIII} % \begin{macrocode} -\newcommand{\ESO@HookI}{} \newcommand{\ESO@HookII}{} +\newcommand{\ESO@HookI}{} +\newcommand{\ESO@HookII}{} \newcommand{\ESO@HookIII}{} % \end{macrocode} % \begin{macro}{\AddToShipoutPicture} @@ -270,59 +352,44 @@ \newcommand{\ClearShipoutPicture}{\global\let\ESO@HookI\@empty} % \end{macrocode} % \end{macro} -% \begin{macro}{\ESO@isMEMOIR} -% Support for the \clsname{memoir} class. -% \begin{macrocode} -\newcommand\ESO@isMEMOIR[1]{} -\@ifclassloaded{memoir}{\renewcommand\ESO@isMEMOIR[1]{#1}}{} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\@ShipoutPicture} -% \changes{v0.8}{2002/01/21}{Compatibility with the \clsname{memoir} class -% (suggested by Andreas Matthias).} -% \changes{v0.9}{2002/07/27}{Compatibility with the \pkgname{crop} package -% (better test of \clsname{memoir}).} -% \changes{v0.9}{2002/07/27}{\cmd{\nointerlineskip} prevents a small vertical -% misplacement (suggested by Stephan Lehmke)} -% \changes{v1.0b}{2002/10/23}{A new hook \cmd\ESO@HookIII for special -% purpose (suggested by D. P. Story).} +% \begin{macro}{\AtBeginShipout} +% \begin{macro}{\AtBeginShipoutUpperLeft} +% (see package \pkgname{atbegshi}) % \begin{macrocode} -\newcommand{\@ShipoutPicture}{% - \bgroup - \@tempswafalse% - \ifx\ESO@HookI\@empty\else\@tempswatrue\fi% - \ifx\ESO@HookII\@empty\else\@tempswatrue\fi% - \ifx\ESO@HookIII\@empty\else\@tempswatrue\fi% - \if@tempswa% - \@tempdima=1in\@tempdimb=-\@tempdima% - \advance\@tempdimb\ESO@yoffsetI% - \ESO@isMEMOIR{% - \advance\@tempdima\trimedge% - \advance\@tempdima\paperwidth% - \advance\@tempdima-\stockwidth% - \if@twoside\ifodd\c@page\else% - \advance\@tempdima-2\trimedge% - \advance\@tempdima-\paperwidth% - \advance\@tempdima\stockwidth% - \fi\fi% - \advance\@tempdimb\trimtop}% - \unitlength=\p@% - \global\setbox\@cclv\vbox{% - \vbox{\let\protect\relax - \pictur@(0,0)(\strip@pt\@tempdima,\strip@pt\@tempdimb)% - \ESO@HookIII\ESO@HookI\ESO@HookII% - \global\let\ESO@HookII\@empty% - \endpicture}% - \nointerlineskip% - \box\@cclv}% - \fi - \egroup +\ESO@isMEMOIR{% + \AtBeginShipout{% + \@tempdima=-\trimedge + \advance\@tempdima-\paperwidth + \advance\@tempdima\stockwidth + \if@twoside\ifodd\c@page\else + \advance\@tempdima2\trimedge + \advance\@tempdima\paperwidth + \advance\@tempdima-\stockwidth + \fi\fi + \@tempdimb=\ESO@yoffsetI + \advance\@tempdimb-\trimtop + \nointerlineskip + \AtBeginShipoutUpperLeft{% + \put(\LenToUnit{\@tempdima},\LenToUnit{\@tempdimb}){% + \ESO@HookIII\ESO@HookI\ESO@HookII + \global\let\ESO@HookII\@empty + }% + }% + } +}{% + \AtBeginShipout{% + \nointerlineskip + \AtBeginShipoutUpperLeft{% + \put(0,\LenToUnit{\ESO@yoffsetI}){% + \ESO@HookIII\ESO@HookI\ESO@HookII + \global\let\ESO@HookII\@empty + }% + }% + } } -% \end{macrocode} +% \end{macrocode} +% \end{macro} % \end{macro} -% \begin{macrocode} -\EveryShipout{\@ShipoutPicture} -% \end{macrocode} % \subsection{The background grid} % \begin{macrocode} \RequirePackage{keyval} @@ -420,26 +487,28 @@ % \begin{macrocode} \newcommand\ESO@div[2]{% \@tempdima=#1\relax\@tempdimb=\ESO@gridunit\relax - \@tempdimb=#2\@tempdimb\divide\@tempdima by \@tempdimb% + \@tempdimb=#2\@tempdimb\divide\@tempdima by \@tempdimb \@tempcnta\@tempdima\advance\@tempcnta\@ne} % \end{macrocode} % \end{macro} % \changes{v1.1c}{2005/12/24}{Remove the disadvantageous check of % `pdfTeX'. Now using with Xe\LaTeX\ should be possible.} +% \changes{v2.0a}{2009/10/07}{Better test of color/xcolor} % \begin{macrocode} +\@ifundefined{colorbox}{% + \IfFileExists{xcolor.sty}{\RequirePackage{xcolor}}% + {\RequirePackage{color}}% +}{}% +\let\ESO@color=\color +\let\ESO@colorbox=\colorbox +\let\ESO@fcolorbox=\fcolorbox \AtBeginDocument{% - \IfFileExists{color.sty} - {% - \RequirePackage{color} - \let\ESO@color=\color\let\ESO@colorbox=\colorbox - \let\ESO@fcolorbox=\fcolorbox - }{} \ESO@dvipsfalse \@ifundefined{Gin@driver}{}% {% \ifx\Gin@driver\@empty\else% \filename@parse{\Gin@driver}\def\reserved@a{dvips}% - \ifx\filename@base\reserved@a\ESO@dvipstrue\fi% + \ifx\filename@base\reserved@a\ESO@dvipstrue\fi \fi }% \ifESO@dvips\def\@tempb{eepic}\else\def\@tempb{epic}\fi @@ -454,18 +523,18 @@ (0,0)(0,##1)} }{} \else - \ifx\ESO@gridcolor\ESO@subgridcolor% + \ifx\ESO@gridcolor\ESO@subgridcolor \renewcommand*\ESO@gridlines{\thicklines} \fi \fi } \ifESO@texcoord \def\ESO@yoffsetI{\z@}\def\ESO@yoffsetII{-\paperheight} - \edef\ESO@griddeltaY{-\ESO@griddelta}\edef\ESO@gridDeltaY{-\ESO@gridDelta} -\else - \def\ESO@yoffsetI{\paperheight}\def\ESO@yoffsetII{\z@} + \edef\ESO@griddeltaY{-\ESO@griddelta}\edef\ESO@gridDeltaY{-\ESO@gridDelta} +\else + \def\ESO@yoffsetI{-\paperheight}\def\ESO@yoffsetII{\z@} \edef\ESO@griddeltaY{\ESO@griddelta}\edef\ESO@gridDeltaY{\ESO@gridDelta} -\fi +\fi % \end{macrocode} % \begin{macro}{\ESO@gridpicture} % \begin{macrocode} @@ -505,32 +574,32 @@ \fontsize{10}{12}\normalfont% \ESO@div{\paperwidth}{\ESO@gridDelta}% \multiput(0,\ESO@gridDeltaY)(\ESO@gridDelta,0){\@tempcnta}{% - \@tempcntb=\@tempcnta\advance\@tempcntb-\@multicnt% + \@tempcntb=\@tempcnta\advance\@tempcntb-\@multicnt \ifnum\@tempcntb>1\relax - \multiply\@tempcntb by \ESO@gridDelta\relax% - \@tempdima=\@tempcntb sp\@tempdima=\ESO@labelfactor\@tempdima% + \multiply\@tempcntb by \ESO@gridDelta\relax + \@tempdima=\@tempcntb sp\@tempdima=\ESO@labelfactor\@tempdima \@tempcntb=\@tempdima% \makebox(0,0)[c]{\ESO@colorbox{white}{\the\@tempcntb}}% \fi}% % \end{macrocode} % --- vertical numbers --- % \begin{macrocode} - \ifx\ESO@gridunitname\@empty\def\@tempa{0}\else\def\@tempa{1}\fi% + \ifx\ESO@gridunitname\@empty\def\@tempa{0}\else\def\@tempa{1}\fi \ESO@div{\paperheight}{\ESO@gridDelta}% \multiput(\ESO@gridDelta,0)(0,\ESO@gridDeltaY){\@tempcnta}{% \@tempcntb=\@tempcnta\advance\@tempcntb-\@multicnt% \ifnum\@tempcntb>\@tempa\relax \multiply\@tempcntb by \ESO@gridDelta\relax% - \@tempdima=\@tempcntb sp\@tempdima=\ESO@labelfactor\@tempdima% - \@tempcntb=\@tempdima% - \makebox(0,0)[c]{\ESO@colorbox{white}{\the\@tempcntb}}% + \@tempdima=\@tempcntb sp\@tempdima=\ESO@labelfactor\@tempdima + \@tempcntb=\@tempdima + \makebox(0,0)[c]{\ESO@colorbox{white}{\the\@tempcntb}}% \fi }% % \end{macrocode} % --- the unit label --- % \begin{macrocode} - \ifx\ESO@gridunitname\@empty\else% - \thicklines\fboxrule=\@wholewidth% + \ifx\ESO@gridunitname\@empty\else + \thicklines\fboxrule=\@wholewidth \put(\ESO@gridDelta,\ESO@gridDeltaY){\makebox(0,0)[c]{% \ESO@fcolorbox{\ESO@gridcolor}{white}{% \textbf{\ESO@gridunitname}}}}% |