如何在页眉和页脚顶部添加徽标 - pdf 中的第一页?

如何在页眉和页脚顶部添加徽标 - pdf 中的第一页?

我想修改以下代码,以便在页眉中添加徽标并在页脚中添加一些文本。可以吗?

\documentclass[a4paper, 10pt]{article} % for A4 size paper
\usepackage{tikz}


\begin{document}
\pagestyle{empty}

\begin{tikzpicture}[remember picture, overlay]

\tikzset{normal lines/.style={gray, very thin}} 
\tikzset{margin lines/.style={gray, thick}} 
\tikzset{mm lines/.style={gray, ultra thin}} 
\tikzset{strong lines/.style={black, very thin}} 
\tikzset{master lines/.style={black, very thick}} 
\tikzset{dashed master lines/.style={loosely dashed, black, very thick}} 

\node at ([xshift=1cm, yshift=8.5mm] current page.south west){
  \begin{tikzpicture}[remember picture, overlay]

    \draw[style=mm lines,step=1mm] (0,0) grid +(19cm,28cm); 
    \draw[style=strong lines,step=1cm] (0,0) grid +(19cm,28cm); 

  \end{tikzpicture}
};
\end{tikzpicture}


\end{document}

答案1

由于您已经在使用tikz,这里有一个使用节点(您已经在使用)的简单解决方案current page。我还稍微简化了您的代码。我希望这就是您想要的。

\documentclass[a4paper, 10pt]{article} % for A4 size paper
\usepackage{graphicx}
\usepackage{mwe}
\usepackage{tikz}
\tikzset{
  normal lines/.style={gray, very thin}, 
  margin lines/.style={gray, thick}, 
  mm lines/.style={gray, ultra thin}, 
  strong lines/.style={black, very thin}, 
  master lines/.style={black, very thick}, 
  dashed master lines/.style={loosely dashed, black, very thick}
}


\begin{document}
\pagestyle{empty}
\tikz [remember picture, overlay]
  \node at (current page.center) {
    \begin{tikzpicture}
      \draw[style=mm lines,step=1mm] (0,0) grid +(19cm,28cm); 
      \draw[style=strong lines,step=1cm] (0,0) grid +(19cm,28cm); 
    \end{tikzpicture}
  };

\tikz [remember picture, overlay]
  \node [anchor=north] at (current page.north) {\includegraphics[height=0.6cm]{example-image-a}};
\tikz [remember picture, overlay]
  \node [anchor=south] at (current page.south) {Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent viverra turpis ac semper auctor.};

\end{document}

输出:

输出

附录

您在标题中引用了 PDF 的第一页。我猜您想让这张方格纸的每一页都打印出来,但只有第一页有徽标和文字?您可以使用以下方法轻松创建更多带有网格的页面:

  \foreach \i in {1, 2, ..., 49} {
    \clearpage
    \tikz [remember picture, overlay]
      \node at (current page.center) {
        \begin{tikzpicture}
          \draw[style=mm lines,step=1mm] (0,0) grid +(19cm,28cm); 
          \draw[style=strong lines,step=1cm] (0,0) grid +(19cm,28cm); 
        \end{tikzpicture}
      };
  }

可以\end{document}在上例之前添加。这样会得到 50 页方格纸,第一页只包含徽标和文字。

相关内容