Conversation
supportIn 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?
Hi! Thank you for this issue report. Please try adding the following to your site’s stylesheet. It should work even for inline KaTeX. .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; }
Hi @beskhue Unfortunately above css did not solve the problem. This reply was modified 4 years, 8 months ago by Sharif Payenda .
Could you provide an example page? The fix worked in my tests, so there must be something going on.
Hi @beskhue Please visit following link. https://app-6128b891c1ac18b2a03403ae.closte.com/general/113323/
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
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; } This reply was modified 4 years, 8 months ago by Tom Churchman .
Thanks @beskhue Looks perfect. Regards
Hi! Thank you for this issue report. Please try adding the following to your site’s stylesheet. It should work even for inline KaTeX. .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; }
Hi @beskhue Unfortunately above css did not solve the problem. This reply was modified 4 years, 8 months ago by Sharif Payenda .
Could you provide an example page? The fix worked in my tests, so there must be something going on.
Hi @beskhue Please visit following link. https://app-6128b891c1ac18b2a03403ae.closte.com/general/113323/
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
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; } This reply was modified 4 years, 8 months ago by Tom Churchman .
Thanks @beskhue Looks perfect. Regards