Bug 41739 - Math equation editor: "newline" fails after symbols
Summary: Math equation editor: "newline" fails after symbols
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version:
(earliest affected)
3.3.3 release
Hardware: All All
: low normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Formula-Editor
  Show dependency treegraph
 
Reported: 2011-10-12 20:18 UTC by Christopher M. Penalver
Modified: 2018-10-14 06:19 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
math_newline_issue.odt (29.29 KB, application/vnd.oasis.opendocument.text)
2011-10-12 20:18 UTC, Christopher M. Penalver
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher M. Penalver 2011-10-12 20:18:23 UTC
Created attachment 52281 [details]
math_newline_issue.odt

Downstream bug may be found at:
https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/281053

1) lsb_release -rd
Description: Ubuntu 11.10
Release: 11.10

2) apt-cache policy libreoffice-writer
libreoffice-writer:
  Installed: 1:3.4.3-3ubuntu2
  Candidate: 1:3.4.3-3ubuntu2
  Version table:
 *** 1:3.4.3-3ubuntu2 0
        500 http://us.archive.ubuntu.com/ubuntu/ oneiric/main i386 Packages
        100 /var/lib/dpkg/status

apt-cache policy libreoffice-math
libreoffice-math:
  Installed: 1:3.4.3-3ubuntu2
  Candidate: 1:3.4.3-3ubuntu2
  Version table:
 *** 1:3.4.3-3ubuntu2 0
        500 http://us.archive.ubuntu.com/ubuntu/ oneiric/main i386 Packages
        100 /var/lib/dpkg/status

3) What is expected to happen in LibreOffice Writer via the Terminal:

cd ~/Desktop && wget https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/281053/+attachment/2417117/+files/math_newline_issue.tar.gz && file-roller -h math_newline_issue.tar.gz && cd math_newline_issue && lowriter -nologo math_newline_issue.odt

is no upside down question marks are presented in the Math formulas.

4) What happens is the upside down question marks are present erroneously due to "newline" command. If "newline" is preceded or followed by some characters (as +, -, =, which are often needed), some error marks "¿" are obtained, and perhaps only a single line if displayed (it depends on the character and its relative position to "newline"). Examples :

a+b_ij = newline = c+d # single line; error mark
a+b_ij newline = c+d # two lines; missing "="; error mark
a+b_ij newline + c+d # correct behaviour !! The "+" sign does fine after newline...
a+b_ij + newline c+d # ... but not before: single line, error mark here
a+b_ij = newline c+d # single line, error mark. The "=" sign does bad whether after or before newline
Comment 1 Björn Michaelsen 2011-12-23 12:40:54 UTC Comment hidden (obsolete)
Comment 2 Christopher M. Penalver 2012-01-17 08:39:06 UTC
Reproducible in:
lsb_release -rd
Description: Ubuntu precise (development branch)
Release: 12.04

apt-cache policy libreoffice-impress
libreoffice-impress:
  Installed: 1:3.5.0~beta2-2ubuntu3
  Candidate: 1:3.5.0~beta2-2ubuntu3
  Version table:
 *** 1:3.5.0~beta2-2ubuntu3 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main i386 Packages
        100 /var/lib/dpkg/status
Comment 3 sasha.libreoffice 2012-02-04 06:04:52 UTC
reproduced in 3.6.0 master on Fedora 64 bit
3.4.3 and 3.5.0 beta on Windows XP 32 bit
Comment 4 Ivan Timofeev (retired) 2012-03-20 11:01:57 UTC
Math always tries to get a complete expression from a single line[1]. i.e. it needs something standing after "=" or "+" at the same line. So the following formula will work:

a+b_ij = {} newline {} = c+d

I think it is not a bug... Opinions?

[1] Formula parsing code: starmath/source/parse.cxx
Comment 5 Christopher M. Penalver 2012-03-21 04:37:35 UTC
Ivan Timofeev, thank you for taking a look at this. Using as a WORKAROUND:
{} newline {}

is acceptable in the all the cases mentioned in the Description. However, this report is about addressing how the use of newline does not have caveats as per the documentation:
http://help.libreoffice.org/Math/Format
http://help.libreoffice.org/Math/Entering_Line_Breaks

So, any of the original of the examples provided in the Description are valid and should work, but not all do.
It would be beneficial for newline be changed to work according to the expectation mentioned in the Description.
As well, having newline's idiosyncrasies documented in the meantime would be nice for others who fall down the same hole.
Comment 6 Ivan Timofeev (retired) 2012-03-21 11:40:50 UTC
(In reply to comment #5)
> Using as a WORKAROUND:
> {} newline {}
> is acceptable in the all the cases mentioned in the Description.

Not always "{} newline {}". You use {} when you need to provide the missing operand of a binary operator. For example,

a+b_ij newline = c+d # left-hand side is missing at the second line
a+b_ij newline {} = c+d # add {} - OK

a+b_ij = newline c+d # right-hand side is missing at the first line
a+b_ij = {} newline = c+d # add {} - OK

And from my point of view, the requirement - "provide all operands, otherwise there will be the flipped question mark" - is simply awful, it would be a great improvement to get rid of it. newline's behavior will be much more intuitive.
Comment 7 Not Assigned 2012-03-22 10:05:08 UTC
Ivan Timofeev committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f52138deee9e129d0566f06d1d2138b6b159d16a

fdo#41739: Math: do not skip "newline" on error
Comment 8 Ivan Timofeev (retired) 2012-03-23 08:14:04 UTC
So - newline works everywhere now. That should reduce the number of confused users. :)
Comment 9 sasha.libreoffice 2012-03-23 09:21:13 UTC
Thanks!
Comment 10 Not Assigned 2012-04-08 03:40:11 UTC
Ivan Timofeev committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=5f80687188db3a29fb0c3a5fe587aeeb3e13dccd

Revert "fdo#41739: Math: do not skip "newline" on error"
Comment 11 Ivan Timofeev (retired) 2012-04-08 03:56:30 UTC
Sorry, I have reverted the commit, it causes awful hangs. The newline token
needs to be handled in many other places, but I really fear to break the parser
again in a more subtle way.
Comment 12 Joel Madero 2014-11-06 20:53:10 UTC
As this bug is not assigned and there has been no activity by the original patch author for months I'm moving this back to NEW.
Comment 13 QA Administrators 2015-12-20 16:19:56 UTC Comment hidden (obsolete)
Comment 14 Shimi Chen 2016-10-31 09:12:27 UTC
Still occurs in 5.2.2.2.0 (Arch Linux x86-64).
Comment 15 QA Administrators 2017-11-01 22:12:16 UTC Comment hidden (obsolete)
Comment 16 Christopher M. Penalver 2017-11-02 00:08:04 UTC
Reproducible verbatim to the Description in:
Version: 5.4.3.1 (x64)
Build ID: 32c8895c6cae21571f364dbb059f419a743ee44d
CPU threads: 8; OS: Windows 6.19; UI render: GL; 
Locale: en-US (en_US); Calc: group
Windows 10 x64
Comment 17 Roman Kuznetsov 2018-07-13 19:33:51 UTC
IMHO, this is NOTABUG, because it's expected behavior of Formula editor (Math).

Regina, what do you think? Is there info about this behavior in ODF standart?