Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.4.1 - Português

Change language to:
English - Français - 日本語 - Русский

Please note that the recommended version of Scilab is 2024.1.0. This page might be outdated.
See the recommended documentation of this function

Ajuda Scilab >> Biblioteca de Gráficos > text > Math rendering in Scilab graphics

Math rendering in Scilab graphics

Display mathematical equations in Scilab graphics through the LaTeX or MathML languages.


Starting from Scilab 5.2, it is possible to write LaTeX or MathML expression.

LaTeX texts must start and end by $ (dollar symbol) while MathML texts must start by < and end by > and being syntactically valid.

On the first use (these libraries are loading on the fly only when needed), note that the MathML engine is slower to load than LaTeX.

// Example with LaTeX / MathML ticks:

// LaTeX and MathML mixed expression
a.x_ticks = tlist(["ticks", "locations", "labels"], (0:6)', [mathml;"1";"$\sin(x)$";"3";"$\cos(a) - test$";"5";"6"]);

LaTeX description

The rendering engine is based on the Java library JLaTeXMath. JLaTeXMath is an implementation of the mathematic mode of LaTeX. All LaTeX base commands are handle (do not hesitate to submit a bug report if missing). Few TeX commands, like \over are supported.

Since Scilab 5.2.1, greek, cyrillic and complete unicode for latin alphabets characters are handled in the Scilab graphics

xtitle('$\mbox{Vector field for }\ddot{\theta}=\sin\theta$')
xtitle('$\JLaTeXMath\ \mathfrak{and}\ \mathtt{Scilab}$')
xstring(0.5,0.5,"$\overbrace{привет\ мир} \underbrace{γειά\ κόσμο}$")

JLaTeXMath provides several fonts with the commands \mathbb, \mathscr, \mathcal, \mathbf, \mathit, \mathsf, \mathtt, \mathfrak, \mathds, \mathrm, with their bold versions when they are available with the command \boldsymbol :

xtitle('$\mathbb{SCILAB}\ \mathsf{or}\ \boldsymbol{\mathfrak{Scilab}}$')
xtitle('$\mathscr{C}\mbox{ n''est pas }\boldsymbol{\mathcal{C}}$')

Different LaTeX packages are available: amsmath, amssymb, stmaryrd, amsxtra and accents with some commands of graphics. Most of the commands of these packages are available (some of amsmath are missing for example).

xtitle('$\hat{\accentset{\star}{\hat h}}\undertilde{ABC}$')
xtitle('$\begin{pmatrix}\mathfrak{a}&\alpha\\\mathbb{A}&\mathcal{A}\end{pmatrix}\mbox{ or }..
xtitle('$\rotatebox{180}{\boxed{\JLaTeXMath}}\ \reflectbox{\JLaTeXMath}$')
xtitle('$\textcolor{Magenta}{\mathfrak{Scilab}}\mbox{ and }\textcolor{Green}{\mathcal{SCILAB}}$')

It is also possible to define new commands or new environments:

xtitle('$\newcommand{\op}{\left(}\newcommand{\cp}{\right)} \op\frac12\cp$')

MathML description

The MathML rendering is based on Jeuclid. Jeuclid is a MathML implementation which covers the whole specification. Therefor, all the MathML language is supported within Scilab.

Due to the size of the Jeuclid library, on the first use, it can take up to a few seconds to load. However, next uses are much faster.

a.x_label.font_size= 5;
a.x_label.text="<mrow><mfrac><mrow><mn>1</mn></mrow><mrow><mn>2</mn></mrow></mfrac><mo></mo><mfenced open=""{"" close=""}""> ..
<mrow><mfrac><mrow><mfrac><mrow><mi>a</mi></mrow><mrow><mi>b</mi></mrow></mfrac></mrow><mrow><mfrac><mrow> ..

See Also

  • xtitle — adidciona títulos a janelas de gráficos
  • axes_properties — descrição das propriedades de entidades Axes (de eixos)
  • label_properties — Descrição de propriedades da entidade Label (rótulo)
  • legend_properties — Descrição das propriedades da entidade Legend (legenda)
  • text_properties — description of the Text entity properties
  • xstringb — escreve strings em uma caixa
  • xstringl — computa uma caixa que cerca strings
  • xstring — imprime strings
  • uicontrol — create a Graphic User Interface object
  • uimenu — Create a menu or a submenu in a figure
Report an issue
<< xstringl text text properties >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Apr 02 17:37:06 CEST 2013