MATH: newline within sqrt markup issue

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

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.