Inconsistent subscript position in the title

Hi all,

The reproducible in the root interactive:

h = TH1F("h", "Title; (d_{0}^{reco} - d_{0}^{true})/#sigma", 10, 0, 10)
h.Draw()

Result:

Why is the first subscript shown visibly lower than the second one?

ROOT Version: 6.30/06
Platform: Centos 7


Just for curiosity.
This is how such TLatex processed with web graphics:

image

Problem in native TLatex parser can be investigated by @couet

1 Like

I’ll check

Thanks!

FYI: The problem appears with the first ( character, the rest is not so important

I do not see the problem with:

root [0] auto t = new TLatex(.5,.5,"d_{0}^{reco} - d_{0}^{true})/#sigma");
root [1] t->Draw()

But i see it when it is an axis title. weird… it should be the same

auto t = new TLatex(.5, .5, "(d_{aaa} - d_{bbb}")
t->Draw()

image

In your example, you have missed the first ( which is the driver of the problem

Yes … true… thanks

It’s a similar problem to this

A workaround: add an empty subscript to the opening parenthesis:

{
  auto c1 = new TCanvas("c1","Examples of TGaxis",10,10,700,500);
  c1->Range(-10,-1,10,1);
 
  auto axis1 = new TGaxis(-4.5,-0.2,5.5,-0.2,-6,8,510,"");
  axis1->SetTitle("(d_{0}^{reco} - d_{0}^{true})/#sigma");
  axis1->Draw();
 
  auto axis2 = new TGaxis(-4.5,0.4,5.5,0.4,-6,8,510,"");
  axis2->SetTitle("(_{}d_{0}^{reco} - d_{0}^{true})/#sigma");
  axis2->Draw();
}

1 Like

It comes form the fact that the text before the subscipt has a descending part. That push down the indice. @dastudillo suggestion is the soution.
you see the same effect with:

{
   auto t1 = new TLatex(.5,.5,"gd_{aaa} - d_{aaa}");
   t1->SetTextFont(42);
   t1->Draw();
   auto t2 = new TLatex(.5,.4,"ad_{aaa} - d_{aaa}");
   t2->SetTextFont(42);
   t2->Draw();
}

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.