## LaTeX forum ⇒ Text Formatting ⇒ Overlapping Numbers in Enumerate Environment Topic is solved

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
JRTsu
Posts: 2
Joined: Tue Jul 17, 2018 10:03 pm

### Overlapping Numbers in Enumerate Environment

Hi!

Something very peculiar is happening in a TeX document I'm typing.

The relevant packages I'm using are xcolor, mdframed, amsthm, and enumerate.

Below is a minimal working example which shows the error I'm seeing:

\documentclass{report}[12pt]

\usepackage{xcolor,mdframed,amsthm,enumerate}

\newtheorem{alg}{{\color{black}{Algorithm}}}[section]

\begin{document}

\begin{mdframed}[backgroundcolor=yellow!10,linewidth=1.5pt]
\begin{alg} {{\textbf{(Algorithm Name)}}}
\begin{enumerate}
\item First item
\item Second item
\item Third item
\end{enumerate}
\end{alg}
\end{mdframed}

\end{document}

When I compile it, the first item doesn't get a number, and the second item gets both labels 1 and 2, then the third item (and onwards) is labelled correctly.

I'm also attaching a picture of what I see.

If I remove the algorithm lines only, everything works (I just don't have my algorithm environment). If I remove just the mdframed lines only, everything works (I just don't get my box and colour). So, I can only assume there's some weird interaction between mdframed and amsthm?

I haven't tried replacing mdframed with a different boxing/colouring package, but I'd be hesitant to do so. I'm typing lecture notes, and I was planning on using the mdframed package throughout to box important theorems, etc. I particularly like mdframed because of the way it wraps between pages (something fbox, etc., doesn't seem to do). However, if there is an functionally equivalent package to mdframed, then I'd be happy to give that a try!

Any help would be greatly appreciated.

Jonathan
Attachments
Strange.png (8.99 KiB) Viewed 555 times

Tags:

Stefan Kottwitz
Posts: 9244
Joined: Mon Mar 10, 2008 9:44 pm
Hi Jonathan,

welcome to the forum!

It works with standard theorems, without changing the syntax. Once amsthm is removed, it works fine. Maybe you can work without it? No feature of it is needed in the code example.

By the way, tcolorbox is a pretty nice and comprehensive alternative way of making boxes.

Stefan

JRTsu
Posts: 2
Joined: Tue Jul 17, 2018 10:03 pm
Hi Stefan,

Wonderful! That worked perfectly -- Thanks so much!