如何在所有页面上设置固定背景(例如,在每个页面的中心)
我想用以下代码将此背景放置在所有页面的中心
\begin{tikzpicture}[overlay]
\node[blue!45,
rotate = 30] at (3,-1.4) {
\begin{tikzpicture}
\draw[line width=0.2 mm] circle[radius=2 cm];
\draw[line width=0.2 mm] circle[radius=1.95 cm];
inner circles
\draw[line width=0.2 mm] circle[radius=1.3 cm] ;
\draw[line width=0.2 mm] circle[radius=1.25 cm] ;
\path[
postaction={
decoration={
text along path,,text color=blue!45,
text={ PROF~~ MEBKHOUTA
},
text align=center,
reverse path
},
decorate
}
]
(10:1.5cm) arc (10:180:1.5cm);
\node[blue!30,rotate=-60] at (350:1.6cm) {$\bigstar$};
\node[blue!30,rotate=60] at (190:1.6cm) {$\bigstar$};
\path [postaction={decorate,decoration={text along path,text color=blue!50, text align=fit to path,text={OUSSAMA}}}] (209:1.8cm) arc (209:330:1.8cm);
central text
\node[font=\fontsize{12}{12}\selectfont] at (0, 0){{ الرياضيات}};
\end{tikzpicture}
};
\end{tikzpicture}`
答案1
我放弃尝试修复你的 tkizpicture。我确实检查过 [overlay] 本身是否会将“光标”置于原点。但是,即使中心不在原点,下面的操作也会起作用。
每次创建 tikzpicture 时都会产生大量的开销,因此我制作了一个副本并将其放入保存箱中。
\documentclass{article}
\usepackage{tikz}
\usepackage{lipsum}% fkae text
\newsavebox{\background}
\savebox{\background}{\begin{tikzpicture}
\node[draw, red] at (1,1) {Background};
\coordinate (center) at (current bounding box.center);
\pgfresetboundingbox
\path(center);
\end{tikzpicture}}
\AddToHook{shipout/background}{\put (0.5\paperwidth, -0.5\paperheight) {\usebox\background}}
\begin{document}
\lipsum[1-12]
\end{document}