4

In the article class I have this section of code

\if@twocolumn
  \setlength\leftmargini  {2em}
\else
  \setlength\leftmargini  {2.5em}
\fi
\leftmargin  \leftmargini
\setlength\leftmarginii  {2.2em}
\setlength\leftmarginiii {1.87em}
\setlength\leftmarginiv  {1.7em}
\if@twocolumn
  \setlength\leftmarginv  {.5em}
  \setlength\leftmarginvi {.5em}
\else
  \setlength\leftmarginv  {1em}
  \setlength\leftmarginvi {1em}
\fi
\setlength  \labelsep  {.5em}
\setlength  \labelwidth{\leftmargini}
\addtolength\labelwidth{-\labelsep}
\@beginparpenalty -\@lowpenalty
\@endparpenalty   -\@lowpenalty
\@itempenalty     -\@lowpenalty
\renewcommand\theenumi{\@arabic\c@enumi}
\renewcommand\theenumii{\@alph\c@enumii}
\renewcommand\theenumiii{\@roman\c@enumiii}
\renewcommand\theenumiv{\@Alph\c@enumiv}
\newcommand\labelenumi{\theenumi.}
\newcommand\labelenumii{(\theenumii)}
\newcommand\labelenumiii{\theenumiii.}
\newcommand\labelenumiv{\theenumiv.}
\renewcommand\p@enumii{\theenumi}
\renewcommand\p@enumiii{\theenumi(\theenumii)}
\renewcommand\p@enumiv{\p@enumiii\theenumiii}
\newcommand\labelitemi{\textbullet}
\newcommand\labelitemii{\normalfont\bfseries \textendash}
\newcommand\labelitemiii{\textasteriskcentered}
\newcommand\labelitemiv{\textperiodcentered}

that set the margins and type of items for the diferent list environments.

How can I modify this to obtain a first margin item equal to 0pt?

4
  • 2
    Why do you want to work at such level. The package enumitem offers a very user friendly way to set lists. May 31, 2012 at 19:51
  • Because I'm creating a new class from article class.
    – osjerick
    May 31, 2012 at 19:57
  • Than have a look at the package layouts. It prints all length of the list environment. Based on this information you can manipulate the elements. May 31, 2012 at 19:59
  • 2
    @osjerick Nothing prevents using enumitem to define list environments in a class.
    – egreg
    May 31, 2012 at 20:40

2 Answers 2

7

To setup a list whether in an own document class, package or in the preamble I recommend the package enumitem which is really flexible.

If you avoid such package your must consult the reference manual source2e

Every environment like enumerate or itemize based on the environment list. The linked reference manual explained the length.

To visualize the length of the current environment you can use the package layouts which produced the following output:

enter image description here

Here the MWE which produced the picture above.

\documentclass[varwidth,border=10,convert]{standalone}
\usepackage{layouts}

\begin{document}
\drawdimensionstrue
\listdiagram
\end{document}
2

Would this suit your needs? It sets the left margin to 0pt, meaning that the bullet or number goes into the margin. Aligning the bullet/number with the margin would be trickier (though perhaps a package can do it for you, I don't know).

\setlength\leftmargini{0em}

A MWE would then be something like:

\documentclass{article}

\setlength\leftmargini{0em}

\usepackage{lipsum}

\begin{document}

\lipsum[1]

\begin{enumerate}
\item My list 1
\item My list 2
\begin{enumerate}
    \item My nested item
\end{enumerate}
\end{enumerate}

\lipsum[2]

\begin{itemize}
\item My list 1
\end{itemize}

\lipsum[3]

\begin{description}
\item[Label] My list 1
\end{description}

\end{document}

You must log in to answer this question.

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