Re: Bounding box on eps and ps files
Rene Brun (Rene.Brun@cern.ch)
Tue, 07 Apr 1998 19:10:16 +0200
Chris Jillings wrote:
>
> Hello all,
> I am trying to use root-generated graphics in a LaTeX document.
> I get the following error for both .eps and .ps files. Note that ghostview
> reads the files just fine.
>
> ! LaTeX Error: Cannot determine size of graphic in c1.ps (no BoundingBox).
>
> My macros is below. Thanks
>
> Chris
>
> //
> // A root macro to read in a .root file and make a 1-d histo
> // based with cuts.
> //
> int cjj_e8a()
> {
> gROOT->Reset();
> gStyle->SetOptFit(1);
> gStyle->SetStatX(0.45);
> gStyle->SetStatY(0.85);
>
> TCanvas* c1 = new TCanvas("c1","Ntuple Plots",1); // create canvas
> c1->SetFillColor(kWhite);
>
> TFile* f1 = new TFile("cjj_e8.root","READ");
> TH1F* hi1 = new TH1F("hi1","Angular Resolution: Electron KE = 8 MeV ",80,-1.0,1.0);
> hi1->SetXTitle("Cos`q#");
> // h509->Draw("Angres>>hi1","Egen>4&&Rfitt<600","goff");
> h509->Draw("(Ue*Uft+Ve*Vft+We*Wft)>>hi1","Rfitt<600","goff");
> c1->SetLogy(1);
> TF1* expExp = new TF1("expExp",expExp,0,1,4);
> expExp->SetParameters(7,0.01,1,35000);
> expExp->SetParNames("1st slope","2nd Amp","2nd slope","scale fac");
>
> TPostScript ps("cjj_e8a.eps",114);
> hi1->Fit("expExp","R");
> c1->Update();
> ps.Close();
To get an encapsulated postscript file, use
TPostScript ps("cjj_e8a.eps",113);
instead of
TPostScript ps("cjj_e8a.eps",114);
The eps file contains the few statements required to define
the bounding box. You do not have to add them manually
as suggested by Tadeusz Pytlos.
Rene Brun