Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Too deeply nested at just fourth nesting level using pandoc with markdown?

The following code is not accepted by pandoc:

1. Code Behaviors
    1. Logging
        1. No "bare" `System.out.println`'s
        1. Logging level can be calibrated by simple change(s) to logging.xml and/or log4j.properties
        1. Errors and exceptions go to appropriate WARN and/or ERROR logging levels
    1. Errors and Exceptions
        1. Almost never "swallowed"
            1. Can only happen for well understood situations
                1. Must be documented clearly in code why they are swallowed
                1. Only a specific exception or error may be swallowed this way
                - In particular can not be done for general Exception.
                - Throwable can never be handled this way

Which should look like this:

  1. Code Behaviors
    1. Logging
      1. No "bare" System.out.println's
      2. Logging level can be calibrated by simple change(s) to logging.xml and/or log4j.properties
      3. Errors and exceptions go to appropriate WARN and/or ERROR logging levels
    2. Errors and Exceptions
      1. Almost never "swallowed"
        1. Can only happen for well understood situations
          1. Must be documented clearly in code why they are swallowed
          2. Only a specific exception or error may be swallowed this way
            • In particular can not be done for general Exception.
            • Throwable can never be handled this way

Using the command line

pandoc --toc  --toc-depth=6 -V fontsize=10pt --pdf-engine xelatex
  -V geometry:"left=1.5cm,right=1.5cm,top=2cm,bottom=2cm" -o review.pdf review.md

We get

Error producing PDF.
! LaTeX Error: Too deeply nested.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.159         \begin{enumerate}

Update I tried to add in additional levels using enumitem package to the preamble as suggested here https://tex.stackexchange.com/a/464459/45938 - but to no effect (same error produced):

---
title: My Review
subtitle: My subtitle 
documentclass: extarticle
author: First Last Sept 15, 2019
geometry: "left=1.5cm,right=1.5cm,top=2cm,bottom=2cm"
header-includes:
  - \usepackage{unicode-math}
  - \setmainfont{TeX Gyre Schola}
  - \setmathfont{TeX Gyre Schola Math}
  - \usepackage{enumitem}
  - \setlistdepth{20}
  - \renewlist{itemize}{itemize}{20}
  - \setlist[itemize]{label=$\cdot$}
  - \setlist[itemize,1]{label=\textbullet}
  - \setlist[itemize,2]{label=--}
  - \setlist[itemize,3]{label=*}

output:
  rmarkdown::html_document:
    theme: lumen
    fig_caption: yes

---
like image 370
WestCoastProjects Avatar asked Sep 15 '19 15:09

WestCoastProjects


People also ask

Can Pandoc convert HTML to markdown?

Pandoc can convert between numerous markup and word processing formats, including, but not limited to, various flavors of Markdown, HTML, LaTeX and Word docx.

What is Pandoc used for?

Pandoc is a tool that runs from the command window or Linux shell to convert a markdown file to another file format. For this workflow, with the use of an appropriate CSS is available to help convert HTML, PDF, DOCX, and EPUB. You can also use your own or discovered CSS as well.

Is Pandoc secure?

The python package pandoc was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was deemed as safe to use.

Where are Pandoc templates?

Some Pandoc templates for an article in PDF (vita LaTeX), HTML, or Microsoft Word. These go in ~/. pandoc/templates . These can be be pointed to directly with the --template= switch as appropriate.


1 Answers

Using enumitem is the correct approach. However, you have to extend both enumerate and itemize environments:

---
header-includes:
  - \usepackage{enumitem}
  - \setlistdepth{20}
  - \renewlist{itemize}{itemize}{20}
  - \renewlist{enumerate}{enumerate}{20}
  - \setlist[itemize]{label=$\cdot$}
  - \setlist[itemize,1]{label=\textbullet}
  - \setlist[itemize,2]{label=--}
  - \setlist[itemize,3]{label=*}
output:
  rmarkdown::pdf_document:
      keep_tex: yes
---

1. Code Behaviors
    1. Logging
        1. No "bare" `System.out.println`'s
        1. Logging level can be calibrated by simple change(s) to logging.xml and/or log4j.properties
        1. Errors and exceptions go to appropriate WARN and/or ERROR logging levels
    1. Errors and Exceptions
        1. Almost never "swallowed"
            1. Can only happen for well understood situations
                1. Must be documented clearly in code why they are swallowed
                1. Only a specific exception or error may be swallowed this way
                    - In particular can not be done for general Exception.
                    - Throwable can never be handled this way

Output:

enter image description here

Note: The output.rmakrdown::pdf_document.keep_tex flag means that the intermediate tex file is retained.

like image 102
Ralf Stubner Avatar answered Sep 29 '22 21:09

Ralf Stubner