Support » Plugin: KaTeX » Incompatible with rtl languages

• Resolved Payenda

(@sharifpayendagmailcom)

In rtl pages katex renders equations from rtl direction and they will not be readable.
For instance f(x)=2x will be rendered 2x=f(x)
This is a simple example but for complex equations and expressions they are not even readable.
Is there any solution that katex does not obey site direction and always should render equations in ltr direction just like what mathjax is doing?

Viewing 7 replies - 1 through 7 (of 7 total)
• Plugin Author Thomas Churchman

(@beskhue)

Hi!

Thank you for this issue report.

.katex-eq {
direction: ltr;
}

This’ll work with <body dir="rtl">. Depending on how RTL is set on your page, you may have to be more persuasive:

.katex-eq {
direction: ltr !important;
}

(@sharifpayendagmailcom)

Hi @beskhue
Unfortunately above css did not solve the problem.

• This reply was modified 2 months, 3 weeks ago by Payenda.
Plugin Author Thomas Churchman

(@beskhue)

Could you provide an example page? The fix worked in my tests, so there must be something going on.

(@sharifpayendagmailcom)

Plugin Author Thomas Churchman

(@beskhue)

Hmm, I see. I played around a bit and found something that does work.

.katex-eq {
direction: ltr;
}

.katex-eq > .katex {
display: inline-block;
}

This works on your example page. I’m not sure why inline-block is required for the inline equations.

There is a somewhat related issue upstream, you might want to chime in there: https://github.com/KaTeX/KaTeX/issues/343

Plugin Author Thomas Churchman

(@beskhue)

Actually, this may be a bit more future-proof, if this plugin ever changes the element layout a bit:

.katex-eq {
direction: ltr;
}

.katex-eq[data-katex-display="false"] {
display: inline-block;
}