
\pagenumbering{gobble}
20190319 更新目次のページ番号を非表示にするためにコマンドを使用しています(タイトルのみを表示したい)。問題は、確かに ToC のページ番号は非表示になりますが、ToC ページに DRAFT の透かしのみが表示され、以降のすべてのページから DRAFT の透かしが消えてしまうことです。 行を削除するとすぐに\pagenumbering{gobble}
、すべてのページで DRAFT の透かしが再び表示されますが、ToC にはページ番号が付きます。
この問題を回避し、すべてのページに DRAFT 透かしを表示し、目次 (タイトルのみ) のページ番号を抑制するにはどうすればよいですか?
これが私のコードです
\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}
答え1
で透かしを追加するだけであればeso-pic
、このような問題はありません。(透かしの外観は見やすくなるように変更しましたが、簡単に元に戻すことができます。)
\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}
答え2
私は「バックグラウンド」パッケージを使用して問題を解決しました。ご協力くださった皆様に感謝します。私が行ったことは次のとおりです。
\usepackage[pages=all]{background} % in the preamble
..............
\backgroundsetup{contents={DRAFT}, color=gray!1000, opacity=0.3, angle=45, scale=23} % right before \begin{document}