Search code examples
latex

Redefining environment trouble


I'm trying to renew the "enumerate" environment so that there is a bracket instead of a dot after the number. Actually here is the code:

\documentclass[a4paper, 14pt]{extarticle}
\usepackage{amsfonts, amsmath, amssymb, amsthm}
\usepackage{enumitem}
\usepackage[top = 1.5cm, right = 1.5cm, bottom = 1.5cm, left = 1.5cm]{geometry}
\usepackage{mathtools} % DeclarePairedDelimiter
\usepackage{nomencl}
\let\originalenumerate\enumerate
\renewenvironment{enumerate}{\begin{originalenumerate}[label={$\left.\arabic*\right)$}]}{\end{originalenumerate}\\}
\newtheorem{theorem}{Theorem}
\newtheorem*{corollary*}{Corollary}
\begin{document}
\section*{Theorems}
\begin{theorem}
Let
\begin{enumerate}
\item Condition 1,
\item Condition 2,
\item Condition 3,
\end{enumerate}
then assertion.
\end{theorem}
\begin{proof}
Proof.
\end{proof}
\end{document}

This raises a trouble whose solution I can’t google: the last item always moves to the left.

enter image description here

There is one more nuisance - if I don't write \\ after \end{originalenumerate} there will be no line break.

How can I solve these troubles?


Solution

  • The problem is caused by the fact that you just store the code for the original start of enumerate, but not \endenumerate, which means that \end{originalenumerate} does not really do anything. Also writing \\ anywhere outside a tabular environment is nearly always wrong and in your case it causes an error if one would properly store the end of enumerate with \let\endoriginalenumerate\endenumerate.

    Anyway, much simpler than redefining the enumerate environment, you can use \setlist{label={$\left.\arabic*\right)$}

    \documentclass[a4paper, 14pt]{extarticle}
    \usepackage{amsfonts, amsmath, amssymb, amsthm}
    \usepackage{enumitem}
    \usepackage[top = 1.5cm, right = 1.5cm, bottom = 1.5cm, left = 1.5cm]{geometry}
    \usepackage{mathtools} % DeclarePairedDelimiter
    \usepackage{nomencl}
    
    \setlist{label={$\left.\arabic*\right)$}   
    
    \newtheorem{theorem}{Theorem}
    \newtheorem*{corollary*}{Corollary}
    \begin{document}
    \section*{Theorems}
    \begin{theorem}
    Let
    \begin{enumerate}
    \item Condition 1,
    \item Condition 2,
    \item Condition 3,
    \end{enumerate}
    then assertion.
    \end{theorem}
    \begin{proof}
    Proof.
    \end{proof}
    \end{document}