0

This question already has an answer here:

Well. I'm writing a manual to my work. And I have to put a header with the logo image and a footer for the pages. I'm trying to use \lhead{...} \cfoot{...} just to see if it work. but I just can't make it work.

here is my code style.

\documentclass{memoir}
\let\STARTCODE\relax 
\let\STOPCODE\relax 
\STARTCODE
\usepackage{fourier} % or what ever
\usepackage[scaled=.92]{helvet}%. Sans serif - Helvetica
\usepackage{color,calc}
\newsavebox{\ChpNumBox}
\definecolor{ChapBlue}{rgb}{0.00,0.65,0.65}
\makeatletter
\newcommand*{\thickhrulefill}{%
  \leavevmode\leaders\hrule height 1\p@ \hfill \kern \z@}
\newcommand*\BuildChpNum[2]{%
  \begin{tabular}[t]{@{}c@{}}
    \makebox[0pt][c]{#1\strut}  \\[.5ex]
    \colorbox{ChapBlue}{%
      \rule[-10em]{0pt}{0pt}%
      \rule{1ex}{0pt}\color{black}#2\strut
      \rule{1ex}{0pt}}%
  \end{tabular}}
\makechapterstyle{BlueBox}{%
  \renewcommand{\chaptername}{}
  \renewcommand{\chapnamefont}{\large\scshape}
  \renewcommand{\chapnumfont}{\Huge\bfseries}
  \renewcommand{\chaptitlefont}{\raggedright\Huge\bfseries}
  \setlength{\beforechapskip}{20pt}
  \setlength{\midchapskip}{26pt}
  \setlength{\afterchapskip}{40pt}
  \renewcommand{\printchaptername}{}
  \renewcommand{\chapternamenum}{}
  \renewcommand{\printchapternum}{%
    \sbox{\ChpNumBox}{%
      \BuildChpNum{\chapnamefont\@chapapp}%
      {\chapnumfont\thechapter}}}
  \renewcommand{\printchapternonum}{%
    \sbox{\ChpNumBox}{%
      \BuildChpNum{\chapnamefont\vphantom{\@chapapp}}%
      {\chapnumfont\hphantom{\thechapter}}}}
  \renewcommand{\afterchapternum}{}
  \renewcommand{\printchaptertitle}[1]{%
    \usebox{\ChpNumBox}\hfill
    \parbox[t]{\hsize-\wd\ChpNumBox-1em}{%
      \vspace{\midchapskip}%
      \thickhrulefill\par
      \chaptitlefont ##1\par}}%
}
\chapterstyle{BlueBox}
\STOPCODE
\setlength\afterchapskip {\onelineskip }
\setlength\beforechapskip {\onelineskip }

%ligando a numeração da subsection
\setcounter{secnumdepth}{3}
\maxtocdepth{subsection}
\maxtocdepth{subsubsection}

%alterando nome da tabela e da figura
\renewcommand{\figurename}{Figura: }
\renewcommand{\tablename}{Tabela: }

%cabeçalho
\usepackage{fancyhdr}
\lhead{LOGO IMAGE HERE}
\cfoot{TEXT HERE}

%Margem
\setlength{\evensidemargin}{0.3cm}
\setlength{\oddsidemargin}{0.3cm}

%tamanho que o texto ocupa
\textwidth=16cm

%fazendo os footers
\pagestyle{plain}

%%%%%%%%%%%%%
\usepackage{lipsum}
%para tabelas grandes
\usepackage{longtable}

%para colocar um width maximo para as figuras do comando
%[max width = ...]
\usepackage[export]{adjustbox}

%packages inseridos que não são do estilo.

\usepackage{placeins}
\usepackage{makeidx}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[table]{xcolor}

marked as duplicate by Johannes_B, user13907, Jesse, user31729, Svend Tveskæg Nov 14 '14 at 10:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • memoir provides it own facilities to place headers and footers. using fancyhdr will only break stuff. Please be aware of that. If you want to use fancyhdr, you need to use \pagestyle{fancy}, but since this package uses commands, that are obsolete for 20 years now, you need to enable this memoir-feature as well. – Johannes_B Nov 13 '14 at 14:51
1

memoir provides it own facilities to place headers and footers. Using fancyhdr will only break stuff. Please be aware of that. If you really want to use fancyhdr, you need to use \pagestyle{fancy}, but since this package (fancyhdr) uses commands, that are obsolete for 20 years now, you need to enable the memoir option oldfontcommands.

Here is the proper way to do the job.

\documentclass{memoir}
\makepagestyle{guilherme}
\makeevenhead{guilherme}{\includegraphics[width=1cm]{example-image-1x1}}{}{}
\makeoddhead{guilherme}{}{}{\includegraphics[width=1cm]{example-image-1x1}}
\makeevenfoot{guilherme}{}{TEXT}{}
\setlength{\headheight}{35pt}
\pagestyle{guilherme}
\usepackage{mwe}
\begin{document}
\chapter{Test Me If You Can}
\blindtext

\blindtext[14]
\end{document}

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