| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/context_document.R |
| 3 |
\name{context_document} |
| 4 |
\alias{context_document} |
| 5 |
\title{Convert to a ConTeXt document} |
| 6 |
\usage{ |
| 7 |
context_document( |
| 8 |
toc = FALSE, |
| 9 |
toc_depth = 2, |
| 10 |
number_sections = FALSE, |
| 11 |
fig_width = 6.5, |
| 12 |
fig_height = 4.5, |
| 13 |
fig_crop = "auto", |
| 14 |
fig_caption = TRUE, |
| 15 |
dev = "pdf", |
| 16 |
df_print = "default", |
| 17 |
template = NULL, |
| 18 |
keep_tex = FALSE, |
| 19 |
keep_md = FALSE, |
| 20 |
citation_package = c("default", "natbib", "biblatex"), |
| 21 |
includes = NULL, |
| 22 |
md_extensions = NULL, |
| 23 |
output_extensions = NULL, |
| 24 |
pandoc_args = NULL, |
| 25 |
context_path = NULL, |
| 26 |
context_args = NULL, |
| 27 |
ext = c(".pdf", ".tex") |
| 28 |
) |
| 29 |
} |
| 30 |
\arguments{ |
| 31 |
\item{toc}{\code{TRUE} to include a table of contents in the output} |
| 32 |
|
| 33 |
\item{toc_depth}{Depth of headers to include in table of contents} |
| 34 |
|
| 35 |
\item{number_sections}{\code{TRUE} to number section headings} |
| 36 |
|
| 37 |
\item{fig_width}{Default width (in inches) for figures} |
| 38 |
|
| 39 |
\item{fig_height}{Default height (in inches) for figures} |
| 40 |
|
| 41 |
\item{fig_crop}{Whether to crop PDF figures with the command |
| 42 |
\command{pdfcrop}. This requires the tools \command{pdfcrop} and |
| 43 |
\command{ghostscript} to be installed. By default, \code{fig_crop = TRUE} |
| 44 |
if these two tools are available.} |
| 45 |
|
| 46 |
\item{fig_caption}{\code{TRUE} to render figures with captions} |
| 47 |
|
| 48 |
\item{dev}{Graphics device to use for figure output (defaults to pdf)} |
| 49 |
|
| 50 |
\item{df_print}{Method to be used for printing data frames. Valid values |
| 51 |
include "default", "kable", "tibble", and "paged". The "default" method |
| 52 |
uses a corresponding S3 method of \code{print}, typically |
| 53 |
\code{print.data.frame}. The "kable" method uses the |
| 54 |
\code{\link[knitr:kable]{knitr::kable}} function. The "tibble" method uses |
| 55 |
the \pkg{tibble} package to print a summary of the data frame. The "paged" |
| 56 |
method creates a paginated HTML table (note that this method is only valid |
| 57 |
for formats that produce HTML). In addition to the named methods you can |
| 58 |
also pass an arbitrary function to be used for printing data frames. You |
| 59 |
can disable the \code{df_print} behavior entirely by setting the option |
| 60 |
\code{rmarkdown.df_print} to \code{FALSE}. See |
| 61 |
\href{https://yihui.org/rmarkdown/html-document.html#data-frame-printing}{Data |
| 62 |
frame printing section} in bookdown book for examples.} |
| 63 |
|
| 64 |
\item{template}{Pandoc template to use for rendering. Pass "default" to use |
| 65 |
the rmarkdown package default template; pass \code{NULL} to use pandoc's |
| 66 |
built-in template; pass a path to use a custom template that you've |
| 67 |
created. See the documentation on |
| 68 |
\href{https://pandoc.org/MANUAL.html}{pandoc online documentation} for |
| 69 |
details on creating custom templates.} |
| 70 |
|
| 71 |
\item{keep_tex}{Keep the intermediate tex file used in the conversion to PDF. |
| 72 |
Note that this argument does not control whether to keep the auxiliary |
| 73 |
files (e.g., \file{.aux}) generated by LaTeX when compiling \file{.tex} to |
| 74 |
\file{.pdf}. To keep these files, you may set \code{options(tinytex.clean = |
| 75 |
FALSE)}.} |
| 76 |
|
| 77 |
\item{keep_md}{Keep the markdown file generated by knitting.} |
| 78 |
|
| 79 |
\item{citation_package}{The LaTeX package to process citations, \code{natbib} |
| 80 |
or \code{biblatex}. Use \code{default} if neither package is to be used, |
| 81 |
which means citations will be processed via the command |
| 82 |
\command{pandoc-citeproc}.} |
| 83 |
|
| 84 |
\item{includes}{Named list of additional content to include within the |
| 85 |
document (typically created using the \code{\link{includes}} function).} |
| 86 |
|
| 87 |
\item{md_extensions}{Markdown extensions to be added or removed from the |
| 88 |
default definition of R Markdown. See the \code{\link{rmarkdown_format}} for |
| 89 |
additional details.} |
| 90 |
|
| 91 |
\item{output_extensions}{Pandoc extensions to be added or removed from the |
| 92 |
output format, e.g., \code{"-smart"} means the output format will be |
| 93 |
\code{latex-smart}.} |
| 94 |
|
| 95 |
\item{pandoc_args}{Additional command line options to pass to pandoc} |
| 96 |
|
| 97 |
\item{context_path}{Path of the ConTeXt executable. If not provided, ConTeXt |
| 98 |
has to be available from the \code{PATH} environment variable.} |
| 99 |
|
| 100 |
\item{context_args}{Command line arguments passed to ConTeXt.} |
| 101 |
|
| 102 |
\item{ext}{Format of the output document (defaults to ".pdf").} |
| 103 |
} |
| 104 |
\value{ |
| 105 |
R Markdown output format to pass to \code{\link{render}}. |
| 106 |
} |
| 107 |
\description{ |
| 108 |
Format for converting from R Markdown to PDF using ConTeXt. |
| 109 |
} |
| 110 |
\details{ |
| 111 |
ConTeXt needs to be installed, e.g., you can install it with |
| 112 |
\code{tinytex::tlmgr_install("context")}. |
| 113 |
|
| 114 |
R Markdown documents can have optional metadata that is used to generate a |
| 115 |
document header that includes the title, author, and date. For more details |
| 116 |
see the documentation on R Markdown \link[=rmd_metadata]{metadata}. |
| 117 |
|
| 118 |
R Markdown documents also support citations. You can find more information on |
| 119 |
the markdown syntax for citations in the |
| 120 |
\href{https://pandoc.org/MANUAL.html#citations}{Bibliographies |
| 121 |
and Citations} article in the online documentation. |
| 122 |
} |
| 123 |
\examples{ |
| 124 |
\dontrun{ |
| 125 |
library(rmarkdown) |
| 126 |
|
| 127 |
# simple invocation |
| 128 |
render("input.Rmd", context_document()) |
| 129 |
} |
| 130 |
} |