Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

I have a large equation

\begin{document}

\begin{gather}
W = \frac{1}{2\mu_0}(\frac{\Psi'^2 \pi^2}{b^2} \sum_{m,n} a_{mn}^2 n^2 (ab/4) + \frac{\Psi'^2 \pi^2}{a^2} \sum_{m,n} a_{mn}^2 m^2 (ab/4) + \Psi'^2ab(\mu^2 + \sum_{m,n} \frac{8a_{mn} \mu^2}{\pi^2 mn} + \frac{a_{mn}^2 \mu^2}{4})) \notag \\[1ex]
W = \frac{\Psi'^2 ab}{2\mu_0}(\mu^2 + \sum_{m,n} [ \frac{a_{mn}^2}{4}(\frac{m^2 \pi^2 }{a^2} + \frac{n^2 \pi^2}{b^2} + \mu^2) + \frac{8a_{mn}\mu^2}{\pi^2 mn}]). \label{eq:energycart}
\end{gather}

\end{document}

On my document settings the first equation JUST goes off the expected margin and as a result is not centred in the middle of the page (the left side stays on the margin, the right side goes off). Is there anyway to centre the equation, even if it goes out of the margins? I don't want to split the equation on to two lines.

share|improve this question

marked as duplicate by Werner, Mike Renfro, Christian Hupfer, Malipivo, Harish Kumar May 11 at 0:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3  
Maybe you don't want to split the first equation; your readers do. –  egreg May 10 at 15:37
2  
Why don't you want to split the equation? –  Gonzalo Medina May 10 at 15:38
    
@Werner No, it's not a duplicate of that one. –  egreg May 10 at 15:57

3 Answers 3

Your instinct may be not to insert a line break in the first equation. However, the typographic consequences of not inserting a line break will be severe. For instance, the first equation will completely dominate the second one, for no discernable typographic reason. Moreover, there's only so much material the human eye can take in if it's all posted on a single line; providing a well-chosen line break will almost certainly help the reader's comprehension of what you're trying to state. I would also use large parentheses (using \bigg and \Big).

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
W &= \frac{1}{2\mu_0}\biggl[
\frac{\Psi'^2 \pi^2}{b^2} \sum_{m,n} a_{mn}^2 n^2 (ab/4) + \frac{\Psi'^2 \pi^2}{a^2} \sum_{m,n} a_{mn}^2 m^2 (ab/4) \notag\\ 
&\qquad+ \Psi'^2ab\biggl(\mu^2 + \sum_{m,n} \frac{8a_{mn} \mu^2}{\pi^2 mn} + \frac{a_{mn}^2 \mu^2}{4}\biggr)\biggr] \notag \\[1ex]
W &= \frac{\Psi'^2 ab}{2\mu_0}\biggl[\mu^2 + \sum_{m,n} \biggl( \frac{a_{mn}^2}{4}\Bigl(\frac{m^2 \pi^2 }{a^2} + \frac{n^2 \pi^2}{b^2} + \mu^2\Bigr) + \frac{8a_{mn}\mu^2}{\pi^2 mn}\biggr)\biggr]. \label{eq:energycart}
\end{align}
\end{document}
share|improve this answer
1  
Nice answer! I think the second W is superfluous. –  Gonzalo Medina May 10 at 15:56
    
@GonzaloMedina - Thanks! You're probably right about the W not being needed at the start of the second equation. I left it in since I didn't want to go too far modifying what the OP had provided. –  Mico May 10 at 16:35
    
It is more readable (IMHO) if the splited line is more on the right (eyes don't have to go so far on the left and it makes a block). Replace \quad by \hfill doesn't work. Is there a simple way to push this line to the right (not just \hspace{?} ? –  Tarass May 11 at 8:29
    
@Tarass - to move the second line more to the right, you could type, for instance, \qquad\qquad instead of a single \qquad. The "correct" amount of indentation is, naturally, subjective. –  Mico May 11 at 8:54

Maybe you don't want to split the first equation into two lines; you readers do and will be grateful. However, I tell you how to do it, hoping you won't.

\documentclass{article}
\usepackage[pass,showframe]{geometry} % for the page frame
\usepackage{amsmath}
\usepackage{mathtools} % for \mathclap
\begin{document}
The following is good
\begin{align}
\begin{split}
W &= 
  \frac{1}{2\mu_0}\biggl(
    \frac{\Psi'^2 \pi^2}{b^2} \sum_{m,n} a_{mn}^2 n^2 \frac{ab}{4} +
    \frac{\Psi'^2 \pi^2}{a^2} \sum_{m,n} a_{mn}^2 m^2 \frac{ab}{4} + {} \\
  &\qquad\qquad
    \Psi'^2ab\biggl(
      \mu^2 + \sum_{m,n} \frac{8a_{mn} \mu^2}{\pi^2 mn} + \frac{a_{mn}^2 \mu^2}{4}
    \biggr)
  \biggr) 
\end{split}
\notag\\[1ex]
W &= 
  \frac{\Psi'^2 ab}{2\mu_0}\biggl(
    \mu^2 + \sum_{m,n} \biggl[
      \frac{a_{mn}^2}{4}\left(\frac{m^2 \pi^2 }{a^2} + \frac{n^2 \pi^2}{b^2} + \mu^2\right) +
      \frac{8a_{mn}\mu^2}{\pi^2 mn}
    \biggr]
  \biggr).
\label{eq:energycart}
\end{align}
On the other hand, this is really bad
\begin{gather}
\mathclap{
  W = 
  \frac{1}{2\mu_0}\biggl(
    \frac{\Psi'^2 \pi^2}{b^2} \sum_{m,n} a_{mn}^2 n^2 \frac{ab}{4} +
    \frac{\Psi'^2 \pi^2}{a^2} \sum_{m,n} a_{mn}^2 m^2 \frac{ab}{4} + 
    \Psi'^2ab\biggl(
      \mu^2 + \sum_{m,n} \frac{8a_{mn} \mu^2}{\pi^2 mn} + \frac{a_{mn}^2 \mu^2}{4}
    \biggr)
  \biggr) 
}
\notag\\[1ex]
W = 
  \frac{\Psi'^2 ab}{2\mu_0}\biggl(
    \mu^2 + \sum_{m,n} \biggl[
      \frac{a_{mn}^2}{4}\left(\frac{m^2 \pi^2 }{a^2} + \frac{n^2 \pi^2}{b^2} + \mu^2\right) +
      \frac{8a_{mn}\mu^2}{\pi^2 mn}
    \biggr]
  \biggr).
%\label{eq:energycart}
\end{gather}
\end{document}

I used split for the first equation, in case you want to assign it a number (which you should, in my opinion).

enter image description here

share|improve this answer
1  
On the first display (the one with the split equation) wouldn't it be better if the + sign at the end of the first line is moved to the start of the second line? –  Gonzalo Medina May 10 at 15:59
    
@GonzaloMedina I think leaving the hanging operation symbol tells more clearly that the formula hasn't ended yet. –  egreg May 10 at 16:01

If you absolutely want to keep the first equation on the same line, replacing (ab/4) with \,\frac{ab}{4} will do — and it will look better, in my opinion. Alternatively, you can use the \mathclap command, from the mathtools package with the first line but only with a gather environment:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage{mathtools}

\begin{document}

\begin{align}
W &= \frac{1}{2\mu_0}\biggl[
\frac{\Psi'^2 \pi^2}{b^2} \sum_{m,n} a_{mn}^2 n^2\,\frac{ab}{4}+ \frac{\Psi'^2 \pi^2}{a^2} \sum_{m,n} a_{mn}^2 m^2\,\frac{ab}{4} + \Psi'^2ab\biggl(\mu^2 + \sum_{m,n} \frac{8a_{mn} \mu^2}{\pi^2 mn} + \frac{a_{mn}^2 \mu^2}{4}\biggr)\biggr] \notag \\[1ex]
W &= \frac{\Psi'^2 ab}{2\mu_0}\biggl[\mu^2 + \sum_{m,n} \biggl( \frac{a_{mn}^2}{4}\Bigl(\frac{m^2 \pi^2 }{a^2} + \frac{n^2 \pi^2}{b^2} + \mu^2\Bigr) + \frac{8a_{mn}\mu^2}{\pi^2 mn}\biggr)\biggr]. \label{eq:energycart}
\end{align}

\begin{gather}
\notag \mathclap{W = \frac{1}{2\mu_0}\biggl[
\frac{\Psi'^2 \pi^2}{b^2} \sum_{m,n} a_{mn}^2 n^2(ab/4)+ \frac{\Psi'^2 \pi^2}{a^2} \sum_{m,n} a_{mn}^2 m^2(ab/4)+ \Psi'^2ab\biggl(\mu^2 + \sum_{m,n} \frac{8a_{mn} \mu^2}{\pi^2 mn} + \frac{a_{mn}^2 \mu^2}{4}\biggr)\biggr]}\\[1ex]
W = \frac{\Psi'^2 ab}{2\mu_0}\biggl[\mu^2 + \sum_{m,n} \biggl( \frac{a_{mn}^2}{4}\Bigl(\frac{m^2 \pi^2 }{a^2} + \frac{n^2 \pi^2}{b^2} + \mu^2\Bigr) + \frac{8a_{mn}\mu^2}{\pi^2 mn}\biggr)\biggr]. \label{eq:energycart}
\end{gather}

\end{document} 

enter image description here

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.