On 18/04/2011 8:41 PM, Yang Zhang wrote:
On Mon, Apr 18, 2011 at 1:23 PM, Julien Rioux
<jri...@physics.utoronto.ca> wrote:
On 18/04/2011 2:29 AM, Yang Zhang wrote:
I'm interested in adding a new graphics format (Xournal) to LyX that
can be displayed on-screen and rendered in PDF outputs. Just to get
started, I've been trying to figure out how to add a dummy graphics
format. The input is actually a .tex file (but named .foo), and I
tried adding a converter to PDF, but not luck. Details follow.
In Tools> Preferences, I added a new format with:
Format: foo
Short Name: foo
Extension: foo
Editor: gedit
Viewer: gedit
I also added a new converter to PDF (ps2pdf) with:
pdflatex -outputdirectory /tmp/ /home/yang/blah/blah.foo&& cp
/tmp/blah.pdf $$o
Note I'm ignoring $$i, just for the sake of getting *something* working.
At least for the export to pdf, it should be sufficient to use:
pdflatex $$i
For the display in the LyX buffer, you might have to define a converter to
.png, but imagemagick will be attempted if you don't define a converter.
Now I tried inserting a simple hello world latex file named .foo into
my document as a graphic. With lyx -dbg graphics, I see the following
output, and in the main window I get the error "Error converting to
loadable format." Any hints? Thanks in advance.
--
Julien
OK, some progress.
I tried exporting my document to a PDF, and it worked - the converter
I registered (foo to PDF) does kick in at that point (despite no
in-LyX display).
I then tried adding a dummy foo-to-PNG converter (I have a simple
out.png file sitting around):
cp .../out.png $$o
That worked - I now have in-LyX display.
This leads to some more questions. I thought LyX would be able to
convert the .pdf to a format it can display. At least, that's what I
understand to be happening with "Graphviz Dot," which has just this
converter to "PDF (ps2pdf)":
dot -Tpdf $$i -o $$o
When I insert .dot files as Graphics they display in LyX just fine.
So why does that work for .dot but not .foo? I verified that both
..foo and .dot formats have "Vector graphics format" checked.
Thanks.
Because imagemagick does handle .dot format, but not your .foo format. I
half expected that conversion from foo to pdf to png would occur, but I
guess that's not the case.
--
Julien