Skip to content

KaTeX update #3833

Merged
Kwpolska merged 5 commits into
getnikola:masterfrom
arunpersaud:KaTeX
Apr 5, 2026
Merged

KaTeX update #3833
Kwpolska merged 5 commits into
getnikola:masterfrom
arunpersaud:KaTeX

Conversation

@arunpersaud

Copy link
Copy Markdown
Contributor

Pull Request Checklist

  • I’ve read the guidelines for contributing.
  • I updated AUTHORS.txt and CHANGES.txt (if the change is non-trivial) and documentation (if applicable).
  • I tested my changes.

Description

tested by creating a demo site and adding

$$\\sin(x) = \\frac{1}{3}$$                                                                          
\\begin{align*} \\sin(x) &= \\frac{1}{3} \\\\  \\cos(x)+5  &= \\int^1_0\exp(x) \\end{align*}         

to the post.

Based on #3710, Fixes #3709

Review needed since I haven't used math mode in nikola before and, for example, not sure about "double " needed in input. Also, KaTeX seems to support some more environment and I'm not sure if the the setup one should only use the * version of those or the one without star or both?

Comment thread nikola/conf.py.in Outdated
@Kwpolska

Copy link
Copy Markdown
Member

Double backslashes are usually required when using markdown or reST, we can’t do much about it.

The default value that KaTeX uses is:

[
  {left: "$$", right: "$$", display: true},
  {left: "\\(", right: "\\)", display: false},
  {left: "\\begin{equation}", right: "\\end{equation}", display: true},
  {left: "\\begin{align}", right: "\\end{align}", display: true},
  {left: "\\begin{alignat}", right: "\\end{alignat}", display: true},
  {left: "\\begin{gather}", right: "\\end{gather}", display: true},
  {left: "\\begin{CD}", right: "\\end{CD}", display: true},
  {left: "\\[", right: "\\]", display: true}
]

We should probably use that and add equation*, because IIRC some input format will generate that. I’m not sure about align vs align*, we probably want both.

@arunpersaud

Copy link
Copy Markdown
Contributor Author

Added equation and align* and fixed the missing comma.

@arunpersaud

Copy link
Copy Markdown
Contributor Author

just checking in, if anything else is needed here

@Kwpolska

Kwpolska commented Apr 1, 2026

Copy link
Copy Markdown
Member

@arunpersaud Have you tested this?

@arunpersaud

Copy link
Copy Markdown
Contributor Author

yes, I tried it in a uv venv, did a nikola install, nikola init, created a test page, build it, served it and checked the webpage. I checked that the correct KaTeX version was in the html and that the math rendered.

However, I only tried it using one python version (3.14.3) and only using a .rst page (no markdown) and I had to enable

.. has_math: yes

in the page header. Without the metadata, the LaTeX did not render.

I also only tried the following LaTeX code:

Here is inline math: :math:`E = mc^2`                                                   
                                                                                        
And a block:                                                                            
                                                                                        
.. math::                                                                               
                                                                                        
   \int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}                                     
  

@Kwpolska Kwpolska merged commit 0a3f5e9 into getnikola:master Apr 5, 2026
13 checks passed
@arunpersaud arunpersaud deleted the KaTeX branch April 8, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KaTeX is out of date, align* environment missing (current is 0.10.2, latest is 0.16.8)

3 participants