1

I need to add two pictures, one at the top and one at the bottom of every page of my article (to format it for a congress). I've find a way that worked for the top picture there is shown below:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[top=160pt]{geometry}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{float}

\usepackage{everypage}

\def\PageTopMargin{1cm}
\def\PageLeftMargin{0in}
\newcommand\atxy[3]{%
 \AddEverypageHook{\smash{\hspace*{\dimexpr-\PageLeftMargin-\hoffset+#1\relax}%
  \raisebox{\dimexpr\PageTopMargin+\voffset-#2\relax}{#3}}}}
\atxy{0in}{0in}{\raisebox{-\height}{\includegraphics[width=15cm]{imagens/Cabeçalho.jpg}}}

\title{Test}
\author{MasterChief}

\begin{document}

\maketitle

\lipsum[1-7]
\begin{figure}[H]
  \centering
  \includegraphics[]{example-image-b}
  
\end{figure}

\lipsum[2-10]
\end{document}

The output is:

enter image description here

I adapted the code from this question of the forum: How to put an image at the top/bottom border of every page?, and it worked fine for the top picture, although I don't know how to add the bottom picture just based on it.

So I wanted to know how to add the bottom picture based on this, or if there's an easier way to do it. (Using other packages or something similar)

**Edit:**I also need to include the page number on the right upper corner of the bottom picture. The configurations that worked for me (maintaining the formating that I need and without overwriting the text below) were:

\usepackage[left=2.0cm,right=2.0cm,bottom=2.0cm,bmargin=3.90cm,tmargin=4.1cm,headheight=3.25cm,
     headsep=1\baselineskip]{geometry}

\fancypagestyle{plain}{%
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
    \fancyhf{}
    \fancyhead[C]{\includegraphics[width=\linewidth, height=3cm]{imagens/Cabeçalho.jpg}}%
    \fancyfoot[C]{\includegraphics[width=\linewidth, height=3.25cm]{imagens/Rodapé.jpg}}
}
\footskip=97pt
\pagestyle{plain}
\fancyfoot[R]{\thepage}

The output that I'm getting is:

enter image description here

and the result that I need is:

enter image description here

So in sum, all the page number are located on the right corner and I just need to deslocate the number of the page to a position similar to that without modfiyng the margins of the pictures.

1
  • Welcome. // Have a look at fancyhdr ctan.org/pkg/fancyhdr . See also other packages mentioned there at the bottom.
    – MS-SPO
    Commented Aug 29, 2022 at 3:18

1 Answer 1

3
  • Are article has numbered pages?
  • If yes, where numbers should be placed?

An example using fancyhdr package, based on answer on question (to which your question is actually duplicate), without numbered pages, can be:

Edit: From OP comment and latter edited question follows, that pages are numbered and that numbers are above bottom images at its north east side.

Since from MWE in question follows, that article is one side, the possible solution is simple:

\documentclass{article}
\usepackage[a4paper,
            hmargin=1in,            % <---
            headheight=0.5in, headsep=1\baselineskip,
            vmargin={1in, 1.3in},   % <---
            showframe   % remove in the real document
            ]{geometry}
\usepackage{graphicx}
\usepackage{fancyhdr}

\fancypagestyle{plain}{%
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
    \fancyhf{}
    \fancyhead[C]{\includegraphics[width=\linewidth, height=0.5in]{example-image-a}}%
    \fancyfoot[C]{\hfill\thepage\par\smallskip
                    \includegraphics[width=\linewidth, height=0.5in]{example-image-b}}
                 }
\usepackage{lipsum}

\title{Test}
\author{MasterChief}

\pagestyle{plain}
\begin{document}
\maketitle
\lipsum\lipsum
\end{document}

enter image description here

However, in conferences proceedings articles are usually two sided. In such cases, the MWE can be as follows:

\documentclass[twoside]{article}    % <---
\usepackage[a4paper,
            hmargin=1in,            % <---
            headheight=0.5in, headsep=1\baselineskip,
            vmargin={1in, 1.3in},   % <---
            showframe   % remove in the real document
            ]{geometry}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{ifoddpage}  % <--- added

\fancypagestyle{plain}{%
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
    \fancyhf{}
    \fancyhead[C]{\includegraphics[width=\linewidth, height=0.5in]{example-image-a}}%
    \fancyfoot[C]{\checkoddpage
                    \ifoddpage
                    \hfill\thepage
                    \else
                    \thepage\hfill\mbox{}
                    \fi\par\smallskip
                    \includegraphics[width=\linewidth, height=0.5in]{example-image-b}}
                 }
\usepackage{lipsum}

\title{Test}
\author{MasterChief}

\pagestyle{plain}
\begin{document}
\maketitle
\lipsum\lipsum
\end{document}

enter image description here

Edit (2): Even after your editing of question, it still has lack of many (important) information. So below is only skeleton how can be designed bottom image:

\documentclass{article}
\usepackage[hmargin=2cm, vmargin={4.1cm, 3.9cm}, 
            headheight=3.25cm, headsep=1\baselineskip]{geometry}
\usepackage{graphicx}
\usepackage{tikz}               % <--- new
\usetikzlibrary{positioning}    % <--- new

\usepackage{fancyhdr}
\fancypagestyle{plain}%
{
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
    \fancyhf{}
    \fancyhead[C]{\includegraphics[width=\linewidth, height=3cm]{example-image-a}}%
    \fancyfoot[C]{\begin{tikzpicture}
        \node (a) [inner sep = 0pt] {\includegraphics[width=\linewidth, height=3.25cm]{example-image-b}};
        \node     [below left=7mm and 1mm of a,
                   font=\huge\bfseries, text=red,   % <--- change according to your wish,
                   anchor=north east] at (a.north east) {\thepage};
                  \end{tikzpicture}}
}

\usepackage{lipsum}

\title{Test}
\author{MasterChief}

\pagestyle{plain}
\begin{document}
\maketitle
\lipsum
\end{document}

enter image description here

A p

4
  • Do I need to exclude this question because it is a duplicate? And yes, I need to display the number on the upper east corner of the bottom image, I'll try to edit my question and add this detail ilustrated with a picture. But thanks for the help ^ ^, I'm kinda new to LaTeX and still struggling with simple things. Commented Aug 30, 2022 at 18:52
  • @Leonardo_Gomes, see edited answer. Is now what you after?
    – Zarko
    Commented Aug 30, 2022 at 22:40
  • Not exactly, I need a way to deslocate the position where the number of page is being shown, but without moving the margins of the bottom picture. I'll put the configurations that I've used and the output that I'm getting on the edit. Commented Sep 2, 2022 at 2:19
  • @Leonardo_Gomes , you should make your question more clear. Since added code doesn't work, it is not clear, where is positioned a page number, what color it should has, font size etc ...
    – Zarko
    Commented Sep 2, 2022 at 4:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .