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 wanted to break long equations in an array environment. To do this, I used dmath environment from breqn package but it did not work. How can I write long equations in an array environment with line breaks? My attempt is as follows:

LaTex Output from ScribTex.com

\documentclass[11pt,twocolumn]{article}
\usepackage{amsmath}
\usepackage{breqn}
\begin{document}
\begin{dmath*}
  L_{\lambda}(\phi, \omega) =
  \left\lbrace
      \begin{array}{ll}
        a \times b \times c \times d \times e \times f \times g \times h \times i \times j \times k \times l \condition[]{for $\phi$ even},
        \\
        a \times b \times c \times d \times e \times f \times g \times h \times i \times j \times k \times l \condition[]{for $\phi$ odd},
      \end{array}
  \right.
\end{dmath*}
\end{document} 

EDIT: Actual Equation :

I thought the solution will be general so posted a nicer version of the problem earlier. Following is the actual equation I want to typeset. How can I typeset this equation nicely even with manual line breaks? output from scribtex.com

\begin{dmath*}
  L_{\lambda}(\phi, \omega) =
  \left\lbrace
      \begin{array}{ll}
        2 \cos
        \left[
          \tanh \left(
            \frac{L_{\lambda-1}(\psi, \omega)}{2}
              \right) \times \tanh \left(
            \frac{L_{\lambda-1}(\psi, \omega+1)}{2}
              \right)
        \right] \condition[]{for $\phi$ even},
        \\
        2 \sin
        \left[
          \tanh \left(
            \frac{B_{\lambda-1}(\psi, \omega+1)}{2}
              \right) \times \tanh \left(
            \frac{L_{\lambda-1}(\psi, \omega)}{2}
              \right)
        \right] \condition[]{for $\phi$ odd},
      \end{array}
  \right.
\end{dmath*}
share|improve this question
    
an array l column is always one line. You need (or could) use instead p columns of fixed width containing inline math $a \times b ....$ the inline math would wrap to the specified column width in standard latex even without breqn. –  David Carlisle Jul 20 '12 at 16:29
add comment

1 Answer

up vote 4 down vote accepted

As David Carlisle has already pointed out in a comment, you can't have a line break inside an array environment (at least not in a column of type l). The only possible break point in the equation you describe is right after the L_{\lambda}(\phi, \omega) part.

If the equation you've posted is really what you need to typeset -- I somehow doubt it, but that is what you've posted... -- your best bet may be to (i) replace all \times symbols with \cdot symbols and (ii) reduce the font size by 1 pt (by issuing the instruction \small) for the equation in question. (Note that I've also gotten rid of the array stuff in favor of a cases* environment.)

\documentclass[11pt,twocolumn]{article}
\usepackage{mathtools,breqn} 
\usepackage{mathtools,breqn}
  \def\filler{Nam dui ligula, fringilla a, euismod sodales, 
  sollicitudin vel, wisi. Morbi auctor lorem non justo.
  Nam lacus libero, pretium at, lobortis vitae, ultricies 
  et, tellus.}
\begin{document} 
{\small
\begin{dmath*}
L_{\lambda}(\phi, \omega) =
\begin{cases*}
a\cdot b\cdot c\cdot d\cdot e\cdot f\cdot g\cdot h\cdot i\cdot j\cdot 
   k\cdot l & for $\phi$ even, \\
a\cdot b\cdot c\cdot d\cdot e\cdot f\cdot g\cdot h\cdot i\cdot j\cdot 
   k\cdot l & for $\phi$ odd.
\end{cases*}
\end{dmath*}
} % end of scope of \small statement
\filler % filler text, to show width of text column
\end{document} 

enter image description here

However, it would seem to be the case that you would rather have the line break (or breaks) occur somewhere to the right of the big curly brace. Here's a suggested solution which uses the split environment:

\documentclass[11pt,twocolumn]{article}
\usepackage{mathtools}
\def\filler{Nam dui ligula, fringilla a, euismod sodales, 
  sollicitudin vel, wisi. Morbi auctor lorem non justo.
  Nam lacus libero, pretium at, lobortis vitae, ultricies 
  et, tellus.}

\begin{document}
\begin{equation*}
   L_{\lambda}(\phi, \omega) =
   \begin{dcases}
      \begin{split}
         a\cdot b\cdot c\cdot d\cdot e\cdot f\cdot g \\
         {}\cdot h\cdot i\cdot j\cdot k\cdot l 
      \end{split}
      & \text{for $\phi$ even,} \\
      \begin{split}
         a\cdot b\cdot c\cdot d\cdot e\cdot f\cdot g \\
         {}\cdot h\cdot i\cdot j\cdot k\cdot l 
      \end{split}
      & \text{for $\phi$ odd.}
   \end{dcases}
\end{equation*}

\noindent\filler
\end{document} 

enter image description here

Addendum: I just noticed that you posted the actual math expression you're trying to typeset. Here's how I would try to get the job done: building on the two previous examples, I'd allow a line break both after L_{\lambda}(\phi, \omega) -- fully automatic, courtesy of breqn and the dmath* environment -- and within each of the longish expressions to the right of the large curly brace.

\documentclass[11pt,twocolumn]{article}
\usepackage{mathtools,breqn}
  \def\filler{Nam dui ligula, fringilla a, euismod sodales, 
  sollicitudin vel, wisi. Morbi auctor lorem non justo.
  Nam lacus libero, pretium at, lobortis vitae, ultricies 
  et, tellus.}
\begin{document}    
\begin{dmath*}
   L_{\lambda}(\phi, \omega) =
   \begin{dcases}
      \begin{split}
         2 \cos \Bigg[ \tanh \left(\frac{L_{\lambda-1}
           (\psi, \omega)}{2}\right) \ \ \ \ \ \\ 
               % need to "shove" the first line to the left
                \times \tanh \left(\frac{L_{\lambda-1}
           (\psi, \omega+1)}{2}\right) \Bigg]
      \end{split} 
      & \text{for $\phi$ even,}\\
      \begin{split}
         2 \sin\Bigg[ \tanh \left( \frac{B_{\lambda-1}
           (\psi, \omega+1)}{2} \right) \\
               \times \tanh \left( \frac{L_{\lambda-1}
           (\psi, \omega)}{2} \right) \Bigg]
      \end{split}
      & \text{for $\phi$ odd.}
   \end{dcases}
\end{dmath*}
\filler %% filler text, to show width of text block
\end{document} 

enter image description here

share|improve this answer
    
This is not the equation I wanted to typeset but the problem is similar. So, I changed the messy equation with a nicer one. I thought there would be a general solution. Can we manually break lines with alignment similar to breqn? –  ubaabd Jul 20 '12 at 16:48
    
@ubaabd: You can always insert a manual break. However, you need to be more clear in your question as to what exactly you're after in terms of that. –  Werner Jul 20 '12 at 16:56
    
@ubaad: I've posted an addendum to show how one can use the split environment to force line breaks. –  Mico Jul 20 '12 at 17:12
    
@Werner I posted the actual equation. How do you think should I manually line break this equation or what is the general trend that people follow with these kind of equations, as I suspect from your answers, there is no automatic way of doing this in Latex. –  ubaabd Jul 20 '12 at 17:14
    
@mico Thanks Mico! Thats exactly what I wanted, i.e., proper alignment even after line breaks. –  ubaabd Jul 20 '12 at 17:15
show 2 more comments

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.