Re: [O] [bug] latex fragment preview with dvipng ignores :foreground specification

2013-04-23 Thread Eric S Fraga
Bastien b...@gnu.org writes:

 Hi Eric,

 Eric S Fraga e.fr...@ucl.ac.uk writes:

 This leads me to suggest that both cases (dvipng
 and imagemagick) use the same latex code and, in fact, it may be
 possible to fold both functions org-create-formula-image-with-dvipng and
 org-create-formula-image-with-imagemagick into one...

 I would welcome such a refactoring, because there is obviously some
 redundancy here.  But I felt too lazy to tackle this so far, and I
 guess I won't be tackling this before long.  So the door is open for
 anyone to enter!

 Best,

Bastien,

I will put this on my todo list and will try to find the requisite Emacs
lisp expertise from within to accomplish this task!

Thanks,
eric


-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_8.0.1-19-g9655a1




Re: [O] [bug] latex fragment preview with dvipng ignores :foreground specification

2013-04-16 Thread Bastien
Hi Eric,

Eric S Fraga e.fr...@ucl.ac.uk writes:

 This leads me to suggest that both cases (dvipng
 and imagemagick) use the same latex code and, in fact, it may be
 possible to fold both functions org-create-formula-image-with-dvipng and
 org-create-formula-image-with-imagemagick into one...

I would welcome such a refactoring, because there is obviously some
redundancy here.  But I felt too lazy to tackle this so far, and I
guess I won't be tackling this before long.  So the door is open for
anyone to enter!

Best,

-- 
 Bastien



Re: [O] [bug] latex fragment preview with dvipng ignores :foreground specification

2013-01-28 Thread Eric S Fraga
Myles English mylesengl...@gmail.com writes:

 Hi Eric,

 Eric S Fraga writes:

 Nick Dokos nicholas.do...@hp.com writes:

 I tried the imagemagick setting, set the options variable to black 
 background
 and red foreground - lo and behold, that's what I get in the preview.

 I was correct in my conclusion last night that I needed to go to
 bed...  I was making a silly mistake (and I won't go into details ;-).

 This does indeed work!  Thanks again.

 Please could you clarify a couple of things for me?

 From your investigations can you say if there is a bug in the orgmode
 use of dvipng, or has dvipng changed so that the expected behaviour is
 no longer supported?  I too use a dark display (emacs theme
 zenburn-emacs), get the black fragments in normal latex blocks in org
 files (i.e. not beamer), and org-format-latex-options has no visible
 effect, how can I have white formulae again?

 Thanks,

 Myles


Hi Myles,

Thanks for prompting me on this.  I've explored the code a bit
further.  The two approaches, i.e. dvipng vs imagemagick, differ not
only in the tool used to create the image and the source of the image
(dvi versus pdf) but also in the latex code actually created to generate
the image in the first place.

The dvipng route does not specify any colours in the latex and relies on
dvipng to change explicitly the background and foreground colours.  The
imagemagick route, however, creates a latex file that has the colour
specifications directly and the conversion does change any colours.

So, it could be that dvipng has changed and no longer changes the
colours correctly or it may be that latex has changed in how the dvi
file specifies colours?

However, I have verified that dvipng will work just fine, without asking
for colour changes, if the dvi is created using the latex code used for
the imagemagick case.  This leads me to suggest that both cases (dvipng
and imagemagick) use the same latex code and, in fact, it may be
possible to fold both functions org-create-formula-image-with-dvipng and
org-create-formula-image-with-imagemagick into one...  but maybe this
has other repercussions.  One such repercussion could be the use of
transparent colour specifications: dvipng would appear to support this
but imagemagick might not (as org appears to use white when transparent
is specified for a background colour, if I understood the code.

eric

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3d-891-gf52600




Re: [O] [bug] latex fragment preview with dvipng ignores :foreground specification

2013-01-28 Thread Myles English

Eric S Fraga writes:

 Myles English mylesengl...@gmail.com writes:

 Please could you clarify a couple of things for me?

 From your investigations can you say if there is a bug in the orgmode
 use of dvipng, or has dvipng changed so that the expected behaviour is
 no longer supported?  I too use a dark display (emacs theme
 zenburn-emacs), get the black fragments in normal latex blocks in org
 files (i.e. not beamer), and org-format-latex-options has no visible
 effect, how can I have white formulae again?

 Thanks for prompting me on this.  I've explored the code a bit
 further.  The two approaches, i.e. dvipng vs imagemagick, differ not
 only in the tool used to create the image and the source of the image
 (dvi versus pdf) but also in the latex code actually created to generate
 the image in the first place.

 The dvipng route does not specify any colours in the latex and relies on
 dvipng to change explicitly the background and foreground colours.  The
 imagemagick route, however, creates a latex file that has the colour
 specifications directly and the conversion does change any colours.

 So, it could be that dvipng has changed and no longer changes the
 colours correctly or it may be that latex has changed in how the dvi
 file specifies colours?

 However, I have verified that dvipng will work just fine, without asking
 for colour changes, if the dvi is created using the latex code used for
 the imagemagick case.  This leads me to suggest that both cases (dvipng
 and imagemagick) use the same latex code and, in fact, it may be
 possible to fold both functions org-create-formula-image-with-dvipng and
 org-create-formula-image-with-imagemagick into one...  but maybe this
 has other repercussions.  One such repercussion could be the use of
 transparent colour specifications: dvipng would appear to support this
 but imagemagick might not (as org appears to use white when transparent
 is specified for a background colour, if I understood the code.

Thanks for looking into it.  Until a conclusion is reached with dvipng
this gets things back to normal for me:

(setq org-latex-create-formula-image-program 'imagemagick)

Myles



Re: [O] [bug] latex fragment preview with dvipng ignores :foreground specification

2013-01-27 Thread Myles English

Hi Eric,

Eric S Fraga writes:

 Nick Dokos nicholas.do...@hp.com writes:

 I tried the imagemagick setting, set the options variable to black background
 and red foreground - lo and behold, that's what I get in the preview.

 I was correct in my conclusion last night that I needed to go to
 bed...  I was making a silly mistake (and I won't go into details ;-).

 This does indeed work!  Thanks again.

Please could you clarify a couple of things for me?

From your investigations can you say if there is a bug in the orgmode
use of dvipng, or has dvipng changed so that the expected behaviour is
no longer supported?  I too use a dark display (emacs theme
zenburn-emacs), get the black fragments in normal latex blocks in org
files (i.e. not beamer), and org-format-latex-options has no visible
effect, how can I have white formulae again?

Thanks,

Myles



Re: [O] [bug] latex fragment preview with dvipng ignores :foreground specification

2013-01-26 Thread Eric S Fraga
Nick Dokos nicholas.do...@hp.com writes:

[...]

 Use a light background emacs for the presentation. And don't tell
 anybody that you switched. Street creds intact, you can switch back to
 the cool dark background afterwards. If you get caught, you can argue
 that you switched for projection purposes (assuming that you are going
 to use a projector): studies show that dark letters on a light
 background are easier to see from a distance (citation: J.WhlClthFab,
 Vol. 3.14159, p. 2.7182818, Apr. 1, 1999)

Love the citation... may try to pass this by some reviewer at some point.
;-)

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3d-874-gf11acc




Re: [O] [bug] latex fragment preview with dvipng ignores :foreground specification

2013-01-26 Thread Eric S Fraga
Nick Dokos nicholas.do...@hp.com writes:

 Eric S Fraga e.fr...@ucl.ac.uk wrote:
 fragments is the most appealing mechanism.  When I try to use
 org-preview-latex-fragment, the latex image is
 generated.  Unfortunately, as I use a black background on my display, I
 cannot see the fragment as it is being generated with black text on a
 transparent background by default.  Note, I am using dvipng for the
 image conversion.
 

 I tried the imagemagick setting, set the options variable to black background
 and red foreground - lo and behold, that's what I get in the preview.

Thanks for the suggestion.  Should have tried that! blush

However, it's not working for me; very strange.  I have tried switching
from dvipng to imagemagick but I get the same result (having cleaned out
the ltxpng directory, restarted emacs, tried both #+OPTIONS: and direct
variable setting, ...).  Mind you, it's very late at night so I'm
probably doing something stupid...  I'm going to bed; I'll check again
in the morning and will follow this up.

Thanks again,
eric
-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3d-874-gf11acc




Re: [O] [bug] latex fragment preview with dvipng ignores :foreground specification

2013-01-26 Thread Eric S Fraga
Nick Dokos nicholas.do...@hp.com writes:

 I tried the imagemagick setting, set the options variable to black background
 and red foreground - lo and behold, that's what I get in the preview.

I was correct in my conclusion last night that I needed to go to
bed...  I was making a silly mistake (and I won't go into details ;-).

This does indeed work!  Thanks again.

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3d-874-gf11acc




[O] [bug] latex fragment preview with dvipng ignores :foreground specification

2013-01-25 Thread Eric S Fraga
Hello,

I am trying to use org-tree-slide for an interactive session I have to
facilitate soon.  This works quite well, in a geeky kind of way ;-)

However, I do want to display a couple of equations and using latex
fragments is the most appealing mechanism.  When I try to use
org-preview-latex-fragment, the latex image is
generated.  Unfortunately, as I use a black background on my display, I
cannot see the fragment as it is being generated with black text on a
transparent background by default.  Note, I am using dvipng for the
image conversion.

I can customise org-format-latex-options to fix this, or so I
thought.  No matter what I do, the resulting latex fragment has black
text.  The problem appears to be that the -fg option to dvipng does not
work so it doesn't matter how I customise org-format-latex-options.

Can anybody suggest a workaround (without changing the actual latex
itself)?  I can customise the above variable to set the background for
latex images to white, which at least allows the equations to be seen,
but this is a mildly ugly solution.  :( And ruins any geek street cred I
might have had ;-)

Thanks,
eric

-- 
: Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
: in Emacs 24.3.50.1 and Org release_7.9.3d-874-gf11acc




Re: [O] [bug] latex fragment preview with dvipng ignores :foreground specification

2013-01-25 Thread Nick Dokos
Eric S Fraga e.fr...@ucl.ac.uk wrote:

 Hello,
 
 I am trying to use org-tree-slide for an interactive session I have to
 facilitate soon.  This works quite well, in a geeky kind of way ;-)
 
 However, I do want to display a couple of equations and using latex
 fragments is the most appealing mechanism.  When I try to use
 org-preview-latex-fragment, the latex image is
 generated.  Unfortunately, as I use a black background on my display, I
 cannot see the fragment as it is being generated with black text on a
 transparent background by default.  Note, I am using dvipng for the
 image conversion.
 
 I can customise org-format-latex-options to fix this, or so I
 thought.  No matter what I do, the resulting latex fragment has black
 text.  The problem appears to be that the -fg option to dvipng does not
 work so it doesn't matter how I customise org-format-latex-options.
 

I think that's true. Using dvipng from the command line, I can change
the background but not the foreground.

 Can anybody suggest a workaround (without changing the actual latex
 itself)?  I can customise the above variable to set the background for
 latex images to white, which at least allows the equations to be seen,
 but this is a mildly ugly solution.  :( And ruins any geek street cred I
 might have had ;-)
 

Use a light background emacs for the presentation. And don't tell
anybody that you switched. Street creds intact, you can switch back to
the cool dark background afterwards. If you get caught, you can argue
that you switched for projection purposes (assuming that you are going
to use a projector): studies show that dark letters on a light
background are easier to see from a distance (citation: J.WhlClthFab,
Vol. 3.14159, p. 2.7182818, Apr. 1, 1999)

Nick



Re: [O] [bug] latex fragment preview with dvipng ignores :foreground specification

2013-01-25 Thread Nick Dokos
Eric S Fraga e.fr...@ucl.ac.uk wrote:

 Hello,
 
 I am trying to use org-tree-slide for an interactive session I have to
 facilitate soon.  This works quite well, in a geeky kind of way ;-)
 
 However, I do want to display a couple of equations and using latex
 fragments is the most appealing mechanism.  When I try to use
 org-preview-latex-fragment, the latex image is
 generated.  Unfortunately, as I use a black background on my display, I
 cannot see the fragment as it is being generated with black text on a
 transparent background by default.  Note, I am using dvipng for the
 image conversion.
 

I tried the imagemagick setting, set the options variable to black background
and red foreground - lo and behold, that's what I get in the preview.

Nick

 I can customise org-format-latex-options to fix this, or so I
 thought.  No matter what I do, the resulting latex fragment has black
 text.  The problem appears to be that the -fg option to dvipng does not
 work so it doesn't matter how I customise org-format-latex-options.
 
 Can anybody suggest a workaround (without changing the actual latex
 itself)?  I can customise the above variable to set the background for
 latex images to white, which at least allows the equations to be seen,
 but this is a mildly ugly solution.  :( And ruins any geek street cred I
 might have had ;-)
 
 Thanks,
 eric
 
 -- 
 : Eric S Fraga, GnuPG: 0xC89193D8FFFCF67D
 : in Emacs 24.3.50.1 and Org release_7.9.3d-874-gf11acc