Data Exchange plugin

Data Exchange plugin - share data between SMath Studio and CSV/ODF/ODS/ODT/XeLaTeX files - Messages

#41 Posted: 1/19/2013 10:02:43 AM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Wrote

Wrote


Try the attached DataExchange.dll



images now have the correct size, thank you for the bug fix. Also, direct word read in is possible (zugstab-export-1.odt). However, in this case only images and text regions are read, all math regions (formulas) are broken.

Intermediate load and save with libreoffice (zugstab-export-LO-1.odt) improves the word import, still the formatting of control structures is broken.

In general, opening both odt files with word generates error messages. If saved as docx from Libreoffice, then Word can read the file cleanly, still formatting is broken (mainly due to centering of math items)

Martin



I've found (and removed) the cause of MS word annoying message.

Any ODT Formula it's composed by two parts: the first, a MathML Markup code, and then the StarMath code (what do you see in the Formula editor as "the code" ). Both LibreOffice and OpenOffice don't require the first one, but seems that MS Word (although not explicitly) need it. Some little test that I've done to introduce the MathML code don't produce the expected result so, as for now, the MS office compatibility is limited to texts and images. [edit] The MathML code will be available ASAP.

Actually an idea could be to add an option to export ODT formulas as images; Further improvements could be added with the next OpenOffice or LibreOffice SDK.

[edit] Russian translation in progress, many tanks to mikekaganski

regards,

w3b5urf3r
Options_2.png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#42 Posted: 1/22/2013 3:24:03 PM
xyonx

xyonx

0 likes in 10 posts.

Group: User

hi DC,

save as ODT's amazing plugin
more work needed to get document look likes a textbook

UserPostedImage

i usually using repetitive tedious works, add manually ""phantom{...} to hiding, so document become readable and not making eyes victim



just wondering, is this possible to do automatically formating by default? since OOo/LO hard and maybe can not access find and replace for embeded formula

thx u s much
#43 Posted: 1/23/2013 4:20:24 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Wrote

hi DC,

save as ODT's amazing plugin
more work needed to get document look likes a textbook

i usually using repetitive tedious works, add manually ""phantom{...} to hiding, so document become readable and not making eyes victim

just wondering, is this possible to do automatically formating by default? since OOo/LO hard and maybe can not access find and replace for embeded formula

thx u s much



Hi xyonx,

I think it's possible, I'll try to see what can be done

IMHO your multiline approach it's a very interesting way to represents results and could be an useful solution for Andrey to implement the "Display values with definition" request of SMath users.


best regards,

w3b5urf3r


P.S. the MS Word compatibility of ODT documents containing formulas was reached; with regard to the alignments of the functions I haven't found a way to force MS Word to do it.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#44 Posted: 1/24/2013 5:21:05 PM
Rising Eagle

Rising Eagle

15 likes in 23 posts.

Group: User

Wrote

P.S. the MS Word compatibility of ODT documents containing formulas was reached; with regard to the alignments of the functions I haven't found a way to force MS Word to do it.



Websurfer,

Very impressed with your projects.

Don't know if this is relevant or how sophisticated you want to be about reformatting stuff, but this thought may be of use. MS word has a facility (as does LO) called tables. When tables are created, each area in the grid is like a mini-page on its own and can be formatted independently of all the others. To align equations, make a 4 column table, put the equals sign (=) in the third column, and narrow the column width to the minimum needed to leave the equals sign visible. Then place equation numbers in the first column, and the LHS and RHS expressions in the second and far right columns. Align the LHS to the right and the RHS to the left. All equals signs and RHS expressions to follow on subsequent lines will be aligned properly.

In the LO file below, tables are used with mathml formula objects in the second and far right columns. Text is used in the first and third columns. This table formatting works in MS office as well. I adjusted the font size of the equals sign until it looked right.

Btw, how does one make math expressions (is it latex?) in these forum posts?
Screenshot-1.png
#45 Posted: 1/25/2013 11:51:44 AM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

PLUGIN UPDATED

  • added "Save as... > LaTeX Text Document";
  • ODT saving:
    - ouptut ODTs now are compatible with MS word (brackets looks better than saving the file from libreoffice)
    - added options on ODT saving (Save text as images/Save formulas as images/evaluate equations)
    - "Print Area Regions" settings from "Page Setup..."
    - SMath texts on multiple lines now are shown on multiple lines even in the output file.
    - minor changes
  • ODF saving: each evaluation (input formula/symbolic/numeric) written on a different line of code;
  • Embedded languages: ENGLISH/ITALIAN/RUSSIAN



best regards,

w3b5urf3r
PolyProperties_2012.01.00[RC6].pdf - TeXworks.png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
5 users liked this post
sergio 1/25/2013 2:52:00 PM, Martin Kraska 1/25/2013 5:17:00 PM, Mike Kaganski 1/25/2013 6:34:00 PM, Oscar Campo 1/29/2013 3:45:00 PM, Radovan Omorjan 1/25/2013 12:39:00 PM
#46 Posted: 1/25/2013 5:16:29 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Hello w3bsurf3r,

thanks for updating the plugin. The Latex-export looks great (not yet tested, but your preview looks promising).

Just a small remark:
default export path is not defined by where the current sm file is but by the current directory. If you first launch SMath, then the current directory for the entire session regardless which files are opened afterwards is where the executable is.

As plugins need to be used with the msi-Installer version, the executable path is normally read only and example execution fails. Anyway you do not want to clutter the install dir by accidental export data.

When you just launch a sm file in the file manager, then current dir is equal to sm file dir.

If you have any chance to determine the sm file path name independently from the current dir, then I would recommend to use this and thereby be consistent to what your docs and examples say. This is would make the target dir more predictable and independent of how the file was opened. Otherwise the comments in the examples might need correction.

Martin
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 users liked this post
Mike Kaganski 1/25/2013 6:35:00 PM
#47 Posted: 1/25/2013 7:25:10 PM
Mike Kaganski

Mike Kaganski

184 likes in 434 posts.

Group: User

w3bsurf3r,

Thank you for this new release.
Now that you have included MathML code to the plugin, would it be possible to add a "copy to clipboard as MathML" command and context menu item? It would be of a value for those who use Word and other apps that accept MathML right from the clipboard.

EDIT: here the required clipboard media types are explained. I suppose that simple "MathML" is enough.
Also, possibly there is a possibility to import the MathML from the clipboard (if you can implement the MathML-to-SMath conversion). The code to handle the clipboard in this case may be found here.

EDIT 2: copy to clipboard as TeX would be also desirable for uses such as Wiki and MathType.
С уважением, Михаил Каганский
#48 Posted: 1/25/2013 8:04:51 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Hello W3bsurf3r,

after a closer look to the latex export I recommend the following:

- left align the equations using \usepackage[fleqn]{amsmath}

- typeset the break and continue statements in roman (mathrm)

- remove all empty lines (less space between equations)

- provide choices (if possible with adjustable default settings) for
- assignment operator (:= vs def over =)
- equation numbering (starred or unstarred equation environment)

Martin
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#49 Posted: 1/26/2013 9:48:39 AM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Wrote

Don't know if this is relevant or how sophisticated you want to be about reformatting stuff, but this thought may be of use. MS word has a facility (as does LO) called tables. When tables are created, each area in the grid is like a mini-page on its own and can be formatted independently of all the others. To align equations, make a 4 column table, put the equals sign (=) in the third column, and narrow the column width to the minimum needed to leave the equals sign visible. Then place equation numbers in the first column, and the LHS and RHS expressions in the second and far right columns. Align the LHS to the right and the RHS to the left. All equals signs and RHS expressions to follow on subsequent lines will be aligned properly.

In the LO file below, tables are used with mathml formula objects in the second and far right columns. Text is used in the first and third columns. This table formatting works in MS office as well. I adjusted the font size of the equals sign until it looked right.

Btw, how does one make math expressions (is it latex?) in these forum posts?


Hi rising eagle, It's a good idea but quite complicated to generate undefined levels of nested equations/statements (but I've done something similare for LaTeX, where tables and formulas can be mixed easily).

About formulas in forum posts look here

Wrote

Just a small remark:
default export path is not defined by where the current sm file is but by the current directory. If you first launch SMath, then the current directory for the entire session regardless which files are opened afterwards is where the executable is.

As plugins need to be used with the msi-Installer version, the executable path is normally read only and example execution fails. Anyway you do not want to clutter the install dir by accidental export data.

When you just launch a sm file in the file manager, then current dir is equal to sm file dir.

If you have any chance to determine the sm file path name independently from the current dir, then I would recommend to use this and thereby be consistent to what your docs and examples say. This is would make the target dir more predictable and independent of how the file was opened. Otherwise the comments in the examples might need correction.


Thank you Martin, you have found a couple of bugs... Actually I can change the output directory of new SMath files (maybe can be the desktop or documents folder); unfortunately seem that both
Environment.CurrentDirectory
and
Directory.GetCurrentDirectory()
don't change when you save the file in another directory ...

Wrote

Now that you have included MathML code to the plugin, would it be possible to add a "copy to clipboard as MathML" command and context menu item? It would be of a value for those who use Word and other apps that accept MathML right from the clipboard. EDIT 2: copy to clipboard as TeX would be also desirable for uses such as Wiki and MathType.


Hi Mike, I'm not sure that I can add a new "global" context menu item from a plugin (and actually I'm not able to add a context menu item in a single function - one of my goals for NonlinearSolvers next stage of development)

However I think that is a good idea...

Wrote

after a closer look to the latex export I recommend the following:
- left align the equations using \usepackage[fleqn]{amsmath}
- typeset the break and continue statements in roman (mathrm)
- remove all empty lines (less space between equations)
- provide choices (if possible with adjustable default settings) for
-- assignment operator (:= vs def over =)
-- equation numbering (starred or unstarred equation environment)



- left align the equations using \usepackage[fleqn]{amsmath} -> done
- typeset the break and continue statements in roman (mathrm) -> fixed (LaTeX/StarMath/MathML) (\operatorname may be better?)
- remove all empty lines (less space between equations) -> mhhh... we don't lose tex file readability from the user?
- provide choices (if possible with adjustable default settings) for
-- assignment operator (:= vs def over =)
-- equation numbering (starred or unstarred equation environment)
ok... consider that actually you can easily change the define equal of the entire file by editing the header

\newcommand{\defeq}{\stackrel{\text{\tiny def}}{=}} % SMath 'define equal'


best regards,

w3b5urf3r
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#50 Posted: 1/26/2013 1:41:53 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

- left align the equations using \usepackage[fleqn]{amsmath} -> done
- typeset the break and continue statements in roman (mathrm) -> fixed (LaTeX/StarMath/MathML) (\operatorname may be better?)

I guess this just affects spacing, which should not relevant without having operands.

Wrote

- remove all empty lines (less space between equations) -> mhhh... we don't lose tex file readability from the user?

If the empty lines are just for source readibility then just start them with %

Wrote

- provide choices (if possible with adjustable default settings) for
-- assignment operator (:= vs def over =)
-- equation numbering (starred or unstarred equation environment)
ok... consider that actually you can easily change the define equal of the entire file by editing the header

I admit that these proposals were just matter of comfort. The trade between user comfort and coding effort is of course your decision.

Perhaps, an alternative could be to have sort of template in some sensible place (somewhere in install dir or in a system user dir). The default then would be what you currently have.
I bet there is no chance to design a single template such that it works in any language environment. In my case, the german umlauts fail to compile, even if I use my input- and fontencoding from the handbook source. Perhaps there is just too much side effects and dependencies between the packages (I never used some of the ones in the latex export).

However, this feature is of course much lower on my wish list than the automatic area region to file export feature (much desired for automated doc/handbook updates with new program versions).

Martin





Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#51 Posted: 1/27/2013 3:00:06 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Wrote

I admit that these proposals were just matter of comfort. The trade between user comfort and coding effort is of course your decision.

Perhaps, an alternative could be to have sort of template in some sensible place (somewhere in install dir or in a system user dir). The default then would be what you currently have.
I bet there is no chance to design a single template such that it works in any language environment. In my case, the german umlauts fail to compile, even if I use my input- and fontencoding from the handbook source. Perhaps there is just too much side effects and dependencies between the packages (I never used some of the ones in the latex export).



As for languages issues, my idea was to export the worksheet as a XeLaTeX document with XITS Math fonts and Linux Libertine fonts... it supports accented letters, german umlauts and cyrillic script...
Test XeLaTeX.zip (12 KiB) downloaded 68 time(s).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#52 Posted: 1/27/2013 4:47:34 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Hello w3bsurf3r,

Would it be possible to provide importData versions without cell specification, which read the rectangular envelope of all non-empty cells? e.g. importData.XLSX("filename";"sheetname" ).

Currently, external input data of unknown size can be read with importdata(), but not with the ods or xlsx import. At least not without looping and adress string construction and the like.

Sorry for bothering you again with a matter of comfort

Martin
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#53 Posted: 1/27/2013 5:39:43 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote


As for languages issues, my idea was to export the worksheet as a XeLaTeX document with XITS Math fonts and Linux Libertine fonts... it supports accented letters, german umlauts and cyrillic script...


That might be a good way. My exported docs compiled with xetex and had the umlauts right. With pdflatex they are lost by whatever reason. pdflatex works fine for my handbook, which is full of umlauts. But never mind, I'll just add "use xelatex to compile latex export" to the survival rules.

Martin



Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#54 Posted: 1/28/2013 3:37:01 AM
Infinity

Infinity

3 likes in 30 posts.

Group: User

Wrote

I'm not sure that I can add a new "global" context menu item from a plugin (and actually I'm not able to add a context menu item in a single function - one of my goals for NonlinearSolvers next stage of development)



At the moment it is only possible to add menu items below the "Insert" item. I already talked with Andrey about it. You have to use a class with interface "IPluginCustomRegion" to add menu items. For reference, have a look at Andrey's CheckBoxRegion plugin (see ComboBoxImpl.cs).

Infinity
#55 Posted: 1/28/2013 4:07:00 AM
xyonx

xyonx

0 likes in 10 posts.

Group: User

hi DC, thanx for updating plugins

try using plugins, save as ODF/ODT all symbols did not display (except for Pi) since it contains "i" at beginning symbol code in OOo math



and here's display result,



please consider, is this crucial for math? thx u
#56 Posted: 1/28/2013 8:32:04 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

I cannot reproduce the problem, see image.
Exporttest.PNG
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#57 Posted: 1/28/2013 10:13:26 AM
Mike Kaganski

Mike Kaganski

184 likes in 434 posts.

Group: User

Wrote

I cannot reproduce the problem, see image.



It seems like xyonx have removed the standard content of the LO/OOO Math Collection. My system gives the same for %ivartheta.

Generally I prefer to use greek characters themselves (plus usual Math decoration) and avoid using the collection names. This makes greek to look consistent with other text, no need to use special font for greek since most modern unicode fonts support it, and it enables to use several "styles" of formulas (if using collection, I would need to define a full new set for each style). Maybe it's worth it to use unicode greek char codes instead of the %igreeknames?

However, there may be some pitfalls that I haven't met at my setup...
С уважением, Михаил Каганский
#58 Posted: 1/28/2013 11:15:45 AM
xyonx

xyonx

0 likes in 10 posts.

Group: User

hi ALL, thx for quick reply

maybe it's about office software & language installation compatibility, i'm using Lotus Symphony 3 Release 3.0.1 FP2

btw, i did not find any %i.. code to write symbol in OOo/LO user guide (English version),



just seeking and i found this topics in LO UG German version (p.12)



i'm not really understand but it's look like the %i.. code required to emphasize italic font in math formula

just asking why the ODF/ODT standard did not consistent in displaying formula content?

#59 Posted: 1/28/2013 5:12:56 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Wrote

hi DC, thanx for updating plugins

try using plugins, save as ODF/ODT all symbols did not display (except for Pi) since it contains "i" at beginning symbol code in OOo math

please consider, is this crucial for math? thx u


Thank you, I'll fix it ASAP! [DONE]


best regards,

w3b5urf3r
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#60 Posted: 1/28/2013 5:37:54 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Wrote

At the moment it is only possible to add menu items below the "Insert" item. I already talked with Andrey about it. You have to use a class with interface "IPluginCustomRegion" to add menu items. For reference, have a look at Andrey's CheckBoxRegion plugin (see ComboBoxImpl.cs).

Infinity

I asked myself Andrey some time ago and it's possible also in the context menu but I miss something (see ComboBoxRegion and ConstructorRegion plugins; latest changes don't work with actual libraries, so I imagine that something is growing behind scenes)... My issue it's how to apply the interface in a "function primitive" (e.g. my proposal to Andrey was to extend the example function binomial()). Obviously any help is welcome


Wrote

Hello w3bsurf3r,

Would it be possible to provide importData versions without cell specification, which read the rectangular envelope of all non-empty cells? e.g. importData.XLSX("filename";"sheetname" ).

Currently, external input data of unknown size can be read with importdata(), but not with the ods or xlsx import. At least not without looping and adress string construction and the like.

Sorry for bothering you again with a matter of comfort

Martin

Yes, it's possible... [DONE]

Wrote

- provide choices (if possible with adjustable default settings) for
-- assignment operator (:= vs def over =)
-- equation numbering (starred or unstarred equation environment)

[DONE] (can memorize settings)
Options.png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
2 users liked this post
Martin Kraska 1/31/2013 7:44:00 PM, Radovan Omorjan 2/1/2013 5:03:00 AM
  • New Posts New Posts
  • No New Posts No New Posts