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.
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:45 MET