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.

Why is there so much vertical space between the subsection heading and the equation in the following example. How do I get rid of it?

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\section{Title}
\subsection{Subtitle}
\begin{flalign*}
a+b=8 &&\\
c=2 &&
\end{flalign*}
\end{document}

Imad

Secondly, why is it aligned at the equals sign, even without &=? I want both of the lines to be flushed to the left.

share|improve this question
1  
Harish's answer show you how to adjust it, but it usually not recommend to begin a paragraph with a display math equation. If you use it as part of the normal paragraph the spacing is correct. –  Peter Grill Nov 10 '12 at 23:16
1  
As far as your second question as to why the equal signs are aligned is that the 8 and 2 take up the same space and the equations are right aligned since there is no & until the end of the line, so then the end of the line is specified as the alignment point. –  Peter Grill Nov 10 '12 at 23:18
    
Are you sure you need flalign*? \subsection{Subtitle}$a+b=8$\\$c=2$ would do as well. Can you be more explicit about why you need such a layout? –  egreg Nov 10 '12 at 23:19
    
Sometimes I'll want to align some equations at the equals sign, so I'll need flalign. With my second question I was just wondering why my example wasn't flushed to the very left (the $ were at the wrong places). –  user21760 Nov 10 '12 at 23:25
add comment

2 Answers

up vote 3 down vote accepted

Reduce \abovedisplayskip and put a & at the begining and one at the end.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\section{Title}
\subsection{Subtitle}
{\setlength{\abovedisplayskip}{0pt}
\begin{flalign*}
&a+b=8 &\\
&c=2 &
\end{flalign*}}
\end{document}

enter image description here

share|improve this answer
    
Is there are way to set \abovedisplayskip so that the space before equations after every heading is reduced? –  user21760 Nov 10 '12 at 23:19
    
@user21760: I don't advice it as it is a overkill (you have to patch the heading command). See comments of egreg and Peter above regarding these things. –  Harish Kumar Nov 10 '12 at 23:24
add comment

I'm not sure that you really want flalign for this:

\documentclass{article}
\usepackage{array}
\newenvironment{flusheqs}
 {\noindent$\begin{array}{@{}>{\displaystyle}l@{}}}
 {\end{array}$\par}


\begin{document}
\section{Title}
\subsection{Subtitle}
\begin{flusheqs}
a+b=8 \\
c=2
\end{flusheqs}
\end{document}

enter image description here

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.