16

I want to vertically align one equation against two, similar to the cases environment but without the brace: e.g. similar environment to:

withbraces

There must be another solution to the alignment solution like Case equation without curly brace - I'd like to label it as a single equation.

0

3 Answers 3

17

There's no need to create a special environment; a simple array environment will do the job.

enter image description here

\documentclass{article}
\begin{document}
\[
y = mx_{ij}\  
\begin{array}{l}
i = 1,2,\dots,n\\
j = 1,2,\dots,n
\end{array}
\]
\end{document}

To make this a numbered equation environment, simply replace \[ and \] with \begin{equation} and \end{equation}, respectively.

3
  • 4
    Or aligned if amsmath is used; it's even simpler
    – egreg
    Commented Nov 6, 2013 at 21:07
  • 1
    @egreg - I guess it depends on what one considers to be "simpler"... By my reckoning, typing \begin{array}{l} and \end{array} requires 27 keystokes, whereas typing \begin{aligned}, \begin{aligned}, and the two & alignment characters requires 33 keystrokes...
    – Mico
    Commented Nov 6, 2013 at 21:18
  • 2
    About keystrokes. :-) Commented Nov 6, 2013 at 21:22
10
\documentclass[preview,border=12pt]{standalone}% change it back to your own document class
\usepackage{mathtools}
\begin{document}
\abovedisplayskip=0pt\relax% don't use this line in your code.
\begin{equation}
y=mx_{ij}
\quad
\!
\begin{aligned}
i &= 1,2,\ldots,n\\
j &= 1,2,\ldots,n
\end{aligned}
\end{equation}
\end{document}

enter image description here

5

You can adjust the gap between the two lines with the optional argument to \stackanchor, currently set to 12pt. I used a few ~~ for horizontal offset.

\documentclass{article}
\usepackage{stackengine}
\begin{document}
\begin{equation}
y = mx_{ij} ~~\ensurestackMath{\stackanchor[12pt]{i = 1,2,\ldots,n}
  {j = 1,2,\ldots,n}}
\end{equation}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .