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

epoxy_latex() not rendering LaTeX expression #127

Open
snhansen opened this issue Aug 8, 2024 · 3 comments
Open

epoxy_latex() not rendering LaTeX expression #127

snhansen opened this issue Aug 8, 2024 · 3 comments

Comments

@snhansen
Copy link

snhansen commented Aug 8, 2024

Consider this Quarto markdown document:

---
format: html
---

```{r}
#| include: false
library(epoxy)
x <- 2
```

```{epoxy_latex}
#| latex_raw: false
A:
$$
2^{10} = <<2^10>>
$$
```

```{epoxy_latex}
#| latex_raw: false
B:
$$
<<x>>^{10} == <<x^10>>
$$
```

```{epoxy_latex}
#| latex_raw: false
C:
$$
1\cdot<<x>>^{10} = <<x^10>>
$$
```

The second chunk (B) isn't rendered in the output. It seems to be caused by starting the chunk with a <<>> because putting something in front of it solves the issue (C).

@gadenbuie
Copy link
Owner

Hi @snhansen! It turns out this is actually a bug in knitr. I commented on a relevant issue that independently discovered the same behavior. In your case, the trick you can apply is to make sure that the <<x>> elements aren't ever the first thing on a line:

```{epoxy_latex}
#| latex_raw: false
B:
$$<<x>>^{10} == <<x>>$$
```

@gadenbuie
Copy link
Owner

With knitr >= 1.48.3 we'll be able to set ref.chunk = FALSE for epoxy_latex chunks. (See linked issue above for details.) I'll work on adding this epoxy soon.

@snhansen
Copy link
Author

Great! I just tried the example in the OP with knitr 1.48.3 and the issue has been resolved without setting ref.chunk = FALSE for the chunks. So it seems that minimal fix that was initially committed did the job in this particular case.

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