I'm relatively new to TeX and I'm wondering why I'm able to use \begin{enumerate} without importing the package for the article, beamer, and letter document classes. But most users seem to add \usepackage{enumerate}. So I'm wondering if the document class imports these automatically (along with other packages), and if so, how I can tell if the packages are imported to avoid redundancy.
- 203
4 Answers
The enumerate environment is defined by the LaTeX kernel - the set of macros loaded on top of (or in addition to) the base TeX. This kernel is collected as within latex.ltx, and here's the definition of enumerate:
4762: \def\enumerate{%
4763: \ifnum \@enumdepth >\thr@@\@toodeep\else
4764: \advance\@enumdepth\@ne
4765: \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
4766: \expandafter
4767: \list
4768: \csname label\@enumctr\endcsname
4769: {\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}}%
4770: \fi}
4771: \let\endenumerate =\endlist
Note how the enumerate environment is defined using its command or macro format. That is, explicitly defining \enumerate and \endenumerate as being a \list with specific properties.
So, there is no need to load the enumerate package in order to use the enumerate environment; it's just coincidence that the package is named that way. The package provides an optional argument (an extension) to the enumerate environment that allows the user to specify certain formatting options (without having to go through the hassle of virtually redefining the way enumerate works).
If you wish to find out which packages are loaded (either by the document class or by some other loaded package), see Find out which packages are used.
- 603,163
Welcome tex.stackexchange.
The classes that you mentioned in above don't import enumerate package.
This package gives you some facilities to typeset the counter of enumerate environment with desired style. for more details see the package's manual.
As a first example you'll see the following example in the manual:
\begin{enumerate}[EX i.]
\item one one one one one one one
one one one one\label{LA}
\item two
\begin{enumerate}[{example} a)]
\item one of two one of two
one of two\label{LB}
\item two of two
\end{enumerate}
\end{enumerate}
- 2,404
You do not need any packages to use the very standard LaTeX environments lists, namely itemize for bulleted items, enumerate for enumerated items and description for items starting with bold text, that are particular cases of the more general list environment.
These defaults environments could be enough to make any lists in most cases if people were not so picky and finicky, but "c'est la vie, mon ami", so this site is plenty about questions about enumerate, enumitem and some others to change easily list behaviours (as change the label of the item, count in reverse order or running several items per line, etc.)
However, at least at some extent you can also change the standard list formats or create your own type of list without any package. Example:
\documentclass{article}
\begin{document}
\noindent Standard enumerated list:
\begin{enumerate}
\item Item one
\item Item two
\item Item three
\end{enumerate}
Modified enumerated list without packages:
\begin{enumerate}
\renewcommand{\labelenumi}{\alph{enumi})}
\renewcommand{\theenumi}{\Alph{enumi}}
\setlength\itemsep{-1ex}
\setlength\labelwidth{-1cm}
\setlength\labelsep{5ex}
\item Item one
\item Item two
\item Item three
\end{enumerate}
Custom enumerated list:
\newcounter{mycounter}
\begin{list}{\textcircled{\scriptsize\arabic{mycounter}}}%
{\usecounter{mycounter}
\setlength\itemsep{2ex}
\setlength\labelwidth{1em}
\setlength\labelsep{1em}
\setlength\leftmargin{0pt}}
\item Item one
\item Item two
\item Item three
\end{list}
\end{document}
- 80,769
Just for the sake of completeness, the enumerate environment is not available in the standalone document class. This MWE
\documentclass{standalone}
\begin{document}
\begin{enumerate}
\item foo
\end{enumerate}
\end{document}
produces a curious error:
! LaTeX Error: Something's wrong--perhaps a missing \item.See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ...
l.4 \item f oo
But standalone is more for documents that produce diagrams, and enumerate isn't needed.
- 44,937
- 14
- 131
- 195
-
1Note that
\show\enumeratewill demonstrate thatenumerateis defined and so "available". What is not allowed in this class is to haveenumerateas a top level environment; putting it inside e.g.minipagewill work fine.standaloneis looking for "pictures" it can cut out and export. – Andrew Swann Sep 13 '17 at 06:53 -
1Is even more available that in the
minimalclass, where the environment is allowed and the items are showed without error, but without numbers. – Fran Sep 13 '17 at 10:24


enumerateandenumitempackages that enhance the nativeenumerateenvironment,verbatimpackage which enhances theverbatimenvironment, ... etc. – Steven B. Segletes Sep 07 '17 at 03:28enumerateand other similar native environments. The packages are in response to the frequent wishes that "if only it could do this and that more easily..." – Steven B. Segletes Sep 07 '17 at 03:33\usepackage{enumerate}. Ever. I frequently have\usepackage{enumitem}. However, don't load them with Beamer. – cfr Sep 07 '17 at 03:40enumerate,itemize, etc are actually defined in a file calledlatex.ltxwhich is loaded before the document class. Some document classes may overwrite those definition without needing to include any other classes. If you include theenumerateclass explicitly, you overwrite all the previous definitions of the commands. That might be a bad idea, if the class redefinesenumerateto play nicely with some other commands in the class, but theenumerateclass then deletes those changes! – alephzero Sep 07 '17 at 03:50latex.ltxas the definition of "what LaTeX actually is" - for example it defines the\documentclasscommand that you use to at the start of your LaTeX input, and many similar things (it's almost 8,500 lines long, in total!) – alephzero Sep 07 '17 at 04:01