ferhue
June 28, 2023, 3:38pm
21
Thanks! @couet Here a minimal standalone reproducer:
void test()
{
auto c = new TCanvas();
TPaveText *pt = new TPaveText(0,0,1,1,"brNDC");
TText *pt_LaTex = pt->AddText(0.2,0.93,"#font[62]{#scale[1.5]{CMS }} #font[42]{ 36.3 fb^{-1} (13 TeV)}");
pt_LaTex->SetTextAlign(11);
pt->Draw();
c->SaveAs("/tmp/test.tex");
}
couet
June 29, 2023, 1:10pm
22
Ah yes, of course, when you use the latex ouput you should use LaTeX directives. scale
is not, it is an ROOT extension of TLatex.
So in the end there is no real solution except heavy editing of the tex file…
ferhue
June 29, 2023, 2:01pm
24
You can do it in advance. Do not use scale/font method when writing your C++ script. Use instead native latex commands such as \large, \textit, etc. in your C++ script / ttext labels. Later you will not have problems when you save as .tex!
couet
June 29, 2023, 2:02pm
25
You said:
Goerlach:
I use the following:
TPaveText *pt = new TPaveText(0,0,1,1,"brNDC");
pt->SetBorderSize(0);
pt->SetFillStyle(0);
pt->SetTextAlign(12);
pt->SetTextFont(42);
pt->SetTextSize(0.04);
TText *pt_LaTex = pt->AddText(0.2,0.93,"#font[62]{#scale[1.5]{CMS }} #font[42]{ 36.3 fb^{-1} (13 TeV)}");
pt_LaTex->SetTextAlign(11);
pt->Draw();
which runs in root.
In that example you are not using and TMathText feature, you can change the font as you wish and save the result as a normal PDF file.
system
Closed
July 13, 2023, 2:03pm
26
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.