% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/options.R
\name{latex_options}
\alias{latex_options}
\alias{reset_latex_options}
\title{Set or query package-wide LaTeX rendering defaults}
\usage{
latex_options(
  math_font = NULL,
  render_mode = NULL,
  tex_style = NULL,
  input_mode = NULL,
  justify = NULL,
  line_break = NULL,
  markdown_style = NULL
)

reset_latex_options()
}
\arguments{
\item{math_font}{Math font name or alias (see
\code{\link{available_math_fonts}}).}

\item{render_mode}{Either \code{"typeface"} or \code{"path"}.}

\item{tex_style}{TeX style override. One of \code{""} (let the parser
decide), \code{"display"}, \code{"text"}, \code{"script"}, or
\code{"scriptscript"}. \code{"display"} forces large operators with
limits placed over/under, useful for inline labels that should still
look like display equations.}

\item{input_mode}{How the input string is interpreted before being
handed to MicroTeX. \code{"mixed"} (default) wraps the string in
\code{\\text{...}} so it reads as ordinary text, with \code{$...$}
(and \code{\\(...\\)}) opening math mode --- the document-level
LaTeX convention. Useful when consuming labels from other packages
that mix prose and math without explicit \code{\\text{}} markers.
\code{"math"} treats the whole string as math --- the classic
MicroTeX behaviour, where letters render as math italics and
unwrapped prose looks wrong.}

\item{justify}{Logical. When \code{TRUE}, wrapped text is stretched at
its interword spaces so every line but the last fills
\code{max_width} exactly. Has no effect without \code{max_width},
since it acts on the lines the wrapper produces. \code{FALSE}
(default) leaves the right edge ragged, matching R's own text
drawing. In a narrow column, justifying alone opens noticeably wide
word spaces; mark the words that may break with \code{\\-}.}

\item{line_break}{How lines are chosen when wrapping.
\code{"greedy"} (default) fills each line as far as it will go and
never reconsiders. \code{"optimal"} chooses the breaks together so
the paragraph as a whole reads best, in the spirit of Knuth-Plass:
pulling one word down early can improve every later line, which a
greedy pass cannot see. Requires \code{max_width}, and costs a
little more layout time.}

\item{markdown_style}{Default style for \code{\link{markdown_grob}} and
\code{\link{markdown_box_grob}}: a \code{\link{markdown_style}}
object, CSS text, or a path to a \code{.css} file.}
}
\value{
Invisibly returns the previous settings (a list). With no
arguments, returns the current settings visibly.
}
\description{
A single entry point for project-wide defaults used by
\code{\link{latex_grob}}, \code{\link{grid.latex}},
\code{\link{latex_dims}}, and \code{\link{latex_tree}}. Options set
here are applied only when the corresponding argument is \emph{not}
supplied at the call site, so explicit arguments always win.
}
\details{
Calling \code{latex_options()} with no arguments returns the current
settings (a list whose \code{NULL} entries mean "use the built-in
default"). Supply one or more named arguments to update them.

Font size and line spacing are controlled via \code{gp} parameters
(\code{fontsize}, \code{cex}, \code{lineheight}) at the grob level
--- see \code{\link{latex_grob}}.
}
\examples{
\donttest{
  latex_options(math_font = "stix", render_mode = "typeface")
  grid.latex("\\\\sum_{i=1}^{n} i^{2}", gp = grid::gpar(fontsize = 14))
  reset_latex_options()
}
}
\seealso{
\code{\link{available_math_fonts}}, \code{\link{latex_grob}}
}
