TLegend ugly in subfigures

Dear fellow physicist,

@couet When printing TLegend in a divided TCanvas, special symbols like a bar or a hat on top of a character become too thick and ugly when the canvas is saved as a pdf. This happens only when I divide the canvas in subcanvasses and save them as a pdf. When only printing the canvasses on screen while in ROOT, it does not happen. But I want to use the canvasses in my report so I download them as a pdf. Does anyone know how to prevent this to happen?

I have attached two pdf’s. In c1 I do not divide the canvas so there is no problem. In c2 I divide the canvas and the same legend is now printed wrong. See below for a code to reproduce this problem:

void uglylegend() {
    TLegend * l = new TLegend(.1, .1, .9, .9);
    l->SetHeader("Header with bar #bar{b} and hat #hat{h}");

    TCanvas * c1 = new TCanvas("c1", "c1");
    l->Draw();

    TCanvas * c2 = new TCanvas("c2", "c2"); 
    c2->Divide(2, 2); c2->cd(1);
    l->Draw();

    c1->SaveAs("c1.pdf");
    c2->SaveAs("c2.pdf");
}

c1.pdf (12.4 KB)
c2.pdf (12.4 KB)


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.18/04
Platform: Windows 10
Compiler: Not Provided


“bar” and “hat” are not characters but they are drawn as lines.
Making the text smaller reduces the size of the lines and you
can get this effect. I am afraid there is not so much we can do about it.
Going to TMathText (using \ instead of “#”) might help but then
you should generate PS instead of PDF.

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