Learn R Programming

microplot (version 1.0-45)

latexSetOptions: Set the options for use of latex; check whether the options for latex functions have been specified.

Description

Set the options for use of latex; check whether the options for latex functions have been specified: if any of options()[c("latexcmd","dviExtension","xdvicmd")] are NULL, an error message is displayed.

Usage

latexSetOptions(
     latexcmd=c("pdflatex", "latex"),
     dviExtension={
       if (is.null(latexcmd)) NULL
       else
         switch(latexcmd,
                pdflatex="pdf",
                latex="dvi")
     },
     xdvicmd={
       if (is.null(latexcmd)) NULL ## dvips is used, .ps in wd displayed
       else
         switch(latexcmd,
                pdflatex=if (nchar(Sys.which("open")))
                           "open"      ## Macintosh, Windows, SMP linux
                         else
                           "xdg-open", ## ubuntu linux
                latex="dvips") ##
                               ## dvips  Mac, Win: .ps in wd displayed
                               ## xdvi   Mac: Quartz displays image borders
                               ##             and waits until dismissed.
                               ## xdvi   Windows: not on my machine.
                               ## yap    Windows: dvi is displayed
                               ## open   Mac: nothing happens
                               ## open   Windows: yap displays dvi
     }
     )

latexCheckOptions(...)

Arguments

latexcmd, dviExtension, xdvicmd

See latex.

Any arguments to latexCheckOptions are ignored.

Value

For latexSetOptions, the invisible list of the options that were set by this command.

For latexCheckOptions, if any NULL options are detected, the error message is printed. If all three options have non-NULL values, NULL.

Details

These are my recommendations (the default when no arguments are specified) for pdflatex:

    options(latexcmd="pdflatex") ## Macintosh, Windows, linux
    options(dviExtension="pdf")  ## Macintosh, Windows, linux

if (nchar(Sys.which("open"))) { options(xdvicmd="open") ## Macintosh, Windows, SMP linux } else { options(xdvicmd="xdg-open") ## ubuntu linux }

These are my recommendations for latex (and are the settings when only the first argument is set to "latex"):

    options(latexcmd="latex")
    options(dviExtension="dvi")
    options(xdvicmd="dvips")
  

See Also

latex

Examples

Run this code
# NOT RUN {
  latexSetOptions() ## default
  latexSetOptions("pdflatex") ## same as default
  latexSetOptions("pdflatex", "pdf", "open") ## same as default on Macintosh, Windows, SMP Unix

  latexSetOptions("latex")
  latexSetOptions("latex", "dvi", "dvips") ## same as above

  latexSetOptions(NULL)
  latexSetOptions(NULL, NULL, NULL) ## same as above
# }

Run the code above in your browser using DataLab