7

I have the following code:

\begin{align}
& a+b+c+d+e+f = 15000 & \text{for } a = 1 ... 15  \\
& D_t= 
\begin{cases}
   \text{equation} , & \text{for } t = 1 ... 10 \\
   \text{another equation} , & \text{for } t = 1 ... 10 \\
\end{cases} 
\end{align}

This produces the following: enter image description here

However, I would like the "for" arguments in cases to be aligned to those in the align environment, which would look something like:

enter image description here

I was wondering if there is a way of doing this automatically, rather than using manual spacing. I have tried using arrays, however it didn't seem to solve the issue.

Thank you.

2
  • The best choice may depend on whether equation and another equation are of single-line height, or whether they are tall (include display fractions for example). Commented Apr 20, 2018 at 14:31
  • In my case, both equations are of single-line height. Commented Apr 20, 2018 at 14:37

3 Answers 3

4

The \Centerstack retains a settable but fixed baselineskip. Thus, using \Centerstacks to set both the equations of the case, as well as (separately) the conditions of the case, will insure that their baselineskips are compatible.

\documentclass{report}
\usepackage{amsmath}
\usepackage[usestackEOL]{stackengine}
\stackMath
\setstackgap{L}{1.2\normalbaselineskip}
\begin{document}
\begin{align}
& a+b+c+d+e+f = 15000 && \text{for } a = 1 ... 15  \\
& D_t= \left\{\Centerstack[l]{\text{equation} ,\\ \text{another equation}}\right.&&
   \Centerstack{ \text{for } t = 1 ... 10 \\ \text{for } t = 1 ... 10}
\end{align}
\end{document}

enter image description here

0
4

Here are two ways to obtain it:

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\begin{alignat}{2}
& a+b+c+d+e+f = 15000 &\quad & \text{for } a = 1 ... 15 \\
& D_t=
\begin{cases}
   \text{equation} , \\
   \text{another equation} ,
\end{cases} & & \begin{aligned}
   \text{for } t = 1 ... 10 \\\text{for } t = 1 ... 10
\end{aligned}
\end{alignat}

\begin{alignat}{2}
& a+b+c+d+e+f = 15000 &\quad & \text{for } a = 1 ... 15 \\
& D_t=
\mathrlap{\begin{cases}
   \text{equation} , & \text{for } t = 1 ... 10 \\
   \text{another equation} ,\hspace{1.9em}& \text{for }t = 1 ... 10
\end{cases}}
\end{alignat}

\end{document} 

enter image description here

1

This can be easy if we force the left part of each equation to occupy a fixed width, using for example \makebox[20em][l]{..}.

\documentclass{report}
\usepackage{amsmath}
\begin{document}

\begin{align}
&\makebox[20em][l]{$a+b+c+d+e+f = 15000$} \text{for } a = 1 \dots 15 \\
&\makebox[20em][l]{$D_t=\begin{cases}
  \text{equation},  \\
  \text{another equation},
\end{cases}$} \begin{aligned}\text{for } t = 1 \dots 10\\
\text{for } t = 1 \dots 10\end{aligned}             
\end{align}

\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 .