emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Windows-unfriendly filename in org-preview-latex-process-alist customization
@ 2016-11-26 15:41 Scott Otterson
  2016-11-26 16:35 ` Fabrice Popineau
  0 siblings, 1 reply; 6+ messages in thread
From: Scott Otterson @ 2016-11-26 15:41 UTC (permalink / raw)
  To: Emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1772 bytes --]

In my Windows build of emacs, when I put the cursor in a latex equation and
run

M-x org-toggle-latex-fragment


then things chug along for a second but then fail.  In the *Org Preview
LaTex Output* buffer, I see the message:

This is dvipng 1.15 Copyright 2002-2015 Jan-Ake Larsson
[1
dvipng: Fatal error, cannot open output file
c:/Users/scott/AppData/Local/Temp/"orgtex4628hQG.png


The reason for the failure is the leftover quote (...Temp/"orgtex...) in
the expected png output file.  With some hackery, I can see that the
command that's being run is:

dvipng -fg "rgb 0 0 0" -bg "rgb 1 1 1" -D "102.0" -T tight -o
"c:/Users/scott/AppData/Local/Temp/""orgtex4628hQG".png
"c:/Users/scott/AppData/Local/Temp/orgtex4628hQG.dvi"


If I paste that into a cygwin xterm, it runs fine on the .dvi file that's
still in the Temp directory.  But the command fails in a Windows cmd
window; if I remove the extra quotes, then the command works in the cmd
window too.

The extra quote comes from the default customization for the dvipng
image-converter field of org-preview-latex-process-alist:

dvipng -fg %F -bg %B -D %D -T tight -o %o%b.png %f


where the %o%b part of the customization concatenates two strings that are
already quoted. That's OK for *nix but apparently not for Windows.

I don't see a way to change the customization to fix this; can anyone take
a look at the elisp?

Thanks,

Scott

--- A test org file --------------

* Put cursor in the equation below and type C-c C-x C-l

\[
e^{i\pi} = -1
\]

--- My setup ---------------
Emacs  : GNU Emacs 25.1.1 (i686-w64-mingw32) of 2016-09-17
Package: Org mode version 9.0.1 (9.0.1-elpaplus @
c:/Users/scott/OneDrive/scotto/.emacs.d/elpa/org-plus-contrib-20161118/)


current state:
==============
(too huge to send)

[-- Attachment #2: Type: text/html, Size: 2792 bytes --]

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

* Re: Bug: Windows-unfriendly filename in org-preview-latex-process-alist customization
  2016-11-26 15:41 Bug: Windows-unfriendly filename in org-preview-latex-process-alist customization Scott Otterson
@ 2016-11-26 16:35 ` Fabrice Popineau
  2016-11-26 23:15   ` Scott Otterson
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Popineau @ 2016-11-26 16:35 UTC (permalink / raw)
  To: Scott Otterson; +Cc: Emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1478 bytes --]

2016-11-26 16:41 GMT+01:00 Scott Otterson <scotto@sharpleaf.org>:

> In my Windows build of emacs, when I put the cursor in a latex equation
> and run
>
> M-x org-toggle-latex-fragment
>
>
> then things chug along for a second but then fail.  In the *Org Preview
> LaTex Output* buffer, I see the message:
>
> This is dvipng 1.15 Copyright 2002-2015 Jan-Ake Larsson
> [1
> dvipng: Fatal error, cannot open output file c:/Users/scott/AppData/Local/
> Temp/"orgtex4628hQG.png
>
>
> The reason for the failure is the leftover quote (...Temp/"orgtex...) in
> the expected png output file.  With some hackery, I can see that the
> command that's being run is:
>
> dvipng -fg "rgb 0 0 0" -bg "rgb 1 1 1" -D "102.0" -T tight -o
> "c:/Users/scott/AppData/Local/Temp/""orgtex4628hQG".png
> "c:/Users/scott/AppData/Local/Temp/orgtex4628hQG.dvi"
>
>
> If I paste that into a cygwin xterm, it runs fine on the .dvi file that's
> still in the Temp directory.  But the command fails in a Windows cmd
> window; if I remove the extra quotes, then the command works in the cmd
> window too.
>
> The extra quote comes from the default customization for the dvipng
> image-converter field of org-preview-latex-process-alist:
>
> dvipng -fg %F -bg %B -D %D -T tight -o %o%b.png %f
>
>
>
This command should read :

dvipng -fg %F -bg %B -D %D -T tight -o "%o%b.png" %f

and the args shouldn't be quoted before.
Unquoting those strings will possibly require to change other command
strings.

Fabrice

[-- Attachment #2: Type: text/html, Size: 2568 bytes --]

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

* Re: Bug: Windows-unfriendly filename in org-preview-latex-process-alist customization
  2016-11-26 16:35 ` Fabrice Popineau
@ 2016-11-26 23:15   ` Scott Otterson
  2016-11-27 11:12     ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Scott Otterson @ 2016-11-26 23:15 UTC (permalink / raw)
  Cc: Emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 2172 bytes --]

Thanks Fabrice.  After more experimentation, I found that image-converter
field of the customization alist should be:

("dvipng -fg %F -bg %B -D %D -T tight -o \"%o%b\.png\" %f")

If this also works for *nix, then I hope that the org-mode maintainers will
make this string the new default.  If it doesn't work on linux, then I hope
that it's possible to come up with a string that works in both OS families
(and that could be the new default).  I'll be back on Linux in a few
months, and would love to keep a simple, cross-platform .emacs file.

On Sat, Nov 26, 2016 at 5:35 PM, Fabrice Popineau <
fabrice.popineau@supelec.fr> wrote:

>
>
> 2016-11-26 16:41 GMT+01:00 Scott Otterson <scotto@sharpleaf.org>:
>
>> In my Windows build of emacs, when I put the cursor in a latex equation
>> and run
>>
>> M-x org-toggle-latex-fragment
>>
>>
>> then things chug along for a second but then fail.  In the *Org Preview
>> LaTex Output* buffer, I see the message:
>>
>> This is dvipng 1.15 Copyright 2002-2015 Jan-Ake Larsson
>> [1
>> dvipng: Fatal error, cannot open output file
>> c:/Users/scott/AppData/Local/Temp/"orgtex4628hQG.png
>>
>>
>> The reason for the failure is the leftover quote (...Temp/"orgtex...) in
>> the expected png output file.  With some hackery, I can see that the
>> command that's being run is:
>>
>> dvipng -fg "rgb 0 0 0" -bg "rgb 1 1 1" -D "102.0" -T tight -o
>> "c:/Users/scott/AppData/Local/Temp/""orgtex4628hQG".png
>> "c:/Users/scott/AppData/Local/Temp/orgtex4628hQG.dvi"
>>
>>
>> If I paste that into a cygwin xterm, it runs fine on the .dvi file that's
>> still in the Temp directory.  But the command fails in a Windows cmd
>> window; if I remove the extra quotes, then the command works in the cmd
>> window too.
>>
>> The extra quote comes from the default customization for the dvipng
>> image-converter field of org-preview-latex-process-alist:
>>
>> dvipng -fg %F -bg %B -D %D -T tight -o %o%b.png %f
>>
>>
>>
> This command should read :
>
> dvipng -fg %F -bg %B -D %D -T tight -o "%o%b.png" %f
>
> and the args shouldn't be quoted before.
> Unquoting those strings will possibly require to change other command
> strings.
>
> Fabrice
>

[-- Attachment #2: Type: text/html, Size: 3880 bytes --]

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

* Re: Bug: Windows-unfriendly filename in org-preview-latex-process-alist customization
  2016-11-26 23:15   ` Scott Otterson
@ 2016-11-27 11:12     ` Nicolas Goaziou
  2016-11-27 21:14       ` Scott Otterson
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2016-11-27 11:12 UTC (permalink / raw)
  To: Scott Otterson; +Cc: Emacs-orgmode@gnu.org

Hello,

Scott Otterson <scotto@sharpleaf.org> writes:

> Thanks Fabrice.  After more experimentation, I found that image-converter
> field of the customization alist should be:
>
> ("dvipng -fg %F -bg %B -D %D -T tight -o \"%o%b\.png\" %f")
>
> If this also works for *nix, then I hope that the org-mode maintainers will
> make this string the new default.  If it doesn't work on linux, then I hope
> that it's possible to come up with a string that works in both OS families
> (and that could be the new default).  I'll be back on Linux in a few
> months, and would love to keep a simple, cross-platform .emacs file.

I introduced %O, which is the absolute output file name, as
a replacement for %o%b.extension.

Could you confirm the bug is fixed?

Regards,

-- 
Nicolas Goaziou

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

* Re: Bug: Windows-unfriendly filename in org-preview-latex-process-alist customization
  2016-11-27 11:12     ` Nicolas Goaziou
@ 2016-11-27 21:14       ` Scott Otterson
  2016-11-27 22:12         ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Scott Otterson @ 2016-11-27 21:14 UTC (permalink / raw)
  To: Scott Otterson, Emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 997 bytes --]

Happy to try it out.  Should I expect the change on elpa/org sometime soon?

Scott

On Sun, Nov 27, 2016 at 12:12 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Scott Otterson <scotto@sharpleaf.org> writes:
>
> > Thanks Fabrice.  After more experimentation, I found that image-converter
> > field of the customization alist should be:
> >
> > ("dvipng -fg %F -bg %B -D %D -T tight -o \"%o%b\.png\" %f")
> >
> > If this also works for *nix, then I hope that the org-mode maintainers
> will
> > make this string the new default.  If it doesn't work on linux, then I
> hope
> > that it's possible to come up with a string that works in both OS
> families
> > (and that could be the new default).  I'll be back on Linux in a few
> > months, and would love to keep a simple, cross-platform .emacs file.
>
> I introduced %O, which is the absolute output file name, as
> a replacement for %o%b.extension.
>
> Could you confirm the bug is fixed?
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 1581 bytes --]

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

* Re: Bug: Windows-unfriendly filename in org-preview-latex-process-alist customization
  2016-11-27 21:14       ` Scott Otterson
@ 2016-11-27 22:12         ` Nicolas Goaziou
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2016-11-27 22:12 UTC (permalink / raw)
  To: Scott Otterson; +Cc: Emacs-orgmode@gnu.org

Scott Otterson <scotto@sharpleaf.org> writes:

> Happy to try it out.  Should I expect the change on elpa/org sometime
> soon?

If you cannot test it straight from Org repository, you need to wait
until tomorrow. It will then be included in the new Org ELPA package.

Regards,

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

end of thread, other threads:[~2016-11-27 22:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-26 15:41 Bug: Windows-unfriendly filename in org-preview-latex-process-alist customization Scott Otterson
2016-11-26 16:35 ` Fabrice Popineau
2016-11-26 23:15   ` Scott Otterson
2016-11-27 11:12     ` Nicolas Goaziou
2016-11-27 21:14       ` Scott Otterson
2016-11-27 22:12         ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).