# Center over-long equations between both margins

I understand the reasoning behind the fairly narrow textwidth in a default LaTeX article. 60-80 characters per line and all that. However, I am preparing a document that features many lengthy equations, and it seems silly to me to restrict the equations to fit into the same margins as the text when there's all that whitespace going unused on either side.

I'd like to have equations which are wider than the textwidth do the obvious thing, that is, continue to be centered on the page just like all the other equations, and simply extend into both the left and right margin equally. My equations are unnumbered, so there's no concern about where to put equation numbers.

How might I go about implementing this?

• Are you just using the equation environment? Perhaps also $...$? No align* from amsmath? – Werner Jan 31 '14 at 18:07
• consider creating an environment that incorporates a minipage that is wider than the text width, and is centered, and place the wide equations in that. but please, please, never submit it for publication! (any sensible copyeditor will return it to you to be fixed.) note that the space above and below such an environment will probably not conform to the usual (and proper) spacing for display material, and it will also be difficult to enforce the convention that at least one line of text should appear above a display on a new page. – barbara beeton Jan 31 '14 at 18:07
• If the equations, don't need to be numbered, \documentclass{article} \usepackage{lipsum} \begin{document} \lipsum[2] {\centering\makebox[0pt]{$\displaystyle y = \frac{A}{12345} + Bx + Cx^2 + Dx^3 + Ex^4 + Fx^5 + Gx^6 + A + Bx + Cx^2 + Dx^3 + Ex^4 + Fx^5 + Gx^6$}\par} \lipsum[2] \end{document} – Steven B. Segletes Jan 31 '14 at 18:11
• @Werner I would ideally like a solution that was effective for any displayed math environment: equation*, align*, gather... – thecommexokid Jan 31 '14 at 18:13
• It is possible to redefine equation* to use adjustwidth from changepage, but it comes with some vertical alignment issues. I was testing it this way: \expandafter\let\expandafter\oldequationstar\csname equation*\endcsname \expandafter\let\expandafter\endoldequationstar\csname endequation*\endcsname \renewenvironment{equation*}{\begin{adjustwidth}{-2cm}{-2cm} \begin{oldequationstar}}{\end{oldequationstar} \end{adjustwidth}}... – Werner Jan 31 '14 at 18:27

\newsavebox{\overlongequation}
\newenvironment{dontbotheriftheequationisoverlong}
{\begin{displaymath}\begin{lrbox}{\overlongequation}$\displaystyle} {$\end{lrbox}\makebox[0pt]{\usebox{\overlongequation}}\end{displaymath}}


You use it just like displaymath (or $...$)

\begin{dontbotheriftheequationisoverlong}
1+2+3+4+5+6+7+8+9+10+
11+12+13+14+15+16+17+18+19+20=
210
\end{dontbotheriftheequationisoverlong}


For a solution compatible with other alignment environments, just use a word processor instead of a typesetting system. Seriously: the effect is worse than you can think.

• Thanks for the proposal. You're missing an \end{displaymath} in there, by the way. As for the aesthetics, I guess I'll soon be finding out what it looks like, but I'm just typing up homework solutions, it's not going to be a published book or anything. If I find it as bad as you say I'll come up with something else, but I at least wanted to see what it would look like! – thecommexokid Jan 31 '14 at 18:31
• Good solution @egreg. – Gennaro Arguzzi Dec 21 '18 at 15:56

You can use \centerline in combination with the minipage environment for this purpose:

\centerline{
\begin{minipage}{\linewidth}
\begin{align*}
\text{I am very looooooooooooooooooooooooooooooong} &
\text{Me toooooooooooooooooooooooooooooooooooooooo!}
\end{align*}
\end{minipage}
}


The minipage environment embeds a virtual page, containing the math environment align*, as a regular text object, which then gets centered by \centerline.