0

I'm trying to make my personal code for a report template. I would have the logo of the company only in the first page and maintain the header and footer in the rest of the document.

\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}

I can't understand where I'm wrong. Please help me!

  • 1
    Welcome to TeX.SE! Please -- as usual here -- make your given code snippet compilable. Then we can simply copy your code and test it on our own computer. As it stands now we have to guess what you are doing ... – Mensch Oct 11 '18 at 16:07
  • 1
    I shared it in the brackets. It is not visible? – Lorenzo D'Eleuterio Oct 12 '18 at 6:18
  • 1
    You missunderstood me: the given code is not complete, for example \begin{document} is missing. To be able to test what you are doing with guessing we need an complete, compilable TeX code, called MWE (minimal working example) ... – Mensch Oct 12 '18 at 12:12
1

For a single page, I use tikzpagenodes. Actually, I avoid fancyhdr as much as possible. It has some nasty habits.

Remember to run this twice.

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.