0

I have the following code

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{enumitem}
\usepackage{mathtools}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{examples}[theorem]{Examples}
 \begin{document}
 \begin{examples}\leavevmode
 \begin{enumerate}[label=\upshape(\arabic*),leftmargin=0.75cm]
 \item Item 1
 \item Item 2
 \item Item 3
 \item Item 4
 \item Item 5
 \end{enumerate}
 \end{examples}
 \end{document}

which produces the following output enter image description here

I need to remove the spacing between item 1 of the list and Examples 0.1 but at the same time I want to keep the spacing between the items themselves (that is, I need also to keep the little spacing between item 1, item 2, ... ). How to achieve this?

Also, is there an alternative to move the labels of the items ((1),(2),(3),...) to get precisely under the letter E of Examples 0.1 rather than using the command \leftmargin=0.75cm ?

2
  • 1
    With enumitem: topsep=0pt and labelindent=0pt.
    – jlab
    Apr 2 at 20:24
  • 1
    labelindent=0pt does shift the label to the far left to be aligned under the word Example. topsep=0pt is what I'm looking for regarding the first problem. Apr 2 at 20:26

1 Answer 1

1

The enumitem package has many options. The following picture, taken from the enumitem manual (p. 3) gives some lengths definitions.

enumitem list parameter

As the space before the list is mainly \topsep, use topsep=0pt to remove it.

The key left=<labelindent> .. <leftmargin> is a quicky way to set the position of the label and the position of the text. In your case, use simply left=0pt.

Full example:

\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{enumitem}
\usepackage{mathtools}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{examples}[theorem]{Examples}

\begin{document}

\begin{examples}\leavevmode
  \begin{enumerate}[label=\upshape(\arabic*), topsep=0pt, left=0pt]
   \item Item 1
   \item Item 2
   \item Item 3
   \item Item 4
   \item Item 5
  \end{enumerate}
\end{examples}

\end{document}

enumitem setting

10
  • Unfortunately, I'm using Latex version 3.14159265-2.6-1.40.15 (taken from cmd). When I added left=0pt an error has been shown. Apr 2 at 21:03
  • @HusseinEid What is the version of the enumitem package? You can find it in the log (for example, I have a line with Package: enumitem 2019/06/20 v3.9 Customized lists).
    – jlab
    Apr 2 at 21:09
  • 1
    @HusseinEid Maybe the best is to update your packages. Your distribution is ten years old.
    – jlab
    Apr 2 at 21:15
  • 1
    @HusseinEid Sorry I don't use MikTeX. I can't help you. But your pdflatex version corresponds to TexLive2014. It's pretty old.
    – jlab
    Apr 2 at 21:29
  • 1
    I'd recommend Overleaf until you sort out the local version. If your document is not too long, you should be able to compile it using just a free version. Note there is time limit until you buy subscription.
    – Celdor
    Apr 3 at 10:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .