所以我复制了第 34 页的例子https://ctan.math.illinois.edu/macros/latex/contrib/tkz/pgfornament/doc/ornaments.pdf
假设这些包:
\documentclass{article}
\usepackage{pgfornament}
\usepackage{eso-pic}
\begin{document}
\newpgfornamentfamily{pgfhan}
\newbox{\fortyseven}
\savebox{\fortyseven}{\pgfornament[scale=0.20,color=black!]{47}}
\tikzset{every node/.append style={inner sep=0pt}}
\AddToShipoutPictureBG{%
\begin{tikzpicture}[overlay,remember picture,color=black!]
\node[anchor=north west,shift={(0.7,-0.85)}] at (current page.north west)
(nw) {\pgfornament[scale=0.2]{25}};
\node[anchor=north east,shift={(-0.7,-0.85)}] at (current page.north east)
(ne) {\pgfornament[scale=0.2,symmetry=v]{25}};
\node[anchor=south west,shift={(0.7,0.85)}] at (current page.south west)
(sw) {\pgfornament[scale=0.2,symmetry=h]{25}};
\node[anchor=south east,shift={(-0.7,0.85)}] at (current page.south east)
(se) {\pgfornament[scale=0.2,symmetry=c]{25}};
\begin{scope}[start chain,node distance=-3pt]
\node[anchor=north west,on chain] at (nw.north east)
{\usebox{\fortyseven}};
\foreach \i in {1,...,14} {\node[on chain]{\usebox{\fortyseven}};}
\end{scope}
\begin{scope}[start chain,node distance=-3pt]
\node[anchor=south west,on chain] at (sw.south east)
{\usebox{\fortyseven}};
\foreach \i in {1,...,6} \node[on chain]{\usebox{\fortyseven}};
\end{scope}
\begin{scope}[start chain=going left,node distance=-3pt]
\node[anchor=south east,on chain,xshift={3pt}] at (se.south west)
{\usebox{\fortyseven}};
\foreach \i in {1,...,6} \node[on chain]
{\usebox{\fortyseven}};
\end{scope}
\foreach \i in {0,...,22}
\node[anchor=south west,rotate=-90,
shift={($\i*(31bp,0)$)}] at (nw.south west)
{\usebox{\fortyseven}};
\foreach \i in {0,...,22}
\node[anchor=south east,rotate=90,shift={($\i*(-31bp,0)$)}] at
([yshift={+3pt}]ne.south east){\usebox{\fortyseven}};
\node[yshift=32pt] at (current page.south){\pgfornament[scale=0.1]{51}};
\node[yshift=32pt,text=black] at (current page.south){\large\thepage};
\end{tikzpicture}
}
\end{document}
但是它不起作用。你知道该如何让它起作用吗?
答案1
您缺少chains
和calc
库。此外,示例的布局似乎针对类的页面几何形状进行了优化tufte-handout
:
\documentclass[a4paper,nofonts]{tufte-handout}
\usepackage[object=vectorian]{pgfornament}
\usetikzlibrary{chains,
calc}
\usepackage{eso-pic}
\pagestyle{empty}
\begin{document}
\newpgfornamentfamily{pgfhan}
\newbox{\fortyseven}
\savebox{\fortyseven}{\pgfornament[scale=0.20,color=MidnightBlue]{47}}
\tikzset{every node/.append style={inner sep=0pt}}
\AddToShipoutPictureBG{%
\begin{tikzpicture}[overlay,remember picture,color=MidnightBlue]
\node[anchor=north west,shift={(0.7,-0.85)}] at (current page.north west)
(nw) {\pgfornament[scale=0.2]{25}};
\node[anchor=north east,shift={(-0.7,-0.85)}] at (current page.north east)
(ne) {\pgfornament[scale=0.2,symmetry=v]{25}};
\node[anchor=south west,shift={(0.7,0.85)}] at (current page.south west)
(sw) {\pgfornament[scale=0.2,symmetry=h]{25}};
\node[anchor=south east,shift={(-0.7,0.85)}] at (current page.south east)
(se) {\pgfornament[scale=0.2,symmetry=c]{25}};
\begin{scope}[start chain,node distance=-3pt]
\node[anchor=north west,on chain] at (nw.north east)
{\usebox{\fortyseven}};
\foreach \i in {1,...,14} {\node[on chain]{\usebox{\fortyseven}};}
\end{scope}
\begin{scope}[start chain,node distance=-3pt]
\node[anchor=south west,on chain] at (sw.south east)
{\usebox{\fortyseven}};
\foreach \i in {1,...,6} \node[on chain]{\usebox{\fortyseven}};
\end{scope}
\begin{scope}[start chain=going left,node distance=-3pt]
\node[anchor=south east,on chain,xshift={3pt}] at (se.south west)
{\usebox{\fortyseven}};
\foreach \i in {1,...,6} \node[on chain]
{\usebox{\fortyseven}};
\end{scope}
\foreach \i in {0,...,22}
\node[anchor=south west,rotate=-90,
shift={($\i*(31bp,0)$)}] at (nw.south west)
{\usebox{\fortyseven}};
\foreach \i in {0,...,22}
\node[anchor=south east,rotate=90,shift={($\i*(-31bp,0)$)}] at
([yshift={+3pt}]ne.south east){\usebox{\fortyseven}};
\node[yshift=32pt] at (current page.south){\pgfornament[scale=0.1]{51}};
\node[yshift=32pt,text=black] at (current page.south){\large\thepage};
\end{tikzpicture}
}
\newpage
test
\end{document}