2

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

1
  • 1
    There are some solutions discussed at github.com/jgm/pandoc/issues/6109. If that helps you to solve the issue then you can post the solution here as a self-answer.
    – Marijn
    May 16, 2021 at 12:54

1 Answer 1

2

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:\Users\USERNAME\AppData\Roaming\pandoc\templates

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

Thanks a lot, @Marijn!

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .