[pdftex] [Slightly OT] Width of ragged text

Ross Moore ross at ics.mq.edu.au
Mon Dec 22 12:59:26 CET 2003


Hello Magnus,

On Mon, 22 Dec 2003, Magnus Lie Hetland wrote:

> I guess this is more of a general LaTeX/TeX question, but I hope it's
> not too far OT here...

Yes, it is rather.

> The question is simply: How do I find the width of a piece of
> ragged(right) text? I put the text in a parbox of a given width to
> break it, but then, of course, it doesn't fill the width of the box,
> and I no longer know how wide it is. Is it possible to find out?

   \setbox0=\hbox{<the text>}

Then \wd0  contains the width of box-register 0 in a compact binary
format. Similarly \ht0 and \dp0  contain the height/depth above/below
the baseline.
To get these values in a readable text format, you need to use
  \the\wd0  \the\ht0  etc.

I'd suggest you read the chapter on Boxes & Glue in The TeXBook, by DEK.


Hope this helps

	Ross Moore

>
> --
> Magnus Lie Hetland           "The mind is not a vessel to be filled,
> http://hetland.org            but a fire to be lighted."  [Plutarch]
> _______________________________________________
> pdftex mailing list
> pdftex at tug.org
> http://tug.org/mailman/listinfo/pdftex
>


More information about the pdftex mailing list