Skip to content

TPad Print() Title option issue #21244

@ankar

Description

@ankar

Check duplicate issues.

  • Checked for duplicates

Description

The TPad::Print() has the possibility to specify the page title string for the table of content, which ease the navigation of generated multi-page PDF files. It works great, except of the very last page.

All in all, the issue is the "Title:name" is not respected for the very last page of pdf generated with TPad::Print() .

Reproducer

Please see below the script which reproduce the problem:

$ cat title.cxx

# run as root -b -q -l title.cxx

#include "TCanvas.h"
#include "TH1.h"

void title()
{
  TH1I bgoplot("bgoplot", "BGO;Energy, MeV;#nevents", 150, -3, 3);
  bgoplot.FillRandom("gaus", 1000);

  TH1I ecalplot("ecalplot", "ECAL;Energy, GeV;#nevents", 150, -3, 3);
  ecalplot.FillRandom("gaus", 1000);

  TCanvas c("plots", "plots");
  c.Print("plots.pdf[");

  c.Clear();
  bgoplot.Draw();
  c.Print("plots.pdf", "Title:BGO");

  c.Clear();
  ecalplot.Draw();
  c.Print("plots.pdf", "Title:ECAL");

  c.Print("plots.pdf]");
}

Here is the screenshot - the table of contents label for page2 should be "ECAL":

Image

ROOT version

$ ssh lxplus

$ root --version
ROOT Version: 6.38.00
Built for linuxx8664gcc on Dec 18 2025, 00:00:00
From tags/6-38-00@6-38-00

Installation method

cern lxplus

Operating system

rhel9.7

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions