On 21/01/2011 12:40 PM, [email protected] wrote:
As far as I understand it preview-latex is useful because 1)
Some macros
defined outside the preview environment might still be needed
by TeX to
process the code inside the environment. Howver this is not always
obvious to LyX (especially since we don't even attempt to
parse any ERT
insets.
Mmmh, macros defined outside? And how preview-latex can help in this way?
OK, so at the moment LyX outputs a 0lyxpreview.tex file containing
*only* the snippets which need updated previews. I think I realized this
at some point, but I had forgotten. When I wrote the above mail I was
under the impression that the whole TeX file gets processed with
preview-latex active, including any macro definitions and what else that
are outside preview insets.
(I think) What preview-latex does in active mode is process for output
only the pieces inside preview environments, but TeX still parses
everything in the file, meaning that when TeX reaches a particular
preview snippets, the TeX engine is in a particular state. This state
can be different if you strip everything out of the TeX file except for
the preview environment. Apparently the latter is what LyX does anyway,
so preview-latex is of no use here.
2) It does the cropping for you (at least when using
pdflatex, I
don't remember for the other backends).
Not a big advantage for all the suffering is causing us :P
So I checked this now and with preview-latex and pdflatex you get each
preview on its own page and each page of the proper dimension, so that
you don't need further cropping. With preview-latex and latex you get
each preview on its own page but all pages are same dimension (?!) so
the only benefit is to have one preview per page, which we could do as
well with \pagebreak it seems.
Aslo preview-latex was developed by or in parallel with auctex
developers to provide small png previews while editing a tex file in
emacs. Perhaps they know better.
I'll investigate that. Maybe it's faster in some way.
It's awesome that you spent the time to look into this code and that you
made previews of tikz picture work.
Thanks!
--
Julien