1\name{ps.latex} 2\alias{pdf.do} 3\alias{pdf.latex} 4\alias{ps.do} 5\alias{ps.latex} 6\title{PostScript/PDF Preview Device with Optional \sQuote{LaTeX} Touch} 7\usage{ 8pdf.do(file, paper = "default", width = -1, height = -1, onefile = FALSE, 9 title = NULL, version = "1.4", quiet = FALSE, \dots) 10 11pdf.latex(file, height = 5 + main.space * 1.25, width = 9.5, 12 main.space=FALSE, lab.space = main.space, 13 paper = "special", title = NULL, 14 lab=c(10, 10, 7), mgp.lab=c(1.6, 0.7, 0), mar=c(4, 4, 0.9, 1.1), \dots) 15 16ps.do(file, width=-1, height=-1, onefile=FALSE, horizontal=FALSE, 17 title = NULL, \dots) 18 19ps.latex(file, height = 5 + main.space * 1.25, width = 9.5, 20 main.space=FALSE, lab.space = main.space, 21 paper = "special", title = NULL, 22 lab=c(10, 10, 7), mgp.lab=c(1.6, 0.7, 0), mar=c(4, 4, 0.9, 1.1), \dots) 23} 24\arguments{ 25 \item{file}{character giving the PostScript/PDF file name to be written.} 26 \item{height}{device height in \emph{inches}, \code{height * 2.54} are 27 \emph{cm}. The default is 5 plus 1.25 iff \code{main.space}.} 28 \item{width}{device width in \emph{inches}; for this and 29 \code{height}, see \code{\link{postscript}}.} 30 \item{onefile, horizontal}{logicals passed to 31 \code{\link{postscript}(..)} or \code{\link{pdf}(..)}, most probably 32 to be left alone.} 33 \item{title}{PostScript/PDF (not plot!) title passed to 34 \code{\link{postscript}()} or \code{\link{pdf}()}; by default use a 35 title with \R version and \code{file} in it.} 36 \item{version}{a string describing the PDF version that will be 37 required to view the output, see \code{\link{pdf}}; our (high) 38 default ensures alpha-transparency.} 39 \item{quiet}{logical specifying that some (informative/warning) 40 messages should not be issued.} 41 \item{main.space}{logical; if true, leave space for a main title 42 (unusual for LaTeX figures!).} 43 \item{lab.space}{logical; if true, leave space for x- and y- labels 44 (by \emph{not} subtracting from \code{mar}).} 45 \item{paper}{character (or missing), typically \code{"a4"} or 46 \code{"a4r"} in non-America, see \code{\link{postscript}}. Only 47 if this is \code{"special"} (or missing) are your choices of \code{width} 48 and \code{height} completely honored (and this may lead to files that 49 cannot print on A4) with resizing.} 50 \item{lab}{integer of length 3, \code{lab[1:2]} are desired number of 51 tick marks on x- and y- axis, see \code{\link{par}(lab=)}.} 52 \item{mgp.lab}{three decreasing numbers determining space for axis 53 labeling, see \code{\link{par}(mgp=)}, the default is here smaller 54 than usual.} 55 \item{mar}{four numbers, indicating marginal space, see 56 \code{\link{par}(mar=)}, the default is here smaller than usual.} 57 \item{\dots}{arguments passed to \code{\link{ps.do}()} or 58 \code{\link{pdf.do}()} from 59 \code{ps.latex} / \code{pdf.latex} and to \code{\link{ps.options}} 60 from \code{ps.do}/\code{pdf.do}.} 61} 62\description{ 63 All functions start a pseudo PostScript or Acrobat preview device, using 64 \code{\link{postscript}} or \code{\link{pdf}}, and further registering 65 the file name for subsequent calls to \code{\link{pdf.end}()} or 66 \code{ps.end()}. 67} 68\details{ 69 \code{ps.latex} and \code{pdf.latex} have an additional 70 LaTeX %\iftex{\LaTeX}{LaTeX} 71 flavor, 72 and just differ by some extra \code{\link{par}} settings from the 73 \code{*.do} siblings: E.g., after \code{\link{ps.do}(..)} 74 is called, the graphical parameters \code{c("mar", "mgp", "lab")} are 75 reset (to values that typically are better than the defaults for LaTeX 76 figures). 77 78 Whereas the defaults for \code{paper}, \code{width}, and \code{height} 79 \emph{differ} between \code{\link{pdf}} and \code{\link{postscript}}, 80 they are set such as to provide very similar functionality, for 81 the functions \code{ps.do()} and \code{pdf.do()}; e.g., by default, 82 both use a full plot on portrait-oriented page of the default paper, 83 as per \code{\link{getOption}("papersize")}.\cr 84 \code{\link{pdf.do}()} sets the default \code{paper} to \code{"special"} 85 when both \code{width} and \code{height} are specified. 86} 87\value{ 88 A list with components 89 \item{old.par}{containing the old \code{par} values} 90 \item{new.par}{containing the newly set \code{par} values} 91} 92\author{Martin Maechler} 93\seealso{\code{\link{ps.end}}, \code{\link{pdf}}, \code{\link{postscript}}, 94 \code{\link{dev.print}}. 95} 96\examples{ 97if(interactive()) { 98 99 ps.latex("ps.latex-ex.ps", main= TRUE) 100 data(sunspots) 101 plot(sunspots,main=paste("Sunspots Data, n=",length(sunspots)),col="red") 102 ps.end() 103 104 pdf.latex("pdf.latex-ex.pdf", main= TRUE) 105 data(sunspots) 106 plot(sunspots,main=paste("Sunspots Data, n=",length(sunspots)),col="red") 107 pdf.end() 108 109 ps.do("ps_do_ex.ps") 110 example(plot.function) 111 ps.end() 112 113 pdf.do("pdf_do_ex.pdf", width=12, height=5) 114 plot(sunspots, main="Monthly Sunspot numbers (in Zurich, then Tokyo)") 115 pdf.end() 116} 117} 118\keyword{device} 119