LaTeX forum ⇒ Text FormattingUsing enumerate package with [1]

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

Using enumerate package with [1]

Postby latexforever » Mon Sep 14, 2009 11:25 am

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:

  1. \begin{enumerate}[[1]:]
  2. \item My first item,
  3. \item My second item.
  4. \end{enumerate}


It does not work. I tried

  1. \begin{enumerate}[{[}1{]:}]
  2. \item My first item,
  3. \item My second item.
  4. \end{enumerate}

with no success too.

Any suggestion would be much appreciated.

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

Postby Stefan Kottwitz » Mon Sep 14, 2009 1:24 pm

Hi Luca,

the second code
  1. \begin{enumerate}[{[}1{]:}]

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

Stefan
LaTeX.org admin

latexforever
Posts: 120
Joined: Fri Nov 14, 2008 9:40 pm

Postby latexforever » Mon Sep 14, 2009 1:37 pm

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: 9560
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Mon Sep 14, 2009 1:44 pm

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

Postby gmedina » Mon Sep 14, 2009 1:46 pm

You can also use the enumitem package:

  1. \documentclass{article}
  2. \usepackage{enumitem}
  3.  
  4. \begin{document}
  5.  
  6. \begin{enumerate}[label={[}\arabic*{]}:]
  7. \item first item.
  8. \item second item.
  9. \end{enumerate}
  10.  
  11. \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

Postby latexforever » Mon Sep 14, 2009 1:50 pm

gmedina wrote:You can also use the enumitem package:

  1. \documentclass{article}
  2. \usepackage{enumitem}
  3.  
  4. \begin{document}
  5.  
  6. \begin{enumerate}[label={[}\arabic*{]}:]
  7. \item first item.
  8. \item second item.
  9. \end{enumerate}
  10.  
  11. \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

Postby rf » Mon Sep 14, 2009 1:54 pm

if you have
  1. \let\lbrack[
  2. \let\rbrack]

and then
  1. \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

Postby latexforever » Mon Sep 14, 2009 5:40 pm

Thanks.


Return to “Text Formatting”

Who is online

Users browsing this forum: No registered users and 1 guest