10

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.

  • 2
    A package may provide totally new set of commands, or it may provide enhanced versions of existing [native] commands. Examples of the latter variety are the enumerate and enumitem packages that enhance the native enumerate environment, verbatim package which enhances the verbatim environment, ... etc. – Steven B. Segletes Sep 7 '17 at 3:28
  • @StevenB.Segletes ah, this makes sense! Thank you! So therefore enumerate and other environments are indeed included in every document class? – rb612 Sep 7 '17 at 3:31
  • 1
    I believe so, in the case of enumerate and 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 7 '17 at 3:33
  • 1
    I never say \usepackage{enumerate}. Ever. I frequently have \usepackage{enumitem}. However, don't load them with Beamer. – cfr Sep 7 '17 at 3:40
  • 5
    ... In fact, you can think oflatex.ltx as the definition of "what LaTeX actually is" - for example it defines the \documentclass command 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 7 '17 at 4:01
14

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.

7

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}

enter image description here

7

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 run­ning sev­eral 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:

mwe

\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}
1

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.

  • 1
    Note that \show\enumerate will demonstrate that enumerate is defined and so "available". What is not allowed in this class is to have enumerate as a top level environment; putting it inside e.g. minipage will work fine. standalone is looking for "pictures" it can cut out and export. – Andrew Swann Sep 13 '17 at 6:53
  • 1
    Is even more available that in the minimal class, where the environment is allowed and the items are showed without error, but without numbers. – Fran Sep 13 '17 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.