How can I control the background color of my LaTex fragments in Org-mode?

I am using the badwolf-theme package, and this is what I get:

enter image description here

I would like the background color of my formulas to match the background color of my org buffer.

Here are my current org-format-latex-options:

enter image description here

  • 1
    Have you tried tweaking org-format-latex-options? – JeanPierre May 28 '16 at 20:03
  • @JeanPierre I updated the OP. Background seems to be set to default. Not sure if there is a different option to control this. – Amelio Vazquez-Reina May 29 '16 at 0:04
  • 1
    Maybe try setting it to auto? – JeanPierre May 29 '16 at 7:34
  • This works for me with the default value of org-format-latex-options, which are the same as yours. Maybe something in the badwolf-theme causes the problem? – Tyler Jun 1 '16 at 13:09

I've had this problem before, sometimes deleting the ltximg folder helps reset things from the previous theme.

| improve this answer | |

I had a similar issue (in my case it was the foreground-setting that I couldn't control appropriately). I was able to fix it by employing xcolor in the conversion process.

Put this in your init.el and execute it by pressing C-M-x or by restarting emacs:

;; fix color handling in org-preview-latex-fragment
(let ((dvipng--plist (alist-get 'dvipng org-preview-latex-process-alist)))
  (plist-put dvipng--plist :use-xcolor t)
  (plist-put dvipng--plist :image-converter '("dvipng -D %D -T tight -o %O %f")))

Then simply recreate your images (delete the folder ltximg).

| improve this answer | |

I would try changing the :background from default to "Black"

Somehow my :foreground default got changed from white to black and it was really annoying. Note that it's expecting a stringp so quotes are needed. You might be able to put hex string in there. Haven't tried myself.

| improve this answer | |

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.