# [texhax] Tex problem

Ulrike Fischer news3 at nililand.de
Thu Apr 16 17:51:21 CEST 2009

Am Thu, 16 Apr 2009 08:58:06 +0000 schrieb Lore M:

> PS : Here is my problem =>
> I'd like to realise an automatic repport with
> the combination of R and Latex (Sweave package). I create several plots with R, and then
> I'd like to include them in my Latex document. The thing is that I
> don't know how many plots I'll get before I run my program, so I can't
> write \includegraphics for every plots. Therefore my code is :
>
>
> \multido{\i=1+1}{\Sexpr{numPage}}{\includegraphics[page=\i]{image.pdf}}
>
>
>
>
> Each plot is on 1 page of my pdf file "image.pdf" and I include all
> the pages (here, there are "numPage" pages). The problem is that all
> the plots are on the same line and I get a "Overful box" because there
> are too many plots. Could you help me ?

Give LaTeX a chance to find a place to break the line. Add e.g. a
space after the graphic.

If you want a paragraph break after each graphics you should
probably better use whiledo from the ifthen package

\documentclass{article}
\usepackage{ifthen}
\newcounter{myloop}
\setcounter{myloop}{1}
\begin{document}
\whiledo{\value{myloop}<50}
{\themyloop: \rule{4cm}{3cm}\par
\stepcounter{myloop}}
\end{document}

--
Ulrike Fischer