[R] Page width figures in Latex

Duncan Murdoch murdoch at stats.uwo.ca
Mon Mar 29 12:33:05 CEST 2010

Sharpie wrote:
> Jim Lemon wrote:
>> bRotheRs & sisteRs,
>> I am once again attempting to learn enough Latex voodoo to get something 
>> done, and failing comically. The document "RJAuthorguide.pdf"
>> mentions that one can get page width figures through the use of the 
>> "figure*" or "table* environments, but despite considerable searching 
>> through the mail archives and reading Frank Harrell's discussion of 
>> "Using Latex Figure Environments for Plots" until my eyes went on 
>> strike, I am nowhere near a solution. Would anyone be kind enough to 
>> point me to the Idiot's Guide to Latex Figure Environments?
>> Jim
> As far as I can recall, figure* and table* are used to create figures/tables
> that span the entire page when the rest of the document is in twocolumn or
> multicol mode.  I.e. these environments allow you to break out of a
> multi-column layout to place a figure that acts like it was in a normal
> single-column layout.
> There are a bunch of caveats such as the figure/table will only appear at
> the top or bottom of a page and will not appear on the same page as the
> point at which it was declared in the source.  That is to say, when you
> declare a figure* in a LaTeX document, one page break must pass before the
> environment actually gets set in your document- no matter what !h or H vodoo
> you pull.
> If your document is not using multiple columns, then you may want to specify
> the width of your figure when you place it using \includegraphics.  In order
> to scale the figure so that it spans the entire page, set the width argument
> equal to \textwidth:
> \begin{figure}
>   \centering
>   \caption{A graph of x verses y along with a linear regression fit.}
>   \label{fig:xVsY}
>   \includegraphics[width=\textwidth]{/path/to/your/figure}
> \end{figure}
One R-specific warning:  by default, R includes relatively wide borders 
around plots, and those are included in the bounding box that is used 
when resizing to \textwidth.  So you may find that your plot is not 
quite the full width unless you adjust the margins when you do your 
plot, or recalculate the bounding box.

Duncan Murdoch
> Some good resources are:
> The LaTeX Wikibook:
>   http://en.wikibooks.org/wiki/LaTeX
> Getting to Grips with LaTeX:
>   http://www.andy-roberts.net/misc/latex/
> Hope this helps!
> -Charlie
> -----
> Charlie Sharpsteen
> Undergraduate-- Environmental Resources Engineering
> Humboldt State University

More information about the R-help mailing list