Histogram title strange behaviour

I cannot type certain characters in the console where i run root, so when i set the histogram axis title in the following way I get a strange result…

const char c = 253;
TString s(c);
TString t = "Chi"+s;   // at this point t = "Chi²"

the title is set to Chiý ( ý has ascii code 236).
Does anybody know what is going wrong there or how i can get the ² in a histogram title?

root [0] TH1F *h = new TH1F("h", "#chi^{ 2};#sqrt{#zeta} + #Theta^{3};#sqrt[3]{#Phi} - #xi^{4} + #frac{#lambda}{#gamma}", 100, 0, 1); root [1] h->FillRandom("gaus", 10000); root [2] h->Draw();

Thanks for the reply. Once I start root in the console (windows) I also cannot type the wavy brackets :frowning: .
The easiest solution will be to use a script. However, still I would like to understand why the way with the char doesnt work.

{ and } are control characters. Escape them with # ie #{ and #}

I see: root.cern.ch/root/html534/TLatex.html

I think he possibly means that he uses a “windows console” and his (national) keyboard does not have “{” nor “}” characters on it (there should exist some “magic key combination” which provides these two characters, however).

Ah yes, may be. Is there keyboards without these characters ? …

i dont think there is a keyboard without these keys…
maybe i should have been more clear with describing what happens…
in my windows console i can type the “{” or the “²”, either directly or by pressing alt+2+5+3.
However once i start root, if i try to type a “{” i get a beep and nothing on the console. For Alt+2+5+3 i dont even get the beep.
Also my original problem is not to type the wavy brackets or to get them into the title, but in general there are many special characters that I cannot type in root running in the windows console.

edit: I have already workarounds for not being able to type some characters. What remains is the question, why executing this

    TH1D* h = new TH1D("h","h",100,0,100);
    const char c(253);
    TString t(c);
    cout << t << endl;

results in “²” output from the cout but a “ý” appearing as the x title of the histogram.

editedit: even if I put a

    cout << h->GetXaxis()->GetTitle() << endl;

it shows my a “²” but still on the drawn histogram its a “ý”


For the keyboard issue, if I remember correctly this kind of issue (with international keyboards) has been fixed some time ago… Which version of ROOT are you using? With which keyboard layout?

Cheers, Bertrand.

The root version i am using is 5.30/00.
However, the bug occuring in the code i posted last is not related to any keyboard issues.

As we told you earlier you should do: