# Preserving equation alignment through nested enumerate blocks

I would like to write something similar to a maths exam paper, with subquestions (labelled a, b, c, etc.) to each question (labelled 1, 2, 3, etc.). Like the picture below, each subquestion would be on a new line and the labels would share the same indentation level. They would have a bit of introductory text, followed by some equations (which will contain = symbols).

Unlike the picture, however, I would like to have all the = signs line up throughout the document.

I have tried to combine enumerate and align blocks in various ways, with no success. How would I achieve such a result?

• Welcome to TeX.SE! Can you please show us the code you tried so far? – Mensch Apr 28 at 17:22
• Do you think such an alignment would be semantically meaningful? – Bernard Apr 28 at 17:27

As @Bernard has already pointed out in a comment, aligning all equations, across \items, on the first occurrence of an = symbol may not be semantically meaningful.

A simpler, and aesthetically probably more appealing, approach would be to start all displayed equations offset by a fixed width from the left-hand margin. This may be achieved by loading the amsmath package with the option fleqn.

If you don't want to offset all displayed equations by fixed amount from the left-hand margin, but only those in an enumerate environment, don't specify the fleqn option. Instead, as @Bernard has also pointed out, load the nccmath package and "wrap" the [...\] chunks in \begin{fleqn}[2em] and \end{fleqn} statements. In case you're curious: the [2em] option is there to provide a fixed horizontal offset in the amount of 2em (equal to \qquad). If you don't want an offset at all, i.e., if the equations should start flush with the left-hand edge, just omit the [2em] option.

\documentclass{article}
\usepackage[fleqn]{amsmath}
\renewcommand{\familydefault}{\sfdefault} % optional
\usepackage{enumitem}
\setlist[enumerate,1]{label=\textbf{\arabic*}}
\setlist[enumerate,2]{label=\textbf{(\alph*)}}

\begin{document}

\begin{enumerate}[start=7]
\item
\begin{enumerate}
\item By writing $\sec x =(\cos x)^{-1}$, use the chain rule \dots
$\frac{\mathrm{d}y}{\mathrm{d}x}=\sec x\tan x$
\hfill{\bfseries[2 marks]}
\item The function $f$ is defined by
$f(x)=2\tan x-3\sec x,\quad\text{for}\quad 0<x<\frac{\pi}{2}$
Find the value of the $y$-coordinate of the stationary point
of the graph of $y=f(x)$, giving \dots
\par\hfill{\bfseries[6 marks]}
\end{enumerate}
\end{enumerate}
\end{document}

• Maybe it's worth mentioning that, if one wants to offset all equations by a fixed width only in an enumeration, and centre ‘normal’ equations, it is possible to use the fleqn environment. – Bernard Apr 28 at 18:23
• @Bernard - Many thanks for this suggestion. I'll add it to the body of the answer. – Mico Apr 28 at 18:28