1

I found for a watermark the following solution:

\documentclass{article}
\usepackage[margin=2.5cm, showframe]{geometry} 
\usepackage{tikzpagenodes}
\usepackage{eso-pic}
\usepackage{lipsum}%<- only to add some text
\AddToShipoutPicture{\begin{tikzpicture}[overlay,remember picture]
        \ifodd\value{page}
        \node[anchor=south,rotate=90,pink,font=\sffamily\Huge] 
        (AE) at ([xshift=-1em]current page text area.west){Albert Einstein};
        \draw[very thick,pink] (AE.east) -- ++ (0,4)
        (AE.west) -- ++ (0,-4);
        \else
        \node[anchor=south,rotate=-90,pink,font=\sffamily\Huge] 
        (CFG) at ([xshift=1em]current page text area.east){Carl Friedrich Gauss};
        \draw[very thick,pink] (CFG.west) -- ++ (0,4)
        (CFG.east) -- ++ (0,-4);
        \fi   
\end{tikzpicture}}
\begin{document}
    \lipsum[1-3]
    \newgeometry{left=1.5cm, right=1.5cm, bottom=1cm}
    \lipsum[2-5]
    \newpage
    \lipsum[1]
\end{document}

This looks almost perfect except a tiny detail. The positioning is done relative to the given side geometry. Since I have some pages which have a different settings the watermark seems quite odd - especially when on these special pages only one graphic is inserted. There the overlapping doesn't matter.

Is there a way to position the \node in a fixed way? e.g. 1.5cm left (or right) and in the middle of the page (which could be calculated manually as well).

UPDATE I've updated the example to contain more than just 2 pages. I would like to have on page 1 and page 3 exactly the same positions of the watermark - despite the geometry settings.

LeO
  • 1,451

1 Answers1

2

Place the watermark relative to (current page) instead of (current page text area).

\documentclass{article}
\usepackage[margin=2.5cm, showframe]{geometry} 
\usepackage{tikz}
\usepackage{eso-pic}
\usepackage{lipsum}%<- only to add some text
\AddToShipoutPicture{\begin{tikzpicture}[overlay,remember picture]
        \ifodd\value{page}
        \node[anchor=south,rotate=90,pink,font=\sffamily\Huge] 
        (AE) at ([xshift=3em]current page.west){Albert Einstein};
        \draw[very thick,pink] (AE.east) -- ++ (0,4)
        (AE.west) -- ++ (0,-4);
        \else
        \node[anchor=south,rotate=-90,pink,font=\sffamily\Huge] 
        (CFG) at ([xshift=-3em]current page.east){Carl Friedrich Gauss};
        \draw[very thick,pink] (CFG.west) -- ++ (0,4)
        (CFG.east) -- ++ (0,-4);
        \fi   
\end{tikzpicture}}
\begin{document}
    \lipsum[1-3]
    \newgeometry{left=1.5cm, right=1.5cm, bottom=1cm}
    \lipsum[2-5]
    \newpage
    \lipsum[1]
\end{document}

enter image description here

gernot
  • 49,614