21

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?

6
  • Are you just using the equation environment? Perhaps also \[...\]? No align* from amsmath?
    – Werner
    Commented Jan 31, 2014 at 18:07
  • 2
    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. Commented Jan 31, 2014 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} Commented Jan 31, 2014 at 18:11
  • 1
    @Werner I would ideally like a solution that was effective for any displayed math environment: equation*, align*, gather... Commented Jan 31, 2014 at 18:13
  • 1
    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
    Commented Jan 31, 2014 at 18:27

2 Answers 2

15

Here's what you want. Please, don't inflict it to your readers

\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.

2
  • 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! Commented Jan 31, 2014 at 18:31
  • Good solution @egreg. Commented Dec 21, 2018 at 15:56
5

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .