Hi,
I would like to know how \phantom{} is internally implemented. Thanks.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAksISKwACgkQM0LLzLt8MhwAEACfRg5P4CnfYHKZsDX3t9pFdmnn
eJAAoKAGM/WoD2U3X/MBamiz43BqZTs7
=7Bwu
-----END PGP SIGNATURE-----
Well, using the plain format, we get:
\show\phantom => \v@true \h@true \ph@nt
and can follow through the logic. Box zero is set to #1, which can then
be used to find the height, depth and width of #1 typeset. These are
then used to set the dimensions of box two, which is set up empty. This
empty box is then used to put in the phantom space.
--
Joseph Wright
> I would like to know how \phantom{} is internally implemented. Thanks.
Basically it sets the contents of its argument in a box (box register
0), assigns box register 2 to an empty horizontal box, and then sets the
dimensions of box 2 to the dimensions of box 0 (depending on whether you
called \hphantom, \vphantom, or \phantom). This relies in the fact that
box dimensions can be set independently of their contents (similar
tricks are employed by \llap, \smash and friends). For the details refer
to TeX by Topic (the chapter about boxes) and the LaTeX source code
(source2e.pdf -- \*phantom are implemented in only 18 lines of code).
--
Change “LookInSig” to “tcalveu” to answer by mail.
Joseph Wright <joseph...@morningstar2.co.uk> writes:
Thanks, Joseph.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAksIcJsACgkQM0LLzLt8MhzmrgCfYHVs4W5Cy/lmzpOMcsVfVpBv
UdwAnjcnxgGtYnDf6loGs/i3WQDSEl54
=b5sM
-----END PGP SIGNATURE-----
Philipp Stephani <Look...@arcor.de> writes:
Thanks, Philipp.
- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iEYEARECAAYFAksIcKwACgkQM0LLzLt8Mhx58wCgqH/CiiE+Ce2OtglQbbu18AMv
oWEAoIfUB61olBycwVdHq4Gp1nu7Cm1t
=NXrG
-----END PGP SIGNATURE-----