4

I would like to use both packages draftmark and siunitx in the same document. When I do this I get the error

! Undefined control sequence.
\@BTswitch ->{\CT@arc@
\hrule \@height \@thisrulewidth }\futurenonspacelet \...

As soon as I comment out either \usepackage{siunitx} or \midrule, it works. Here is what I tried

\documentclass[11pt,a4paper]{article}
\usepackage{siunitx}
\usepackage{booktabs,tabularx}
\usepackage[draft]{draftmark}

\begin{document}
\begin{tabularx}{\textwidth}{ll}
head1 & head2 \\
\midrule
123 & 456\\
123 & 456\\
\end{tabularx}
\end{document}

Obiviously, there is no problem when I comment out \usepackage[draft]{draftmark}

Can anyone help? Thanks.

4
  • Can you add an image how the watermark should look like? There are many other ways to add one. Commented Jan 24 at 16:01
  • 1
    Sorry, but the package uses etextools that's known to be very buggy and incompatible with recent (past 2010) versions of LaTeX. You get it somewhat working if you load tabularx after draftmark, but I can't guarantee further problems won't show up. Commented Jan 24 at 16:46
  • I was using ˋdraftwatermarkˋ before, but ˋdraftmarkˋ has the option ˋpages=ˋ to print the watermark on particular pages only Commented Jan 24 at 18:43
  • Package draftwatermark works with siunitx. Have you considered this instead? Commented Jan 24 at 20:26

2 Answers 2

4

xwatermark, from the same author, is superior to draftmark. xwatermark

\documentclass[11pt,a4paper]{article}
\usepackage{siunitx}
\usepackage{booktabs,tabularx}

\usepackage[angle=90,scale=5,color=red!100!green!20,opacity=1]{background}
\backgroundsetup{contents={\fboxsep=35pt\fboxrule=0pt\relax\fbox{-- DRAFT -- }}}

\begin{document}
\begin{tabularx}{\textwidth}{ll}
head1 & head2 \\
\midrule
123 & 456\\
123 & 456\\
\end{tabularx}
\end{document}

enter image description here

Alternative:

eso-pic is a well maintained package

\documentclass[11pt,a4paper]{article}

\usepackage{siunitx}
\usepackage{booktabs,tabularx}
\usepackage{graphicx}
\usepackage{eso-pic}

\AddToShipoutPictureBG*{%
  \AtPageCenter{%
    \makebox(0,0){%
      \rotatebox{90}{%
        \scalebox{5}{%
          \textcolor{red!100!green!20}{-- DRAFT --}%
        }%
      }%
    }%
  }%
}

\begin{document}

\begin{tabularx}{\textwidth}{ll}
head1 & head2 \\
\midrule
123 & 456\\
123 & 456\\
\end{tabularx}

\end{document}

enter image description here

3
  • 2
    The CTAN page of xwatermark says It is currently unmaintained and does not work with modern LaTeX releases. Commented Jan 24 at 16:19
  • 2
    Better use the build-in page hooks - no need for extra packages. Commented Jan 24 at 16:23
  • With the starred version of \AddToShipoutPictureBG* from the package eso-pic I can put the watermark only on the pages I want. Commented Jan 28 at 7:18
7

The draftmark package loads etextools that's very buggy and hasn't been compatible with releases of LaTeX after at least 2015.

If your aim is just to add “DRAFT” in the background, you can do it with no packages at all (except graphicx and xcolor, which are safe).

\documentclass[11pt,a4paper]{article}
\usepackage{graphicx}
\usepackage{xcolor}

\usepackage{lipsum}

\AddToHook{shipout/background}{%
  \put(0.5\paperwidth,-0.5\paperheight){%
    \makebox(0,0){\rotatebox{45}{\scalebox{10}{\textcolor{gray!30}{DRAFT}}}}%
  }%
}

\begin{document}

\lipsum[1-30]

\end{document}

output

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.