From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: preview latex fragments Date: Thu, 24 May 2012 11:39:41 -0400 Message-ID: <8463.1337873981@alphaville> References: <8762bmy5m6.fsf@med.uni-goettingen.de> <87obpej65q.fsf@gnu.org> <87ipflwzqc.fsf@med.uni-goettingen.de> <87ehq9wz55.fsf@med.uni-goettingen.de> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:38954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXa9I-00059e-JC for emacs-orgmode@gnu.org; Thu, 24 May 2012 11:40:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXa98-0005f8-5L for emacs-orgmode@gnu.org; Thu, 24 May 2012 11:40:24 -0400 Received: from g4t0015.houston.hp.com ([15.201.24.18]:17009) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXa97-0005HW-UT for emacs-orgmode@gnu.org; Thu, 24 May 2012 11:40:14 -0400 In-Reply-To: Message from Andreas Leha of "Thu, 24 May 2012 14:18:30 +0200." <87ehq9wz55.fsf@med.uni-goettingen.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Andreas Leha Cc: emacs-orgmode@gnu.org Andreas Leha wrote: > Andreas Leha writes: > > > Hi Bastien, > > > > Bastien writes: > > > >> Hi Andreas, > >> > >> Andreas Leha writes: > >> > >>> I experience a problem with the preview of latex fragments: I can not > >>> change the foreground color (in org-format-latex-options). On a dark > >>> background, the black fragments are barely visible. > >>> > >>> The settings for background and scale (in the same variable) are > >>> honored, though. > >> > >> Can you post a reproducible case with a specific Org version? > > > > Thanks a lot for looking into this, but: > > No, I can not. Now it works as it should. No clue what happened > > actually. Sorry for the noise. > > > > - Andreas > > > Actually, now I can again reproduce it. The problem seems to be tikz: > With tikz in the latex header, foreground is always black. So probably > more a LaTeX-issue? > > Example: Change the :foreground color in org-format-latex-options to > "Red" and do the preview (C-c C-x C-l) on this subtree: > > #+begin_org > #+LATEX_HEADER: \usepackage{tikz} > > > * Test > Hi, > > set :foreground in org-format-latex-options to "Red" and take this > fragment $1 = 2$ and press C-c C-x C-l. > #+end_org > > > So the question becomes: > Can I make the foreground changing work even with tikz loaded in the > latex document? > I can reproduce it too, without tikz. I have a green-on-black setup but I think the underlying reason (at least in my case: Andreas's case might be different) is minted. I'm appending an org file with my investigation. Nick --8<---------------cut here---------------start------------->8--- * previewing a latex fragment produces a black blob I use a green-on-black scheme: #+BEGIN_SRC elisp (setq frame-inherited-parameters '(foreground-color background-color)) (set-foreground-color "green") (set-background-color "black") (set-cursor-color "red") (set-mouse-color "red") (set-face-foreground 'menu "light grey") (set-face-background 'menu "black") #+END_SRC Here's a simple latex fragment: \[ 2 + 2 = 4 \] Previewing it with C-c C-x C-l, I get an invisible black blob. The current value of org-format-latex-options is (:foreground default :background default :scale 1.4 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")) If I link to the produced png file: [[file:./ltxpng/dark-bg_ca60306327ae6b995f92a473e1e8787c7917c488.png]] and follow the link, I get nothing. The file has size 84 which seems ridiculously low. Indeed, I can ``display'' it and get info on the image: the channel statistics show it's all black. OTOH, if I take the following tex program, latex and dvipng it with the same parameters, I get a reasonable result: #+BEGIN_EXAMPLE \documentclass{article} \begin{document} \[ 2 + 2 = 4 \] \end{document} %%% Local Variables: %%% mode: latex %%% TeX-master: "fragment" %%% End: #+END_EXAMPLE #+BEGIN_SRC sh latex fragment.tex dvipng -fg "rgb 0 1 0" -bg "rgb 0 0 0" -D 140 -T tight -o fragment.png fragment.dvi #+END_SRC So either the production of the fragment is wrong or the production of the png from the fragment, probably the former. The latex code for the fragment follows. If I again do the latex/dvipng run by hand (with --shell-escape to accommodate minted) I get an all-black png. If I comment out minted, it works. #+BEGIN_SRC latex \documentclass{article} \usepackage[usenames]{color} \usepackage{amsmath} \usepackage[mathscr]{eucal} \pagestyle{empty} % do not remove \usepackage{minted} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} % Package fixltx2e omitted \usepackage{graphicx} % Package longtable omitted % Package float omitted % Package wrapfig omitted \usepackage{soul} \usepackage{textcomp} \usepackage{marvosym} \usepackage{wasysym} \usepackage{latexsym} \usepackage{amssymb} % Package hyperref omitted \tolerance=1000 % The settings below are copied from fullpage.sty \setlength{\textwidth}{\paperwidth} \addtolength{\textwidth}{-3cm} \setlength{\oddsidemargin}{1.5cm} \addtolength{\oddsidemargin}{-2.54cm} \setlength{\evensidemargin}{\oddsidemargin} \setlength{\textheight}{\paperheight} \addtolength{\textheight}{-\headheight} \addtolength{\textheight}{-\headsep} \addtolength{\textheight}{-\footskip} \addtolength{\textheight}{-3cm} \setlength{\topmargin}{1.5cm} \addtolength{\topmargin}{-2.54cm} \begin{document} \[ 2 + 2 = 4 \] \end{document} #+END_SRC --8<---------------cut here---------------end--------------->8---