Latex 图像页眉和页脚

Posted

技术标签:

【中文标题】Latex 图像页眉和页脚【英文标题】:Latex Image headers and footers 【发布时间】:2020-08-30 09:18:27 【问题描述】:

我正在尝试在 LaTex 中创建一个机构页面,该页面必须具有我的机构提供的页眉和页脚,并且无法更改,所以我试图用我的下一个代码强制它们借用这里https://tex.stackexchange.com/questions/297240/adding-an-image-to-a-header-in-latex

\documentclass[12pt,letterpaper]article


\usepackagefancyhdr
\usepackage[left=4cm,top=4cm,right=3cm,bottom=3cm,headheight=3.8cm]geometry

\pagestylefancy
\usepackagetikz
\usetikzlibrarycalc
\usepackagetikzpagenodes
\renewcommand\headrulewidth0pt
\renewcommand\footrulewidth0pt


\fancyfoot[R]\begintikzpicture[remember picture,overlay]
\draw  let \p1=($(current page footer area.north)-(current page.south)$),
      \n1=veclen(\x1,\y1) in
node [inner sep=0,outer sep=0,below right] 
      at (current page.south west)\includegraphics[width=\paperwidth,height=\n1]exampleH;
\endtikzpicture


\fancyhead[L]\begintikzpicture[remember picture,overlay]
\draw  let \p1=($(current page.north)-(current page header area.south)$),
      \n1=veclen(\x1,\y1) in
node [inner sep=0,outer sep=0,below right] 
      at (current page.north west)\includegraphics[width=\paperwidth,height=\n1]ExampleF;
\endtikzpicture





\begindocument
\sectionFirst section
Type your document as usual!
\newpage
\sectionSecond section
Type your document as usual!
\enddocument

【问题讨论】:

【参考方案1】:

问题是您将页脚图片放置在页面底部边框下方。如果您将节点放在下边界上方,您会看到它:

\documentclass[12pt,letterpaper]article


\usepackagefancyhdr
\usepackage[left=4cm,top=4cm,right=3cm,bottom=3cm,headheight=3.8cm]geometry

\pagestylefancy
\usepackagetikz
\usetikzlibrarycalc
\usepackagetikzpagenodes
\renewcommand\headrulewidth0pt
\renewcommand\footrulewidth0pt



\fancyfoot[R]\begintikzpicture[remember picture,overlay]
\draw  let \p1=($(current page footer area.north)-(current page.south)$),
      \n1=veclen(\x1,\y1) in
node [inner sep=0,outer sep=0,above right] 
      at (current page.south west)\includegraphics[width=\paperwidth,height=\n1]example-image-duck;
\endtikzpicture

\fancyhead[L]\begintikzpicture[remember picture,overlay]
\draw  let \p1=($(current page.north)-(current page header area.south)$),
      \n1=veclen(\x1,\y1) in
node [inner sep=0,outer sep=0,below right] 
      at (current page.north west)\includegraphics[width=\paperwidth,height=\n1]example-image-duck;
\endtikzpicture





\begindocument
\sectionFirst section
Type your document as usual!
\newpage
\sectionSecond section
Type your document as usual!
\enddocument

【讨论】:

以上是关于Latex 图像页眉和页脚的主要内容,如果未能解决你的问题,请参考以下文章

在 C# 中从 .docx 文件的页眉和页脚获取图像

我想使用 mpdf 在 PDF 中设置页眉和页脚

将页眉和页脚作为内联 C# 添加到电子邮件

具有固定页眉和页脚以及可滚动内容的模态对话框

使用 CSS 创建页眉和页脚进行打印

如何在Excel中设置页眉和页脚