emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Minor problems with dvipng latex image preview


From: Nick Dokos
Subject: Re: [O] Minor problems with dvipng latex image preview
Date: Sun, 26 May 2013 02:38:38 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Nicolas Goaziou <address@hidden> writes:

> Nick Dokos <address@hidden> writes:
>
>> Nicolas Goaziou <address@hidden> writes:
>
>>> Anyway, in a nutshell, your proposal is to:
>>>
>>>   - add a custom variable, e.g., `org-latex-dvi-process-options' (which
>>>     library should it belong to?)
>>
>> Unless it would make sense to toss the whole dvipng thing overboard and
>> just keep imagemagick.
>
> I'm not sure there is a really good reason to drop it. Is it inferior in
> some way?
>

I wouldn't say inferior, although the dvipng implementation is slightly
more brittle than the imagemagick one (imo, of course). But it is two
implementations where one would suffice (Windows might present problems
however: I don't know the availability of dvipng/imagemagick on that
platform - I believe they are both available on MacOS, but I could be
wrong).

The reason I was using dvipng is that the dvipng preview method predated
the imagemagick method so that's where I started and that's where I
stayed, but it was trivial to switch to imagemagick for experimentation
and I may stick with it in the end. And the only reason I can see for
keeping both is so that nobody's workflow gets broken.

> Also, imagemagick is not optimal either. Since it uses
> `org-latex-pdf-process', "pdflatex" is called three times by default,
> which is unnecessary for a short snippet.
>

Agreed. I switched to texi2dvi a long time ago, even patching it when
its infamous bug was still around. By this time, it might even be
possible to actually make it the default (although Windows might present
problems again). But given the history, it doesn't give one the warm
fuzzies either.

> So, both dvipng and imagemagick should have a variable to set the
> program to call, along with its arguments.
>
>>>   - modify `org-latex-listings' docstring (in particular, add third
>>>     elements and new custom variable)
>>
>> I'm not sure any more that it can all be explained clearly in the
>> docstring (at least I've been trying different mental gyrations and I
>> have not come up with anything satisfactory). So maybe the thing to do
>> is add a page to worg and a pointer to it in the docstring. If that's
>> acceptable, I volunteer to write the worg page (at least the initial
>> version).
>
> A worg page can't hurt, but a URL in the docstring is not very handy
> either. It also defeats the "self-documenting" part of Emacs.
>

Agreed again (about the self-documenting part: not sure about the URL
not being very handy), but some things are just too fiddly to fit into a
few sentences. I have now written a document of 335 lines (still not
done and only covering the options available today, but I am trying to
provide enough context to make it stand on its own): I may be suffering
from Pascal's syndrome ("Forgive the length of this letter; I did not
have the time to make it shorter") and I do tend to be verbose in
explanations (as some people on this list can probably testify), but I'm
not sure I can shorten it by much, even if I suddenly turn into
Hemingway - yeah, I wish :-)

In any case, a note like "If you get into trouble or you want to know
more, see FOO for the gory details" does not seem too bad to me.

>> As a separate issue, I proposed some debugging aids:
>>
>>>   - add a custom variable, e.g., `org-latex-dvi-process-debug', which,
>>>     when non-nil asks to leave produced "tex" file.
>>>
>>
>> ... and a call-process-log function that logs the command in *Messages*
>> before executing it with call-process (or something more or less
>> equivalent). It would be used wherever call-process is used now.
>>
>> I would actually propose that the debug variable inhibit the deletion
>> of intermediate files everywhere, not just in latex preview.
>
> Some parts of Org already have their own debug variable (see
> `org-export-async-debug'). A meta debug variable would not be optimal,
> would it?
>

Optimal in what sense? Also, I'm not sure what you mean by a "meta
debug" variable. I was thinking of a more global debug variable (it
would e.g. subsume the role of org-export-async-debug), but you
are right that it's more complicated than that: e.g. there is the
question of what all the intermediate files are and where they are
located.

That's why I wanted a log message in *Messages*: I could then say "keep
all intermediate files" by turning on the variable, carry out the
operation and then look in *Messages* to find out where those files are
- no mucking around through the sources. What I do now is find the
function that produces the file(s), and either edebug it, break at (or
just after) the call-process call site and evaluate the variables to
figure out where everything is, then go look at them; or add a (debug)
call just after and otherwise proceed the same way.

It's not too bad, but I like systems that can tell me what they are
doing, so if the need arises, I can easily figure out what went wrong.

-- 
Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]