summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/xwatermark
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-01-13 00:04:39 +0000
committerKarl Berry <karl@freefriends.org>2010-01-13 00:04:39 +0000
commit8ef4b34298b082adaed9714c182beb730e8aafeb (patch)
treee8983a766e40bb6185850d1506e57dde7ad447d4 /Master/texmf-dist/tex/latex/xwatermark
parentbf3ee8e4da13507d79b5af06868c9a3b1eb456db (diff)
xwatermark update (12jan10)
git-svn-id: svn://tug.org/texlive/trunk@16691 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/xwatermark')
-rw-r--r--Master/texmf-dist/tex/latex/xwatermark/keyreader.sty113
-rw-r--r--Master/texmf-dist/tex/latex/xwatermark/xwatermark.sty247
2 files changed, 124 insertions, 236 deletions
diff --git a/Master/texmf-dist/tex/latex/xwatermark/keyreader.sty b/Master/texmf-dist/tex/latex/xwatermark/keyreader.sty
deleted file mode 100644
index 1de651a1221..00000000000
--- a/Master/texmf-dist/tex/latex/xwatermark/keyreader.sty
+++ /dev/null
@@ -1,113 +0,0 @@
-%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
-% This is file 'keyreader.sty', version 0.1. %
-% %
-% This package reads multiple keys to be defined by xkeyval.sty. %
-% %
-% 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 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. %
-% %
-% The LPPL maintenance status of this software is 'author-maintained'. %
-% %
-% This software is provided 'as it is', without warranty of any kind, %
-% either expressed or implied, including, but not limited to, the %
-% implied warranties of merchantability and fitness for a particular %
-% purpose. %
-% %
-% Copyright (c) 2009 Ahmed Musa (a.musa@rocketmail.com). %
-%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
-\begingroup
-\catcode064=11% @
-\catcode123=01% {
-\catcode125=02% }
-\def\x{\endgroup
- \edef\kr@restorecodeatend{%
- \catcode035=\the\catcode035\relax
- \catcode064=\the\catcode064\relax
- \catcode123=\the\catcode123\relax
- \catcode125=\the\catcode125\relax
- }%
-}
-\x
-\catcode035=06% #
-\catcode064=11% @
-\catcode123=01% {
-\catcode125=02% }
-\def\kr@ensurecode#1#2{%
- \edef\kr@restorecodeatend{%
- \kr@restorecodeatend
- \catcode#1=\the\catcode#1\relax
- }%
- \catcode#1=#2\relax
-}
-\AtEndOfPackage{\kr@restorecodeatend}
-\kr@ensurecode{044}{12}% ,
-\kr@ensurecode{059}{12}% ;
-\kr@ensurecode{038}{03}% &
-\ProvidesPackage{keyreader}%
- [2009/12/15 v0.1 Read keys for the xkeyval package (AM)]
-\NeedsTeXFormat{LaTeX2e}[1996/12/01]
-\RequirePackage{xkeyval}[2008/08/13]
-\newcommand\kr@warn[1]{\PackageWarningNoLine{keyreader}{#1}}
-\newcommand\kr@err[1]{\PackageError{keyreader}{#1}{\@ehc}}
-\define@cmdkey[KV]{keyreader}[kr@]{parser}[;]{}
-\define@cmdkey[KV]{keyreader}[kr@]{keyprefix}[KV]{}
-\define@cmdkey[KV]{keyreader}[kr@]{keyfamily}[fam]{}
-\define@cmdkey[KV]{keyreader}[kr@]{macroprefix}[mp@]{}
-\DeclareOptionX*{\kr@warn{Unknown option '\CurrentOption' ignored}}
-\ExecuteOptionsX[KV]<keyreader>{parser,keyprefix,keyfamily,macroprefix}
-\ProcessOptionsX*[KV]<keyreader>\relax
-\@ifdefinable\krsetup{%
- \def\krsetup#1{\setkeys[KV]{keyreader}{#1}}%
-}
-\long\def\ifblank#1{\kr@ifblank#1&&\@secondoftwo\@firstoftwo:}
-\long\def\kr@ifblank#1#2&#3#4#5:{#4}
-\@ifdefinable\stopread{%
- \long\def\stopread#1&{\long\def\kr@remainder{#1}}%
-}
-\def\kr@allist{}
-\gdef\kr@define@key#1,#2,#3,#4&{%
- \edef\kr@keytype{#1}%
- \edef\kr@key{#2}%
- \edef\kr@default{#3}%
- \def\kr@func{#4}%
- \ifcase\number\kr@keytype\relax
- \or
- \edef\x{\noexpand\define@key[\kr@keyprefix]{\kr@keyfamily}%
- {\kr@key}[\kr@default]{\expandafter\noexpand\kr@func}%
- }\x
- \or
- \edef\x{\noexpand\define@cmdkey[\kr@keyprefix]{\kr@keyfamily}%
- [\kr@macroprefix]{\kr@key}[\kr@default]{\expandafter\noexpand\kr@func}%
- }\x
- \or
- \edef\x{\noexpand\define@boolkey[\kr@keyprefix]{\kr@keyfamily}%
- [\kr@macroprefix]{\kr@key}[\kr@default]{\expandafter\noexpand\kr@func}%
- }\x
- \or
- \ifx\kr@allist\@empty
- \kr@err{'\string\kr@allist' is empty: choicekey can't be defined.
- \MessageBreak You need to first define '\string\kr@allist'
- \MessageBreak as a nonempty set}%
- \fi
- \edef\x{\noexpand\define@choicekey*[\kr@keyprefix]{\kr@keyfamily}{\kr@key}%
- [\noexpand\kr@val\noexpand\kr@nr]{\kr@allist}[\kr@default]%
- {\expandafter\noexpand\kr@func}%
- }\x
- \else
- \kr@err{Unknown key type/identifier '\kr@keytype'}%
- \fi
-}
-\newcount\kr@cnta
-\newcommand\define@keylist[1]{%
- \kr@cnta=\z@\relax\romannumeral-`\q\expandafter\kr@readlist#1;&}
-\expandafter\def\expandafter\kr@readlist\expandafter#\expandafter 1\kr@parser#2&{%
- \ifblank{#1}{}{%
- \ifx#1\stopread\stopread#2&\kr@cnta=1\relax\else\kr@define@key#1&\fi
- }%
- \ifnum\kr@cnta=\z@\ifblank{#2}{}{\kr@readlist#2&}\fi
-}
-
-\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/xwatermark/xwatermark.sty b/Master/texmf-dist/tex/latex/xwatermark/xwatermark.sty
index bce397e73a3..b7973759d62 100644
--- a/Master/texmf-dist/tex/latex/xwatermark/xwatermark.sty
+++ b/Master/texmf-dist/tex/latex/xwatermark/xwatermark.sty
@@ -1,14 +1,15 @@
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
-% This is file 'xwatermark.sty', version 1.3. %
+% This is file 'xwatermark.sty', version 1.4. %
% %
% This package puts user-specified watermarks (graphics and arbitrary %
% texts) on select pages of documents. See package documentation %
% for further details. %
% %
-% 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 any later version. The latest version of this license %
-% is in http://www.latex-project.org/lppl.txt and version 1.3 or later %
+% This work (ie, all the files in the xwatermark manifest) may be %
+% distributed and/or modified under the conditions of the LaTeX %
+% Project Public License, either version 1.3 of this license or 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. %
% %
% The LPPL maintenance status of this software is 'author-maintained'. %
@@ -18,21 +19,23 @@
% implied warranties of merchantability and fitness for a particular %
% purpose. %
% %
-% Copyright (c) 2009 Ahmed Musa (a.musa@rocketmail.com). %
+% Copyright (c) 2010 Ahmed Musa (a.musa@rocketmail.com). %
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++%
\begingroup
-\catcode064=11% @
-\catcode123=01% {
-\catcode125=02% }
+\catcode064 11% @
+\catcode123 01% {
+\catcode125 02% }
\def\x{\endgroup
\edef\xwm@RestoreCodeAtEnd{%
- \catcode035=\the\catcode035\relax
- \catcode064=\the\catcode064\relax
- \catcode123=\the\catcode123\relax
- \catcode125=\the\catcode125\relax
+ \catcode035 \the\catcode035% #
+ \catcode064 \the\catcode064% @
+ \catcode123 \the\catcode123% {
+ \catcode125 \the\catcode125% }
+ \catcode061 \the\catcode061% =
}%
}
\x
+\@makeother{\=}%
\catcode035=06% #
\catcode064=11% @
\catcode123=01% {
@@ -57,7 +60,6 @@
\xwm@EnsureCode{047}{12}% /
\xwm@EnsureCode{058}{12}% :
\xwm@EnsureCode{060}{12}% <
-\xwm@EnsureCode{061}{12}% =
\xwm@EnsureCode{062}{12}% >
\xwm@EnsureCode{094}{07}% ^ (superscript)
\xwm@EnsureCode{096}{12}% `
@@ -68,28 +70,43 @@
\def\filedate{#4}%
\def\fileversion{v#3}%
\def\filetime{#5}%
- \def\fileauthor{#6\space#7}
+ \def\fileauthor{#6\space#7}%
}
\def\filedesc{%
Puts user-specified watermarks on select document pages (\fileauthor)}
\readRCS
-$Id: xwatermark.sty,v 1.3 2009/10/27 09:00:00 Ahmed Musa Exp $
+$Id: xwatermark.sty,v 1.4 2010/01/10 09:00:00 Ahmed Musa Exp $
\ProvidesPackage{xwatermark}[\filedate\space\fileversion\space\filedesc]
\NeedsTeXFormat{LaTeX2e}[1996/12/01]
-\RequirePackage{etoolbox}[2009/08/06]
-\RequirePackage{ltxnew}[2009/07/22]
+\@ifpackageloaded{etoolbox}{}{\RequirePackage{etoolbox}[2009/08/06]}
+\@ifpackageloaded{ltxnew}{}{\RequirePackage{ltxnew}[2009/07/22]}
\newrobustcmd\xwm@info[1]{\PackageInfo{xwatermark}{#1\@gobble}}
\newrobustcmd\xwm@warn[1]{\PackageWarningNoLine{xwatermark}{#1}}
\newrobustcmd\xwm@err[1]{\PackageError{xwatermark}{#1}{\@ehc}}
+\new\def\xwm@car#1#2\@nil{#1}
+\new\def\xwm@testarg#1{%
+ \begingroup
+ \escapechar=92\relax
+ \edef\tmp@a{\expandafter\xwm@car\string#1\@nil}%
+ \if\tmp@a\@backslashchar
+ \aftergroup\@firstoftwo
+ \else
+ \aftergroup\@secondoftwo
+ \fi
+ \endgroup
+}
\newrobustcmd*\xwm@numdef[2]{%
+ \xwm@testarg{#1}{}{\xwm@err{Unacceptable argument '#1' for number}}
\ifstrempty{#2}{\xwm@err{Empty argument for counter}}{}
\ifundef{#1}{\new\count#1\relax #1=\numexpr#2\relax}{#1=\numexpr#2\relax}
}
\newrobustcmd*\xwm@dimdef[2]{%
- \ifstrempty{#2}{\xwm@err{Empty argument for dimension}}{}
+ \xwm@testarg{#1}{}{\xwm@err{Unacceptable argument '#1' for dimension}}
+ \ifstrempty{#2}{\xwm@err{Empty argument for dimension}}{}
\ifundef{#1}{\new\dimen#1\relax #1=\dimexpr#2\relax}{#1=\dimexpr#2\relax}
}
\new\long\def\xwm@afterfi#1\fi{\fi#1}
+\new\long\def\xwm@afterelsefi#1\else#2\fi{\fi#1}
\new\let\xwm@pagestart\@empty
\new\let\xwm@pageend\@empty
\new\def\xwm@pagerange#1{%
@@ -97,10 +114,10 @@ $Id: xwatermark.sty,v 1.3 2009/10/27 09:00:00 Ahmed Musa Exp $
\renew\def\xwm@pageend{}%
\xwm@pagerange@ifhyphen#1-\@nil{%
\ifx\xwm@pagestart\@empty
- \expandafter\xwm@err{Empty page range passed to package}
+ \xwm@afterelsefi\xwm@err{Empty page range passed to package}%
\else
- \expandafter\xwm@err{Only page \xwm@pagestart\MessageBreak
- was passed as page range}
+ \xwm@afterfi
+ \xwm@err{Only page \xwm@pagestart\space was passed as page range}%
\fi
}{%
\xwm@pagerange@split#1\@nil
@@ -111,29 +128,28 @@ $Id: xwatermark.sty,v 1.3 2009/10/27 09:00:00 Ahmed Musa Exp $
\renew\def\xwm@pageend{#2}%
\xwm@pagerange@ifhyphen#2-\@nil{%
\ifx\xwm@pagestart\@empty
- \expandafter\xwm@err{No starting page for page range}
+ \expandafter\xwm@err{No starting page for page range}%
\else
\ifx\xwm@pageend\@empty
- \expandafter\expandafter\expandafter%
- \xwm@err{No ending page for page range}
+ \xwm@afterelsefi
+ \xwm@err{No ending page for page range}%
\else
- \expandafter\expandafter\expandafter%
- \xwm@info{Page range:\space
- \xwm@pagestart\space to \xwm@pageend}
+ \xwm@afterfi
+ \xwm@info{Page range:\space\xwm@pagestart\space to \xwm@pageend}%
\fi
\fi
}{%
- \xwm@err{Too many hyphens in page range}
+ \xwm@err{Too many hyphens in page range}%
}%
}
\new\def\xwm@pagerange@ifhyphen#1-#2\@nil{%
- \ifstrempty{#2}{\expandafter\@firstoftwo}{\expandafter\@secondoftwo}
+ \ifstrempty{#2}{\@firstoftwo}{\@secondoftwo}%
}
-\RequirePackage{fix-cm}
-\RequirePackage{graphicx}
-\RequirePackage{xkeyval}[2008/08/13]
-\RequirePackage{atbegshi}[2008/07/31]
-\RequirePackage{picture}[2008/11/26]
+\@ifpackageloaded{fix-cm}{}{\RequirePackage{fix-cm}[2006/03/24]}
+\@ifpackageloaded{graphicx}{}{\RequirePackage{graphicx}[1999/02/16]}
+\@ifpackageloaded{xkeyval}{}{\RequirePackage{xkeyval}[2008/08/13]}
+\@ifpackageloaded{atbegshi}{}{\RequirePackage{atbegshi}[2008/07/31]}
+\@ifpackageloaded{picture}{}{\RequirePackage{picture}[2008/11/26]}
\@ifpackageloaded{xcolor}{%
\xwm@info{You have loaded 'xcolor' package\MessageBreak
with options that possibly differ\MessageBreak
@@ -143,14 +159,16 @@ $Id: xwatermark.sty,v 1.3 2009/10/27 09:00:00 Ahmed Musa Exp $
\xwm@info{'xcolor' package loaded with\MessageBreak
options 'table', 'hyperref'}
}
-\RequirePackage{xifthen}[2009/04/17]
-\RequirePackage{boxedminipage}
+\@ifpackageloaded{xifthen}{}{\RequirePackage{xifthen}[2009/04/17]}
+\@ifpackageloaded{boxedminipage}{}{\RequirePackage{boxedminipage}}
+\@ifpackageloaded{keyreader}{}{\RequirePackage{keyreader}[2010/01/01]}
+\krsetup{parser=;,macroprefix=xwm@,keyprefix=XWM,keyfamily=xwatermark}
\xwm@dimdef{\xwm@xcoord@a}{\z@}
\xwm@dimdef{\xwm@ycoord@a}{\z@}
\xwm@numdef{\xwm@minmark}{\z@}
\xwm@numdef{\xwm@c@printmark}{\z@}
\new\let\xwm@papercenter\relax
-\newtoggle{pdf}
+\providetoggle{pdf}
\ifundef\pdfoutput{}{\unless\ifnum\pdfoutput<1\toggletrue{pdf}\fi}
\define@boolkey[XWM]{xwatermark}[xwm@]{printwatermark}[true]{%
\ifxwm@printwatermark\xwm@minmark=\@ne\fi}
@@ -177,9 +195,9 @@ $Id: xwatermark.sty,v 1.3 2009/10/27 09:00:00 Ahmed Musa Exp $
\fi
}%
}
-\define@choicekey*+[XWM]{xwatermark}{align}[\xwm@val\xwm@nr]%
+\define@choicekey*+[XWM]{xwatermark}{align}[\val\nr]%
{center,right,left,justified}[center]{%
- \ifcase\xwm@nr\relax
+ \ifcase\nr\relax
\def\xwm@align{\centering}%
\or
\def\xwm@align{\flushright}%
@@ -189,23 +207,20 @@ $Id: xwatermark.sty,v 1.3 2009/10/27 09:00:00 Ahmed Musa Exp $
\let\xwm@align\relax
\fi
}{%
- \xwm@err{Inadmissible value '#1' for align}
+ \xwm@err{Inadmissible value '\string#1' for align}%
}
\define@cmdkey[XWM]{xwatermark}[xwm@]{page}[1]{%
- \xwm@bool@onepageonlytrue
- \xwm@minmark=\@ne\relax
+ \xwm@bool@onepageonlytrue\xwm@minmark=\@ne
}
\define@key[XWM]{xwatermark}{pages}[1-1]{%
\xwm@bool@prangetrue
- \xwm@pagerange{#1}%
- \xwm@minmark=\@ne\relax
+ \xwm@pagerange{#1}\xwm@minmark=\@ne
}
\iftoggle{pdf}{\new\def\xwm@picfilex{pdf}}{\new\def\xwm@picfilex{eps}}
\define@cmdkey[XWM]{xwatermark}[xwm@]{picfile}[]{%
\ifstrempty{#1}{\xwm@bool@pmarkfalse}{%
- \xwm@bool@pmarktrue
- \xwm@minmark=\@ne\relax
- }
+ \xwm@bool@pmarktrue\xwm@minmark=\@ne
+ }%
}
\define@cmdkey[XWM]{xwatermark}[xwm@]{textmark}[DRAFT]{%
\ifstrempty{#1}{\xwm@bool@tmarkfalse}{\xwm@bool@tmarktrue}%
@@ -223,12 +238,10 @@ $Id: xwatermark.sty,v 1.3 2009/10/27 09:00:00 Ahmed Musa Exp $
{\def\xwm@picfilex{eps}}{}%
}%
}
-\RequirePackage[parser=;,macroprefix=xwm@,keyprefix=XWM,
- keyfamily=xwatermark]{keyreader}
\define@keylist{2,color,gray!25,;2,fontfamily,bch,;2,angle,45,;
2,scale,1,;2,coordunit,mm,;2,fontsize,5cm,;2,fontseries,b,;
2,height,\paperwidth,;2,width,\paperheight,;2,xcoord,\z@,;
- 2,ycoord,\z@,;2,picscale,1,;2,picbb,0 0 100 100,;}
+ 2,ycoord,\z@,;2,picscale,1,;2,picbb,0 0 100 100,}
\presetkeys[XWM]{xwatermark}{tmark,angle,scale,color,
textmark,fontfamily,fontsize,fontseries,coordunit,
align,height,width,xcoord,ycoord,picscale,picbb}{}
@@ -236,15 +249,8 @@ $Id: xwatermark.sty,v 1.3 2009/10/27 09:00:00 Ahmed Musa Exp $
\ExecuteOptionsX[XWM]<xwatermark>{printwatermark}
\ProcessOptionsX*[XWM]<xwatermark>\relax
\newrobustcmd\watermarksetup[1]{\setkeys[XWM]{xwatermark}{#1}}
-\def\xwm@nolateoptions{printwatermark}
\AtBeginDocument{%
- \@for\@mem:=\xwm@nolateoptions\do{%
- \expandafter\edef\expandafter\@mem\expandafter{\expandafter
- \expandafter\expandafter\zap@space\expandafter\@mem\space\@empty}%
- \key@ifundefined[XWM]{xwatermark}{\@mem}{}{%
- \xwm@disable@keys[XWM]{xwatermark}{\@mem}%
- }%
- }%
+ \xwm@disable@keys[XWM]{xwatermark}{printwatermark,dgeometry}%
}
\new\def\xwm@coords{\begingroup%
\protected@edef\@tempa{\endgroup%
@@ -252,7 +258,7 @@ $Id: xwatermark.sty,v 1.3 2009/10/27 09:00:00 Ahmed Musa Exp $
\number\xwm@xcoord\xwm@coordunit}%
\xwm@dimdef{\xwm@ycoord@a}{-0.5\paperheight+
\number\xwm@ycoord\xwm@coordunit}%
- }\@tempa%
+ }\@tempa
}
\unless\ifxwm@printwatermark
\xwm@info{printwatermark=false: no watermark printed}
@@ -262,28 +268,29 @@ $Id: xwatermark.sty,v 1.3 2009/10/27 09:00:00 Ahmed Musa Exp $
\put(0,-0.5\paperheight){\line(1,0){\paperwidth}}%
\put(0.5\paperwidth,0){\line(0,-1){\paperheight}}%
\put(0.5\paperwidth,-0.5\paperheight){\circle{10}}%
-}%
+ \normalcolor
+}
\newcommand\xwm@insert@textmark@a{%
\leavevmode\removelastskip\noindent%
\makebox(0,0){\rotatebox[origin=c]{\xwm@angle}{\scalebox{\xwm@scale}{%
\parbox[c][\xwm@height][c]{\xwm@width}{%
\color{\xwm@color}%
\fontfamily{\xwm@fontfamily}\fontseries{\xwm@fontseries}%
- \fontsize{\xwm@fontsize}{1.2\xwm@fontsize}\selectfont%
- \xwm@align\xwm@textmark%
- }}}}\relax
- \removelastskip\normalcolor%
-}%
+ \fontsize{\xwm@fontsize}{1.2\xwm@fontsize}\selectfont
+ \xwm@align\xwm@textmark
+ }}}}%
+ \removelastskip\normalcolor
+}
\newcommand\xwm@insert@picmark@a{%
\xwm@align
- \makebox(0,0){\rotatebox{\xwm@angle}{\xwm@insertpic}}\relax
-}%
+ \makebox(0,0){\rotatebox{\xwm@angle}{\xwm@insertpic}}%
+}
\newcommand\xwm@insert@textmark@b{%
\put(\xwm@xcoord@a,\xwm@ycoord@a){\xwm@insert@textmark@a}%
-}%
+}
\newcommand\xwm@insert@picmark@b{%
\put(\xwm@xcoord@a,\xwm@ycoord@a){\xwm@insert@picmark@a}%
-}%
+}
\newcommand\xwm@insert@mark@a{%
\xwm@coords
\ifxwm@bool@tmark\xwm@insert@textmark@b\fi
@@ -317,89 +324,81 @@ $Id: xwatermark.sty,v 1.3 2009/10/27 09:00:00 Ahmed Musa Exp $
\fi
\fi\fi\fi\fi\fi\fi\fi
\fi
-}%
+}
\ifxwm@printwatermark
\AtBeginShipout{\AtBeginShipoutUpperLeft{\xwm@insertmark}}%
\xwm@info{Option 'printwatermark=true': watermark printed}%
\fi
-\krsetup{keyfamily=minipage,macroprefix=mp@}
+\krsetup{keyfamily=minipage,macroprefix=mp@}%
\define@keylist{2,width,\paperwidth,;2,textcolor,black,;
2,framecolor,white,;2,framesep,3pt,;2,framerule,0.4pt,;
- 2,text,No text passed.,}
-\define@cmdkey[XWM]{minipage}[mp@]{align}[center]{%
- \protected@edef\mp@align{\mp@align}%
- \def\@tempa{center}%
- \ifx\mp@align\@tempa
- \gdef\mp@align{\centering}%
+ 2,text,No text passed.,}%
+\define@key[XWM]{minipage}{align}[center]{%
+ \begingroup
+ \edef\x{\endgroup\noexpand\XKV@cc*+[\noexpand\val\noexpand\nr]{#1}%
+ {center,right,left,justified}{}{}}%
+ \x
+ \ifcase\nr\relax
+ \def\mp@align{\centering}%
+ \or
+ \def\mp@align{\flushright}%
+ \or
+ \def\mp@align{\flushleft}%
+ \or
+ \let\mp@align\relax
\else
- \def\@tempa{right}%
- \ifx\mp@align\@tempa
- \gdef\mp@align{\flushright}%
- \else
- \def\@tempa{left}%
- \ifx\mp@align\@tempa
- \gdef\mp@align{\flushleft}%
- \else
- \def\@tempa{justified}%
- \ifx\mp@align\@tempa
- \global\let\mp@align\relax
- \else
- \xwm@err{Inadmissible value '#1' for minipage's align}
- \fi
- \fi
- \fi
+ \xwm@err{Inadmissible value '\string#1' for minipage's align}%
\fi
-}
+}%
\presetkeys[XWM]{minipage}{align,width,textcolor,text,framesep,
framerule,framecolor}{}%
\long\def\xwminipage#1{%
\setkeys[XWM]{minipage}{#1}%
- \begingroup
- \fboxsep=\mp@framesep\relax
- \fboxrule=\mp@framerule\relax
+ \begingroup%
+ \fboxsep=\mp@framesep\fboxrule=\mp@framerule%
\removelastskip
\color{\mp@framecolor}%
\noindent
\begin{boxedminipage}{\mp@width}%
\mp@align\textcolor{\mp@textcolor}{\mp@text}%
- \end{boxedminipage}\relax
+ \end{boxedminipage}%
\removelastskip
\endgroup
-}
+}%
\krsetup{keyfamily=colorbox,macroprefix=cb@}
\define@keylist{2,width,\textwidth,;2,textcolor,black,;
2,fillcolor,yellow!55,;2,framecolor,white,;
2,text,No text passed.,;2,framesep,3\p@,;2,framerule,0.4\p@,}
\define@choicekey*+[XWM]{colorbox}{align}[\val\nr]%
{center,right,left,justified}[center]{%
- \protected@edef\cb@align{\val}
+ \protected@edef\cb@align{\val}%
}{%
- \xwm@err{Inadmissible value '#1' for colorbox's align}
-}
+ \xwm@err{Inadmissible value '\string#1' for colorbox's align}%
+}%
\presetkeys[XWM]{colorbox}{align=center,width,fillcolor,textcolor,text,
framesep,framerule,framecolor}{}
\newcommand\xwcolorbox[1]{%
\setkeys[XWM]{colorbox}{#1}%
\color{\cb@framecolor}%
- \removelastskip\noindent
- \colorbox{\cb@fillcolor}{\relax
+ \removelastskip\noindent%
+ \colorbox{\cb@fillcolor}{%
\xwminipage{framesep=\cb@framesep,framerule=\cb@framerule,
framecolor=\cb@framecolor,align=\cb@align,width=\cb@width,
- text=\cb@text,textcolor=\cb@textcolor%
- }\relax
+ text=\cb@text,textcolor=\cb@textcolor
+ }%
}%
- \removelastskip\normalcolor
+ \removelastskip\normalcolor%
}%
\newcommand\ywcolorbox[1]{%
\setkeys[XWM]{colorbox}{#1}%
\color{\cb@framecolor}%
\begin{center}%
\makebox[\z@][c]{%
- \colorbox{\cb@fillcolor}{\relax
+ \colorbox{\cb@fillcolor}{%
\xwminipage{framesep=\cb@framesep,framerule=\cb@framerule,
framecolor=\cb@framecolor,align=\cb@align,width=\cb@width,
text=\cb@text,textcolor=\cb@textcolor
- }\relax
+ }%
}%
}%
\end{center}%
@@ -419,28 +418,30 @@ $Id: xwatermark.sty,v 1.3 2009/10/27 09:00:00 Ahmed Musa Exp $
}{\xwm@err{No file \xwm@picfile.\xwm@picfilex\space or wrong path}}%
}%
}\@tempa%
-}
+}%
\newrobustcmd\xwm@dis@ble@keys[1]{%
- \XKV@checksanitizeb{#1}\XKV@tempa
- \XKV@for@o\XKV@tempa\XKV@tempa{%
- \XKV@ifundefined{\XKV@header\XKV@tempa}{%
- \XKV@err{key '\XKV@tempa' undefined}%
+ \XKV@checksanitizeb{#1}\xwm@tempa
+ \XKV@for@o\xwm@tempa\xwm@tempa{%
+ \XKV@ifundefined{\XKV@header\xwm@tempa}{%
+ \xwm@warn{Key '\xwm@tempa' undefined: can't be disabled}%
}{%
- \edef\XKV@tempb{%
- \noexpand\xwm@err{Key '\XKV@tempa' has been disabled.\MessageBreak
+ \edef\xwm@tempb{%
+ \noexpand\xwm@err{Key '\xwm@tempa' has been disabled.\MessageBreak
You can't set or reset it at this late stage.\MessageBreak
You should have set it earlier in the\MessageBreak
\string\documentclass\space or \string\usepackage}%
}%
- \XKV@ifundefined{\XKV@header\XKV@tempa @default}{%
- \edef\XKV@tempc{\noexpand\XKV@define@key{\XKV@tempa}}%
+ \XKV@ifundefined{\XKV@header\xwm@tempa @default}{%
+ \edef\xwm@tempc{\noexpand\XKV@define@key{\xwm@tempa}}%
}{%
- \edef\XKV@tempc{\noexpand\XKV@define@key{\XKV@tempa}[]}%
+ \edef\xwm@tempc{\noexpand\XKV@define@key{\xwm@tempa}[]}%
}%
- \expandafter\XKV@tempc\expandafter{\XKV@tempb}%
+ \expandafter\xwm@tempc\expandafter{\xwm@tempb}%
}%
}%
-}
-\newcommand\xwm@disable@keys{\XKV@testoptb\xwm@dis@ble@keys}
+}%
+\newrobustcmd\xwm@disable@keys{\XKV@testoptb\xwm@dis@ble@keys}%
\endinput
+
+%%% End of file xwatermark.sty %%% \ No newline at end of file