简体   繁体   中英

Emacs org mode: background color of latex fragments (with `org-highlight-latex-and-related`) : which variable to change?

Ok, so my org-mode latex fragments have a slightly off background color, but only when I:

(setq org-highlight-latex-and-related '(native))

As seen here在此处输入图片说明

It looks similar to the background highlighting functionality as involved in ~~ (code).

Does anyone know what to do?

BONUS:

  • I'm using doom emacs and the gruvbox theme.

TRIED:

  • I don't think this is related to the fragments themselves a la org-format-latex-options (as seen in many other posts)
  • This is NOT helped by setting font-latex-math-face :background

HINTS:

  • I feel like it IS related to the face org-latex-and-related , but I can work out how the chance the background, when I 'customise' the face i get the following:
(defface org-latex-and-related
  (let ((font (cond ((assq :inherit custom-face-attributes)
             '(:inherit underline))
            (t '(:underline t)))))
    `((((class grayscale) (background light))
       (:foreground "DimGray" ,@font))
      (((class grayscale) (background dark))
       (:foreground "LightGray" ,@font))
      (((class color) (background light))
       (:foreground "SaddleBrown"))
      (((class color) (background dark))
       (:foreground "burlywood"))
      (t (,@font))))
  "Face used to highlight LaTeX data, entities and sub/superscript."
  :group 'org-faces
  :version "24.4"
  :package-version '(Org . "8.0"))

Answering my own question.

As usual, tecosaur got there first and gives a good breakdown of the internals.

The code that does the magic is

(require 'org-src)
(add-to-list 'org-src-block-faces '("latex" (:inherit default :extend t)))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM