0

So, I'm using LaTeX for my math homework and I'm having trouble with figuring out enumerate in Overleaf. Right now what I'm trying to do is write an answer that is centered, but I can't figure out how to do it without centering the question number, which I don't want to do.

Problematic code:

\documentclass{article}

\usepackage{enumitem}

\begin{document} \begin{enumerate} \item \begin{center} $math$ \end{center} \end{enumerate}

\end{document}

Is there any way of getting around this? Thanks in advance!

Bernard
  • 271,350
tcb93
  • 167

2 Answers2

0

Use display math (enclose in \[ and \]):

\documentclass{article}

\usepackage{enumitem}

\begin{document} \begin{enumerate} \item [ math ] \end{enumerate}

\end{document}

enter image description here

DG'
  • 21,727
0

If you want the maths be on the same line as the enumerate number, you can do it with a simple \makebox:

    \documentclass{article}
    \usepackage{amsmath}
    \usepackage{enumitem}
\begin{document}

The formula for the solution of the quadratic equation $\,ax^2 + bx + c = 0\,$:
\begin{enumerate}
\item \makebox[\linewidth]{$x = \dfrac{-b\pm\sqrt{b^2-4ac}}{{2a}}$}
\end{enumerate}

\end{document} 

enter image description here

Bernard
  • 271,350
  • So this works, but is there any way to control the horizontal spacing the box creates after it? Since it's different from the spacing between other lines – tcb93 Jun 23 '22 at 16:48
  • @tcb93: The only way I can see for thr horizontal spacing is to try adding an \hspace{some length}, because by default the content of an \makebox is centred in the box. – Bernard Jun 23 '22 at 16:53