Bug 139194 - Non-matching parentheses/brackets in math formulas
Summary: Non-matching parentheses/brackets in math formulas
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:ooxml
Depends on:
Blocks: DOCX-Formula
  Show dependency treegraph
 
Reported: 2020-12-23 17:55 UTC by Bruno Grenet
Modified: 2023-04-25 14:38 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
.docx file with 3 unrendered formulas (9.64 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-12-28 12:18 UTC, Bruno Grenet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno Grenet 2020-12-23 17:55:48 UTC
Description:
The formula editor only accepts matching parentheses, or matching square brackets. Examples of formulas that are not understood follow. The first ones are natural (two different ways of denoting the interval from 1 included to 2 excluded). The last one is less natural (why put these curly braces around a closing parenthesis?) but occurs while translating from say markdown using pandoc. In any case, I do not see a good reason for refusing this formula.

[1, 2[

[1, 2) 

(n/2{)}^2 

Steps to Reproduce:
1. Open the formula editor
2. Enter any of the above formulas, say "[1, 2[", in the input area


Actual Results:
The output is "¿"

Expected Results:
The output should be "[1, 2[", typeset as is typeset for instance [1, 2].


Reproducible: Always


User Profile Reset: No



Additional Info:
Version : 6.4.6.2
Build ID : 1:6.4.6-0ubuntu0.20.04.1
Threads CPU : 4; OS : Linux 5.4; UI Render : par défaut; VCL: gtk3; 
Locale : fr-FR (fr_FR.UTF-8); Langue IHM : fr-FR
Calc: threaded
Comment 1 V Stuart Foote 2020-12-23 20:54:24 UTC
The StarMath syntax used requires the closing brackets. If you need them as literals use quotes.
Comment 2 Ming Hua 2020-12-23 21:08:35 UTC
(In reply to V Stuart Foote from comment #1)
> The StarMath syntax used requires the closing brackets. If you need them as
> literals use quotes.
To elaborate, either

\[ a, b \)

or

"[" a, b ")"

would give you the result you want.
Comment 3 Bruno Grenet 2020-12-24 11:29:55 UTC
Of course, I should have described the real situation... I simplified it too much apparently, but thanks for your comments that show that the problem I encountered is not where I thought.

The formulas I presented are actually in some .docx documents, that display correctly on Microsoft Word, but not in Libreoffice. When I open the .docx document, the formulas like "[0,1[" or "[0,1)" are not displayed and replaced by ¿ indicating an error. If I inspect each formula, I see that their description is "[ 0 , 1 [" and "[ 0 , 1 )" which are not valid StarMath formulas according to your comments.

So it seems that the difficulty is the way Libreoffice interprets math formulas in .docx documents.

[I did not reopen the bug, because it may be a better idea to open a new bug with better explanations. Let me know what you think is the best.]
Comment 4 Ming Hua 2020-12-27 19:38:06 UTC
(In reply to Bruno Grenet from comment #3)
> The formulas I presented are actually in some .docx documents, that display
> correctly on Microsoft Word, but not in Libreoffice. When I open the .docx
> document, the formulas like "[0,1[" or "[0,1)" are not displayed and
> replaced by ¿ indicating an error. If I inspect each formula, I see that
> their description is "[ 0 , 1 [" and "[ 0 , 1 )" which are not valid
> StarMath formulas according to your comments.
> 
> So it seems that the difficulty is the way Libreoffice interprets math
> formulas in .docx documents.
Yes, that would indeed be a bug.

> [I did not reopen the bug, because it may be a better idea to open a new bug
> with better explanations. Let me know what you think is the best.]
Stuart hasn't replied yet (holiday and all that), so I'll just give my opinion as an inexperienced QA member -- either reopening this bug or submitting a new bug is fine, but make sure to attach the problematic .docx document (make sure to remove private and sensitive information first, see https://wiki.documentfoundation.org/QA/Bugzilla/Sanitizing_Files_Before_Submission) so that other people can reproduce the bug.
Comment 5 V Stuart Foote 2020-12-27 20:10:07 UTC
Attach OOXML .docx with valid MS Formula editor formulas that are not filter imported to LO.
Comment 6 Bruno Grenet 2020-12-28 12:18:40 UTC
Created attachment 168529 [details]
.docx file with 3 unrendered formulas

I've added an minimal example with three not rendered formulas, namely "[0, 1[", "[0, 1)" and "(x/2{)}^{n}".
Comment 7 V Stuart Foote 2020-12-28 15:59:57 UTC
OK, so this seems a legitimate import filter issue against OOXML OMML.
Comment 8 QA Administrators 2022-12-29 03:30:10 UTC Comment hidden (obsolete)
Comment 9 Bruno Grenet 2022-12-30 19:53:14 UTC
I confirm that the bug is still present with the most recent downloadable version of Libreoffice. Tested with the following configuration:

Version: 7.4.3.2 / LibreOffice Community
Build ID: 1048a8393ae2eeec98dff31b5c133c5f1d08b890
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Calc: threaded