I want to export my source blocks from org-mode to pdf through latex with the export backend engraved. I installed the package engraved-faces, set the variable with (setq org-latex-src-block-backend 'engraved) and exported.

Everything worked as expected until I tried to use some latex3 code inside a code block. The export ended with some errors and showing unnecessary characters inside the pdf document next to the latex3 code.

Here a MWE:

#+latex_class: article
#+latex_compiler: lualatex
#+date: \today
#+title: A Great Title
#+author: Mr. Bigfoot
#+language: en-gb

* Testing source code environments

Here comes some verbatim latex code:

#+name: latex-src
#+caption: Ein Latex-Src Block
#+begin_src latex
# \seq_new:N \l_lukeflo_seq

#+name: shelltest
#+attr_latex: :options numbers=left
#+begin_src shell
  touch hello_world.txt && echo "Done!"

Here its over.

With the latex3 code commented out, it gives a good result:

enter image description here

But as soon as I use the latex3 code, the output is messed up:

enter image description here

The problem seems to be that engraved doesn't produce an appropriate latex color definition for the face the latex3 code is highlighted with in emacs (invoking C-u C-x = its font-latex-sedate-face org-block). This face is missing in the autogenerated list of latex colors in the intermediate .tex file. A random example is e.g.:

\newcommand{\EFc}[1]{\textcolor{EFc}{#1}} % font-lock-comment-face

for the font-lock-comment-face (there are multiple such lines).

Thus, the question ist: How can I add custom faces to engraved whose color then will be processed correctly during latex export?


The variables in question are engrave-faces-themes and engrave-faces-current-preset-styles. I tried to add a custom theme to the first one with (add-to-list 'engrave-faces-themes '(theme-name . [...])), where the [...] part is just a copy of the default theme extended with the line (font-latex-sedate-face :short "fl-sedate" :slug "sed" :foreground "#ff8c00") to process the face font-latex-sedate-face which I use for highlighting latex3 code.

If I check the variable afterwards with C-h,v engrave-faces-themes, my custom theme is added. But it can't be usen during latex-export. The error message states: "Theme theme-name is not found in 'engrave-faces-current-preset-style' or availible Emacs themes". Thus, I need to pass the new theme to the engrave-faces-current-preset-style or invoke a function which does this. Unfortunatley, I'm not able to understand the whole elisp code in the package file of engrave-faces which processes all this stuff.

So, still happy for help.


Your Answer

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