# align* in varwidth seems to ignore fleqn option

I am using the \documentclass option [fleqn] (which I think is identical to \usepackage[fleqn]{amsmath}). This seems to work fine, except when using an align* within the varwidth environment:

## Notes:

• Problem does not occur with align (non-starred) environment.

## Code

\documentclass[fleqn]{article}
\usepackage{showframe}
\usepackage{varwidth}
\usepackage{mathtools}

\newcommand*{\MyContent}{%
Using align*:
\begin{align*}
E &= mc^2
\shortintertext{and}
F &= ma
\end{align*}%
Using align
\begin{align}
y = x + b
\end{align}%
}%

\begin{document}
\noindent
Outside of \verb|varwidth|:

\MyContent

\noindent
Inside \verb|varwidth|:

\noindent
\begin{varwidth}{\linewidth}
\MyContent
\end{varwidth}
\end{document}

You just need to set the flag in the documented high level varwidth interface.

\documentclass[fleqn]{article}
\usepackage{showframe}
\usepackage{varwidth}
\usepackage{mathtools}

\newcommand*{\MyContent}{%
Using align*:
\begin{align*}
E &= mc^2
\shortintertext{and}
F &= ma
\end{align*}%
Using align
\begin{align}
y = x + b
\end{align}%
}%

\makeatletter\let\@vwid@eqmodetrue\@vwid@eqmodefalse\makeatother
\begin{document}
\noindent
Outside of \verb|varwidth|:

\MyContent

\noindent
Inside \verb|varwidth|:

\noindent vw\\
\begin{varwidth}{\linewidth}
\MyContent
\end{varwidth}

\noindent mp\\
\begin{minipage}{\linewidth}
\MyContent
\end{minipage}

\end{document}
• "Documented?" :-) texdoc varwidth opens up a one page document!! I guess you have access to better documentation. :-). Thanks for the fix. – Peter Grill Oct 6 '17 at 18:36
• @PeterGrill note that this isn't really a "fix" that is you couldn't generally patch the package in this way. varwidth failed to understand align* so it decided this was a centred equation and re-centred it, the patch disables that test so it never decides that it was a centred equation. This wouldn't be correct if you were not using fleqn and needed that test. – David Carlisle Oct 6 '17 at 20:01