2

I have some code that works but I wish to align the environments according to the descriptions. I've tried various combinations of align, equation and cases, but can't seem to find a functional solution.

\begin{equation}
  \textit{Initial conditions} \qquad \begin{cases}
  C\left(X,0\right) = S\left(X,0\right) = 0\\
  C\left(0,T\right) = 1
  \end{cases}
  \label{eq:dimensionless_initcond}
\end{equation}
\begin{equation}
  \textit{Continuous injection} \qquad  C\left(0,T\right) = 1 \label{eq:dimensionless_continuous}
\end{equation}
\begin{equation}
  \textit{Finite injection} \qquad C\left(0,T\right) = \begin{cases}
  1 \text{ for } 0 < T < T_0\\
  0 \text{ for } T_0 < T < \infty
  \end{cases}
  \label{eq:dimensionless_finite}
\end{equation}

Optimal case would be to have the environments such that both descriptions and equations are left aligned as seen in my badly done mspaint picture here: optimal case

1

My initial thought would be to place everything in an align environment as follows:

\documentclass{article}
\usepackage{amsmath,amssymb}
\newcommand{\mytext}[1]{\makebox[1.25in][l]{#1}\qquad}
\pagestyle{empty}
\begin{document}

\begin{align}
  \mytext{Initial conditions} 
  & \begin{cases}
      C\left(X,0\right) = S\left(X,0\right) = 0\\
      C\left(0,T\right) = 1
    \end{cases}
    \label{eq:dimensionless_initcond}
  \\[2ex]
  \mytext{Continuous injection} 
  &
    C\left(0,T\right) = 1 
    \label{eq:dimensionless_continuous}
  \\[2ex]
  \mytext{Finite injection} 
  &
  C\left(0,T\right) 
    = 
    \begin{cases}
      1 \text{ for } 0 < T < T_0\\
      0 \text{ for } T_0 < T < \infty
    \end{cases}
  \label{eq:dimensionless_finite}
\end{align}

\end{document}

enter image description here

Since the align environment wants to make the material in the first column right aligned, I create a box to wrap the text there \mytext which you can format as you want. It uses a \makebox whose syntax is:

\makebox[<width>][<alignment>]{<text>}

The <alignment> here can be left l, right r, or center which is the default.

  • Implementing your solution it gives a lot of Undefined control sequence errors when I added the \newcommand in my preamble file. It works perfectly with the \newcommand in the specific .tex file itself however. Not as pretty code-wise, but it works :) cheers! – mendokusai Oct 28 '13 at 12:39

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.