summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-08-13 22:36:56 +0000
committerKarl Berry <karl@freefriends.org>2012-08-13 22:36:56 +0000
commit35f8085a57171a8fc9bd16a32df711bc517358d3 (patch)
tree537c4e8fe686b6e1910a256984c0a7e1632790db /Master/texmf-dist/tex/latex
parent42603b43b47aad681630a062bd8b23773d1bc22c (diff)
background (13aug12)
git-svn-id: svn://tug.org/texlive/trunk@27390 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/background/background.sty194
1 files changed, 137 insertions, 57 deletions
diff --git a/Master/texmf-dist/tex/latex/background/background.sty b/Master/texmf-dist/tex/latex/background/background.sty
index 314c090a90a..e746a4e3311 100644
--- a/Master/texmf-dist/tex/latex/background/background.sty
+++ b/Master/texmf-dist/tex/latex/background/background.sty
@@ -6,7 +6,7 @@
%%
%% background.dtx (with options: `package')
%%
-%% Copyright (C) 2009 Gonzalo Medina (gmedinaar@unal.edu.co)
+%% Copyright (C) 2009-2012 Gonzalo Medina (gmedinaar@unal.edu.co)
%%
%% --------------------------------------------------------------------------
%%
@@ -25,71 +25,128 @@
%% This work consists of the files background.ins, background.dtx,
%% and the derived files background.sty and background.pdf.
%%
- % \end{center}
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{background}[2009/11/07 v1.0 bg material]
-\RequirePackage{everypage}
-\RequirePackage{tikz}
-\RequirePackage{afterpage}
+
+
+
+
+
+
+
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{background}[2012/08/06 v2.0 background material]
+\@ifpackageloaded{xkeyval}{}{\RequirePackage{xkeyval}}
+\@ifpackageloaded{tikz}{}{\RequirePackage{tikz}}
+\@ifpackageloaded{everypar}{}{\RequirePackage{everypage}}
+\@ifpackageloaded{afterpage}{}{\RequirePackage{afterpage}}
+\DeclareOptionX[BG]<background>{contents}{%
+ \def\Background@Contents{#1}}
+\DeclareOptionX[BG]<background>{color}{%
+ \def\Background@Color{#1}}
+\DeclareOptionX[BG]<background>{angle}{%
+ \def\Background@Angle{#1}}
+\DeclareOptionX[BG]<background>{opacity}{%
+ \def\Background@Opacity{#1}}
+\DeclareOptionX[BG]<background>{scale}{%
+ \def\Background@Scale{#1}}
+\DeclareOptionX[BG]<background>{position}{%
+ \def\Background@Position{#1}}
+\DeclareOptionX[BG]<background>{anchor}{%
+ \def\Background@Anchor{#1}}
+\DeclareOptionX[BG]<background>{hshift}{%
+ \def\Background@HShift{#1}}
+\DeclareOptionX[BG]<background>{vshift}{%
+ \def\Background@VShift{#1}}
\newif\ifbg@some
\bg@somefalse
-\def\bg@contents{Draft}
-\def\bg@color{red!45}
-\def\bg@angle{60}
-\def\bg@opacity{.5}
-\def\bg@scale{15}
-\def\bg@position{current page.center}
-\def\bg@anchor{}
-\def\bg@hshift{0}
-\def\bg@vshift{0}
-
-\DeclareOption{all}{\bg@somefalse}
-\DeclareOption{some}{\bg@sometrue}
-\DeclareOption{center}{%
- \def\bg@position{current page.center}%
- \def\bg@anchor{}%
- \def\bg@angle{60}}
-\DeclareOption{bottom}{%
- \def\bg@position{current page.south}%
- \def\bg@anchor{above}%
- \def\bg@angle{0}%
- \def\bg@scale{8}}
-\DeclareOption{top}{%
- \def\bg@position{current page.north}%
- \def\bg@anchor{below}%
- \def\bg@angle{0}%
- \def\bg@scale{8}}
+\define@choicekey+[BG]{background}{pages}[\val\nr]{all,some}{%
+ \ifcase\nr\relax
+ \bg@somefalse
+ \or
+ \bg@sometrue
+ \fi
+}{%
+ \PackageWarning{background}{erroneous input ignored}%
+}
+
+\define@choicekey+[BG]{background}{placement}[\val\nr]{center,bottom,top}{%
+ \ifcase\nr\relax
+ \renewcommand\Background@Position{current page.center}%
+ \renewcommand\Background@Anchor{}%
+ \renewcommand\Background@Angle{60}
+ \or
+ \renewcommand\Background@Position{current page.south}%
+ \renewcommand\Background@Anchor{above}%
+ \renewcommand\Background@Angle{0}%
+ \or
+ \renewcommand\Background@Position{current page.north}%
+ \renewcommand\Background@Anchor{below}%
+ \renewcommand\Background@Angle{0}%
+ \fi
+}{%
+ \PackageWarning{background}{erroneous input ignored}%
+}
+\define@boolkey+[BG]{background}{firstpage}{%
+ \ifBG@background@firstpage
+ \bg@sometrue%
+ \AtBeginDocument{\BgThispage}%
+ \else
+ \bg@somefalse%
+ \fi
+}{%
+ \PackageWarning{background}{erroneous input ignored}%
+}
+
+\DeclareOptionX[BG]<background>{all}{\bg@somefalse}
+\DeclareOptionX[BG]<background>{some}{\bg@sometrue}
+\DeclareOptionX[BG]<background>{center}{%
+ \renewcommand\Background@Position{current page.center}%
+ \renewcommand\Background@Anchor{}%
+ \renewcommand\Background@Angle{60}}
+\DeclareOptionX[BG]<background>{bottom}{%
+ \renewcommand\Background@Position{current page.south}%
+ \renewcommand\Background@Anchor{above}%
+ \renewcommand\Background@Angle{0}%
+ \renewcommand\Background@Scale{8}}
+\DeclareOptionX[BG]<background>{top}{%
+ \renewcommand\Background@Position{current page.north}%
+ \renewcommand\Background@Anchor{below}%
+ \renewcommand\Background@Angle{0}%
+ \renewcommand\Background@Scale{8}}
+
\ExecuteOptions{all,center}
-\ProcessOptions
-
-\newcommand*\SetBgContents[1]{%
- \def\bg@contents{#1}}
-\newcommand*\SetBgColor[1]{%
- \def\bg@color{#1}}
-\newcommand*\SetBgAngle[1]{%
- \def\bg@angle{#1}}
-\newcommand*\SetBgOpacity[1]{%
- \def\bg@opacity{#1}}
-\newcommand*\SetBgScale[1]{%
- \def\bg@scale{#1}}
-\newcommand*\SetBgPosition[1]{%
- \def\bg@position{#1}}
-\newcommand*\SetBgAnchor[1]{%
- \def\bg@anchor{#1}}
-\newcommand*\SetBgHshift[1]{%
- \def\bg@hshift{#1}}
-\newcommand*\SetBgVshift[1]{%
- \def\bg@vshift{#1}}
+
+
+\DeclareOptionX*{\PackageWarning{background}{‘ \CurrentOption’ ignored}}
+
+\ExecuteOptionsX[BG]<background>{%
+ firstpage=false,
+ contents=Draft,%
+ color=red!45,%
+ angle=60,%
+ opacity=0.5,%
+ scale=10,%
+ position=current page.center,%
+ anchor={},%
+ hshift=0,%
+ vshift=0%
+}
+
+\ProcessOptionsX[BG]<background>
+\DeclareRobustCommand*\backgroundsetup[1]{%
+ \setkeys[BG]{background}{#1}
+}
\newcommand\bg@material{%
- \begin{tikzpicture}[remember picture,overlay]
- \node [rotate=\bg@angle,scale=\bg@scale,opacity=\bg@opacity,%
- xshift=\bg@hshift,yshift=\bg@vshift,color=\bg@color]
- at (\bg@position) [\bg@anchor] {\bg@contents};
+ \begin{tikzpicture}[remember picture,overlay,scale=\Background@Scale]
+ \node [rotate=\Background@Angle,scale=\Background@Scale,
+ opacity=\Background@Opacity,%
+ xshift=\Background@HShift,yshift=\Background@VShift,color=\Background@Color]
+ at (\Background@Position) [\Background@Anchor] {\Background@Contents};
\end{tikzpicture}}%
\newcommand\BgThispage{\AddThispageHook{\bg@material}}
@@ -102,6 +159,29 @@
\else
\AddEverypageHook{\bg@material}
\fi
+
+\newcommand\SetBgContents[1]{%
+ \def\Background@Contents{#1}}
+\newcommand\SetBgAngle[1]{%
+ \def\Background@Angle{#1}}
+\newcommand\SetBgColor[1]{%
+ \def\Background@Color{#1}}
+\newcommand\SetBgScale[1]{%
+ \def\Background@Scale{#1}}
+\newcommand\SetBgVshift[1]{%
+ \def\Background@VShift{#1}}
+\newcommand\SetBgHshift[1]{%
+ \def\Background@HShift{#1}}
+\newcommand\SetBgPosition[1]{%
+ \def\Background@Position{#1}}
+\newcommand\SetBgAnchor[1]{%
+ \def\Background@Anchor{#1}}
+\newcommand\SetBgOpacity[1]{%
+ \def\Background@Opacity{#1}}
+
+\let\BgMaterial\bg@material
+
+\AtEndDocument{\clearpage}
\endinput
%%
%% End of file `background.sty'.