10

Update:

How do I align both the \sum signs and the = signs in the last two equations? I have updated the picture.

Original Question:

When I use the following code:

\begin{equation}
\begin{split}
    \label{eq:BILP}
    \mathpzc{I}^* & = \argmax_{\mathcal{I}} \; \left\{\sum_{i\in \mathcal{V}} \left(\theta_K \cdot \mathbb{I}_{i,j}(1,1) + \theta_K \cdot \mathbb{I}_{i,j}(0,0) \right) + \right.\\
    & \qquad  \qquad \quad \;\,\;\; \left. \sum_{i\in \mathcal{E}} \theta_{i_0} \cdot \mathbb{I}(x_i=0) + \theta_{i_1} \cdot \mathbb{I}(x_i=1) \right\}\\
    & \qquad \qquad  \text{s.t.} \; \; \sum_{x_j} \mathbb{I}_{i,j}(1,x_j)  =   \mathbb{I}(x_i=1) \\
    & \qquad \qquad  \qquad \sum_{x_i}\mathbb{I}_{i,j}(x_i,1) =   \mathbb{I}(x_j=1) \\
    & \qquad \qquad  \qquad \sum_{x_i,x_j}\mathbb{I}_{i,j}(x_i,x_j) = 1 \\
    %& \;\psi_{\mathrm{SAT}}\left(\mathbf{s}, \mathbf{l}\right) = 1
    \end{split}
    \end{equation}

I get the following (note the misalignment between the \sum signs, and the = signs highlighted under the red lines):

    enter image description here

How can I get them to align? (and avoid using all the artificial \qquad, \, \; spaces)

2
  • Are you maybe missing a pair of parentheses around the argument of the summation on the second line? Just curious.
    – Mico
    Apr 18, 2012 at 3:17
  • You are right @Mico. Thanks for pointing that out! Apr 18, 2012 at 15:28

1 Answer 1

12

Use the \bigg variety for bigger delimiters and align the sums. There's a subtlety for the last one, since the long subscript would shift it to the right and \mathclap from mathtools avoids it.

\documentclass{article}

\usepackage{amsmath,amssymb,mathtools}
\DeclareMathOperator*{\argmax}{argmax}
\begin{document}
\begin{equation}\label{eq:BILP}
\begin{split}
I^* = \argmax_{\mathcal{I}}\biggl\{
  & \sum_{i\in \mathcal{V}} (\theta_K \cdot \mathbb{I}_{i,j}(1,1) + \theta_K \cdot \mathbb{I}_{i,j}(0,0) ) + {}\\
  & \sum_{i\in \mathcal{E}} \theta_{i_0} \cdot \mathbb{I}(x_i=0) + \theta_{i_1} \cdot \mathbb{I}(x_i=1) \biggr\}\\
\text{s.t.}\quad
  & \sum_{x_j} \mathbb{I}_{i,j}(1,x_j)  = \mathbb{I}(x_i=1) \\
  & \sum_{x_i}\mathbb{I}_{i,j}(x_i,1) = \mathbb{I}(x_j=1) \\
  & \sum_{\mathclap{x_i,x_j}}\mathbb{I}_{i,j}(x_i,x_j) = 1 
\end{split}
\end{equation}
\end{document}

enter image description here

6
  • 1
    Using the "starred" version of the \DeclareMathoperator macro would under-set rather than side-set the \mathcal{I} element. :-)
    – Mico
    Apr 18, 2012 at 3:16
  • @Mico I didn't notice that; thanks.
    – egreg
    Apr 18, 2012 at 6:23
  • 1
    +1 mathtools loads amsmath so there's no need to load both explicitly
    – cmhughes
    Apr 18, 2012 at 8:34
  • 1
    The \mathclap part can also be done via the \smashoperator in mathtools
    – daleif
    Apr 18, 2012 at 8:57
  • Thanks @egreg. I'm wondering if there is a way of getting two things aligned vertically, the \sum signs and the = on the last three equations? Apr 18, 2012 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.