3

UPDATED 20190319 I am using the command \pagenumbering{gobble} in order to suppress the page numbering in the table of contents (I only want to show the titles). The problem is that it does indeed suppress the page numbers in the ToC, but I now only see the DRAFT watermark on the ToC page, and the DRAFT watermark disappeared from all the following pages. As soon as I delete the line \pagenumbering{gobble}, the DRAFT watermark is visible again on all the pages, but I have page numbering in the ToC.

How can I bypass this problem, and have simultaneously the DRAFT watermark on all pages and page numbering suppression in the ToC (titles only)?

Here is my code

\documentclass[10pt, a3paper]{article}
\newcommand{\projecttitle}{Example}

\usepackage{tikz}
\usepackage[printwatermark]{xwatermark}
\usepackage{pdfpages}
\usepackage{pdflscape}
\usepackage{geometry}

\geometry{
a3paper,
left=23mm,
top=15mm,
right=10mm,
bottom=15mm,
headheight=38pt,
includeheadfoot,
showframe=false
}

\newsavebox\mybox
\savebox\mybox{\scalebox{20}{\tikz[color=gray!1000,opacity=0.3]\node{DRAFT};}}
\newwatermark*[allpages,angle=45]{\usebox\mybox}

\begin{document}

\tableofcontents \thispagestyle{fancy}
\addtocontents{toc}{\protect\thispagestyle{empty}}
\pagenumbering{gobble}

\newpage
\thispagestyle{empty}
\includepdf[scale=1.000, trim=0cm 0cm 0.0cm 2cm, pagecommand= {\begin{tikzpicture}[remember picture, overlay] \node [anchor=west] at (-0.2, 0) {\parbox{\linewidth}{\section{Section 1}}}; \end{tikzpicture}}]{any_pdf_image.pdf}

\newpage
\thispagestyle{empty}
\includepdf[scale=1.000, trim=0cm 0cm 0.0cm 2cm, pagecommand= {\begin{tikzpicture}[remember picture, overlay] \node [anchor=west] at (-0.2, 0) {\parbox{\linewidth}{\section{Section 2}}}; \end{tikzpicture}}]{any_pdf_image.pdf}

\newpage
\thispagestyle{empty}
\includepdf[scale=1.000, trim=0cm 0cm 0.0cm 2cm, pagecommand= {\begin{tikzpicture}[remember picture, overlay] \node [anchor=west] at (-0.2, 0) {\parbox{\linewidth}{\section{Section 3}}}; \end{tikzpicture}}]{any_pdf_image.pdf}

\end{document}
  • 5
    (1) welcome, (2) as always on this site, please provide a full but minimal examples for others to test. This is a lot easier than trying to use just your sniplet and try to guess from there. For example where does \newwatermark come from? – daleif Mar 18 at 9:35
1

If you just add the water mark with eso-pic, there is no such problem. (I changed the appearance of the watermark to make it more visible but you can easily change it back.)

\documentclass{article}
\usepackage{eso-pic}
\usepackage{tikz}
\usepackage{lipsum}
\begin{document}
\pagenumbering{gobble}
\tableofcontents

\clearpage
\AddToShipoutPictureBG{\begin{tikzpicture}[overlay,remember picture]
\node[gray,opacity=0.3,scale=8,font=\sffamily,rotate=45] at (current page.center){DRAFT};
\end{tikzpicture}}
\foreach \X in {1,...,20}
{\section{Section \X}
\lipsum[\X]}
\end{document}

enter image description here

  • I don't think I was clear enough. Here is a small script I prepared – Vlad Mar 18 at 15:12
  • @Vlad My solution works with your script, too, except that I do not have the your graphics files. If you want to have something based on your solution, make it compilable first. – user121799 Mar 18 at 15:38
  • It is compilable. There are some warnings on the way but I confirm that the pdf gets built. Please try to run in non stop mode from cmd such: in the right location> pdflatex -interaction nonstopmode filename.tex – Vlad Mar 18 at 17:25
  • @Vlad It may be compilable on your machine because you have E:/download.pdf which most users won't have. Please provide an example that can be compiled on a generic machine, not just on yours. – user121799 Mar 18 at 17:27
  • 1
    @Vlad I am definitely not going to ignore error messages. The result of the compilation will be random. – user121799 Mar 18 at 18:06
0

I solved the issue using the 'background' package. Thank you all for trying to help All I did was:

\usepackage[pages=all]{background} % in the preamble
..............

\backgroundsetup{contents={DRAFT}, color=gray!1000, opacity=0.3, angle=45, scale=23} % right before \begin{document}

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.