Text can enter ggforma as literal Unicode, a restricted Markdown/HTML string or a checked R plotmath expression. Inline tags inherit styles. The renderer shapes the paragraph before applying paint to glyph clusters. An unavailable typeface can change both the line breaks and the glyphs you see.
Equations inside text
Use format = "mixed" to recognise dollar-delimited plotmath. Markdown alone preserves dollar signs as ordinary text. In mixed input, escape a literal dollar as \\$ in an R string. On the drawing device the formula supplies its advance, ascent and descent. Text can wrap around it. A formula stays together on one line.
grid.newpage()
grid.draw(markup_grob("A **mean** with standard error $frac(sigma, sqrt(n))$.",
format = "mixed", width = unit(63, "mm"), size = 16,
padding = unit(2, "mm"), fill = "grey96",
border = "grey70", radius = unit(2, "mm")))
A stand-alone display equation can use double-dollar delimiters on its own line. Examples of accepted plotmath include sum(x[i], i == 1, n), integral(f(x), 0, 1), nested fractions, roots and limits. Use geom_markup_label() for data-bound padded boxes and element_markup() in plot titles, axes, guides and facet strips. The grid grob uses big points and grid units. Geom sizes use millimetres.
The supported markup includes emphasis, inline code, underline, strike-through, superscripts, subscripts and styled spans. Supported CSS properties include local font family, size in pt, bold/italic, decoration and hexadecimal foreground colour. Linked images, arbitrary HTML/CSS, matrices, aligned systems and TeX commands are outside the grammar.