Math & ScienceEquation numbers running out of the page

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
hajime
Posts: 10
Joined: Sat Aug 15, 2009 1:03 am

Equation numbers running out of the page

Post by hajime »

Hello, some of my equations are so long that when latex puts the equation numbers, the numbers are either partially seen or moved to the next line (please refer to the attachments). Any solution to fix these two problems are greatly appreciated. Thanks.
Attachments
problem2.jpg
problem2.jpg (14.79 KiB) Viewed 11375 times
problem1.jpg
problem1.jpg (8.07 KiB) Viewed 11375 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: Equation numbers running out of the page

Post by Stefan Kottwitz »

There's simply not sufficient space at the right.

I recommend to break the wide equation earlier, making several lines. The other options, such as making the margins smaller or reducing the font size of the equations are probably not so good.

Stefan
LaTeX.org admin
hajime
Posts: 10
Joined: Sat Aug 15, 2009 1:03 am

Re: Equation numbers running out of the page

Post by hajime »

Thanks for the reply. I tried to reduce the font size already. Nothing changes.
For problem2, is there a way to move the (18) to the right?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Equation numbers running out of the page

Post by Stefan Kottwitz »

Sure, it depends on how you are producing this equation (which environment?), perhaps show the source code. As also general document settings are important (margins? amsmath?), to verify and to fix it, a Infominimal working example containing equation and document settings would be useful.

I guess you don't want to see any other equation where the tag (18) is pushed to the right, but your equation with your settings. ;-)

Stefan
LaTeX.org admin
hajime
Posts: 10
Joined: Sat Aug 15, 2009 1:03 am

Re: Equation numbers running out of the page

Post by hajime »

Thanks Stefan! The source code is:

\begin{eqnarray}
-\frac{A_0}{2}g_z + \sum_{k=-N}^N [-\frac{g_z}{2} - \frac{(\bar z_{0} + z_q)(2 \pi k f_0 )^2}{2} ] (A_k - j B_k) e^{2\pi jkf_0 t} \label{equation18} \nonumber \\
= \frac{a_0}{2} + \frac{1}{2} \sum_{k=-N}^N (a_k - jb_k) e^{2\pi jkf_0 t

\end{eqnarray}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Equation numbers running out of the page

Post by Stefan Kottwitz »

I see. There are errors:
  • There cannot be an empty line within a math environment, because this means a paragraph break for TeX.
  • A closing brace is missing in the last expression e^{2\pi jkf_0 t
If I fix this, I get:
equation.png
equation.png (10.35 KiB) Viewed 11362 times
So the tag is at the right, there's no problem with this code you showed, once the mentioned errors are fixed.

I strongly recommend to avoid eqnarray though, because there are known problems. Use an environment of amsmath instead.

Stefan
LaTeX.org admin
hajime
Posts: 10
Joined: Sat Aug 15, 2009 1:03 am

Re: Equation numbers running out of the page

Post by hajime »

Thanks Stefan. I removed \\ and added the closing bracket. Then, the equation looks like the one attached. Also, the two equations below this one got numbered as (18) and (19). Is there anything wrong with my corrections?



\begin{eqnarray}
-\frac{A_0}{2}g_z + \sum_{k=-N}^N [-\frac{g_z}{2} - \frac{(\bar z_{0} + z_q)(2 \pi k f_0 )^2}{2} ] (A_k - j B_k) e^{2\pi jkf_0 t} \label{equation18} \nonumber
= \frac{a_0}{2} + \frac{1}{2} \sum_{k=-N}^N (a_k - jb_k) e^{2\pi jkf_0 t}

\end{eqnarray}
Attachments
new problem.jpg
new problem.jpg (7.26 KiB) Viewed 11360 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Equation numbers running out of the page

Post by Stefan Kottwitz »

Yes - I did not say that you should remove the \\. I said remove the empty line.

Stefan
LaTeX.org admin
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Equation numbers running out of the page

Post by Stefan Kottwitz »

Here's a complete document, which shows what to use instead of eqnarray: an environment of amsmath, here: multline.

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{multline}
\label{equation18}
-\frac{A_0}{2}g_z + \sum_{k=-N}^N [-\frac{g_z}{2} - \frac{(\bar z_{0} + z_q)(2 \pi k f_0 )^2}{2} ] (A_k - j B_k) e^{2\pi jkf_0 t} \\
= \frac{a_0}{2} + \frac{1}{2} \sum_{k=-N}^N (a_k - jb_k) e^{2\pi jkf_0 t}
\end{multline}
\end{document}
If you post code, please use the code button, as I did.

Stefan
LaTeX.org admin
Post Reply