Replies: 1 comment 1 reply
-
@tchaumeny (1) If you are calling a copy of KaTeX from your own server (which appears to be the case), you could modify the following where I'm assuming you're using a recent version of katex.min.js. Find the bit (it's around halfway down the katex.min.js script) that says Now whenever KaTeX makes a math element, the outer span will have the 2 classes, "katex" and "notranslate". This has a good chance of working because it appears the translator begins its task after page load and after the math is processed. But you would need to ensure that is the case. I would suggest loading your scripts such that the translator scripts aren't called until KaTeX is finished. The minus with this approach is that you would need to remember to make the tweak each time you updated your KaTeX version. (2) If you're using the CDN version of KaTeX (which doesn't appear to be the case), you could do a post-processing step as follows. Add this function to one of your scripts:
Then:
The advantage of this method is you don't have to remember to tweak the KaTeX core script when it updates. The disadvantage is it will probably slow down page rendering, since I notice the translator does do some work in the background as other content is loaded, and before the translated text is displayed. Regards |
Beta Was this translation helpful? Give feedback.
-
When I ask Google Translate to translate my blog from french to english (see here), things are messy because math formulas are translated: for instance "a" (variable name) is turned into "has".
Google proposes a way to deactivate translation by marking an HTML block with
class="notranslate"
(see https://developers.google.com/search/blog/2008/10/helping-you-break-language-barrier).Unfortunately, I couldn't find a way to indicate to Katex that all its HTML blocks should be generated using this additional class.
Is this something possible?
Beta Was this translation helpful? Give feedback.
All reactions