Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html code used along with Matlab

I have recently found that Matlab can use LaTeX character sequences. However, they only can be used by the functions text, title, xlabel, ylabel and zlabel. I have designed a GUI which has an uitable. Its header is a string that uses HTML code and looks like this:

headers = {'<html><center>Component X<br />(km/s^2)</center></html>', ...
           '<html><center>Component Y<br />(km/s^2)</center></html>', ...
           '<html><center>Component Z<br />(km/s^2)</center></html>'};

My intention is replacing s^2 with s squared. Because of I can not use LaTeX characters inside the string "header" (at least I have tried it and it has not worked), I would like to know how I could do it if I use HTML code which I do not know.

like image 567
julianfperez Avatar asked Oct 09 '22 10:10

julianfperez


2 Answers

For writing superscripts in HTML, use the <sup>...</sup> pair:

headers = {'<html><center>Component X<br />(km/s<sup>2</sup>)</center></html>', ...
           '<html><center>Component Y<br />(km/s<sup>2</sup>)</center></html>', ...
           '<html><center>Component Z<br />(km/s<sup>2</sup>)</center></html>'};
like image 111
Werner Avatar answered Oct 19 '22 10:10

Werner


For the superscripts appearing in units in diagram titles and labels I always use the designated Unicode characters like km/s² or kg/m³.
These numbers are available: ⁿⁱ⁰²³⁴⁵⁶⁷⁸⁹
This works even in software that does not allow LaTeX charactrer sequences (if the selected font has the corresponding characters and if the software is Unicode capable). The same numbers are available as subscript also.

like image 28
matth Avatar answered Oct 19 '22 10:10

matth