1

I wanted to achieve the following:

And I did but my code looks like it was in a major accident:

\documentclass{article}
\usepackage{amsmath}
\usepackage{stackengine} 
\begin{document}



\begin{flalign*}
    \setstackgap{L}{15pt}
    \Centerstack[r]{{\text{Something long }} {$\left[\text{Something}_{\text{else}}\right]$}} = & \text{ } \dfrac{\text{Something} * \left( \sum \text{(Something)} + \sum \text{(Something)} \right) } {\text{0,5} * \sum \text{(Something)} + \sum \text{(Something)} } & \\
    + & \text{ } \dfrac{\text{Something} * \left( \sum \text{(Something)} + \sum \text{(Something)} \right) } {\text{0,5} * \sum \text{(Something)} + \sum \text{(Something)} } &
\end{flalign*}      


\end{document}

I started using flalign* to get the formula aligned to the left. Then I posted a question here regarding lining up of the two lines on the left of the equation. That is where the stackengine package is coming from. When I had to put something in subscript it wouldn't compile anymore and I started fiddling around with the $$ until it worked. I am using the \text{ } to get some spacing between the equal sign and the formula. The & in the end is used to actually align it to the left.

As I said. It works and produces the desired result. But as I will have a lot of formulas like this one, I wanted to know if there is a more correct or better way to achieve it.

EDIT:

I reduced the code for the MWE to only one line. As it was pointed out to me this was an undue simplification.

2
  • just use fleqn option on \documentclass and a normal \[..\] it's wrong to use a align for a single line display, a standard \parbox will vertically centre the text, so no packages are needed. May 15, 2015 at 20:29
  • The formula has multiple lines. I reduced it to one for the MWE. I will edit.
    – Thomas
    May 15, 2015 at 20:32

1 Answer 1

1

Note the fl in flalign is for full length, not flush left. the fleqn option is intended to flush left math layouts:

enter image description here

\documentclass[fleqn]{article}
\usepackage{amsmath}
\setlength\mathindent{0pt}
\begin{document}


left aligned equation:
\begin{align*}
{\begin{array}{c}
\text{Something long}\\
{[\text{Something}_{\text{else}}]}
\end{array}} 
&= 
\frac{\text{Something} * ( \sum \text{(Something)} + \sum \text{(Something)}) }
 {\text{0,5} * \sum \text{(Something)} + \sum \text{(Something)} }\\[\jot]
&\quad{}+ 
\frac{\text{Something} * ( \sum \text{(Something)} + \sum \text{(Something)}) }
 {\text{0,5} * \sum \text{(Something)} + \sum \text{(Something)} } 
\end{align*}    


\end{document}
5
  • you could replace the {c} by @{}c@{} to remove the padding around the left hand array, but it looked a bit tight, so I left it in. May 15, 2015 at 20:44
  • \[ \begin{split} ... \end{split} \] would work equally well here, and is perhaps a bit more logical. May 15, 2015 at 20:51
  • I can't use '\setlength\mathindent{0pt}' because I want to have some other formula centered.
    – Thomas
    May 15, 2015 at 20:56
  • @Thomas it's a local setting you can set it just for that equation May 15, 2015 at 20:57
  • @barbarabeeton yes May 15, 2015 at 20:57

You must log in to answer this question.

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