LaTeX forum ⇒ Math & ScienceHorizontal Spacing within aligned Equations Topic is solved

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
User avatar
Cham
Posts: 901
Joined: Sat Apr 02, 2011 4:06 pm

Horizontal Spacing within aligned Equations

Postby Cham » Sat Sep 07, 2013 6:20 pm

I'm having a spacing problem with the following minimal working code. The first four items aren't horizontally spaced enough and I don't know why.

  1. \documentclass[12pt]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{mathtools}
  4.  
  5. \begin{document}
  6. Test
  7.  
  8. \begin{equation}
  9. \begin{gathered}
  10. \begin{aligned}
  11. \tilde{A} &= {\Omega}^{2} \, A,
  12. &\tilde{B} &= {\Omega}^{- 2} \, B, \\[12pt]
  13. \tilde{\Phi} &= {\Omega}^{w} \, \Phi,
  14. &\tilde{\Psi} &= {\Omega}^{w} \, \Psi,
  15. \end{aligned} \\[12pt]
  16. \tilde{A}_{\mu_1 \, \ldots \, \mu_q}^{\lambda_1 \, \ldots \, \lambda_p} = {\Omega}^{w} \, A_{\mu_1 \, \ldots \, \mu_q}^{\lambda_1 \, \ldots \, \lambda_p}.
  17. \end{gathered}
  18. \end{equation}
  19. \end{document}


The aligned items should be spaced like in the align environment.

Any idea what is going on here?

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Mon Sep 09, 2013 6:39 pm

Would you be able to clarify what isn't aligned properly? Maybe by inserting comments directly inside the code or uploading a screen shot of the resulting PDF with little marks (done by Gimp or something similar).

Best regards
Johannes



PS: Remember to click on "Open in writeLaTeX" to see the same output that we see.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

User avatar
Cham
Posts: 901
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Mon Sep 09, 2013 9:34 pm

When you click on the "Open in writeLaTeX" button, you get a well compiled code. Except that the "A", "B", 'Phi" and "Psi" items are too close from each other (horizontally), compared to what we get in the usual align environment.

I think that the aligned environment should output the same horizontal spacing as the align environment.

Here's the output from the code above :
aligned.jpg
aligned.jpg (11.78 KiB) Viewed 18282 times


And here's the output from the code below (I'm not sure it's the proper way to do this, since I want a single equ. number for all the set of equations) :
align.jpg
align.jpg (11.82 KiB) Viewed 18282 times


  1. \documentclass[12pt]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{mathtools}
  4.  
  5. \begin{document}
  6. Test
  7. \begin{align}
  8. \tilde{A} &= {\Omega}^{2} \, A,
  9. &\tilde{B} &= {\Omega}^{- 2} \, B, \nonumber \\[12pt]
  10. \tilde{\Phi} &= {\Omega}^{w} \, \Phi,
  11. &\tilde{\Psi} &= {\Omega}^{w} \, \Psi,
  12. \end{align}
  13. \begin{equation*}
  14. \tilde{A}_{\mu_1 \, \ldots \, \mu_q}^{\lambda_1 \, \ldots \, \lambda_p} = {\Omega}^{w} \, A_{\mu_1 \, \ldots \, \mu_q}^{\lambda_1 \, \ldots \, \lambda_p}.
  15. \end{equation*}
  16. \end{document}

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Tue Sep 10, 2013 10:46 am

Cham wrote:the "A", "B", 'Phi" and "Psi" items are too close from each other (horizontally), compared to what we get in the usual align environment.


Why don't you just use align then? (Probably because of the equation numbers?) You could also simply add horizontal spacing by inserting a \quad (inserts 1em of space), \qquad (inserts 2em of space) or \hspace{<dim>} in one of the lines.

Cham wrote:I think that the aligned environment should output the same horizontal spacing as the align environment.


Well, the AMS which is maintaining amsmath seems to have a different opinion. The {aligned} environment is certainly not going to change since that would break lots of documents that rely upon its current behavior.

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

User avatar
Cham
Posts: 901
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Tue Sep 10, 2013 3:09 pm

Well, I already tried the \qquad spacing trick, but the equal signs aren't properly aligned anymore (within a gather environment). And apparently, the align environment can't be used inside a gather environment, or can it ?

Edit: I'm an incredibly stupid idiot! Adding the \qquad spacing in the items, inside the aligned environment solves the issue! :oops:


Return to “Math & Science”

Who is online

Users browsing this forum: No registered users and 5 guests