2

I'm trying to make an equal header and footer from the image below

enter image description here

I saved the header and footer as an image. Below my attempt, the header was right, but the text was left without left margin and without bottom margin

\documentclass[a4paper, 12pt]{article}
\usepackage[top=3cm, bottom=4.3cm, left=3cm, right=2cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usepackage[T1]{fontenc}
\usepackage{graphics,graphicx}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,arrows,shapes,shadows,fit,patterns,quotes,spy}
\usepackage{lipsum}
\usepackage[fontsize=12pt]{scrextend}

%\renewcommand{\footrulewidth}{1pt}

\geometry{a4paper, includehead, top=-0.4cm, left=0cm}
\setlength\headheight{3cm}
\setlength\headwidth{\paperwidth}

\cfoot{\includegraphics[height=2.3cm]{g.png}}
\renewcommand{\headrulewidth}{0pt}

\chead{\includegraphics[width=\headwidth]{k.png}}
\renewcommand{\headrulewidth}{1pt}


%\chead{\makebox[\paperwidth][c]{\includegraphics{k.png}}}


\begin{document}

\lipsum

\end{document}

enter image description here

enter image description here

  • 1
    Just a guess: You want these not in the header*/*footer, but instead across the entire page width at the top*/*bottom of the page... is this the case? – Werner Oct 20 '17 at 21:36
  • yes, I will try here by placing upper margin 0pt and add the image at the top. – Marcelo Rodrigues Oct 20 '17 at 21:43
  • 1
    Do you want this only on the first page, or on every page? – Werner Oct 20 '17 at 21:45
  • every page. the footer I was able to do using \ cfoot, the image above can not make it stay in the width of the page, it obeys the left margin – Marcelo Rodrigues Oct 20 '17 at 21:46
4

The follow code uses eso-pic to place the respective images at the top and bottom of the page boundary. This way you can still set a regular header/footer and/or change the page geometry without affecting the placement.

enter image description here

\documentclass{article}

\usepackage{graphicx,eso-pic}
\usepackage{lipsum}

\AddToShipoutPictureBG{%
  \AtPageUpperLeft{%
    \raisebox{-\height}{\includegraphics[width=\paperwidth]{k.png}}
  }
  \AtPageLowerLeft{%
    \makebox[\paperwidth]{\includegraphics[height=2.3cm]{g.png}}
  }%
}

\begin{document}

\lipsum

\end{document}
|improve this answer|||||
  • Thank you very much, solved my problem. I just changed the image below because in the original template below the image still has the margin and will not number, I used the \ cfoot. One question, is it possible to use some command to make the images more opaque? In the original Word template, the images appear more opaque – Marcelo Rodrigues Oct 20 '17 at 22:08
  • 1
    @MarceloRodrigues: More opaque? No. Less opaque (or more transparent)? Yes. Load the transparent package (\usepackage{transparent} in your preamble) and then include \transparent{<value>} just before using \includegraphics. A <value> of 0.5[0.1] would make the image 50% [10%] opaque. Requires at least two compilations. – Werner Oct 20 '17 at 22:17
  • When I put the command \ transparent {0.5}, \cfoot{\transparent{0.5}\includegraphics[width=\textwidth]{g.png}}, the image goes a little further down, any suggestions? – Marcelo Rodrigues Oct 20 '17 at 22:49
  • 1
    @MarceloRodrigues: I see this output when using this code. It places the header/footer in the background with different transparencies on the two-page document. There is no movement of the images with/without \transparent{<value>}. – Werner Oct 20 '17 at 23:24
  • 1
    @MarceloRodrigues: You can use \raisebox{<dim>}{\makebox[\paperwidth]{\includegraphics[height = 2.3cm]{g.png}}} in order to raise the included image by <dim>. That way you can still use the regular header/footer for whatever (page numbers or something else). – Werner Oct 21 '17 at 1:36
1

Like this? I had to define values for \fancyhfoffset on both sides, equal to the left and right margins:

\documentclass[a4paper, brazil, 12pt]{article}
\usepackage[top=120pt, bottom=4.3cm, left=3cm, right=2cm, headheight=95pt, footskip=66pt]{geometry}%
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,arrows,shapes,shadows,fit,patterns,quotes,spy}
\usepackage{lipsum}
\usepackage[fontsize=12pt]{scrextend}

%\renewcommand{\footrulewidth}{1pt}

%\geometry{a4paper, includehead, top=-0.4cm, left=2cm}
\setlength\headwidth{\paperwidth}

\fancyhfoffset[L]{3cm}\fancyhfoffset[R]{2cm}

\cfoot{\includegraphics[width=\headwidth]{g.png}}
\renewcommand{\headrulewidth}{0pt}

\chead{\includegraphics[width=\headwidth]{k.png}}
\renewcommand{\headrulewidth}{1pt}
\begin{document}

\lipsum

\end{document} 

enter image description here

|improve this answer|||||
  • Good solution. When I put the command \ transparent {0.5}, \cfoot{\transparent{0.5}\includegraphics[width=\textwidth]{g‌​.png}}, the image goes a little further down, any suggestions? – Marcelo Rodrigues Oct 20 '17 at 22:54
  • 1
    @MarceloRodrigues: Not really. Maybe try \makebox[0pt]{\inclcludegraphics{...}}? – Bernard Oct 20 '17 at 23:07
  • Many thanks, it worked out using \cfoot{\makebox[0pt]{\transparent{0.5}\includegraphics[width=\textwidth]{g.png}}} – Marcelo Rodrigues Oct 20 '17 at 23:32

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.