Math & ScienceAligned subequations

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
carwe
Posts: 2
Joined: Mon Nov 02, 2009 6:35 pm

Aligned subequations

Post by carwe »

Hi!

I want to achieve the following visual output:

Code: Select all

  nameeee_a := expr1a    = expppr2a  (2.1a)
  name_b    := exppppr1b = expr2b    (2.1b)
...and I want it to be centered like the rest of my equations. I want subnumbers of the two lines *and* I want aligment both at the := and the = symbols. I don't wish any excess spacings but rather the two equations written as compact as possible in the middle of the page.

I've read amsldoc and tried e.g. nesting aligned and subequation environments in different order, but I either get error messages or something else than the desired output.

One of my tries is the following code:

Code: Select all

\begin{equation*}
  \begin{subequations} \label{ab}	
    \begin{aligned}
      name_a &:= expr1a &= expr2a \label{a} \\
      name_b &:= expr1b &= expr2a \label{b}
    \end{aligned}
  \end{subequations}
\end{equation*}
...which looks OK but doesn't print any labels and also generates error messages about multiple \label's.

Using alginedat resulted in the equations not being centered but rather left-aligned on the page.

I see that I probably haven't understood how the different environments can be nested but I just don't find information about that in the documentation.

Could someone help me out?
Thanks.

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Aligned subequations

Post by localghost »

Starred versions of displayed math environments always result in unnumbered equations. Try the following.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{amsmath}

\begin{document}
  \begin{subequations}\label{eqn:main}
    \begin{alignat}{2}
      name_a &:= expr1a &&= expr2a \label{subeqn:a} \\
      name_b &:= expr1b &&= expr2a \label{subeqn:b}
    \end{alignat}
  \end{subequations}
\end{document}
For more information refer to the amsmath manual or to the »Math mode« document.


Best regards and welcome to the board
Thorsten¹
carwe
Posts: 2
Joined: Mon Nov 02, 2009 6:35 pm

Re: Aligned subequations

Post by carwe »

Thanks alot! I did what you say and it works the way I want. Thank you!
Post Reply