quarto-dev / quarto-dev/quarto-cli
Conditional content does not work with latex macros
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Bug description
It seems like macros in hidden divs still get expanded by pandoc. This is problematic as I have defined some macros that only work with mathjax not latex (and vis versa) (for example the mathjax mathtip macro)
::: {.content-visible unless-format="pdf"}
\newcommand{\test}{one}
:::
::: {.content-visible unless-format="html"}
\newcommand{\test}{two}
:::
$\test$
Quarto will complain that the second macro has already been defined irrespective of output. Ideally for macros one should be able to have a sort of preamble for html that gets parsed by pandoc (not just passed through like include-before-body does), thus one could specify which to include in yaml dependent on output wanted
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproducer in the issue and compare HTML and PDF rendering, focusing on how conditional content and Pandoc macro expansion are handled. Trace the relevant conditional-content entry point and verify that only the macro for the selected output format is expanded, without a duplicate-definition error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- latex
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100