如何在文档的每一页上“盖章”相同的文本

如何在文档的每一页上“盖章”相同的文本

我希望起草信息出现在文档的每一页上。

我在 Kluwer 文档类中看到过类似的东西,它定义了\@oddfoot很多\@evenfoot可能性。

有没有比这更简单的方法?有没有办法在不覆盖现有标题的情况下做到这一点?

答案1

您可以使用everypage 模块在每页发送之前执行 Latex 代码。您可以使用 PS 特效在页面中添加水印等内容(参见水印包ncctools 软件包,我相信使用了这种技术),或者使用 PS 绘图包在页面上叠加图形。

答案2

有几个软件包可以在每页上加盖水印:draftcopydraftwatermark。根据您想在每页上加盖的内容的性质,它们可能对您有用。

答案3

您可以使用该包fancyhdr来简化页面样式的创建和修改。

但是,手动操作也不是那么难。基本上可以归结为重新定义命令\ps@plain,以便重新定义\@oddfoot\@evenfoot

% Define a nice example stamp.
\newcommand\myoverlay{
  % Taken from the TikZ documentation.
  % NB: This requires \usepackage{tikz}!
  \begin{tikzpicture}[remember picture,overlay]
    \node [rotate=60,scale=10,text opacity=0.2]
      at (current page.center) {Example};
  \end{tikzpicture} 
}

% Save the old definition:
\let\old@ps@plain\ps@plain

\renewcommand\ps@plain{
  % First, load the old definition:
  \old@ps@plain

  % Now, save the previously (by \@old@ps@plain) defined footers:
  \let\old@oddfoot\@oddfoot
  \let\old@evenfoot\@evenfoot

  % Actual redefinition of the footer to include the overlay stamp.
  \gdef\@oddfoot{
    \old@oddfoot
    \myoverlay
  }
  \gdef\@evenfoot{
    \old@evenfoot
    \myoverlay
  }
}

现在测试了一下,它起作用了。但请注意,它仅有的适用于页面样式实际上是 的页面plain。某些页面(例如\part标题页)会自动将其页面定义为具有其他页面样式。当然,也可以通过重新定义这些页面样式来解决此问题。但我想使用fancyvrbCharles 提到的包或软件包可以节省一些工作。

答案4

“background” 包是另一个可以简单地在页面上添加水印(或其他覆盖)的包。我相信默认设置是在页面上对角线放置一个巨大的“草稿”:

http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=background

相关内容