# Labelling LaTeX sub-equations in org-mode

How to achieve subequation numbering a,b,etc like https://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics#Subordinate_equation_numbering in org-mode. I tried using the LaTeX snippet as it is and surrounding it with

#+BEGIN_SRC latex

#+END_SRC


No success.

Edit:
org-version 9.2
org-latex-default-packages-alist
Value: (("AUTO" "inputenc" t ("pdflatex")) ("T1" "fontenc" t ("pdflatex")) (#1="" "graphicx" t) (#1# "grffile" t) (#1# "longtable" nil) (#1# "wrapfig" nil) (#1# "rotating" nil) ("normalem" "ulem" t) (#1# "amsmath" t) (#1# "textcomp" t) (#1# "amssymb" t) (#1# "capt-of" nil) (#1# "hyperref" nil))
org-version: 9.2 OS: Linux/NixOs
By default the variable org-latex-default-packages-alist
has amsmath. I used just the code provided by @Ian. This is the result for HTML export. https://imgur.com/a/L6HHV7R that I get. PDF export gives the correct result with error mentioned by @NickD. I found some more resources on amsmath http://ctan.imsc.res.in/info/short-math-guide/. Is it possible to get the correct export in HTML.

• What does your org file look like? What does the resulting tex file look like? Edit your question and add them. Feb 2 '19 at 18:28

Your question is a little bit ambiguous - while the snippet in your link provides numbering as (1a), (1b), you ask for specific like (a), (b). Both versions are possible, as below.

To solve, you should check your emacs setting variable org-latex-default-packages-alist for the package amsmath and add:

a) add it if it is not there, in case you use a lot math mode or

b) add it to the header of your org file the line #+LaTeX_HEADER: \usepackage{amsmath}

Be sure you have the org version 9.x

The following code was tested:

Euler not only proved that the series $\sum_{n=1}^{\infty}\frac{1}{n^{2}}$
converges, but also that
\numberwithin{equation}{section}
\begin{subequations}\label{e1}
\begin{align}
\sum\nolimits_{n=1}^{\infty}{\frac{1}{n^{2}}} = \frac{\pi^{2}}{6}\\
\frac{\alpha_{\beta}^{\delta}}{2}
\end{align}
\end{subequations}

\numberwithin{equation}{section}
\begin{align} \frac{\alpha_{\beta}^{\delta}}{2} \end{align}

And now the example from the link:
\begin{subequations}
Maxwell's equations:
\begin{align}
B'&=-\nabla \times E, \tag{a}\\
E'&=\nabla \times B - 4\pi j,\tag{b}
\end{align}
\end{subequations}


Note you do not need to add #+BEGIN_SRC latex #+END_SRC in your org file.

The result is below:

• Can you post your config Feb 2 '19 at 12:50
• i already have amsmath in org-latex-default-packages-alist variable Feb 2 '19 at 15:13
• While I can do that, it will be more useful for you to describe a little bit what really "does not work", eventually what errors do you get - you can check a variable with C-h v followed by the name of that variable.
– Ian
Feb 2 '19 at 15:23
• Type M-x org-version and then edit your question to add the org version. Useful to tag your question with operating system - Win, Linux, OSX.
– Ian
Feb 2 '19 at 15:33
• The subequations environments work fine for me. The equation environment does not: amsmath gives me an error: ! Package amsmath Error: Erroneous nesting of equation structures; (amsmath) trying to recover with 'aligned'. See the amsmath package documentation for explanation. Type H <return> for immediate help. ... l.39 \end{align}. If I change equation to subequations it works. Feb 2 '19 at 18:32