🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #2664

getting width of {\tt xxxxxxxx} in the *current* font size

#2664
From: Jonathan Thornburg
Date: Sun, 23 Aug 1992 07:20
33 lines
1947 bytes
In a LaTeX style file, how can I set \dimen\tabwidth to the width
of {\tt xxxxxxxx} in the *current* size?  All of my attempts so far
yield \normalsize\tt.

[It's almost certainly not relevant, but the context of this is
that I'm trying to modify a tab-interpreting verbatim.sty to use
the current font's \tt rather than always using \normalsize\tt.]

My main attempts so far:

\newdimen\tabwidth
\setbox0=\hbox{\tt xxxxxxxx}	gives me \normalsize\tt
\dimen\tabwidth=\wd0

\newdimen\tabwidth
\setbox0={\tt xxxxxxxx}		is a TeX error, because \setbox requires
\dimen\tabwidth=\wd0		a *box*, which {\tt xxxxxxxx} isn't

\newdimen\tabwidth		gives \normalsize\tt, but I don't know why
\edef\@xtab{\tt xxxxxxxx}	(I thought the \edef would get me the
\setbox0=\hbox{\@xtab}		current (size of) \tt -- why doesn't it?)

[I have the sinking feeling that I'm missing something painfully
obvious, but alas neither trial and (numerous) errors nor rereading
various chapters of the \TeX{}book yield any insights.  Please be
gentle if this is a silly question.]

Thanks for any assistance anyone can provide,

- Jonathan Thornburg
  <jonathan@einstein.ph.utexas.edu> or <jonathan@hermes.chpc.utexas.edu>
  University of Texas at Austin / Physics Dept / Center for Relativity
  and (for a few more months) U of British Columbia / {Astronomy,Physics}
Technical Details
Message-ID: <1992Aug23.072029.18770@chpc.utexas.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!jonathan

Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!jonathan
From: jonathan@chpc.utexas.edu (Jonathan Thornburg)
Subject: getting width of {\tt xxxxxxxx} in the *current* font size
Message-ID: <1992Aug23.072029.18770@chpc.utexas.edu>
Summary: my attempts thus far always give me width of \normalsize\tt
Keywords: TeX LaTeX box dimension register font \tt verbatim tab width \hbox
Sender: jonathan@einstein.ph.utexas.edu
Organization: U of Texas at Austin / Physics Dept / Center for Relativity
Date: Sun, 23 Aug 92 07:20:29 GMT
Lines: 33