我只想在每页的角落放置简单的对象(并且能够排除某些页面。我甚至可以手动为每一页执行此操作,因为它们真的很少),使用通常的符号:
\newpgfornamentfamily{pgfhan}
\pgfornament[width = 2cm, color = black!]{5}
或者
\newpgfornamentfamily{pgfhan}
\begin{tikzpicture}
\tikzset{pgfornamentstyle/.style={
fill=black!,
fill opacity=1,
line width=0.1pt}}%
\pgfornament[color=black!,scale=0.45,anchor=south, symmetry=v]{5}%
\end{tikzpicture}
工作代码示例:
\documentclass{article}
\usepackage{pgfornament}
\begin{document}
\newpgfornamentfamily{pgfhan}
\begin{tikzpicture}
\tikzset{pgfornamentstyle/.style={
fill=black!,
fill opacity=1,
line width=0.1pt}}%
\pgfornament[color=black!,scale=0.45,anchor=south]{5}%
\end{tikzpicture}
\renewcommand{\contentsname}{
\begin{center}
Contenuti
\end{center}}
\tableofcontents
\section{a}
\end{document}
我在网上阅读了很多东西,但大多数都是复杂的示例,我无法将其分成小部分并确定我需要什么。
你能帮助我吗?
答案1
如果您想要一个完整的示例,这里有一个。我假设您希望每个角落都有单独的 pgfornament。定义一个新命令,其中\addpgfornaments
包含在每个角落绘制四个 pgfornament 的代码。使用此命令\AddToHook{shipout/background}{\addpgfornaments}
在每个页面中添加绘图,然后使用关闭相应页面上的 pgfornaments 绘图,\RemoveFromHook{shipout/background}
然后再次切换回使用\AddToHook{shipout/background}{\addpgfornaments}
。
\documentclass{article}
\newcounter{loopcount}
\usepackage{pgfornament}
\newpgfornamentfamily{pgfhan}
\newcommand{\addpgfornaments}{\begin{tikzpicture}[
remember picture,
overlay,
pgfornamentstyle/.style={scale=0.45}
]
\node [anchor=north west,inner sep=0pt] at (current page.north west) {\pgfornament {5}};
\node [anchor=south west,inner sep=0pt] at (current page.south west) {\pgfornament[symmetry=h] {5}};
\node [anchor=north east,inner sep=0pt] at (current page.north east) {\pgfornament[symmetry=v] {5}};
\node [anchor=south east,inner sep=0pt] at (current page.south east) {\pgfornament[symmetry=v,symmetry=h] {5}};
\end{tikzpicture}}
\AddToHook{shipout/background}{\addpgfornaments}
\begin{document}
\renewcommand{\contentsname}{
\begin{center}
Contenuti
\end{center}}
\tableofcontents
\loop\ifnum\value{loopcount}<30
\stepcounter{loopcount}
\addcontentsline{toc}{section}{testing}\repeat
\clearpage\RemoveFromHook{shipout/background}
\section{a}\clearpage
\section{b}\clearpage\AddToHook{shipout/background}{\addpgfornaments}
\section{c}
\end{document}