Does Writer use Mathematical Markup Language (MathML) to represent equations?

I notice that webpages use Mathematical Markup Language (MathML) to represent equations and other mathematical symbols.

I was just curious if Libre Office Writer does the same because when I create an odt file from other files such as .tex or .html, the vec command of tex is translated as a rightarrow when making the odt file, but the html file gets it right. My html files with math look good and when I inspect the source, they ARE editable, they are not graphic images - they are xhtml scripts. So I wonder should I look into the converters I’m using? Do the converters misunderstand what hints to give to the odt format or is it the odt format that needs to be tweaked.

I almost have a perfect conversion of .tex to html to odt/doc/docx but for the vectors being translated improperly, after the html stage, at which point they look nice. So I need to hand edit the vectors and when I do, the vector displays, but it displays very tiny. And I don’t know how to edit it. The vectors display pretty nicely at the html stage of the document conversion.

I know many have advised against it, but there are those of us who can almost do it. My converted documents are nice looking, it’s just that they turn to junk when I convert them to odt.

I have not yet installed Microsoft Word to see if I can just open an html file and save it as a .doc. I would have to order a copy of MS Office from ebay or some place.

Anyway, just curious if Libre Office has mover, etc… keywords in its vocabulary of markup that it uses. The Mathematical Markup Language is not half-bad.

I use the below method but the pandoc part of it does NOT work for me so I skip that part.

  1. Use htlatex to produce HTML code, with the following options:

htlatex document.tex “xhtml,mathml” " -cunihtf -utf8"

  1. Convert the html with pandoc:

pandoc -s document.html -o document.docx

I don’t think it’s foolhardy to demand that one document type be translated into another. If Word and Writer cannot write proper equations, then the capability should be added. I found it hard to use the Math OLE app of Writer to edit and enter equations. Perhaps there is stuff still being developed.

But there is nothing wrong with investigating converting documents.

And there is nothing wrong with using html to represent a document to be printed. The HTML file just needs the right “formatting of structure”. HTML is not a format anyhow language but the output CAN be adjusted for different purposes, including for display in a book or article. I have already proven it.

Before responding here, it may be useful to see what suggestions the OP has already received for similar tasks in the Apache forum, to establish a “starting point”:
Looking for html to doc or odt converter
How to convert .tex files to .doc

3 Likes

Are you convinced that for your attitude you’ll receive good karma in form of other people striving to help you here on this site?

4 Likes

I’m not asking people to strive - if it takes a strive, then do it only if you enjoy the process of discovery and the increased knowledge it gives you. I don’t hold it against anyone if they can’t answer the question. But I hold it against someone, when they try to ridicule me for asking the question. I haven’t really even gotten deep with my questions, they are pretty elementary. I don’t put someone down who asks a good question, but on Apache, they put me down because I (me, myself) was ABLE to answer the question and answered. I don’t need the childish envy, that’s all. If you can’t answer things, be humble.

But John_Ha on Apache is asking for troubles by making a long list of the questions I asked and comments I made. There are some serious bugs in Libre Office Writer - I haven’t looked at the source code because I’m very busy with other things and I already have to manage other coding projects which I’m behind on, so I hope to get a little bit ahead by querying others.

But I don’t make a big deal if someone doesn’t know something or experiments with something. I can tell that there are serious problems with the markup in Libre Office Writer - it’s not even close to as good as even html is. But maybe it’s just a bug and not a design error. I asked this question in order to try to distinguish between the two as the markup in HTML is pretty decent. For all I know, maybe Writer has the better markup save for a bug or two, so I just want to know because if it does NOT have good equations and vectors, I will have to use latex to write the book as I don’t have any other word processors available and I DO think tex’s documents look good, and I’ve at least done a couple latex documents. I’ve only used Libre Office Writer in the past to do pdf editing. It was painstaking due to margin issues but it solved some big problems in my personal life. But it was difficult to use due to the text fields overlapping into the margins. But I realize that it’s OpenSource software and needs people to help make it better. I occasionally help on Github with development.

The Math Guide is a free download at English documentation | LibreOffice Documentation - LibreOffice User Guides

Extensions for LibreOffice including the word LaTex can be found at Extensions » Extensions

I have found that inserting a one page pdf as OLE in Writer works well. A portion only can be used by double-clicking and adjusting sliders for position and handles for cropping.

That would be Draw, not Writer. The same fonts must be installed in the system reading the pdf for them not to be substituted by a different font with probably different metrics.

I don’t own a forum.

What I pointed to was not posing as intelligence. It was knowledge. There is a difference. If you were honest about getting an answer, you would be happy to not having to go through the basics once more (and so would the helpers around here). If you are trolling, you would of course want to reveal as little as possible.

You have just proven yourself.

That level of respect is mutual, I promise.

I look forward to that. The evidence is clear.

Trolling? Well, they say “it takes one to know one”. Enjoy your ride!
By the way: To stop, I would first have to start. Please point me to your forums (if you have any), and I will be happy to oblige. Or not.

Consider this a troll call.

And if you intend to get answer, be also humble instead of adopting an Asperger-like tone and behaviour.

Mr. SuperiorMind, you’re welcome to improve the Math formula description language as this component lags a lot behind the progress made in other components (Writer, Calc, Draw, Impress). Eventually, create a specification for switching the MathML, provided it brings the same expressiveness as the present language. It must not break the existing creativity and offer at least the same possibilities (anyway, formulas will need to be rewritten).

Yes, but it does not cover all the needs for book writing for a simple reason: HTML has no notion of pages. The rest may de “decent” but printed documents are still locked to this page repartition. It follows that HTML semantics must be extended to encompass this notion of page.

2 Likes

I had been aware of this fact that you had pointed out, however, at the time, I simply reformatted the margins and kept grappling as I simply HAD to solve some document to send to the state for some COVID relief, so I didn’t take the time to check the fonts. I only NOW know that pdf files fonts can be checked up on with Ctrl-D command and then look at the list.

And yes, it’s Draw, not Writer, I had just forgotten.

I thank you for pointing out what my intuition had suspected would work - ie., to have the correct fonts. And I DO assume that the font-check will take place and the correct font substituted. I will check this some time - my homework to do, since I am the one who wants to know. It’s a really great thing if LibreOffice Draw CAN successfully import a pdf file without major formatting issues because all those textboxes are a bear to manage if the process doesn’t go smoothly. I realize I’m not an expert on Writer or Draw - I have only used them sporadically and to write 100 pages of a book that will need pdf file inclusions of one type or another.

I guess my HTML files are looking so good that I felt that the “pages” were ok, but I trust your opinion if you say that HTML has no concept of pages. For the sake of inclusion into my main document, I just need something that looks decent, and I now realize I cannot trust the current version of Libre Office Writer to handle math and vectors. I need better handling so I’m in a difficult situation, I might have to use latex, so I’ve already started a Latex document. But I was SO happy with Writer’s use of chapters and the table of contents looks SO nice. To redo it all in tex which has all the styles to master, is a bit of a job, although not that difficult. At least I’ve done one good document in Tex 3 years ago.

ODF uses MathML for formula objects. So a saved file with Math formula objects contains MathML in its file markup. However, the UI of LibreOffice uses an own language “StarMath 5.0”, so there are always conversions when using the UI. The file markup has the object in MathML and its annotation element LibreOffice transports is own language. Of cause, if such annotation is missing, LibreOffice can nevertheless read the formula object.

When working in the Math module, LibreOffice can export a formula object directly to MathML and can import MathML text via clipboard.

If you want text with formula objects directly usable in a browser, you can export a text document from Writer to XHTML. This XHTML contains the equations as MathML element.

4 Likes

I did NOT ask how to export formulas. I tried to import the above-pictured formula which contains correct MathML and it neither imports from a file nor the clipboard. The functionality you describe does not work.
What does importing from a file have to do with a saved file? Why would I want to save a file? You mean save a file from the program I’m exporting from?
I don’t know what kludges you are suggesting but I don’t use kludges in my engineering.
I am well aware of how the Libre Office Math editor works - it can save as ODF or MML file types. But a person doing math in another application doesn’t first do the math in the application he wants to import into - correct?
I don’t know who did the Attributes and Relations modules, but the vectors are drawn too close to the underlying variables and parts of the vectors become obfuscated. It takes a long time to write one vector equation. There are bugs. I should also add that the bug occurs when defining a vector NEXT to another variable.

I can see from this exported equation what the format is so I guess I need to try to change all of my imported formulas to that but I had thought that the Import process would do that, that’s all. And the bug of the adjacent variable might be a show-stopper unless I can figure a work-around. I’ll experiment for another day.
TestOfMML
Another issue is how it handles multiple formulas - I can’t keep going in the UI of the Math editor. It stops after 1 formula. I have to hit new formula.
The important thing I had wanted to test was can Libre Office represent the formulas - if it can, I can edit my odt files and perhaps use the files I had wanted to include. I can see that it CAN render the formulas and vectors so I will have to hand edit each formula and see if I can finish the document I have.
I now realize that the import and editing is HIGHLY sensitive to the font and perhaps the version of Libre Office. I get different results between LO Writer 5.2.7.2 and LO Writer 6.2.8.2. I will be forced to try it on 6.2.8.2 where I have Liberation font and simply a later version. This might cause problems but I’m willing to try to edit the document on another machine.
It’s a major bug: if you create an empty writer document, the formula displays with a nice-looking vector over the variables. But if you insert it into a document with other text surrounding it, the vectors get chopped into ugly, thin arrows. It’s either a bug or some very particular font issue. It’s a constant wrestling match to use the technique. And why is the GUI for editing the fonts in the equation disabled? But after I scroll some, the problem seems to go away so maybe there is hope? It’s just that adjacent variable issue in the Math Writer now. I’ll test it out again. Maybe I can find a solution. The problem is that the equations cannot be entered in the fashion that I want - with variables and operators near the vectors. As soon as you put more than one variable or operator near a vector, it doesn’t render properly. It’s a bug or design issue.

The equation is cropped.
EquationCropped
Below I will show what I was forced to do:
TestOfMML2
It’s too tedious to edit all of the equations and change them.
I have posted a bug to Bugzilla. I cannot have documents with errors in them.

The font I’m using which is Deja Vu Serif does NOT support Math apparently - I looked in the CTAN documentation where it said that.

Unless I’m wrong, Math, the formula editor, needs OpenSymbols font. Is it installed?

1 Like

I’ll check, I believe it IS installed. Usually, Computer Modern is a good math font. I’ll try once again, but it’s getting really tiring to try to get the vectors to display properly. And why limit it to only one font, like OpenSymbols? I’m willing to try but why the strange dialogs in the Math editor for setting the font differently for variables, functions, …, . Awfully cryptic not to just be able to highlight the math text and change it’s font as if it was regular text. The interface is hard to understand.

I tried OpenSymbol as the font - it doesn’t display anything at all. The font doesn’t even work.
I don’t see anything in the documentation that mentions a particular font. They use markup to do the equations, the font matters, but it should at least display in any font. The arrows on vectors are cut off if there are variables or operators next to the variable with the vector over it. It seems like a bug. The font might be part of the problem but I have to reinstall OpenSymbol, not sure why it doesn’t work.

If you mean OpenSymbol font, it doesn’t have any characters, it would be impossible to use it.

There is installed one font only what is similar to the name OpenSymbol on my Windows 10 x64; the name is : “opens___.ttf” And the Math editor of the LO works fine.

https://downloads.sourceforge.net/portableapps/LibreOfficePortable_7.4.3_fonts.zip

Fonts for LibreOffice are listed on this page, Fonts - The Document Foundation Wiki

If font is damaged you might be able to extract a copy from the installation file to replace it.