Hi Rene,
I am using version 3.00 on HP-UX-10.20-aCC (sorry for forgetting).
I tried your macro and indeed it works for me too. In fact, I do not use the
TLatex class directly, I use TText to draw one line of text on screen (vertically).
TText gives the behaviour I described. For example:
TText text( 0.2, 0.3, "text #1");
text.Draw();
gPad->SaveAs("testHash.ps")
Shows the # on screen, but not on ps output (just shows "text 1").
Maybe I should not be using TText? What should I use?
Regards,
Martin.
Rene Brun wrote:
>
> Hi Martin,
>
> Unfortunately, you do not specify which version of Root you use.
>
> With the production version, you do not need any escape character for "#".
> The character is only recognized where it makes sense, eg #alpha, #int, etc
> See an example below with the corresponding Postscript output in the attachment.
>
> {
> gROOT->Reset();
> enum colors {bg, fg, red, green, blue, yellow, magenta, cyan};
> TCanvas * c1 = new TCanvas("c1","Simple Formulae",700,500);
>
> // create a 1-dim function object (class TF1)
>
> TF1* exp = new TF1("exp","[0]*exp(-[1]*x)", 0, 10);
> Double_t a1 = 2.;
> Double_t lambda = 0.5;
> exp->SetParameters(a1, lambda);
> exp->SetLineColor(red); exp->SetLineWidth(6);
> exp->Draw();
>
> char buf[100];
> sprintf(buf, "#int^{4}_{2} a_{1} e^{-#lambda * x} = %f",exp->Integral(2,4));
>
> // create a Latex object and let it print the formula
>
> TLatex latex;
> latex.SetTextColor(red);
> latex.SetTextSize(0.08);
> latex.DrawLatex(3.5 ,1.3, buf);
>
> // Create another function (class TF1) and overlay it
>
> TF1* fesin = new TF1("fesin",
> "[0]*exp(-[1]*x) * abs(sin(2*x))", 0, 10);
> fesin->SetParameters(a1, lambda);
> fesin->SetLineColor(blue); fesin->SetLineWidth(6);
> fesin->Draw("SAME");
>
> latex.SetTextColor(blue);
> latex.DrawLatex(3.5 ,0.8, "a_{1} e^{-#lambda * x} abs(sin(2x))");
> latex.DrawLatex(3.5 ,0.4, "comment #3");
>
> c1->SetGridx();
> c1->SetGridy();
> c1->Update();
> }
>
> Rene Brun
>
> Martin Woudstra wrote:
> >
> > Hello rooters,
> >
> > Does anybody know how can I print out the '#' character in TLatex?
> > The '#' appears on the screen, but not in the Postscript output file.
> >
> > Since '#' is an escape character in TLatex, I guessed that getting
> > a '#' might be by '##', but this doesn't work either. Two '#'s appear
> > on screen and none in the Postscript output file.
> >
> > Is the '#' supported in the Postscript output of TLatex (or was it overlooked maybe)?
> > If not yet, I suggest the '##' syntax.
> >
> > Regards,
> > Martin.
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> Name: c1.ps
> c1.ps Type: Postscript Document (application/postscript)
> Encoding: 8bit
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:45 MET