Bug 114493 - In Math Formula the spacing around operators, numbers, identifiers etc should be adjustable
Summary: In Math Formula the spacing around operators, numbers, identifiers etc should...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Formula-Editor
  Show dependency treegraph
 
Reported: 2017-12-16 08:05 UTC by Vladislav Ivanistsev
Modified: 2019-08-31 13:34 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladislav Ivanistsev 2017-12-16 08:05:50 UTC
Description:
Currently in the Math Formula menu (Format > Spacing) in Category Spacing it is possible to set a general spacing between all math object. However, there are different types of objects. E.g. operators (+, =), numbers (1, 2, 3) etc. The spacing around them should be adjustable in a separate way.

Steps to Reproduce:
1. In Formula editor type "f(2+2) = 4". Mark that the spacing around operators + and = too small.
3. Open Math Formula menu Format > Spacing.
4. Choose category Spacing.
5. Set spacing to 50%.

Actual Results:  
See that the spacing between all "f" and "(" is enormous. Spacing around operators + and = looks good.

Expected Results:
Spacing around operators + and = should be as it is, but the spacing between "f" and "(" should not be affected.


Reproducible: Always


User Profile Reset: No



Additional Info:
There should be different categories for different types of mathematical objects (operators, numbers, identifiers).


User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36 OPR/49.0.2725.56
Comment 1 Jean-Baptiste Faure 2017-12-18 20:33:20 UTC
(In reply to Vladislav Ivanistsev from comment #0)
[...]
> Mark that the spacing around operators + and = too small.

It's a matter of taste.

You can add small or normal spaces around + and = if you want :

code : f(2`+`2) `=` 4
or code : f(2~+~2) ~=~ 4

Best regards. JBF
Comment 2 Vladislav Ivanistsev 2017-12-18 22:32:54 UTC
Sure, one can use "`" or "~". 

Yet, take a look on the implementation in mathml. For the mo element there is an "lspace" and "rspace" parameters. Both depend on the form of an element -- prefix (eg "("), infix (eg "+") or postfix (eg ")".

Your solution is equivalent of adding manually mspace element in mathml. A more elegant solution rely of the https://www.w3.org/TR/mathml-for-css/#mo, where several types are defined:

mi	identifier
mn	number
mo	operator, fence or separator
mtext	text
mspace	space
ms	string literal

Using these types it is possible to define and redefine difference space values in a more flexible way than it is currently done in LO formula editor.

Herewith, padding is set only in the following cases:
mo[largeop="true"]
	{font-size:1.3em;
	vertical-align:-0.1ex;}
mo[form="infix"], * + mo
	{padding:0 0.3ex;}
mo[form="prefix"]
	{padding:0 0 0 0.5ex;}
mo[form="postfix"]
	{padding:0 0.5ex 0 0;}
mo[fence="true"], mo[separator="true"]
	{padding:0;}

I propose distinguishing fences and separators from other operators, and allow adjusting space around them in a separate way.
Comment 3 Jean-Baptiste Faure 2017-12-22 20:23:31 UTC
Hi Regina,

I think you are the right person to evaluate this enhancement request :-)
What do you think ?

Best regards. JBF
Comment 4 Regina Henschel 2017-12-22 21:49:56 UTC
This is a valid request. Unfortunately type setting of formulas are not strongly standardized. But the values in the operator dictionary are suitable as default in LibreOffice. https://www.w3.org/TR/MathML3/appendixc.html.

There exists some bugs about spacing, e.g. 66279, 107379, 104194. But they are not really duplicate. I think we should keep this issue for the spacing aspects in StarMath and the related UI. Of cause import from and export to MathML has to be implemented at the same time.
Comment 5 Jean-Baptiste Faure 2017-12-23 16:45:57 UTC
Thank you very much Regina for your answer. So setting as NEW.

Best regards. JBF