ltx_fontsize | R Documentation |
This function modifies the LaTeX code for a table to set the font size and line spacing. It appends the necessary LaTeX command to the table's LaTeX code.
ltx_fontsize(x, font_size = 8, skip = NULL, print_tbl = FALSE, verbose = TRUE)
x |
A character vector representing LaTeX code for a table, typically
captured via |
font_size |
Numeric value indicating the desired font size (default is 8). |
skip |
Numeric value for the line spacing (skip), typically set to 1.2
times the font size. If |
print_tbl |
Logical, whether to print the modified LaTeX table to the
console (default is |
verbose |
Logical, whether to display informative messages via the |
The function appends a LaTeX \\fontsize{}
and \\selectfont
command
directly after the \\begin{table}
tag in the input LaTeX code. If the
skip
parameter is NULL
, the function sets the skip value to 1.2 times
the font_size
.
The function validates that font_size
and skip
are positive values and
that a \\begin{table}
tag is present. If verbose is enabled, informative
messages are displayed to guide the user.
Returns the modified LaTeX code as a character vector (invisible).
ltx_capture_output
## Not run:
# Sample LaTeX table code
table_code <-
c("\\begin{table}",
"\\centering",
"\\begin{tabular}{cc}",
"A & B \\\\",
"1 & 2 \\\\",
"\\end{tabular}",
"\\end{table}")
# Modify font size to 10
modified_code <- ltx_fontsize(table_code, font_size = 10, skip = 12, print_tbl = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.