5

Conference submissions typically limit a document to a certain number of pages, and when I'm editing, I'd like to be able to add a watermark to mark pages that are over the limit. For example, if I have a 11 page document and the conference submission limit is 9 pages, I'd like the watermark to automatically be added to pages 10 and 11.

I've looked at the xwatermark package, but it only permits watermarks between prespecified pages, and does not allow any of the endpoints to be left unspecified. I tried using the lastpage package to access the last page via \pageref{LastPage} and do something like

\newwatermark[pages=10-\pageref{LastPage},color=gray!25,scale=3,xpos=0,ypos=0]{DRAFT}

but that triggers an error.

6

xwatermark offers \lastdocpage that represents the last page in the document. Therefore, use

\newwatermark[pages=10-\lastdocpage,color=gray!25,scale=3,xpos=0,ypos=0]{DRAFT}

From the xwaterwark documentation (section 6.9 The last page of the document):

You can easily obtain the last page of the document with the label xwmlastpage, which is automatically provided by the package: the user doesn't have to insert it himself. In general, you can use the command \xwmgetpagenumber to extract page numbers from LaTeX labels (even in expansion contexts). More than one run may be necessary in extracting page numbers from this command. The following example inserts the watermark from second to the last page to the last page. Note that in this example the starting page is necessarily enclosed in curly braces so as to distinguish the two hyphens that serve different purposes.

\newwatermark[pages={\lastdocpage-2}-\lastdocpage,angle=90,
  71 scale=1,xpos=0,ypos=-1]{This is page \thepage~of~\pageref*{xwmlastpage}}

The command \lastdocpage is equivalent to \xwmgetpagenumber{xwmlastpage}.

3

An example with the background package; using \BGfrom{<number>} only pages from <number> onwards will have the desired background material:

\documentclass{article}
\usepackage[a6paper]{geometry}
\usepackage[contents={}]{background}
\usepackage{lipsum}

\newcommand\BGfrom[1]{%
\AddEverypageHook{%
  \ifnum\value{page}>\numexpr#1-1\relax
    \backgroundsetup{
      contents={Over the limit},
      color=orange,
      scale=3
    }%
  \fi
  \BgMaterial%
  }%
}
\BGfrom{7}

\begin{document}

\lipsum[1-13]

\end{document}

The resulting document:

enter image description here

In its present form, \BGfrom{<number>} will also add the material to the page <number>; if you want to exclude this page, the code is simpler:

\newcommand\BGfrom[1]{%
\AddEverypageHook{%
  \ifnum\value{page}>#1\relax
    \backgroundsetup{
      contents={Over the limit},
      color=orange,
      scale=3
    }%
  \fi
  \BgMaterial%
  }%
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.