### Bug description

Latex isn't rendering correctly with a `\text{#}` character using either Katex or Mathjax.

`file.qmd`:
```
---
jupyter: python3
---

This is a test

$$
w_{\color{orange}{\text{current node #}}}
$$

or this: $a \text{#} b$
```

which was generated from a simple `.ipynb` file which renders like this:

<img width="825" alt="image" src="https://user-images.githubusercontent.com/742407/220462294-a4816779-2540-4609-9175-29c7aadb96a3.png">

the resulting html file, however, looks like this:
<img width="857" alt="image" src="https://user-images.githubusercontent.com/742407/220462418-c80f0923-d199-49e8-a606-3b2d5f509f78.png">

OS: Mac 13.2.1

### Checklist

- [X] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [X] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] Please document the operating system you're running. If on Linux, please provide the specific distribution.
2023-02-21T21:29:39Z
diego898
bug
closed
Latex isn't rendering correctly with a \text{#} character in either Katex or Mathjax
https://github.com/quarto-dev/quarto-cli/issues/4450