Cannot create SVG or use scripts
Brought to you by:
phfaist
I'm not able to generate svg files: when I try to save, I do not have the option for svg file.
I'm running KLatexFormula 3.3.0beta with TexLive 2014, with ghostscript 9.16 and dvisvgm 1.6 included in TexLive, installed in directory "C:\texlive\2014\bin\win32" and correctly added to system path (ghostscript executable is "rungs.exe" instead of "gs" or "gswin32c", but I added it to KLatexFormula settings correctly). I'm able to generate all other file formats.
I also cannot use scripts: when I open the expanded view and go to the script tab I can only choose "none", I also tried to refresh scripts but nothing happens.
Thanks,
Federico
Hi Federico, Thanks for the feedback. I imagine the reason why the scripts don't work is because they require Python. Python is installed by default on Linux and Mac OS, but not on Windows. The klatexformula scripts require Python 2.7, which you may either install in the standard location (
C:\Python27), or anywhere else and set the environment variable KLF_PYTHON_EXECUTABLE to point to the python executable. The klatexformula documentation is unfortunately a bit incomplete on this issue.This would explain why the scripts don't work, and thus why no SVG was generated. Please let me know if it doesn't fix the problem.
Thanks for your help, but svg still doesn't work. I installed python and now the scripts are displayed in klatekformula interface, but svg option is unable to generate output file (I can choose "save as svg using dvisvgm" but output file is not generated). I tried to call svg-dvisvgm.py through windows cmd but it says that filename syntax is not correct (I tried with filename.dvi, filename, path\filename.dvi, "path\filename.dvi" and similar strings).
I also noticed that klatexformula is unable to locate dvisvgm in standard texlive installation (C:\texlive\2014\bin\win32\dvisvgm.exe, the directory is in system path and dvisvgm.exe works when called in windows cmd) so I had to manually create KLF_USCONFIG_dvisvgm environment variable.
Finally I called dvisvgm with the options written at the end of svg-dvisvgm.py (line 83: result = os.system("'"+dvisvgm+"' -an -b min "+dvifile);) and the resulting svg file has incorrect font and borders (if I open it with Inkscape the font is incorrect and some parts of the symbols are out of picture borders, the same problem appear in LibreOffice and other software and it is also possible that image parts that are out of borders are cutted when the file is displayed); I suggest to use "-a -n -e", so that every symbol is converted to path and image borders are calculated on glyphs instead of being read from latex fonts (this issue is better described in dvisvgm documentation at http://dvisvgm.sourceforge.net/Manpage in the description of the -e option). I attach a simple svg file containing "x^2" where both issues are present.
Last edit: dargor314 2015-06-11
Thanks very much for the detailed report; I'll try to look into more detail soon, and sorry for the late reply.
By the way, the environment variables
KLF_USCONFIG_*can be set via KLatexFormula's settings dialog (under "User Scripts", select the corresponding script), so you shouldn't need to set them externally. (Sorry, that's also badly documented.)The scripts at this point are rather primitive and very basic, so if you have improved versions, I'd be glad to update them in KLatexFormula, just send me a diff or a new version. Typically creating outlines from fonts could be an option in the settings dialog which for example might be on by default. (Note: the UI in the settings dialog is a standard Qt widget form under
src/plugins/userscriptdata/*/*.uicreated with Qt Designer; the UI file is referred to from the script'sScriptInfoinformation. The script can then access those form widgets which are namedINPUT_*through theKLF_USCONFIG_*environment variables.)(Note that there may have been some small changes between the current release and the SVN version, but that's mostly related to how they are being packaged; I didn't really improve the scripts themselves.)
Thanks,
Philippe