Math & ScienceSubequations within Align/Gather environment

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
davidnsibs
Posts: 2
Joined: Wed Jan 19, 2011 3:24 pm

Subequations within Align/Gather environment

Post by davidnsibs »

Hello,

I'm trying to have the situation as below:

my first equation ... (1)
my second equation .. (2)
my third equation ... (3a)
my fourth equation .. (3b)
my fifth equation ... (4)

and would like these all in the same align environment so as to not require the need to manually remove whitespace.

Obviously one 'solution' is
\begin{align}
first equation\\
second equation
\end{align}
\begin{subequations}
\begin{align}
third equation\\
fourth equation
\end{align}
\end{subequations}
\begin{align}
fifth equation
\end{align}

but as mentioned, this is not desirable as the whitespace would need to be played around with. Is there a known way to include subequations inside align tags?

Many thanks
Last edited by davidnsibs on Thu Jan 20, 2011 12:09 pm, edited 1 time in total.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

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

Subequations within Align/Gather environment

Post by frabjous »

I'd probably define some commands of my own, perhaps something like this?

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\newcounter{subeq}
\renewcommand{\thesubeq}{\theequation\alph{subeq}}
\newcommand{\newsubeqblock}{\setcounter{subeq}{0}\refstepcounter{equation}}
\newcommand{\mysubeq}{\refstepcounter{subeq}\tag{\thesubeq}}

\begin{document}
\begin{align}
1+1&=2\\
2+2&=4\\
\newsubeqblock
\mysubeq 3+3&=6 \\
\mysubeq 3+3&=4+2  \\
4+4&= 8
\end{align}
\end{document}
subeq.png
subeq.png (2.88 KiB) Viewed 8662 times
davidnsibs
Posts: 2
Joined: Wed Jan 19, 2011 3:24 pm

Re: Subequations within Align/Gather environment

Post by davidnsibs »

That is fantastic, thank you!
koala102938
Posts: 1
Joined: Wed Feb 26, 2014 4:54 am

Re: Subequations within Align/Gather environment

Post by koala102938 »

Yes, this is very good! Thank you, frabjous!

How can you label a complete subeqblock? Something like the following (that doesn't work):

\begin{document}
\begin{align}
1+1&=2\\
2+2&=4\\
\newsubeqblock\label{eq:block}
\mysubeq 3+3&=6 \\
\mysubeq 3+3&=4+2 \\
4+4&= 8
\end{align}
\end{document}

This is reference to a complete subeqblock \eqref{eq:block}
Post Reply