diff options
author | Karl Berry <karl@freefriends.org> | 2011-11-27 23:07:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-11-27 23:07:27 +0000 |
commit | 9811c749cda1c7fe41675c55bf658afb91690f38 (patch) | |
tree | 8496f598258f0f75d0b55e545733ce3aa9b7efb9 /Master/texmf-dist/tex | |
parent | fc756e8f8a1c9108bb71bbf79b6c8566ab668f80 (diff) |
xwatermark (26nov11)
git-svn-id: svn://tug.org/texlive/trunk@24671 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/xwatermark/xwatermark.sty | 744 |
1 files changed, 401 insertions, 343 deletions
diff --git a/Master/texmf-dist/tex/latex/xwatermark/xwatermark.sty b/Master/texmf-dist/tex/latex/xwatermark/xwatermark.sty index 81ceb5b120f..f48af204ad6 100644 --- a/Master/texmf-dist/tex/latex/xwatermark/xwatermark.sty +++ b/Master/texmf-dist/tex/latex/xwatermark/xwatermark.sty @@ -1,5 +1,5 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -% This is file 'xwatermark.sty', version 1.5.1, July 2011. % +% This is file 'xwatermark.sty', version 1.5.2, November 2011. % % % % This package puts user-specified watermarks (graphics and arbitrary % % texts) on select pages of documents. See package documentation % @@ -22,13 +22,20 @@ % Copyright (c) 2009-2011 Ahmed Musa (amusa22@gmail.com). % %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% -\@ifpackageloaded{catoptions}{}{\RequirePackage{catoptions}[2011/07/30]} +\@ifpackageloaded{catoptions}{% + \@ifpackagelater{catoptions}{2011/10/22}{}{% + \@latex@error{Loaded version of catoptions package is + not current}\@ehc + }% +}{% + \RequirePackage{catoptions}[2011/10/22]% +} \UseNormalCatcodes \StyleFilePurpose{Puts select watermarks on select pages} \StyleFileRCSInfo -$Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ +$Id: xwatermark.sty,v 1.5.2 2011/11/24 09:00:00 Ahmed Musa Exp $ \ProvidesPackage{xwatermark}[\StyleFileInfo] -\NeedsTeXFormat{LaTeX2e}[1996/12/01] +\NeedsTeXFormat{LaTeX2e}[2011/06/27] \SetStyleFileMessages[xwm@]{info}{warn}{err} \robust@def*\xwm@@err#1#2#3{\xwm@err{#1}{#2}\@gobble} \cptloadpackages{% @@ -41,31 +48,48 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ ltxkeys||2011/01/01; framed||2007/10/04 } -\AtEndOfPackage{\AtBeginDocument{% +\AtEndOfPackage{\BeforeStartOfDocument{% \ifcsndefTF{ver@hyperref.sty}{}{\usepackage{hyperref}}% }} + \newletcs\xwm@nil\relax +\new@def*\xwm@nnil{\xwm@nil} \AtBeginShipoutInit \newvariables{box}[xwm@box]{a,b}\relax -\newvariables{count}[xwm@]{cnta}\relax +\newvariables{count}[xwm@]{cnta}[\z@pt] \newvariables{if}[xwm@]{pdf,swa,swb,foregrd,wall}[false] \newvariables{write}[xwm@]{wrt}\relax \robust@def*\AtShipoutAlwaysUpperLeft#1{% \AtBeginShipout{\AtBeginShipoutUpperLeft{#1}}% } -\newletcs\stripallbr\stripallouterbraces -\newletcs\stripallbrincs\stripallouterbracesincs +\new@def*\xwm@boxframestack{} +\robust@def*\xwm@pushboxframe{% + \xdef\xwm@boxframestack{% + \fboxrule=\the\fboxrule\relax + \fboxsep=\the\fboxsep\relax + \xwm@nil{\expandcsonce\xwm@boxframestack}% + }% +} +\robust@def*\xwm@popboxframe{% + \begingroup + \def\reserved@a##1\xwm@nil{\endgroup + ##1\gdef\xwm@boxframestack + }% + \expandafter\reserved@a\xwm@boxframestack +} +\newletcs\xwm@stripallbr\stripallouterbraces +\newletcs\xwm@stripallbrincs\stripallouterbracesincs \new@def*\xwmremoveleadparsers#1#2{% \s@expandarg\ifbracedTF{#2}{% \unexpanded\expandafter{#2}% }{% \unexpanded\expandafter{\romannumeral - \expandafter\xwm@removeleadparsers#2\batchmode{#1}}% + \expandafter\xwm@removeleadparsers#2\noboundary{#1}}% }% } -\new@def*\xwm@removeleadparsers#1#2\batchmode#3{% - \ifcondTF\if\string#3\string#1\fi{% - \xwm@removeleadparsers#2\batchmode{#3}% +\new@def*\xwm@removeleadparsers#1#2\noboundary#3{% + \ifcondTF\if\string#1\string#3\fi{% + \xwm@removeleadparsers#2\noboundary{#3}% }{% 0 #1#2% }% @@ -101,27 +125,27 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \robust@def*\xwm@d@finecolorset#1(#2)#3{% \xwm@ifxcolorloaded{% \begingroup - \emptifycsset{\xwm@tempb,\xwm@tempc,\xwm@tempd,\xwm@tempe}% + \cptemptifycsset{\xwm@tempb,\xwm@tempc,\xwm@tempd,\xwm@tempe}% \def\xwm@tempa##1,##2,##3,##4,##5\@nil{% - \ifx\noboundary##4\noboundary + \ifblankTF{##4}{% \xwm@err{Incomplete color format in \string\xwmdefinecolorset}\@ehc - \else - \def\reserved@a{##1}% - \fi + }{% + \def\xwm@tempf{##1}% + }% }% \cpt@stfalse\cpt@csvnormalize[;]{#3}% \def\do##1;{% \ifnot@nil{##1}{% \xwm@tempa##1,,,,\@nil - \xifinsetTF{,\reserved@a,}{,\xwm@tempd,}{% - \edef\xwm@tempe{\cptliststack,\xwm@tempe\reserved@a}% + \xifinsetTF{,\xwm@tempf,}{,\xwm@tempd,}{% + \edef\xwm@tempe{\csliststack,\xwm@tempe\xwm@tempf}% }{% - \edef\xwm@tempd{\cptliststack,\xwm@tempd\reserved@a}% - \@ifundefinedcolor{#1\reserved@a#2}{% - \edef\xwm@tempb{\cptliststack;\xwm@tempb##1}% + \edef\xwm@tempd{\csliststack,\xwm@tempd\xwm@tempf}% + \@ifundefinedcolor{#1\xwm@tempf#2}{% + \edef\xwm@tempb{\csliststack;\xwm@tempb##1}% }{% - \edef\xwm@tempc{\cptliststack;\xwm@tempc#1\reserved@a#2}% + \edef\xwm@tempc{\csliststack;\xwm@tempc#1\xwm@tempf#2}% }% }% \do @@ -142,7 +166,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \endgroup }% } -\DefSuffixChecker\xwm@suffixcheck{*}{'} +\DefSuffixChecker\xwm@suffixcheck{*}{+}{'} \robust@def*\xwmifitemsinTF{% \cpt@swatrue\cpt@testopt\xwm@itemsin\@ne } @@ -205,7 +229,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ }{% \ifblankTF{#1}{% \xwm@err{Empty page range for watermark: - ^^J'\expandcsonce\currentmark'.^^J}\@ehc + ^^J'\expandcsonce\currwatermark'.^^J}\@ehc }{% \protected@edef#3{#1}% }% @@ -215,11 +239,11 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \def#3{#1}\def#4{#2}% \ifinsetTF{-}{#2}{% \xwm@err{Too many hyphens in page range '#1-#2' - \MsgBrk of watermark:^^J'\expandcsonce\currentmark'}\@ehc + \MsgBrk of watermark:^^J'\expandcsonce\currwatermark'}\@ehc }{% \ifblankTF{#1}{% \xwm@warn{No start-page in page-range of watermark: - ^^J'\expandcsonce\currentmark'.^^JI have used the + ^^J'\expandcsonce\currwatermark'.^^JI have used the default start-page '\xwm@defaultfirstpage' instead}% \def#3{\xwm@defaultfirstpage}% @@ -229,7 +253,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ }% \ifblankTF{#2}{% \xwm@warn{No end-page for page-range - of watermark:^^J'\expandcsonce\currentmark' + of watermark:^^J'\expandcsonce\currwatermark' ^^JI have used the default end-page '\xwm@defaultlastpage' instead}% \def#4{\xwm@defaultlastpage}% @@ -292,14 +316,16 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \ifmacroTF{#1}{}{\cpt@notcserr{#1}}% \begingroup \cptexpandmacro{#1}\xwm@tempa - \cptexpandargonce{\endgroup\stripallbr}\xwm@tempa#1% + \cptexpandargonce{\endgroup\xwm@stripallbr}\xwm@tempa#1% \ltxkeys@trimspacesincs{#1}% \cptexpandsecond{\def\reserved@a##1}{#1}##2##3\xwm@nil{% - \ifx\noboundary##3\noboundary + \def\reserved@a{##2}% + \ifxTF\reserved@a\xwm@nnil{% \cpt@err{Invalid value '#1' for textalign}\@ehc - \else + \def#1{xwm@relax}% + }{% \def#1{##2}% - \fi + }% }% \cptexpandsecond{\reserved@a center{center},\centering{center},right{flushright}, @@ -317,17 +343,19 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \cpt@notcserr{#1}% }% } +% 'boxalign' may be in the format 't-l, t-r, b-l, b-r, c, s' +% or 'top-left, top-right, etc': \robust@def*\xwm@setboxalign#1{% \ifmacroTF{#1}{}{\cpt@notcserr{#1}}% \begingroup \toks@{}% \cptexpandarg\lowercase{\def\noexpand\reserved@a{#1}}% + % We don't want the format 't-l' mixed with 'top-left': \def\xwm@tempa{}\def\xwm@tempb{}% \def\xwm@resa##1-{% \ifstrcmpTF{##1}{\xwm@nil}{}{% - \ifinsetTF{,##1,}{,top,left,right,bottom,center,% - justified,}{% - \edef\xwm@tempa{\cptliststack,\xwm@tempa##1}% + \ifinsetTF{,##1,}{,top,left,right,bottom,center,justified,}{% + \edef\xwm@tempa{\csliststack,\xwm@tempa##1}% }{% \ifinsetTF{,##1,}{,l,r,b,t,c,s,}{% \edef\xwm@tempb{\xwm@tempb##1}% @@ -395,7 +423,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \postgroupdef#1\endgroup } \robust@def*\xwm@notenddocerr{% - \xwm@err{Wrong location of \noexpand\enddocument command}\@ehc + \xwm@err{Wrong location of end-of-document command}\@ehc } \robust@def*\AfterEndOfDocument{\grightaddtocs\xwm@afterenddoc} \new@def*\xwm@afterenddoc{} @@ -427,11 +455,11 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \begingroup \ifcsndefFT{#1@#2}{}{% \gdef\xwm@multiplelabels{% - \@ltx@warn{There were multiply-defined labels}% + \ltxmsg@warn{There were multiply-defined labels}% }% - \@ltx@warn{Label '#2' multiply defined}% + \ltxmsg@warn{Label '#2' multiply defined}% }% - \csn@gdef{#1@#2}{#3}% + \csngdef*{#1@#2}{#3}% \endgroup } \let\xwm@multiplelabels\relax @@ -457,7 +485,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \if@filesw \ifx\xwm@multiplelabels\relax \ifxwm@swa - \@ltx@warn{Label(s) may have changed. + \ltxmsg@warn{Label(s) may have changed. Rerun to get cross-references right}% \fi \else @@ -500,7 +528,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \fi \robust@def*\DeclareWatermarkParser#1{% \begingroup - \stripallbr{#1}\xwm@tempa + \xwm@stripallbr{#1}\xwm@tempa \xdef\xwm@watermarkparser{\cptoxdetok\xwm@tempa}% \endgroup } @@ -526,8 +554,8 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \xwm@swbtrue \cptgxaddtolist*\xwm@picfilesread{\usename{#2picfile}}% }% - \aftercsname\stripallbrincs{#2picfileext}% - \if@boolTF{xwm@pdf}{% + \aftercsname\xwm@stripallbrincs{#2picfileext}% + \ifboolTF{xwm@pdf}{% \xifinsetTF{,\usename{#2picfileext},}{,pdf,png,jpeg,jpg,mps,}{}{% \csn@def{#2picfileext}{pdf}% \ifxwm@swb\xwm@tempb{pdf}{pdf}\fi @@ -555,36 +583,36 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ } \new@def*\xwm@gr@phicsoptions{} \robust@def*\GraphicsOptions#1{\gdef\xwm@gr@phicsoptions{#1}} -\ltxkeys@definekeys*[XWM]<main>[xwm@]{% - disable-geometry=true/\setmnkey{disablegeometry}; +\ltxkeys@definekeys*[XWM]{main}[xwm@]{% + disable-geometry=true/\setaliaskey{disablegeometry}; printwatermark=true; - print-watermark=true/\setmnkey{printwatermark}; + print-watermark=true/\setaliaskey{printwatermark}; allownesting=true; - showpagecenter=true/\if@boolTF{xwm@showpagecenter} + showpagecenter=true/\ifboolTF{xwm@showpagecenter} {\wmk@showpagecentertrue\wlp@showpagecentertrue}{}; - show-page-center=true/\setmnkey{showpagecenter}; - showpapercenter=true/\setmnkey{showpagecenter}; + show-page-center=true/\setaliaskey{showpagecenter}; + showpapercenter=true/\setaliaskey{showpagecenter}; usedummymarks=true; - use-dummy-marks=true/\setmnkey{usedummymarks}; + use-dummy-marks=true/\setaliaskey{usedummymarks}; defaultfirstpage=1; - default-first-page=1/\setmnkey{defaultfirstpage}; + default-first-page=1/\setaliaskey{defaultfirstpage}; defaultlastpage=\xwmgetpagenumber{xwmlastpage}; default-last-page=\xwmgetpagenumber{xwmlastpage}/ - \setmnkey{defaultlastpage}; + \setaliaskey{defaultlastpage}; frontpagestyle=empty; - front-page-style=empty/\setmnkey{frontpagestyle}; + front-page-style=empty/\setaliaskey{frontpagestyle}; watermarkparser={;}/\DeclareWatermarkParser{#1}; - watermark-parser={;}/\setmnkey{watermarkparser}; + watermark-parser={;}/\setaliaskey{watermarkparser}; resetpaperorigin=true/\ifxwm@resetpaperorigin\pdfhorigin\z@pt \pdfvorigin\z@pt\hoffset\z@pt\voffset\z@pt\fi; - reset-paper-origin=true/\setmnkey{resetpaperorigin}; + reset-paper-origin=true/\setaliaskey{resetpaperorigin}; } \ltxkeys@biboolkeys+[XWM]{main}[xwm@]{draft,final}[true] {}{}{\ltxkeys@keyvalerr} -\makeoption@keys[XWM]{main} +\ltxkeys@makeoptionkeys[XWM]{main} \BeforeStartOfDocument{% \ifxwm@printwatermark - \cptreplaceoneelement\XWM@main@initial@keyvals + \cptreplaceoneelement\XWM@main@initialkeyvals {printwatermark=false}{printwatermark=true}% \fi } @@ -605,8 +633,8 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ pmark=true; graphicsoptions={}/ \ifbracedTF{##1}{% - \aftercsname{\stripallbr{##1}}{#1graphicsoptions} - }{ + \aftercsname{\xwm@stripallbr{##1}}{#1graphicsoptions} + }{% \cpt@err{Values of key 'graphicsoptions' not braced}\@ehc }; GraphicsOptions=/ @@ -616,80 +644,77 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ Maybe you meant 'graphicsoptions'}\@ehc }{}; picontoptext=true; - picture-on-top-text=true/\setmnkey{picontoptext}; - pic-on-top-text=true/\setmnkey{picontoptext}; - textontoppic=true/\setmnkey{picontoptext}[false]; - text-on-top-picture=true/\setmnkey{picontoptext}[false]; - text-on-top-pic=true/\setmnkey{picontoptext}[false]; + picture-on-top-text=true/\setaliaskey{picontoptext}; + pic-on-top-text=true/\setaliaskey{picontoptext}; + textontoppic=true/\setaliaskey{picontoptext}[false]; + text-on-top-picture=true/\setaliaskey{picontoptext}[false]; + text-on-top-pic=true/\setaliaskey{picontoptext}[false]; draftboxcolor=blue; - draft-box-color=blue/\setmnkey{draftboxcolor}; + draft-box-color=blue/\setaliaskey{draftboxcolor}; textcolor=gray!25; - text-color=gray!25/\setmnkey{textcolor}; - color=gray!25/\setmnkey{textcolor}; + text-color=gray!25/\setaliaskey{textcolor}; + color=gray!25/\setaliaskey{textcolor}; textangle=0; - text-angle=0/\setmnkey{textangle}; - angle=0/\setmnkey{textangle}; + text-angle=0/\setaliaskey{textangle}; + angle=0/\setaliaskey{textangle}; textscale=1; - text-scale=1/\setmnkey{textscale}; - scale=1/\setmnkey{textscale}; + text-scale=1/\setaliaskey{textscale}; + scale=1/\setaliaskey{textscale}; textalign=center/\aftercsname\xwm@settextalign{#1textalign}; - text-align=center/\setmnkey{textalign}; - align=center/\setmnkey{textalign}; - showpagecenter=true/\ifboolTF{#1showpagecenter}{% + text-align=center/\setaliaskey{textalign}; + align=center/\setaliaskey{textalign}; + showpagecenter=true/\ifdefboolTF{#1showpagecenter}{% \usename{#1showpagecentertrue}}{\usename{#1showpagecenterfalse}}; - show-page-center=true/\setmnkey{showpagecenter}; - showpapercenter=true/\setmnkey{showpagecenter}; + show-page-center=true/\setaliaskey{showpagecenter}; + showpapercenter=true/\setaliaskey{showpagecenter}; fontsize=1cm/\aftercsname{\xwm@defaultunits{##1}}{#1fontsize}; - font-size=1cm/\setmnkey{fontsize}; fontseries=b; - font-series=b/\setmnkey{fontseries}; fontfamily=bch; - font-family=bch/\setmnkey{fontfamily}; - \needvalue{picfile}=/\aftercsname\stripallbrincs{#1picfile} + \needvalue{picfile}=/\aftercsname\xwm@stripallbrincs{#1picfile} \ifcsnnullTF{#1picfile}{\usename{#1pmarkfalse}}{\usename{#1pmarktrue} \usename{#1minmarktrue}}; - \needvalue{picture-file}=/\setmnkey{picfile}; + \needvalue{picture-file}=/\setaliaskey{picfile}; picfileext=\xwm@defaultfileext/\xwm@fileextfn{##1}{#1}; - pic-file-ext=\xwm@defaultfileext/\setmnkey{picfileext}; + pic-file-ext=\xwm@defaultfileext/\setaliaskey{picfileext}; picangle=0; - picture-angle=0/\setmnkey{picangle}; + picture-angle=0/\setaliaskey{picangle}; picscale=1; - picture-scale=1/\setmnkey{picscale}; + picture-scale=1/\setaliaskey{picscale}; picbb=0 0 100 100; - picture-bb=0 0 100 100/\setmnkey{picbb}; - pic-bounding-box=0 0 100 100/\setmnkey{picbb}; + picture-bb=0 0 100 100/\setaliaskey{picbb}; + pic-bounding-box=0 0 100 100/\setaliaskey{picbb}; picxpos=\z@pt; - picture-xpos=0/\setmnkey{picxpos}; - picture-x-position=0/\setmnkey{picxpos}; + picture-xpos=0/\setaliaskey{picxpos}; + picture-x-position=0/\setaliaskey{picxpos}; picypos=\z@pt; - picture-ypos=0/\setmnkey{picypos}; - picture-y-position=0/\setmnkey{picypos}; - mark=DRAFT/\setmnkey{textmark}; + picture-ypos=0/\setaliaskey{picypos}; + picture-y-position=0/\setaliaskey{picypos}; + mark=DRAFT/\setaliaskey{textmark}; textmark=DRAFT/ - \aftercsname\stripallbrincs{#1textmark} + \aftercsname\xwm@stripallbrincs{#1textmark} \ifcsnnullTF{#1textmark}{% \usename{#1tmarkfalse} - }{ + }{% \usename{#1tmarktrue} - } - \letcstocsn\currentmark{#1textmark}; - text-mark=DRAFT/\setmnkey{textmark}; - firstpage=true/\if@boolFT{#1firstpage}{}{\usename{#1minmarktrue}}; - first-page=true/\setmnkey{firstpage}; - allpages=true/\if@boolFT{#1allpages}{}{\usename{#1minmarktrue}}; - oddpages=true/\if@boolFT{#1oddpages}{}{\usename{#1minmarktrue}}; - evenpages=true/\if@boolFT{#1evenpages}{}{\usename{#1minmarktrue}}; + }% + \letcstocsn\currwatermark{#1textmark}; + text-mark=DRAFT/\setaliaskey{textmark}; + firstpage=true/\ifdefboolFT{#1firstpage}{}{\usename{#1minmarktrue}}; + first-page=true/\setaliaskey{firstpage}; + allpages=true/\ifdefboolFT{#1allpages}{}{\usename{#1minmarktrue}}; + oddpages=true/\ifdefboolFT{#1oddpages}{}{\usename{#1minmarktrue}}; + evenpages=true/\ifdefboolFT{#1evenpages}{}{\usename{#1minmarktrue}}; page=1/ \ifinsetTF{-}{##1}{% \xwm@err{I found '-' in '##1' for key 'page', \MsgBrk but 'page' doesn't take page-range}\@ehc - }{ + }{% \ifnum\numexpr##1=\z@pt\else\usename{#1onepageonlytrue} \usename{#1minmarktrue}\fi }; pages=1-1/ - \aftercsname\stripallbrincs{#1pages} - \aftercsname\cptstrcmp{#1pages}{0-0}{}{% + \aftercsname\xwm@stripallbrincs{#1pages} + \aftercsname\xifstrcmpTF{#1pages}{0-0}{}{% \usename{#1prangetrue}\usename{#1minmarktrue} } \cptexpandsecond\xwm@hyphenpagerange{\cptmakecs{#1pages} @@ -700,7 +725,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ }; boxalign=/\ifblankTF{##1}{} {\aftercsname\xwm@setboxalign{#1boxalign}}; - box-align=/\setmnkey{boxalign}; + box-align=/\setaliaskey{boxalign}; } \robust@def*\xwm@adddefkeys{% \begingroup @@ -714,167 +739,166 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ {\csname#2@commonkeys\endcsname{#3}#1#5}% } \xwm@adddefkeys[;]{xwm-1}{wmk@} - {\ltxkeys@definekeys*[XWM]<watermark>[wmk@]}{% + {\ltxkeys@definekeys*[XWM]{watermark}[wmk@]}{% textwidth=\paperheight; - text-width=\paperheight/\setmnkey{textwidth}; - width=\paperheight/\setmnkey{textwidth}; + text-width=\paperheight/\setaliaskey{textwidth}; + width=\paperheight/\setaliaskey{textwidth}; textheight=\paperwidth; - text-height=\paperwidth/\setmnkey{textheight}; - height=\paperwidth/\setmnkey{textheight}; + text-height=\paperwidth/\setaliaskey{textheight}; + height=\paperwidth/\setaliaskey{textheight}; \needvalue{picheight}=; - pic-height=/\setmnkey{picheight}; - picture-height=/\setmnkey{picheight}; + pic-height=/\setaliaskey{picheight}; + picture-height=/\setaliaskey{picheight}; \needvalue{picwidth}=; - picture-width=/\setmnkey{picwidth}; + picture-width=/\setaliaskey{picwidth}; textxpos=0; - text-xpos=0/\setmnkey{textxpos}; - text-x-position=0/\setmnkey{textxpos}; - xpos=0/\setmnkey{textxpos}; + text-xpos=0/\setaliaskey{textxpos}; + text-x-position=0/\setaliaskey{textxpos}; + xpos=0/\setaliaskey{textxpos}; textypos=0; - text-ypos=0/\setmnkey{textypos}; - text-y-position=0/\setmnkey{textypos}; - ypos=0/\setmnkey{textypos}; + text-ypos=0/\setaliaskey{textypos}; + text-y-position=0/\setaliaskey{textypos}; + ypos=0/\setaliaskey{textypos}; coordunit=mm/\xwm@checkcoordunit{#1}; - coord-unit=mm/\setmnkey{coordunit}; - position-unit=mm/\setmnkey{coordunit}; + coord-unit=mm/\setaliaskey{coordunit}; + position-unit=mm/\setaliaskey{coordunit}; } -\makeoption@keys*[XWM]{watermark} +\ltxkeys@makeoptionkeys*[XWM]{watermark} \xwm@adddefkeys[;]{xwm-1}{wlp@} - {\ltxkeys@definekeys*[XWM]<wallpaper>[wlp@]}{% + {\ltxkeys@definekeys*[XWM]{wallpaper}[wlp@]}{% textheight=\wlp@tileysize; - text-height=\wlp@tileysize/\setmnkey{textheight}; + text-height=\wlp@tileysize/\setaliaskey{textheight}; textwidth=\wlp@tilexsize; - text-width=\wlp@tilexsize/\setmnkey{textwidth}; + text-width=\wlp@tilexsize/\setaliaskey{textwidth}; picheight=\wlp@tileysize; - picture-height=\wlp@tileysize/\setmnkey{picheight}; + picture-height=\wlp@tileysize/\setaliaskey{picheight}; picwidth=\wlp@tilexsize; - picture-width=\wlp@tilexsize/\setmnkey{picwidth}; + picture-width=\wlp@tilexsize/\setaliaskey{picwidth}; tilexsize=.25\paperwidth; - tile-xsize=.25/\setmnkey{tilexsize}; + tile-xsize=.25/\setaliaskey{tilexsize}; tileysize=.25\paperheight; - tile-ysize=.25/\setmnkey{tileysize}; + tile-ysize=.25/\setaliaskey{tileysize}; wpxoffset=\z@pt; - wallpaper-xoffset=\z@pt/\setmnkey{wpxoffset}; + wallpaper-xoffset=\z@pt/\setaliaskey{wpxoffset}; wpyoffset=\z@pt; - wallpaper-yoffset=\z@pt/\setmnkey{wpyoffset}; + wallpaper-yoffset=\z@pt/\setaliaskey{wpyoffset}; tilexoffset=\z@pt; - tile-xoffset=\z@pt/\setmnkey{tilexoffset}; + tile-xoffset=\z@pt/\setaliaskey{tilexoffset}; tileyoffset=\z@pt; - tile-yoffset=\z@pt/\setmnkey{tileyoffset}; + tile-yoffset=\z@pt/\setaliaskey{tileyoffset}; tileno=4; - tilenumber=4/\setmnkey{tileno}; - tile-number=4/\setmnkey{tileno}; - number-of-tiles=4/\setmnkey{tileno}; + tilenumber=4/\setaliaskey{tileno}; + tile-number=4/\setaliaskey{tileno}; + number-of-tiles=4/\setaliaskey{tileno}; squaretiles=true; - square-tiles=true/\setmnkey{squaretiles}; + square-tiles=true/\setaliaskey{squaretiles}; } -\makeoption@keys*[XWM]{wallpaper} -\ltxkeys@definekeys*[XWM]<fancypagenos>[pgn@]{% +\ltxkeys@makeoptionkeys*[XWM]{wallpaper} +\ltxkeys@definekeys*[XWM]{fancypagenos}[pgn@]{% textalign=center/\xwm@settextalign\pgn@textalign; - text-align=center/\setmnkey{textalign}; - align=center/\setmnkey{textalign}; + text-align=center/\setaliaskey{textalign}; + align=center/\setaliaskey{textalign}; boxalign=/\ifblankTF{#1}{}{\xwm@setboxalign\pgn@boxalign}; - box-align=center/\setmnkey{boxalign}; + box-align=center/\setaliaskey{boxalign}; textangle=0; - text-angle=0/\setmnkey{textangle}; - angle=0/\setmnkey{textangle}; + text-angle=0/\setaliaskey{textangle}; + angle=0/\setaliaskey{textangle}; picangle=0; - picture-angle=0/\setmnkey{picangle}; + picture-angle=0/\setaliaskey{picangle}; textwidth=.25\textwidth; - text-width=.25/\setmnkey{textwidth}; - width=.25\hsize/\setmnkey{textwidth}; + text-width=.25/\setaliaskey{textwidth}; + width=.25\hsize/\setaliaskey{textwidth}; textheight=.25\textheight; - text-height=.25/\setmnkey{textheight}; - height=.25\vsize/\setmnkey{textheight}; + text-height=.25/\setaliaskey{textheight}; + height=.25\vsize/\setaliaskey{textheight}; textxpos=\z@pt; - x-position=0/\setmnkey{textxpos}; - xpos=\z@pt/\setmnkey{textxpos}; + x-position=0/\setaliaskey{textxpos}; + xposition=0/\setaliaskey{textxpos}; + xpos=\z@pt/\setaliaskey{textxpos}; textypos=\z@pt; - y-position=0/\setmnkey{textypos}; - ypos=\z@pt/\setmnkey{textypos}; + y-position=0/\setaliaskey{textypos}; + yposition=0/\setaliaskey{textypos}; + ypos=\z@pt/\setaliaskey{textypos}; textcolor=blue; - text-color=blue/\setmnkey{textcolor}; - color=blue/\setmnkey{textcolor}; + text-color=blue/\setaliaskey{textcolor}; + color=blue/\setaliaskey{textcolor}; textscale=2.5; - text-scale=2.5/\setmnkey{textscale}; - scale=2.5/\setmnkey{textscale}; + text-scale=2.5/\setaliaskey{textscale}; + scale=2.5/\setaliaskey{textscale}; coordunit=mm/\xwm@checkcoordunit{#1}; - coord-unit=mm/\setmnkey{coordunit}; - position-unit=mm/\setmnkey{coordunit}; + coord-unit=mm/\setaliaskey{coordunit}; + position-unit=mm/\setaliaskey{coordunit}; fontfamily=bch; - font-family=bch/\setmnkey{fontfamily}; fontseries=m; - font-series=m/\setmnkey{fontseries}; format=\fbox; + framerule=.4\p@; + framesep=3\p@; fontsize=12\p@/\xwm@defaultunits{#1}\pgn@fontsize; - font-size=12/\setmnkey{fontsize}; cfoot; - center-footer=/\setmnkey{cfoot}; - footer-center=/\setmnkey{cfoot}; + center-footer=/\setaliaskey{cfoot}; + footer-center=/\setaliaskey{cfoot}; rfoot; - right-footer=/\setmnkey{rfoot}; - footer-right=/\setmnkey{rfoot}; + right-footer=/\setaliaskey{rfoot}; + footer-right=/\setaliaskey{rfoot}; lfoot; - left-footer=/\setmnkey{lfoot}; - footer-left=/\setmnkey{lfoot}; + left-footer=/\setaliaskey{lfoot}; + footer-left=/\setaliaskey{lfoot}; chead; - center-header=/\setmnkey{chead}; - header-center=/\setmnkey{chead}; + center-header=/\setaliaskey{chead}; + header-center=/\setaliaskey{chead}; rhead; - right-header=/\setmnkey{rhead}; - header-right=/\setmnkey{rhead}; + right-header=/\setaliaskey{rhead}; + header-right=/\setaliaskey{rhead}; lhead; - left-header=/\setmnkey{lhead}; - header-left=/\setmnkey{lhead}; - headruleH=.4\p@; - headrule-height=.4\p@/\setmnkey{headruleH}; - headruleD=.4\p@; - head-rule-depth=.4\p@/\setmnkey{headruleD}; - headruleW=\headwidth; - headrule-width=\headwidth/\setmnkey{headruleW}; - headruleS=2\p@; - head-rule-sep=2\p@/\setmnkey{headruleS}; - head-rule-separation=2\p@/\setmnkey{headruleS}; - headruleC=blue; - headrule-color=blue/\setmnkey{headruleC}; - footruleH=.4\p@; - foot-rule-height=.4\p@/\setmnkey{footruleH}; - footruleD=.4\p@; - footrule-depth=.4\p@/\setmnkey{footruleD}; - footruleW=\headwidth; - footrule-width=\headwidth/\setmnkey{footruleW}; - footruleS=2\p@; - footrule-sep=2\p@/\setmnkey{footruleS}; - footrule-separation=2\p@/\setmnkey{footruleS}; - footruleC=cyan; - footrule-color=blue/\setmnkey{footruleC}; - hfoffsetL=.5; - hfoffset-left=.5/\setmnkey{hfoffsetL}; - hfoffsetR=.5; - hfoffset-right=.5/\setmnkey{hfoffsetR}; + left-header=/\setaliaskey{lhead}; + header-left=/\setaliaskey{lhead}; + headruleheight=.4\p@; + headrule-height=.4\p@/\setaliaskey{headruleheight}; + headruledepth=.4\p@; + headrule-depth=.4\p@/\setaliaskey{headruledepth}; + headrulewidth=\headwidth; + headrule-width=\headwidth/\setaliaskey{headrulewidth}; + headrulesep=2\p@; + headrule-sep=2\p@/\setaliaskey{headrulesep}; + headrule-separation=2\p@/\setaliaskey{headrulesep}; + headrulecolor=blue; + headrule-color=blue/\setaliaskey{headrulecolor}; + footruleheight=.4\p@; + footrule-height=.4\p@/\setaliaskey{footruleheight}; + footruledepth=.4\p@; + footrule-depth=.4\p@/\setaliaskey{footruledepth}; + footrulewidth=\headwidth; + footrule-width=\headwidth/\setaliaskey{footrulewidth}; + footrulesep=2\p@; + footrule-sep=2\p@/\setaliaskey{footrulesep}; + footrule-separation=2\p@/\setaliaskey{footrulesep}; + footrulecolor=cyan; + footrule-color=blue/\setaliaskey{footrulecolor}; + hfoffsetleft=.5; + hfoffset-left=.5/\setaliaskey{hfoffsetleft}; + hfoffsetright=.5; + hfoffset-right=.5/\setaliaskey{hfoffsetright}; style=\thepage; - printstyle=\thepage/\setmnkey{style}; - print-style=\thepage/\setmnkey{style}; + printstyle=\thepage/\setaliaskey{style}; sendtoback=true; - send-to-back=true/\setmnkey{sendtoback}; } -\makeoption@keys*[XWM]{fancypagenos} -\ltxkeys@definekeys*[XWM]<fancypagenos>[pgn@]{% +\ltxkeys@makeoptionkeys*[XWM]{fancypagenos} +\ltxkeys@definekeys*[XWM]{fancypagenos}[pgn@]{% showpagenos=true/\ifpgn@showpagenos\global\pgn@showpagenostrue\fi; - show-page-numbers=true/\setmnkey{showpagenos}; - show-pagenos=true/\setmnkey{showpagenos}; - show-pageno=true/\setmnkey{showpagenos}; + showpagenumbers=true/\setaliaskey{showpagenos}; + show-page-numbers=true/\setaliaskey{showpagenos}; + show-pagenos=true/\setaliaskey{showpagenos}; + show-pageno=true/\setaliaskey{showpagenos}; showonpageone=true; - show-on-page-1=true/\setmnkey{showonpageone}; - show-on-page-one=true/\setmnkey{showonpageone}; + show-on-page-one=true/\setaliaskey{showonpageone}; showheadrule=true; - show-headrule=true/\setmnkey{showheadrule}; + show-headrule=true/\setaliaskey{showheadrule}; showfootrule=true; - show-footrule=true/\setmnkey{showfootrule}; + show-footrule=true/\setaliaskey{showfootrule}; } \BeforeStartOfDocument{% \ifpgn@showpagenos - \cptreplaceoneelement\XWM@fancypagenos@initial@keyvals + \cptreplaceoneelement\XWM@fancypagenos@initialkeyvals {showpagenos=false}{showpagenos=true}% \fi } @@ -951,7 +975,8 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ }% } \robust@def*\xnewwatermark{% - \cpt@teststpm{\cpt@testopt\cpt@xnewwatermark{}}% + \xwm@suffixcheck + {\cpt@teststpm{\cpt@testopt\cpt@xnewwatermark{}}}% } \robust@def*\xwm@ltxcmds{% \centering,\flushright,\flushleft,\raggedright,% @@ -961,7 +986,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ } \robust@def*\xwm@relaxltxcmds{% \def\ltxkeys@do##1{\let##1=\relax}% - \ltxkeys@csvparse*\xwm@ltxcmds + \ltxkeys@parse*1\xwm@ltxcmds } \robust@def*\cpt@xnewwatermark[#1]#2{% \begingroup @@ -1009,7 +1034,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ }% } \robust@def\xwm@n@wwatermark[#1]#2{% - \if@boolTF{cpt@pm}{}{\xwm@n@ww@termark{#1}{#2}}% + \ifboolTF{cpt@pm}{}{\xwm@n@ww@termark{#1}{#2}}% } \robust@def\xwm@n@ww@termark#1#2{% \xwm@decidexp{#1}% @@ -1033,7 +1058,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ while option 'allownesting' is false}\@ehc \fi \fi - \if@boolTF{xwm@wall}{}{% + \ifboolTF{xwm@wall}{}{% \xwmifitemsinFT[1]{% squaretiles,square-tiles,tilexsize,tile-xsize,% tileysize,tile-ysize,wpxoffset,wallpaper-xoffset,% @@ -1045,7 +1070,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \MsgBrk non-wallpaper watermarks}\@ehc }% }% - \if@boolTF{xwm@allownesting}{}{% + \ifboolTF{xwm@allownesting}{}{% \cpt@choicefdfalse \def\csv@do##1{% \xifinsetFT{,\detokenize{##1}}{,\xwm@detok{#2}}{}{% @@ -1091,7 +1116,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ }% \expandafter\edef\reserved@a{% \expandafter\ifdefTF\reserved@a{\expandcstwice\reserved@a}{}% - \expandcsonce\currentmark + \expandcsonce\currwatermark }% \undefcs\xwm@xp\undefcs\xwm@detok } @@ -1118,10 +1143,10 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \if@tempswa textmark={\expandcsonce\xwm@currmark}\fi }% \ifcsemptyTF\xwm@tempb{}{\xwm@normdoublecomma\xwm@tempb}% - \edef\currentmark{% - \expandcsonce\currentmark{\number#1}{\expandcsonce\xwm@tempb}% + \edef\currwatermark{% + \expandcsonce\currwatermark{\number#1}{\expandcsonce\xwm@tempb}% }% - \postgroupdef\currentmark\endgroup + \postgroupdef\currwatermark\endgroup } \robust@def*\xwm@getpagespec#1{% \ifinsetTF{,#1,}{,page,pages,pagex,}{% @@ -1159,19 +1184,18 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \robust@def*\xwm@ifpagespec#1{% \cptexpandtwoargs\cpt@in {,\detokenize{#1}}{,\cptoxdetok\xwm@currattrib}% - \if@boolTF{cpt@in}\@iden\@gobble + \ifboolTF{cpt@in}\@iden\@gobble } \robust@def*\xwm@normdoublecomma#1{% \def\xwm@tempa##1,,##2\xwm@@nil{% - \ifblankTF{##2} - {\edef#1{\unexpanded{##1}}} + \ifblankTF{##2}{\edef#1{\unexpanded{##1}}} {\xwm@tempa##1,##2\xwm@@nil}% }% \expandafter\xwm@tempa#1,,\xwm@@nil } \robust@def*\xwm@makecurrmark{% \edef\xwm@rsvda{\lastdocpage}% - \def\currentmark{}% + \def\currwatermark{}% \xwm@swafalse \xwm@ifpagespec{page=}{% \xwm@twopagespecerr @@ -1185,15 +1209,15 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \xwm@cnta\numexpr\xwm@pagestart\relax \cptloop \xwm@addcurrmark\xwm@cnta - \advance\xwm@cnta by1 + \advance\xwm@cnta by1 % \ifnum\xwm@cnta<\numexpr\xwm@pageend+1\relax - \repeat + \cptrepeat }% \xwm@ifpagespec{pagex=}{% \xwm@twopagespecerr \xwm@getpagespec{pagex}% \def\ltxkeys@do##1{\xwm@addcurrmark{##1}}% - \ltxkeys@csvparse*\xwm@currpage + \ltxkeys@parse*1\xwm@currpage }% \xwm@ifpagespec{firstpage}{% \xwm@twopagespecerr @@ -1215,19 +1239,19 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \fi \advance\xwm@cnta by1 \ifnum\xwm@cnta<\numexpr\xwm@rsvda+1\relax - \repeat + \cptrepeat }% \xwm@ifpagespec{oddpages}{% \xwm@twopagespecerr \xwm@getpagespec{oddpages}% - \xwm@cnta\z@ + \xwm@cnta\z@pt \cptloop \ifodd\xwm@cnta \xwm@addcurrmark\xwm@cnta \fi - \advance\xwm@cnta by1 + \advance\xwm@cnta by1 % \ifnum\xwm@cnta<\numexpr\xwm@rsvda+1\relax - \repeat + \cptrepeat }% \ifxwm@swa\else \xwm@err{No page specifier in watermark attributes: @@ -1240,7 +1264,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ {'\string\newwatermark' in front of \string\dummywatermark}% {First comment out or remove '\string\newwatermark'.}% }{% - \if@boolTF{xwm@usedummymarks}\newwatermark\xwm@dummywatermark + \ifboolTF{xwm@usedummymarks}\newwatermark\xwm@dummywatermark #1% }% } @@ -1250,7 +1274,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ {'\string\newwallpaper' in front of \string\dummywallpaper}% {First comment out or remove '\string\newwallpaper'.}% }{% - \if@boolTF{xwm@usedummymarks}\newwallpaper\xwm@dummywatermark + \ifboolTF{xwm@usedummymarks}\newwallpaper\xwm@dummywatermark #1% }% } @@ -1276,7 +1300,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \catcode`\\\z@pt \catcode`\{\@ne \catcode`\}\tw@ - \if@boolTF{xwm@printwatermark}{% + \ifboolTF{xwm@printwatermark}{% \let\xwm@watermarklist\xwm@backwmklist \let\xwm@wallpaperlist\xwm@backwalllist \AtBeginShipoutUpperLeft{% @@ -1357,10 +1381,10 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ } \robust@def*\xwm@textpicmark@a{% \ifcsnullTF\xwm@watermarklist{% - \if@boolTF{xwm@foregrd}{}{% - \if@boolFT{xwm@printwatermark}{}{% - \if@boolTF{xwm@draft}{% - \if@boolTF{wmk@showpagecenter}{}{% + \ifboolTF{xwm@foregrd}{}{% + \ifdefboolFT{xwm@printwatermark}{}{% + \ifboolTF{xwm@draft}{% + \ifboolTF{wmk@showpagecenter}{}{% \ifnumcmpFT\c@page=\@ne{}{% \cptexpandargonce{\ltxkeys@setkeys[XWM]{watermark}}% \xwm@perpagewmkstate @@ -1384,7 +1408,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ }{% \xwm@processmarks\xwm@watermarklist{% \xwm@setwatermarkkeys{watermark}{wmk}{##2}% - \if@boolFT{wmk@minmark}{}\xwm@textpicmark@c + \ifdefboolFT{wmk@minmark}{}\xwm@textpicmark@c }% }% } @@ -1392,7 +1416,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \ifcsnullTF\xwm@wallpaperlist{}{% \xwm@processmarks\xwm@wallpaperlist{% \xwm@setwatermarkkeys{wallpaper}{wall}{##2}% - \if@boolFT{wlp@minmark}{}\xwm@wallpaper@c + \ifdefboolFT{wlp@minmark}{}\xwm@wallpaper@c }% }% } @@ -1403,7 +1427,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ }{% [\ltxkeys@keynames]{\expandcsnonce{xwm@perpage#2state}}% }% - \edef\currentmark{\unexpanded{#3}}% + \edef\currwatermark{\unexpanded{#3}}% \ifblankTF{#3}{}{\ltxkeys@setkeys[XWM]{#1}{#3}}% } \robust@def*\xwm@processmarks#1#2{% @@ -1444,7 +1468,6 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \nxp\parbox[c][\mcs{#1@textheight}]% [c]\mcs{#1@textwidth}{% \nxp\color{\mcs{#1@textcolor}}% - % First convert \fontsize to scaled points: \cptdimdef\mcs{#1@fontsize@a}{\mcs{#1@fontsize}}% \cptdimdef\mcs{#1@fontsize@a}% {1.5\p@*\mcs{#1@fontsize@a}}% @@ -1452,9 +1475,10 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \nxp\fontseries\mcs{#1@fontseries}% \nxp\fontsize\mcs{#1@fontsize}\mcs{#1@fontsize@a}% \nxp\selectfont - \noexpand\begin{\xwm@curralign}% + \quitvmode + \nxp\begin{\xwm@curralign}% \mcs{#1@textmark}% - \noexpand\end{\xwm@curralign}% + \nxp\end{\xwm@curralign}% }% }% }% @@ -1494,7 +1518,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \xwm@put(\wmk@picxpos@a,\wmk@picypos@a){% \rotatebox[origin=c]\wmk@picangle{% \cptexpandsecond{\makebox(0,0)}{[\wmk@boxalign]{% - \if@boolTF{xwm@draft} + \ifboolTF{xwm@draft} {\xwm@draftbox{wmk}}{\copy\xwm@boxa}% }% }% @@ -1521,14 +1545,14 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \newcommand*\xwm@textpicmark@c{% \xwm@getposition\wmk@textxpos\wmk@textypos\wmk@coordunit \xwm@getposition\wmk@picxpos\wmk@picypos\wmk@coordunit - \if@boolTF{wmk@picontoptext}{% - \if@boolFT{wmk@tmark}{}{\xwm@textbox{wmk}}% - \if@boolFT{wmk@pmark}{}\xwm@picmark + \ifboolTF{wmk@picontoptext}{% + \ifdefboolFT{wmk@tmark}{}{\xwm@textbox{wmk}}% + \ifdefboolFT{wmk@pmark}{}\xwm@picmark }{% - \if@boolFT{wmk@pmark}{}\xwm@picmark - \if@boolFT{wmk@tmark}{}{\xwm@textbox{wmk}}% + \ifdefboolFT{wmk@pmark}{}\xwm@picmark + \ifdefboolFT{wmk@tmark}{}{\xwm@textbox{wmk}}% }% - \if@boolFT{wmk@showpagecenter}{}\xwm@papercenter + \ifdefboolFT{wmk@showpagecenter}{}\xwm@papercenter } \AtBeginDocument{% \ifdefTF\Ginput@path{% @@ -1554,11 +1578,11 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \robust@def*\xwm@w@term@rkpaths#1(#2)#3{% \cpt@useemptytrue \def\xwm@tempa{#3}% - \if@boolTF{cpt@st}{% - \ifbracedTF{#3}{\stripallbr{#3}\xwm@tempa}{}% + \ifboolTF{cpt@st}{% + \ifbracedTF{#3}{\xwm@stripallbr{#3}\xwm@tempa}{}% \def\csv@do##1{% \ifbracedTF{##1}{% - \stripallbr{##1}\xwm@tempa + \xwm@stripallbr{##1}\xwm@tempa }{% \def\xwm@tempa{##1}% }% @@ -1584,7 +1608,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \newletcs\watermarkpath=\watermarkpaths \new@def*\xwmifeofTF#1{\ifcondTF\ifeof#1\fi} \robust@def*\pdfiffileexistsTF#1{% - \cptifcondFT\if\pdffilesize{#1}\relax\fi + \ifcondFT\if\pdffilesize{#1}\relax\fi } \robust@def*\xwmiffileexistsTF#1{% \openin\@inputcheck#1\@space @@ -1607,7 +1631,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \let\xwm@pathfound\@empty \cpt@choicefdfalse \def\tsv@do##1{% - \stripallbr{##1}\xwm@tempa + \xwm@stripallbr{##1}\xwm@tempa \openin\@inputcheck\xwm@tempa#1\@space \xwmifeofTF\@inputcheck{}{% \let\xwm@pathfound\xwm@tempa @@ -1617,7 +1641,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ }% }% \tsv@@loop*\xwm@inputpath - \if@boolTF{cpt@choicefd}\@firstoftwo\@secondoftwo + \ifboolTF{cpt@choicefd}\@firstoftwo\@secondoftwo } \robust@def*\xwm@nofileerr#1#2{% \message{% @@ -1646,7 +1670,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \robust@def*\xwm@findpicfile#1#2{% \let\xwm@filefound\@empty \edef\xwm@filegiven{#1.#2}% - \if@boolTF{xwm@pdf}{% + \ifboolTF{xwm@pdf}{% \xwm@f@ndpicfile{#1}{#2}{pdf,png,jpeg,mps}% }{% \xwm@f@ndpicfile{#1}{#2}{eps,ps}% @@ -1666,8 +1690,8 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ }% \csv@@loop[,]{#3}% }% - \if@boolTF{xwm@swb}{}{% - \if@boolTF{xwm@swa}{% + \ifboolTF{xwm@swb}{}{% + \ifboolTF{xwm@swa}{% \xwm@warn{File '\xwm@filegiven' doesn't exist \MsgBrk on given path(s) '\xwm@inputpath', \MsgBrk but I have found \xwm@filefound'}% @@ -1678,23 +1702,23 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ }% } \robust@def*\xwm@wallpaper@c{% - \if@boolTF{wlp@picontoptext}{% + \ifboolTF{wlp@picontoptext}{% \xwm@textwallpaper \xwm@picwallpaper }{% \xwm@picwallpaper \xwm@textwallpaper }% - \if@boolFT{wlp@showpagecenter}{}\xwm@papercenter + \ifdefboolFT{wlp@showpagecenter}{}\xwm@papercenter } \robust@def*\xwm@textwallpaper{% - \if@boolFT{wlp@tmark}{}{% - \if@boolTF{wlp@squaretiles}\xwm@sqtexttiles\xwm@texttiles + \ifdefboolFT{wlp@tmark}{}{% + \ifboolTF{wlp@squaretiles}\xwm@sqtexttiles\xwm@texttiles }% } \robust@def*\xwm@picwallpaper{% - \if@boolFT{wlp@pmark}{}{% - \if@boolTF{wlp@squaretiles}% + \ifdefboolFT{wlp@pmark}{}{% + \ifboolTF{wlp@squaretiles}% \xwm@sqpictiles\xwm@pictiles }% } @@ -1709,7 +1733,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \xwm@put(\tilex,\xwm@tempa){\rotatebox[origin=c] \xwm@currangle{% \cptexpandsecond{\makebox(0,0)}{[\wlp@boxalign]}{% - \if@boolTF{xwm@draft} + \ifboolTF{xwm@draft} {\xwm@draftbox{wlp}}{\copy\xwm@boxa}% }% }}% @@ -1767,6 +1791,20 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \let\xwm@currangle\wlp@picangle \xwm@dotiling } +\robust@def*\xwmsetbox#1#2#3#4{% + \begingroup + \setbox1\hbox{\color@begingroup#4\color@endgroup}% + \setbox\@tempboxa\hbox to#1\textwidth{% + \setbox0\vtop{% + \ignorespaces#4\vskip\dimexpr#3\textheight/2\relax + }% + \cptdimdef\x{(#1\textwidth-\wd1)/2\relax}% + \hskip\x\box0\hskip-\x + }% + \ht\@tempboxa=\dimexpr#2\textheight/2\relax + \noindent\box\@tempboxa + \endgroup +} \robust@def*\xwmstrut#1#2{% \relax\unskip \ifhmode\nobreak\fi @@ -1775,45 +1813,52 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \ifmmode\copy\@tempboxa\else\unhcopy\@tempboxa\fi \endgroup } -\ltxkeys@definekeys*[XWM]<boxedminipage>[xwmbmp@]{% - width=\paperwidth; +\ltxkeys@definekeys*[XWM]{boxedminipage}[xwmbmp@]{% + width=\textwidth; textcolor=black; framecolor=black; framesep=3\p@; framerule=0.4\p@; height=\z@pt; depth=\z@pt; - width=\paperwidth; - textalign=center/\xwm@settextalign\xwmbmp@textalign; - text-align=center/\setmnkey{textalign}; + textalign=justified/\xwm@settextalign\xwmbmp@textalign; + innerpos=c; } \robust@def*\xwmboxedminipage{\cpt@testopt\xwm@boxedminipage{}} \begingroup \catcode`\|=\catcode`\% -\robust@gdef\xwm@boxedminipage[#1]#2{% +\robust@gdef*\xwm@boxedminipage[#1]{% \ltxkeys@launchkeys[XWM]{boxedminipage}{#1}% - \stripallbrincs\xwmbmp@width - \stripallbrincs\xwmbmp@textcolor + \xwm@stripallbrincs\xwmbmp@width + \xwm@stripallbrincs\xwmbmp@textcolor \leavevmode\@pboxswfalse \begingroup \color{\xwmbmp@framecolor}% - \xifstrcmpTF\xwmbmp@innerpos{b}\vbox{% - \xifstrcmpTF\xwmbmp@innerpos{t}\vtop{% - \if@boolTF{mmode}\vcenter{% + \xifstrcmpTF\xwmbmp@innerpos{b}{% + \vbox + }{% + \xifstrcmpTF\xwmbmp@innerpos{t}{% + \vtop + }{% + \ifboolTF{mmode}{% + \vcenter + }{% \@pboxswtrue $\vcenter |$ }% }% }% - \bgroup - \hsize\xwmbmp@width + {\ifnum`}=0\fi + \hsize\xwmbmp@width\relax \hrule\@height\xwmbmp@framerule - \hbox\bgroup - \vrule\@width\xwmbmp@framerule\hskip\xwmbmp@framesep - \vbox\bgroup - \vskip\xwmbmp@framesep - \cptdimdef\xwm@dima{\hsize-2\xwmbmp@framerule-2\xwmbmp@framesep}% - \hsize\xwm@dima - \textwidth\xwm@dima\columnwidth\xwm@dima + \hbox{\ifnum`}=0\fi + \vrule\@width\xwmbmp@framerule + \kern\xwmbmp@framesep\relax + \vbox{\ifnum`}=0\fi + \vskip\xwmbmp@framesep\relax + \cptdimdef\reserved@a{\hsize-(\xwmbmp@framerule+\xwmbmp@framesep)*2}% + \hsize\reserved@a\relax + \textwidth\reserved@a\relax + \columnwidth\reserved@a\relax \@parboxrestore \c@mpfootnote\z@pt \let\@footnotetext\@mpfootnotetext @@ -1822,28 +1867,31 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \everypar{\global\@minipagefalse\everypar{}}% \leavevmode\@killglue \xwmstrut\xwmbmp@height\z@pt - \noindent\xwmbmp@textcolor + \noindent\color{\xwmbmp@textcolor}% \begin\xwmbmp@textalign + \ignorespaces } -\robust@def\endxwmboxedminipage{% +\robust@gdef*\endxwmboxedminipage{% \end\xwmbmp@textalign \xwmstrut\z@pt\xwmbmp@depth \ifvoid\@mpfootins\else \vskip\skip\@mpfootins\footnoterule\unvbox\@mpfootins \fi - \vskip\xwmbmp@framesep - \egroup - \hskip\xwmbmp@framesep\vrule\@width\xwmbmp@framerule - \egroup + \vskip\xwmbmp@framesep\relax + \ifnum`{=0\fi}% + \kern\xwmbmp@framesep\relax + \vrule\@width\xwmbmp@framerule + \ifnum`{=0\fi}% \hrule\@height\xwmbmp@framerule - \egroup + \ifnum`{=0\fi}% \if@pboxsw\m@th$\fi |$ - \leavevmode\@killglue\@ignoretrue + \leavevmode\@killglue \endgroup + \@ignoretrue } \endgroup -\ltxkeys@definekeys*[XWM]<minipage>[xwmmp@]{% +\ltxkeys@definekeys*[XWM]{minipage}[xwmmp@]{% width=\paperwidth; textcolor=black; framecolor=black; @@ -1851,27 +1899,26 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ framerule=0.4\p@; height=\z@pt; depth=\z@pt; - width=\hsize; textalign=center/\xwm@settextalign\xwmmp@textalign; - text-align=center/\setmnkey{textalign}; + text-align=center/\setaliaskey{textalign}; framebox=true; - insertframe=true/\setmnkey{framebox}; - insert-frame=true/\setmnkey{framebox}; + insertframe=true/\setaliaskey{framebox}; + insert-frame=true/\setaliaskey{framebox}; } \robust@def*\xwmminipage{\cpt@testopt\xwm@minipage{}} \robust@def\xwm@minipage[#1]#2{% \ltxkeys@launchkeys[XWM]{minipage}{#1}% - \stripallbrincs\xwmmp@width - \stripallbrincs\xwmmp@textcolor - \edef\sav@fboxsep{\the\fboxsep}% - \edef\sav@fboxrule{\the\fboxrule}% - \fboxsep\xwmmp@framesep\fboxrule\xwmmp@framerule + \xwm@stripallbrincs\xwmmp@width + \xwm@stripallbrincs\xwmmp@textcolor + \xwm@pushboxframe + \fboxsep\xwmmp@framesep\fboxrule\xwmmp@framerule\relax \cptdimdef\xwmmp@boxwidth{\xwmmp@width-2\fboxsep-2\fboxrule}% \def\xwm@printbox{% \color{\xwmmp@framecolor}% \ifxwmmp@framebox\fbox{\fi \usebox\xwm@boxa \ifxwmmp@framebox}\fi + \xwm@popboxframe }% \@killglue\noindent \begin{lrbox}\xwm@boxa @@ -1888,32 +1935,33 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \end{lrbox}% \@ignoretrue\@killglue\noindent \xwm@printbox - \fboxsep\sav@fboxsep\fboxrule\sav@fboxrule - \normalcolor\@ignoretrue + \normalcolor + \@ignoretrue } -\ltxkeys@definekeys*[XWM]<colorbox>[xwmcbx@]{% +\ltxkeys@definekeys*[XWM]{colorbox}[xwmcbx@]{% width=\textwidth; height=\z@pt; depth=\z@pt; framebox=true; - insertframe=true/\setmnkey{framebox}; - insert-frame=true/\setmnkey{framebox}; + insertframe=true/\setaliaskey{framebox}; + insert-frame=true/\setaliaskey{framebox}; textcolor=black; fillcolor=white; outerframecolor=black; - outer-frame-color=black/\setmnkey{outerframecolor}; + outer-frame-color=black/\setaliaskey{outerframecolor}; innerframecolor=black; - inner-frame-color=black/\setmnkey{innerframecolor}; + inner-frame-color=black/\setaliaskey{innerframecolor}; framesep=3\p@; framerule=0.4\p@; textalign=center/\xwm@settextalign\xwmcbx@textalign; - align=center/\setmnkey{textalign}; - text-align=center/\setmnkey{textalign}; + align=center/\setaliaskey{textalign}; + text-align=center/\setaliaskey{textalign}; } \robust@def*\xwmcolorbox{\cpt@testopt\xwm@colorbox{}} \robust@def\xwm@colorbox[#1]#2{% \ltxkeys@launchkeys[XWM]{colorbox}{#1}% - \fboxsep\xwmcbx@framesep\fboxrule\xwmcbx@framerule + \xwm@pushboxframe + \fboxsep\xwmcbx@framesep\fboxrule\xwmcbx@framerule\relax \removelastskip\noindent \fcolorbox{\xwmcbx@outerframecolor}{\xwmcbx@fillcolor}{% \cptexpandsecond\xwmminipage{[textalign=\xwmcbx@textalign, @@ -1922,10 +1970,11 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ height=\xwmcbx@height,depth=\xwmcbx@depth, textcolor=\xwmcbx@textcolor,framebox=true]}{#2}% }% + \xwm@popboxframe \removelastskip \normalcolor } -\ltxkeys@definekeys*[XWM]<makecolorbox>[xwmmbx@]{% +\ltxkeys@definekeys*[XWM]{makecolorbox}[xwmmbx@]{% width=\textwidth; height=\z@pt; depth=\z@pt; @@ -1933,24 +1982,24 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ textcolor=black; fillcolor=white; outerframecolor=black; - outer-frame-color=black/\setmnkey{outerframecolor}; + outer-frame-color=black/\setaliaskey{outerframecolor}; innerframecolor=black; - inner-frame-color=black/\setmnkey{innerframecolor}; + inner-frame-color=black/\setaliaskey{innerframecolor}; framesep=3\p@; framerule=0.4\p@; textalign=center/\xwm@settextalign\xwmmbx@textalign; - align=center/\setmnkey{textalign}; - text-align=center/\setmnkey{textalign}; + align=center/\setaliaskey{textalign}; + text-align=center/\setaliaskey{textalign}; boxalign=center/\xwm@settextalign\xwmmbx@boxalign; } - \robust@def*\makecolorbox{\cpt@testopt\xwm@makecolorbox{}} \robust@def*\xwm@makecolorbox[#1]#2{% \ltxkeys@launchkeys[XWM]{makecolorbox}{#1}% \begin{\xwmmbx@boxalign}% \makebox[\z@pt][c]{% \xwmstrut\xwmmbx@height\z@pt - \fboxsep\xwmmbx@framesep\fboxrule\xwmmbx@framerule + \xwm@pushboxframe + \fboxsep\xwmmbx@framesep\fboxrule\xwmmbx@framerule\relax \fcolorbox{\xwmmbx@outerframecolor}{\xwmmbx@fillcolor}{% \cptexpandsecond\xwmminipage{[textalign=\xwmmbx@textalign, framesep=\xwmmbx@framesep,framerule=\xwmmbx@framerule, @@ -1959,13 +2008,14 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ textcolor=\xwmmbx@textcolor,framebox= \thebool@normal{xwmmbx@framebox}]}{#2}% }% + \xwm@popboxframe \xwmstrut\z@pt\xwmmbx@depth }% \end{\xwmmbx@boxalign}% \removelastskip \normalcolor } -\ltxkeys@definekeys*[XWM]<shade>[xwmshd@]{% +\ltxkeys@definekeys*[XWM]{shade}[xwmshd@]{% width=\hsize; leftadjust=\z@pt; indent=\z@pt; @@ -1982,7 +2032,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \def\FrameCommand{% \clubpenalty\@m\widowpenalty\@m \noindent\kern\xwmshd@leftadjust - \fboxrule\xwmshd@framerule\fboxsep\xwmshd@framesep + \fboxrule\xwmshd@framerule\fboxsep\xwmshd@framesep\relax \fcolorbox{\xwmshd@framecolor}{\xwmshd@fillcolor}% }% \parindent\z@pt\finalhyphendemerits\z@pt @@ -2005,7 +2055,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \xwmstrut\z@pt\xwmshd@depth \par\unskip\endMakeFramed\@ignoretrue } -\ltxkeys@definekeys*[XWM]<fadingtext>[fad@]{% +\ltxkeys@definekeys*[XWM]{fadingtext}[fad@]{% textcolor=white; boxcolor=black; scale=1; @@ -2076,30 +2126,30 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \rhead{\pgn@rhead}\lhead{\pgn@lhead}% \ifpgn@showheadrule \def\headrule{{% - \color{\pgn@headruleC}% - \hrule\@height\pgn@headruleH\@depth\pgn@headruleD - \@width\headwidth\vspace{\pgn@headruleS}% - \hrule\@height\pgn@headruleH\@depth\pgn@headruleD - \@width\headwidth\vspace{-\pgn@headruleS}% + \color{\pgn@headrulecolor}% + \hrule\@height\pgn@headruleheight\@depth\pgn@headruledepth + \@width\headwidth\vspace{\pgn@headrulesep}% + \hrule\@height\pgn@headruleheight\@depth\pgn@headruledepth + \@width\headwidth\vspace{-\pgn@headrulesep}% }}% \else \let\headrule\relax \fi \ifpgn@showfootrule \def\footrule{{% - \color{\pgn@footruleC}% - \hrule\@height\pgn@footruleH\@depth\pgn@footruleD - \@width\headwidth\vspace{\pgn@footruleS}% - \hrule\@height\pgn@footruleH\@depth\pgn@footruleD - \@width\headwidth\vspace{\pgn@footruleS}% + \color{\pgn@footrulecolor}% + \hrule\@height\pgn@footruleheight\@depth\pgn@footruledepth + \@width\headwidth\vspace{\pgn@footrulesep}% + \hrule\@height\pgn@footruleheight\@depth\pgn@footruledepth + \@width\headwidth\vspace{\pgn@footrulesep}% }}% \else \let\footrule\relax \fi - \xwm@gethfoffset\pgn@hfoffsetL\pgn@hfoffsetR + \xwm@gethfoffset\pgn@hfoffsetleft\pgn@hfoffsetright \fancyhfoffset[R,L]\xwm@hfoffset \AtBeginShipout{% - \if@boolTF{pgn@sendtoback}{% + \ifboolTF{pgn@sendtoback}{% \AtBeginShipoutUpperLeft{% \xwm@f@ncyp@genos }% @@ -2110,14 +2160,22 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ }% }% } +\newswitch{xwm@fancy} \robust@def*\xwm@f@ncypagenos{% - \def\pgn@textmark{\pgn@format{\normalfont\pgn@style}}% + \def\pgn@textmark{% + \begingroup + \fboxrule\pgn@framerule\fboxsep\pgn@framesep\relax + \pgn@format{\normalfont\pgn@style}% + \endgroup + }% + \switchtrue{xwm@fancy}% \xwm@textbox{pgn}% + \switchfalse{xwm@fancy}% } \robust@def*\xwm@f@ncyp@genos{% - \if@boolFT{pgn@showpagenos}{}{% + \ifboolFT{pgn@showpagenos}{}{% \ifnumcmpTF\c@page=\@ne{% - \ifpgn@showonpageone\xwm@f@ncypagenos\fi + \ifboolTF{pgn@showonpageone}\xwm@f@ncypagenos\relax }{% \xwm@f@ncypagenos }% @@ -2127,7 +2185,7 @@ $Id: xwatermark.sty,v 1.5.1 2011/07/30 09:00:00 Ahmed Musa Exp $ \begingroup \def\temp@err{% \xwm@err{Only digits (without units) are allowed\MsgBrk - in the values of 'hfoffsetL' and 'hfoffsetR'}\@ehc + in the values of 'hfoffsetleft' and 'hfoffsetright'}\@ehc }% \xifblankTF{#1}{}{% \x@xwmifitemsinTF\xwm@allowedcoordunits{#1}\temp@err{}% |