I'm trying to recreate something similar to this:


Where the numbering is encased inside its own box, and the content in another.

I know I could probably use a table but I was wondering if there is another way, possibly making a custom enumerate environment to accomplish this.

I did find a similar implementation, but it was accomplished by wrapping the item itself which leaves gaps between the items.

Here is some code i've tried, but it doesnt include the vertical line:


  \ifnum#1<10 0\fi

  \item My first item
  \item My second item
  • 1
    Welcome to TeX.SX! It would be great if you could show us what you have tried. Posting a minimal working example that indicates what you are trying to do makes it easier for people to understand what you want. It also makes it easier for people to help you, since they have some code to start from, and hence much more likely that some one will try to help you.
    – user30471
    Commented Mar 1, 2020 at 12:20
  • 2
    Why not use a table? Also, why do this at all? The lines don't add any clarity. Rather, they distract and introduce an unnecessary separation between the item numbers and the item texts.
    – schtandard
    Commented Mar 1, 2020 at 13:36
  • @schtandard I completely agree, unfortunately it is part of a layout request. Commented Mar 1, 2020 at 14:10

2 Answers 2


If your enumeration is long, you can use longtable



  \ifnum\value{justinitem}<10 0\fi\arabic{justinitem}.%

  \begin{longtable}{|>{\justinitem} w{r}{2em}|
  \multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{\bfseries #1} \\



\jitem text for the first item text for the first item 
  text for the first item text for the first item 
  text for the first item text for the first item 
  text for the first item \\
\jitem text for the second item \\



Remember to add \\ at the end of each item.

enter image description here

  • This is perfect! Thank you. Is there a way to remove the prefix/suffix vertical space? EDIT: I found the answer to my question, using: latex \setlength{\LTpre}{0pt} Commented Mar 1, 2020 at 17:48
  • @JustinDalrymple Add, before \begin{longtable}, \setlength{\LTpre}{0pt}\setlength{\LTpost}{0pt}.
    – egreg
    Commented Mar 1, 2020 at 17:55
  • I spoke too soon. I applied that change, but the prefix space remains. I've even tested it on an empty document to make sure other items were not affecting the spacing. hmm... Commented Mar 1, 2020 at 17:59
  • @JustinDalrymple I tested my suggestion and it removes the space; however, 0pt is too small, probably \topsep is a better choice.
    – egreg
    Commented Mar 1, 2020 at 18:02
  • You're correct! The problem was due to something else. Thank you! Commented Mar 1, 2020 at 18:12

I'd suggest using a tabular for the task. In the following example, I have combined the magicrownumber originally from here with your \twodigits command to automatically number the rows in the table. I have also used the calc package in order to calculate the width of the second column to make the whole table fit perfectly into the available text width.

enter image description here



  \ifnum#1<10 0\fi



\begin{tabular}{|@{\makebox[2.5em][r]{\rownumber\space}} | p{\textwidth-2\tabcolsep-2.5em-3\arrayrulewidth}|}
  \gdef\rownumber{\stepcounter{magicrownumbers}\protect\twodigits{\arabic{magicrownumbers}}.} \\
  My first item\\
  My second item\\

  • This is great too! I went with the other answer because I found it more intuitive. Thank you for the help!! Commented Mar 1, 2020 at 17:49

You must log in to answer this question.

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