Pavel Sanda wrote:
> i see three possibilities:
>
> - one possibility would be to make external template which tries to
> the instant preview from the included file only. it will work 100%
> for typeset output, preview will work for figures and somewhat unreliably
> for the documents i guess.
> (but as noted previously this maybe does not need external template at
> all for the tikz case.)
>
> - to make a python script which would take the parent document dumps the
> preamble, then inputs tikz, latex it and returns figure for both preview
> and output.
>
> - enhance the lyx code for external templates itself; more possibilities
> then -dump the preamble for your scritp somewhere (some tag like
> ParentPreamble dumpfile.tmp) -make some particular command for preview
> generation etc.
The problem is that instant-preview (and most notably dvipng) do not support
pgf/tikz properly yet.
You can put your tikz figures in an external tex file and \input that (this is
how I handle my tikz figures). This works very well, however, if you activate
"Preview" for the include inset, you'll get a very garbled preview.
IMHO the only way to go is an external inset that
* outputs \input{myfigure.tiks} to LaTeX
and
* uses the graphics approach for the preview.
I think this should be possible with the current external templates approach.
Jürgen