How to Prevent Pandoc From Forcing Lists to be Arabic

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:


  1. lorem
    1. dolor
  2. ipsum

I want it to be like this instead:


  1. lorem
    1.1 dolor
  2. 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}.}.

Unfortunately, I don't think this type of list are supported yet by Pandoc which is used for conversion

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

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.