So I want to have KaTeX inline formulas like with MathJax.
But so far I've found only render()
function which "draws" a string to an element.
And I need to modify a part of a text node in DOM.
I really couldn't find how to do this with KaTeX. Does it have such functionality?
MathJax could do this.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
As of early 2020, it seems that KaTeX 0.11.1 supports inline maths without using the "hack" in the answer by Vincent. The single dollar delimiters
$ ... $
do not work but the escaped brackets\( ... \)
instead do, as in the following minimal code and snippet:After some tests, I couldn't make dollar delimiters
$ ... $
work but the brackets\( ... \)
here working by default are an update respect to version 0.7.1 of KaTeX (anyway still available).render can take an extra third argument (default is false) to select inline displaymode:
Is this what you are looking for?
Yes, you can render all
$
-delimited formulas inline using KaTeX's auto-render extension. Per the documentation on that page,$
is not one of the default delimiters so you'll need to set it when you callrenderMathInElement()
and setdisplay
tofalse
, which renders inline. Below is one example and another from KaTeX can be found here.Note that
\\
in the JavaScript corresponds to\
in the HTML.