Math & ScienceHow to center align all parts of multilined formula

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
sitov
Posts: 2
Joined: Wed Sep 29, 2010 5:53 pm

How to center align all parts of multilined formula

Post by sitov »

Hi,

I want to make something like gather environment where all parts are center aligned (it doesn't fit because it considers every new line as new formula).
The problem with multline environment is that the first line is left aligned and the last is right aligned, and center environment doesn't help here.
The split environment is also not very useful here cause it requires manual definition of align points.
I'm sure there is a way to make this but i can't find it.
Last edited by sitov on Wed Sep 29, 2010 10:39 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.

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

How to center align all parts of multilined formula

Post by frabjous »

Perhaps you're looking for the gathered environment of amsmath?

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
    \begin{equation}
        \begin{gathered}
            2+2=4\\
            3+3=6\\
            1234 - 1234 = 0
        \end{gathered}
    \end{equation}
\end{document}
sitov
Posts: 2
Joined: Wed Sep 29, 2010 5:53 pm

Re: How to center align all parts of multilined formula

Post by sitov »

It looks like some kind of cheat, but it works. Thanks!
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How to center align all parts of multilined formula

Post by localghost »

Now that the problem is solved, please be so kind and mark the topic accordingly as clearly written in the Board Rules (to be read before posting). Please keep that in mind for the future so that further reminders will not be necessary.


Best regards and welcome to the board
Thorsten
Post Reply