2

This question already has an answer here:

My goal is to create a framed minipage environment that will contain text and math environments in varying combinations. I noticed that the top (and bottom) margin of the minipage is quite a bit larger if the first (and last) entry is a math environment (than it is if the first thing is normal text).

I tried to extract the relevant parts into a MWE:

\documentclass{article}
\usepackage[fleqn]{amsmath}

\begin{document}
\setlength{\mathindent}{-.15em}
\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}
\setlength{\belowdisplayshortskip}{0pt}
  \fbox{
    \begin{minipage}{.1\linewidth}
      XXX \\
      XXX
    \end{minipage}
  }
  \fbox{
    \begin{minipage}{.1\linewidth}
      \begin{align*}
        \textnormal{XXX}
      \end{align*}
      \begin{align*}
        \textnormal{XXX}
      \end{align*}
    \end{minipage}
  }
\end{document}

Which results in:
MWE output

So why are there larger top/bottom margins for math environments and how do I get rid of them?

marked as duplicate by egreg, user13907, yo', Guido, Masroor Oct 29 '14 at 0:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Browse other questions tagged or ask your own question.