amael-ls / parse-latex

Filter that will parse raw LaTeX snippets and include the results in the output.
MIT License
0 stars 0 forks source link

nested environments #1

Open amael-ls opened 4 months ago

amael-ls commented 4 months ago

When there are nested environments then the filter might be unable to process/ignore correctly. Here is an example, where \eqref must be ignored, but not table:

---
filters:
  - parse-latex
parse-latex:
  eqref: backslash
  ref: backslash
  equation: begin
format:
  html:
    toc: true
    include-in-header: mathjax.html
  pdf:
    fontsize: 12pt
    mathspec: true
    include-in-header:
      - text: |
          \usepackage{booktabs}
---

Hello World! See \eqref{eq::test}
\begin{equation} \label{eq::test}
  x = 2
\end{equation}

::: {#tbl-methods_notations}

`{=latex}
\begin{tabular}{@{}rp{10cm}l@{}}
    \toprule
    \multicolumn{1}{c}{\textbf{Symbol}} & \multicolumn{1}{c}{\textbf{Definition}} & \multicolumn{1}{c}{\textbf{Unit}} \\
  \( x \) & defined by equation \eqref{eq::test}) & - \\
  \end{tabular}
`

Used notations, sorted by alphabetical order with Latin symbols first. The parameters of the gamma distribution priors
:::

The pdf output is correct (makes sense, it is not processed by the filter), but in the html output, the table is missing

amael-ls commented 3 months ago

The table is missing because, with my code, when \eqref{eq::test} is detected in the table, then it returns TRUE to the question 'should this be ignored' for the whole block (i..e, for the table, and not only for eqref).