TransWikia.com

Passing Xcolor package in YAML markdown for Pandoc

TeX - LaTeX Asked on June 18, 2021

I have the following YAML in a .md file and everything is working smooth.
But I want to use xcolor to change color for TOC.

Pandoc Manual (see here) says:

linkcolor, filecolor, citecolor, urlcolor, toccolor

color for internal links, external links, citation links, linked URLs, and links in table of contents, respectively: uses options allowed by xcolor, including the dvipsnames, svgnames, and x11names lists

My Question is: how do I pass xcolor option / or how to use svgnames color, because if I change
toccolor: Blue to toccolor: DarkBlue I get undefined color.

Error producing PDF.
! Package xcolor Error: Undefined color `DarkBlue'.

See the xcolor package documentation for explanation.
Type  H <return>  for immediate help.

Here is the YAML Code

---
title: Name of the Article
author: Author Name
date: today
lang: ro-RO
geometry:
  - a4paper
  - margin=2.5cm
  - heightrounded
header-includes: |
  usepackage{fancyhdr}
  pagestyle{fancy}
  fancyhead[L]{textbf{leftmark}}
  fancyhead[R]{textbf{rightmark}}
  lfoot{}cfoot{thepage}rfoot{}
numbersections: yes,
linestretch: 1.2
toccolor: Blue
bibliography: [X:/absolute/path/to/ref.bib]
csl: [X:/absolute/path/to/chicago-fullnote-bibliography.csl]
documentclass: article
toc: true
---

One Answer

As @Marijn suggested by pointing to Github there is an issue with the default.latex template, meaning that instead of

PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor}

currently, template has:

PassOptionsToPackage{dvipsnames,svgnames*,x11names*}{xcolor}

Pandoc version 2.13 has this issue, but the template is fixed on GitHub therefore will be shipped with the next version

In Windows 10

Solution for this problem is the following:

  1. in command line
pandoc -D latex > default.latex

This will copy the template in the current directory.

  1. remove * from svgnames and x11names in the line PassOptionsToPackage{dvipsnames,svgnames*,x11names*}{xcolor}

  2. copy the modified default.latex to C:UsersUSERNAMEAppDataRoamingpandoctemplates

    • if the directory not exists you have to create it.
  3. run as ussualy: pandoc INPUT.md -o OUTPUT.pdf

Thanks a lot, @Marijn!

Correct answer by Mafsi on June 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP