[Solved] Formatting really long formula!

Discuss the formula editor
Post Reply
actionmatt
Posts: 2
Joined: Tue Dec 11, 2007 4:06 am

[Solved] Formatting really long formula!

Post by actionmatt »

Currently doing my economics dissertation and I have a reallllly long formula (essentially expanded squares, for the purpose of completeness in deriving a model), and I'm having trouble formatting it. Essentially I have a really long bracket that needs to be "newline"ed but it doesn't seem to like it doing it in the middle of a bracket. If you copy the code into Math you'll see what I mean (?s all over the shop)! I've tried all sorts of positions of { }s but to no avail. It really doesn't like me interrupting a (.....). Any help greatly appreciated!
Matt

Formula:
E^CB L=1 over 2 %lambda E ({%alpha^2%DELTA m^2} + {%alpha^2 v^2} +{%alpha^2{%pi^e}^2}+{e^2}+{k^2} +{2%alpha^2%DELTA mv} + {2%alpha^2%DELTA m%pi^e} + {2%alpha%DELTA me} - {2%alpha%DELTA mk} newline alignl - {2%alpha^2 v%pi^e} + {2%alpha ve} - {2%alpha vk} -{2%alpha%pi^e e }+ {2%alpha%pi^e k -2ek}) + 1 over 2(%DELTA m^2 + v^2 +2%DELTA mv)
Last edited by Hagar Delest on Tue Jun 10, 2008 1:56 pm, edited 2 times in total.
Reason: tagged the thread as Solved.
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Formatting really long formula!

Post by acknak »

Is this closer to what you want? (I'm not 100% sure from your description)

Code: Select all

alignl
E^CB L =
  {alignc {size *0.8 1 over size *0.8 2}} %lambda E 
  \(
      %alpha^2%DELTA m^2 +
      %alpha^2 v^2 +
      %alpha^2{%pi^e}^2 +
      e^2 +
      k^2 +
      2%alpha^2%DELTA mv +
      2%alpha^2%DELTA m%pi^e +
      2%alpha%DELTA me
    newline
	   -
      2%alpha%DELTA mk -
      2%alpha^2 v%pi^e +
      2%alpha ve -
      2%alpha vk -
      2%alpha%pi^e e +
      2%alpha%pi^e k -2{ek}
  \)
  + {alignc {size *0.8 1 over size *0.8 2}} (%DELTA m^2 + v^2 +2%DELTA mv)
I think to use the newline in there, you have to somehow "turn off" the forced matching of the "()" brackets.

You could either use

left ( ...
right none newline left none
... right )

which ends up looking odd, I guess because the brackets are scaled--or, just make the brackets plain text by putting them in quotes. I can't see any problem with that, since they don't need to be scaled[*][/color].

For long formulas, it really helps to format your formula code. OOo Math ignores the white space, so you can lay it out however you want. I find it helps keep the math clear, as well as the syntactical structure of the formula. My old programming habits coming through I guess.

[*]PS: Hmm, the more I look at it, the brackets in quotes do look different than the real math brackets. On a whim, I tried prefixing the brackets with a backslash, and it works perfectly: you get a math bracket without the enforced pairing.

PPS: Edited once more to tweak the alignments. And the fractions.[/color]
Last edited by acknak on Tue Dec 11, 2007 8:23 pm, edited 1 time in total.
Reason: Changed some "{"s to "(" in the message text. Ack! Time for new glasses!
AOO4/LO5 • Linux • Fedora 23
actionmatt
Posts: 2
Joined: Tue Dec 11, 2007 4:06 am

Re: Formatting really long formula!

Post by actionmatt »

Legend, that's exactly what I wanted, and I promise in future I'll format my formulas better in the editor (it gets messier from here on in buy partially differentiating wrt deltaM, so I'll pretty much have to!). Thanks sooo much- means I won't have to have my dissertation look like a three year old wrote it! Cheers again!
Post Reply