That function works nicely generating the pdf on the fly instead of the dvi file, however, consider the example below. I can't get the pdf to landscape.
report <- structure(list(Date = c("2/26/2010", "2/27/2010", "2/28/2010", "3/1/2010", "3/2/2010", "3/3/2010", "3/4/2010", "3/5/2010", "3/6/2010", "3/7/2010", "3/8/2010", "3/9/2010", "3/10/2010", "3/11/2010", "Biweekly Lower 90% Confidence Interval", "Biweekly Total", "Biweekly Upper 90% Confidence Interval", "Brood-year Lower 90% Confidence Interval", "Brood Year Total", "Brood-year Upper 90% Confidence Interval"), Run1 = c("0 ( ? )", "n (0 ? 0)", "357 (123 ? 123)", "144 (95 ? 152)", "73 (126 ? 152)", "43 (108 ? 108)", "n (0 ? 0)", "270 (101 ? 140)", "121 (111 ? 112)", "0 ( ? )", "34 (111 ? 111)", "102 (111 ? 140)", "0 ( ? )", "35 (125 ? 125)", "-537", "1,425", "3,388", "2,578,499", "4,455,877", "6,333,255" ), Run2 = c("0 ( ? )", "n (0 ? 0)", "0 ( ? )", "99 (65 ? 71)", "0 ( ? )", "86 (66 ? 76)", "n (0 ? 0)", "0 ( ? )", "40 (66 ? 66)", "0 ( ? )", "33 (74 ? 74)", "0 ( ? )", "35 (66 ? 66)", "35 (70 ? 70)", "-549", "402", "1,353", "74,306", "314,206", "541,552"), Run3 = c("7,002 (33 ? 39)", "n (0 ? 0)", "130,342 (29 ? 57)", "22,741 (31 ? 56)", "8,365 (31 ? 53)", "5,962 (33 ? 60)", "n (0 ? 0)", "22,461 (30 ? 61)", "12,485 (31 ? 55)", "7,352 (31 ? 56)", "2,908 (32 ? 48)", "3,265 (27 ? 48)", "1,993 (30 ? 55)", "1,445 (33 ? 62)", "35,097", "296,085", "557,074", "2,249,920", "7,347,719", "12,058,021"), Run4 = c("0 ( ? )", "n (0 ? 0)", "0 ( ? )", "48 (196 ? 196)", "0 ( ? )", "0 ( ? )", "n (0 ? 0)", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "35 (185 ? 185)", "0 ( ? )", "-375", "103", "580", "98,734", "225,976", "353,217" ), Run5 = c("0 ( ? )", "n (0 ? 0)", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "n (0 ? 0)", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0 ( ? )", "0", "0", "0", "-184", "977", "2,138")), .Names = c("Date", "Run1", "Run2", "Run3", "Run4", "Run5"), class = "data.frame", row.names = c(NA, -20L)) report require(stringr) report <- t(apply(report, 1, function(x) {str_replace(x, "\\?", "-")})) 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") # Portrait (default) it doesn't fit show.dvi(dvi(x.tex <- latex(report))) # so let's try to Landscape show.dvi(dvi(x.tex <- latex(report,landscape=TRUE))) The table itself gets landscaped but not the actual pdf If I run tex2dvi(report.tex,pdf=TRUE) then everything gets landscaped nicely. Do I need anything else inside the latex function? Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA > >From: RICHARD M. HEIBERGER <r...@temple.edu> >To: Erik Iverson <er...@ccbr.umn.edu> >Cc: Felipe Carrillo <mazatlanmex...@yahoo.com>; r-help@r-project.org; Charles >Dupont <charles.dup...@vanderbilt.edu>; Frank E Harrell Jr ><f.harr...@vanderbilt.edu> >Sent: Thu, May 13, 2010 8:57:01 AM >Subject: Re: [R] a question about "latex" in Hmisc and .dvi file > > >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(). > [[alternative HTML version deleted]]
______________________________________________ R-help@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.