I am using pandoc to convert different documents into pdf. I have a template to include with the flag --include-in-header ~/path/to/template/pandoc_format_darkmode.tex -V geometry:a4paper -V geometry:margin=2cm -V fontsize=11pt --pdf-engine=xelatex

This template is supposed to recolor the document, e.g. change background color, change font colors as well as format of the sections and subsections.

Here is the template:




\setmainfont{DejaVu Sans}[
% \setmainfont[Color=white]{DejaVu Sans}[
%   ItalicFeatures={Color=olive},
%   BoldFeatures={Color=orange},
% ]




    pdftitle={Overleaf Example},

 a4paper, % 21.0 x 29.7

The problem is the following: Converting to pdf works basically, but everytime, I use italic or bold in my documents (doesn't matter if I convert from markdown, html or docx), the font turns to black when going back to normal font. That's annoying of course, because I now have paragraphs in white font and after one word in bold sytlisation, the font turns to black, which it shouldn't do.

I guess it is an issue with my font, but I haven't found out yet.

If I change \setmainfont{DejaVu Sans}[ to \setmainfont[Color=white]{DejaVu Sans}[ (as shown in the commented section of the template code), the error doesn't exist. But now, all my section and subsections headings are colored in white, which also is not the outcome I wished for, as I want them to have specific colors (as I defined in the template).

Please help, thanks!

1 Answer 1


Well, I kinda worked around it: I used the commands


as they basically do the same job in coloring italic and bold text but they don't produce the error in the same way as they are used by pandoc directly and don't mess up the main font which I defined with \color{white}

You must log in to answer this question.

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