Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support eqn (aka troff equation preprocessor) / libreoffice syntax #3261

Open
yota-code opened this issue Jul 17, 2024 · 3 comments
Open

Support eqn (aka troff equation preprocessor) / libreoffice syntax #3261

yota-code opened this issue Jul 17, 2024 · 3 comments

Comments

@yota-code
Copy link

Eqn is an equation preprocessor for the troff typesetting system.
Its syntax was used as a base for the libreoffice equation object.
Its syntax is clean, simple, an I would be please to be able to use it to input math formulas with mathjax

The syntax is described at least here : https://lists.gnu.org/archive/html/groff/2013-10/pdfTyBN2VWR1c.pdf
I don't know if libreoffice uses a dialect of it

This would nicely complete the availability of asciimath

Here an example of the libreoffice equation editor
libreoffice_math

@dpvc
Copy link
Member

dpvc commented Jul 22, 2024

I've marked this as a feature request, though we currently have no plans to implement an eqn input format. It would be possible for a third-party to create such an input jax for MathJax, if someone is interested in that.

You can export your LibreOffice expressions as MathML and use them in MathJax, if you are looking for a way to get your LibreOffice equations into a web document that uses MathJax. See the documentation from LibreOffice on that.

@yota-code
Copy link
Author

Thanks ! It was not much about importing libreoffice equations and more about using a clear and concise syntax :) I'll have a look at how to write new input plug-in. What is your "internal representation" based on ?

@dpvc
Copy link
Member

dpvc commented Jul 23, 2024

There is really no documentation about writing an input jax at the moment, so there are only the two examples of the TeX and MathML input jax. Neither is ideal for looking at as a starting point, as the TeX input jax is more complicated that what you would need, and the MathML one is not very parallel to the problem you are solving.

The internal representation is basically MathML, but as javascript objects (not DOM objects). There is a factory for creating them, where you can pass the type of node to create, its attributes, and its contents. The TeX input jax has a NodeUtil object that sits between the input jax and the internal format, which is left over from the fact that both of these were being developed at the same time, and we wanted to insulate the input jax from possible changes in the core MathML objects. It is really no longer necessary, as you can manipulate the MathML internals directly now.

There are two important pieces to the input jax. The first is a FindMath implementation that identifies the math within the document, producing a MathItem object for each one. In your case, you would be looking for .eq and .en strings on individual lines of the document, marking those as the delimiters. That could be based on the TeX input jax's FindMath.

The second is the parser for the text string that is between those delimiters, and is what produces the internal MathML format from the expression. This is the fun part. the TeX input jax implements a stack-based parser, but it is up to you how you handle the parsing for eqn.

that's a quick overview, but if you choose to pursue this, I might be able to give you a bit more to go on, after you have taken a look at the ts/core/InputJax.ts file and ts/input/tex.ts as starting points.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants