% \iffalse meta comment
% File: makebox.dtx Copyright (C) 1999 Harald Harders
% \fi
%
% \iffalse
%
%<*driver>
\documentclass{ltxdoc}
\IfFileExists{makebox.sty}{\usepackage{makebox}
 \let\makeboxSTYfound\active}{\GenericWarning{makebox.dtx}{Package
 file makebox.sty not found (Documentation will be messed up!^^J^^A
 Generate makebox.sty by (La)TeXing makebox.ins, process
 makebox.dtx again)^^J}\stop}
\usepackage[T1]{fontenc}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{url}
\GetFileInfo{makebox.sty}
\title{The \texttt{makebox} package\thanks{This file has version
    \fileversion\ last revised \filedate.}}
\author{Harald Harders\\\texttt{h.harders@tu-bs.de}}
\date{File Date \filedate, Printed \today}
\newlength{\tempdima}%
\makeatletter
\renewenvironment{table}[1][]{%
  \@float{table}[#1]%
  \centering%
  \setlength{\tempdima}{\abovecaptionskip}%
  \setlength{\abovecaptionskip}{\belowcaptionskip}%
  \setlength{\belowcaptionskip}{\tempdima}%
  }{%
\end@float
}
\makeatother
\EnableCrossrefs
\CodelineIndex
\DoNotIndex{\def,\edef,\let,\newcommand,\newenvironment,\newcounter}
\DoNotIndex{\setcounter,\space,\ifx,\else,\fi}
\CodelineNumbered
\RecordChanges
\CheckSum{18}
\begin{document}
 \DocInput{makebox.dtx}
\end{document}
%</driver>
% \fi
%
% \maketitle
% \begin{abstract}
% \noindent 
% This package defines a \cs{makebox*} command that allows to give the
% width for the \cs{makebox} command by a sample text instead of a
% measure.
% \end{abstract}
%
% \tableofcontents
%
% \section*{Copyright}
% Copyright  2004 Harald Harders.
%
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
% \section{Using this package}
%
% Sometimes you want to put a text into a box that has the same width
% as another text. 
% Normally, you have to use \cs{settowidth} to set a length to the
% width of the reference text and use \cs{makebox} afterwards.
%\DescribeMacro{\makebox*}%
%With this package, you can use the \cs{makebox*} command for that.
% The width of the box is then given by a mandatory first argument
% (instead of the optional first argument of the \cs{makebox}
% command).
% The following arguments are identically to the normal \cs{makebox}
% command.
%
% For example, 
%\begin{verbatim}
%--longer reference text--\\*
%--\makebox*{longer reference text}{short text}--\\*
%--\makebox*{longer reference text}[r]{short text}--\\*
%--\makebox*{longer reference text}[r]{even longer text than the reference}--\end{verbatim}
% leads to\\
%--longer reference text--\\*
%--\makebox*{longer reference text}{short text}--\\*
%--\makebox*{longer reference text}[r]{short text}--\\*
%--\makebox*{longer reference text}{even longer text than the reference}--
%
%
% \StopEventually{\PrintChanges \PrintIndex}
%
%
% \section{The implementation}
% \iffalse
%<*package>
% \fi
% \changes{1.04}{2003/11/09}{Avoide usage of \cs{textversion} etc.}%
% Heading of the package:
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{makebox}
  [2004/07/31 v0.1 extend makebox command]
%    \end{macrocode}
% \begin{macro}{\makebox*}
% Save the original \cs{makebox} command since it has to be redefined.
%    \begin{macrocode}
\newcommand*\hh@orig@makebox{}
\let\hh@orig@makebox\makebox
%    \end{macrocode}
% Redefine \cs{makebox}.
% If using normally call the original command.
% If using with a star, get the width of the box by a text and call
% \cs{hh@makebox} for doing so.
%    \begin{macrocode}
\renewcommand*\makebox{%
  \@ifnextchar*%
  {\hh@makebox}{\hh@orig@makebox}%
}
%    \end{macrocode}
% The \cs{hh@makebox} is defined with two mandatory arguments since
% the star is the first argument and ignored.
% First, the width of the reference text is stored in the length
% \cs{@tempdima}.
% Then, the original \cs{makebox} command ist called to typeset the
% box.
%    \begin{macrocode}
\newcommand*\hh@makebox[2]{%
  \settowidth\@tempdima{#2}%
  \hh@orig@makebox[\@tempdima]%
}
%    \end{macrocode}
% \end{macro}
% \iffalse
%</package>
% \fi
% \Finale
