Update
This has been fixed (using the code below) in release 2.17a of amsmath
(August 2017).
amsmath
explicitly tests for this situation and adds code to issue a warning
\begin{macro}{\black@}
This macro is made to produce an
overfull box message and possibly (depending on the value of
\overfullrule
) a rule in the margin if the total width of an
alignment is larger than the value of \displaywidth
.
Unfortunately the code it inserts only produces a warning with fleqn
(flush left equations, which is the default for AMS classes) not with the centred
equations which is the standard default.
The following fixes that, it should make no change at all in documents without over wide equations. For documents with over wide equations the internal box structure is slightly different but there should be no visible change to the document except in draft
mode when as documented above, you get an overfull box rule at the margin.
This will probably appear in the next release of amsmath
pending further testing.
As modified below the test file produces console output
Overfull \hbox (49.62772pt too wide) detected at line 38
Test file:
\documentclass{article}
\usepackage{scrextend}
\usepackage{amsmath}
\makeatletter
\def\black@#1{%
\noalign{%
\ifdim#1>\displaywidth
\dimen@\prevdepth
\nointerlineskip
\vskip-\ht\strutbox@
\vskip-\dp\strutbox@
\vbox{\noindent\hbox to \displaywidth{\hbox to#1{\strut@\hfill}}}%
% added this ^^^^^^^^^^^^^^^^^^^^^^^ ^
\prevdepth\dimen@
\fi
}%
}
\makeatother
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{addmargin}[1cm]{0mm}
\lipsum[2]
\begin{enumerate}
\item
\lipsum[3]
\item
\begin{align*}
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn
\end{align*}
\end{enumerate}
\end{addmargin}
\end{document}
align*
environment. If it is changed toequation*
, a warning results. I've tried to locate the source of the problem, but the definition is very complicated, so no explanation yet.addmargin
is irrelevant; the missing warning doesn't depend on it.