Add Math Support

From Scribus Wiki
Revision as of 16:17, 20 March 2007 by Herm (talk | contribs)
Jump to: navigation, search

Add Math Support


I often wanted to have a tool that allows complicated layouts but still is easy to use. This is exactly what scribus does. However for scientific papers I lacks one main capability: Formulas. So I want to add these as my summer of code project. The bugtracker also lists requests for math support

there's a feature request in the Debian database

and it's also on the

So quite a lot of people seem to want this feature.


In IRC we came to the conclusion that it probably is the best to use a approch like MathSetter.

  • Let the user enter LaTeX source (perhaps using LyX's editor)
  • Run latex
  • Read latex's output
  • Display this output instead of the source.



I'll try to create this as a C++-Plugin. If core changes are required I'll restrict the to the minimum level required. As much of the new functionality as possible will be exposed to the python interface.

Image frame vs. group of vectors

I was told that image frames are easier to handle internally than groups of vectors and consume less memory. However vectors offer more flexibility (see example below). A good solution for this problem: Use image frames and provide a "Convert to Outlines" as it is done for text frames. The ability to edit the forumla's contents is lost, however it's the same with text-frames.


There will be a new object that consists of a group of vector objects (these objects are created by importing the EPS or PDF output of latex) and which has a property that stores the latex source. For editing this property either a simple text dialog (syntax highlighting?) is displayed or LyX is started with the existing text loaded as the default file. Parent object will be PageItem_ImageFrame.

Processing the latex input

When the user has finished editing latex is run with a temporary file created by inserting the userinput to the template (see below). preview.sty is used to create a DVI file with a matching boundingbox. The DVI is converted to either PDF or EPS and then imported (functions for import are already included in scribus).

Handling missing latex / wrong syntax

When latex is missing the display of the object is replaced by the error message (or the source?) and a problem is flagged in the preflight verifier.


There should be a template so the user only has to type the formula and no header. However it is probably a good idea to allow disabling/replacing the template (or at lest the non-required (preview.sty) parts) so the user can define own styles.

Use cases

  • Scientific posters

It is very hard (if not even impossible) to create good-looking posters with LaTeX but it's easy to add formulas to LaTeX documents. On the other hand it's very easy to create good posters with scribus but a complicated process is necessary to add just a single formula. The ability to use LaTeX for typesetting the forumla and the post-processing it in scribus (easily possible, after all it's just a vector graphic from scribus' point of view) would greatly simplify this.

  • Math/Physics teachers

At school I've seen a lot of teachers that created their tests with Microsoft Word and relying on its forumla editor or even on basic text formatting (sub-/superscript) and adding any "complicated" math symbols (vectors, integrals, etc.) by hand in the printout. Obviously the full power of latex is something they are unwilling to learn (and it is probably not required for them). So I belive they would be happy to have a WYSIWYG tool that supports embedded forumlas.

  • There a many more use cases and I think virtually anybody involved in natural sciences will at some point be disappointed by his existing software (Word or Latex) because it is hard to get the wanted layout. Then they might look for alternatives...

... and find Scribus! So this will attract new users to scribus and (perhaps) open source in general.



  • The barcode generator works similar to this, but has a major drawback: It's not possible to edit it once a barcode is placed.
  • Various LaTeX to HTML tools might be a good starting point to check how the EPS/PDF is best created.


(Nice things that might be possible but are not guranteed to work)

This should also be usable to import editable graphs generated in latex (pstricks) and even would provide some (limited) support for tables. Formating the table text is however restricted to latex's capabilities and editing has to be done in latex-syntax.


  • TeX Rendering (Discussion)
  • Math support (Discussion)
  • KFormula (Formula editor, output does not look satisfying)
  • TeXmacs (very good looking formula editor, not based on TeX or Emacs despite its name)
  • LyX (WYSIWYG LaTeX editor)
  • sklatex, a LaTeX plugin for skencil. Definitely worth a look!
  • SketchLaTex, another LaTeX plugin for skencil. Please investigate before re-inventing the wheel!
  • Tex Text, a third LaTeX plugin for skencil.
  • Latex Text Frames Related idea from the projects list.