Dear all,Those who were in Albufeira probably remember the hack I showed that allowed to copy-paste from TeXmacs to Inkscape with the possibility to re-edit the original content in TeXmacs. With this feature, one can use Texmacs as a convenient wysiwyg equation editor for Inskcape. You can also copy-paste other image formats (png, jpg ...) to other applications (e.g. LibreOffice), but with no re-edition capability so far.
What I showed in Albufeira was really an ugly hack on the texmacs side, partly implemented with a python script. With some input from Joris I could rewrite this in scheme, and Joris recently committed it.
Please be kind enough to consider this stuff as work in progress. Presently I would say it is fairly usable in Linux (on which I develop) and Joris reports it works already partly on MacOS. I'd greatly appreciate help from those of you guys working on MacOS (Max, Miguel, any free time?) and Windows (Denis?) to make it fully working on those platforms.
See the attached file for installation instructions, usage, and present limitations/known issues.
Best regards, Philippe
<TeXmacs|1.0.7.15> <style|generic> <\body> <section|Install> <\enumerate-numeric> <item>TeXmacs needs external converters to produce images. Make sure you have the required converters installed and in your path <\itemize-minus> <item>Ghostscript's utilities <verbatim|ps2pdf> and <verbatim|ps2epsi> <item>ImageMagick's <verbatim|convert> <item><verbatim|pdf2svg> (available in most Linux distributions, and MacPorts provide it for MacOS) </itemize-minus> <item>If you want to use the feature with Inkscape, you'll need Inkscape version \<gtr\>= 0.47 (current stable is 0.48.3). In MacOS Joris reports that the dmg from Inkscape website lacks a python library necessary to re-edit equations, but MacPorts' Inkscape is fine. Be sure to install Inkscape before the next step. <item>Get and compile the latest TeXmacs from svn. After install, run <verbatim|texmacs --setup> once, in order to install the ``TeXmacs equation'' plugin in your user Inkscape directory, that will allow re-editting equations.\ </enumerate-numeric> <section|Usage> You can export the texmacs selection as a graphics file using "File/Export/Selection as graphics..." (The image format that gets exported is determined from the file extension you specify). You can copy texmacs selection to the clipboard using "edit/copy to image". The graphics format that gets pasted on the clipboard is defined in "Preferences/Converters/Selection-\<gtr\>Image on clipboard". SVG graphics created this way can be opened or pasted in Inkscape and re-edited in texmacs provided the "texmacs equation" inkscape extension is installed in the proper location (see Install). Bitmaps formats images can be copy-pasted to many applications (Gimp, LibreOffice, (wine-)PowerPoint,...) <subsection|Modifying/Inserting a TeXmacs equation from within an Inkscape drawing> Select an existing equation (or nothing to enter a new one) and chose the menu item "Extensions/TeXmacs equation". This should bring up the equation to be edited in a <em|new> TeXmacs instance. During edition Inkscape is in a modal dialogue: you cannot do anything before terminating the edition of this equation. This is an Inkscape limitation; not my fault. In Texmacs however, you can open another document where you already have the equation you want and paste it to the document opened from Inkscape. When finished, everything between the top of the document and the line saying "When finished ... " will be converted to svg and transferred to Inkscape. You will have to authorize the script on a case by case basis or permanently in ``Preferences/Security/Accept all scripts''. Be cautious however if you already had a Texmacs instance running with an important document : the new instance clears the cached files of the first instance and that may crash it (see bug ).\ In Inkscape these equations are grouped objects. If you ungroup the equation you loose the ability to re-edit it (the texmacs code is inside that group, and is lost with the ungrouping). You can however enter the group by double-clicking it and then mofify the content of the group (add elements, colorize items, move them around.... double click outside the equation on a blank part to leave the group when you're done). Of course if you re-edit an equation changed this way in Inkscape, such changes will be lost. Some global transforms made on the group such as rotation, zoom, effects,... will survive editing though, but not a global color change (you will need to re apply it). If you want colored equations, it is preferable to apply colors inside TeXmacs. <subsection|Compatibility with Inscape plugin Textext> People using Textext equations in Inkscape (re-editable Latex equations plugin shipped with Inkscape) can edit the equations you produce with texmacs, provided they use the style file containing the texmacs macros and necessary includes. Conversely, you can work on their files, re-opening their textext equations with texmacs. Hence, you can keep collaborating with people who do not (yet) want to switch to texmacs equations. <subsection|Present limitations and Known Issues> Presently the copy-paste mechanism is not working on MacOS. The machinery used is based on Qt and should be cross-platform, but there seems to be a twist. I would appreciate if someone could debug this since I do not have a Mac myself. No testing has been done so far on the windows platform. Pathes and calls to external converters surely need adjustment. If someone wants to peek into this I can provide the pdf2svg.exe converter that is needed. If some characters appear pixelated in Inkscape, you are maybe missing some extra font (download the extra font package from texmacs website), or texmacs is not configured for "type 1 font" printing preference. Note however that some characters (e.g. strechable arrows) are inherently bitmaps already in TeXmacs<with|color|orange|>. Presently you cannot copy-paste between two TeXmacs instances (say, when you are re-editing an equation from Inkscape). A work-around is to perform an intermediate paste and copy again in a plain text editor. If the selection in texmacs contains an embedded postscript image, there is a high probability that the svg will be invalid (the postscript raw data is not properly escaped for #00 characters). Then Inkscape simply pretends there is no data on the clipboard. If the selection contains a macro call with the macro definition outside of the selection, it won't be rendered (\<less\>error\| compound xx\<gtr\>)... \; </body> <\initial> <\collection> <associate|language|british> <associate|prog-scripts|maxima> </collection> </initial> <\references> <\collection> <associate|auto-1|<tuple|1|?>> <associate|auto-2|<tuple|2|?>> <associate|auto-3|<tuple|2.1|?>> <associate|auto-4|<tuple|2.2|?>> <associate|auto-5|<tuple|2.3|?>> </collection> </references> <\auxiliary> <\collection> <\associate|toc> <vspace*|1fn><with|font-series|<quote|bold>|math-font-series|<quote|bold>|Install> <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>> <no-break><pageref|auto-1><vspace|0.5fn> <vspace*|1fn><with|font-series|<quote|bold>|math-font-series|<quote|bold>|Usage> <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>> <no-break><pageref|auto-2><vspace|0.5fn> <with|par-left|<quote|1.5fn>|Modifying/Inserting a TeXmacs equation from within an Inkscape drawing <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>> <no-break><pageref|auto-3>> <with|par-left|<quote|1.5fn>|Compatibility with Inscape plugin Textext <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>> <no-break><pageref|auto-4>> <with|par-left|<quote|1.5fn>|Known Issues <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>> <no-break><pageref|auto-5>> </associate> </collection> </auxiliary>
_______________________________________________ Texmacs-dev mailing list Texmacs-dev@gnu.org https://lists.gnu.org/mailman/listinfo/texmacs-dev