paolobrasolin / jekyll-antex

Use arbitrary LaTeX in your Jekyll website!
https://paolobrasolin.github.io/jekyll-antex/
MIT License
3 stars 1 forks source link

`align` environment #25

Closed jaycech3n closed 2 years ago

jaycech3n commented 2 years ago

Does jekyll-antex support \begin{align} etc. environments? On my Krater instance using

{% tex classes: [antex,display] %}
\begin{align}
  \sum(\centerdot) = \mathbbm 1 \\\\
  \sum(\Gamma, A) = \sum_{\sum\Gamma} A
\end{align}
{% endtex %}

results in the following error:

! Missing \\endgroup inserted.
<inserted text> 
                \\endgroup 
l.9 \\end{align}

? 
! Emergency stop.
<inserted text> 
                \\endgroup 
l.9 \\end{align}

For now I'm getting around the issue with aligned inside the usual $ delimiters instead.

paolobrasolin commented 2 years ago

Hi @jaycech3n!

TL;DR: your workaround the best alternative I can come up with atm.


Each snippet gets compiled independently interpolating it into a template that puts it inside an lrbox to measure it before rendering it. So, any content must be compatible with an lrbox and that's where align fails.

The template is configurable so we could use something else than lrbox, but that's the most reliable way I found so far to measure TeX boxes. Ofc, suggestions are more than welcome. 😄

Another reason to not use align is that the numbering would not work, as snippets are renderend independently.

Furthermore, this would work but give some problems with sizing of the math:

{% tex classes: [antex, display] %}
\parbox[t]{\linewidth}{
\begin{align*}
  \sum(\centerdot) = \mathbbm 1 \\\\
  \sum(\Gamma, A) = \sum_{\sum\Gamma} A
\end{align*}}
{% endtex %}

So, all in all, $\begin{aligned}...\end{aligned}$ is currently the best option since it renders at the correctly size with no other problems.

(Thanks for trying krater! Sorry for the delay.)

paolobrasolin commented 2 years ago

@jaycech3n as a side note: I tend to use jekyll-antex for TikZ and diagrams while defaulting to Katex (or MathJax) for standard math contents. It's relatively easy to have a mixed setup -- lmk whether you're interested and I can point you to an example. 👍