Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

katex produces extra phantom output in rmarkdown::html_vignette #12

Open
kgoldfeld opened this issue Feb 15, 2023 · 2 comments
Open

katex produces extra phantom output in rmarkdown::html_vignette #12

kgoldfeld opened this issue Feb 15, 2023 · 2 comments

Comments

@kgoldfeld
Copy link

I have used katex successfully in R blogdown when creating html output. However, I am running into a problem when creating a vignette for an R package that is being output to an rmarkdown::html_vignette. Here's the yaml:

---
title: "Correlation Matrices"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Correlation Matrices}
  %\VignetteEngine{knitr::rmarkdown}
  \usepackage[utf8]{inputenc}
---

And here is the katex-related code:

matform <- "
R = \\left (
\\begin{matrix} 
1.0 & \\rho & \\rho & \\rho \\\\
\\rho & 1.0 & \\rho & \\rho \\\\
\\rho & \\rho & 1.0 & \\rho \\\\
\\rho & \\rho & \\rho & 1.0
\\end{matrix}
\\right )
"

katex::katex_html(matform)

And the correct matrix is generated in the html output file, but there is extra output that shows up:

katex_eample

The centered matrix on top is what I am trying to create. The "inline" piece below is not desired. Is this a bug, or have I implemented incorrectly? Thanks so much.

@jeroen
Copy link
Member

jeroen commented Feb 15, 2023

I can't reproduce this, it seems to work fine for me?

Screenshot 2023-02-15 at 8 40 17 AM

Is there perhaps something else in your vignette that could be interfering? Do you see the same problem with an empty vignette with only this equation? Are you using the latest version of katex from cran?

@kgoldfeld
Copy link
Author

I was missing the include_css = TRUE argument. In blogdown, where I first used katex, the output was generated as expected without explicitly specifying include_css. But, I am very glad to have this resolved. Thanks so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants