halilozercan / compose-richtext

A collection of Compose libraries for advanced text formatting and alternative display types.
https://halilibo.com/compose-richtext
Apache License 2.0
749 stars 59 forks source link

Support LaTeX ? #70

Open phucynwa opened 2 years ago

phucynwa commented 2 years ago

I've just found this awesome library. I love your attempt.

I hope that compose-richtext will support LaTeX soon.

halilozercan commented 2 years ago

Rendering LaTeX would be an almost impossible task for any Android library alone. I don't think we will have that kind of ambitious goal anytime soon. If we are talking about a small subset of LaTeX like math equations, that'd be something we can look into. I mean not the parsing of a math syntax but providing necessary builders to write a generic math function.

buildFormula {
  pow(a, 2) + pow(b, 2) eq pow(c,2)
}

would render something like

image

phucynwa commented 2 years ago

@halilozercan Yes. I wish richtext-commonmark will support LaTeX syntax like Markwon library. I hope I can use this function soon. Thank you.

leon2017 commented 1 year ago

请问现在支持LaTex了吗

zayass commented 2 weeks ago

I am not sure about quality but here some existing libraries for parsing/rendering LaTeX on android

https://github.com/NanoMichael/AndroidLaTeXMath https://github.com/noties/jlatexmath-android

@halilozercan what do you think about some kind of plugins to parse/render embedded things.

I think it is better than inventing yet another math markup language. Because it is a pretty common and widely used scenario to embed LaTeX into markdown:

f{\left( a \right )} = \frac{1}{2 \pi i} \oint_{\gamma} \frac{f{\left( z \right )}}{z - a} dz

$$f{\left( a \right )} = \frac{1}{2 \pi i} \oint_{\gamma} \frac{f{\left( z \right )}}{z - a} dz$$