`Problem with enumerate

#enumerateitemizelistsmarginsnumber

So I have been having issues with the enumerate command on my document.

It initially works fine until I add a margin then it does this weird thing where It completely forgets about the previous numbers and start organizing the items with numbers resulting of how many 'i' is In the word margin.

Here is an example with itemize and enumerate in the same document page.

\noindent The following four transformation parameters are known as the DH parameters:
\begin{itemize}[leftmargin=3cm]
    \item \boldsymbol{d}: offset along previous $z$ to the common normal
    \item \boldsymbol{\theta}: angle about previous $z$, from old $x$ to new $x$.
    \item \boldsymbol{r}: length of the common normal (aka $a$, but if using this notation, do not confuse with $\alpha$ ). Assuming a revolute joint, this is the radius about previous $z$.
    \item \boldsymbol{\alpha} : angle about common normal, from old z axis to new $z$ axis.
\end{itemize}\newline

In summary, the reference frames are laid out as follows:
\begin{enumerate}[leftmargin=3cm]
    \item the $z$-axis is in the direction of the joint axis.
    \item the $x$-axis is parallel to the common normal: $x_{n}=z_{n}\times z_{n-1}$ (or away from zn-1)
If there is no unique common normal (parallel $z$ axes), then $d$ (below) is a free parameter. The direction of $x_{n}$ is from $z_{{n-1}}$ to $z_{n}$, as shown in the video below.
    \item the $y$-axis follows from the $x$- and $z$-axis by choosing it to be a right-handed coordinate system.
\end{enumerate}

This is how it looks:

Wrong one

If I remove the [leftmargin=3cm] from the enumerate it works fine but without a margin.
This is how it looks:
normal working one
I'm pretty new to Latex so I don't really know how to fix it but I know it's a package error or a definition error somewhere in my document that I need to adjust.

I could use all the help I can get.

Thank you very much.

Best Answer

You did not show the code causing the error but I would guess you have

\documentclass{article}

\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{enumerate}
\begin{document}

\noindent The following four transformation parameters are known as the DH parameters:
\begin{itemize}[leftmargin=3cm]
    \item $\boldsymbol{d}$: offset along previous $z$ to the common normal
    \item $\boldsymbol{\theta}$: angle about previous $z$, from old $x$ to new $x$.
    \item $\boldsymbol{r}$: length of the common normal (aka $a$, but if using this notation, do not confuse with $\alpha$ ). Assuming a revolute joint, this is the radius about previous $z$.
    \item $\boldsymbol{\alpha}$ : angle about common normal, from old z axis to new $z$ axis.
\end{itemize}%no!!\newline

In summary, the reference frames are laid out as follows:
\begin{enumerate}[leftmargin=3cm]
    \item the $z$-axis is in the direction of the joint axis.
    \item the $x$-axis is parallel to the common normal: $x_{n}=z_{n}\times z_{n-1}$ (or away from zn-1)
If there is no unique common normal (parallel $z$ axes), then $d$ (below) is a free parameter. The direction of $x_{n}$ is from $z_{{n-1}}$ to $z_{n}$, as shown in the video below.
    \item the $y$-axis follows from the $x$- and $z$-axis by choosing it to be a right-handed coordinate system.
\end{enumerate}

\end{document}

which generates errors starting with

! Undefined control sequence.
\enit@endenumerate ->\enit@after 
                                 \endlist \ifx \enit@series \relax \else \if...
l.22 \end{enumerate}
                    
? 

but if you scroll past the errors produces

enter image description here

remove the enumerate package and just use enumitem here.

In general never ignore errors, the PDF is not intended to be usable after an error.

enumerate is incompatible with enumitem as they both provide an optional argument to control the lable, but enumerate does not use a key-value list but uses a "template" where i denotes roman numbers, 1 denotes arabic, etc so

enter image description here

is produced from

\documentclass{article}

\usepackage{amsmath}

\usepackage{enumerate}
\begin{document}

\noindent The following four transformation parameters are known as the DH parameters:
\begin{itemize}
    \item $\boldsymbol{d}$: offset along previous $z$ to the common normal
    \item $\boldsymbol{\theta}$: angle about previous $z$, from old $x$ to new $x$.
    \item $\boldsymbol{r}$: length of the common normal (aka $a$, but if using this notation, do not confuse with $\alpha$ ). Assuming a revolute joint, this is the radius about previous $z$.
    \item $\boldsymbol{\alpha}$ : angle about common normal, from old z axis to new $z$ axis.
\end{itemize}%no!!\newline

In summary, the reference frames are laid out as follows:
\begin{enumerate}[\bfseries i)]
    \item the $z$-axis is in the direction of the joint axis.
    \item the $x$-axis is parallel to the common normal: $x_{n}=z_{n}\times z_{n-1}$ (or away from zn-1)
If there is no unique common normal (parallel $z$ axes), then $d$ (below) is a free parameter. The direction of $x_{n}$ is from $z_{{n-1}}$ to $z_{n}$, as shown in the video below.
    \item the $y$-axis follows from the $x$- and $z$-axis by choosing it to be a right-handed coordinate system.
\end{enumerate}

\end{document}

See

What's the difference between the enumerate and enumitem packages?

Related Question