文章类文档的所有页面都有水印?

问题描述 投票:0回答:1

我想在文章类中制作一个文档,所有页面都带有水印。此外,我希望能够控制该水印的不透明度。以下代码给出了两个问题:1)水印仅在第一页上2)我无法调整水印的不透明度。有办法解决这些问题吗?

\documentclass[12pt,a4paper,twoside,envcountsect]{article} 

\usepackage{fancyhdr} 
\usepackage{lastpage} 
\usepackage[titles,subfigure]{tocloft} 
\usepackage{subcaption}
\usepackage{geometry}
\geometry{top=2.5cm , bottom=2.5cm , left=2.5cm , right=2.5cm , headsep=9mm , footskip=14mm , marginparwidth=2.0cm , marginparsep=0.25cm , a4paper , pdftex}
\pagestyle{fancy}             
\fancyhead{} 
\fancyhead[LE,RO]{ \footnotesize \nouppercase \leftmark }
\fancyhead[LE,RO]{}
\lhead{\footnotesize lhead}
\chead{\footnotesize chead}
\rhead{\footnotesize rhead}
\fancyfoot{} 
\rfoot{Page \thepage \space of \pageref{LastPage}}
\lfoot{lfoot}
\renewcommand{\headrulewidth}{0.6pt} 
\renewcommand{\footrulewidth}{0.6pt} 
\renewcommand{\sectionmark}[1]{\markboth{#1}{}}

\usepackage[printwatermark]{xwatermark}
\newwatermark[
    allpages,
    opacity=0.5,
    color=red,
    angle=45,
    scale=3.14,
    xpos=0,
    ypos=0
    ]{WATERMARK} % watermark underneath
%\newwatermark*[allpages,color=red,angle=45,scale=3,xpos=3.3,ypos=3.8]{WATERMARK} % watermark on top

\usepackage[]{hyperref}
\newcounter{Chapcounter}
\newcommand\showmycounter{\addtocounter{Chapcounter}{1}\themycounter}
\newcommand{\chapter}[1] 
{    
  \addcontentsline{toc}{section}{\large\color{cyan} #1}    
}

\hypersetup{colorlinks=true}
\hypersetup{linkcolor=black}

\begin{document}

\renewcommand*{\contentsname}{\LARGE Contents}

\vspace{1cm}
\begin{center}
    \huge{Headline}
\end{center}
\vspace{1cm}

\tableofcontents\newpage

\chapter{Calculus}
\section{Subject}

\newpage
\chapter{Algebra}
\section{Subject}

\end{document} 
latex watermark
1个回答
0
投票
\documentclass[12pt,a4paper,twoside]{article} 

\usepackage{fancyhdr} 
\usepackage{lastpage} 
\usepackage[titles,subfigure]{tocloft} 
\usepackage{subcaption}
\usepackage{geometry}
\geometry{top=2.5cm , bottom=2.5cm , left=2.5cm , right=2.5cm , headsep=9mm , footskip=14mm , marginparwidth=2.0cm , marginparsep=0.25cm , a4paper , pdftex}
\pagestyle{fancy}             
\fancyhead{} 
\fancyhead[LE,RO]{ \footnotesize \nouppercase \leftmark }
\fancyhead[LE,RO]{}
\lhead{\footnotesize lhead}
\chead{\footnotesize chead}
\rhead{\footnotesize rhead}
\fancyfoot{} 
\rfoot{Page \thepage \space of \pageref{LastPage}}
\lfoot{lfoot}
\renewcommand{\headrulewidth}{0.6pt} 
\renewcommand{\footrulewidth}{0.6pt} 
\renewcommand{\sectionmark}[1]{\markboth{#1}{}}

\usepackage{tikz}
\AddToHook{shipout/background}{
\begin{tikzpicture}[remember picture,overlay]
  \node[font=\Huge,red,rotate=45,opacity=0.45] at (current page.center) {Watermark};
\end{tikzpicture}
}

\usepackage[]{hyperref}
\newcounter{Chapcounter}
\newcommand\showmycounter{\addtocounter{Chapcounter}{1}\themycounter}
\newcommand{\chapter}[1] 
{    
  \addcontentsline{toc}{section}{\large\color{cyan} #1}    
}

\hypersetup{colorlinks=true}
\hypersetup{linkcolor=black}

\begin{document}

\renewcommand*{\contentsname}{\LARGE Contents}

\vspace{1cm}
\begin{center}
    \huge{Headline}
\end{center}
\vspace{1cm}

\tableofcontents\newpage

\chapter{Calculus}
\section{Subject}

\newpage
\chapter{Algebra}
\section{Subject}

\end{document} 
© www.soinside.com 2019 - 2024. All rights reserved.