Bug 155358 - Render incomplete matrices with enclosing brackets while writing
Summary: Render incomplete matrices with enclosing brackets while writing
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
7.3.6.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Formula-Editor
  Show dependency treegraph
 
Reported: 2023-05-16 14:20 UTC by Klaus
Modified: 2023-07-04 08:34 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Enhancement request text with the equations visible as rendered / not rendered equation objects. (47.72 KB, application/vnd.oasis.opendocument.text)
2023-05-16 14:20 UTC, Klaus
Details
Enhancement request text with the equations visible as rendered / not rendered equation objects. (PDF) (37.00 KB, application/pdf)
2023-05-16 14:21 UTC, Klaus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Klaus 2023-05-16 14:20:01 UTC
Description:
______________________
1. PROBLEM DESCRIPTION

Currently, LibreOffice Math equations will not render incomplete parts. This is most painful when writing equations with large matrices, since the live-preview is effectively disabled until writing the matrix is finished.

For other structures, writing some scaffolding before filling in the contents can help, for instance writing

    left( right)

before filling in the contents between the parentheses. But for a matrix, writing

    left(matrix{
      m_1' E # 0 # 0 # 0 # dotsaxis ##
      0 # I_1' # 0 # 0 # dotsaxis ##
      0 # 0 # m_2 E
    }right)

still won't render, was matrices are only rendered when all rows have the same length.


________________________
2. SUGGESTED ENHANCEMENT

Instead it could be rendered as

    left(matrix{
      m_1' E # 0    # 0     # 0   # dotsaxis ##
      0      # I_1' # 0     # 0   # dotsaxis ##
      0      # 0    # m_2 E # <?> # <?>
    }right)

and something like

    left(matrix{
      m_1' E # 0    # 0     # 0   # dotsaxis ##
      0      # I_1' # 0     # 0   # dotsaxis ##
    }right)

could be rendered as either

    left(matrix{
      m_1' E # 0    # 0 # 0   # dotsaxis ##
      0      # I_1' # 0 # 0   # dotsaxis
    }right)

or

    left(matrix{
      m_1' E # 0    # 0     # 0   # dotsaxis ##
      0      # I_1' # 0     # 0   # dotsaxis ##
      <?>    # <?>  # <?>   # <?> # <?>
    }right)


________________________________________
3. WORKAROUND AND WHY IT IS INSUFFICIENT

This *can* be solved by preparing a scaffolding

    left(matrix{
        . # . # . # . # . # . ##
        . # . # . # . # . # . ##
        . # . # . # . # . # . ##
        . # . # . # . # . # . ##
        . # . # . # . # . # .
    }right)

but is very inconvenient, and doesn’t work if during writing it turns out that an additional column has to be added, especially in the middle. Additionally, creating such a large scaffolding structure breaks the flow of writing a lot more than a simpler construct like left( right).

The latter scaffoldings in many cases are even already supported as keyboard shortcuts, such as

    Shift+F10, B, H

to insert

    left( <?> right)

and select the <?> placeholder. No such thing exists for matrices, for which a whole wizard would be needed.


_______________________________________________
4. ADVANTAGE OF HANDLING SPECIAL CASE OF MATRIX

Similar issues arise for many other constructs. While eliminating the need for a "scaffolding first" style of writing equations would be desirable, it would results in unclear situations, especially when editing in the middle of an equation.

For instance,

    f(t) = sin(a +

could reasonably be rendered as

    f(t) = sin(a + <?>)

but when encountering

    f(t) = sin(a +   cos(c + d)

its not clear if rendering this as

    f(t) = sin(a + cos(c + d) )

would be a desirable change.

By contrast, filling up a matrix with <?> until it is a complete rectangular matrix affects only the rendering of one component of the equation, and will at worst result in shifting expression from one column to the next, when another column is added in the middle.



___________
ATTACHMENTS

The enhancement request text with the equations being rendered:
  * text_with_euqations.odt
  * text_with_euqations.pdt


Steps to Reproduce:
In LibreOffice Math, write 

    matrix{
       a # b # c ## 
       d # e ##
       f
    }

Actual Results:
Only a single ? is rendered, i.e. the matrix is not rendered at all effectively.

Expected Results:
Instead it could be rendered as if the user had written

In LibreOffice Math, write 

    matrix{
       a # b   # c   ## 
       d # e   # <?> ##
       f # <?> # <?>
    }


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Tested with:

Version: 7.5.1.2 (X86_64) / LibreOffice Community
Build ID: fcbaee479e84c6cd81291587d2ee68cba099e129
CPU threads: 12; OS: Linux 5.3; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF8); UI: en-US
Flatpak
Calc: threaded

Version: 7.3.6.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 12; OS: Linux 5.3; UI render: default; VCL: gtk3
Locale: de-AT (en_US.UTF8); UI: en-US
Calc: threaded
Comment 1 Klaus 2023-05-16 14:20:52 UTC
Created attachment 187332 [details]
Enhancement request text with the equations visible as rendered / not rendered equation objects.
Comment 2 Klaus 2023-05-16 14:21:02 UTC
Created attachment 187333 [details]
Enhancement request text with the equations visible as rendered / not rendered equation objects. (PDF)
Comment 3 Klaus 2023-05-16 14:35:00 UTC
Note: To some degree it is already happening, but with strange filling behavior. For instance, 

    = left( matrix{ 
         m_0 E    # 0        # dotsaxis
      ## 0        # M_1      # dotsdown
      ## dotsvert # dotsdown # 
      ## 0        # dotsaxis 
    }right)

is rendered as 

    (  m0 E    0     ...         )
    (  0       M1    ...    ...? )
    (  ...     ...   ?           )
Comment 4 Stéphane Guillou (stragu) 2023-05-31 10:12:50 UTC
Sounds like a sensible enhancement request to me.
Thank you for the detailed description.
Comment 5 V Stuart Foote 2023-05-31 15:00:42 UTC
Not clear this is valid.

When entering a matrix, it is applying the enclosing nodes for left | right stretchy bracketing that causes the matrix to not respond with partial entries. Leave the brackets out while building and matrix will render with place holders for missing elements.

e.g. build or paste just the matrix {} 

matrix{
      m_1' E # 0 # 0 # 0 # dotsaxis ##
      0 # I_1' # 0 # 0 # dotsaxis ##
      0 # 0 # m_2 E
    }

After the first ## line break the matrix has its n -  column count, pre enter the ## for each row to set the m - row count (they don't render yet). But each element will render as completed with its closing #. Complete entry of the matrix elements.

Only then add the brackets. 

Of course that is not the way folks write equations--but then LaTex is not any better.

Placing Formula Editor into the "experimental" and incomplete Visual mode (Tools -> Options -> Advanced "Enable experimental features") helps a little with entry. 

Point is the sm node logic facilitates layout and presentation--not standardized mathematics markup.

The entire UI and sm render engine needs rework. Doing it piecemeal for specific constructs doesn't move it along.  

Throwing to UX-advise for consideration of what really should be direction for the sm module.  Status quo does not facilitate efficiency of creating discrete OLE formulas (ODF Formulas .odf) nor input of in line formulas.  Needs some design attention.
Comment 6 Heiko Tietze 2023-06-05 14:11:04 UTC
(In reply to V Stuart Foote from comment #5)
> After the first ## line break the matrix has its n -  column count...

True only if not enclosed in "left( right)" brackets.

matrix {1#2## 3#4## 5#} => shows the matrix with an inverted question mark for the last item

left( matrix {1#2## 3#4## 5#} right) => shows just the inverted question mark until 6 is added as last item; there is no dummy filling for the next row (same happens with just [] around the matrix)

Sounds like an ordinary bug to me.
Comment 7 Klaus 2023-07-04 08:34:20 UTC
A case I didn't consider when first writing this ticket was the behavior when writing strictly left-to-write, i.e. not producing intermediate states like

    left( <?> right)

In this case, it becomes an issue that parentheses are not rendered before a matching closing parenthesis is input.


    INPUT                           RENDERED AS

    x = a                           x = a
    x = (a                          x = ¿
    x = left( a                     x = ¿
                                         a  b
    x = matrix{a # b ## c #         x =  c  ¿
    x = left(matrix{a # b ## c #    x = ¿


If this behavior were changed, left-to-right input of matrix expressions would be possible with preview. 

Note that this behavior applies also without the "left" keyword.