After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 688663 - export to pgf latex: custom text colors are not kept in exported tikz file
export to pgf latex: custom text colors are not kept in exported tikz file
Status: RESOLVED FIXED
Product: dia
Classification: Other
Component: exports
0.97.x
Other Linux
: Normal normal
: 0.98
Assigned To: Dia maintainers
Dia maintainers
Depends on:
Blocks:
 
 
Reported: 2012-11-19 17:44 UTC by Dominik Bollmann
Modified: 2013-07-21 15:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
dia-bug.dia: dia file in which the text color bug occurs during a PGF export (672 bytes, application/octet-stream)
2012-11-21 22:44 UTC, Dominik Bollmann
  Details
the PGF file exported from file dia-bug.dia (864 bytes, text/x-tex)
2012-11-21 22:45 UTC, Dominik Bollmann
  Details
a manual change fixing the automatically exported faulty dia-bug.tex file (890 bytes, text/x-tex)
2012-11-21 22:46 UTC, Dominik Bollmann
  Details
Patch that fix pgf plugin render error on custom colors for text (1.24 KB, patch)
2013-07-02 21:40 UTC, Marco Casazza
none Details | Review

Description Dominik Bollmann 2012-11-19 17:44:26 UTC
Hi,

I just noticed the following bug in Dia 0.97.2: 

If I create some diagram with a text object, say "hello world", then change the text color of this object to some new individual color, and then export the diagram using "pgf latex macros", then the individually set text color is lost in the exported tikz file. I.e., if I use this exported tikz file in a latex document, then the text "hello world" inside the tikz file shows up again in black and *not* in the color, that I defined for it using dia.

Hope this helps and you can reproduce this bug! Would be really cool, if someone could fix it quickly :-)

Cheers!
Comment 1 Hans Breuer 2012-11-21 21:59:46 UTC
Just reading the code shows that \pgfsetstrokecolor is set with the text color defined. Maybe it should just use \pgfsetfillcolor or something else. The PGF does not make it clear to me. If you can provide a simple Dia file and the - modified to be working - pgf file I will change the source accordingly.
Comment 2 Dominik Bollmann 2012-11-21 22:44:27 UTC
Created attachment 229600 [details]
dia-bug.dia: dia file in which the text color bug occurs during a PGF export
Comment 3 Dominik Bollmann 2012-11-21 22:45:34 UTC
Created attachment 229601 [details]
the PGF file exported from file dia-bug.dia
Comment 4 Dominik Bollmann 2012-11-21 22:46:28 UTC
Created attachment 229602 [details]
a manual change fixing the automatically exported faulty dia-bug.tex file
Comment 5 Dominik Bollmann 2012-11-21 22:56:45 UTC
@Hans Breuer: Unfortunately, I don't have any insights into the PGF format either. As you pointed out, it seems that the export filter does not set the color of displayed text inside any node correctly (even though the color is set appropriately inside dia). A quick fix for this problem would be to simply surround all displayed text using a \textcolor{dialinecolor}{hello world} when exporting it to PGF. This is exemplified in the dia-bug-original.tex and dia-bug-fix.tex files, which I've comitted above and which solve the issue for me. 

However, I'm pretty certain that there is a better solution to this (i.e., a dedicated \pgf macro, which precisely allows to set the colors of texts). May be the author of the export filter can help here?!

Cheers!
Comment 6 Marco Casazza 2013-07-02 21:40:29 UTC
Created attachment 248257 [details] [review]
Patch that fix pgf plugin render error on custom colors for text

The color is passed as an option to the \node command, instead of set the line color.
Comment 7 Marco Casazza 2013-07-02 21:42:34 UTC
I propose this solution to correct the problem. 
I modified the pgf render plugin and instead of setting the color of the line (which is still made to define a custom color), I pass the color directly into the option of the \node command.
Comment 8 Hans Breuer 2013-07-21 14:22:05 UTC
Thanks for the patch, applied and pushed to master:
https://git.gnome.org/browse/dia/commit/?id=013bbddb0b1cd92eb13bb3d8b2754d693d4eb822