I am using quarto to create a lesson with lots of mixed in tex. I want two version of this lesson -- one with answers and one without the answers -- in the same document to avoid trying to keep the two files consistent. What is the easiest way to do this?
I tried
::: {.content-visible XXX}
Will only appear in HTML.
:::
but that only seems to be working if I want to change the document output format. I want it to toggle with just a TRUE or FALSE value. I also tried
```{r, eval = showText, echo = TRUE, output = "asis"}
The probability that $n^2$ items happy is `dpois(n, 1)`.
```
However, this gives me the error
Error: unexpected symbol in "The probability"
Furthermore, it doesn't render the latex $n^2$
UPDATE: I tried the Lua filter approach without success.
---
title: "Conditional Content"
format: pdf
editor: visual
hide-answer: false
filters:
- hide-answer.lua
---
## Answer Test
- This is a list
- This $n^2$ works
- This is another element
- **Question:** What is my name?
::: answer
- Why is this $n^2$ failing?
:::
- Continuation