dealing with KaTeX

Input problem

In my other note taking apps (iA writer, Obsidian) an inline formula would be written as $\int_{-\infty}^\infty e^{ikx}\mathrm dx = 2\pi\delta(x)$ and a display formula would look the same but with two dollar signs.

Now, according to the docs, and to the answer to this question, I can get an inline equation like eikxdx=2πδ(x)_{-}e{ikx}dx = 2(x) by enclosing the formula in double dollar signs inline, and a display equation

eikxdx=2πδ(x)

by spanning that command on several lines. This is ok, i could write a script to convert my iA writer and Obsidian notes to this formatting, but it is a bit annoying nevertheless.

Typesetting problem

These formulas look weirdly angular, compared to how they look in iA writer, Obsidian, or most default LaTeX compilers. That formula, inline, renders as inline equation while the display version is

display equation

These were screenshots from iA writer, but it would look the same on Obsidian or in LaTeX.

For context, in maths and physics, italics an roman symbols are used to denote different things (for example, italic d will denote a variable, while roman d is often used for the exterior derivative operator.)

Note that in the video on the blot.im homepage, as well as the KaTeX homepage, the formulas look nice have the normal elegant look, so maybe this behaviour has something to do with some setting in the implementation of KaTeX on the site. The behaviour seems present in most templates.

Note also that the angularity does not come from the the \mathrm d command, even replacing it with mathrm{d} the formulas are angular.

The centering on the display equations wouldn’t be a bad thing.

By the way, this is how the formulas on the blog look on mobile

how it looks on mobile

clearky the formatting distinction between inline and display is lost there.

Another bug

Note that if i cannot show a code snippet (with backticks) for a maths command enclosed in double dollar signs, otherwise I get gibberish like this <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msubsup><mo>∫</mo><mrow><mo>−</mo><mi mathvariant="normal">∞</mi></mrow><mi mathvariant="normal">∞</mi></msubsup><msup><mi>e</mi><mrow><mi>i</mi><mi>k</mi><mi>x</mi></mrow></msup><mi mathvariant="normal">d</mi><mi>x</mi><mo>=</mo><mn>2</mn><mi>π</mi><mi>δ</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\int_{-\infty}^\infty e^{ikx}\mathrm dx = 2\pi\delta(x)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.2734em;vertical-align:-0.4142em;"></span><span class="mop"><span class="mop op-symbol small-op" style="margin-right:0.19445em;position:relative;top:-0.0006em;">∫</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8593em;"><span style="top:-2.3442em;margin-left:-0.1945em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">−</span><span class="mord mtight">∞</span></span></span></span><span style="top:-3.2579em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">∞</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.4142em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">e</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8491em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.03148em;">ik</span><span class="mord mathnormal mtight">x</span></span></span></span></span></span></span></span></span><span class="mord mathrm">d</span><span class="mord mathnormal">x</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">2</span><span class="mord mathnormal" style="margin-right:0.03588em;">π</span><span class="mord mathnormal" style="margin-right:0.03785em;">δ</span><span class="mopen">(</span><span class="mord mathnormal">x</span><span class="mclose">)</span></span></span></span>)

just checking if formula alignment works here too

2πδ(x)=eikxdx=eikxdx

update

as of 21 Nov, looks much better.

However, bug is still there, and the other specialised fonts come as RR, RR, RR gg instead of

special fonts

Nice!



Date
2022-11-19