We are currently planning to migrate to a different platform for the forum. We will announce this fact both here and on Twitter, once we have settled on a solution.

How to the YAML frontmatter on a file for Pandoc?

hmfhmf
edited June 30 in General

First and foremost great job.

I have just go started. I have gone over the tutorials and videos. But I have not read the documentation fully, so I may have missed something.

I have a markdown file with many levels in the bullet lists. When generating the PDF, Pandoc will fail because it exceeds Latex's maximum depth. To solve this, I originally added the following YAML frontmatter to the file:

---
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
colorlinks: true
urlcolor: cyan
---

When I generate the PDF file from the GUI, I still get the error. It seems like command fails because the YAML is not being processed. My original command was:

pandoc -s -o edit_notes.pdf --pdf-engine=xelatex edit_notes.md

which does not match what is shown in the settings. I am assuming that the frontmatter I have is being analyzed and stripped by Zettlr or the Pandoc command avoids use of the frontmatter. So my question is, what is the best way to add these setting for Pandoc?

TIA

Comments

  • I have finally been able to work around adding a YAML LaTex "preamble" as discussed here. I can confirm that the YAML metadata is being correctly parsed and used by Pandoc. I have tested this with the YAML block at the start of the source file, at the end of the source file and as an external final, all using Zettlr's internal Pandoc (Advanced settings). This only works if (and only if) I also remove the template from the command line ($tpl$ variable).

    I am not able to test this command in the OS terminal because I am using Ubuntu 2.04 and several unmet dependencies do not allow me to update to the latest. version. Nevertheless, some unexpected interaction is occurring with the provided template.

    So my question is, will I loose any Zettlr features by not using the provided template. If so, any way I can avoid this?

    Hope this is useful for someone else.

  • If so, any way I can avoid this?

    No, but that's also not a problem. Zettlr basically just adds a few variables that you can indeed also pass to Pandoc directly. That idea was me not completely understanding Pandoc when I integrated that to Zettlr. Don't worry, in 2.0 that's much simpler.

Sign In or Register to comment.