Bug 158678 - Problem with vertical bar in MathML import
Summary: Problem with vertical bar in MathML import
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: bibisected, bisected, regression
Depends on:
Blocks: MathML
  Show dependency treegraph
Reported: 2023-12-13 07:41 UTC by Adam Ryczkowski
Modified: 2024-04-10 16:44 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:

Screenshot of the problem (30.42 KB, image/png)
2023-12-13 07:41 UTC, Adam Ryczkowski
The document where MathML does not render properly in the math object (7.86 KB, application/octet-stream)
2023-12-15 17:12 UTC, Adam Ryczkowski
The bug.odt is displayed in MS Word correctly (112.24 KB, image/png)
2023-12-15 17:16 UTC, Adam Ryczkowski
MathML file showing the problem on import (180 bytes, text/plain)
2023-12-19 06:35 UTC, Mike Kaganski

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Ryczkowski 2023-12-13 07:41:10 UTC
Created attachment 191402 [details]
Screenshot of the problem

Inserting a math object containing a formula with a vertical bar (absolute value symbol) results in a garbled output.

To reproduce:

1. Install LibreOffice Writer on Ubuntu 22.04 using the `ppa:libreoffice/ppa`.
2. Launch the writer.
3. Click on menu Insert->OLE Object->Formula Object...
4. Type the formula containing the `|` character, e.g. `f(x)=|x|`. 

I am aware that there is an alternate way of laying out formulas using the LibreOffice Math Formula product, which is not affected by this bug. In my case, it is not a viable walk around, because we use LibreOffice format for the automated generation of technical documentation generated in Pandoc. Here is the relevant Pandoc ticket: https://github.com/jgm/pandoc/issues/9235
Comment 1 Adam Ryczkowski 2023-12-13 09:14:46 UTC
Correction: The bug affects the Math Formula as well, so I see no viable walk around for Ubuntu 22.04.
Comment 2 Mike Kaganski 2023-12-13 11:27:13 UTC
This is not a bug.
In Math, symbol | is an alternative "boolean or" operator. Therefore, if you need to put this character as a literal, you either need to include it into quotation marks, like


or use other methods, mentioned in FAQ [1][2].

If you have a different problem of errors when *importing* MathML (which is apparently what your Pandoc issue is about), you should make your issue different, attaching the problematic MathML, and a screenshot of its intended render.

[1] https://wiki.documentfoundation.org/Faq/Math/003
[2] https://wiki.documentfoundation.org/Faq/Math/106
Comment 3 Adam Ryczkowski 2023-12-15 17:12:41 UTC
Created attachment 191444 [details]
The document where MathML does not render properly in the math object
Comment 4 Adam Ryczkowski 2023-12-15 17:14:25 UTC
We believe the escaping of the "|" character is not relevant here. 

Please consider why this valid MathML does not render properly in Writer.

<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">
<mo stretchy="true" form="prefix">|</mo><mi>x</mi><mo stretchy="true" form="postfix">|</mo>

I have uploaded an example document that demonstrates the issue.
Comment 5 Adam Ryczkowski 2023-12-15 17:16:34 UTC
Created attachment 191445 [details]
The bug.odt is displayed in MS Word correctly
Comment 6 Mike Kaganski 2023-12-19 06:35:03 UTC
Created attachment 191497 [details]
MathML file showing the problem on import
Comment 7 Mike Kaganski 2023-12-19 06:37:04 UTC
Opening attachment 191497 [details] in Math reproduces the problem.
The ODF file from attachment 191444 [details] is not relevant, because it's the artifact of the incorrect import. But indeed, there is an import problem here.
Comment 8 Mike Kaganski 2023-12-19 06:38:29 UTC
Note that the MML file may also be viewed in Firefox browser, to check the intended rendering.
Comment 9 Telesto 2023-12-19 11:51:17 UTC
Also in
Version: (x64) / LibreOffice Community
Build ID: a94b58277c7aeaa83ce14347cd0b8f7137969d03
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: default; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL

fine in
Version: (x64)
Build ID: 626ea4e62a3e5005fe9825923a1c0c5bdb61cc08
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: default; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL
Comment 10 raal 2023-12-21 17:16:32 UTC
This seems to have begun at the below commit in bibisect repository/OS linux-64-7.1.
Adding Cc: to Noel Grandin ; Could you possibly take a look at this one?
 ecf776e1a95b73bec9f9380fe87d274c7717dc8b is the first bad commit
commit ecf776e1a95b73bec9f9380fe87d274c7717dc8b
Author: Jenkins Build User <tdf@pollux.tdf>
Date:   Tue Sep 22 20:21:44 2020 +0200

    source 8c716704df4aaa83fcd198cc8d92cd3e1e542de9

98795: tdf#38885 Remove createTextFromNode | https://gerrit.libreoffice.org/c/core/+/98795