amake / orgro

An Org Mode app for iOS and Android
https://orgro.org
GNU General Public License v3.0
480 stars 22 forks source link

LaTeX blocks with tags don't render correctly #42

Closed amake closed 3 years ago

amake commented 3 years ago

As reported in https://github.com/amake/orgro/issues/22#issuecomment-828373842, a LaTeX block with a tag (implied or otherwise) will render with the tag overlapping the main body:

\begin{equation}
a + b = c
\end{equation}

IMG_1927

amake commented 3 years ago

I think it's going to be quite hard to get this to work with all possible layout scenarios:

Prior to v1.18.0 the equation environment was simply dropped, so this was not an issue (the tag was suppressed). Suppressing the tag through some mechanism could be the best solution if people aren't wedded to the tag being shown.

amake commented 3 years ago

Things that are easy to do:

amake commented 3 years ago

@fountainer Can you comment on what you expect in terms of how tags should be presented?

fountainer commented 3 years ago

@fountainer Can you comment on what you expect in terms of how tags should be presented?

I personally don't care much about the tags. I prefer the solution that tags are removed. However, I also accept other solutions as long as they don't overlap with the formulas.

fountainer commented 3 years ago

Another option is to put tags on the left side of the formulas.

amake commented 3 years ago

I think I will go with

Show tags at a fixed offset from the right edge of the main content (not aligned to the right of the screen)

and if you don't want tags shown at all then you can use equation* instead of equation.

amake commented 3 years ago

This is addressed in v1.18.1, which is now available in Test Flight.

fountainer commented 3 years ago

The equation numbers are always one. Is it a bug? IMG_C2645E4E9BD0-1

amake commented 3 years ago

It's a limitation of the current implementation. Each block has its own context, and I don't know how to share the context such that the numbering could continue.

amake commented 3 years ago

~Actually it seems that it's a limitation of the rendering engine itself. If you want meaningful tags you need to specify the contents manually like \tag{foo}.~

This is wrong; KaTeX can correctly auto-number equations. I've opened https://github.com/amake/flutter_tex_js/issues/9 to track this, but I don't think I'm going to be able to solve this any time soon.