aligned math, with localized text justifications on the right #3229
Replies: 2 comments 3 replies
-
One natural way to implement this would be to use custom macros whose contents you could pass in to localize. For example: \begin{align*}
f(x) &= \cos(x)^2 & \text{\bydefinition} \\
&= \left(1 - \frac{x^2}2 + \frac{x^4}{4!} + o_0(x^5)\right)^2 & \text{\bylimit} \\
\end{align*} Then at runtime, once you know the desired language, you could call KaTeX with the desired macro definitions: renderMathInElement(document.body, {
macros: {
"\\bydefinition": "par d\\'efinition de la fonction $f$.",
"\\bylimit": "Via le d\\'eveloppement limit\\'e en $0$ du cosinus \\`a l'ordre $2$.",
}
}); |
Beta Was this translation helpful? Give feedback.
-
Yes, this works when KaTeX dynamically produce HTML from TeX String and a choice of locale I went another way (for performance reasons) : I store KaTeX MathML/Html rendering of TeX stuff in a database That way, this is really fast even when I display lots of maths on a page |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am trying to build a system with
aligned math on the right and ... localized html strings injected to the left as justification for the math steps
Is there a way to do that ?
at the moment, I am using htmlId{} in a \begin{align*}\end{align*} environment,
I render this into a string with katex
AND NEXT, at runtime, in the browser, I am tempering with the html and ids to inject html (for now)
and later compute display metrics and translate the math nodes downards so that the texts do not overlap
The point is : I compile math nodes once
And next I inject localized (french/english/german text in the html) in the html
Beta Was this translation helpful? Give feedback.
All reactions