quarto-dev / quarto-dev/quarto-cli

Bug in block-style latex if exporting to docx

Open
#4,740 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement lint
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

If exporting to PDF or previewing the markdown document, the following snippet works great and as expected

The maximum entropy method is equivalent to least-squares fitting the available time series data to an autoregressive model:
\begin{equation}
X_t=\sum_{k=1}^M \alpha_k X_{t-k}+\epsilon_k
\end{equation}

However, if I export this to .docx, it does not seem to export the block style equation above. In order to do so, one must enclose the equation environment with the $$ delimiters, i.e.

The maximum entropy method is equivalent to least-squares fitting the available time series data to an autoregressive model:
$$
\begin{equation}
X_t=\sum_{k=1}^M \alpha_k X_{t-k}+\epsilon_k
\end{equation}
$$

While this works great for exporting to .docx, it now breaks exporting to pdf since xelatex complains about the $$ delimiters being used in a block env.

Is there a simple fix to this?

My version:

quarto --version
1.2.280
Checklist
  • 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.
  • Please format your issue so it is easier for us to read the bug report.
  • Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • Please document the operating system you're running. If on Linux, please provide the specific distribution.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported equation example from the issue by exporting it to PDF and DOCX, using xelatex for the PDF path. Compare how the equation environment is handled in each export path. Done means the block-style equation exports correctly to DOCX without requiring $$ delimiters and still produces valid PDF output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, latex
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.