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 778836 - Do not escape TeX macros if string is marked properly -- "$...$" or "{...}"
Do not escape TeX macros if string is marked properly -- "$...$" or "{...}"
Status: RESOLVED FIXED
Product: dia
Classification: Other
Component: exports
devel
Other Linux
: Normal normal
: ---
Assigned To: Dia maintainers
Dia maintainers
Depends on:
Blocks:
 
 
Reported: 2017-02-17 14:11 UTC by Josef Kufner
Modified: 2019-03-17 18:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
The patch (1.10 KB, patch)
2017-02-17 14:11 UTC, Josef Kufner
none Details | Review
unescaping only math parts of text (3.22 KB, patch)
2018-09-15 12:03 UTC, Bohdan
none Details | Review

Description Josef Kufner 2017-02-17 14:11:45 UTC
Created attachment 346076 [details] [review]
The patch

Hello,
this patch adds support to TeX strings in Dia for PGF export. If starts and ends with '$', or is enclosed in {curly braces}, then LaTeX special characters are not escaped. This allows to enter math formulae with only a little risk of breaking other strings, like function_names in UML diagrams.

I believe it will solve most problems like #742018, #112377, #143414, and many other.

Patch attached and also available at Github:
https://github.com/jkufner/dia/commit/bed9d8f36820eeef1c114cde3a2b8df4364a6646

Special thanks to https://mail.gnome.org/archives/dia-list/2010-August/msg00020.html for pointing to the right place.
Comment 1 gabriel.puech 2017-03-07 08:47:03 UTC
Dobri djen,

Thank you for patching Dia, sure it will be very usefull. 
I wonder to know how I install Dia with the patch to keep TeX formulae unescaped in PGF export in Ubuntu 16.04 Xenial. 

Should Dia must be recompiled from source and installed with make -install? 

Or is there a specific repo to get the latest packaged version with the most stable environement possible once merged in the git?

Best regards,

Gabriel
Comment 2 gabriel.puech 2017-03-07 08:51:53 UTC
(In reply to gabriel.puech from comment #1)
> Dobri djen,
> 
> Thank you for patching Dia, sure it will be very usefull. 
> I wonder to know how I install Dia with the patch to keep TeX formulae
> unescaped in PGF export in Ubuntu 16.04 Xenial. 
> 
> Should Dia must be recompiled from source and installed with make -install? 
> 
> Or is there a specific repo to get the latest packaged version with the most
> stable environement possible once merged in the git?
> 
> Best regards,
> 
> Gabriel

Sorry guys I wouldn't spam anybody. It isn't the right place to ask this question. 

I apologice.

Sincerly,
Gabriel
Comment 3 Josef Kufner 2017-03-07 09:25:02 UTC
Note for those who wonder how to compile dia:

    ./autogen.sh
    make
    ./app/run_dia.sh

There are no packages, just clone repo from github (or download zip) and run the commands above.
Comment 4 Bohdan 2018-09-15 12:03:25 UTC
Created attachment 373666 [details] [review]
unescaping only math parts of text
Comment 5 Bohdan 2018-09-15 12:08:06 UTC
Hello,

I would like to suggest a little extended patch for this:
https://bugzilla.gnome.org/attachment.cgi?bugid=778836

It leaves unescaped only parts of text that are math expressions (text in '$..$'). I guess it's more usefull as math expressions are mixed with regular text often enough.

Best regards,
Bohdan
Comment 6 Josef Kufner 2018-09-16 09:40:49 UTC
Bohdan: With the original patch, you can include math if you wrap the whole string in curvy brackets, e.g., "{Hello $a^2$.}" is interpreted as "Hello a².", but "Hello $a^2$." stays as "Hello $a^2$.".

The point here is to avoid accidental TeX interpretation as much as possible. For example, "The price is from $2 to $5." should not detect "$2 to $" as TeX math. You add an option to escape the '$', but if a user does not know about this feature, he may be very surprised.
Comment 7 Bohdan 2018-09-17 07:37:55 UTC
Josef: your point makes sense. However,
1. In both cases, if a user didn't know about features, he would be surprised.
2. If he knows about the feature, he may use "The price is from \$2 to \$5."

The reason, why I think it's important to mix math with regular text is: IRL (subjectively, based only on my own experience) there are much more cases when we need both regular and math expressions. But now, there are some issues with text alignment after exporting to tex, so assembling text from several textboxes may lead to ugly exporting output.
Comment 8 Josef Kufner 2019-03-17 18:37:50 UTC
Fixed in https://gitlab.gnome.org/GNOME/dia/merge_requests/3