report_latex_dependencies: Manage LaTeX dependencies for huxtables

Description Usage Arguments Value Examples

View source: R/latex-dependencies.R

Description

report_latex_dependencies prints out and/or returns a list of LaTeX dependencies for adding to a LaTeX preamble.

check_latex_dependencies checks whether the required LaTeX packages are installed.

install_latex_dependencies is a utility function to install and/or update the LaTeX packages that huxtable requires. It calls tinytex::tlmgr_install() if possible, or tlmgr install directly.

Usage

1
2
3
4
5

Arguments

quiet

Logical. For report_latex_dependencies, suppress printing of dependencies. For check_latex_dependencies, suppress messages.

as_string

Logical: return dependencies as a string.

Value

If as_string is TRUE, report_latex_dependencies returns a string of "\\\\usepackage\\{...\\}" statements; otherwise it returns a list of rmarkdown::latex_dependency objects, invisibly.

check_latex_dependencies() returns TRUE or FALSE.

install_latex_dependencies returns TRUE if tlmgr returns 0.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
report_latex_dependencies()

## Not run: 
  check_latex_dependencies()

## End(Not run)

## Not run: 
  install_latex_dependencies()

## End(Not run)

Example output

\usepackage{array}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage{colortbl}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{calc}
\usepackage{tabularx}
\usepackage{threeparttable}
\usepackage{wrapfig}
% These are LaTeX packages. You can install them using your LaTex management software,
% or by running `huxtable::install_latex_dependencies()` from within R.
% Other packages may be required if you use non-standard tabulars (e.g. tabulary).tlmgr info --list --only-installed --data name
Unknown option: data
Usage:
    tlmgr [*option*]... *action* [*option*]... [*operand*]...

The following LaTeX packages were not found:
caption, siunitx, colortbl, multirow, threeparttable, wrapfig, tools
Install them using your latex package manager or via install_latex_dependencies().
[1] FALSE
Warning message:
running command ''tlmgr' info --list --only-installed --data name' had status 2 
Trying to install packages: caption, siunitx, colortbl, multirow, threeparttable, wrapfig, tools
If this fails, try running the following on the command line (you may need admin permissions):
  tlmgr install caption siunitx colortbl multirow threeparttable wrapfig tools
tlmgr install caption siunitx colortbl multirow threeparttable wrapfig tools
(running on Debian, switching to user mode!)
cannot setup TLPDB in /home/anon/texmf at /usr/bin/tlmgr line 5336.
tlmgr update --self
(running on Debian, switching to user mode!)
cannot setup TLPDB in /home/anon/texmf at /usr/bin/tlmgr line 5336.
fmtutil: format directory `/var/lib/texmf/web2c' is not writable.
tlmgr install caption siunitx colortbl multirow threeparttable wrapfig tools
(running on Debian, switching to user mode!)
cannot setup TLPDB in /home/anon/texmf at /usr/bin/tlmgr line 5336.
tlmgr path add
(running on Debian, switching to user mode!)
action `path' not supported in usermode!
[1] FALSE

huxtable documentation built on May 15, 2021, 1:09 a.m.