Formulas inside Cantor

August 25, 2011

I haven’t been overly active in KDE lately. I finished my bachelor degree this semester and that didn’t leave much time for KDE (or real-life for that matter). But now I finally have time to do some hacking again. And with this post I’d like to introduce a new feature I’ve been working on for the last days: Formulas inside Cantor.

Since the beginning Cantor had the possibility to typeset the results of your calculations using LaTeX. A bit later it got support for text entries that can be used for better documenting the calculations you are doing, but until now it was not possible to have nice formulas inside your text.
I’ve had more or less finished patches for this feature done by other contrybutors lying around for quite some time now, but somehow they never got to a point where I could integrate them. (Sorry for that guys). Until now. I’ve rewritten some things, cleaned up others, and rewrote some minor things inside Cantor to make it fit better and now it finally landed in master.
I’ve added two ways you can add formulas inside your Cantor worksheets. For one you can just use a regular Richtext-Entry with all the simple formatting options it offers. If you want to add a formula, just insert your latex commands inside a pair of ‘$$’ (e.g. write $$\sum_{n=0}^{\infty}{\frac{1}{n^2}}$$) and it will be rendered and inserted inside your text once you evaluate the entry. If you want to edit it again, just double-click on the formula.
This is useful for small formulas with some text around them. For fancier stuff, I’ve also added a new type of entry that renders all its input using LaTeX and displays it. Again you can double click the entry to edit it again. In the following screenshot you can see this feature in action:
The whole thing is still in a pretty early stage, for example loading/saving these new things does not work correctly yet, but for now I’d really like some feedback on what you think about it, and more importantly: how the user interaction should be done, do you like the $$-thing, and the double clicks or should it behave differently? I’m open to suggestions.
So have fun, with the first new feature I coded in a while.