Tao Shi,

Here is the repair for your query.  Use this version of show.dvi temporarily
(until Hmisc includes it in its official version of show.dvi).  This
function and
option setting will let the command
    latex(x)
display the dvi file in a YAP window on Windows.

This version is not to be used with the pdf version of show.dvi I posted
earlier today,
Only one of them can be active.

On Thu, May 13, 2010 at 3:05 PM, Shi, Tao <shidaxia@yahoo.com> wrote:

>  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
>


## yap only, only on Windows
library(Hmisc)
options(xdvicmd="c:\\progra~1\\miktex~1.7\\miktex\\bin\\yap.exe")
show.dvi <- function(object, width = 5.5, height = 7) {
  ## this is a Windows-only version of show.dvi
  ## eventually this will be merged into the official Hmisc show.dvi
  viewer <- optionsCmds("xdvi")
  cmd <- paste(viewer, object$file)
  system(paste(Sys.getenv("COMSPEC"),"/c", cmd), intern=FALSE, wait = FALSE)
}
assignInNamespace("show.dvi", show.dvi, "Hmisc")

## example
x <- matrix(1:24, 6,4, dimnames=list(letters[1:6], LETTERS[1:4]))
latex(x)

	[[alternative HTML version deleted]]

