Re: Formulas in diagrams exported to LaTeX... Last known working version?



I tinkered around a bit.  I was able to typeset at least some formulas
by modifying the pgf export plugin.  I'm sure this will still have
formula alignment issues, but it at least works for characters and
small expressions.  Here is a diff:

Index: plug-ins/pgf/render_pgf.c
===================================================================
--- plug-ins/pgf/render_pgf.c   (revision 4384)
+++ plug-ins/pgf/render_pgf.c   (working copy)
@@ -1116,18 +1116,18 @@
     p = (char *) src;
     while (*p != '\0') {
        switch (*p) {
-       case '%': g_string_append(dest, "\\%"); break;
-       case '#': g_string_append(dest, "\\#"); break;
-       case '$': g_string_append(dest, "\\$"); break;
-       case '&': g_string_append(dest, "\\&"); break;
-       case '~': g_string_append(dest, "\\~{}"); break;
-       case '_': g_string_append(dest, "\\_"); break;
-       case '^': g_string_append(dest, "\\^{}"); break;
-       case '\\': g_string_append(dest, "\\ensuremath{\\backslash}"); break;
-       case '{': g_string_append(dest, "\\{"); break;
-       case '}': g_string_append(dest, "\\}"); break;
-       case '[': g_string_append(dest, "\\ensuremath{[}"); break;
-       case ']': g_string_append(dest, "\\ensuremath{]}"); break;
+       case '%': g_string_append(dest, "%"); break;
+       case '#': g_string_append(dest, "#"); break;
+       case '$': g_string_append(dest, "$"); break;
+       case '&': g_string_append(dest, "&"); break;
+       case '~': g_string_append(dest, "~"); break;
+       case '_': g_string_append(dest, "_"); break;
+       case '^': g_string_append(dest, "^"); break;
+       case '\\': g_string_append(dest, "\\"); break;
+       case '{': g_string_append(dest, "{"); break;
+       case '}': g_string_append(dest, "}"); break;
+       case '[': g_string_append(dest, "["); break;
+       case ']': g_string_append(dest, "]"); break;
        default:
             /* if we really have utf8 append the whole 'glyph' */
             g_string_append_len(dest, p, g_utf8_skip[(unsigned char)*p]);


On Sun, Feb 13, 2011 at 4:58 PM, Andrew Wagner <drewm1980 gmail com> wrote:
Hello-

First of all, dia is great; currently the best diagram editor for
linux as far as I'm concerned.  However, I need to put LaTeX formulas
into my diagrams, and can't get it to work.  I get the impression from
the FAQ that it worked at some point for someone.  Does anyone know of
any known working versions?  I'm willing to recompile an old version
if necessary, and to use any latex rendering path necessary.

I'm using Debian 5 (lenny) with dia 0.97.1

It seems there are at least a couple other people having trouble too:

http://www.mail-archive.com/dia-list gnome org/msg12118.html
http://www.reddit.com/r/LaTeX/comments/evpnl/export_latex_formulas_from_dia/

Thanks!
Drew




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]