\message{OVAL Boxes (c) by Elmar Schalueck 1991}
\catcode`\@=11          % Make @ a letter
\newbox\@tmpbox         % to save a box
\newbox\@cornerbox      % to save a corner
\newdimen\@tmpradius%
\newdimen\@tmprule%
\newdimen\@tmpdimadd%
\newdimen\@tmpsep%
\newdimen\@tmpdimd        % dimen of depth
\newdimen\@tmpdimh        % dimen of height
\newdimen\@tmpdimw        % dimen of width
\newdimen\@cornerdimw     % dimen of width of a corner
\newdimen\@vboxheight     % dimen of height of surrounding box
\newdimen\@hboxwidth      % dimen of width of surrounding box
\font\@cornerfont = newcirc     % font for corners
\newcount\@tmpchar%
\newcount\@tmpcount%
%
%
%
% \@getovalradius calculates the real radius of the corners
%
\def\@getovalradius
{\global\@tmpsep=2pt
\ifdim\fboxsep>14\@tmpsep\@tmpcount=7\else
\ifdim\fboxsep>12\@tmpsep\@tmpcount=6\else
\ifdim\fboxsep>10\@tmpsep\@tmpcount=5\else
\ifdim\fboxsep>8\@tmpsep\@tmpcount=4\else
\ifdim\fboxsep>6\@tmpsep\@tmpcount=3\else
\ifdim\fboxsep>4\@tmpsep\@tmpcount=2\else
\ifdim\fboxsep>2\@tmpsep\@tmpcount=1\else
\global\@tmpcount=0\fi\fi\fi\fi\fi\fi\fi
\global\@tmpchar=4\global\multiply\@tmpchar by\@tmpcount
\advance\@tmpcount by 1
\global\multiply\@tmpsep by\@tmpcount}
%
%
% \@gettmprule calculates real line width
%
\def\@gettmprule
{\global\@tmprule=.4pt
\ifdim\fboxrule>3\@tmprule\@tmpcount=3\else
\ifdim\fboxrule>2\@tmprule\@tmpcount=2\else
\ifdim\fboxrule>\@tmprule\@tmpcount=1\else
\@tmpcount=0\fi\fi\fi
\advance\@tmpcount by 1
\global\@tmprule=.4pt\global\multiply\@tmprule by\@tmpcount
\advance\@tmpcount by -1
\multiply\@tmpcount by 32
\global\advance\@tmpchar by\@tmpcount}
%
%
%
% \ovalbox#1 defines a box with round corners to enclose #1
%
\long\def\ovalbox#1{%
 \leavevmode\setbox\@tmpbox\hbox{#1}     % make #1 a box
 \@getovalradius%
 \@gettmprule%
 \setbox\@cornerbox\hbox{\@cornerfont\char\@tmpchar}%
 \@cornerdimw=\wd\@cornerbox%
 \@tmpdimd=\dp\@tmpbox                   % depth of box, i.e. the part beneath
                                         % the baseline
 \@tmpdimh=\ht\@tmpbox                   % part above baseline
 \@tmpdimw=\wd\@tmpbox                   % width of box
 \advance\@tmpdimh by\@tmpdimd           % total height of original box
 \@hboxwidth=\fboxsep%
 \advance\@hboxwidth by \fboxsep%
 \@vboxheight=\@hboxwidth%
 \advance\@hboxwidth by \@tmpdimw        % total width of surrounding box
 \advance\@vboxheight by \@tmpdimh       % total height of surrounding box
 \advance\@tmpdimd by\fboxsep%
 \advance\@tmpdimd by\@tmprule           % total amount beneath baseline
 \@tmpdimadd=\fboxsep%
 \advance\@tmpdimadd by -\@tmpsep%
 \multiply\@tmpdimadd by 2               % calculate additional length
 \advance\@tmpdimh by\@tmpdimadd         % calculate height of vrule
 \advance\@tmpdimw by\@tmpdimadd         % calculate width of hrule
 \hbox{\lower\@tmpdimd                   % put a box beneath baseline
  \hbox%
   {\vbox%
     {\hbox{\@cornerfont \char \@tmpchar}%
      \nointerlineskip%
      \global\advance\@tmpchar by 1%
      \hbox{\hskip-0.5\@tmprule%
            \vrule height\@tmpdimh width\@tmprule depth0pt}%
      \nointerlineskip%
      \hbox{\@cornerfont \char \@tmpchar}%
      \global\advance\@tmpchar by 1%
     }\relax%
    \lower0.5\@tmprule\vbox
     {\hrule width\@tmpdimw height\@tmprule depth0pt\relax%
      \vskip\fboxsep%
      \vskip-0.25\@tmprule%
      \hbox%
       {\hskip0.5\@tmpdimadd%
        \box\@tmpbox\relax                       % place original box
       }%
      \vskip\fboxsep%
      \hrule width\@tmpdimw height\@tmprule depth0pt\relax%
     }\relax%
    \vbox%
     {\hbox{\@cornerfont \char \@tmpchar}%
      \nointerlineskip%
      \global\advance\@tmpchar by 1%
      \hbox{\hskip\@tmpsep\hskip-0.5\@tmprule%
            \vrule height\@tmpdimh width\@tmprule depth0pt}%
      \nointerlineskip%
      \hbox{\@cornerfont \char \@tmpchar}%
     }%
   }}}%
%
\catcode`\@=12%