3

I have a very complicated multiple lines problem in the align environment to solve.

See the code below and the pdf file https://docs.google.com/file/d/0B1kX_CbBVoMteHU2MmFlZWJNWDg/edit?pli=1 .

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
&c_{1}J_{h}>0\text{, }c_{1}J_{h+1}>0\text{, }c_{1}\left( J_{h}+p_{1}\left(
h\right) \right) >0\text{,}\\
&c_{1}\left( \left( J_{h}+J_{h+1}\right) \prod_{v\in \left\{ -1,1\right\} \
}\left( J_{h+v}+p_{1}\left( h\right) \right) -J_{h}J_{h+1}\left(
J_{h+1}-J_{h-1}\right) \right) <0\text{.}
\end{align}

\begin{alignat}{2}
& c_{1}J_{h}>0\text{, }c_{1}J_{h+1}>0\text{, }c_{1}\left( J_{h}+p_{1}\left(
h\right) \right) >0\text{,} & & \\
& c_{1}\Bigg(\left( J_{h}+J_{h+1}\right) \prod_{v\in \left\{ -1,1\right\} \
}\left( J_{h+v}+p_{1}\left( h\right) \right)  & & -  \notag \\
& & & J_{h}J_{h+1}\left( J_{h+1}-J_{h-1}\right) \Bigg)<0\text{.}
\end{alignat}

\end{document}

As you see in the pdf file, formulas (1) and (2) are usual situation in the align environment. But if (2) is too long, then we have to divide it into two lines ( something like (4) ).

I think my code is not a good solution for this situation. Because my expected solution should be as follows:

(i) Use amsmath package only.

(ii) We can not use additional environments except for align, gather, flalign, multline, alignat and split.

(iii) Make the spacing of the two lines of (4) be smaller than the spacing of (3) and the first line of (4).

(iv) Can not use phantom command.

(v) Keep the corresponding brackets in (2) and (4) the same size.

Obviously, my code can not satisfy (iii) and (v), so I hope someone can help me. Thanks! Wait for your solutions...

  • for (iii) you can always use \\[value] with value positive or negative at end of lines. It will add value to regular distance between lines. About (v) it looks like brackets have same size in (2) and (4). In any case, what would you like to get? – Ignasi Jan 16 '14 at 10:14
3

You can use multlined from mathtools. However, my advice is to use gather rather than align.

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\begin{gather}
c_{1}J_{h}>0,\quad c_{1}J_{h+1}>0,\quad c_{1}(J_{h}+p_{1}(h))>0, \\
c_{1}\biggl( (J_{h}+J_{h+1}) \prod_{v\in \{-1,1\}}(J_{h+v}+p_{1}(h))-
  J_{h}J_{h+1}(J_{h+1}-J_{h-1})\biggr)<0.
\end{gather}

\begin{align}
&c_{1}J_{h}>0,\quad c_{1}J_{h+1}>0,\quad c_{1}(J_{h}+p_{1}(h))>0, \\
&c_{1}\biggl( (J_{h}+J_{h+1}) \prod_{v\in \{-1,1\}}(J_{h+v}+p_{1}(h))-
  J_{h}J_{h+1}(J_{h+1}-J_{h-1})\biggr)<0.
\end{align}

\begin{align}
&c_{1}J_{h}>0,\quad c_{1}J_{h+1}>0,\quad c_{1}(J_{h}+p_{1}(h))>0, \\
&\!\begin{multlined}
  c_{1}\biggl( (J_{h}+J_{h+1}) \prod_{v\in \{-1,1\}}(J_{h+v}+p_{1}(h))-{}\\
    J_{h}J_{h+1}(J_{h+1}-J_{h-1})\biggr)<0.
  \end{multlined}
\end{align}

\end{document}

Note that you shouldn't use \left and \right in front of all parentheses. In particular, watch out for \left and \right when the parentheses are around a big operator such as \sum or \prod: they'll produce too big delimiters, while \bigg usually gives the correct size.

Instead of \text{, }, I suggest ,\quad that gives more room. There's non need to say \text{,} or \text{.} for the final punctuation.

enter image description here

If you really can't use mathtools, then you can go with aligned, manually finding out the alignment points, something like

\begin{align}
&c_{1}J_{h}>0,\quad c_{1}J_{h+1}>0,\quad c_{1}(J_{h}+p_{1}(h))>0, \\
&\!\begin{aligned}
  c_{1}\biggl((J_{h}+J_{h+1})& \prod_{v\in \{-1,1\}}(J_{h+v}+p_{1}(h))-{}\\
    &J_{h}J_{h+1}(J_{h+1}-J_{h-1})\biggr)<0.
  \end{aligned}
\end{align}

enter image description here

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.