Hi Stephen,
Root produces the same output as LateX. See macro below where you can play
with the vertical text alignment.
Rene Brun
{
gROOT->Reset();
TCanvas c1("c1");
c1.SetGrid();
TH2F h("h","",2,0,1,2,0,1);
h.Draw();
TLatex latex;
latex.SetTextSize(0.04);
latex.SetTextAlign(12);
latex.DrawLatex(0.1, 0.8, "K_{S}");
latex.DrawLatex(0.1, 0.6, "K^{*0}");
latex.DrawLatex(0.4, 0.6, "K_{S} K^{*0}");
latex.DrawLatex(.1,.4,"#frac{2s}{#pi#alpha^{2}}\
#frac{d#sigma}{dcos#theta} (e^{+}e^{-} #rightarrow f#bar{f} ) =\
#left| #frac{1}{1 - #Delta#alpha} #right|^{2} (1+cos^{2}#theta)");
latex.DrawLatex(.1,.1,"K_{S}... K^{*0}... #frac{2s}{#pi#alpha^{2}}\
#frac{d#sigma}{dcos#theta} (e^{+}e^{-} #rightarrow f#bar{f} ) =\
#left| #frac{1}{1 - #Delta#alpha} #right|^{2} (1+cos^{2}#theta)");
}
Stephen Bailey wrote:
>
> Hi Rene.
>
> Hmm. Good question. I answer it by finding out how LaTeX
> would format it: to me, if LaTeX has formatted it, it is by
> definition correctly formatted. I LaTeX'ed the following
> and attached it as a .eps file.
>
> \documentclass{article}
> \begin{document}
> \pagestyle{empty}
> $K_{S}$ ... $K^{*0}$ ...
> ${2s \over \pi \alpha^2} {d \sigma \over d \cos \theta}
> (e^+ e^- \to f \bar f) = \left| {1 \over 1 - \Delta \alpha} \right|^2
> (1 + \cos^2\theta)$
> \end{document}
>
> The bottom of the two K 's are aligned with each other and the bottom
> of the e^+ e^- ... The fraction bars are centered on the middle of
> the height of the lowercase letters that sit on the baseline. I agree
> that there are infinitely cascading subtlties as the formulas get
> more complicated. Short of entirely reproducing LaTeX, it is impossible
> to anticipate them all. But if ROOT ever switches to a Postscript based
> graphics rendering that can easily embed .eps files on a canvas, I'm
> writing a class that will run LaTeX to produce an .eps file and embed
> it... But I guess for now, I suggest:
>
> * TLatex output be aligned to some baseline that normal letters "sit"
> on and super/sub-scripts go up and down from there.
> * In the case of fractions, the line is vertically aligned somewhere
> above the baseline, and their text sits on baselines above and below
> that.
> * In the case of complicated structures like fractions, etc. there be
> some rule such that the equation can never overlap itself. e.g. if
> there is a superscript in the denominator of a fraction, the baseline
> for the denominator is low enough that the superscript doesn't hit
> the fraction line.
>
> I don't know how realistic or easy these requests are, or what
> other subtlties might come up. But for now, I'd be happy to be
> able to align "basic" structures like K_{S} and the K^{*0}.
>
> Thanks.
>
> Stephen
>
> On Tue, 8 Aug 2000, Rene Brun wrote:
>
> > Hi Stephen, I understand your point in this particular example, but
> > your proposal would have plenty of side effects. For example, what
> > would you propose for the 3rd Tlatex string in my macro below?
> >
> > Rene Brun
> >
> > {
> > gROOT->Reset();
> > TCanvas c1("c1");
> > c1.SetGrid();
> > TH2F h("h","",2,0,1,2,0,1);
> > h.Draw();
> > TLatex latex;
> > latex.DrawLatex(0.1, 0.5, "K_{S}");
> > TLatex *l=(TLatex*)latex.DrawLatex(0.1, 0.3, "K^{*0}");
> > latex.DrawLatex(.1,.1,"#frac{2s}{#pi#alpha^{2}}\
> > #frac{d#sigma}{dcos#theta} (e^{+}e^{-} #rightarrow f#bar{f} ) =\
> > #left| #frac{1}{1 - #Delta#alpha} #right|^{2} (1+cos^{2}#theta)");
> > }
> >
> >
> >
> > Stephen Bailey wrote:
> > >
> > > Hi Rooters,
> > >
> > > TLatex appears to vertically align text based upon
> > > the lowest/highest element drawn, including sub/superscripts.
> > > e.g.
> > >
> > > TLatex latex;
> > > latex.SetNDC();
> > > latex.DrawLatex(0.5, 0.5, "K_{S}");
> > > latex.DrawLatex(0.6, 0.5, "K^{*0}");
> > >
> > > aligns the bottom of the subscripted "S" with the bottom of the
> > > other K. I would prefer the alignment to be based upon the bottom
> > > of the normal script, i.e. have the two K aligned and have the
> > > S be lowered from there and the *0 be raised.
> > >
> > > Do others agree? Would this be easily possible?
> > >
> > > Thanks.
> > >
> > > Stephen
> >
>
> --------------------------------------------------------------------------------
>
> Name: temp.eps
> temp.eps Type: Postscript Document (APPLICATION/PostScript)
> Encoding: BASE64
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:31 MET