Bug 168619 - Request addition of a diagonalstrike attribute
Summary: Request addition of a diagonalstrike attribute
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
25.8.1.1 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Formula-Editor
  Show dependency treegraph
 
Reported: 2025-09-30 08:36 UTC by Lionel Martin
Modified: 2025-10-01 11:06 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
visual LateX example (5.10 KB, image/png)
2025-09-30 08:40 UTC, Lionel Martin
Details
Test document (13.22 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2025-10-01 08:37 UTC, Heiko Tietze
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lionel Martin 2025-09-30 08:36:11 UTC
Description:
Hello LibreOffice Development Team,

I would like to request a new feature for LibreOffice Math: the addition of a \cancel command, similar to the one available in LaTeX. This command would allow users to draw a diagonal line through a term in an equation to indicate simplification or cancellation.

Currently, there is no straightforward way to represent a crossed-out term, and adding this functionality would greatly improve the usability of LibreOffice Math for educational purposes.

Thank you for considering this feature request.

Best regards,
Lionel MARTIN

Actual Results:
Not available

Expected Results:
similar to overstrike {} but with an angle


Reproducible: Always


User Profile Reset: No

Additional Info:
None
Comment 1 Lionel Martin 2025-09-30 08:40:10 UTC
Created attachment 203051 [details]
visual LateX example
Comment 2 V Stuart Foote 2025-09-30 19:08:04 UTC
Seems reasonable, a diagonal strike through/cancellation would be a good addition to the Formula editor where the 'overstrike' now only provides a horizontal strike through.

Imagine the sm function name could follow the LaTeX with 'cancel', or maybe 'strikeout'.

Implementing would stroke be made part of nodes, or an annotation? And how to get it into ODF Formula. ODF extension needed?

Seems its not implemented directly in MathML, which requires annotation as a <menclose> element and notation as updiagonalstrike or downdiagonalstrike

We'd need to go both directions into and out of MathML so would need filter work as well.

@Regina, thoughts?
Comment 3 Regina Henschel 2025-09-30 20:52:05 UTC
The formula editor is bound to MathML. Thus we need a MathML markup for such "diagonal strike through".

Perhaps it could be done with element <menclose> using its attributes updiagonalstrike and downdiagonalstrike. I see it in the draft of MathML 4.0. [1]

But according to [2] it is not standard and not widely supported.

[1] https://w3c.github.io/mathml/#presm_menclose 
[2] https://developer.mozilla.org/en-US/docs/Web/MathML/Reference/Element/menclose
Comment 4 Heiko Tietze 2025-10-01 08:34:28 UTC
        <math>
            <menclose notation="updiagonalstrike">
                <mrow>
                    <mi> x </mi>
                    <mo> + </mo>
                    <mi> 1 </mi>
                </mrow>
            </menclose>
        </math>

indeed works not only in the browser but also for MSO365 by pasting this code into the equation. No idea how to clear or how to apply via the UI.

We have the Attributes category with, for example Line Trough resulting in "overstrike {x+1}", and could add the new attributes there.
Comment 5 Heiko Tietze 2025-10-01 08:37:04 UTC
Created attachment 203068 [details]
Test document

The updiagonalstrike attribute is stored in MSO365 but ignored when loaded in LibreOffice.
Comment 6 V Stuart Foote 2025-10-01 11:06:01 UTC
Hmm, so just checked and our export to MML2 already implements the <menclose> for horizontal strike for the 'overstrike' annotation with the "horizontalstrike" notation.  

Frederic Wang. had added this in back at the 4.2 release,  https://gerrit.libreoffice.org/c/core/+/4465

Might be an easyhack here to add the two diagonals?

=-=-=

Clip of an export from a 26.2 nightly

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
 <semantics>
  <menclose notation="horizontalstrike">
   <mrow>
    <mrow>
     <mi>E</mi>
     <mo stretchy="false">=</mo>
     <mi>m</mi>
    </mrow>
    <msup>
     <mi>c</mi>
     <mn>2</mn>
    </msup>
   </mrow>
  </menclose>
  <annotation encoding="StarMath 5.0">overstrike {E = m c^2}</annotation>
 </semantics>
</math>