如何仅在第一页显示徽标

如何仅在第一页显示徽标

我正在尝试为报告模板编写个人代码。我会在第一页只显示公司徽标,并在文档的其余部分保留页眉和页脚。

\documentclass[11pt]{report}
\usepackage[T1]{fontenc}
\usepackage{pbox}  
\usepackage{graphicx} 
\usepackage{xcolor}
\usepackage[a4paper,top=2cm,bottom=2.5cm,left=2.01cm,rigt=2.1cm,bindingoffset=0mm]{geometry}

\usepackage{latexsym} 
\usepackage{framed} 
\setlength\headheight{33pt} %% just to make warning go away. Adjust the value after looking into the warning.
\usepackage{fancyhdr, lastpage}

\fancyhf{} 


\lhead{\includegraphics[scale=1]{logo.PNG}}
\chead{}
\rhead{\footnotesize\bfseries{\pbox[b]{\textwidth}{\color{gray}xxx\\ xxx}}}

\renewcommand{\headrulewidth}{0.4pt} 
\renewcommand{\headrule}{\hbox 
   to\headwidth{\color{red}\leaders\hrule 
   height\headrulewidth\hfill}} 



   \rfoot{\thepage} 
   \renewcommand{\footrulewidth}{0.4pt}
 \renewcommand{\footrule}{\hbox 
   to\headwidth{\color{red}\leaders\hrule height 
    \footrulewidth\hfill}}

  \pagestyle{plain}

我不明白我错在哪里。请帮帮我!

答案1

对于单个页面,我使用 tikzpagenodes。实际上,我尽可能避免使用 fancyhdr。它有一些不好的习惯。

记得运行两次。

\documentclass[11pt]{report}
\usepackage[T1]{fontenc}% why do people use XeLaTeX fonts in MWEs?
\usepackage{pbox}  
\usepackage{graphicx} 
\usepackage{xcolor}
\usepackage[a4paper,top=2cm,bottom=2.5cm,left=2.01cm,right=2.1cm,bindingoffset=0mm,headsep=10pt]{geometry}

\usepackage{latexsym} 
\usepackage{framed} 
\usepackage{lastpage}

\usepackage{tikzpagenodes}
\usepackage{lipsum}% MWE only

\begin{document}
\begin{tikzpicture}[remember picture,overlay]
  \node[above right, inner sep=0pt] at (current page header area.south west)
    {\includegraphics[height=33pt]{example-image}};
  \node[above left, inner sep=0pt] at (current page header area.south east)
    {\footnotesize\bfseries{\pbox[b]{\textwidth}{\color{gray}xxx\\ xxx}}};
\end{tikzpicture}
\lipsum[1-10]
\end{document}

相关内容