all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Bug: Latex preview fg color w/tikz (known problem, fix suggested) [9.1.9 (release_9.1.9-65-g5e4542 @ /home/carlos/local/stow/emacs-26/share/emacs/26.1.90/lisp/org/)]
@ 2018-12-05 19:17 Carlos Pita
  2018-12-05 19:37 ` Carlos Pita
  2018-12-05 23:38 ` Nicolas Goaziou
  0 siblings, 2 replies; 13+ messages in thread
From: Carlos Pita @ 2018-12-05 19:17 UTC (permalink / raw)
  To: emacs-orgmode

Hi, I know this problem has been reported in the past ([1], [2]). The
second link provides a hint to a solution that I've developed
further. The underlying problem is (from dvipng man page):

 -fg color_spec Choose foreground color for the images. This option will
     be ignored if there is a foreground color \special in the DVI. The
     color spec should be in TeX color \special syntax, e.g., 'rgb 1.0
     0.0 0.0'.

So the current approach to latex fragment previewing is broken as far as
any latex package indirectly uses xcolor to set background or foreground
color, tikz being a prominent example.

As a more robust solution, I suggest to explicitly set the colors in the
tex fragment for the preview instead of passing them as arguments to
dvipng. This can be done easily:

...
\usepackage{xcolor}
...
\begin{document}
  \definecolor{bg}{rgb}{0,0,0}
  \definecolor{fg}{rgb}{1,1,1}
  \color{fg}
  \pagecolor{bg}
...

Where fg and bg might be replaced by randomly generated string or
whatever you see fit to prevent name clashes.

Notice that the syntax for rgb color is the same than the one for dvipng
so it shouldn't be much of a refactoring.

Best regards
--
Carlos

---

[1] https://lists.gnu.org/archive/html/emacs-orgmode/2010-01/msg00635.html

[2] https://lists.gnu.org/archive/html/emacs-orgmode/2012-05/msg00865.html

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-01-04 13:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-05 19:17 Bug: Latex preview fg color w/tikz (known problem, fix suggested) [9.1.9 (release_9.1.9-65-g5e4542 @ /home/carlos/local/stow/emacs-26/share/emacs/26.1.90/lisp/org/)] Carlos Pita
2018-12-05 19:37 ` Carlos Pita
2018-12-05 23:38 ` Nicolas Goaziou
2018-12-08  4:32   ` Carlos Pita
2018-12-08  9:56     ` Nicolas Goaziou
2018-12-08 14:43       ` Eric S Fraga
2018-12-22 14:00         ` Carlos Pita
2019-01-01 18:08           ` Carlos Pita
2019-01-02 15:07             ` Nicolas Goaziou
2019-01-02 22:12               ` Carlos Pita
2019-01-03 11:35                 ` Nicolas Goaziou
2019-01-03 15:38                   ` Carlos Pita
2019-01-04 13:21                     ` Nicolas Goaziou

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.