# Getting Atbegshi to start on first page and reset content when overwritten

I'm trying to add titles at a specific location (over a letterhead) for a number of pages (1-2) and then add a new title to the following 2. I have two problems. First AtBegShi starts at the second page \AtBeginShipoutFirst doesn't fix this, and secondly \AtBeginShipoutDiscard doesnt reset AtBegShi so it has Rhubarb and Custard superimposed.

Any thoughts on this would be extremely gratefully received. thanks

\documentclass[10pt]{article}
\usepackage{atbegshi}
\usepackage{textpos}
\AtBeginShipoutInit

\def\mycontent{rhubarb}

\AtBeginShipout{
\begin{textblock}{6}[0,0](0.1,-0.15)
\mycontent
\end{textblock}
}
\AtBeginShipoutFirst{
\begin{textblock}{6}[0,0](0.1,-0.15)
\mycontent
\end{textblock}
}

\begin{document}

blah
\newpage
blah
\newpage
\def\mycontent{custard}

blah
\newpage
blah
\end{document}

• It's more convenient to replace Rhubarb/Custard with a macro, say \sometext, and then redefine \sometext appropriately. – Werner Feb 17 '13 at 5:29
• Try xwatermark package. – Ahmed Musa Feb 17 '13 at 6:52
• thanks @Werner, that is extremely elegant! Would you happen to know how to get the shipout to start from page 1? – Tahnoon Pasha Feb 17 '13 at 9:26
• thanks @AhmedMusa. Looking at the documentation for xwatermark now. Looks very powerful, but struggling to get to grips with the fontseries options. It hangs if I put \textbf\textsc{mytext} in the {} braces, and hangs if I use the fontseries=\bfseries\scshape formulation. I'm trying to find the series spec for the \FancyPageNos macro but a google search hasn't had results. Do you know where the documentation might be available? – Tahnoon Pasha Feb 17 '13 at 9:29
• Please can you give a minimal non-working example? – Ahmed Musa Feb 18 '13 at 17:05

## 1 Answer

I don't know what you need textpos for, but I was able to generate the following. The watermark appears on pages 1 and 3. You can adjust the key values of \newwatermark and \xwmcolorbox to suit your need.

\documentclass[10pt]{article}
\usepackage[printwatermark]{xwatermark}
\usepackage{xcolor}
\usepackage{lipsum}
\def\mycontent{rhubarb}
\newwatermark[coord-unit=cm,pagex={1,3},xpos=0,ypos=4]{%
\xwmcolorbox[framesep=4pt,innerframerule=4pt,outerframerule=2pt,
fillcolor=brown!70!yellow!55,innerframecolor=white,
outerframecolor=blue,height=1cm,width=.8\paperwidth,
depth=.4cm,textalign=center,textcolor=blue]{%
\scalebox{2.5}{\textbf{\mycontent}}%
}%
}

\begin{document}
\lipsum[1-5]
\newpage
\lipsum[1-5]
\newpage
\def\mycontent{custard}
\lipsum[1-5]
\newpage
\lipsum[1-5]
\end{document}