How to fix Math formula bad output

Is there any config that makes LibreOffice math formulas look good like the ones what we get with MathType ?

Version: 7.5.0.3 (X86_64) / LibreOffice Community
Build ID: 50(Build:3)
CPU threads: 2; OS: Linux 6.1; UI render: default; VCL: kf5 (cairo+xcb)
Locale: en-US (en_US.UTF-8); UI: en-US
7.5.0-1
Calc: threaded

Operating System: Manjaro Linux
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8
Kernel Version: 6.1.11-1-MANJARO (64-bit)
Graphics Platform: X11

It is not bad, it is different to what you want. You just need the font used by MathType and change the fonts in Format > Fonts

See Math Help Fonts

1 Like

This a subjective request. To make it objective, describe which element is bad: font face, spacing, size, …? Remember that good or bad is as diverse as there are users.

1 Like

Changing it to another font makes the output much worse. For example using STIX Two Math font

You still don’t tell us what is “bad”. The main difference I see is the vertical distance between the fraction bar and the square root. This distance can be adjusted in Format>Spacing, category Fractions. Position of exponent can be adjusted too. Explore and experiment the various items in menu Format.

I wouldn’t trust fonts with “Math” in their name. They are probably descendants of pre-Unicode fonts (256-character sets). They were used to draw the various operators. This is done now either graphically or with very specialised fonts like OpenSymbol. Prefer more standard fonts for variables and functions.

For example, take this expression:

Look at the bad kerning of function name ‘f’ with its parentheses, the horrible ‘sqrt’ symbol (the intersection is really visible), the bad exponent position (too far from ‘e’) and its bad scale, the content of ‘sqrt’ suffers from bad kerning, the exponent inside the exponent is too small, and the most horrible thing is that default font which is not suited for Math expressions, and if I try to change it the result becomes much worse.

Look how it should really look:

With MathType:

With LaTeX:

Both are not looking good, neither the default nor the new font.

The image attached to the question showed two versions of an expression where I judged the right one to be extremely ugly (partly due to the scalable parentheses and excessive font weight) while the (less rich) left one was ok for me. The questioner seemed to judge differently, but I still didn’t find where he (f/m) stated this explicitly. What use in discussing good / bad / worse on this level of willfulness in a LibreOffice Q&A site?
When Donald E. Knuth wasn’t satisfied with the software of the time concerning typesetting and formula rendering he developed TEX. Despite his extreme demands for quality and aesthetic harmony, not all potential users seem to follow his judgment. There are not only the “small” technical problems, due to which sometimes two strokes do not join exactly. And I surely wasn’t satisfied with MathType.
Our questioner should perhaps try the Extension TexMath.
(And this still ignores the related aesthetic judgement by people loving Devanagari or Arabic scripts…)

Math editing is a key component in any office suite, even default Microsoft math editor seems to do a much better job, while LibreOffice Math is abandoned. TexMaths has a serious vertical alignment problem which I reported in 2020 and was refused due to lack of technical solution.

I tried to improve formula rendering by playing with various parameters in Format menu.

image

I added spacing to separate the exponential function from the fraction and the sigma from the square root. I enlarged slightly the fraction bar(s) and extended the horizontal bar of the radical.

Font size for the exponential argument was reduced.

However all these adjustments have limits as the parameters act globally on the whole formula, not on selected elements. Math has not seen development for years, shame.

Ah, I also chose font TeX Gyre Termes.

PS: I have not added spaces around the equal sign.

LibreOffice Math editor is not up to edit any important math document, and I’m sure if those default parameters are kept while editing, the final document will surely be refused by any math supervisor.

I used to think so, not as an author of important mathematical writings, but as a teacher and system administrator concerned about acceptance of FLOSS software. Unfortunately, the development of Math has nevertheless not progressed. Later I even once offered up to 500EUR for significant improvements, but got no response. So I do not represent a “blind” point of view. However, I do not like the matter-of-factness with which “good” and “bad” are used here. And whoever strives for full harmony as an editor of mathematical printed matter cannot possibly specify the requirements precisely enough. He (f/m) must specify the software together with all settings.

Translated with the help of www.DeepL.com/Translator (free version)

@medmedin2014 filed BZ issue tdf#153643 which was invalidated as not actionable. However, the state of issues against the LibreOffice ODF Formula editor (for inline OLE or stand-alone) can be found on the tdf#39750 META for the Formula Editor.

1 Like

My take

The Math module in LibreOffice is sufficient for most of my needs. I find the inconsistent case of predefined macros (greek letters, specifically) annoying. Also, sometimes the output is not satisfying, and I recognize that other users work towards higher standards than myself.

For the sample illustrated, I chose font Georgia for variables and have the code

f(x)={ 1 over {%Sigma sqrt {2 %pi}}} e^{size*0.5 -{(%chi - %my)^2 over {2 %Sigma ^2}} }

which gives the output

Where @ajlittoz adjusted spacing in settings, I use inline spacing and size for similar outcome.

For me this is OK. Finer adjustments to spacing may be available, but makes the code progressively convoluted.

Admittedly you have better control of the output with LaTeX (perhaps even more convoluted code, but only slightly) and MathType (which needs MS Windows compatible platform and requires payment).

As a builtin tool for specialised output, in a free general purpose office suite, I think Math does a decent job.

How to fix

First, see whether actual output (pdf export or print) is better than what you see on screen while you edit the formula. The rendering “on the fly” may use shortcuts that leave the artifacts and shortcomings you have observed, and finalized rendering may be better (or not).

Failing that, if you need MathType/LaTeX class output integrated into LibreOffice apps, use TeXMath. If on Windows (possibly also on Linux with WINE), MathType server is a possible alternate solution.

2 Likes