Let's say I have this list in R Markdown:
1. lorem
1. dolor
1. ipsum
When I compile, the output will be like this:
lorem
dolor
ipsum
I want it to be like this instead:
lorem
1.1 dolor
ipsum
The LaTeX output looks like this:
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item lorem
\begin{enumerate}
\def\labelenumii{\arabic{enumii}.}
\tightlist
\item dolor
\end{enumerate}
\item ipsum
\end{enumerate}
I want it to be like this instead:
\begin{enumerate}
\tightlist
\item lorem
\begin{enumerate}
\tightlist
\item dolor
\end{enumerate}
\item ipsum
\end{enumerate}
In other words, I need it to stop adding \def\labelenumii{\arabic{enumii}.}
.
cderv
June 2, 2022, 9:23am
2
Unfortunately, I don't think this type of list are supported yet by Pandoc which is used for conversion
opened 08:57PM - 15 Sep 14 UTC
enhancement
format:Markdown
reader
This is a request for a markdown extension. I don't believe this is supported in… any other implementation or in CommonMark. However, it seems to make common sense and I believe it is unambiguous. I would like markdown to accept nested decimal lists, like so:
```
1. First item
2. Second Item
2.1. sub-item
2.2. sub-item
```
Right now pandoc doesn't recognize any of the sub-items as list elements.
This would allow nested decimal lists to be readable in both the markdown and the final document. The format of the nested list in the final document would depend on the HTML/LaTeX/etc formatting options, of course, which would only use decimal numbered lists if specified. Pandoc would only need to recognize this as an ordered list, with structure delineated by indentation.
Of course, it is possible to _create_ such lists in markdown now, simply by omitting decimal formatting or using '#.', relying only on indentation to create list structure. However, this makes the markdown LESS readable - one can not easily see the full sub-section identifier in the markdown.
For now you would need to leverage the fancy_list
extension of pandoc which is activated by default
https://pandoc.org/MANUAL.html#extension-fancy_lists
and use #.
as list marker so that you get the default numbering of your format.
#. lorem
#. dolor
#. ipsum
will produce
\begin{enumerate}
\tightlist
\item
lorem
\begin{enumerate}
\tightlist
\item
dolor
\end{enumerate}
\item
ipsum
\end{enumerate}
You can also mixed them as explained in https://pandoc.org/MANUAL.html#extension-startnum
1. lorem
#. dolor
1. ipsum
you could probably change the default numebring for your list using a header preamble for you latex document using header-includes
Hope it helps
1 Like
Thanks that's exactly what I needed. #.
does exactly what I want. As for the decimal nested list, it's easy. All you have to do is this:
\usepackage{enumitem}
\renewcommand{\labelenumii}{\arabic{enumi}.\arabic{enumii}.}
1 Like
system
Closed
June 9, 2022, 1:52pm
4
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.