summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/xwatermark
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-10-26 21:33:37 +0000
committerKarl Berry <karl@freefriends.org>2012-10-26 21:33:37 +0000
commit1ba5423718e09a1da3063546e2a147eb7041fd89 (patch)
treea0520c5288285986cc919502dc5824843e483850 /Master/texmf-dist/tex/latex/xwatermark
parent72a3c141966579d533651df02a1dc7ed0859c0d9 (diff)
xwatermark (26oct12)
git-svn-id: svn://tug.org/texlive/trunk@28090 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/xwatermark')
-rw-r--r--Master/texmf-dist/tex/latex/xwatermark/xwatermark.sty91
1 files changed, 63 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/latex/xwatermark/xwatermark.sty b/Master/texmf-dist/tex/latex/xwatermark/xwatermark.sty
index 51b61741c18..9ead5f270e9 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.2c, October 2012. %
+% This is file 'xwatermark.sty', version 1.5.2d, October 23, 2012. %
% %
% This package puts user-specified watermarks (graphics and arbitrary %
% texts) on select pages of documents. See package documentation %
@@ -33,7 +33,7 @@
\UseNormalCatcodes
\StyleFilePurpose{A dynamic watermarking scheme}
\StyleFileRCSInfo
-$Id: xwatermark.sty,v 1.5.2c 2012/10/14 09:00:00 Ahmed Musa Exp $
+$Id: xwatermark.sty,v 1.5.2d 2012/10/23 09:00:00 Ahmed Musa Exp $
\ProvidesPackage{xwatermark}[\StyleFileInfo]
\NeedsTeXFormat{LaTeX2e}[2011/06/27]
\SetStyleFileMessages[xwm@]{info}{warn}{err}
@@ -58,26 +58,41 @@ $Id: xwatermark.sty,v 1.5.2c 2012/10/14 09:00:00 Ahmed Musa Exp $
\cptnewvariables{box}[xwm@box]{a,b}\relax
\cptnewvariables{count}[xwm@]{cnta}[\z@pt]
\cptnewvariables{if}[xwm@]{pdf,swa,swb,foregrd,wall,putmark}[false]
+\newletcs\xwm@catch@nil\relax
+\new@def*\xwm@catchtonil#1\xwm@catch@nil{\def\stuff{#1}}
\xwm@putmarktrue
\cptnewvariables{write}[xwm@]{wrt}\relax
\robust@def*\AtShipoutAlwaysUpperLeft#1{%
\AtBeginShipout{\AtBeginShipoutUpperLeft{#1}}%
}
-\robust@def*\xwm@secstartpage#1{%
+\robust@def*\xwm@secstopagerange#1{%
+ % To do: what of if a chapter, instead of another section,
+ % comes after section.
\begingroup
- \def\do##1##2,{%
- \ifx\do##1\else
- \csn@gdef{xwm@secstartpage@@\romannumeral##1}{##2}%
- \expandafter\do
- \fi
+ \ifblankTF{#1}{}{%
+ \def\@do##1##2,##3\@nil##4{%
+ \ifstrcmpTF\do{##1}{}{%
+ \csn@xdef{xwm@sec@page@end@\detokenize{##4}}{##2}%
+ \do{##1}{##2},##3\@nil
+ }%
+ }%
+ \def\do##1##2,##3\@nil{%
+ \ifstrcmpTF\do{##1}{}{%
+ \csn@xdef{xwm@sec@page@start@\detokenize{##1}}{##2}%
+ \@do##3\@nil{##1}%
+ }%
+ }%
+ \do#1,\do\do,\@nil
}%
- \do#1,\do\do,%
\endgroup
}
\new@def*\xwm@seclist{}
\AtEndDocument{%
\immediate\write\@auxout{%
- \string\xwm@secstartpage{\xwm@seclist}%
+ \string\xwm@secstopagerange{%
+ \xwm@seclist\ifx\xwm@seclist\@empty\else,\fi
+ {10000}{\lastdocpage}%
+ }%
}%
}
\robust@def*\xwm@recordsecno{%
@@ -87,6 +102,7 @@ $Id: xwatermark.sty,v 1.5.2c 2012/10/14 09:00:00 Ahmed Musa Exp $
}%
}
\edef\reserved@a{%
+ % To do: do the same for chapter.
\def\noexpand\@seccntformat##1{%
\unexpanded\expandafter{\@seccntformat{#1}}%
\unexpanded{\protect\xwm@recordsecno}%
@@ -210,28 +226,35 @@ $Id: xwatermark.sty,v 1.5.2c 2012/10/14 09:00:00 Ahmed Musa Exp $
}
\DefSuffixChecker\xwm@suffixcheck{*}{+}{'}
\robust@def*\xwmifitemsinTF{%
- \xwm@swatrue\cpt@testopt\xwm@itemsin\@ne
-}
-\robust@def*\xwmifitemsinFT{%
- \xwm@swafalse\cpt@testopt\xwm@itemsin\@ne
+ \begingroup\xwm@swatrue\cpt@testopt\xwm@itemsin\@ne
}
\robust@def*\xxwmifitemsinTF{%
- \xwm@swatrue\cpt@testopt\xwm@xitemsin{1}%
+ \begingroup\xwm@swatrue\cpt@testopt\xwm@xitemsin\@ne
+}
+\robust@def*\xwmifitemsinFT{%
+ \begingroup\xwm@swafalse\cpt@testopt\xwm@itemsin\@ne
}
\robust@def\xwm@xitemsin[#1]#2#3{%
\cptexpandtwoargs{\xwm@itemsin[#1]}{#2}{#3}%
}
\robust@def\xwm@itemsin[#1]#2#3{%
- \ifnum\numexpr#1<\@ne
- \xwm@err{Invalid number '\the#1'\relax\MsgBrk
- for command \string\xwmifitemsinTF}\@ehd
+ \begingroup
+ \afterassignment\xwm@catchtonil\@tempcnta=#1\xwm@catch@nil
+ \if\relax\cptoxdetok\stuff\relax
+ \ifnum\numexpr#1<\@ne
+ \xwm@err{Invalid number '\the#1'\relax
+ \MsgBrk for command \string\xwmifitemsinTF}\@ehd
+ \fi
+ \else
+ \xwm@err{Token '\detokenize{#1}' not an integer}\@ehd
\fi
+ \endgroup
\lowercase{%
\edef\xwm@tempa{\unexpanded{#2}}%
\edef\xwm@tempb{\unexpanded{#3}}%
}%
\cpt@sttrue\cpt@csvnormalize[,]\xwm@tempb
- \chardef\xwm@nritems\z@pt
+ \def\xwm@nritems{0}%
\def\xwm@items{}%
\def\csv@do##1{%
\xifinsetFT{,\detokenize{##1}}{,\cptoxdetok\xwm@tempb}{}{%
@@ -244,6 +267,7 @@ $Id: xwatermark.sty,v 1.5.2c 2012/10/14 09:00:00 Ahmed Musa Exp $
}%
}%
\csv@@parse*[,]\xwm@tempa
+ \expandafter\endgroup
\csname
@\ifnum\xwm@nritems>\numexpr#1-1\relax
\ifxwm@swa first\else second\fi
@@ -1346,16 +1370,20 @@ $Id: xwatermark.sty,v 1.5.2c 2012/10/14 09:00:00 Ahmed Musa Exp $
\ifnum\xwm@cnta<\numexpr\xwm@lastpage+1\relax
\cptrepeat
}%
+ % Incomplete concept. To be refined later. Basically, I want to get page
+ % range from section numbers. The work to be done next is actually in
+ % formatting \xwm@seclist and completing \xwm@convertsecstopagerange and
+ % \xwm@convertsecstopagerange@hyphen.
\xwm@ifpagespec{section=}{%
\xwm@avoidtwopagespecs
\xwm@getpagespec{section}%
- \xwm@convertsectopage\xwm@currpages
+ \xwm@convertsecstopagerange\xwm@currpages
\xwm@addcurrmark\xwm@currpages
}%
\xwm@ifpagespec{sections=}{%
\xwm@avoidtwopagespecs
\xwm@getpagespec{sections}%
- \xwm@convertsectopage@hyphen\xwm@currpages
+ \xwm@convertsecstopagerange@hyphen\xwm@currpages
\xwm@hyphenpagerange\xwm@currpages\xwm@pagestart\xwm@pageend
\xwm@cnta\numexpr\xwm@pagestart\relax
\cptloop
@@ -1367,7 +1395,7 @@ $Id: xwatermark.sty,v 1.5.2c 2012/10/14 09:00:00 Ahmed Musa Exp $
\xwm@ifpagespec{sectionx=}{%
\xwm@avoidtwopagespecs
\xwm@getpagespec{sectionx}%
- \xwm@convertsectopage\xwm@currpages
+ \xwm@convertsecstopagerange\xwm@currpages
\expandafter\cptfor\xwm@currpages\dofor{%
\xwm@addcurrmark{##1}%
}%
@@ -1378,15 +1406,22 @@ $Id: xwatermark.sty,v 1.5.2c 2012/10/14 09:00:00 Ahmed Musa Exp $
\fi
\postgroupdef\xwm@currwatermark\endgroup
}
-% \xwm@convertsectopage{<current.pages>}
-\robust@def*\xwm@convertsectopage#1{%
+% \xwm@convertsecstopagerange{<section.range>}
+\robust@def*\xwm@convertsecstopagerange#1{%
\begingroup
\def\xwm@tempa{}%
\expandafter\cptfor#1\dofor{%
- \letcstocsn\reserved@a{xwm@secstartpage@@\romannumeral##1}%
+ \letcstocsn\reserved@a{xwm@sec@page@start@\detokenize{##1}}%
+ \letcstocsn\reserved@b{xwm@sec@page@end@\detokenize{##1}}%
\ifx\reserved@a\undefined
\def\reserved@a{1}%
\fi
+ \ifx\reserved@b\undefined
+ \def\reserved@b{1}%
+ \fi
+ % To do:
+ % To build the page range for each section, loop from section start
+ % (page start) to section end (page end).
\xifinsetTF{,\reserved@a,}{,\xwm@tempa,}{}{%
\edef\xwm@tempa{%
\xwm@tempa\ifx\xwm@tempa\@empty\else,\fi\reserved@a
@@ -1396,12 +1431,12 @@ $Id: xwatermark.sty,v 1.5.2c 2012/10/14 09:00:00 Ahmed Musa Exp $
\let#1\xwm@tempa
\postgroupdef#1\endgroup
}
-% \xwm@convertsectopage@hyphen{<current.pages>}
-\robust@def*\xwm@convertsectopage@hyphen#1{%
+% \xwm@convertsecstopagerange@hyphen{<section.range>}
+\robust@def*\xwm@convertsecstopagerange@hyphen#1{%
\begingroup
\def\xwm@tempa{}%
\def\csv@do##1{%
- \letcstocsn\reserved@a{xwm@secstartpage@@\romannumeral##1}%
+ \letcstocsn\reserved@a{xwm@sec@page@start@\detokenize{##1}}%
\ifx\reserved@a\undefined
\def\reserved@a{1}%
\fi