Closed ThierryO closed 3 years ago
I'm not an expert on the katex library itself, but I think this is intended, such that output can be rendered in tex clients?
Maybe when using hugo it is better to use katex_html()
?
I get the same issue with both katex_html()
and katex_mathml()
I've ended up writing two helper functions.
math_display <- function(tex) {
x <- vapply(tex, katex_mathml, character(1), displayMode = TRUE)
x <- gsub("<annotation(.*?)\\/annotation>", "", x)
cat(x)
}
math_inline <- function(tex) {
x <- katex_mathml(tex = tex, displayMode = FALSE)
x <- gsub("<annotation(.*?)\\/annotation>", "", x)
cat(x)
}
OK glad you found a solution. I think if you want to fix this you need to report this in the upstream KaTeX repository. The R package just provides bindings we don't control the output.
returns the output below. I split the output over multiple lines to highlight the issue. The output contains an annotation. This annotation is rendered below the equation when using Hugo to render the md to html.