Text Formatting ⇒ How to make equations within enumerate centered on page
How to make equations within enumerate centered on page
https://www.overleaf.com/read/mmgsmbfymmqk#1ee955
How do I make the equation center to the page.
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
- Stefan Kottwitz
- Site Admin
- Posts: 10358
- Joined: Mon Mar 10, 2008 9:44 pm
Re: How to make equations within enumerate centered on page
there was no quick answer, perhaps because the code was not included here. Very good that you made an example, but please post it as code here in the forum, instead of an Internet link to some external service.
If you embed an equation within an enumerate list, it gets centered in this list. To center it outside of the list, on the page, it shouldn't be within the list. Luckily you can suspend and resume a list for such a purpose, with the

Code: Select all
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\begin{equation}
x = 1
\end{equation}\begin{enumerate}
\item Text
\item More text
\end{enumerate}
\begin{equation}
y = 1
\end{equation}
\begin{enumerate}[resume]
\item Text
\end{enumerate}
\end{document}
Re: How to make equations within enumerate centered on page
I have a follow up question. The method works great until I start nesting enumerated lists. If I try to resume twice, it does not work. I have written the following code, which does work, but is very clunky. I tried to make an environment, but was unsuccessful because I want to have \end statements before \begin statements, as I want to \end an environment outside of this custom environment. Any suggestions on how to do this, or if a different solution is better for what I want?
Code: Select all
\documentclass{article}
\usepackage{amsmath}
\usepackage{enumitem}
\begin{document}
\begin{equation*}
x = 1
\end{equation*}
\newcounter{outer}
\newcounter{inner}
\begin{enumerate}
\item Outer 1
\setcounter{outer}{\value{enumi}}
\begin{enumerate}
\item item a
\item item b
% Ideally would have environment or another tool to not have all of this code every time I want a centered equation
\setcounter{inner}{\value{enumii}}
\end{enumerate}
\end{enumerate}
\vspace{-1em}
\begin{align*}
x=1
\end{align*}
\begin{enumerate}
\item[]
\setcounter{enumi}{\value{outer}}
\begin{enumerate}
\setcounter{enumii}{\value{inner}}
% End equation code
\item item c
\end{enumerate}
\item Outer 2
\end{enumerate}
\end{document}
- Stefan Kottwitz
- Site Admin
- Posts: 10358
- Joined: Mon Mar 10, 2008 9:44 pm
Re: How to make equations within enumerate centered on page
Stefan