I would like to set the colors for a pdf export of an org-mode file based on the structural elements. That is something like

* This Headline Should Be Blue
** This subheadline should be green
   - List items should be black
Plain text should be black

Currently, I can modify the font and font color for the entire exported document with the following:

#+LATEX_HEADER:\setmainfont[Color=Green]{Fira Sans}
#+LATEX_HEADER:\setsansfont[Color=Green]{Fira Sans}

And I can set the color for a specific region with something like

\addfontfeature{Color=red} this part is red \addfontfeature{Color=black} and now back to black

But I'd like to define consistent rules across the document so I don't have to keep manually switching back and forth between colors.


How about the following:

#+LATEX_HEADER: \usepackage{titlesec}
#+LATEX_HEADER: \titleformat*{\section}{\color{blue}}
#+LATEX_HEADER: \titleformat*{\subsection}{\color{green}}
#+LATEX_HEADER: \titleformat*{\paragraph}{\color{black}}
  • What's the question? And why/how does it serve as an answer for the OP's question? – Drew Jul 3 '18 at 2:44
  • I've made some edits to more directly answer the question. – jdtonkin Jul 3 '18 at 4:09
  • Thanks. This looks to work for \section and \paragraph, but the \subsection coloring is also black. (The titlesec package also kinda messes with some other formatting, but that's a separate issue) – Metropolis Jul 3 '18 at 15:38
  • Hmm - not sure what's going on there, sorry. – jdtonkin Aug 1 '18 at 17:48
  • This worked for me when I added #+LATEX_HEADER: \usepackage{xcolor} – Jonta Dec 9 '18 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.