上个月,我发布了以下代码作为问题的答案。代码给出了正确的输出。然而,我没有注意到的是特蕾莎做到了它会生成有关未定义标签的警告,无论编译多少次,该警告仍然存在。
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
为什么警告持续存在?我应该怎么做才能避免它?
\documentclass[a4paper]{article}
\usepackage{geometry,tikz}
\usetikzlibrary{calc}
\usepackage[placement=bottom,scale=1,opacity=1]{background}
\backgroundsetup{contents={%
\begin{tikzpicture}
\fill [red] (current page.north west) rectangle ($(current page.north east)!.2!(current page.south east)$) coordinate (a);
\fill [yellow] (current page.south west) rectangle (a);
\end{tikzpicture}}}
\usepackage{kantlipsum}
\begin{document}
\kant[1-5]
\end{document}
答案1
如果我猜的话,那可能是 tikzcurrent page
在添加矩形时会考虑变化。添加该overlay
选项可避免出现警告。
\documentclass[a4paper]{article}
\usepackage{geometry,tikz}
\usetikzlibrary{calc}
\usepackage[placement=bottom,scale=1,opacity=1]{background}
\backgroundsetup{contents={%
\begin{tikzpicture}[overlay]
\fill [red] (current page.north west) rectangle ($(current page.north east)!.2!(current page.south east)$) coordinate (a);
\fill [yellow] (current page.south west) rectangle (a);
\end{tikzpicture}}}
\usepackage{kantlipsum}
\begin{document}
\kant[1-5]
\end{document}