Bug 162972 - add a %prime symbol (Unicode U+2032) to the sm Formula Symbols chart
Summary: add a %prime symbol (Unicode U+2032) to the sm Formula Symbols chart
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL: https://ask.libreoffice.org/t/how-to-...
Whiteboard: target:26.8.0
Keywords:
Depends on:
Blocks: Formula-Editor
  Show dependency treegraph
 
Reported: 2024-09-15 02:51 UTC by john
Modified: 2026-01-09 16:24 UTC (History)
4 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 john 2024-09-15 02:51:09 UTC
Description:
As discussed and documented and the following link, the rendering in LO of the 'prime' symbol is very unsatisfactory especially compared to latex.
https://ask.libreoffice.org/t/how-to-type-x-prime-and-subscript/100384/6

This leads to the messy hack of 

x^{ font fixed size*1.2{,}}_1

when it should be enough to write

x'_1
or
x^prime_1

I made a workaround by adding %prime to the symbol catalog, and it's a bit smoother/easier, but then requires a customisation of each LO install on which the document is being edited.

I think a good solution for the prime symbol is needed as part of the base installation of LO.






Steps to Reproduce:
1. add a formula x'_1 x^'_2
2. render 

Actual Results:
note that x'_1 renders with the subscript 1 too far to the right, while x^'_2 renders with the the prime too far up and too small.


Expected Results:
some standard syntax is needed in LO that gives a properly positioned prime symbol


Reproducible: Always


User Profile Reset: No

Additional Info:
As noted above, adding the symbol Ux2032 from MathJax Main (specifically this font -- it has an oversized prime that behaves correctly when used as a superscript)  solves this problem but is nasty because it requires customisation in order to achieve a commonly needed/standard feature.
Comment 1 V Stuart Foote 2024-09-15 12:09:06 UTC
Addition of a %prime to the 'Special' symbol set is reasonable. Would avoid users needing to repeatedly perform Unicode conversion of U+2032, or needing to make their own addition to the symbol set.

Not sure, but could we use a font other than 'OpenSymbol'? The U+2032 glyph in Liberation Serif looks better against default font for 'Variable' nodes.

Seems easy hackable.
Comment 2 john 2024-09-15 12:53:37 UTC
Just a couple that double prime and triple prime are also commonly used in certain contexts. It seems there could be pitfalls there to consider:

https://stackoverflow.com/questions/42723131/second-derivative-in-asciimath
Comment 3 V Stuart Foote 2024-09-15 13:52:01 UTC
(In reply to john from comment #2)
> Just a couple that double prime and triple prime are also commonly used in
> certain contexts. It seems there could be pitfalls there to consider:
>...

s/couple/comment/

Sure, suppose we could also provide %doubleprime against U+2033 and even %tripleprime against U+2034, but diminishing returns for common use.
Comment 4 Timur 2025-12-29 15:24:08 UTC
Note https://gerrit.libreoffice.org/c/core/+/196304.
Comment 5 Commit Notification 2026-01-07 21:19:36 UTC
Pranam Lashkari committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3998e5ca53afb3cebb8e9c33a27a3f9ca3f3ad19

tdf#162972 math: special treatment for apostrophe(') in MSO

It will be available in 26.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 john 2026-01-08 03:56:07 UTC
I saw in the changed code:

    if (sup == "'")
        return "{" + e + "} {" + sup + "}";

I'm wondering if this change will also work correctly for double prime and triple prime? The primary use-case for 'prime' is in derivatives, and users will typically need to use double prime and in some cases triple prime, so I'm hoping a different hack is not needed in that case now?
Comment 7 V Stuart Foote 2026-01-08 13:10:37 UTC
Remains => NEW 

The commit at 26.8 with https://gerrit.libreoffice.org/c/core/+/196304 does not really address issue here and in the Ask thread linked above.

The sm Symbols -> Special catalog needs to support the MathML named entities "′", "″" (DoublePrime), "‴" (TriplePrime). And would expect we would also want to extend the StarMath syntax for entry with %prime, %doubleprime, and %tripleprime.

OpenSymbol font already covers the U+2032, U+2033, U+2034 glyphs so no issues there. But does not have a U+2057 for the quad "⁗", but probably not needed.

Maybe the Symbols -> Special catalog and StarMath syntax should expand and to cover more/all of the MathML §8.4.2 Pseudo-scripts [1]?

@Regina, @Khaled what is your take?

=-ref-=
[1] https://www.w3.org/TR/mathml4/#chars_pseudo-scripts
Comment 8 Xisco Faulí 2026-01-09 14:34:09 UTC
My guess is that 3998e5ca53afb3cebb8e9c33a27a3f9ca3f3ad19 pointing to this ticket was a mistake and it fixes another issue. The fix is in ooxmlimport while this issue is about the Formula Smybols chart.
@Pranam, could you please confirm ?
Comment 9 Regina Henschel 2026-01-09 15:15:43 UTC
I see no option in the UI of the Microsoft Office Equation Editor for adding prime, double prime and triple prime. But I see it in the UI of an old version of MathType from Design Science that is used in SoftMaker, for example. The lack of UI in Microsoft Office results in lot of fancy workarounds. Thus it would be good, if LibreOffice provides build-in symbols for them.

I like the idea to extend the Symbols as such. The Gallery should be extended as well.

I'm not happy with the proposed keywords. I know that the proposal corresponds to the named characters of HTML 5 as can be found in https://dev.w3.org/html5/spec-LC/named-character-references.html. But they are not user friendly. And the distinction by character case is unfriendly for searching in file markup.

I would prefer something like "prime", "dblprime" and "triprime". That would be used as e.g. %dblprime in the command window, that is without semicolon. It would be well distinguished from HTML. Or if nearer to HTML is desired, as "prime", "dprime" and "tprime".

Does there exist a often used package for Latex, that introduces keywords for these characters? If yes, how are the characters named there?
Comment 10 V Stuart Foote 2026-01-09 16:24:59 UTC
(In reply to Regina Henschel from comment #9)

> ... 
> Does there exist a often used package for Latex, that introduces keywords
> for these characters? If yes, how are the characters named there?

Looks like the "unicode-math" package offers the same \prime, \dprime, \trprime named macros for some flavors of LaTeX.