Hi list,
Excuse me b/c this is probably a more "TeX" then "R"
question.
I've been using "latex" function in my .Rnw file to
generate tables, but I've always been using it without assigning the
result to a object, i.e.
x <- matrix(1:6, nrow=2,
dimnames=list(c('a','b'),c('c','d','this that')))
latex(x)
so, I always get the error window (attached) poped out. But since I can
just click OK and everything seems fine except in my working directory I get a bunch of "junk" files (.log, .dvi, etc...), I've been ignoring
it.
Now I know by doing e.g. tmp <- latex(x) will suppress
this error message, but I'm still curious on how to get rid of the error window when I just use latex(x). I read the "Example" section of
"latex" help file and I tried to include the following into my PATH:
"C:\Program Files\MiKTeX 2.7\tex\latex"
but that didn't work.
I'm
using R.2.11.0, Hmisc 3.7, and MiKtex 2.7 on WinXP.
Thanks!
...Tao
a question about "latex" in Hmisc
30 messages · Richard M. Heiberger, Shi, Tao, Erik Iverson +5 more
Messages 1–25 of 30
Shi, Tao wrote:
Hi list,
Excuse me b/c this is probably a more "TeX" then "R"
question.
I've been using "latex" function in my .Rnw file to
generate tables, but I've always been using it without assigning the
result to a object, i.e.
x <- matrix(1:6, nrow=2,
dimnames=list(c('a','b'),c('c','d','this that')))
latex(x)
so, I always get the error window (attached) poped out. But since I can
just click OK and everything seems fine except in my working directory I get a bunch of "junk" files (.log, .dvi, etc...), I've been ignoring
it.
Your attachment did not come through, most likely because it is not a type that is supported by the list.
Now I know by doing e.g. tmp <- latex(x) will suppress this error message, but I'm still curious on how to get rid of the error window when I just use latex(x). I read the "Example" section of "latex" help file and I tried to include the following into my PATH: "C:\Program Files\MiKTeX 2.7\tex\latex"
Well I can't directly help you with your issue, since I don't know what error you're receiving, the reason this is happening is that when you don't assign the result of your latex call, the function 'print.latex' is getting called, which if I understand tries to compile the LaTeX output and display the result in a suitable viewer. By assigning the results of the latex call in R, you stop this printing from happening. As for what your issue is, I don't know since your attachment did not come through.
Hi Tao, I think you just need latex(x, file="") Best, Ista
On Wednesday 12 May 2010 3:18:42 pm Shi, Tao wrote:
Hi list,
Excuse me b/c this is probably a more "TeX" then "R"
question.
I've been using "latex" function in my .Rnw file to
generate tables, but I've always been using it without assigning the
result to a object, i.e.
x <- matrix(1:6, nrow=2,
dimnames=list(c('a','b'),c('c','d','this that')))
latex(x)
so, I always get the error window (attached) poped out. But since I can
just click OK and everything seems fine except in my working directory I
get a bunch of "junk" files (.log, .dvi, etc...), I've been ignoring it.
Now I know by doing e.g. tmp <- latex(x) will suppress
this error message, but I'm still curious on how to get rid of the error
window when I just use latex(x). I read the "Example" section of "latex"
help file and I tried to include the following into my PATH:
"C:\Program Files\MiKTeX 2.7\tex\latex"
but that didn't work.
I'm
using R.2.11.0, Hmisc 3.7, and MiKtex 2.7 on WinXP.
Thanks!
...Tao
Shi, Tao wrote:
so, I always get the error window (attached) poped out.
The image was stripped by the mailer. Please type the text of the error into the body of the email.
I tried to include the following into my PATH: "C:\Program Files\MiKTeX 2.7\tex\latex"
Where? In the Windows environment on the Control Panel? Through R?
What does R think the the path is?
Sys.getenv("PATH")
Does it have two backslash characters everywhere you only one backslash
character?
My R shows
C:\\Program Files\\MiKTeX 2.7\\miktex\\bin;
but that didn't work.
Please define "didn't work". Include the full message that you received. Rich
Ista Zahn wrote:
Hi Tao, I think you just need latex(x, file="")
I think I misunderstood the question, I believe that is what is needed here.
Hi Erik, Thanks for the quick reply! My attachment was in .png which should be supported by the list .... I'm resending it. Yes, I knew by assigning it to an object, I can avoid this. But, I'm curious to know what if I choose to do e.g. just latex(x), how can I get rid of the error window. It actually worked for me once (i.e. I got Yap poped out to preview the table I'm generating), but I had no idea what I did differently. ...Tao ----- Original Message ----
From: Erik Iverson <eriki at ccbr.umn.edu> To: "Shi, Tao" <shidaxia at yahoo.com> Cc: r-help at r-project.org Sent: Wed, May 12, 2010 12:27:32 PM Subject: Re: [R] a question about "latex" in Hmisc
Shi, Tao wrote:
Hi list,
Excuse me b/c this is
probably a more "TeX" then "R" question.
I've been using
"latex" function in my .Rnw file to generate tables, but I've always been using
it without assigning the result to a object, i.e.
x <-
matrix(1:6, nrow=2, dimnames=list(c('a','b'),c('c','d','this that')))
latex(x)
so, I always get the error window (attached) poped
out. But since I can just click OK and everything seems fine except in my
working directory I get a bunch of "junk" files (.log, .dvi, etc...), I've been
ignoring it.
Your attachment did not come through, most likely because it
is not a type that is supported by the list.
Now I know by doing e.g. tmp <- latex(x) will suppress this error message, but I'm still curious on how to get rid of the error window when I just use latex(x). I read the "Example" section of "latex" help file and I tried to include the following into my PATH: "C:\Program Files\MiKTeX 2.7\tex\latex"
Well I can't directly help you with your issue, since I
don't know what error you're receiving, the reason this is happening is that when you don't assign the result of your latex call, the function 'print.latex' is getting called, which if I understand tries to compile the LaTeX output and display the result in a suitable viewer. By assigning the results of the latex call in R, you stop this printing from happening.
As for what your
issue is, I don't know since your attachment did not come through.
Hi Richard, Obviously, the list doesn't like my attachment. Here it is: http://i41.tinypic.com/15qz387.jpg I set the path using Windows control panel. And "didn't work" means I'm still getting the same error window shown above. ...Tao ----- Original Message ----
From: Richard M. Heiberger <rmh at temple.edu> To: "Shi, Tao" <shidaxia at yahoo.com> Cc: r-help at r-project.org Sent: Wed, May 12, 2010 12:34:13 PM Subject: Re: [R] a question about "latex" in Hmisc Shi, Tao wrote: so, I always get the error window (attached) poped out.
The image was stripped by the mailer. Please type the text of the
error into the body of the email.
I tried to include the following into my PATH: "C:\Program Files\MiKTeX 2.7\tex\latex"
Where? In the Windows environment on the
Control Panel? Through R?
What does R think the the path
is?
Sys.getenv("PATH")
Does it have two backslash
characters everywhere you only one backslash character?
My R
shows
C:\\Program Files\\MiKTeX 2.7\\miktex\\bin;
but that didn't work.
Please define "didn't work". Include the full
message that you received.
Rich
Shi, Tao wrote:
Hi Richard, Obviously, the list doesn't like my attachment. Here it is: http://i41.tinypic.com/15qz387.jpg I set the path using Windows control panel. And "didn't work" means I'm still getting the same error window shown above.
Well, it's hard to say what's going on unless I can get on a Windows machine and replicate it. That path is R's temporary directory, so it seems the DVI file is either not getting created, it's getting created in a different place than it's expected, or something is looking in the wrong spot for the .dvi file. You mention in your original post that the .dvi file is created. Can you confirm that this is true? Did you mean in the temp directory, or in your working directory? Check the .log file in the temp directory if one exists with the same base name as the .dvi file in the error message.
Erik, No, you didn't misunderstand my question. Ista, I have no access to LaTex now, so I can't test your solution right away. My understanding to your solution is that, basically, you just let 'latex' function generate the tex text which is directly incorporated into the big .tex file (rather a separate .tex file just for that table). Am I right? Thanks, ...Tao ----- Original Message ----
From: Erik Iverson <eriki at ccbr.umn.edu> To: Ista Zahn <istazahn at gmail.com> Cc: r-help at r-project.org Sent: Wed, May 12, 2010 12:34:15 PM Subject: Re: [R] a question about "latex" in Hmisc
Ista Zahn wrote:
Hi Tao, I think you just need latex(x, file="")
I think I misunderstood the question, I believe that is
what is needed here.
______________________________________________
ymailto="mailto:R-help at r-project.org" href="mailto:R-help at r-project.org">R-help at r-project.org mailing list
href="https://stat.ethz.ch/mailman/listinfo/r-help" target=_blank
PLEASE do read the posting
and provide commented,
minimal, self-contained, reproducible code.
The .dvi file is being created in the working directory for sure, not sure whether it's in the tmp folder or not. (I just tested on my home machine which only has R but no MikTex installed, I can see only .tex file in the tmp folder. No .log file in the tmp folder.) ...Tao ----- Original Message ----
From: Erik Iverson <eriki at ccbr.umn.edu> To: "Shi, Tao" <shidaxia at yahoo.com> Cc: Richard M. Heiberger <rmh at temple.edu>; r-help at r-project.org Sent: Wed, May 12, 2010 12:56:28 PM Subject: Re: [R] a question about "latex" in Hmisc
Shi, Tao wrote:
Hi Richard, Obviously, the list doesn't like my attachment. Here it is: http://i41.tinypic.com/15qz387.jpg I set the path using Windows control panel. And "didn't work" means I'm still getting the same error window shown above.
Well, it's hard to say what's going on
unless I can get on a Windows machine and replicate it. That path is R's temporary directory, so it seems the DVI file is either not getting created, it's getting created in a different place than it's expected, or something is looking in the wrong spot for the .dvi file. You mention in your original post that the .dvi file is created. Can you confirm that this is true? Did you mean in the temp directory, or in your working directory? Check the .log file in the temp directory if one exists with the same base name as the .dvi file in the error message.
On Wednesday 12 May 2010 3:58:08 pm Shi, Tao wrote:
Erik, No, you didn't misunderstand my question. Ista, I have no access to LaTex now, so I can't test your solution right away. My understanding to your solution is that, basically, you just let 'latex' function generate the tex text which is directly incorporated into the big .tex file (rather a separate .tex file just for that table). Am I right?
Yes, that is correct. As far as I'm aware the print method for latex()
actually typesets the table. To avoid this, simply set file="" as I suggested.
If you would rather have a separate file for your table you can continue to
use your original method, e.g.,
<<>>=
tmp <- latex(x, file="x.tex")
@
\include{x.tex}
(not sure what your objection to this was in the first place).
-Ista
Thanks, ...Tao ----- Original Message ----
From: Erik Iverson <eriki at ccbr.umn.edu> To: Ista Zahn <istazahn at gmail.com> Cc: r-help at r-project.org Sent: Wed, May 12, 2010 12:34:15 PM Subject: Re: [R] a question about "latex" in Hmisc
Ista Zahn wrote:
Hi Tao, I think you just need latex(x, file="")
I think I misunderstood the question, I believe that is
what is needed here.
______________________________________________ ymailto="mailto:R-help at r-project.org" href="mailto:R-help at r-project.org">R-help at r-project.org mailing list href="https://stat.ethz.ch/mailman/listinfo/r-help" target=_blank 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.
Hi Ista, Thanks for the reply! You actually misunderstood me. I never objected the "tmp <- latex(x)" method (in fact, that's what I'm doing now in my .Rnw file). As I stated in my original post, I'm simply curious about what causes the error window and wanted to get to the bottom of it. ...Tao ===================================== If you would rather have a
separate file for your table you can continue to
use your original method,
e.g.,
<<>>= tmp <- latex(x,
file="x.tex")
@
\include{x.tex}
(not sure what your objection to
this was in the first place).
-Ista
On 12/05/2010 4:33 PM, Shi, Tao wrote:
Hi Ista, Thanks for the reply! You actually misunderstood me. I never objected the "tmp <- latex(x)" method (in fact, that's what I'm doing now in my .Rnw file). As I stated in my original post, I'm simply curious about what causes the error window and wanted to get to the bottom of it.
latex(x) returns an object of class "latex". When you don't assign it, it prints. The print method for "latex" objects tries to run latex and then display the resulting .dvi file. (Or maybe it runs pdflatex and displays the .pdf file). If you can't run latex, you can't print those objects. That's why you're getting an error. Duncan Murdoch
On 05/12/2010 03:33 PM, Shi, Tao wrote:
Hi Ista, Thanks for the reply! You actually misunderstood me. I never objected the "tmp<- latex(x)" method (in fact, that's what I'm doing now in my .Rnw file). As I stated in my original post, I'm simply curious about what causes the error window and wanted to get to the bottom of it. ...Tao
Not clear why the earlier suggestion someone made to use latex(object, file='') is not the method of choice with Sweave. Frank
===================================== If you would rather have a
separate file for your table you can continue to
use your original method,
e.g.,
<<>>= tmp<- latex(x,
file="x.tex")
@
\include{x.tex}
(not sure what your objection to
this was in the first place).
-Ista
Frank E Harrell Jr Professor and Chairman School of Medicine
Department of Biostatistics Vanderbilt University
HI: If you don't mind me asking this question about latex: Based on Duncan's comment: "The print method for "latex" objects tries to run latex and then display the resulting .dvi file.? (Or maybe it runs pdflatex and displays the .pdf file)." Where in MikTex can I change to pdflatex? everytime I use latex it displays?the dvi file which is a problem because tables that I want to see landscaped don't work. Thanks ? Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA ----- Original Message ----
From: Duncan Murdoch <murdoch.duncan at gmail.com> To: "Shi, Tao" <shidaxia at yahoo.com> Cc: r-help at r-project.org Sent: Wed, May 12, 2010 1:40:50 PM Subject: Re: [R] a question about "latex" in Hmisc On 12/05/2010 4:33 PM, Shi, Tao wrote: Hi Ista, Thanks for the reply! You actually misunderstood me.? I never objected the "tmp <- latex(x)" method (in fact, that's what I'm doing now in my .Rnw file).? As I stated in my original post, I'm simply curious about what causes the error window and wanted to get to the bottom of it. ?
latex(x) returns an object of class "latex".? When
you don't assign it, it prints.? The print method for "latex" objects tries to run latex and then display the resulting .dvi file.? (Or maybe it runs pdflatex and displays the .pdf file).
If you can't run latex, you can't
print those objects.? That's why you're getting an error.
Duncan
Murdoch
______________________________________________
ymailto="mailto:R-help at r-project.org" href="mailto:R-help at r-project.org">R-help at r-project.org mailing list href="https://stat.ethz.ch/mailman/listinfo/r-help" target=_blank
PLEASE do read the posting
and provide commented,
minimal, self-contained, reproducible code.
On 13.05.2010 16:32, Felipe Carrillo wrote:
HI: If you don't mind me asking this question about latex: Based on Duncan's comment: "The print method for "latex" objects tries to run latex and then display the resulting .dvi file. (Or maybe it runs pdflatex and displays the .pdf file)." Where in MikTex can I change to pdflatex? everytime I use latex it displays the dvi file which is a problem because tables that I want to see landscaped don't work. Thanks
Run pdflatex rather than latex? Uwe Ligges
Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish& Wildlife Service California, USA ----- Original Message ----
From: Duncan Murdoch<murdoch.duncan at gmail.com> To: "Shi, Tao"<shidaxia at yahoo.com> Cc: r-help at r-project.org Sent: Wed, May 12, 2010 1:40:50 PM Subject: Re: [R] a question about "latex" in Hmisc On 12/05/2010 4:33 PM, Shi, Tao wrote: Hi Ista, Thanks for the reply! You actually misunderstood me. I never objected the "tmp<- latex(x)" method (in fact, that's what I'm doing now in my .Rnw file). As I stated in my original post, I'm simply curious about what causes the error window and wanted to get to the bottom of it.
latex(x) returns an object of class "latex". When
you don't assign it, it prints. The print method for "latex" objects tries to run latex and then display the resulting .dvi file. (Or maybe it runs pdflatex and displays the .pdf file).
If you can't run latex, you can't
print those objects. That's why you're getting an error.
Duncan
Murdoch
______________________________________________ ymailto="mailto:R-help at r-project.org" href="mailto:R-help at r-project.org">R-help at r-project.org mailing list href="https://stat.ethz.ch/mailman/listinfo/r-help" target=_blank 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. ______________________________________________ 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.
On 13/05/2010 10:48 AM, Uwe Ligges wrote:
On 13.05.2010 16:32, Felipe Carrillo wrote:
HI: If you don't mind me asking this question about latex: Based on Duncan's comment: "The print method for "latex" objects tries to run latex and then display the resulting .dvi file. (Or maybe it runs pdflatex and displays the .pdf file)." Where in MikTex can I change to pdflatex? everytime I use latex it displays the dvi file which is a problem because tables that I want to see landscaped don't work. Thanks
Run pdflatex rather than latex?
Or if using texify, use the --pdf option. Duncan Murdoch
Uwe Ligges
Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish& Wildlife Service California, USA ----- Original Message ----
From: Duncan Murdoch<murdoch.duncan at gmail.com> To: "Shi, Tao"<shidaxia at yahoo.com> Cc: r-help at r-project.org Sent: Wed, May 12, 2010 1:40:50 PM Subject: Re: [R] a question about "latex" in Hmisc On 12/05/2010 4:33 PM, Shi, Tao wrote: Hi Ista, Thanks for the reply! You actually misunderstood me. I never objected the "tmp<- latex(x)" method (in fact, that's what I'm doing now in my .Rnw file). As I stated in my original post, I'm simply curious about what causes the error window and wanted to get to the bottom of it.
latex(x) returns an object of class "latex". When
you don't assign it, it prints. The print method for "latex" objects tries to run latex and then display the resulting .dvi file. (Or maybe it runs pdflatex and displays the .pdf file).
If you can't run latex, you can't
print those objects. That's why you're getting an error.
Duncan
Murdoch
______________________________________________ ymailto="mailto:R-help at r-project.org" href="mailto:R-help at r-project.org">R-help at r-project.org mailing list href="https://stat.ethz.ch/mailman/listinfo/r-help" target=_blank 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. ______________________________________________ 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.
Felipe Carrillo wrote:
HI: If you don't mind me asking this question about latex: Based on Duncan's comment: "The print method for "latex" objects tries to run latex and then display the resulting .dvi file. (Or maybe it runs pdflatex and displays the .pdf file)." Where in MikTex can I change to pdflatex? everytime I use latex it displays the dvi file which is a problem because tables that I want to see landscaped don't work. Thanks
I don't work in a Windows environment, but I think the process is the
same here.
You have to know what the print.latex function in Hmisc is doing. It
simply calls show.latex. If you look at the source for show.latex, it
looks at the latex object passed to it, and inspects the file argument.
If the file argument is the empty string ( "" ), it does not attempt
to show the resulting output in a dvi. If the file argument is a file
name, show.latex will call dvi.latex on the object, which will wrap the
latex code in some basic latex, and call optionsCmds("latex") on the file.
This is by default set to
> optionsCmds("latex")
[1] "/usr/bin/latex"
This will of course create a dvi and attempt to display it with
show.dvi, which will in turn use
> optionsCmds("xdvi")
[1] "xdvi"
to display the resulting file.
I'm guessing MikTex comes with pdflatex, just like it comes with a
binary called latex. You'd just have to find it and make sure it's in
your path.
Then, by setting the relevant options I just described above to pdflatex
and a suitable pdf viewer, you might get what you want. But there might
be other things I haven't thought of that will prohibit this from
working. In fact, it looks like dvi.latex naturally assumes the
extension .dvi from its output, and so this may not work. You/I might
have to write separate functions to carry this out it appears. Of
course, someone else may have already, and I just don't know about it.
--Erik
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100513/6d231956/attachment.pl>
Looks good. I came up with something on my own which was basically to
re-write print.latex. I call pdflatex a few times because with the
longtable package, sometimes things don't line up right until you run
pdflatex multiple times. I think mine is less flexible though, and I
like your solution better.
The only thing I can see to make your solution more flexible is to note
that there is already options("pdfviewer") in R, so maybe you could just
use whatever that is for options("xdvicmd") and then in show.dvi, you
can test
if(viewer == options("pdfviewer")) {
...
}
--Erik
RICHARD M. HEIBERGER wrote:
Here is the full repair for the latex functions in Hmisc to make
pdflatex work in Windows.
This version is still slightly awkward. I hope that Charles and Frank
will smooth it out
and put it in their next release.
I added two new options() and revised show.dvi so it will use them.
Rich
library(Hmisc)
show.dvi <-
function (object, width = 5.5, height = 7)
{
viewer <- optionsCmds("xdvi")
cmd <- if (viewer == "yap") {
paste(viewer, object$file)
}
else if (viewer == "kdvi") {
paste(viewer, object$file)
}
else if (viewer == "xdvi") {
paste(viewer, " -paper ", width, "x", height, "in -s 0 ",
object$file, sep = "")
}
else if (basename(viewer) == "AcroRd32") {
object$file <- sub("dvi", "pdf", object$file)
paste(viewer, object$file)
}
else {
paste(viewer, object$file)
}
system(cmd, intern = TRUE, wait = TRUE)
invisible(NULL)
}
environment(show.dvi) <- environment(print.dvi)
options(latexcmd="pdflatex",
xdvicmd="c:/Progra~1/Adobe/Reader~1.0/Reader/AcroRd32")
x <- matrix(1:24, 6,4, dimnames=list(letters[1:6], LETTERS[1:4]))
show.dvi(dvi(x.tex <- latex(x)))
paste(getwd(), x.tex$file, sep="/") ## location of the table itself
## The tex file with headers and the pdf file are in the directory
## given in the printed output from dvi().
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100513/432852d0/attachment.pl>
<snip>
Notice that I didn't quite get my function into the Hmisc environment
and that is why you need the awkward phrase
show.dvi(dvi(x.tex <- latex(x)))
instead of the smooth phrase
latex(x)
Somehow with my own data and not using the awkward bit, it worked on my Linux machine? At least I thought it did, since I believe show.dvi is an exported function, can't you just overwrite it in your global environment and anything that calls it will use your copy? I'll have to look into how I got your code working on my system, because I know I didn't use that trick! --Erik
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100513/183549e8/attachment.pl>
Hi Duncan, I have no problems running latex or pdflatex. I re-ran my code and it seems the problem is that R (or MiKTex ?) put the .tex file (the one wrapping everything in a document format for displaying purpose) in a R tmp folder, but the corresponding .log, .aux, and .dvi in my working directory. So when YAP was called, it was looking for the .dvi file in the R temp folder. Therefore, the error window. http://i41.tinypic.com/15qz387.jpg I wonder how to fix that? Thanks! ...Tao ----- Original Message ----
From: Duncan Murdoch <murdoch.duncan at gmail.com> To: "Shi, Tao" <shidaxia at yahoo.com> Cc: Ista Zahn <istazahn at gmail.com>; r-help at r-project.org Sent: Wed, May 12, 2010 1:40:50 PM Subject: Re: [R] a question about "latex" in Hmisc On 12/05/2010 4:33 PM, Shi, Tao wrote: Hi Ista, Thanks for the reply! You actually misunderstood me. I never objected the "tmp <- latex(x)" method (in fact, that's what I'm doing now in my .Rnw file). As I stated in my original post, I'm simply curious about what causes the error window and wanted to get to the bottom of it.
latex(x) returns an object of class "latex". When
you don't assign it, it prints. The print method for "latex" objects tries to run latex and then display the resulting .dvi file. (Or maybe it runs pdflatex and displays the .pdf file).
If you can't run latex, you can't
print those objects. That's why you're getting an error.
Duncan
Murdoch
Hi Prof. Harrell, Originally, I was thinking that by putting tables (especially those long tables) into separate .tex files would make my 'big' .tex file more organized (i.e. rather than having an one giant .tex file). But now I'm having a second thought, b/c I don't really have to worry how my 'big' .tex file looks, as it's just a intermediate and I'll do all my editing in the .Rnw file. So, I think I'll use the latex(x, file="") method more. This also will make my working directory cleaner. Thank you very much! ...Tao ----- Original Message ----
From: Frank E Harrell Jr <f.harrell at vanderbilt.edu> To: r-help at r-project.org Sent: Wed, May 12, 2010 4:28:20 PM Subject: Re: [R] a question about "latex" in Hmisc On 05/12/2010 03:33 PM, Shi, Tao wrote: Hi Ista, Thanks for the reply! You actually misunderstood me. I never objected the "tmp<- latex(x)" method (in fact, that's what I'm doing now in my .Rnw file). As I stated in my original post, I'm simply curious about what causes the error window and wanted to get to the bottom of it. ...Tao
Not clear why the earlier suggestion someone
made to use latex(object,
file='') is not the method of choice with
Sweave.
Frank
===================================== If you would rather have a
separate file for your table you can continue to
use your original method,
e.g.,
<<>>= tmp<- latex(x,
file="x.tex")
@
\include{x.tex}
(not sure what your objection to
this was in the first place). -Ista
>
Frank E Harrell Jr Professor and Chairman
> School of Medicine
> Department of Biostatistics Vanderbilt
> University
______________________________________________
> ymailto="mailto:R-help at r-project.org"
> href="mailto:R-help at r-project.org">R-help at r-project.org mailing list
> href="https://stat.ethz.ch/mailman/listinfo/r-help" target=_blank
> >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.