Get dimensions of a LaTeX expression
Arguments
- tex
Character string of LaTeX math code.
- math_font
Name of the math font to use (e.g.,
"stix"). Use""(default) for Lete Sans Math, which pairs with R's default sans-serif text font. Seeavailable_math_fontsfor loaded fonts.- max_width
Numeric maximum width in big points for automatic line wrapping. Use
0(default) for no wrapping.- tex_style
Character: TeX style override. One of
""(default; let the parser decide),"display","text","script", or"scriptscript". Seelatex_grobfor the semantics of each value.- render_mode
Character string:
"typeface"(default) renders glyphs as native text using the math font, producing selectable/accessible text in PDF and SVG output. Requires the math font to be installed on the system. Falls back to path mode automatically on devices that do not support font embedding (e.g., the basepdf()device)."path"renders math symbols as filled vector paths (works on all devices but text is not selectable in PDF/SVG). For PDF output with embedded/selectable text, prefercairo_pdf.- gp
Graphical parameters (see
gpar). Common entries:col(formula foreground),fontfamily/fontface(text font),fontsize/cex(formula size), andlineheight(multi-line spacing). Seelatex_grobfor how each of these flows through MicroTeX.
Value
A list with the following elements:
width,height,depth: grid unit objects in big points.heightis total height (ascent + descent).baseline: grid unit object giving the baseline position measured in big points from the bottom of the bounding box. Equivalent toheight - depthfor single-line formulas. Useful for aligning a formula's baseline with surrounding text.is_split: logical;TRUEif the formula was wrapped across multiple lines (only possible whenmax_width > 0).