I want my Org Mode Latex Pdf Export to look like Code Styles and Colours

Colour definitions for the xcolor package have been added to


It looks like that now:

 (setq org-format-latex-header 

 \\pagestyle{empty}             % do not remove
 % The settings below are copied from fullpage.sty

mystyle settings


have been added to


It looks like that now:

     (setq org-latex-listings-options
       '(("backgroundcolor" "\\color{backcolour}")
         ("commentstyle" "\\color{codegreen}")
         ("keywordstyle" "\\color{magenta}")
         ("numberstyle" "\\tiny\\color{codegray}")
         ("stringstyle" "\\color{codepurple}")
         ("basicstyle" "\\ttfamily\\footnotesize")
         ("breakatwhitespace" "false")
         ("breaklines" "true")
         ("captionpos" "b")
         ("keepspaces" "true")
         ("numbers" "left")
         ("numbersep" "5pt")
         ("showspaces" "false")
         ("showstringspaces" "false")
         ("showtabs" "false")
         ("tabsize" "2")

If I now use the export dispatcher with C-c C-e l L, and analyze the buffer nothing has changed.

1. Am I adjusting the settings/variables incorrectly?

2. Is there a better org mode way to get an automatically generated .pdf with code style highlighting?

Edit 1:

the org-latex-listings-options is inserted above every


and not once above the \begin{document}

3. How can I optimize that

Edit 2: Here some example Files (Naming should clarify the purpose) Don´t know how to attach files in StackExchange

File Link

  • Can you please provide a mininal org file on which one can see the problem? – JeanPierre Nov 6 '19 at 15:56
  • I edited the post with a gdrive link to some example files. – 7ie7an Nov 7 '19 at 6:33

Your Answer

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

Browse other questions tagged or ask your own question.