Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

! LaTeX Error: Too deeply nested (lists more than 6 levels deep) #2922

Open
dumblob opened this issue May 16, 2016 · 16 comments
Open

! LaTeX Error: Too deeply nested (lists more than 6 levels deep) #2922

dumblob opened this issue May 16, 2016 · 16 comments

Comments

@dumblob
Copy link

dumblob commented May 16, 2016

This is already a long-living issue (there has been discussions [1] [2] quite a while ago about this), but because it's still not solved (the hack mentioned in [1] obviously doesn't work when not working with markdown or when just converting random documents to PDF) and because I could not find any existing issue here on GitHub, I'm creating one.

I fully understand and even more agree with the rule to make pandoc PDF export work even with the texlive-latex-base debian package and therefore I would recommend trying to use the solution outlined on SO.

@jgm
Copy link
Owner

jgm commented May 17, 2016

You mean the solution of adding a bunch of low-level latex definitions to the default latex template? I'd rather not do that; it adds a lot of length and complexity to the template.

Perhaps we could include a conditional in the template to use enumitem if a certain variable (enumitem) is set, and the LaTeX writer could be told to set that variable if the document contains any lists nested more than six levels deep? The writer would have to keep track of nesting levels as it rendered lists, but this could be done.

This solution would mean that in most cases the enumitem package wouldn't be needed.

@jgm jgm changed the title ! LaTeX Error: Too deeply nested. ! LaTeX Error: Too deeply nested (lists more than 6 levels deep) May 17, 2016
@dumblob
Copy link
Author

dumblob commented May 17, 2016

You mean the solution of adding a bunch of low-level latex definitions to the default latex template?

Right, that's what I meant.

Perhaps we could include a conditional in the template to use enumitem if a certain variable (enumitem) is set, and the LaTeX writer could be told to set that variable if the document contains any lists nested more than six levels deep?

How about making it completely unattended using IfFileExists or @ifpackageloaded?

@jgm
Copy link
Owner

jgm commented May 17, 2016

+++ dumblob [May 17 16 10:53 ]:

Perhaps we could include a conditional in the template to use
enumitem if a certain variable (enumitem) is set, and the LaTeX
writer could be told to set that variable if the document contains
any lists nested more than six levels deep?

How about making it completely unattended using [1]IfFileExists or
[2]@ifpackageloaded?

If we do that, then people who don't have enumitem installed
will still get the LaTeX error, and won't know how to fix
it. With the solution I suggested, they'd get a different
LaTeX error, but one that points towards a solution (package
enumitem missing).

@dumblob
Copy link
Author

dumblob commented May 17, 2016

If we do that, then people who don't have enumitem installed will still get the LaTeX error, and won't know how to fix it. With the solution I suggested, they'd get a different LaTeX error, but one that points towards a solution (package enumitem missing).

That depends on whether the enumitem variable will be set by default or unset. Probably unset (because deeper nesting than 5 shouldn't be more common than nesting up to 5th level) and then you're right.

@dumblob
Copy link
Author

dumblob commented Nov 5, 2017

Any news on this?

@jgm
Copy link
Owner

jgm commented Nov 5, 2017

No, it's not a high priority for me, but maybe someone else wants to code up the solution mentioned?

@dumblob
Copy link
Author

dumblob commented Nov 6, 2017

Well, the part

The writer would have to keep track of nesting levels as it rendered lists, but this could be done.

seems to be the most difficult one of the whole solution you proposed above. Could you help at least with this keeping track of nesting levels?

@jgm
Copy link
Owner

jgm commented Nov 6, 2017 via email

@nathanshelly
Copy link

As a follow up here, while it sounds like fixing this sustainably may not be possible at this time is there a workaround (however hacky)? I noticed an old post on Gmane about this topic where @jgm you seemed to have a temporary solution involving replacing the enumerate package with enumitem. That post is back from 2012 and the template default.latex no longer appears to use the enumerate package. Is a similar workaround still viable and if so what would be the lines now to remove and add? Thanks in advance!

@jgm
Copy link
Owner

jgm commented Jan 24, 2018

Create a file deeplists.tex with the following contents:

   \usepackage{enumitem}
   \setlistdepth{9}

   \setlist[itemize,1]{label=$\bullet$}
   \setlist[itemize,2]{label=$\bullet$}
   \setlist[itemize,3]{label=$\bullet$}
   \setlist[itemize,4]{label=$\bullet$}
   \setlist[itemize,5]{label=$\bullet$}
   \setlist[itemize,6]{label=$\bullet$}
   \setlist[itemize,7]{label=$\bullet$}
   \setlist[itemize,8]{label=$\bullet$}
   \setlist[itemize,9]{label=$\bullet$}
   \renewlist{itemize}{itemize}{9}

   \setlist[enumerate,1]{label=$\arabic*.$}
   \setlist[enumerate,2]{label=$\alph*.$}
   \setlist[enumerate,3]{label=$\roman*.$}
   \setlist[enumerate,4]{label=$\arabic*.$}
   \setlist[enumerate,5]{label=$\alpha*$}
   \setlist[enumerate,6]{label=$\roman*.$}
   \setlist[enumerate,7]{label=$\arabic*.$}
   \setlist[enumerate,8]{label=$\alph*.$}
   \setlist[enumerate,9]{label=$\roman*.$}
   \renewlist{enumerate}{enumerate}{9}

Then use -H deeplists.tex on your pandoc command line. That should be all it takes to get deeply nested lists to work. You need to make sure the enumitem latex package is available.

@nathanshelly
Copy link

Exactly what I was looking for, thank you so much for the quick reply!

@craigbass76
Copy link

Is this still valid? I'm continuing to get Too deeply nested errors.

@craigbass76
Copy link

This is how I fixed it (December 2018). I went nine deep and figured I'd be good to go:
\usepackage{enumitem}
\setlistdepth{9}

\setlist[itemize,1]{label=\textbullet}
\setlist[itemize,2]{label=\textbullet}
\setlist[itemize,3]{label=\textbullet}
\setlist[itemize,4]{label=\textbullet}
\setlist[itemize,5]{label=\textbullet}
\setlist[itemize,6]{label=\textbullet}
\setlist[itemize,7]{label=\textbullet}
\setlist[itemize,8]{label=\textbullet}
\setlist[itemize,9]{label=\textbullet}

\renewlist{itemize}{itemize}{9}

RMPR pushed a commit to RMPR/OSCP-Exam-Report-Template-Markdown that referenced this issue Nov 19, 2019
When there are too many indentation levels (lists more than 6 levels deep)
pandoc fails to generate a pdf and exit with the above error this is intended
to be a fix for that problem, for more details see the issue below:
jgm/pandoc#2922
@ghuser
Copy link

ghuser commented Feb 4, 2021

I get enumitem.sty not found. I run through docker

@zedzedzed
Copy link

I get enumitem.sty not found. I run through docker

I'm also running via Docker and I ran into this problem too. I managed to get around it by downloading enumitem.sty from https://ctan.org/tex-archive/macros/latex/contrib/enumitem/ and placing it somewhere within your path (I used my project root).

@amine-aboufirass
Copy link

amine-aboufirass commented Mar 1, 2023

For those of us who care about consistent spacing and use of new bullet symbols at each new nested level, I'd recommend the following:

\usepackage{enumitem}
\usepackage{pifont, graphicx}

\let\oldlabelitemi\labelitemi
\let\oldlabelitemii\labelitemii
\let\oldlabelitemiii\labelitemiii
\let\oldlabelitemiv\labelitemiv

\setlistdepth{9}
\setlist[itemize, 1]{label=\oldlabelitemi, leftmargin=25pt}
\setlist[itemize, 2]{label=\oldlabelitemii, leftmargin=25pt}
\setlist[itemize, 3]{label=\oldlabelitemiii, leftmargin=25pt}
\setlist[itemize, 4]{label=\scalebox{0.7}{\ding{117}}, leftmargin=25pt}
\setlist[itemize, 5]{label=\scalebox{0.7}{\ding{110}}, leftmargin=25pt}
\setlist[itemize, 6]{label=\scalebox{0.7}{\ding{115}}, leftmargin=25pt}
\setlist[itemize, 7]{label=\scalebox{0.7}{\ding{108}}, leftmargin=25pt}
\setlist[itemize, 8]{label=\scalebox{0.7}{\ding{53}}, leftmargin=25pt}
\setlist[itemize, 9]{label=\oldlabelitemiv, leftmargin=25pt}

\renewlist{itemize}{itemize}{9}

Though I'm not sure whether using graphicx and including it with the -H flag would cause any problems down the line.,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants