parpalak / upmath.me

Markdown and LaTeX online editor - create text for web with equations and diagrams
https://upmath.me/
MIT License
323 stars 40 forks source link

Use single dollars for mathematics? #12

Closed jmhammond closed 3 years ago

jmhammond commented 5 years ago

Can the processor render mathematics within standard single-dollar tags? That way when we use the same markdown file with pandoc, it properly renders inline vs. display style mathematics?

parpalak commented 5 years ago

There are some reasons for that choise. Now the main question is what to do with backward compatibility.

jmhammond commented 5 years ago

~~Could you share the reasons? I know that $$ is not canonical LaTeX and is instead a holdover from TeX. https://tex.stackexchange.com/questions/503/why-is-preferable-to ~~

Edit: I don't really need to know the reasons. I'm starting to use upmath integration in Standard Notes and was just curious. But here's an idea that could solve my problem and not break current documents.

To maintain compatibility with the current implementation, could we include ( to enter inline math and ) to end math mode? This is LaTeX2e spec. For example,

( \sum_{n=1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6} )

Thanks!

On Sat, Jun 1, 2019, 4:30 PM Roman Parpalak notifications@github.com wrote:

There are some reasons for that choise. Now the main question is what to do with backward compatibility.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/parpalak/upmath.me/issues/12?email_source=notifications&email_token=AAAURKYMI6V32SFAQUXT3PDPYLTANA5CNFSM4HSAUNW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWXI5CY#issuecomment-497979019, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAURKYLRR7XKLEGI37O663PYLTANANCNFSM4HSAUNWQ .

parpalak commented 5 years ago

Well, I think it's possible, I'll consider this features for next releases. However, I assume Standard Notes uses a fork of the Upmath code, I have nothing in common with this product.

Anyway I'm going to explain the reasons. The core of the Upmath is a service that convert latex equations to SVG images. When an equation is passed, the service does not know if it comes from an inline context or a block context.

Long time ago I used codecogs.com for this purpose. It generates a block equation unless equation starts with \inline. (This is necessary in rare cases, for example, to reduce the height of a fraction added via \frac.) Then I've developed my own service but kept the syntax for compatibility.

So the $\frac{a}{b}$ would be completely equivalent to $$\inline\frac{a}{b}$$. And I’ve coded only the latter for simplicity. In addition, the delimiter in form of double dollars will hardly ever occur in the text of a page, so there will be no problems with escaping.

jmhammond commented 5 years ago

That makes sense. Thanks!

On Thu, Jun 6, 2019 at 5:03 PM Roman Parpalak notifications@github.com wrote:

Well, I think it's possible, I'll consider this features for next releases. However, I assume Standard Notes uses a fork of the Upmath code, I have nothing in common with this product.

Anyway I'm going to explain the reasons. The core of the Upmath is a service that convert latex equations to SVG images. When an equation is passed, the service does not know if it comes from an inline context or a block context.

Long time ago I used codecogs.com for this purpose. It generates a block equation unless equation starts with \inline. (This is necessary in rare cases, for example, to reduce the height of a fraction added via \frac.) Then I've developed my own service but kept the syntax for compatibility.

So the $\frac{a}{b}$ would be completely equivalent to $$\inline\frac{a}{b}$$. And I’ve coded only the latter for simplicity. In addition, the delimiter in form of double dollars will hardly ever occur in the text of a page, so there will be no problems with escaping.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/parpalak/upmath.me/issues/12?email_source=notifications&email_token=AAAURK3ZK4IJDFES3HCMNOLPZGCTJA5CNFSM4HSAUNW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXEJMDY#issuecomment-499684879, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAURK7CWDCAR65U7LYEQJTPZGCTJANCNFSM4HSAUNWQ .

parpalak commented 3 years ago

By the way, why do you use pandoc? Is it for generating PDF?

I've created printing styles for Upmath and now it's possible to use the standard browser print dialog and PDF printers.