Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I wish to get a more typical alignment (I hope this obvious) than what I am getting with the following code:

\[                                                                                                                                                                           
 \hat\delta = \left \{                                                                                                                                                       
   \begin{array}{lr}                                                                                                                                                         
    \hat\delta(q_i, \epsilon) &= q_i \\                                                                                                                                      
    \hat\delta(q_i, ax) &= \hat\delta(\delta(q_i, a), x) : a\in\Sigma, x\in\Sigma^*                                                                                          
     \end{array}                                                                                                                                                             
   \right.                                                                                                                                                                   
\]

This produces:Weird Alignment

After seeing the above picture, I believe it is obvious that I wish to move the = sign and the q_i over to the left in the alignment. How can I achieve this?

Thanks for all the help!

share|improve this question
2  
Make your {lr} alignment {ll}, or else use the align environment of amsmath. –  Steven B. Segletes Jan 28 at 15:28
    
Thanks! That did it! What do both of those code segments do? –  CodeKingPlusPlus Jan 28 at 15:29
    
They define the alignment of the columns in your array: l = left, r = right –  Thruston Jan 28 at 15:31
    
The introduction of & into the array environment are column delimiters. Since you have one &, it means you have two columns. The {ll} specifier to the environment means left-align the two columns. The way you had it, the first column was left aligned, while the second was right-aligned. The other alignment is a c for center-alignment. –  Steven B. Segletes Jan 28 at 15:31
add comment

3 Answers

I don't think the equals signs should be aligned, so a simple cases environment suffices. However, I add also the “aligned” version.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\noindent
First attempt, like I would do it; there's
no need to align the equals signs:
\[
\hat\delta =
\begin{cases}
\hat\delta(q_i, \epsilon) = q_i, \\
\hat\delta(q_i, ax) = \hat\delta(\delta(q_i, a), x), & a\in\Sigma,\ x\in\Sigma^*
\end{cases}
\]
Second attempt, aligning the equals signs:
\[
\renewcommand{\arraystretch}{1.2}
\hat\delta =
\left\{
\begin{array}{@{}l@{}ll@{}}
\hat\delta(q_i, \epsilon) &{}= q_i, \\
\hat\delta(q_i, ax) &{}= \hat\delta(\delta(q_i, a), x), & a\in\Sigma,\ x\in\Sigma^*
\end{array}
\right.
\]
\end{document}

enter image description here

share|improve this answer
add comment

Another possibility is

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation*}
  \hat\delta
  = \left\{
  \begin{aligned}
    \hat\delta(q_{i}, \epsilon)
      &= q_{i} \\
    \hat\delta(q_{i}, ax)
      &= \hat\delta(\delta(q_{i}, a),x)
         \qquad \text{for } a \in \Sigma, x \in \Sigma^{\ast}
  \end{aligned}
  \right.
\end{equation*}
or
\begin{equation*}
  \hat\delta
  = \left\{
  \begin{alignedat}{2}
    &\hat\delta(q_{i}, \epsilon)
      &&= q_{i} \\
    &\hat\delta(q_{i}, ax)
      &&= \hat\delta(\delta(q_{i}, a),x)
          \qquad \text{for } a \in \Sigma, x \in \Sigma^{\ast}
  \end{alignedat}
  \right.
\end{equation*}

\end{document}

output

share|improve this answer
add comment

Using the cases or the align* environment would give a better spacind around the = sign. For the solution with align*, loading the empheq package with overload option allows a simpler syntax:

\documentclass[11pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern} 
\usepackage[overload]{ empheq}

\begin{document}

\begin{align*}[left = {\hat\delta =\empheqlbrace}]
   \hat\delta(q_i, \epsilon) &= q_i \\
   \hat\delta(q_i, ax) &= \hat\delta(\delta(q_i, a), x) : a\in\Sigma, x\in\Sigma^*
\end{align*}

\[ \hat\delta =
   \begin{cases}
      \hat\delta(q_i, \epsilon)= q_i \\
      \hat\delta(q_i, ax)= \hat\delta(\delta(q_i, a), x) : a\in\Sigma, x\in\Sigma^*
   \end{cases} \]

\end{document}

Result:

output

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.