3
\usepackage{mathtools, amssymb, amsthm}
\begin{align}\label{eq1}
\sum_{n}\lambda^{n}(i)-\sum_{n}\lambda^{n}(j) \nonumber\\=\begin{cases}
    \lambda_{n},  &\text{if } n = i\\
    -\lambda_{n}, &\text{if } n = i\\
    0, &\text{otherwise}
    \end{cases} 
    \text{ }\forall i, j
\end{align}

First line of the equation must be left aligned (or at least adjustable, \hspace not working). \sum_{n}\lambda^{n}(i)-\sum_{n}\lambda^{n}(j) \nonumber then according to first line cases will be aligned. However, equation number should be at extreme right.

As per clarification request by @Mico The first pic from the answer.

enter image description here What I need is the following pic:

enter image description here

The alignment of the starting of the equation is preferably left (or adjustable)

3

I'm not sure what the proposed alignment should achieve, but here it is:

\documentclass[twocolumn]{article}
\usepackage{amsmath}

\begin{document}

\begin{itemize}

\item sample equation
\begin{equation}\label{eq1}
\hspace{\dimexpr\displaywidth-\linewidth}
\begin{aligned}[b]
\sum_{n}\lambda^{n}(i)
&-\sum_{n}\lambda^{n}(j)\\
&=\begin{cases}
  \lambda_{n},  & \text{if $n = i$}\\
  -\lambda_{n}, & \text{if $n = i$}\\
  0,            & \text{otherwise}
  \end{cases} 
  \quad\forall\, i, j
\end{aligned}
\hspace{10000pt minus 1fil}
\end{equation}

\item sample equation
\begin{equation}\label{eq2}
\begin{split}
\sum_{n}\lambda^{n}(i)
&-\sum_{n}\lambda^{n}(j)\\
&=\begin{cases}
  \lambda_{n},  & \text{if $n = i$}\\
  -\lambda_{n}, & \text{if $n = i$}\\
  0,            & \text{otherwise}
  \end{cases} 
  \quad\forall\, i, j
\end{split}
\end{equation}

\end{itemize}

\end{document}

enter image description here

3

You can use the fleqn environment, from nccmath. The distance from the left margin can be set as an optional argument. Incidentally, I replaced the cases environment with cases* for simpler typing of the text part:

\documentclass{article}
\usepackage{mathtools, nccmath}
\usepackage{eqparbox} 
\newcommand\eqmathbox[2][]{\eqmakebox[#1][r]{$ #2 $}}
\usepackage[showframe]{geometry}

\begin{document}

\begin{itemize}
\item Sample equation: 
\begin{fleqn}
  \begin{align}\label{eq1}
    \sum_{n}\lambda^{n}(i)
                       & -\sum_{n}\lambda^{n}(j) \nonumber \\
                       & = \begin{cases*}
    \eqmathbox[C]{\lambda_{n}}, & if $n = i$ \\
    \eqmathbox[C]{-\lambda_{n}}, & if $n = i$ \\
    \eqmathbox[C]{0}, & otherwise
    \end{cases*}
    \qquad \forall i, j
  \end{align}
\end{fleqn}


\item Sample equation \texttt{(with optional argument)}: 
\begin{fleqn}[2em]
  \begin{align}\label{eq2}
    \sum_{n}\lambda^{n}(i)
                       & -\sum_{n}\lambda^{n}(j) \nonumber \\
                       & =\begin{cases*}
    \eqmathbox[C]{\lambda_{n}}, & if $n = i$ \\
    \eqmathbox[C]{-\lambda_{n}}, & if $n = i$ \\
    \eqmathbox[C]{0}, & otherwise
    \end{cases*}
    \qquad \forall i, j
  \end{align}
\end{fleqn}
\end{itemize}

\end{document}

enter image description here

  • @Mico: My editor, and above all my absent-mindedness, struck again! I've fixed it. Thank you for patiently pointing these problems. B.t.w., in your code (which I shamelessly stole to have a basis), \hfill doesn't work. I circumvented it using eqmakebox. – Bernard Apr 1 '17 at 10:05
  • FWIW, \hfill does work with cases environments. :-) It's just the cases* environment where it doesn't work... – Mico Apr 1 '17 at 10:09
  • Is it a bug in ` cases*`? This means I simplified the typing of the text part by complexifying the math part. Communicating vessels… – Bernard Apr 1 '17 at 10:18
  • I definitely would not claim that it's a bug in cases. The cases* environment of the mathtools package is of much more recent vintage than the cases environment is. The author and maintainer of the mathtools package presumably had their reasons for programming up the cases* environment they way they did. But it does mean that there's more than just one difference (viz., math mode or text mode for the second column) between cases and cases*. – Mico Apr 1 '17 at 10:26
  • Do note, by the way, that I used \hfill in my (now deleted) answer because I was addressing the original form of the query. The OP subsequently changed his/her query massively, to the point where the original material basically disappeared entirely. One of the (many) changes the OP brought about was that the first column of the cases (or cases*) environment is no longer required to be right-aligned. Sigh. – Mico Apr 1 '17 at 10:31

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.