While Markdown parsers like pandoc know what LaTeX is, commonmark does not, and that means LaTeX equations will end up with extra markup due to commonmark's desire to escape characters.
However, if you have LaTeX equations that use either $
or $$
to delimit them,
you can protect them from formatting changes with the $protect_math()
method (for users of the yarn
object)
or the protect_math()
function (for those using the output of to_xml()
).
Below is a demonstration using the yarn
object:
path <- system.file("extdata", "math-example.md", package = "tinkr") math <- tinkr::yarn$new(path) math$tail() # malformed math$protect_math()$tail() # success!
Note, however, that there are a few caveats for this:
$\alpha$
is valid, but $ \alpha$
and $\alpha $
are not valid.`INKEY$`
is good, but INKEY$
by itself is not good and will be interpreted as LaTeX code, throwing an error:
r
path <- system.file("extdata", "basic-math.md", package = "tinkr")
math <- tinkr::yarn$new(path)
math$head(15) # malformed
math$protect_math() #error
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.