diff --git a/altdoc/quarto_website.yml b/altdoc/quarto_website.yml index cf8a5bb9..462a8ad5 100644 --- a/altdoc/quarto_website.yml +++ b/altdoc/quarto_website.yml @@ -20,7 +20,6 @@ website: - vignettes/plot.qmd - vignettes/theme.qmd - vignettes/custom.qmd - - vignettes/options.qmd - vignettes/notebooks.qmd - vignettes/faq.qmd - text: Tutorial (PDF) diff --git a/man-roxygen/global_options.R b/man-roxygen/global_options.R index 520fe5af..c2b845ae 100644 --- a/man-roxygen/global_options.R +++ b/man-roxygen/global_options.R @@ -1,49 +1,101 @@ #' #' @section Global options: #' -#' Many global options can be used to set the default argument values of `tinytable` functions. -#' For a full list, see: +#' Options can be set with `options()` and change the default behavior of tinytable. For example: #' -#' https://vincentarelbundock.github.io/tinytable/vignettes/options.html +#' ```r +#' options(tinytable_tt_digits = 4) +#' tt(head(iris)) +#' ``` #' -#' ## Quarto +#' You can set options in a script or via `.Rprofile`. Note: be cautious with `.Rprofile` settings as they may affect reproducibility. #' -#' ### Figure environment +#' ## Default values for function arguments #' -#' * `options("tinytable_quarto_figure" = FALSE)`: Typst only. Normally, it is best to allow Quarto to define the figure environment, so the default behavior is to not include one. -#' * `options(tinytable_print_rstudio_notebook = "inline")`: Display tables "inline" or in the "viewer" in RStudio notebooks. +#' ### tt() #' -#' ### Data Processing +#' * `tinytable_tt_digits` +#' * `tinytable_tt_caption` +#' * `tinytable_tt_notes` +#' * `tinytable_tt_width` +#' * `tinytable_tt_theme` +#' * `tinytable_tt_rownames` #' -#' The `format_tt(quarto=TRUE)` argument activates Quarto data processing for specific cells. This funcationality comes with a few warnings: +#' ### format_tt() #' -#' 1. Currently, Quarto provides a `\QuartoMarkdownBase64{}` LaTeX macro, but it does not appear to do anything with it. References and markdown codes may not be processed as expected in LaTeX. -#' 2. Quarto data processing can enter in conflict with `tinytable` styling or formatting options. See below for how to disable it. +#' * `tinytable_format_digits` +#' * `tinytable_format_num_fmt` +#' * `tinytable_format_num_zero` +#' * `tinytable_format_num_suffix` +#' * `tinytable_format_num_mark_big` +#' * `tinytable_format_num_mark_dec` +#' * `tinytable_format_date` +#' * `tinytable_format_bool` +#' * `tinytable_format_other` +#' * `tinytable_format_replace` +#' * `tinytable_format_escape` +#' * `tinytable_format_markdown` +#' * `tinytable_format_quarto` +#' * `tinytable_format_fn` +#' * `tinytable_format_sprintf` #' -#' `options(tinytable_quarto_disable_processing = TRUE)` +#' ### save_tt() #' -#' Disable Quarto processing of cell content. Setting this global option to `FALSE` may lead to conflicts with some `tinytable` features, but it also allows use of markdown and Quarto-specific code in table cells, such as cross-references. +#' * `tinytable_save_overwrite` #' -#' ```r -#' x <- data.frame(Math = "x^2^", Citation = "@Lovelace1842") -#' fn <- function(z) sprintf("", z) -#' tt(x) |> format_tt(i = 1, fn = fn) -#' ``` +#' ### theme_tt() +#' +#' Placement: +#' * `tinytable_theme_placement_float` +#' * `tinytable_theme_placement_horizontal` +#' +#' Resize: +#' * `tinytable_theme_resize_width` +#' * `tinytable_theme_resize_direction` +#' +#' Multipage: +#' * `tinytable_theme_multipage_rowhead` +#' * `tinytable_theme_multipage_rowfoot` +#' +#' Tabular: +#' * `tinytable_theme_tabular_style` +#' +#' ### print.tinytable() +#' +#' * `tinytable_print_output` #' -#' See this link for more details: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing +#' ## Output-specific options #' -#' ## HTML +#' ### HTML #' -#' * `options(tinytable_html_mathjax = TRUE)` -#' - insert MathJax scripts in the HTML document. Warning: This may conflict with other elements of the page if MathJax is otherwise loaded. -#' * `options(tinytable_html_portable = TRUE)` -#' - `plot_tt()` inserts base 64 encoded images directly in the HTML file rather than use external links. +#' * `tinytable_html_mathjax`: Insert MathJax scripts (warning: may conflict if MathJax is loaded elsewhere) +#' * `tinytable_html_portable`: Insert base64 encoded images directly in HTML for `plot_tt()` #' -#' ## PDF +#' ### PDF #' -#' * `options(tinytable_pdf_clean = TRUE)` -#' - deletes temporary and log files. -#' * `options(tinytable_pdf_engine = "xelatex")` -#' - "xelatex", "pdflatex", "lualatex" +#' * `tinytable_pdf_clean`: Delete temporary and log files +#' * `tinytable_pdf_engine`: Choose between "xelatex", "pdflatex", "lualatex" +#' +#' ### Quarto +#' +#' The `format_tt(quarto=TRUE)` argument enables Quarto data processing with some limitations: +#' +#' 1. The `\QuartoMarkdownBase64{}` LaTeX macro may not process references and markdown as expected +#' 2. Quarto processing may conflict with `tinytable` styling/formatting +#' +#' Options: +#' +#' * `tinytable_quarto_disable_processing`: Disable Quarto cell processing +#' * `tinytable_print_rstudio_notebook`: Display tables "inline" or in "viewer" for RStudio notebooks +#' * `tinytable_quarto_figure`: Control Typst figure environment in Quarto +#' +#' Example of Quarto-specific code in cells: +#' +#' ```r +#' x <- data.frame(Math = "x^2^", Citation = "@Lovelace1842") +#' fn <- function(z) sprintf("", z) +#' tt(x) |> format_tt(i = 1, fn = fn) +#' ``` #' +#' For more details on Quarto table processing: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing #' diff --git a/man/format_tt.Rd b/man/format_tt.Rd index a3d50df9..7ec628df 100644 --- a/man/format_tt.Rd +++ b/man/format_tt.Rd @@ -99,64 +99,125 @@ If this function is applied several times to the same cell, the last transformat \section{Global options}{ -Many global options can be used to set the default argument values of \code{tinytable} functions. -For a full list, see: +Options can be set with \code{options()} and change the default behavior of tinytable. For example: -https://vincentarelbundock.github.io/tinytable/vignettes/options.html -\subsection{Quarto}{ -\subsection{Figure environment}{ +\if{html}{\out{
}}\preformatted{options(tinytable_tt_digits = 4) +tt(head(iris)) +}\if{html}{\out{
}} + +You can set options in a script or via \code{.Rprofile}. Note: be cautious with \code{.Rprofile} settings as they may affect reproducibility. +\subsection{Default values for function arguments}{ +\subsection{tt()}{ \itemize{ -\item \code{options("tinytable_quarto_figure" = FALSE)}: Typst only. Normally, it is best to allow Quarto to define the figure environment, so the default behavior is to not include one. -\item \code{options(tinytable_print_rstudio_notebook = "inline")}: Display tables "inline" or in the "viewer" in RStudio notebooks. +\item \code{tinytable_tt_digits} +\item \code{tinytable_tt_caption} +\item \code{tinytable_tt_notes} +\item \code{tinytable_tt_width} +\item \code{tinytable_tt_theme} +\item \code{tinytable_tt_rownames} } } -\subsection{Data Processing}{ - -The \code{format_tt(quarto=TRUE)} argument activates Quarto data processing for specific cells. This funcationality comes with a few warnings: -\enumerate{ -\item Currently, Quarto provides a \verb{\\QuartoMarkdownBase64\{\}} LaTeX macro, but it does not appear to do anything with it. References and markdown codes may not be processed as expected in LaTeX. -\item Quarto data processing can enter in conflict with \code{tinytable} styling or formatting options. See below for how to disable it. +\subsection{format_tt()}{ +\itemize{ +\item \code{tinytable_format_digits} +\item \code{tinytable_format_num_fmt} +\item \code{tinytable_format_num_zero} +\item \code{tinytable_format_num_suffix} +\item \code{tinytable_format_num_mark_big} +\item \code{tinytable_format_num_mark_dec} +\item \code{tinytable_format_date} +\item \code{tinytable_format_bool} +\item \code{tinytable_format_other} +\item \code{tinytable_format_replace} +\item \code{tinytable_format_escape} +\item \code{tinytable_format_markdown} +\item \code{tinytable_format_quarto} +\item \code{tinytable_format_fn} +\item \code{tinytable_format_sprintf} +} } -\code{options(tinytable_quarto_disable_processing = TRUE)} - -Disable Quarto processing of cell content. Setting this global option to \code{FALSE} may lead to conflicts with some \code{tinytable} features, but it also allows use of markdown and Quarto-specific code in table cells, such as cross-references. +\subsection{save_tt()}{ +\itemize{ +\item \code{tinytable_save_overwrite} +} +} -\if{html}{\out{
}}\preformatted{x <- data.frame(Math = "x^2^", Citation = "@Lovelace1842") -fn <- function(z) sprintf("", z) -tt(x) |> format_tt(i = 1, fn = fn) -}\if{html}{\out{
}} +\subsection{theme_tt()}{ -See this link for more details: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing +Placement: +\itemize{ +\item \code{tinytable_theme_placement_float} +\item \code{tinytable_theme_placement_horizontal} } +Resize: +\itemize{ +\item \code{tinytable_theme_resize_width} +\item \code{tinytable_theme_resize_direction} } -\subsection{HTML}{ +Multipage: \itemize{ -\item \code{options(tinytable_html_mathjax = TRUE)} +\item \code{tinytable_theme_multipage_rowhead} +\item \code{tinytable_theme_multipage_rowfoot} +} + +Tabular: \itemize{ -\item insert MathJax scripts in the HTML document. Warning: This may conflict with other elements of the page if MathJax is otherwise loaded. +\item \code{tinytable_theme_tabular_style} } -\item \code{options(tinytable_html_portable = TRUE)} +} + +\subsection{print.tinytable()}{ \itemize{ -\item \code{plot_tt()} inserts base 64 encoded images directly in the HTML file rather than use external links. +\item \code{tinytable_print_output} } } + } -\subsection{PDF}{ +\subsection{Output-specific options}{ +\subsection{HTML}{ \itemize{ -\item \code{options(tinytable_pdf_clean = TRUE)} +\item \code{tinytable_html_mathjax}: Insert MathJax scripts (warning: may conflict if MathJax is loaded elsewhere) +\item \code{tinytable_html_portable}: Insert base64 encoded images directly in HTML for \code{plot_tt()} +} +} + +\subsection{PDF}{ \itemize{ -\item deletes temporary and log files. +\item \code{tinytable_pdf_clean}: Delete temporary and log files +\item \code{tinytable_pdf_engine}: Choose between "xelatex", "pdflatex", "lualatex" +} +} + +\subsection{Quarto}{ + +The \code{format_tt(quarto=TRUE)} argument enables Quarto data processing with some limitations: +\enumerate{ +\item The \verb{\\QuartoMarkdownBase64\{\}} LaTeX macro may not process references and markdown as expected +\item Quarto processing may conflict with \code{tinytable} styling/formatting } -\item \code{options(tinytable_pdf_engine = "xelatex")} + +Options: \itemize{ -\item "xelatex", "pdflatex", "lualatex" +\item \code{tinytable_quarto_disable_processing}: Disable Quarto cell processing +\item \code{tinytable_print_rstudio_notebook}: Display tables "inline" or in "viewer" for RStudio notebooks +\item \code{tinytable_quarto_figure}: Control Typst figure environment in Quarto } + +Example of Quarto-specific code in cells: + +\if{html}{\out{
}}\preformatted{x <- data.frame(Math = "x^2^", Citation = "@Lovelace1842") +fn <- function(z) sprintf("", z) +tt(x) |> format_tt(i = 1, fn = fn) +}\if{html}{\out{
}} + +For more details on Quarto table processing: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing } + } } diff --git a/man/group_tt.Rd b/man/group_tt.Rd index 082335b6..3e1f1653 100644 --- a/man/group_tt.Rd +++ b/man/group_tt.Rd @@ -34,7 +34,7 @@ Warning: The \code{style_tt()} can normally be used to style the group headers, \section{Word and Markdown limitations}{ -Markdown and Word tables only support these styles: italic, bold, strikeout. The \code{width} arugment is also unavailable +Markdown and Word tables only support these styles: italic, bold, strikeout. The \code{width} argument is also unavailable Moreover, the \code{style_tt()} function cannot be used to style headers inserted by the \code{group_tt()} function; instead, you should style the headers directly in the header definition using markdown syntax: \code{group_tt(i = list("*italic header*" = 2))}. These limitations are due to the fact that there is no markdown diff --git a/man/save_tt.Rd b/man/save_tt.Rd index a443571a..4560a46f 100644 --- a/man/save_tt.Rd +++ b/man/save_tt.Rd @@ -63,64 +63,125 @@ Note: Your document will fail to compile to PDF in Quarto if you enable caching \section{Global options}{ -Many global options can be used to set the default argument values of \code{tinytable} functions. -For a full list, see: +Options can be set with \code{options()} and change the default behavior of tinytable. For example: -https://vincentarelbundock.github.io/tinytable/vignettes/options.html -\subsection{Quarto}{ -\subsection{Figure environment}{ +\if{html}{\out{
}}\preformatted{options(tinytable_tt_digits = 4) +tt(head(iris)) +}\if{html}{\out{
}} + +You can set options in a script or via \code{.Rprofile}. Note: be cautious with \code{.Rprofile} settings as they may affect reproducibility. +\subsection{Default values for function arguments}{ +\subsection{tt()}{ \itemize{ -\item \code{options("tinytable_quarto_figure" = FALSE)}: Typst only. Normally, it is best to allow Quarto to define the figure environment, so the default behavior is to not include one. -\item \code{options(tinytable_print_rstudio_notebook = "inline")}: Display tables "inline" or in the "viewer" in RStudio notebooks. +\item \code{tinytable_tt_digits} +\item \code{tinytable_tt_caption} +\item \code{tinytable_tt_notes} +\item \code{tinytable_tt_width} +\item \code{tinytable_tt_theme} +\item \code{tinytable_tt_rownames} } } -\subsection{Data Processing}{ - -The \code{format_tt(quarto=TRUE)} argument activates Quarto data processing for specific cells. This funcationality comes with a few warnings: -\enumerate{ -\item Currently, Quarto provides a \verb{\\QuartoMarkdownBase64\{\}} LaTeX macro, but it does not appear to do anything with it. References and markdown codes may not be processed as expected in LaTeX. -\item Quarto data processing can enter in conflict with \code{tinytable} styling or formatting options. See below for how to disable it. +\subsection{format_tt()}{ +\itemize{ +\item \code{tinytable_format_digits} +\item \code{tinytable_format_num_fmt} +\item \code{tinytable_format_num_zero} +\item \code{tinytable_format_num_suffix} +\item \code{tinytable_format_num_mark_big} +\item \code{tinytable_format_num_mark_dec} +\item \code{tinytable_format_date} +\item \code{tinytable_format_bool} +\item \code{tinytable_format_other} +\item \code{tinytable_format_replace} +\item \code{tinytable_format_escape} +\item \code{tinytable_format_markdown} +\item \code{tinytable_format_quarto} +\item \code{tinytable_format_fn} +\item \code{tinytable_format_sprintf} +} +} + +\subsection{save_tt()}{ +\itemize{ +\item \code{tinytable_save_overwrite} +} } -\code{options(tinytable_quarto_disable_processing = TRUE)} - -Disable Quarto processing of cell content. Setting this global option to \code{FALSE} may lead to conflicts with some \code{tinytable} features, but it also allows use of markdown and Quarto-specific code in table cells, such as cross-references. - -\if{html}{\out{
}}\preformatted{x <- data.frame(Math = "x^2^", Citation = "@Lovelace1842") -fn <- function(z) sprintf("", z) -tt(x) |> format_tt(i = 1, fn = fn) -}\if{html}{\out{
}} +\subsection{theme_tt()}{ -See this link for more details: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing +Placement: +\itemize{ +\item \code{tinytable_theme_placement_float} +\item \code{tinytable_theme_placement_horizontal} } +Resize: +\itemize{ +\item \code{tinytable_theme_resize_width} +\item \code{tinytable_theme_resize_direction} } -\subsection{HTML}{ +Multipage: \itemize{ -\item \code{options(tinytable_html_mathjax = TRUE)} +\item \code{tinytable_theme_multipage_rowhead} +\item \code{tinytable_theme_multipage_rowfoot} +} + +Tabular: \itemize{ -\item insert MathJax scripts in the HTML document. Warning: This may conflict with other elements of the page if MathJax is otherwise loaded. +\item \code{tinytable_theme_tabular_style} +} } -\item \code{options(tinytable_html_portable = TRUE)} + +\subsection{print.tinytable()}{ \itemize{ -\item \code{plot_tt()} inserts base 64 encoded images directly in the HTML file rather than use external links. +\item \code{tinytable_print_output} } } + } -\subsection{PDF}{ +\subsection{Output-specific options}{ +\subsection{HTML}{ \itemize{ -\item \code{options(tinytable_pdf_clean = TRUE)} +\item \code{tinytable_html_mathjax}: Insert MathJax scripts (warning: may conflict if MathJax is loaded elsewhere) +\item \code{tinytable_html_portable}: Insert base64 encoded images directly in HTML for \code{plot_tt()} +} +} + +\subsection{PDF}{ \itemize{ -\item deletes temporary and log files. +\item \code{tinytable_pdf_clean}: Delete temporary and log files +\item \code{tinytable_pdf_engine}: Choose between "xelatex", "pdflatex", "lualatex" } -\item \code{options(tinytable_pdf_engine = "xelatex")} +} + +\subsection{Quarto}{ + +The \code{format_tt(quarto=TRUE)} argument enables Quarto data processing with some limitations: +\enumerate{ +\item The \verb{\\QuartoMarkdownBase64\{\}} LaTeX macro may not process references and markdown as expected +\item Quarto processing may conflict with \code{tinytable} styling/formatting +} + +Options: \itemize{ -\item "xelatex", "pdflatex", "lualatex" +\item \code{tinytable_quarto_disable_processing}: Disable Quarto cell processing +\item \code{tinytable_print_rstudio_notebook}: Display tables "inline" or in "viewer" for RStudio notebooks +\item \code{tinytable_quarto_figure}: Control Typst figure environment in Quarto } + +Example of Quarto-specific code in cells: + +\if{html}{\out{
}}\preformatted{x <- data.frame(Math = "x^2^", Citation = "@Lovelace1842") +fn <- function(z) sprintf("", z) +tt(x) |> format_tt(i = 1, fn = fn) +}\if{html}{\out{
}} + +For more details on Quarto table processing: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing } + } } diff --git a/man/style_tt.Rd b/man/style_tt.Rd index bdd077fe..97023bba 100644 --- a/man/style_tt.Rd +++ b/man/style_tt.Rd @@ -127,7 +127,7 @@ This function applies styling to a table created by \code{tt()}. It allows custo \section{Word and Markdown limitations}{ -Markdown and Word tables only support these styles: italic, bold, strikeout. The \code{width} arugment is also unavailable +Markdown and Word tables only support these styles: italic, bold, strikeout. The \code{width} argument is also unavailable Moreover, the \code{style_tt()} function cannot be used to style headers inserted by the \code{group_tt()} function; instead, you should style the headers directly in the header definition using markdown syntax: \code{group_tt(i = list("*italic header*" = 2))}. These limitations are due to the fact that there is no markdown diff --git a/man/tt.Rd b/man/tt.Rd index ae6bcae3..52e100a6 100644 --- a/man/tt.Rd +++ b/man/tt.Rd @@ -101,7 +101,7 @@ Note: Your document will fail to compile to PDF in Quarto if you enable caching \section{Word and Markdown limitations}{ -Markdown and Word tables only support these styles: italic, bold, strikeout. The \code{width} arugment is also unavailable +Markdown and Word tables only support these styles: italic, bold, strikeout. The \code{width} argument is also unavailable Moreover, the \code{style_tt()} function cannot be used to style headers inserted by the \code{group_tt()} function; instead, you should style the headers directly in the header definition using markdown syntax: \code{group_tt(i = list("*italic header*" = 2))}. These limitations are due to the fact that there is no markdown @@ -112,64 +112,125 @@ via the Pandoc software. \section{Global options}{ -Many global options can be used to set the default argument values of \code{tinytable} functions. -For a full list, see: +Options can be set with \code{options()} and change the default behavior of tinytable. For example: -https://vincentarelbundock.github.io/tinytable/vignettes/options.html -\subsection{Quarto}{ -\subsection{Figure environment}{ +\if{html}{\out{
}}\preformatted{options(tinytable_tt_digits = 4) +tt(head(iris)) +}\if{html}{\out{
}} + +You can set options in a script or via \code{.Rprofile}. Note: be cautious with \code{.Rprofile} settings as they may affect reproducibility. +\subsection{Default values for function arguments}{ +\subsection{tt()}{ \itemize{ -\item \code{options("tinytable_quarto_figure" = FALSE)}: Typst only. Normally, it is best to allow Quarto to define the figure environment, so the default behavior is to not include one. -\item \code{options(tinytable_print_rstudio_notebook = "inline")}: Display tables "inline" or in the "viewer" in RStudio notebooks. +\item \code{tinytable_tt_digits} +\item \code{tinytable_tt_caption} +\item \code{tinytable_tt_notes} +\item \code{tinytable_tt_width} +\item \code{tinytable_tt_theme} +\item \code{tinytable_tt_rownames} } } -\subsection{Data Processing}{ - -The \code{format_tt(quarto=TRUE)} argument activates Quarto data processing for specific cells. This funcationality comes with a few warnings: -\enumerate{ -\item Currently, Quarto provides a \verb{\\QuartoMarkdownBase64\{\}} LaTeX macro, but it does not appear to do anything with it. References and markdown codes may not be processed as expected in LaTeX. -\item Quarto data processing can enter in conflict with \code{tinytable} styling or formatting options. See below for how to disable it. +\subsection{format_tt()}{ +\itemize{ +\item \code{tinytable_format_digits} +\item \code{tinytable_format_num_fmt} +\item \code{tinytable_format_num_zero} +\item \code{tinytable_format_num_suffix} +\item \code{tinytable_format_num_mark_big} +\item \code{tinytable_format_num_mark_dec} +\item \code{tinytable_format_date} +\item \code{tinytable_format_bool} +\item \code{tinytable_format_other} +\item \code{tinytable_format_replace} +\item \code{tinytable_format_escape} +\item \code{tinytable_format_markdown} +\item \code{tinytable_format_quarto} +\item \code{tinytable_format_fn} +\item \code{tinytable_format_sprintf} +} } -\code{options(tinytable_quarto_disable_processing = TRUE)} - -Disable Quarto processing of cell content. Setting this global option to \code{FALSE} may lead to conflicts with some \code{tinytable} features, but it also allows use of markdown and Quarto-specific code in table cells, such as cross-references. +\subsection{save_tt()}{ +\itemize{ +\item \code{tinytable_save_overwrite} +} +} -\if{html}{\out{
}}\preformatted{x <- data.frame(Math = "x^2^", Citation = "@Lovelace1842") -fn <- function(z) sprintf("", z) -tt(x) |> format_tt(i = 1, fn = fn) -}\if{html}{\out{
}} +\subsection{theme_tt()}{ -See this link for more details: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing +Placement: +\itemize{ +\item \code{tinytable_theme_placement_float} +\item \code{tinytable_theme_placement_horizontal} } +Resize: +\itemize{ +\item \code{tinytable_theme_resize_width} +\item \code{tinytable_theme_resize_direction} } -\subsection{HTML}{ +Multipage: \itemize{ -\item \code{options(tinytable_html_mathjax = TRUE)} +\item \code{tinytable_theme_multipage_rowhead} +\item \code{tinytable_theme_multipage_rowfoot} +} + +Tabular: \itemize{ -\item insert MathJax scripts in the HTML document. Warning: This may conflict with other elements of the page if MathJax is otherwise loaded. +\item \code{tinytable_theme_tabular_style} } -\item \code{options(tinytable_html_portable = TRUE)} +} + +\subsection{print.tinytable()}{ \itemize{ -\item \code{plot_tt()} inserts base 64 encoded images directly in the HTML file rather than use external links. +\item \code{tinytable_print_output} } } + } -\subsection{PDF}{ +\subsection{Output-specific options}{ +\subsection{HTML}{ \itemize{ -\item \code{options(tinytable_pdf_clean = TRUE)} +\item \code{tinytable_html_mathjax}: Insert MathJax scripts (warning: may conflict if MathJax is loaded elsewhere) +\item \code{tinytable_html_portable}: Insert base64 encoded images directly in HTML for \code{plot_tt()} +} +} + +\subsection{PDF}{ \itemize{ -\item deletes temporary and log files. +\item \code{tinytable_pdf_clean}: Delete temporary and log files +\item \code{tinytable_pdf_engine}: Choose between "xelatex", "pdflatex", "lualatex" +} +} + +\subsection{Quarto}{ + +The \code{format_tt(quarto=TRUE)} argument enables Quarto data processing with some limitations: +\enumerate{ +\item The \verb{\\QuartoMarkdownBase64\{\}} LaTeX macro may not process references and markdown as expected +\item Quarto processing may conflict with \code{tinytable} styling/formatting } -\item \code{options(tinytable_pdf_engine = "xelatex")} + +Options: \itemize{ -\item "xelatex", "pdflatex", "lualatex" +\item \code{tinytable_quarto_disable_processing}: Disable Quarto cell processing +\item \code{tinytable_print_rstudio_notebook}: Display tables "inline" or in "viewer" for RStudio notebooks +\item \code{tinytable_quarto_figure}: Control Typst figure environment in Quarto } + +Example of Quarto-specific code in cells: + +\if{html}{\out{
}}\preformatted{x <- data.frame(Math = "x^2^", Citation = "@Lovelace1842") +fn <- function(z) sprintf("", z) +tt(x) |> format_tt(i = 1, fn = fn) +}\if{html}{\out{
}} + +For more details on Quarto table processing: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing } + } } diff --git a/vignettes/options.qmd b/vignettes/options.qmd deleted file mode 100644 index 28917663..00000000 --- a/vignettes/options.qmd +++ /dev/null @@ -1,120 +0,0 @@ -# Available Options - -Options can be set with `options()` and change the default behavior of tinytable. For example, to format all tables to 4 digits when calling `tt()`, we can do: - -```r -options(tinytable_tt_digits = 4) -tt(head(iris)) -``` - -You can either set options in a script (usually at the top) or via `.Rprofile`. Note that you want to [be cautious](https://rstats.wtf/r-startup.html) with putting things in `.Rprofile` since they might make results not reproducible (e.g. if you change `tinytable_format_digits` in `.Rprofile`, the table will be formatted differently). - -## Default values for function arguments - -Most options are function specific and allow you to set default values. These all start with `tinytable_X_` where X is `tt`/`format`/`theme`/`print`. See the corresponding help documentation for the what the argument looks like. - -### `tt()` - -Sets default values for `tt()` arguments. - -- `tinytable_tt_digits` -- `tinytable_tt_caption` -- `tinytable_tt_notes` -- `tinytable_tt_width` -- `tinytable_tt_theme` -- `tinytable_tt_rownames` - -### `format_tt()` - -Sets default formats for different kinds of variables. see `format_tt()` - -- `tinytable_format_digits` -- `tinytable_format_num_fmt` -- `tinytable_format_num_zero` -- `tinytable_format_num_suffix` -- `tinytable_format_num_mark_big` -- `tinytable_format_num_mark_dec` -- `tinytable_format_date` -- `tinytable_format_bool` -- `tinytable_format_other` -- `tinytable_format_replace` -- `tinytable_format_escape` -- `tinytable_format_markdown` -- `tinytable_format_quarto` -- `tinytable_format_fn` -- `tinytable_format_sprintf` - -### `save_tt()` - -- `tinytable_save_overwrite` - -### `theme_tt()` - -When using `theme_tt(theme = "theme_name")`, this allows you to set default arguments to the corresponding theme. See `theme_tt()` for details. - -placement: - -- `tinytable_theme_placement_float` -- `tinytable_theme_placement_horizontal` - -resize: - -- `tinytable_theme_resize_width` -- `tinytable_theme_resize_direction` - -multipage: - -- `tinytable_theme_multipage_rowhead` -- `tinytable_theme_multipage_rowfoot` - -tabular: - -- `tinytable_theme_tabular_style` - -### `print.tinytable()` - -`tinytable_print_output` - - -## Global options - -The rest of the options are a set of global options that apply when the tables are being built. - -### HTML - -* `options(tinytable_html_mathjax = TRUE)` - - insert MathJax scripts in the HTML document. Warning: This may conflict with other elements of the page if MathJax is otherwise loaded. -* `options(tinytable_html_portable = TRUE)` - - `plot_tt()` inserts base 64-encoded images directly in the HTML file rather than use external links. - -### PDF - -* `options(tinytable_pdf_clean = TRUE)` - - deletes temporary and log files. -* `options(tinytable_pdf_engine = "xelatex")` - - `"xelatex"`, `"pdflatex"`, `"lualatex"` - -### Quarto - -The `format_tt(quarto=TRUE)` argument activates Quarto data processing for specific cells. This funcationality comes with a few warnings: - -1. Currently, Quarto provides a `\QuartoMarkdownBase64{}` LaTeX macro, but it does not appear to do anything with it. References and markdown codes may not be processed as expected in LaTeX. -2. Quarto data processing can enter in conflict with `tinytable` styling or formatting options. See below for how to disable it. - -* `options(tinytable_quarto_disable_processing = TRUE)` - - disables Quarto processing of cell content. -* `options(tinytable_print_rstudio_notebook = "inline")` or `"viewer"` - - Display tables inline in the notebook or in the viewer. Inline is an RStudio-only feature. -* `options(tinytable_quarto_figure = FALSE)` - - by default, do not include Typst tables in a figure environment in Quarto. - -Setting this global option to `FALSE` may lead to conflicts with some `tinytable` features, but it also allows use of markdown and Quarto-specific code in table cells, such as cross-references. - -```r -x <- data.frame(Math = "x^2^", Citation = "@Lovelace1842") -fn <- function(z) sprintf("", z) -tt(x) |> format_tt(i = 1, fn = fn) -``` - -See this link for more details: https://quarto.org/docs/authoring/tables.html#disabling-quarto-table-processing -