[OS X TeX] LaTeXiT

Bruno Voisin bvoisin at mac.com
Tue May 17 11:23:03 EDT 2005


Le 17 mai 05 à 16:40, Pierre Chatelier a écrit :

> But is it possible to compute the baseline position out of a LaTeX  
> equation ? I guess it is just the first step to make it work...

It is possible to get the depth of any box, by using in plain TeX the  
primitive \dp, and in LaTeX the command \settodepth. What exactly the  
depth of a box means for an equation, whether it is what we would  
intuitively expect, I don't know.

Proof of concept for plain TeX:

     \parindent=0pt
     \parskip=\medskipamount

     \newbox\eqbox
     \newdimen\eqdepth

     \def\eqwithdepth#1
       {\setbox\eqbox=\hbox{$#1$}\eqdepth=\dp\eqbox%
        The depth of the equation \copy\eqbox{} is \the\eqdepth.}

     \eqwithdepth{x^2}

     \eqwithdepth{x_1^2}

     \bye

And for LaTeX:

     \documentclass{article}

     \setlength{\parindent}{0pt}
     \setlength{\parskip}{\medskipamount}

     \newsavebox{\eqbox}
     \newlength{\eqdepth}

     \newcommand{\eqwithdepth}[1]
       {\sbox{\eqbox}{$#1$}\settodepth{\eqdepth}{\usebox{\eqbox}}%
        The depth of the equation \usebox{\eqbox} is \the\eqdepth.}

     \begin{document}

     \eqwithdepth{x^2}

     \eqwithdepth{x_1^2}

     \end{document}

Hope this helps,

Bruno Voisin--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the MacOSX-TeX mailing list