Bård wrote:
I’ve been looking into the details of the “customize.xxe”-system. We
would like to replace the PNG output from texmathtoimg.bat with SVG. The
reason is that SVG renders much better in a browser, in particular when
users zoom. It is also easier to scale the image using the viewport
scale settings.
So the idea is to modify the texmathtoimg.bat to cater for SVG output
using dvisvgm from https://dvisvgm.de <https://dvisvgm.de>
If you download and install (using XXE's "Options|Install Add-ons") the
add-on alled "A sample customize.xxe" (see
https://www.xmlmind.com/xmleditor/addons_doc.html#sample_customize_xxe),
you'll find in directory XXE_user_prefs_dir/addon/sample_customize_xxe/
customize.xxe
and
imagetoolkits.incl
and
texmathtoimg
texmathtoimg.bat
The <imageToolkit name="TeX Math"> found in imagetoolkits.incl invokes
shell script/BAT script texmathtoimg.
---
<imageToolkit name="TeX Math">
<description>Converts TeX mathematics to PNG, EPS, PDF.
Important: requires Ghostscript 8+.</description>
<converter>
<!-- First line of the TeX file must be "%tex" if you want to be able
to embed base64-encoded ``TeX images'' in your documents. -->
<input extensions="tex" magicStrings="%tex"/>
<output extensions="png eps ps pdf"/>
<shell command='"%C%Stexmathtoimg" "%I" "%O"' platform="Unix"/>
<shell command='call "%C%Stexmathtoimg.bat" "%I" "%O"'
platform="Windows"/>
</converter>
</imageToolkit>
---
You should modify the above <imageToolkit> to suit your needs, for example:
0) First of all, pleas make sure to uncomment in
sample_customize_xxe/customize.xxe.
--
<include location="imagetoolkits.incl" />
--
1) Replace
<output extensions="png eps ps pdf"/>
by
<output extensions="svg"/>
2) Replace the invocations of texmathtoimg by the invocations of a shell
script/BAT script of your own leveraging dvisvgm.
We have not tested this specifc <imageToolkit> for a very long time
because we don't have TeX installed on our development Linux boxes but
we don't see why this would not work. After all SVG is accepted
everywhere PNG is.
- The reference documentation of <imageToolkit> is found here:
https://www.xmlmind.com/xmleditor/_distrib/doc/configure/imageToolkit.html
- The reference documentation of customize_xxe is found here:
https://www.xmlmind.com/xmleditor/_distrib/doc/configure/bindings_generic.html
The above chapter is about custom bindings but Ffle customize.xxe may
also be used to specify parameterGroup, imageToolkit, etc, properties.
However, looking at imagetoolkits.incl and texmathtoimg.bat we cannot
figure out where the extension .png comes from when bat-script is
executed. It seems that .png extension is hard-coded for WebHelp output,
is this correct?
No. This would be a bug.
We tried to modify the “outputformat” in the attributes
of the imageobject, but it doesn't seem to be working.
@outputformat is an "effectivity attribute". See
https://tdg.docbook.org/tdg/5.2/ref-elements#common.effectivity.attributes
--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support