[Solved] Formatting when aligning equations at the =

Discuss the formula editor
Post Reply
User avatar
22878
Banned
Posts: 27
Joined: Tue Jul 07, 2020 1:02 am

[Solved] Formatting when aligning equations at the =

Post by 22878 »

As you can see from the attached image, the numerator and denominator are shifted to the left of the fraction bars. Is there any way to fix this?

Image

Code: Select all

size 28 nospace { matrix{
 alignr nospace{int f(x)dx} # {}={} # alignl nospace{ 2 x^2 + 3 x - 1 } over {x^{1/3}}dx ##
 alignr {} # {}={} # alignl int left({ nospace{2 x^2} over {x^{1/3}} } + { nospace{3 x} over {x^{1/3}} } - { {1} over {x^{1/3}} }right)dx ##
 alignr {} # {}={} # alignl int (nospace{2 x^{5/3} + 3 x^{2/3} - x^{1/3}})dx ##
 alignr {} # {}={} # alignl 2 cdot { {3} over {8} } x^{8/3} + 3 cdot { {3} over {5} } x^{5/3} - 3 cdot { {3} over {2} } x^{2/3} + C ##
 alignr {} # {}={} # alignl { {3} over {4} } x^{8/3} + { {9} over {5} } x^{5/3} - { {3} over {2} } x^{2/3} + C} }
Last edited by robleyd on Sat Aug 01, 2020 8:17 am, edited 2 times in total.
Reason: Tagged ✓ [Solved] (see topic 102648); add green tick
OpenOffice 4.1.5 on Windows 10
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Issue with formatting when aligning equations at the =

Post by Zizi64 »

Your formula code applied in my LibreOffice 6.2.8:
Formula in LO.png
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
22878
Banned
Posts: 27
Joined: Tue Jul 07, 2020 1:02 am

Re: Issue with formatting when aligning equations at the =

Post by 22878 »

Zizi64 wrote:Your formula code applied in my LibreOffice 6.2.8:
Formula in LO.png
Do you see how the numerators and denominators in the fractions are shifted to the left side of the fraction bar instead of being centered? That's what I'm trying to fix.
OpenOffice 4.1.5 on Windows 10
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Issue with formatting when aligning equations at the =

Post by Zizi64 »

Do you see how the numerators and denominators in the fractions are shifted to the left side of the fraction bar instead of being centered? That's what I'm trying to fix.
Ahhh... I meant the integral signs in your image above.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Issue with formatting when aligning equations at the =

Post by Zizi64 »

The modified first line seems to work as you expected (I put an "alignc" command into the denominator):

Code: Select all

alignr nospace{int f(x)dx} # {}={} # alignl nospace{ 2 x^2 + 3 x - 1 } over {alignc {x^{1/3}}}dx ##
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
MrProgrammer
Moderator
Posts: 4905
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Issue with formatting when aligning equations at the =

Post by MrProgrammer »

As formatted with OpenOffice 4.1.7 on Mac OS 10.14.6
As formatted with OpenOffice 4.1.7 on Mac OS 10.14.6
Use Format → Alignment → Centered then
size 28 {
   int f(x)dx 
   stack { ~=~ int {
                  {2 x^2 + 3 x - 1} over {x^{1/3}}
                } dx ~~~~~~~~~~~
         # ~=~ int { left ( 
                     { {2 x^2} over {x^{1/3}} } + 
                     { {3 x}   over {x^{1/3}} } -
                     { 1       over {x^{1/3}} }
               right ) } dx ~~~~~~
         # ~=~ int { 
                  {2 x^{5/3} + 3 x^{2/3} - x^-{1/3}}
               } dx ~~~~~
         # ~=~ 2 cdot { 3 over 8 } x^{8/3} + 
               3 cdot { 3 over 5 } x^{5/3} - 
                      { 3 over 2 } x^{2/3} + C
         # ~=~ { 3 over 4 } x^{8/3} +
               { 9 over 5 } x^{5/3} -
               { 3 over 2 } x^{2/3} + C ~~~~
         } 
}
It's more important to get the math right than spend hours fussing over tiny formatting details.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
22878
Banned
Posts: 27
Joined: Tue Jul 07, 2020 1:02 am

Re: Issue with formatting when aligning equations at the =

Post by 22878 »

MrProgrammer wrote:
Screen Shot 2020-07-18 at 14.15.47.png
Use Format → Alignment → Centered then
size 28 {
   int f(x)dx 
   stack { ~=~ int {
                  {2 x^2 + 3 x - 1} over {x^{1/3}}
                } dx ~~~~~~~~~~~
         # ~=~ int { left ( 
                     { {2 x^2} over {x^{1/3}} } + 
                     { {3 x}   over {x^{1/3}} } -
                     { 1       over {x^{1/3}} }
               right ) } dx ~~~~~~
         # ~=~ int { 
                  {2 x^{5/3} + 3 x^{2/3} - x^-{1/3}}
               } dx ~~~~~
         # ~=~ 2 cdot { 3 over 8 } x^{8/3} + 
               3 cdot { 3 over 5 } x^{5/3} - 
                      { 3 over 2 } x^{2/3} + C
         # ~=~ { 3 over 4 } x^{8/3} +
               { 9 over 5 } x^{5/3} -
               { 3 over 2 } x^{2/3} + C ~~~~
         } 
}
It's more important to get the math right than spend hours fussing over tiny formatting details.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
I am using format > alignment > centered, and your code doesn't line everything up, but it does make it so the numerators and denominators aren't shifted to the left. What are these ~? It seems you are just adding spaces to line things up? Also, I know there were mistakes in my first post, I fixed them in my image before you responded.

Note: I used the formatting recommended here: https://wiki.openoffice.org/w/images/3/ ... ide3.3.pdf to align the equations at the equals sign.
OpenOffice 4.1.5 on Windows 10
User avatar
22878
Banned
Posts: 27
Joined: Tue Jul 07, 2020 1:02 am

Re: Issue with formatting when aligning equations at the =

Post by 22878 »

Does anyone have a solution? I used the method recommended in the Math guide. I cannot understand why everything is shifted to the left.
OpenOffice 4.1.5 on Windows 10
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Issue with formatting when aligning equations at the =

Post by Zizi64 »

I cannot understand why everything is shifted to the left.
Because you have used the alignl (= align left) command inside the formula. Use the alignc (= align ceter) command for the relevant parts of the formula, as I pointed it above. Use the braces for the parts of the formla what you want to align center.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
22878
Banned
Posts: 27
Joined: Tue Jul 07, 2020 1:02 am

Re: [Solved] Formatting when aligning equations at the =

Post by 22878 »

Was my last reply deleted? I swear I responded and now it's not showing up.
OpenOffice 4.1.5 on Windows 10
User avatar
22878
Banned
Posts: 27
Joined: Tue Jul 07, 2020 1:02 am

Re: [Solved] Formatting when aligning equations at the =

Post by 22878 »

Zizi64 wrote:
But is there a way to align the left side to the top instead of in the middle as you can see in your screencap?
Your original formula works for me, when I modified it by the usage the "alignc" command in proper bracing.
This is amazing. This is the correct solution to my problem, because it uses the method recommended to line up equations at the equals sign, so you don't have to use the space hacks, which don't completely line up the equals signs, like this does, plus you need another stack or something to get the left half of the equation at the top with the other method. Bravo, Tibor.
Attachments
Formula.odt
(13.67 KiB) Downloaded 420 times
OpenOffice 4.1.5 on Windows 10
Post Reply