0

I have some text and I would like to include some images on top of page 2 and page 4 and on the bottom of page 7. I tried the code below but I could not get the right formatting. I would be grateful for your help.

 \documentclass[10pt,a4paper]{extarticle}
 \usepackage{lipsum}


 \begin{document}

 \begin{figure}[p=2,t]
 \centering 
 \includegraphics{a.pdf}
 \end{figure}

 \begin{figure}[p=4,t]
 \centering 
 \includegraphics{b.pdf}
 \end{figure}

 \begin{figure}[p=7,b]
 \centering 
 \includegraphics{c.pdf}
 \end{figure}

 \lipsum[1-500]

 \end{document}
3
  • p means a dedicated page for floats, but you can select the page by being clever with \afterpage. Dec 29 '15 at 22:24
  • Do you need to put the graphics in floating environments? If you know exactly where you want to put your illustrations, then you could just put in manual page breaks and use \includegraphics on it's own without the figure environments.
    – Thruston
    Dec 29 '15 at 23:09
  • The text and the actual graphics may change so I need a template where the text wraps around the graphics which are in specified places in the report.
    – adam.888
    Dec 30 '15 at 11:02
1

You can also pack \onpage into the previous \onpage, but this way is less confusing.

\documentclass[10pt,a4paper]{extarticle}
 \usepackage{afterpage}
 \usepackage{mwe}

\def\bottomfraction{0.5}% allows bigger figures on bottom of page

 \newcommand{\onpage}[2]% #1 = page, #2 = code
  {\ifnum\value{page}<#1\relax\afterpage{\onpage{#1}{#2}}%
   \else#2\fi}

 \begin{document}

 \onpage{2}{%
 \begin{figure}[t]
 \centering 
 \includegraphics{example-image-a}
 \end{figure}}}%

 \onpage{4}{%
 \begin{figure}[t]
 \centering 
 \includegraphics{example-image-b}
 \end{figure}}}%

 \onpage{7}{%
 \begin{figure}[b]
 \centering 
 \includegraphics{example-image-c}
 \end{figure}}}%

 \lipsum[1-40]

 \end{document}
0

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.