# nccmath affecting minipage widths

It seems that nccmath is affecting the layout of minipages. In the MWE, you can see the left minipage is clearly not taking up 70% of the page as I wanted. I'm hoping that there is an easy fix for this, otherwise I need to get rid of nccmath.

I have had problems with nccmath previously as discussed in Alignment of item number in list containing a minipage so I'm wondering if I should try to work without that package.

\documentclass[fleqn,preview=false]{standalone}

\usepackage{amsmath}
\usepackage{nccmath}% Needed for fleqn environment

\begin{document}
\begin{minipage}{0.70\linewidth}
\begin{align*}
y &= x
\end{align*}
\end{minipage}
\begin{minipage}{0.30\linewidth}
Note: abcd
\end{minipage}
\end{document}

-

It appears that nccmath indeed breaks minipages containing only a math display, setting them to have the width resulting from adding the space on the left of the display and the equation width.

If the minipage contains "paragraph material", its width is correctly set.

Solution: start a minipage that should contain only a display with

\hrule height 0pt width \hsize


Some examples (in the code the \hrule has a height in order to make it visible)

\documentclass[a4paper,fleqn]{article}

\usepackage{amsmath}
\usepackage{nccmath}% Needed for fleqn environment

\begin{document}
% let's have a "ruler"
\kern-.2pt\vrule depth 2pt\kern-.2pt
\medskip

Example 1: we put a rule with the desired width

\noindent\begin{minipage}{0.70\columnwidth}
\hrule width \hsize\kern-.4pt
\begin{align*}
y &= x
\end{align*}
\end{minipage}%
\begin{minipage}{0.30\columnwidth}
\hrule
Note: abcd

Where should this go?
\hrule
\end{minipage}

\medskip

Example 2: we don't specify the rule's width

\noindent\begin{minipage}{0.70\columnwidth}
\hrule\kern-.4pt
\begin{align*}
y &= x
\end{align*}
\end{minipage}%
\begin{minipage}{0.30\columnwidth}
\hrule
Note: abcd

Where should this go?
\hrule
\end{minipage}

\medskip

Example 3: text before the display

\noindent\begin{minipage}{0.70\columnwidth}
\hrule\kern-.4pt
Some text before
\begin{align*}
y &= x
\end{align*}
\end{minipage}%
\begin{minipage}{0.30\columnwidth}
\hrule
Note: abcd

Where should this go?
\hrule
\end{minipage}

\medskip

Example 4: text below the display

\noindent\begin{minipage}{0.70\columnwidth}
\hrule\kern-.4pt
\begin{align*}
y &= x
\end{align*}
Some text below
\end{minipage}%
\begin{minipage}{0.30\columnwidth}
\hrule
Note: abcd

Where should this go?
\hrule
\end{minipage}

\end{document}


-
Do you see any problems with adding that hrule to all minipages? Also, is the \noindent a good idea to add to all minipages? –  Peter Grill Jul 2 '11 at 18:02
The \noindent was outside the minipages, just not to have it added when building the line. Adding the \hrule to all minipages is definitely out of the question: you'll not be able to align at the top row. –  egreg Jul 2 '11 at 18:09
Looks like you are correct, but I don't understand. I thought the above macro was adding a horizontal rule of zero height. If ALL minipages have that, then I can't understand why they would not be able to align at top. –  Peter Grill Jul 2 '11 at 18:36
Just try with one having ascenders and the other not. –  egreg Jul 2 '11 at 19:26
Have posted another problem with nccmath where minipage text overlaps with text before that –  Peter Grill Jul 2 '11 at 19:33

In the comment within your code I see you need nccmath for the fleqn environment. You can define that environment yourself in your preamble without loading nccmath. You can use the code from that package:

\makeatletter
\newenvironment*{fleqn}[1][\z@]{\@fleqntrue
\setlength\@mathmargin{#1}\ignorespaces
}{%
\ignorespacesafterend
}
\makeatother

-
Excellent suggestion. But, in case I need other things from nccmath later, I think I'll leave it in my common preamble. Taking it out now and putting it back in seems that it might result in a lot of additional work later. Do you know if the features of nccmath package have been implemented elsewhere? –  Peter Grill Jul 2 '11 at 17:59