Re: [R] Hmisc latex function with longtable option

From: Frank E Harrell Jr <f.harrell_at_vanderbilt.edu>
Date: Wed, 02 Jul 2008 11:46:05 -0500

Erik Iverson wrote:
> Hello -
>
> I'm trying to use Hmisc's latex function to produce a postscript file of
> a data.frame, using the longtable = TRUE option. When I run, for example,
>
> ## sample R code
> dvips(latex(data.frame(a = rnorm(100), b = rnorm(100)),
> longtable = TRUE), file = "test.ps")
>
> latex runs successfully and a test.ps file is produced. However, I see
> the following in the output that the latex command sends to the R buffer.
>
> ...
> Package longtable Warning: Column widths have changed
> (longtable) in table 1 on input line 121.
>
>
> Package longtable Warning: Table widths have changed. Rerun LaTeX.
> ...
>
> And the resulting test.ps file has the column headings not aligned (in
> my real life example, there are other misalignments).
>
> To resolve this, I am currently going into the /tmp/Rtmp****/ directory
> where the .tex files are created by the dvi.latex function, and
> rerunning latex on the appropriate file****.tex file.
>
> Is there any thing I'm missing that would make this easier?
>
> Thanks,
> Erik Iverson
> iverson_at_biostat.wisc.edu

longtable requires two passes at the LaTeX code to finish the job. If you use

m <- latex(..., file='my.tex')

and \include{my} in a master document, you can run latex twice on the master to get the desired result.

Frank

>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 02 Jul 2008 - 16:50:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Jul 2008 - 17:31:50 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive