0

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:

xelatex
\usepackage[utf8]{inputenc}

\usepackage[ngerman]{babel}
\usepackage{ot-tableau}
\usepackage{easylist}
\usepackage{hanging}
\usepackage{hyperref}
\usepackage{titlesec}
\usepackage{geometry}
\usepackage{setspace}
\usepackage{blindtext}
\usepackage{tipa}
\usepackage{cgloss4e}
\usepackage{qtree}
\usepackage{enumerate}
\usepackage{longtable}
\usepackage{textgreek}
\usepackage{amssymb}
\usepackage{amsfonts}
%\usepackage{enumitem}
\usepackage{xcolor}

\color[RGB]{255,255,255}
\pagecolor[RGB]{61,61,61}


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

\titleformat{\section}
{\color{teal}\normalfont\LARGE}
{\color{teal}\thesection}{1em}{}

\titleformat{\subsection}
{\color{cyan}\normalfont\Large}
{\color{cyan}\thesection}{1em}{}

\titleformat{\subsubsection}
{\color{pink}\normalfont\large}
{\color{pink}\thesection}{1em}{}

\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,
    urlcolor=cyan,
    pdftitle={Overleaf Example},
    pdfpagemode=FullScreen,
    }

\geometry{
 a4paper, % 21.0 x 29.7
 left=20mm,
 right=20mm,
 top=20mm,
 bottom=20mm
 }
\urlstyle{same}
\onehalfspace

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

1

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

\let\emphasized\emph
\let\strong\textbf
\renewcommand{\emph}[1]{\textcolor{olive}{\emphasized{#1}}}
\renewcommand{\textbf}[1]{\textcolor{orange}{\strong{#1}}}

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 .