2

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:\usepackage{fontspec}
#+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.

1 Answer 1

1

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}}
5
  • What's the question? And why/how does it serve as an answer for the OP's question?
    – Drew
    Commented Jul 3, 2018 at 2:44
  • I've made some edits to more directly answer the question.
    – jdtonkin
    Commented Jul 3, 2018 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
    Commented Jul 3, 2018 at 15:38
  • Hmm - not sure what's going on there, sorry.
    – jdtonkin
    Commented Aug 1, 2018 at 17:48
  • This worked for me when I added #+LATEX_HEADER: \usepackage{xcolor}
    – Jonta
    Commented Dec 9, 2018 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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