Sergio Callegari to meet a special need. I call the
new package 'draftmark'. I will like to use a macro
I call \draftmarksetup to specify package options,
as an alternative to specifying the optional arguments
to the \usepackage command. I have used the facilities
in the xkeyval package for processing my package
options, but the macro \draftmarksetup based on \setkeys
has not worked properly. Can anyone familiar with the
xkeyval/keyval package help me?
The new package and a sample document are listed below.
Code: Select all
\ProvidesPackage{draftmark}[2009/03/10 v1.0 Puts a draftmark on specified document pages]\NeedsTeXFormat{LaTeX2e}\RequirePackage{etoolbox}\RequirePackage{xkeyval}\RequirePackage{atbegshi}\RequirePackage{picture}\RequirePackage{xcolor}\RequirePackage{xifthen}\newif\ifdm@final\dm@finalfalse\newif\ifdm@draft\dm@draftfalse\newif\ifdm@firstpage\dm@firstpagefalse\newif\ifdm@allpages\dm@allpagesfalse\newif\ifdm@oddpages\dm@oddpagesfalse\newif\ifdm@evenpages\dm@evenpagesfalse\newif\ifdm@particularpage\dm@particularpagefalse\newlength\dm@xcoord\setlength\dm@xcoord{0.5\paperwidth}\newlength\dm@ycoord\setlength\dm@ycoord{-0.5\paperheight}\newcount\dm@sytlecnt\dm@sytlecnt=\z@\newlength\dm@xcoord@tempa\newlength\dm@ycoord@tempa% Defaults:\def\dm@markangle{45}\def\dm@markscale{1}\edef\dm@draftmarkpages{\z@}\edef\dm@markcolorname{gray}\edef\dm@markgrayness{0.8}\def\dm@markcolor{\color[gray]{0.8}}\edef\dm@marktext{DRAFT}\edef\dm@fontfamily{cmr}\edef\dm@fontsize{5cm}\newcommand\dm@info[1]{\PackageInfo{draftmark}{#1\@gobble}}\newcommand\dm@warn[1]{\PackageWarningNoLine{draftmark}{#1}}\@onlypreamble\dm@warn\@onlypreamble\dm@info\DeclareOptionX[dm]<draftmark>{firstpage}[true]{%\ifstrequal{#1}{true}{\dm@firstpagetrue}{\dm@firstpagefalse}\xdef\dm@draftmarkpages{First}\dm@sytlecnt=\@ne}