Math & ScienceCentering equations with caveat

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
theo moore
Posts: 72
Joined: Thu Jan 15, 2009 3:16 pm

Centering equations with caveat

Post by theo moore »

Here's an example. I'd like to type the equation

Code: Select all

\begin{equation}
x^2 + y^2 + z^2 = 1, \text{\qquad with $x,y,z \in \mathbb{Z}$}
\end{equation}
I'd like to keep the main equation centered in the page, but with the little text off to the side. The reason is that if you have a bunch of these equations down the page, it just looks nicer if the main parts are centered, rather than the equations.

Recommended reading 2024:

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

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

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Centering equations with caveat

Post by frabjous »

You could do:

Code: Select all

\begin{equation}
x^2 + y^2 + z^2 = 1 \put(0,0){\qquad with $x,y,z \in \mathbb{Z}$}
\end{equation}
If you have several equations on the same page you want to align nicely with paragraphs in between, however, consider using the align environment with the \intertext command. See the amsmath documentation for more info.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Centering equations with caveat

Post by localghost »

Another solution that works with a box.

Code: Select all

\documentclass{article}
\usepackage{amsmath,amssymb}

\begin{document}
  \begin{equation}
    x^2 + y^2 + z^2 = 1 \makebox[0pt][l]{\qquad with $x,y,z \in\mathbb{Z}$}
  \end{equation}
\end{document}

Best regards
Thorsten
Post Reply