全局设置 Tikz Boarder |乳胶

Setting Tikz Boarder Globally | Latex

使用以下代码,我可以为 当前 页面设置边界,但是如何才能使边界对所有页面可用,而无需在每个页面上明确设置它。


% !TeX TS-program = xelatex % | xelatex %

\documentclass[12pt, a4paper]{article}
\usepackage[left=3.3cm,right=2.3cm,top=2.3cm,bottom=2.3cm, footskip=42pt]{geometry}

\usepackage{fontspec}
\setmainfont{Times New Roman}

\usepackage{tikz}
\usetikzlibrary{calc}


\begin{document}

    \begin{tikzpicture}[remember picture, overlay]
        \draw[line width=3pt] ($(current page.north west)+(2.5cm,-1.5cm)$) rectangle ($(current page.south east)+(-1.5cm,1.5cm)$);
        \draw[line width=1pt] ($(current page.north west)+(2.6cm,-1.6cm)$) rectangle ($(current page.south east)+(-1.6cm,1.6cm)$);
        \fill[red] (current page.center) circle (0.1);
        \node[font=\Large\bfseries, text width=5cm,align=center] at (current page.center) {
            \uppercase{Note -- 1}

            \vspace{24pt}

            \uppercase{Data analysis}
        };
    \end{tikzpicture}

    \newpage

    test

\end{document}

一种可能是使用 eso-pic 包:

% !TeX TS-program = xelatex % | xelatex %

\documentclass[12pt, a4paper]{article}
\usepackage[left=3.3cm,right=2.3cm,top=2.3cm,bottom=2.3cm, footskip=42pt]{geometry}

\usepackage{fontspec}
\setmainfont{Times New Roman}

\usepackage{tikz}
\usetikzlibrary{calc}

\usepackage{eso-pic}
\AddToShipoutPictureBG{%
\begin{tikzpicture}[remember picture, overlay]
  \draw[line width=3pt] ($(current page.north west)+(2.5cm,-1.5cm)$) rectangle ($(current page.south east)+(-1.5cm,1.5cm)$);
  \draw[line width=1pt] ($(current page.north west)+(2.6cm,-1.6cm)$) rectangle ($(current page.south east)+(-1.6cm,1.6cm)$);
\end{tikzpicture}%
}

\begin{document}

    \begin{tikzpicture}[remember picture, overlay]
        \fill[red] (current page.center) circle (0.1);
        \node[font=\Large\bfseries, text width=5cm,align=center] at (current page.center) {
            \uppercase{Note -- 1}

            \vspace{24pt}

            \uppercase{Data analysis}
        };
    \end{tikzpicture}

    \newpage

    test

\end{document}