# [R] Help with Latex (Hmisc)

Frank E Harrell Jr f.harrell at vanderbilt.edu
Tue Feb 24 23:55:01 CET 2009

jimdare wrote:
> Dear R Users,
>
> I have three questions.
>
> 1)  Is there a way to get the output tex file to include
>
> \documentclass{report}
> \begin{document}
>
> and
>
> \end{document}
>
> so I can generate a PDF straight away.  (I am trying to generate hundreds of
> these and don't want to have to manually type this in every time I load a
> tex file).

See the dvi and dvips function in Hmisc under the help file for latex.
You could use these functions as models to write a dvipdf function.

>
> 2)  When I have have a table of greater than 9 columns, the columns to the
> right tend to get cut off (see attached PDF "SNA cutoff").  Is it possible
> to specify that if the number of columns >9, continue the table below (see
> attached PDF "Desired result". Excuse my crude editing skills but you get
> the idea).

use the longtable option and landscape mode

>
> 3) This is not so related to R but I thought someone may know the answer.
> Is there a way to maintain the image quality when I copy these tables into a
> word document?   The file "Desired result" shows how copying from the
> original pdf ("SNA cutoff") drastically reduces the quality (note the word
> doc was re-converted to a PDF for posting).

It depends on how you copy.  By all means use Insert ... Picture ...
from file and directly insert pdf.  In OpenOffice you can directly
insert encapsulated postscript.

Frank

>
> Regards,
> James
>
> http://www.nabble.com/file/p22191035/SNA%2Bcutoff.pdf SNA+cutoff.pdf
> http://www.nabble.com/file/p22191035/Desired%2Bresult.pdf Desired+result.pdf

--
Frank E Harrell Jr   Professor and Chair           School of Medicine
Department of Biostatistics   Vanderbilt University



More information about the R-help mailing list