chirun-ncl / chirun

A Python package providing the command line interface for building flexible and accessible content with Chirun.
https://chirun.org.uk/
Other
29 stars 4 forks source link

LaTeX enumerate sub-items are default numbers not letters #235

Open prowlett opened 5 months ago

prowlett commented 5 months ago

I have this code with nested enumerate items.

\documentclass{article}
\begin{document}
\begin{enumerate}
    \item First
    \item Second
        \begin{enumerate}
            \item A part
            \item Another part
        \end{enumerate}
    \item Third
\end{enumerate}
\end{document}

The PDF output looks like this:

List. Item 2 has sub items a and b

But the HTML output looks like this:

List. Item 2 has sub items 1 and 2

Can it be that the HTML version has sub-items (a), (b) and so on, like the LaTeX output does? I'd prefer if the two are the same (students have got confused because I referred to 2c) and I prefer letters to be the default because it matches LaTeX and I think having 1, 2, etc. within an already numbered list is inherently confusing.

The HTML produced is like this:

         <ol class="enumerate" id="a0000000002">
<li id="a0000000003" value="1">
<p>
First 
</p>
</li>
<li id="a0000000004" value="2">
<p>
Second 
</p>
<ol class="enumerate" id="a0000000005">
<li id="a0000000006" value="1">
<p>
A part 
</p>
</li>
<li id="a0000000007" value="2">
<p>
Another part 
</p>
</li>
</ol>
</li>
<li id="a0000000008" value="3">
<p>
Third 
</p>
</li>
</ol>

so I guess list a0000000005 doesn't know it is inside an already running numbered list.

I can get around this by using the LaTeX package enumerate and instructing it to do what LaTeX already does by default.

\documentclass{article}
\usepackage{enumerate}
\begin{document}
\begin{enumerate}
    \item First
    \item Second
        \begin{enumerate}[(a)]
            \item A part
            \item Another part
        \end{enumerate}
    \item Third
\end{enumerate}
\end{document}

This produces

HTML version with sub-items (a) and (b)

This is broadly fine, but calling an unnecessary package and remembering to do this is an extra overhead.