Math & ScienceEquations Alignment Problem

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Equations Alignment Problem

Post by Cham »

I need to show four equations : two equations on one line, and two other equations on a second line, like this (compilable code):

Code: Select all

\documentclass[12pt,letterpaper]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath}

\begin{document}

	\begin{align}
		Axy = Bx - 3 &= z = k,
		& Bx - yz &= - 6, \\ \nonumber \\
		C - D &= E + f = 0,
		& Gx - 4y &= 2.
	\end{align}

\end{document}
Here's a preview from the code above :
4equations.jpg
4equations.jpg (8.83 KiB) Viewed 2817 times
Currently, the equations aren't properly aligned. The two equations on the left side should be centered, as if I was using the gather environment. The two equations on the right side should also be centered. How can I do that ?

This is probably some pretty basic stuff, but I really don't know how to do it ! :oops:

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

Equations Alignment Problem

Post by Stefan Kottwitz »

For centered blocks within multiline formulas, you could use the gathered environment. For example:

Code: Select all

\documentclass[12pt,letterpaper]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\begin{document}
\[
  \begin{gathered}
    Axy = Bx - 3 = z = k, \\
    C - D = E + f = 0,
  \end{gathered}
  \hspace{4em}
  \begin{gathered}
    Bx - yz = - 6, \\
    Gx - 4y = 2.
  \end{gathered}
\]
\end{document}
gathered.png
gathered.png (3.3 KiB) Viewed 2809 times
However, it could be hard to number by line on the right if you group it this way. Numbering as a whole is no problem, using an equation environment instead of \[ ... \]. I guess I would change this formula set structure, because I would centered blocks as belonging together, not the lines then which span over different blocks.

Stefan
LaTeX.org admin
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Re: Equations Alignment Problem

Post by Cham »

Hmmm, this is much less "basic stuff" than what I thought.

And yes, line numbering is posing a problem.

So there is no better way to do this ? This is strange.
User avatar
Cham
Posts: 937
Joined: Sat Apr 02, 2011 4:06 pm

Equations Alignment Problem

Post by Cham »

Actually, what I'm trying to do is this :

I need to present a set of independant equations into some kind of "gather" packs. The equations are not related to each others.

However, I need to save some space, so this is why I placed them in two columns and several lines.

Aligning the equations with the "=" sign is really ugly in this case.

So what's the best way to present them ?
Post Reply