
會議提交通常會將文件限制為一定數量的頁面,當我編輯時,我希望能夠添加浮水印來標記超出限制的頁面。例如,如果我有一份 11 頁的文檔,而會議提交限制為 9 頁,我希望將浮水印自動新增到第 10 頁和第 11 頁。
我查看了該xwatermark
包,但它只允許預先指定的頁面之間存在浮水印,並且不允許任何未指定的端點。我嘗試使用該lastpage
包來訪問最後一頁\pageref{LastPage}
並執行類似的操作
\newwatermark[pages=10-\pageref{LastPage},color=gray!25,scale=3,xpos=0,ypos=0]{DRAFT}
但這會觸發錯誤。
答案1
xwatermark
\lastdocpage
代表文件中最後一頁的優惠。因此,使用
\newwatermark[pages=10-\lastdocpage,color=gray!25,scale=3,xpos=0,ypos=0]{DRAFT}
來自xwaterwark
文件(部分6.9 文件最後一頁):
您可以輕鬆取得帶有標籤的文件的最後一頁
xwmlastpage
,該標籤是由套件自動提供的:使用者不必自己插入它。一般來說,您可以使用該命令\xwmgetpagenumber
從 LaTeX 標籤中提取頁碼(即使在擴充上下文中)。從該命令中提取頁碼可能需要多次運行。以下範例將浮水印從第二頁到最後一頁插入到最後一頁。請注意,在此範例中,起始頁必須括在大括號中,以便區分用於不同目的的兩個連字符。\newwatermark[pages={\lastdocpage-2}-\lastdocpage,angle=90, 71 scale=1,xpos=0,ypos=-1]{This is page \thepage~of~\pageref*{xwmlastpage}}
該命令
\lastdocpage
相當於\xwmgetpagenumber{xwmlastpage}
.
答案2
一個例子background
包裹;\BGfrom{<number>}
從開始僅使用頁面<number>
將具有所需的背景資料:
\documentclass{article}
\usepackage[a6paper]{geometry}
\usepackage[contents={}]{background}
\usepackage{lipsum}
\newcommand\BGfrom[1]{%
\AddEverypageHook{%
\ifnum\value{page}>\numexpr#1-1\relax
\backgroundsetup{
contents={Over the limit},
color=orange,
scale=3
}%
\fi
\BgMaterial%
}%
}
\BGfrom{7}
\begin{document}
\lipsum[1-13]
\end{document}
產生的文檔:
以目前的形式,\BGfrom{<number>}
還將為頁面添加材料<number>
;如果你想排除這個頁面,程式碼更簡單:
\newcommand\BGfrom[1]{%
\AddEverypageHook{%
\ifnum\value{page}>#1\relax
\backgroundsetup{
contents={Over the limit},
color=orange,
scale=3
}%
\fi
\BgMaterial%
}%
}