Math & ScienceEquation Number centered with Equation

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Joao
Posts: 11
Joined: Sat Jun 18, 2011 8:02 pm

Equation Number centered with Equation

Post by Joao »

Hi folks

My University doesn't offer a template for thesis in laTeX, so I'm writing code in LaTeX to create my own. I've used a template by another guy, based on book.cls, and modified it according my University rules. But I run into this problem, which I was unable to solve:

The rules specify that the equations should be centered and the equation number will come immediately at the end of equation (so, would be centered with the equation). I'm using the amsmath package, which only offers the options of putting the equation number on the right or on the left of the page, is there any hack I can make at my class to make my template according to the rules, or another package similar to amsmath that has that option?
Last edited by Joao on Sun Jun 19, 2011 6:51 pm, edited 1 time in total.

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: 10344
Joined: Mon Mar 10, 2008 9:44 pm

Equation Number centered with Equation

Post by Stefan Kottwitz »

Hi Joao,

in amsmath, the code for placing tags is very extensive. A quick way regarding align environments would be:

Code: Select all

\def\place@tag{\quad\boxz@}
align can be used for many purposes, also for simple equations - you just don't need to use & or \\. Or define equation by align. Here's a complete example:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\makeatletter
\def\place@tag{\quad\boxz@}
\makeatother
\let\equation\align
\let\endequation\endalign
\begin{document}
\begin{equation}
e^{i\pi} + 1 = 0
\end{equation}
\begin{align}
e = \lim_{n\to\infty} \left( 1 + \frac{1}{n} \right)^n
\end{align}
\end{document}
tags.png
tags.png (3.79 KiB) Viewed 2432 times
Stefan
LaTeX.org admin
Joao
Posts: 11
Joined: Sat Jun 18, 2011 8:02 pm

Re: Equation Number centered with Equation

Post by Joao »

Once again, thank you. Problem solved, final adjustments at my template, and will make it available to other university students. Thanks so much!
Post Reply