2

I'm beginner in LaTeX, and I will start with a easy example, but I can't create, because the items make incorrect, I don't know how I can put the elements in place, for example:

The image, header and footer, need to be on every page

Header (The tables generator online, don't create this table in example)

Content

Footer

\documentclass{article} 
\usepackage{graphicx,pgffor}
\title{\vspace{-7em}MyTitle} 



\begin{document}

\header{MyHeader}

\begin{foreach} 
    \foreach \i in {1,...,10}{
        \begin{figure} \includegraphics[width=1.0\textwidth]{C:/Users/myuser/Pictures/Img/imagem\i.jpg} \end{figure}
    }
\end{foreach}

\footer{Myfooter}

\end{document}

enter image description here

3
  • It would be helpful if you could show us what you are able to put togehter.
    – A.Ellett
    Oct 3, 2018 at 16:17
  • My difficulty is to order the elements, for example I already added the images in the document, however when I try to add the header, it creates a page only for the header
    – Kaue
    Oct 3, 2018 at 16:20
  • Is it possible create a document, like the attached?
    – Kaue
    Oct 3, 2018 at 16:30

1 Answer 1

3

Here's presentation of that shows you some ways of doing this:

enter image description here

I used TikZ here because I saw you were already using pgffor.

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{mwe}%%<-- only for example text, not necessary for real document

\usepackage{lastpage}%% <-- package to remember how many pages are in document (requires two runs of LaTeX)
\usepackage{fancyhdr}%% <-- very nice package for headers and footers of each page
\pagestyle{fancy}

\renewcommand\headrulewidth{0pt}
\renewcommand\footrulewidth{0pt}
%% setting the header and footers           
%% read the documentation for `fancyhdr`    
%% this isn't the only way to approach this.
\lhead{}
\chead{}
\rhead{}
\lfoot{}
%% OK, probably fancier than you need, but it gives you an idea 
%% that these things can be done according to pages             
%% This doesn't have to be an if/then/else statement.           
\cfoot{\ifnum\thepage=1\relax Copyright blah blah blah\else Something else\fi}
\rfoot{\thepage\ of \pageref{LastPage}}%% 

%% A way to store this information.  Yes, LaTeX has its own 
%% internals for these sorts of things.  I just want to show
%% alternatives.                                            
\newcommand\mytitle{THIS IS MY TITLE}
\newcommand\mysubtitle{this is my subtitle}

\begin{document}

\noindent
\begin{tikzpicture}
  \coordinate (TL) at (0,0);
  \coordinate (TR) at (\columnwidth,0);
  \node[anchor=north west,draw,inner sep=0pt] (PIC) at (TL) {\includegraphics[width=2in]{example-image-a}};
  \coordinate (BR) at (PIC.south-|TR);
  \coordinate (CR) at (PIC.east-|TR);
  \draw (TL) rectangle (BR);
  \draw (PIC.east) -- (CR);
  \path (PIC.east) -- node[midway] {\mytitle}    (TR);
  \path (PIC.east) -- node[midway] {\mysubtitle} (BR);
\end{tikzpicture}


{\centering\Large 
  \mytitle\ Again
\par\addvspace{2ex}}
%% \par triggers \centering to take effect             
%% parentheses prevent this from effecting the rest of 
%% the document.                                       

  ARMA virumque cano, Troiae qui primus ab oris
  Italiam, fato profugus, Laviniaque venit
  litora, multum ille et terris iactatus et alto
  vi superum saevae memorem Iunonis ob iram;
  multa quoque et bello passus, dum conderet urbem,
  inferretque deos Latio, genus unde Latinum,
  Albanique patres, atque altae moenia Romae.

  Musa, mihi causas memora, quo numine laeso,
  quidve dolens, regina deum tot volvere casus
  insignem pietate virum, tot adire labores
  impulerit.  Tantaene animis caelestibus irae?

  Urbs antiqua fuit, Tyrii tenuere coloni,
  Karthago, Italiam contra Tiberinaque longe
  ostia, dives opum studiisque asperrima belli;
  quam Iuno fertur terris magis omnibus unam
  posthabita coluisse Samo; hic illius arma,
  hic currus fuit; hoc regnum dea gentibus esse,
  si qua fata sinant, iam tum tenditque fovetque.
  Progeniem sed enim Troiano a sanguine duci
  audierat, Tyrias olim quae verteret arces;
  hinc populum late regem belloque superbum
  venturum excidio Libyae:  sic volvere Parcas.
  Id metuens, veterisque memor Saturnia belli,
  prima quod ad Troiam pro caris gesserat Argis---
  necdum etiam causae irarum saevique dolores
  exciderant animo:  manet alta mente repostum
  iudicium Paridis spretaeque iniuria formae,
  et genus invisum, et rapti Ganymedis honores.
  His accensa super, iactatos aequore toto
  Troas, reliquias Danaum atque immitis Achilli,
  arcebat longe Latio, multosque per annos
  errabant, acti fatis, maria omnia circum.
  Tantae molis erat Romanam condere gentem!

  Vix e conspectu Siculae telluris in altum
  vela dabant laeti, et spumas salis aere ruebant,
  cum Iuno, aeternum servans sub pectore volnus,
  haec secum:  'Mene incepto desistere victam,
  nec posse Italia Teucrorum avertere regem?
  Quippe vetor fatis.  Pallasne exurere classem
  Argivom atque ipsos potuit submergere ponto,
  unius ob noxam et furias Aiacis Oilei?

\vspace*{\fill}

\begin{center}
\includegraphics[height=3in]{example-image}
\end{center}

\pagebreak

something else

\end{document}

One thing that I notice you're doing which will probably give you headaches is using a float environment in a context where you want to nail down where the image goes. The image in the upper left hand corner should not be in a float environment if that's where you want to place it. Float environments are used for tables and figures for which you're willing to let LaTeX make these designs about best placement.

1
  • Thank you very much, now I will learn how to do it, it was difficult to find similar examples on the internet
    – Kaue
    Oct 3, 2018 at 16:35

You must log in to answer this question.

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