I have equations inside an environment which has a larger left-margin than the main text (analogous to an enumerate/itemize environment, implemented with the changepage
package's adjustwidth
environment). Just as equations in enumerate/itemize behave, the equations are centered with respect to the entire text, rather than just the width of the container environment. I want the latter behavior.
I'm trying to accomplish this by wrapping all display-math in minipages. Namely, I'm modifying the mathdisplay
environment in amsmath.sty
as follows:
\makeatletter
\let\oldmd\mathdisplay
\def\mathdisplay#1{%
\newline
\begin{minipage}{\textwidth-\@totalleftmargin}%
\oldmd{#1}%
}
\let\oldendmd\endmathdisplay
\def\endmathdisplay#1{%
\oldendmd{#1}%
\end{minipage}
}
\makeatother
This is almost working, but there are some issues with spacing which I don't understand how to fix. Here's how the the normal \[ ... \]
and numbered \begin{equation} ... \end{equation}
look with the above modification:
My main confusion is why the numbered version is behaving so differently from the unnumbered. But all in all I want to fix this so that the spacing above and below is even as it usually is. Any help is appreciated, thanks.
Edit: Here's a compilable example:
\documentclass{amsart}
\usepackage{lipsum}
\usepackage{calc}
\usepackage{changepage}
\makeatletter
\let\oldmd\mathdisplay
\def\mathdisplay#1{%
\newline
\begin{minipage}{\textwidth-\@totalleftmargin}%
\oldmd{#1}%
}
\let\oldendmd\endmathdisplay
\def\endmathdisplay#1{%
\oldendmd{#1}%
\end{minipage}
}
\makeatother
\setlength{\parindent}{0pt}
\begin{document}
\lipsum[1]
\begin{adjustwidth}{20pt}{}
\lipsum[2]
\[
x \mapsto \hom(-,x)
\]
\lipsum[3]
\begin{equation}
y \mapsto \hom(y,-)
\end{equation}
\lipsum[4]
\end{adjustwidth}
\lipsum[5]
\end{document}