Projects: Difference between revisions

Jump to navigation Jump to search
748 bytes removed ,  2 September 2020
Line 324: Line 324:
* [http://en.wikipedia.org/wiki/Cairo_%28software%29 Cairo]: this library is widely used and known to provides high-quality graphics with support for PS/PDF/SVG output.
* [http://en.wikipedia.org/wiki/Cairo_%28software%29 Cairo]: this library is widely used and known to provides high-quality graphics with support for PS/PDF/SVG output.


== TeX/LaTeX markup ==
== LaTeX markup ==


Text objects in plots (like titles, labels, texts...) in the OpenGL renderer only support plain text mode without any formatting possibility. Support for TeX and/or LaTeX formatting needs to be added.
Text objects in plots (like titles, labels, texts...) in the OpenGL renderer only support plain text and TeX. The latter consists of a very limited subset of the TeX language. On the other hand, the LaTeX formatting support is expected to provide full LaTeX capabilities. There are various approaches that can be used:
 
* Use an external LaTeX engine: this is the most straightforward, but it requires users to install a LaTeX distribution and setup Octave to use it.
* The TeX formatting support actually only consists of a very limited subset of the TeX language. This can be implemented directly in C++ into Octave by extending the existing text engine, avoiding to add a dependency on a full TeX system. Essentially, support for Greek letters, super/sub-scripts, and several mathematical symbols needs to be supported.  For example,
* Use an external library that supports LaTeX syntax, e.g. [http://forge.scilab.org/index.php/p/jlatexmath/ JLaTeXMath] a Java API to display LaTeX code, [https://github.com/nathancarter/qtmathjax qtmathjax] a Qt based library that executes MathJax in a background web page.
 
* Implement our own LaTeX parser and renderer. The matplotlib project [http://matplotlib.sourceforge.net/users/usetex.html has already done this in Python] and might be used as an example of how to do this in Octave. There is also [https://github.com/jkriege2/JKQtPlotter JKQtPlotter], a Qt based plotting application which implements its own LaTeX parser/renderer in C++.
:<pre>\alpha \approx \beta_0 + \gamma^\chi</pre>
 
:Would be rendered as,
 
:&alpha; &asymp; &beta;<sub>0</sub> + &gamma;<sup>&chi;</sup>
 
:This is analogous to how special characters may be included in a wiki using html.
 
:<pre>&amp;alpha; &amp;asymp; &amp;beta;<sub>0</sub> + &amp;gamma;<sup>&amp;chi;</sup></pre>
 
:The text object's {{Codeline|extent}} for the rendered result needs to be calculated and the text placed the location specified by the text object's {{Codeline|position}} property. An itemized list of a text objects properties can be found [http://www.gnu.org/software/octave/doc/interpreter/Text-Properties.html here].
 
* On the other hand, the LaTeX formatting support is expected to provide full LaTeX capabilities. This will require to use an external LaTeX system to produce text graphics in some format (to be specified) that is then integrated into Octave plots.
 
:The matplotlib project [http://matplotlib.sourceforge.net/users/usetex.html has already done this in Python] and might be used as an example of how to do this in Octave.  Mediawiki has also also done [http://en.wikipedia.org/wiki/Wikipedia:Texvc something similar]. There is also [http://forge.scilab.org/index.php/p/jlatexmath/ JLaTeXMath], a Java API to display LaTeX code in mathematical mode.


=History=
=History=
Anonymous user

Navigation menu