latex - 使用带有 markdown 的 pandoc 在第四个嵌套级别嵌套得太深?

标签 latex markdown r-markdown pandoc

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

应该是这样的:

  1. 代码行为
    1. 记录
      1. 没有“裸”System.out.println
      2. 可以通过对logging.xml和/或log4j.properties进行简单更改来校准日志记录级别
      3. 错误和异常会转到适当的 WARN 和/或 ERROR 日志记录级别
    2. 错误和异常
      1. 几乎从未“吞下”
        1. 仅在易于理解的情况下才会发生
          1. 必须在代码中清楚地记录它们被吞下的原因
          2. 只有特定的异常或错误可以通过这种方式被吞掉
            • 特别是不能对一般异常执行此操作。
            • Throwable 永远不能以这种方式处理

使用命令行

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

我们得到

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}

更新 我尝试使用 enumitem 包将其他级别添加到序言中,如此处建议的 https://tex.stackexchange.com/a/464459/45938 - 但没有效果(产生相同的错误):

---
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

---

最佳答案

使用enumitem是正确的方法。但是,您必须扩展 enumerateitemize 环境:

---
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

输出:

enter image description here

注意:output.rmakrdown::pdf_document.keep_tex 标志表示保留中间 tex 文件。

关于latex - 使用带有 markdown 的 pandoc 在第四个嵌套级别嵌套得太深?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57945414/

相关文章:

latex - 如何在 LaTeX 文档中使用 ⨝ 和 ⊐?

r - 错误 : Missing $ inserted when using kable

parsing - 如何在PHP中解析Markdown?

r - 如何在 R markdown 中左对齐我的水平线?

html - Knitr 忽略 HTML 主题中的选项卡

rmarkdown 用户输入以从列表中选择

latex - 使用knitr kable制作居中的LaTeX表格

latex - 在 LaTeX 中使用\hline 时出错,不会中断编译,但也许我的做法是错误的

ruby - 如何在 Markdown 文件中传递和呈现 ruby​​ 变量? gem "redcarpet"

r - 在RStudio中创建良好的有线输出