% \iffalse meta-comment
% $Header: /edrive/emtex/texinput/latex2e/nick/RCS/key.dtx,v 1.1 1997/09/21 09:45:50 Nick Exp $
%
% $Log: key.dtx,v $
% Revision 1.1  1997/09/21 09:45:50  Nick
% Initial revision
%
%
% \fi
% \CheckSum{22}
% \def\fileversion{2.1}
% \def\filedate{21 Sep 97}
% \def\docdate{21 Sep 97}
%
% \MakeShortVerb{\|}
%
% \changes{v1.0}{1 Apr 95}{First release}
% \changes{v2.0}{17 Sep 95}{Added documentation}
% \changes{v2.0a}{11 Oct 95}{Problem with the |\docdate| fixed}
% \changes{v2.1}{21 Sep 97}{Let width change, have a minimum height,
% let the formatting be as the user chooses.}
%
%
% \title{Making boxed keys to immitate key presses}
% \author{Nick Urbanik}
% \maketitle
% \begin{abstract}
% For laboratory sheets I needed to show to the student when they were to
% press a particular key.  This style provides the |\key| command, which encloses its arguments in a box with rounded corners.
% \end{abstract}
%\StopEventually{}
% \section{Producing the documentation}
% Here is a short driver program that can be extracted with the \LaTeX2e\
% |docstrip| program.
%    \begin{macrocode}
%<*driver>
\documentclass{article}%
\usepackage{a4,doc}
\EnableCrossrefs   % Make a full index.
\CodelineIndex     % Index by line numbers rather than by page.
\RecordChanges     % Show change history.
\begin{document}
\DocInput{key.dtx}
\PrintIndex
\PrintChanges
%    \end{macrocode}
% Now tell the people what they need to do next to get the index and
% change list:
%    \begin{macrocode}
\message{Next, to make the index and changes list for this documentation:}
\message{2. makeindex -s gind.ist key}
\message{^^J3. makeindex -s gglo.ist -o key.gls key.glo}
\message{Finally, run this file through LaTeX once more.}
%    \end{macrocode}
%
%    \begin{macrocode}
\end{document}
%</driver>
%    \end{macrocode}
%    \begin{macrocode}
%<*package>
\ProvidesPackage{key}[97/09/21 ver 2.1 Creates a boxed key image]
%    \end{macrocode}
%
% \section{The package that \emph{really} does the work}
% The |fancybox| package does all the work.  This |key| package is
% just using that to do the job here.
%    \begin{macrocode}
\RequirePackage{fancybox}
%    \end{macrocode}
%
% \DescribeMacro{key}
% The |key| macro takes one argument.  This argument will be set in a small
% sans serif font with a box that is 0.7em in size, and has rounded corners.
% Really, the work is all done by the |fancybox| package.
%
% The optional argument to |\rule| allows the positioning of the letter
% within the box to be adjusted vertically.  I changed it from a negative
% value to zero.
%
% before, I wrote this:
%\begin{verbatim}
%\newcommand{\key}[1]%
%{%
%   \Ovalbox%
%   {%
%      \makebox[0.7em]%
%      {%
%         {\small\textsf{#1}}%
%         \rule[-0.0em]{0pt}{0.7em}%
%      }%
%   }%
%}
%\end{verbatim}
% but this did funny things to the line spacing, and some boxes should
% be longer than others.  It seems the sensible thing is for the
% height of the box to be \emph{at least} some particular value, and
% allow it to get higher if the contents are bigger.  Let the width of
% the box be whatever it likes.
%    \begin{macrocode}

\newcommand{\key}[1]%
{%
   \cornersize*{2ex}%
   \Ovalbox%
   {%
      {#1}%
      \rule{0pt}{1.6ex}%
   }%
}
%</package>
%    \end{macrocode}
%
% This |\endinput| command prevents anything else from being read by
% |docstrip|, such as the character table.
%    \begin{macrocode}
\endinput
%    \end{macrocode}
% \Finale
