LaTeX forum ⇒ Math & ScienceHorizontal Spacing in aligned Equations

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Pratt_G
Posts: 3
Joined: Mon Sep 02, 2013 5:41 pm

Horizontal Spacing in aligned Equations

Postby Pratt_G » Mon Sep 02, 2013 6:05 pm

Hi,

can anyone please help me understand the following two issues?

  1. Why do I get non-uniform and inordinate spacing between the columns? The first summation is very close to "min" and the second summation is way too from the first summation.
  2. Is there any way to left-align the columns? I want the third columns to be aligned left.

  1. \documentclass[11 pt]{article}
  2. \usepackage {amsmath}
  3.  
  4. \begin{document}
  5. \begin{subequations}
  6. \begin{align}
  7. \min\limits_{\lambda} & \sum\limits_{k \in R} & (\sum\limits_{i=1}^{M} a_i \quad +\\
  8. & & \sum \limits_{j=1}^N b_j \quad + \quad \sum \limits_{j=1}^N c_j \quad + \\
  9. \end{align}
  10. \end{subequations}
  11. \end{document}


Thanks,
P
Last edited by localghost on Mon Sep 02, 2013 6:12 pm, edited 1 time in total.
Reason: Source code has to be tagged as such to keep a post clear and legible (see Board Rules).

Tags:

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Mon Sep 02, 2013 6:21 pm

The alignat environment is your friend.
  1. \documentclass[11pt]{article}
  2. \usepackage{mathtools} % loads »amsmath«
  3.  
  4. \begin{document}
  5. \begin{subequations}
  6. \begin{alignat}{2}
  7. \min\limits_{\lambda} & \sum\limits_{k\in R} & \Big(\sum\limits_{i=1}^{M} a_i \quad + \\
  8. & \sum \limits_{j=1}^N b_j \quad + \quad &\sum\limits_{j=1}^N c_j \quad +
  9. \end{alignat}
  10. \end{subequations}
  11. \end{document}

Since there seem to be going more elements into the equations, you might need to choose another number as parameter for the environment.


Further reading:



Best regards and welcome to the board
Thorsten
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

Pratt_G
Posts: 3
Joined: Mon Sep 02, 2013 5:41 pm

Postby Pratt_G » Tue Sep 03, 2013 6:13 am

Thanks. That worked. But in my general experience align and alignat have been very painful to use especially because their preset horizontal alignments. I prefer to use array instead, as it allows me to flexibly choose the alignment of individual columns. Now only if there was a way to use array under subequations environment.


Return to “Math & Science”

Who is online

Users browsing this forum: No registered users and 2 guests