r-markdownpandoc

Is there a limit to how many nested lists you can have within a Roman numbered list in Rmarkdown?


I want to create a numbered list with Roman Numerals. Within each item, I want a nested numbered list with Arabic numerals. Such as:

I. The first item
    1. The first subitem
II. The second item
    1. The second subitem

When I try doing so in Rmarkdown (please see minimal example and output below), it works fine for the first nested list but breaks down for the second. Why? Is there a fix for this?

Edit: I edited my example to show that it also works fine when the outer list is with Arabic numbers. It only breaks down when the outer list is numbered with Roman numerals.

Minimal example

---
title: Minimal Example 
output: html_document
---

The first list (works fine):

I.  The first item

II.  The second item

Second list:

I.  The first item

    1.  The first subitem

II.  The second item

    1.  The second subitem

For comparison, a third list, only with Arabic numbers (works fine):

1.  The first item

    1.  The first subitem

2.  The second item

    1.  The second subitem

Output

Screenshot showing that the first and third lists are formatted fine; in the second list, the first subitem is formatted fine but the second subitem is not formatted as a list at all.


Solution

  • As I already mentioned in my comment there is a space too many or a space to less. (; Whether you use spaces or tabs and even when obeying the four space rule you to have to ensure that the numeral for the sublist starts in the same column as (or is aligned with) the content of the top list item or to the right of it, i.e. in the non-working case 1. The second subitem starts to the "left" of The second item.

    ---
    title: Minimal Example 
    output: html_document
    ---
    
    The first list (works fine):
    
    I.  The first item
    
    II.  The second item
    
    Second list:
    
    I.  The first item
    
        1.  The first subitem
    
    II.  The second item (Does not work)
    
        1.  The second subitem
    
    II.   The second item (Does work)
    
          1.  The second subitem
        
    II.   The second item (Does work)
    
            1.  The second subitem
    
    For comparison, a third list, only with Arabic numbers (works fine):
    
    1.  The first item
    
        1.  The first subitem
    
    2.  The second item
    
        1.  The second subitem
    

    enter image description here