Another TAxis change with 5.34.07

I noticed another difference in moving from 5.34.01 to 5.34.07: The behavior of TAxis::SetTitle() I often call TH1::SetXAxisTitle(gFile->GetName()) to identify the the plot as coming from a particular file. Following attachments show the same histogram drawn with ROOT v5.34.01: (you might need to scroll down to see the x-axis)



and v5.34.07:


Can you suggest a work-around so that the text I pass to the x-axis title is not interpreted, but simply displayed? thank you

Ed

Yes TLatex invokes directly TMathText when a “” is in the string. That’s why we have implemented
the Latex character #backslash in TLatex. See:

A simple filter using TString tools can change all the “” into #backslash.

Let me know if that’s ok for your or if we should think of an other mechanism.

Hi Olivier,

I am not sure if this already exists, but some global configuration to force
either always TMathText or plain TLatex would be very useful. Right now I
think I need to use something like

ax->SetTitle("\\psi_n\\,")

to enforce the TMathText rendering I want for titles which do not contain backslashes.

Right now it is entirely automatic based on the fact the string contains “” or not.
My be we can have a TLatex global static function setting a flag to decide between:

  1. never use TMathText
  2. use TMathText if the string has a “”
  3. always use TMathText

By the way I do not understand your point. If you do:

ax->SetTitle("\psi_n,")

it will use TMathText …

My coffee still hasn’t arrived in my system, wrong example :wink:

An example would be any quantity with an index and not using special LaTeX
characters, e.g. a rapidity with an index.

I instinctively wrote \psi since angles don’t have a unit which I would
typeset with \mathrm. Still the wrong example though.

Yes the right example would be a string to be rendered using the nice TMathText and not having any special character. Like:

"a_1x^2 + a_2 = -a_3 "

This can be renderer with basic TLatex but the look is a bit different from TMathText. If you want the TMathText look anyway, then a logic like the one I mentioned before is needed. But, as soon as you will have a math string, very quickly control character are needed # for TLatex and \ for TMathtext. So it is not really obvious a such logic is mandatory.

One actually just needs to insert some “invisible” character which contains a
backslash and triggers TMathText rendering. I habitually use a small space ,
and it doesn’t seem to mess up alignment from what I can see.

A global switch might after all also be more messy than desirable since
TMathText seems to default to math mode which would make any text (e.g. in
labels) look totally wrong, so I think it might not be something worth
implementing.