Diacritics are bad printed to screen

Is the answer to this still no?
It would really nice to use utf8 encoded characters. (The Qt version didn’t work for me)

Why ?

More than 3 years after, I ask again if we can hope to see a support of UTF-8 in ROOT6. There is still this encoding problem in the 5.34.10 version…

Strings in ROOT do not support UTF-8. ROOT 6 is mainly about new interpreter (though, cling, probably, can work with utf-8 encoded source files + understands universal character names correctly)…
I guess, you can try to use TMathText to have special symbols, have a look at tutorials.
For example, using universal character names, ASCII encoded source file + tmathtext + ROOT 6 (actually, the trunk version of ROOT) I have this (see attachment).

My need of UTF-8 support is mainly for the axis title. I am not sure that TMathText help in that case.

Well, I agree and even writing this “Hello” in Russian using universal character names is quite a … lot of work. tmathtext.C contains ‘New Yourk’ (in Russian) without \uxxxx notation, so I guess tmathtext.C is in some different encoding. I remember it was a request to enable math text for axes labels also, we have to ask Olivier about this.

You can use TMathText every where for titles simple use “\” instead of “#”

Indeed, it is a kind of workaround, thanks. But it will be better is it was support natively :mrgreen:

That’s not a workaround that’s native. TMathText offers this possibility (see the class help). No need to duplicate that complex code in TLatex.

I mean it is not “natural” to write

instead of

In this last piece of code the “é” is displayed as “é” which is not the case with TMathText.

This is the LaTex way. TMathText is fully Latex.

Yes I understand, nut in my mind, I should not have to use LaTeX to only display “text”. I think I should be able to write directly

without using LaTeX.
The comment is also valid for Russian, Chinese, Japanese, … languages. It is simply text, not a mathematical formula.

Well, at least you have a way to do it now. Before it was impossible !
We can think of some automatic way to enclose the text with hbox
but that’s not straight forward if we want to be general enough because
you cannot put \alpha in a hbox.

[quote=“couet”]We can think of some automatic way to enclose the text with hbox
but that’s not straight forward if we want to be general enough because
you cannot put \alpha in a hbox.[/quote]
Is there an option to make ROOT’s \hbox parse LaTeX commands like LaTeX’s \hbox does? This works in LaTeX (mimicing ROOT’s default math mode here)

$ \hbox{$\alpha$} $     % displays α

while in ROOT

TMathText t(0, 0, "\\hbox{$\\alpha$});   // drawn as $\alpha$

If ROOT’s \hbox was more powerful one could eventually automatically wrap all characters outside of the ASCII range in \hbox and switch to the correct font with LaTeX commands inside, e.g.

TMathText t(0, 0, "Mix\\hbox{ed}");

typesets “Mix” in italic (mathmode) font, while “ed” turns turn math mode off
with no way to fix this by the user (ROOT’s \hbox doesn’t parse LaTeX inside).

If \hbox would allow me to use a math font in ROOT, I’d probably always write
something like this when required to use non-ascii chars

TMathText t(0, 0, "\\hbox{γ²=α²±β²}");

At least in decent editors entering digraphs isn’t that hard.

[quote=“honk”][quote=“couet”]We can think of some automatic way to enclose the text with hbox
but that’s not straight forward if we want to be general enough because
you cannot put \alpha in a hbox.[/quote]
Is there an option to make ROOT’s \hbox parse LaTeX commands like LaTeX’s \hbox does?[/quote]

This is not trivial, and involves implementing TeX’s horizontal mode. Currently, as the name “mathtext” says, it is primarily an implementation of TeX’s math mode. This is also the reason why there are e.g. no arrays/matrices implemented (it involves switching to horizontal/vertical mode and back).

[quote=“honk”]This works in LaTeX (mimicing ROOT’s default math mode here)

$ \hbox{$\alpha$} $     % displays α

while in ROOT

TMathText t(0, 0, "\\hbox{$\\alpha$}); // drawn as $\alpha$ [/quote]

Yes, because there is currently no real horizontal mode (to interpret e.g. $), and issueing \hbox simply enters a plain-Unicode-string-mode (more like \verb|…|).

This can be implemented.