On Tue, Jul 18, 2006 at 07:01:05PM +0200, Tribulations Parallèles wrote:
> On Tuesday 18 July 2006 16:49, Helge Hafting wrote:
> 
> > Perhaps xfig itself could be better, but I fail to see how using an
> > external application is a problem.
> > Slower? Not really, why should using two apps that do one thing be
> > slower than one app that does two things?  The two-app approach
> > gives security, a crash in xfig does not bring down lyx. A crash
> > in the word drawing program brings down word though.
> 
> I agree, but ideally applications do not crash ;-) Ok, the world is not 
> ideal. 
> I have not an experience of big projects, perhaps stability is a major issue, 
> so important that it is the main reason for the two-app approach.
> 
Most big programs crash.  All webbrowsers capable of using plugins seems
to crash now and then.  That's why I use separate email and web
programs, I deliberately never use a program that does both.  I have
lost too many half-finished emails when "looking up some detail on the
web" and then the browser/mail app died.  

LyX is a kind of program that get used to work on really big documents
some times. It is therefore important that it doesn't crash, and one way
to help this is to not stick other functions than _writing_ and
_formatting_ in it.  Even layout and printing is external to LyX.

Imagine having spent time touching up stuff here and there, all over
some 100-page document and then get a crash. :-(  Fortunately, LyX have
been so stable for me that I am used to leaving a LyX window open over
several days without saving.  Now, LyX does some autosaving and
generally also manages to save upon the rare crashes, but still.  The
more crashes you have, the bigger the chance that you get a non-saving
one.  

> > Lyx has nice support for starting xfig when needed, so you
> > have "integration" even though it is two apps.  And this
> > approach is easily extendible to any other drawing program,
> > should you find something better than xfig for your figures.
> 
> Inkscape seems a very active project, but I think it is more suitable for 
> artists than scientists/engineers:
> - no equations;
> - no CAD functions like the possibility to stop a stroke exactly on a circle.
> Moreover, it seems to me than Qt is quicker than GTK: Qcad is really a quick 
> tool. But Qcad do not allow equations, and is a bit too technical (I think).
>
Then I recommend either trying to get equations into Qcad, or have xfig
extended to do clipping on circle boundaries and such.  The nice thing
about open source is that you can actually copy functionality from one
program to another.

> > Sizing and positioning graphichs in lyx is easy enough.  The drawing
> > program being external does not change this, or could you explain?
> 
> I spoke about the positioning and sizing of the equations in XFIG when 
> exporting "PS/LATEX BOTH PARTS". Sometimes, it is necessary to adjust the 
> positioning in XFIG of the equations, because when compiled by LaTeX, the 
> equation is for example a bit too wide, and overlaps into another object of 
> the drawing.
>
I see.  Well, that is more of a xfig problem then.  About the only way
to fix this is to attempt laying out the equation.  Either by xfig
understanding some latex, or by xfig doing latex testruns in order to
get exact measurements.  Perhaps you can get the xfig maintainer interested?  
A drawing program embedded in LyX would have exactly the same issue, as
the LyX math editor only shows an approximation.

> > Good vector drawing software is nice to have.  The problem with stuffing
> > everything inside lyx is that you get something like word - mediocre
> > vector drawing, mediocre bitmap drawing and so on.  It is better to
> > interface to a well-maintained _good_ drawing program.  Lyx do that with
> > xfig, and I am sure a similiar interface can be made for qcad too. If
> > we were to implement a drawing program inside lyx, there would never be
> > time for matching the quality of these existing programs - why reinvent
> > the wheel?
> 
> Ok. So I must find an external to improve, particularly the support of 
> equations: Inkscape or Qcad? Another?

A quick search of the debian package database brings up
skencil, sodipodi, ivtools and tgif.  I  don't know if any of them fits
your use. Search the web for vector software, and find out what suits
you best.  Setting up the LyX "external inset" mechanism should be
simple, especially if the program can provide postscript or pdf or
some format for which a postscript converter exists.

> > > Other subject: can I find a document that depicts the data structures
> > > employed in LyX, and the structure of the code of LyX? I have searched on
> > > the developer's site, but can't find anything.
> >
> > The lyx sources aren't documented except for preferred coding style.
> > If you want to contribute, feel free to ask tons of questions and they
> > will be answered. :-)
> 
> It is a big work.
> I have experienced code deciphering with SNNS (Stuttgart Neural Net 
> Simulator). And other projects as Easy Timeline.
> But it was C, or Perl, not C++. I have not experienced a lot of C++, just a 
> bit of STL and boost::spirit.
> For the time being, could you suggest an external vector drawing application 
> to improve? The functions that you dream about?
> Have you ever tried to read code of Xfig? Qcad? Inkscape? What project is 
> more 
> suitable for the integration of equations?

Depends on what you think is easy to do.  Xfig already support latex
equations.  It could be improved by adding your clip-to-circle and other
"pro cad" features.  It seems to be written in C.  Shouldn't be too hard
if the math involved is one of your strong points - and you may of
course look at how qcad does that sort of thing too.  Open source is
nice that way.  So I recommend improving xfig, but it is your choice.

I don't know how hard it'd be to add equations to Qcad - in doing so you
also need to know a fair amount of latex in addition to programming.
You will need to understand pretty well how qcad creates its postscript
files. Xfig have a complicated way of generating postscript+latex by
making two files (one with vector postscript and another with latex
formulas) and then the latex document have to include both and make them
overlap.  The nice thing about it is that it is already done so you
won't have to. :-)

> The equations of LyX are displayed in real-time. What is the part of the code 
> or library that performs this? Could it be possible to re-use this library in 
> the code of other application as Inkscape or Qcad for example? Is there a 
> massive use of Qt, such that it is mandatory to use a Qt application?
> Give me your ideas, please. Qcad?

Well, LyX has this "GUI independence" thing so the equation editor works
with all toolkits supported by lyx. (qt3, qt4, possibly xforms and gtk.) 
Note that the equation editor only shows what the formula will look
like, it does not get exact measurements.  So you may still get the
problem with equations overlapping the graphichs now and then.  You
don't know until it is rendered.  The usual way to check these issues is
to make a postscript or pdf file for testing, and just look at it.

Helge Hafting

Reply via email to