0

I have a g-brief document which includes an xwatermark in it. By the below error it appears as though xwatermark doesn't like semicolons in the watermarks description:

TeX console error (I can't seem to copy from the console in MacTeX?!)

The relevant part seems to be Enclode your toke ';' in braces:

\newwatermark*[allpages,color=red!50,angle=90,scale=3,xpos=0,ypos=0]{
  \begin{tikzpicture}[opacity=.05]
   % \clip (-2,-5) rectangle (10,5);
    \foreach \x in {0,0.05,...,2}{
      \draw (0,\x) .. controls (4-\x,-4-3*\x) and (11-2*\x,4-3*\x) .. (12,-5+3*\x);
      \draw (0,\x-1) .. controls (4-\x,\x-2) and (11-2*\x,-4-3*\x) .. (12,-3+3*\x);
      \draw (0,\x-3) .. controls (4-\x,\x-2) and (11-4*\x,-1-4*\x) .. (12,-5+3.5*\x);
    }
  \end{tikzpicture}
  }

Yet, putting the semicolons in braces doesn't seem to work. Any idea how to safely integrate a tikz drawing in an xwatermark?


Edit1: As Ulrike of course was totally right here's a complete, crowded example of my standard g-brief with lots of over-the-years acquired hacks in which I hope I haven't left in anything embarrasing.

% !TEX encoding = UTF-8 Unicode
\documentclass[11pt]{g-brief}
\usepackage[utf8]{inputenc}
\usepackage{ngerman}
\usepackage{enumerate}
\usepackage{eurosym}
\usepackage{todonotes}
\usepackage{nicefrac}
\usepackage{lineno}
\usepackage{blindtext}
\usepackage{lmodern}
\usepackage{paralist}
\usepackage{units}
\usepackage{textcomp}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage[arrow, matrix, curve]{xy}
\usepackage[output-decimal-marker={,},group-separator = {.},group-four-digits]{siunitx}
\usepackage{pgfkeys,pgfcalendar}
\usepackage{etoolbox}
\usepackage{tabularx}
\usepackage{fixltx2e}
\usepackage{hyperref}
\usepackage{rechnung}
\usepackage{color,calc,ngerman,mathptmx}
\usepackage[printwatermark]{xwatermark}
\usepackage{graphicx,type1cm,eso-pic,color}


\makeatletter
\AddToShipoutPictureBG{
    \setlength{\@tempdimb}{.5\paperwidth}
    \setlength{\@tempdimc}{.5\paperheight}
    \setlength{\unitlength}{1pt}
    \put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){
    \makebox(0,0){\rotatebox{55}{\textcolor[gray]{0.85}
    {\fontsize{4cm}{4cm}\selectfont{  }}}}}
}

\AddToShipoutPicture*{
    \setlength{\@tempdimb}{.2\paperwidth}
    \setlength{\@tempdimc}{.81\paperheight}
    \setlength{\unitlength}{1pt}
    \put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){
    \makebox(0,0){\rotatebox{55}{\textcolor[gray]{0.65}
    {\fontsize{1cm}{1cm}\selectfont{  }}}}}
}

\newcommand\watermark[1]{%
    #1%
    \sbox0{#1}%
    \llap{%
    \makebox[\wd0][c]{%  hor. centering
    \raisebox{.5\ht0}{%  approx. vert. centering
    \csname Gin@isotrue\endcsname% = "keepaspectratio"
    \resizebox*{.8\ht0}{.8\ht0}{% Scale down (the height is also used for the width to avoid the surrounding spaces)
    \parbox{10em}{% Allow line breaks
            \color{black!90}%  
            c me 2018
        }%
    }}}}%
}


\newcount\julianday
\newcount\daycount
\newcount\weekday

\newcommand*{\holiday}[2]{%
  \pgfcalendardatetojulian{#1}{\julianday}%
  \csdef{holiday-\number\julianday}{#2}%
}

\newcommand*{\adddays}[2]{%
  \pgfcalendardatetojulian{#1}{\julianday}%
  \daycount=#2\relax
  \loop
    \advance\julianday by 1\relax
    \pgfcalendarjuliantoweekday{\julianday}{\weekday}%
    \ifnum\weekday<5\relax
      % It's a weekday (Mon-Fri)
      \ifcsdef{holiday-\number\julianday}%
      {% It's a holiday
      }%
      {% Not a holiday
        \advance\daycount by -1\relax
      }%
    \fi
  \ifnum\daycount > 0
  \repeat
  \pgfcalendarjuliantodate{\julianday}{\thisyear}{\thismonth}{\thisday}%
  \thisday.\thismonth.\thisyear
}

\newwatermark*[allpages,color=red!50,angle=90,scale=3,xpos=0,ypos=0]{
  \begin{tikzpicture}[opacity=.1]
   % \clip (-2,-5) rectangle (10,5);
    \foreach \x in {0,0.05,...,2}{
      \draw (0,\x) .. controls (4-\x,-4-3*\x) and (11-2*\x,4-3*\x) .. (12,-5+3*\x);
      \draw (0,\x-1) .. controls (4-\x,\x-2) and (11-2*\x,-4-3*\x) .. (12,-3+3*\x);
      \draw (0,\x-3) .. controls (4-\x,\x-2) and (11-4*\x,-1-4*\x) .. (12,-5+3.5*\x);
    }
  \end{tikzpicture}
  }


\holiday{2015-04-21}{Oster Montag}
\holiday{2015-10-03}{Tag der deutschen Einheit}
\holiday{2015-05-25}{Pfingstmontag}

\renewcommand{\blztext}{\footnotesize BIC}
\renewcommand{\kontotext}{\footnotesize IBAN}
\newcommand{\areaval}[1]{\EUR{#1}\si{\per\Square\meter}}


%\lochermarke
\faltmarken
%\fenstermarken
\trennlinien


\Name                {me}
\Strasse             {here 1}
\Zusatz              {}
\RetourAdresse       {}
\Ort                 {12345 city}
\Land                {}

\Telefon             {5551212}
%\Telefax             {5551313}
%\EMail               {me@example.com}

%\Bank                {Bank}
%\BLZ                 {ABCD}
%\Konto               {DE12 3456 7890}

\Unterschrift        {My T\watermark. name}

\Postvermerk         {persönlich/vertraulich}
\Adresse             {abc\\def\\xxx\\12345 abc}

\Betreff             {abc }

\Datum               {\today}
\IhrZeichen          {} 
\IhrSchreiben        {}
%\MeinZeichen         {}

\Anrede              {Sehr geehrte Damen und Herren,}
\Gruss               {Mit freundlichem Gruss,}{1cm}

%\Anlagen             {\emph{Anlagen:\\ xxx }}

%\Verteiler           {\it Verteiler:\\ xxx}
%\klassisch %-> altes Kopfzeilenformat, Betr.: vor Betreff und Unterschrift kursiv und in Klammern
%\unserzeichen %-> "Unser Zeichen" statt "Mein Zeichen"
\newcommand{\FristinWerktagen}{10}

\begin{document}
\begin{g-brief}
\shorthandoff{"} 
\begin{linenumbers}


\Blindtext[4]
%\blindlistlist{enumerate}[12]
%\blindmathpaper



\end{linenumbers}
\end{g-brief}
\end{document}


\endinput
  • 1
    I wouldn't use xwatermark but beside this: always make a complete example. That makes it much easier to test your issue. – Ulrike Fischer May 31 '18 at 9:41
  • @UlrikeFischer Of course, sorry for leaving it out. I have added a compete example above. Thanks for the heads up... – Christian May 31 '18 at 9:54
  • 1
    Make the example smaller. It contains lots of irrelevant stuff. And as you are using eso-pic anyway: use it also for the watermark. Much less troublesome than xwatermark. – Ulrike Fischer May 31 '18 at 10:08

Your Answer

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

Browse other questions tagged or ask your own question.