%%% ==================================================================== %%% @LaTeX-doc-source-file{ %%% filename = "getwidth.dtx", %%% version = "1.01", %%% date = "2001/12/19", %%% time = "20:56:06 PST", %%% author = "Michael J Downes", %%% address = "American Mathematical Society, %%% Publications Technical Group, %%% PO Box 6248, %%% Providence, RI 02940, %%% USA", %%% email = "tech-support@ams.org", %%% URL = "http://www.ams.org/", %%% keywords = "storing measurements" %%% abstract = "LaTeX package for storing and retrieving measurements %%% for document objects.", %%% checksum = "09517 121 288 3286", %%% docstring = "The checksum field, produced by Robert Solovay's %%% checksum utility, gives CRC-16 checksum, lines, %%% words, and characters.", %%% } %%% ==================================================================== % \iffalse %<*driver> \NeedsTeXFormat{LaTeX2e} \documentclass{amsdtx} \providecommand{\mdash}{\textemdash} \providecommand{\qq}[1]{\textquotedblleft#1\textquotedblright} \begin{document} \title{The \pkg{getwidth} package} \author{Michael~J. Downes\\American Mathematical Society} \date{Version \fileversion, \filedate} \hDocInput{getwidth.dtx} \end{document} % % \fi % % \maketitle % \section{Introduction} % % The \pkg{getwidth} package provides a way for \LaTeX{} elements to % record measurements in the aux file for use on future passes. % %\begin{verbatim} %\GetWidth{\leftmargin} %\SaveWidth{\leftmargin}{\makelabel{\@itemlabel}} %\end{verbatim} % % \begin{macrocode} \let\@nx\noexpand \let\@xp\expandafter % \end{macrocode} % % \begin{macrocode} \def\gw@index{0}% \let\saved@widths\@empty % \end{macrocode} % % \begin{macrocode} \newcommand{\GetWidth}[2][]{% \begingroup \@tempcnta\gw@index \advance\@tempcnta\@ne \xdef\gw@index{\number\@tempcnta}% \escapechar\m@ne \edef\@tempa{W[\gw@index]\string#2\@empty}% \xdef\saved@widths{{\@tempa}\saved@widths}% % \message{saved@widths: \saved@widths}% \edef\X{\endgroup\@nx\@xp\@nx\gw@check \@nx\csname r@\@tempa\endcsname{#2}{% \ifx @#1@#2\else#1\fi}}% \X } % \end{macrocode} % % \begin{macrocode} \def\gw@check#1#2#3{% \ifx#1\relax #2=#3\relax \else #2=#1\relax \fi } % \end{macrocode} % % \begin{macrocode} \def\SaveWidth#1#2{% \relax \if@filesw \begingroup \settowidth\@tempdima{#2}% \PopWidthLabel\@tempa % \newlabel{W[19]leftmargin}{20.334pt} \immediate\write\@auxout{\string\newlabel{\@tempa}{\the\@tempdima}}% \endgroup \fi } % \end{macrocode} % % \begin{macrocode} \def\PopWidthLabel#1{% \ifx\saved@widths\@empty \PopError\saved@widths \def#1{10pt}% \else \iffalse{\fi \afterassignment\PopWL@a \@xp\def\@xp#1\saved@widths}% \fi } \def\PopWL@a{\xdef\saved@widths{\iffalse}\fi} \def\PopError#1{% \@latex@error{Empty stack \string#1 cannot be popped}\@ehc } % \end{macrocode} % % The usual \cs{endinput} to ensure that random garbage at the end of % the file doesn't get copied by \fn{docstrip}. % \begin{macrocode} \endinput % % \end{macrocode} % % \CheckSum{109} % \Finale % \endinput