[R] latex() hangs R console

Michael Friendly friendly at yorku.ca
Tue Dec 7 14:53:30 CET 2010


[Env: R 2.11.1, Win Xp, Miktex 2.7]

I've just started using Hmisc::latex and friends, and find that running 
latex() produces the .tex and .dvi files, but hangs,
presumably trying to run yap.  An example is below.  What could be wrong?

My PATH seems OK:
 > strsplit(Sys.getenv("path"),';')
$path
  [1] "c:\\program files\\imagemagick-6.4.4-q16"                   
"c:\\Rtools\\bin"
  [3] "c:\\Rtools\\perl\\bin"                                      
"c:\\Rtools\\MinGW\\bin"
  [5] "C:\\Program Files\\MiKTeX 2.7\\miktex\\bin"                 
"C:\\WINDOWS\\system32"
  [7] "C:\\WINDOWS"                                                
"C:\\WINDOWS\\System32\\Wbem"
  [9] "C:\\Program Files\\Intel\\DMIX"                             
"C:\\Program Files\\ATI Technologies\\ATI.ACE\\"
[11] "C:\\Program Files\\Common Files\\Roxio Shared\\DLLShared\\" 
"C:\\WINDOWS\\system32\\nls"
[13] "C:\\WINDOWS\\system32\\nls\\ENGLISH"                        
"C:\\Program Files\\SecureCRT\\"
[15] "C:\\Program Files\\IDM Computer Solutions\\UltraEdit-32"    
"C:\\Program Files\\SAS\\Shared Files\\Formats"
[17] "C:\\Program Files\\Graphviz2.20\\Bin"                       
"C:\\Program Files\\MATLAB\\R2008a\\bin"
[19] "C:\\Program Files\\MATLAB\\R2008a\\bin\\win32"              
"C:\\Program Files\\TortoiseSVN\\bin"
[21] "C:\\Program Files\\HTML Help Workshop"                      
"C:\\Program Files\\QuickTime\\QTSystem\\"

Example:

 > x <- matrix(1:6, nrow=2, dimnames=list(c('a','b'),c('c','d','this 
that')))
 > latex(x, file="")
% latex.default(x, file = "")
%
\begin{table}[!tbp]
  \begin{center}
  \begin{tabular}{lrrr}\hline\hline
\multicolumn{1}{l}{x}&\multicolumn{1}{c}{c}&\multicolumn{1}{c}{d}&\multicolumn{1}{c}{this 
that}\tabularnewline
\hline
a&$1$&$3$&$5$\tabularnewline
b&$2$&$4$&$6$\tabularnewline
\hline
\end{tabular}
\end{center}
\end{table}

 > cd("c:/r/test")
 > latex(x)
This is pdfTeX, Version 3.1415926-1.40.9 (MiKTeX 2.7)
entering extended mode
(C:/WINDOWS/TEMP/Rtmpz0QkT8/file311f289a.tex
LaTeX2e <2005/12/01>
Babel <v3.8l> and hyphenation patterns for english, dumylang, 
nohyphenation, ge
rman, ngerman, french, loaded.
("C:\Program Files\MiKTeX 2.7\tex\latex\base\report.cls"
Document Class: report 2005/09/16 v1.4f Standard LaTeX document class
("C:\Program Files\MiKTeX 2.7\tex\latex\base\size10.clo"))
("C:\Program Files\MiKTeX 2.7\tex\latex\geometry\geometry.sty"
("C:\Program Files\MiKTeX 2.7\tex\latex\graphics\keyval.sty")
("C:\Program Files\MiKTeX 2.7\tex\latex\geometry\geometry.cfg"))
No file file311f289a.aux.
[1] (file311f289a.aux) )
Output written on file311f289a.dvi (1 page, 372 bytes).
Transcript written on file311f289a.log.

At this point, I have to press ESC after a few minutes to regain the 
console, and no .dvi (yap) window appears.
If I go to the temp directory, C:/WINDOWS/TEMP/Rtmpz0QkT8/, the .dvi 
file is there and double-click
launches yap.

 >  optionsCmds("xdvi")
[1] "yap"

Reading the code of print.latex -> show.latex -> show.dvi, I tried 
executing  system() directly, in the forms

 > system(paste("yap", "C:/WINDOWS/TEMP/Rtmpz0QkT8/file311f289a.dvi"), 
intern=TRUE)

 > system(paste("yap", "C:/WINDOWS/TEMP/Rtmpz0QkT8/file311f289a.dvi"))

However, both of these result in the same behavior -- R console hangs 
until I press ESC.



-- 
Michael Friendly     Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street    Web:   http://www.datavis.ca
Toronto, ONT  M3J 1P3 CANADA



More information about the R-help mailing list