Compile LaTeX Files
until all cross-references are resolved to create a dvi or a PDF file.
1 2 3 4 5 6 7
character string. Name of the LaTeX source file.
logical. No output unless an error occurs.
character string (or
logical: should indices be prepared?
texi2pdf is a wrapper for the common case of
texi2dvi(pdf = TRUE).
Despite the name, this is used in R to compile LaTeX files,
specifically those generated from vignettes and by the
Rd2pdf script (used for package reference manuals). It
ensures that the ‘R_HOME/share/texmf’ directory is
in the TEXINPUTS path, so R style files such as ‘Sweave’
and ‘Rd’ will be found. The TeX search path used is first the
existing TEXINPUTS setting (or the current directory if unset),
then elements of argument
‘R_HOME/share/texmf’ and finally the default path.
Analogous changes are made to BIBINPUTS and BSTINPUTS
The default option for
texi2dvi is set from environment variable
R_TEXI2DVICMD, and the default for that is set from environment
variable TEXI2DVI or if that is unset, from a value chosen when
R is configured.
A shell script
texi2dvi is part of GNU's texinfo.
Several issues have been seen with released versions, so if yours does
not work correctly try R_TEXI2DVICMD=emulation.
Occasionally indices contain special characters which cause indexing
to fail (particularly when using the hyperref LaTeX package)
even on valid input. The argument
index = FALSE is provided to
allow package manuals to be made when this happens: it uses emulation.
NULL. Used for the side effect of creating a dvi or
PDF file in the current working directory (and maybe other files,
clean = FALSE).
There are various versions of the
texi2dvi script on
Unix-alikes and quite a number of bugs have been seen, some of which
this R wrapper works around.
One that was present with
supplied by macOS) is that it will not work correctly for paths which
contain spaces, nor if the absolute path to a file would contain
The three possible approaches all have their quirks. For example the
texi2dvi script removes ancillary files that already
exist but the other two approaches do not (and may get confused by
Where supported (
texi2dvi 5.0 and later;
texify.exe from MiKTeX), option --max-iterations=20
is used to avoid infinite retries.
The emulation mode supports
quiet = TRUE from R 3.2.3 only.
clean = TRUE only cleans up in this mode if the
conversion was successful—this gives users a chance to examine log
files in the event of error.
All the approaches should respect the values of environment variables LATEX, PDFLATEX, MAKEINDEX and BIBTEX for the full paths to the corresponding commands.
Originally Achim Zeileis but largely rewritten by R-core.
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.