GNOME Bugzilla – Bug 778836
Do not escape TeX macros if string is marked properly -- "$...$" or "{...}"
Last modified: 2019-03-17 18:37:50 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.
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
(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
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.
Created attachment 373666 [details] [review] unescaping only math parts of text
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
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.
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.
Fixed in https://gitlab.gnome.org/GNOME/dia/merge_requests/3