← Back to team overview

zim-wiki team mailing list archive

Re: equation editor

 

Indeed it works using dvisgm and it looks good, just change 3 lines in the
plugin, see attached diff.

When I have some time I will try to make it an option in the plugin.

Regards,

Jaap


On Thu, Nov 26, 2015 at 11:00 AM, Paulo van Breugel <p.vanbreugel@xxxxxxxxx>
wrote:

> Perhaps replacing the dvipng by dvisgm (http://dvisvgm.bplaced.net/)
> could work?
>
>
>
> On 26-11-15 10:56, Paulo van Breugel wrote:
>
> Thanks, I had been looking in equationeditor.py file, but wasn't sure how
> to add the -D option.
>
> The reason I want to be able to change the resolution is to make the image
> suitable to be used in printed documents, which normally requires a dpi of
> 300. But that would result in a very large image in the notebook. A
> solution for me (but perhaps not so much for you) would be an option to
> resize the image display in the notebook (like you can do with a normal
> image). The option to use svg instead of png would be even better, perhaps
> also for your user case?
>
>
> On 26-11-15 10:28, wzhd wrote:
>
> I have been thinking about the same thing since I got a HiDPI screen.
> Currently, I have only managed to make the images bigger, by passing the
> option "-D 192" to the "dvipng" command. The modified version is here:
> <https://github.com/wzhd/zim-plugin-equation-editor/commit/c3c42d0668ca8dcf69dc1d25d9450d81514d5524>
> https://github.com/wzhd/zim-plugin-equation-editor/commit/c3c42d0668ca8dcf69dc1d25d9450d81514d5524
>
>
> However this is not perfect, when I open the notebook on other computers,
> the equations are too big.
>
> On 26 November 2015 at 00:29, Paulo van Breugel <p.vanbreugel@xxxxxxxxx>
> wrote:
>
>> Hi Jaap and other Zim devs,
>>
>> The 'insert equation' function is a great function, producing nice
>> looking equations in Zim. However, the resolution of the image (png file)
>> that is generated by the addon is fairly low. Is there a way to change the
>> resolution of the image? Or even better, would it be possible to add the
>> option to store the on-the-fly generaged image as svg instead of png? This
>> would provide in perfectly scalable solution for any document.
>>
>> Best regards
>>
>> Paulo
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~zim-wiki
>> Post to     : zim-wiki@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~zim-wiki
>> More help   : https://help.launchpad.net/ListHelp
>>
>
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~zim-wiki
> Post to     : zim-wiki@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~zim-wiki
> More help   : https://help.launchpad.net/ListHelp
>
>
=== modified file 'zim/plugins/equationeditor.py'
--- zim/plugins/equationeditor.py	2015-09-24 16:57:37 +0000
+++ zim/plugins/equationeditor.py	2016-01-07 14:24:01 +0000
@@ -13,7 +13,8 @@
 
 # TODO put these commands in preferences
 latexcmd = ('latex', '-no-shell-escape', '-halt-on-error')
-dvipngcmd = ('dvipng', '-q', '-bg', 'Transparent', '-T', 'tight', '-o')
+#~ dvipngcmd = ('dvipng', '-q', '-bg', 'Transparent', '-T', 'tight', '-o')
+dvipngcmd = ('dvisvgm', '-o')
 
 class InsertEquationPlugin(ImageGeneratorPlugin):
 
@@ -46,7 +47,8 @@
 
 	object_type = 'equation'
 	scriptname = 'equation.tex'
-	imagename = 'equation.png'
+	#~ imagename = 'equation.png'
+	imagename = 'equation.svg'
 
 	def __init__(self, plugin):
 		ImageGeneratorClass.__init__(self, plugin)
@@ -80,7 +82,8 @@
 
 		# Call dvipng
 		dvifile = File(self.texfile.path[:-4] + '.dvi') # len('.tex') == 4
-		pngfile = File(self.texfile.path[:-4] + '.png') # len('.tex') == 4
+		#~ pngfile = File(self.texfile.path[:-4] + '.png') # len('.tex') == 4
+		pngfile = File(self.texfile.path[:-4] + '.svg') # len('.tex') == 4
 		dvipng = Application(dvipngcmd)
 		dvipng.run((pngfile, dvifile)) # output, input
 			# No try .. except here - should never fail


Follow ups

References