Text FormattingUsing enumerate package with [1]

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
latexforever
Posts: 120
Joined: Fri Nov 14, 2008 9:40 pm

Using enumerate package with [1]

Post by latexforever »

Hello,

I would like to use the enumerate package to have such an output:

[1]: My first item,
[2]: My second item.

Inferring its manual (http://www.dd.chalmers.se/latex/Docs/PDF/enumerate.pdf), I would use such a partial code:

Code: Select all

\begin{enumerate}[[1]:]
\item My first item,
\item My second item.
\end{enumerate}
It does not work. I tried

Code: Select all

\begin{enumerate}[{[}1{]:}]
\item My first item,
\item My second item.
\end{enumerate}
with no success too.

Any suggestion would be much appreciated.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

Using enumerate package with [1]

Post by Stefan Kottwitz »

Hi Luca,

the second code

Code: Select all

\begin{enumerate}[{[}1{]:}]
worked for me as well as

Code: Select all

\begin{enumerate}[{[1]:}]
Stefan
LaTeX.org admin
latexforever
Posts: 120
Joined: Fri Nov 14, 2008 9:40 pm

Re: Using enumerate package with [1]

Post by latexforever »

Thanks for your answer, Stefan. That is possible that I made a typo when trying locally. It now works.

Is there a preferred (in the sense of the enumerate package, not in our sense) form?

Thanks.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

Using enumerate package with [1]

Post by Stefan Kottwitz »

Hi Luca,
latexforever wrote:Is there a preferred (in the sense of the enumerate package, not in our sense) form?
regarding the enumerate-package, I don't see a reason to prefer a certain form as long as it's working.
But in general and in my opinion I would be careful when grouping by {...} to avoid changes in the kerning between characters, that's why I often prefer to use {word} instead of {w}ord for instance when I want to protect the first letter in this case.

Stefan
LaTeX.org admin
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Using enumerate package with [1]

Post by gmedina »

You can also use the enumitem package:

Code: Select all

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\begin{enumerate}[label={[}\arabic*{]}:]
  \item first item.
  \item second item.
\end{enumerate}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
latexforever
Posts: 120
Joined: Fri Nov 14, 2008 9:40 pm

Using enumerate package with [1]

Post by latexforever »

gmedina wrote:You can also use the enumitem package:

Code: Select all

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\begin{enumerate}[label={[}\arabic*{]}:]
  \item first item.
  \item second item.
\end{enumerate}

\end{document}
Pretty good! I will check it too. Thanks.

Stefan_K wrote:Hi Luca,
latexforever wrote:Is there a preferred (in the sense of the enumerate package, not in our sense) form?
regarding the enumerate-package, I don't see a reason to prefer a certain form as long as it's working.
But in general and in my opinion I would be careful when grouping by {...} to avoid changes in the kerning between characters, that's why I often prefer to use {word} instead of {w}ord for instance when I want to protect the first letter in this case.
Ok. Thanks.
rf
Posts: 21
Joined: Mon Jul 20, 2009 5:27 pm

Using enumerate package with [1]

Post by rf »

if you have

Code: Select all

\let\lbrack[
\let\rbrack]
and then

Code: Select all

\begin{enumerate}[\lbrack1{\rbrack:}]
you get the correct result.

tex doesn't do bracket matching, so there's a lot of requests like
this :-(
latexforever
Posts: 120
Joined: Fri Nov 14, 2008 9:40 pm

Re: Using enumerate package with [1]

Post by latexforever »

Thanks.
Post Reply