-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Unwanted vertical space after aligned environment #3142
Description
Before reporting a bug
- Check common issues.
- Check the bug is reproducible in the demo. If not, check KaTeX is up-to-date and installed correctly.
- Search for existing issues.
Describe the bug:
Using the aligned environment results in extra unwanted empty space at the bottom of the rendered math equations.
To Reproduce:
Steps to reproduce the behavior:
-
Go to the KaTeX demo
-
Enter any equation using
\begin{aligned}...\end{aligned}, such as\begin{aligned} (\overline{\alpha} ; \beta)(k \otimes v) &= ((\otimes ; \overline{\alpha}) ; \beta)(k,v) \\ &= (\alpha ; \beta)(k,v) = \beta(kv) \\ &= 1 \otimes kv = k \otimes v \end{aligned} -
Right click on the equation and "inspect element". Hover over the
span.katex-displayelement in the DOM tree to see the bounding box for the element. You will see something like this:
As you can see, this extra space is not usually present for equations not using the aligned environment:
As you can see from the image below, this extra space can look quite awkard in context. Paragraph spacing that normally looks fine is made asymmetric by the extra space. Worse, it's not possible to fix the problem with CSS, as there's not a simple way to detect when the aligned environment is being used to render math that appears just before a paragraph.
Expected behavior:
There should be no extra vertical space at the bottom of aligned environments.
Screenshots: see above
Environment (please complete the following information):
- KaTeX Version: 0.13.13
- Device: Desktop
- OS: Ubuntu 20.04
- Browser: Tested in Chrome and Firefox
- Version: Chrome v91, Firefox v90.0
Additional context: None. Reproducible on the demo site.


