[texhax] re TeX Query 7: measuring the real height and width

Paul Stanley paulrichardstanley at gmail.com
Tue Aug 13 03:09:56 CEST 2013


hi folks,
This is the resumption of an old thread which was temporarily solved 
several months ago. I've pasted the original query and anser below.

can the list suggest a way of measuring the height and width of an 
individual row or column or any construct entirely or in part with 
the \showthe command?
I suppose what I'm looking for is a generic syntax that could be 
applied to any part of the document.
As I am not able to, as it were, eyeball the output or measure it in 
any visual way, this could be an equally efective solution.

Sincerely,
Paul


At 13:26 09/12/2012, you wrote:
On Sun, Dec  9, 2012 at 03:27 (+0000), Paul Stanley wrote:

 > Hi folks,
 > How does one draw a `virtical' line to a specified length in order to
 > measure the height of box or boxes in the output?

 > For example, a virtical line to get an idea of the `real' height of
 > the following structure:
 > %start code
 > {\hsize = 5cm \settabs 3 \columns
 > \+column 1&column 2&column 3\cr
 > \+one&cattle&herd\cr
 > \+two&fish&school\cr
 > \+three&lions&pride\cr}
 > %end code

 > There may be other ways of getting the real height and width of boxes
 > and compound structures, if so, i'd be grateful for more info.

Paul,

if you say

\setbox0=\vbox{
{\hsize = 5cm \settabs 3 \columns
  \+column 1&column 2&column 3\cr
  \+one&cattle&herd\cr
  \+two&fish&school\cr
  \+three&lions&pride\cr}
}

\showthe\ht0


\showthe\dp0


you will get the height and depth of that construct.

This doesn't draw a vertical line for measuring, but if that was an
indirect method anyway, you might like this better.

If you really want a rule drawn, try this:

\setbox0=\vbox{
{\hsize = 5cm \settabs 3 \columns
  \+column 1&column 2&column 3\cr
  \+one&cattle&herd\cr
  \+two&fish&school\cr
  \+three&lions&pride\cr}
}
\hbox{\vrule  height \ht0 depth \dp0 \box0}


Cheers.
				Jim



More information about the texhax mailing list