Re: More MetaPost text positioning....
- From: "Rob McDonald" <robm asdl gatech edu>
- To: "discussions about usage and development of dia" <dia-list gnome org>
- Subject: Re: More MetaPost text positioning....
- Date: Sat, 25 Feb 2006 12:10:15 -0500
A bug report with a some summary of this mail is the right thing to do.
It does not matter much if you reopen the previous one or open a new one.
Ok, I'll do that.
Talking of UML (class?) diagram I had another issue with the matapost
plug-in: collision with TeX escapes and special chars marking the
access of class members. Could you try Self/dia-core.dia and suggest
some solution (maybe escaping as done in pstricks?).
Yeah, I'm talking about the class diagram. I'm using it for a database
schema, so whatever you want to call it...
The problem with TeX / LaTeX special characters isn't limited to UML
diagrams, it is universal, and it goes deeper than that... I also faced the
problem working with an open source outlining program (I don't remember the
name). It is a difficult problem, and the best solution I know if is to
ignore it and place the burden on the LaTeX user. If they're using LaTeX,
they're probably smart enough to fix it themselves...
Lots of things in LaTeX are special characters. The one I hit all the time
is '&'. If you want to use an ampersand, you have to escape it like this
'\&'. Which works fine, but since Dia objects are sometimes re-sized to fix
the text width, inserting an extra character can slightly mess up the object
width. (Dia sees an extra \ relative to what shows up in LaTeX).
Of course, this problem will always be there. LaTeX does pretty things like
ligature (special merged hybrid characters) on ff and fi. It also does
kerning (squishing together to remove inter-letter white space) on letter
combinations like VA. Dia won't ever match this, so very subtle text width
problems will always persist. Of course, these are really small problems...
A much larger issue is if a user wants to insert a LaTeX formula into a
box...
$E=M\ c^2$
MetaPost export will handle this fine for now, but Dia doesn't have any clue
as to the actual width and height of this text. Imagine if someone were
entering an array or a large, complex equation with bulky fractions. (This
is another reason that I think you should always be able to override the
width of a box, even if the text then overflows the sides. Because, when
LaTeX renders it, its width may be really different. However, I see this is
a LaTeX only feature, and isn't very important.)
So, if you try to put in logic to escape LaTeX special characters in idle
everyday text (& for example) You're going to break the LaTeX formatting of
equations and things where people need to use special characters. (Because
you're going to escape the escape characters).
Right now, if I was using MetaPost to typeset something with equations, I
would do one of two things...
1) Insert junk characters in the text box of an appropriate width and height
(empirically obtained). Then, search & replace the *.mp file for the junk
characters and replace with LaTeX. This is a pain because you have to
manually edit the file all the time.
2) Insert blanks to size the text box appropriately, and then insert a
free-floating label to hold the LaTeX expression. That way, it doesn't
impact the box sizing. This is a pain because repositioning the text within
the box is tougher, especially because you don't really know how big an
equation will be relative to a box. Once you get it right, I suppose you
can group the objects for movement.)
So, in short (yeah right), this is a difficult problem. My solution is to
pass the burden to the LaTeX guy. He already knows about these escape
characters, and these problems should make sense. I'd say don't escape or
modify anything you output. If they see errors when they compile the LaTeX,
they'll know how to fix them.
Furthermore, if the person is advanced enough to be using equations and what
not, then they won't be restricted against that.
The only _true_ fix would be to incorporate a LaTeX based text renderer
directly into Dia. That way, text that was marked as from LaTeX would be
properly processed and rendered in Dia. Given the variety of LaTeX
distributions across platforms, I really don't think this is something that
you want to get into... Of course, if you did, it would add cool formatting
and equation capabilities to Dia...
An example of this kind of functionality is the TeXPoint PowerPoint plugin.
A guy has developed an open-source powerpoint plugin that lets you use LaTeX
as an equation writer (bitmap image generator) for PowerPoint. Double click
on the image, and a LaTeX text editor opens up. Change the equation, click
OK, and it seamlessly compiles the LaTeX to a specified resolution bitmap,
and imports it into PowerPoint. It is pretty slick... He did it with his
own home-brew LaTeX distribution. Making a similar technology
cross-platform would be a nightmare.
Hope this helps,
Rob
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]