Ask Your Question
0

MATH: newline within sqrt markup issue [closed]

asked 2015-04-10 14:44:34 +0100

Stephen_K gravatar image

updated 2020-08-20 00:32:32 +0100

Alex Kemp gravatar image

The following markup provides the correct result, except that it is too long for one line (and could be much longer):

T(x) = sqrt { [0.0005 - 0.00106 x + 0.001 x^2 + 0.00141 x^3]^2 - [0.000866 + 0.00106 x + 0.000707 x^2 + 0.00141 x^3]^2 }

However, inserting "newline" breaks it:

T(x) = sqrt {[0.0005 - 0.00106 x + 0.001 x^2 + 0.00141 x^3]^2 newline - [0.000866 + 0.00106 x + 0.000707 x^2 + 0.00141 x^3]^2}

How can I display the "contents" of a sqrt symbol over multiple lines? Preferably this would involve a scaled (enlarged) sqrt symbol, but would be acceptable if the symbol's overhead line extended over more than one line.

The root of the issue seems to be that Math doesn't like brackets or braces that contain newline - brackets seem to need to be on the same line. So there is a conflict between the need to contain the "contents" of the sqrt symbol within braces or brackets and the need the spread these "contents" over multiple lines.

LibreOffice Version: 4.2.7.2, Ubuntu 14.04 LTS 64

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-08-20 00:32:56.474633

1 Answer

Sort by » oldest newest most voted
1

answered 2015-04-11 00:49:43 +0100

Stephen_K gravatar image

updated 2015-04-12 02:12:41 +0100

Instead of using "newline", the key turns out to be the use of "matrix" after the square root symbol, combined with careful use of brackets. To prevent brackets breaking the markup, preceding appropriate pairs of brackets with the backslash "\" makes them visual only rather than structural.

Here are some examples showing different layouts that all work and use multiple lines after the sqrt symbol.

EDIT: reviewing my answer, I noticed that the backslashes did not survive the transition from the text entry box to the displayed text, so I have had to enclose them in double quotes thus: "\". If you try these examples in LO Math, delete the double quotes but leave the backslashes in place. I've also attached an odt file Multiple lines in sqrt.odt showing the correct markup.

alignc T(x) = sqrt {matrix {[0.0005 - 0.00106 x + 0.001 x^2 + 0.00141 x^3]^2 ## - [0.000866 + 0.00106 x + 0.000707 x^2 + 0.00141 x^3]^2 }}

alignc T(x) = sqrt {matrix { "\"[ 0.0005 - 0.00106 x + 0.001 x^2 ## + 0.00141 x^3 "\"] ^2 - [ 0.000866 + 0.00106 x + 0.000707 x^2 + 0.00141 x^3 ] ^2 }}

alignc T(x) = sqrt left[ matrix { "\"[ 0.0005 - 0.00106 x + 0.001 x^2 ## + 0.00141 x^3 "\"] ^2 - [ 0.000866 + 0.00106 x + 0.000707 x^2 + 0.00141 x^3 ] ^2 } right]

alignc T(x) = sqrt matrix { "\"[ 0.0005 - 0.00106 x + 0.001 x^2 ## + 0.00141 x^3 "\"] ^2 - "\"[ 0.000866 + 0.00106 x ## + 0.000707 x^2 + 0.00141 x^3 "\"] ^2 }

alignl T(x) = sqrt matrix { "\"[ 0.0005 - 0.00106 x + 0.001 x^2 ## + 0.00141 x^3 "\"] ^2 - "\"[ 0.000866 + 0.00106 x ## + 0.000707 x^2 + 0.00141 x^3 "\"] ^2 }

alignc T(x) = sqrt left[ matrix { "\"[ 0.0005 - 0.00106 x + 0.001 x^2 ## + 0.00141 x^3 "\"] ^2 - "\"[ 0.000866 + 0.00106 x ## + 0.000707 x^2 + 0.00141 x^3 "\"] ^2 }right]

I've answered my own question in the hope that it helps anyone googling in while suffering a headache - and heartache - from this issue.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-04-10 14:44:34 +0100

Seen: 733 times

Last updated: Apr 12 '15