[texhax] LaTeX amsmath: two equations aligned left-right
Lars Madsen
daleif at imf.au.dk
Fri Mar 25 17:04:47 CET 2011
Olivier Cailloux wrote:
> Hello,
>
> I can't find how to display properly some equations the way I would to.
> It is a bit difficult to explain, please compile this and observe the
> result. Or read below.
>
> \documentclass[a4paper]{article}
> \usepackage[utf8]{inputenc}
> \usepackage{amssymb}
> \usepackage{amsmath}
> \usepackage{amsthm}
>
> \begin{document}
> \section{Two equations}
> \begin{multline}
> \label{eq:eq1}
> \forall j \in J, a \in A, 1 \leq h \leq k-1 :\\
> \frac{1}{M_j+ \delta_j} ((g_j(a) - g_j(b_h))+\delta_j)
> \leq C_j(a, b_h).
> \end{multline}
> \begin{multline}
> \label{eq:eq2}
> \forall j \in J, a \in A, 1 \leq h \leq k-1 :\\
> C_j(a,
> b_h) \leq \frac{1}{M_j} (g_j(a) - g_j(b_h)) + 1.
> \end{multline}
>
> \section{Now better}
> \begin{multline}
> \forall j \in J, a \in A, 1 \leq h \leq k-1 :\\
> \left\{\begin{gathered}
> % \label{eq:eq1}
> \frac{1}{M_j+ \delta_j} ((g_j(a) - g_j(b_h))+\delta_j)
> \leq C_j(a, b_h);\\
> C_j(a,
> b_h) \leq \frac{1}{M_j} (g_j(a) - g_j(b_h)) + 1.
> \label{eq:eq2}
> \end{gathered}\right.
> \end{multline}
> \end{document}
>
> In the first section I present the two equations I need. I need two
> separate equation numbers to be able to refer to each of them
> independently.
>
> I would like to display them all together as in the second section,
> which would allow me to avoid repeating the first, common, part. In
> order to do that, I need in total three lines. The first line holds the
> common beginning; the second and third lines are enclosed in a left
> bracket to make it clear that they both are the continuation of the
> first part. The second and third line must be aligned on the right
> margin while the first line is left aligned. All of this I get with the
> "multline" and embedded "gathered", as in the sample code. However what
> I don't get is two different equation numbers. I would like a number on
> the second line, to refer to that equation specifically, and a different
> (consecutive) number on the third line.
>
> Any suggestion?
> Olivier
>
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
>
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org
I would not write it like that at all (and I would never use multline,
it often ends up looking really bad, especiellay if one afterwards
change the margins)
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{empheq}
\begin{document}
\section{Now better}
$\forall j \in J, a \in A, 1 \leq h \leq k-1 :$
\begin{empheq}[left=\empheqlbrace]{align}
&\frac{1}{M_j+ \delta_j} ((g_j(a) - g_j(b_h))+\delta_j)
\leq C_j(a, b_h);\\
&C_j(a,
b_h) \leq \frac{1}{M_j} (g_j(a) - g_j(b_h)) + 1.
\end{empheq}
\end{document}
The $\forall...$ is the premise (is that the correct word?) and I would
not write that as a part of the equation it self, it is understood from
the context that the equation is under those conditions
--
/daleif
More information about the texhax
mailing list