latexSetOptions: Set the options for use of latex; check whether the options...

View source: R/latexCheckOptions.R

latexSetOptionsR Documentation

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.

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

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.

Author(s)

Richard M. Heiberger <rmh@temple.edu>

See Also

latex

Examples

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

## End(Not run)

microplot documentation built on March 18, 2022, 7:56 p.m.