% \iffalse meta comment
% File: contour.dtx Copyright (C) 1999--2004 Harald Harders, Morten H�gholm
% \fi
%
% \iffalse
%
%<*driver>
\documentclass{ltxdoc}
\IfFileExists{contour.sty}{\usepackage{contour}
  \let\contourSTYfound\active}{\GenericWarning{contour.dtx}{Package
    file contour.sty not found (Documentation will be messed up!^^J^^A
    Generate contour.sty by (La)TeXing contour.ins, process
    contour.dtx again)^^J}\stop}
\usepackage{longtable}
\usepackage{graphicx}
\usepackage{url}
\GetFileInfo{contour.sty}
\title{The contour package}
\author{Harald Harders (\texttt{h.harders@tu-bs.de})\\
  Morten H\o gholm (\texttt{moho01ab@student.cbs.dk})}
\date{File version \fileversion, date \filedate, printed \today}
\EnableCrossrefs
\CodelineIndex
\DoNotIndex{\def,\edef,\let,\newcommand,\newenvironment,\newcounter}
\DoNotIndex{\setcounter,\space,\ifx,\else,\fi,\global,\newlength,\number}
\DoNotIndex{\relax,\setlength,\strip@pt,\the,\typeout,\p@,\z@,\@ne}
\DoNotIndex{\ProvidesPackage,\RequirePackage,\NeedsTeXFormat}
\DoNotIndex{\@firstoftwo,\@secondoftwo,\ifdim,\fi,\ifnum,\fi}
\CodelineNumbered
\RecordChanges
\CheckSum{326}
\renewcommand\floatpagefraction{0.75}
\begin{document}
 \DocInput{contour.dtx}
\end{document}
%</driver>
% \fi
%
% \changes{2.14}{2004/11/18}{Full outline support for Y\&Y DVIPSONE}%
% \changes{2.12}{2004/08/28}{Full outline support for V\TeX}%
% \changes{2.11}{2004/08/28}{Restricted outline support for V\TeX}%
% \changes{2.10}{2004/08/23}{Print text with real outlines for vector
%   fonts}%
% \changes{2.00}{2004/08/03}{Allow arbitrary numbers of text copies}%
% \changes{1.04}{2003/11/09}{Avoide usage of \cs{textversion} etc.}%
%
% \maketitle
% \begin{abstract}
% \noindent
% This package generates a colored contour around a given text in order 
% to enable printing text over a background without the need of a 
% color box around the text.
% By default this is done by placing copies of the text around the text
% itself and can be switched to use real outlines if supported by the
% backend driver.
% \end{abstract}
%
% \tableofcontents
%
% \section*{Copyright}
% Copyright  1999--2004 Harald Harders, Morten H\o gholm.
%
% 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{Introduction}
% Sometimes it is necessary to print text over a background that is
% not pure white, e.g., in gnuplot plots. It is not always wished to
% plot the text in a rectangular box since this can cover important
% information or look poor. This package provides a solution to cover
% less space with the text and ensure readable text in the same time.
%
% The used technique is quite simple.
% By default, in a circle around the original text position the same
% text is printed evenly distributed 16, 32, or a a given number
% times.
% The default radius for the circle is $0.03\,\mathrm{em}$.
% If requested and supported by the used driver (dvips, pdf\TeX, V\TeX,
% DVIPSONE) a real outline can be chosen instead of text copies.
%
%
% \section{User interface}
%
% To use this package place
% \begin{verbatim}
%\usepackage[<options>]{contour}\end{verbatim}
% in the preamble of your document.
%
% If loaded without package option or with the option |copies| the
% contour is printed by placing copies of the text around the original
% text, as described below.
% This can be changed by the option |outline|.
% If specified this option the contour is printed by a real outline of
% the text instead of copies.
% This increases speed as well as quality\footnote{Especially in
% Acrobat Reader, the quality is better.} and reduces the file size.
% But some prerequisites have to be fulfilled:
% \begin{itemize}
% \item The backend driver has to be supported.
%   Currently, dvips, pdf\TeX, V\TeX, and DVIPSONE are supported.
%   Normally, the file |contour.cfg| tries to find out which driver
%   has to be loaded.\footnote{DVIPSONE cannot be determined
%     automatically.}
%   But you can also specify the driver by giving one of the package
%   options |dvips|, |xdvi|, |pdftex|, |vtex|, or |dvipsone|.
%   |xdvi| refers to |dvips| as driver.
%   In xdvi and DVIWindo, the contours are silently ignored.
% \item Outline (vector) fonts have to be used.
%   With dvips, this means that Type\,1 fonts have to be used.
%   With pdf\TeX, Type\,1 or TrueType fonts are supported.
%   If you are using METAFONT fonts you have to use copies (package
%   option |copies|).
% \end{itemize}
%
%
% \DescribeMacro{\contour}%
% The package provides the commands
%\begin{verbatim}
%\contour{<color>}{<text>}
%\contour[<number>]{<color>}{<text>}
%\contour*{<color>}{<text>}\end{verbatim}
% which produce the text \meta{text} with a \meta{color}ed contour
% around.
% The text itself is typeset in the normal active color.
% The normal \cs{contour} command produces 16 copies of the text while
% the |*| variant makes 32 copies.
% If \meta{number} is given, the given number of copies is generated
% around the text.
% If \meta{number} is |auto| instead of a number, the number of copies
% is calculated automatically depending on the font size.
%
% \DescribeMacro{\contourlength}%
% The radius of the circle (= thickness of the contour) can be changed using
% the command \cs{contourlength}\marg{length}, where \meta{length} is a
% length understood by \LaTeX. The length is not expanded when defining the
% contour length but when using it. For example when using |0.05em|, 
% $0.05\,\mathrm{em}$ of the font used in the command \cs{contour} are used.
%
% \DescribeMacro{\contournumber}%
% By default, \cs{contour} generates 16 copies of the text.
% You can change this by using \cs{contournumber}, e.g.,
%\begin{verbatim}
%\contournumber{27}\end{verbatim}
% If you specify |auto| instead of a number, \cs{contour} will use the
% automatically calculated number of copies.
% You may also use the package option |auto| to reach this behaviour:
% \begin{verbatim}
%\usepackage[auto]{contour}\end{verbatim}
% If using outlines the number of copies is ignored.
%
%
% \section{Examples}
%
% The command
%\begin{verbatim}
% \colorbox{black}{This text is not visible
%   \contour{white}{but this is.}}\end{verbatim}
% produces:
% \medskip
%
% \noindent
% \colorbox{black}{This text is not visible \contour{white}{but this
% is.}}
% \medskip
%
% Another example is shown in Figure~\ref{fig:comparison}.
% \begin{figure}
% \contourlength{0.05em}
% \centering
% \unitlength1mm
% \begin{picture}(50,30)%
% \put(0,0){\line(1,0){50}}%
% \put(0,30){\line(1,0){50}}%
% \put(0,0){\line(0,1){30}}%
% \put(50,0){\line(0,1){30}}%
% \put(0,25){\line(1,1){5}}%
% \put(0,20){\line(1,1){10}}%
% \put(0,15){\line(1,1){15}}%
% \put(0,10){\line(1,1){20}}%
% \put(0,5){\line(1,1){25}}%
% \multiput(0,0)(5,0){5}{\line(1,1){30}}%
% \put(25,0){\line(1,1){25}}%
% \put(30,0){\line(1,1){20}}%
% \put(35,0){\line(1,1){15}}%
% \put(40,0){\line(1,1){10}}%
% \put(45,0){\line(1,1){5}}%
% \put(0,5){\line(1,-1){5}}%
% \put(0,10){\line(1,-1){10}}%
% \put(0,15){\line(1,-1){15}}%
% \put(0,20){\line(1,-1){20}}%
% \put(0,25){\line(1,-1){25}}%
% \multiput(0,30)(5,0){5}{\line(1,-1){30}}%
% \put(25,30){\line(1,-1){25}}%
% \put(30,30){\line(1,-1){20}}%
% \put(35,30){\line(1,-1){15}}%
% \put(40,30){\line(1,-1){10}}%
% \put(45,30){\line(1,-1){5}}%
% \put(25,23){\makebox(0,0)%
%   {{\Large\colorbox{white}{text with colorbox}}}}%
% \put(25,15){\makebox(0,0)%
%   {{\Large\contour{white}{text with contour}}}}%
% \put(25,7){\makebox(0,0)%
%   {{\Large simple text}}}%
% \end{picture}
% \caption{Comparison of the commands \cs{colorbox} and
% \cs{contour}}
% \label{fig:comparison}
% \end{figure}
%
% In Figure~\ref{fig:anzahl}, you can see how the output depends on
% the number of copies.
% \begin{figure}
% \centering
% \begin{minipage}{0.85\linewidth}
% \contourlength{0.08em}%
% \let\lw\linewidth
% \definecolor{gray50}{rgb}{0.5,0.5,0.5}
% \begin{minipage}{0.3\lw}
% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[1]{white}{Test}}}}\\%
% a) 1 white copy
% \end{minipage}
% \hfill
% \begin{minipage}{0.3\lw}
% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[2]{white}{Test}}}}\\%
% b) 2 white copies
% \end{minipage}
% \hfill
% \begin{minipage}{0.3\lw}
% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[3]{white}{Test}}}}\\%
% c) 3 white copies
% \end{minipage}\\[5pt]
% \begin{minipage}{0.3\lw}
% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[4]{white}{Test}}}}\\%
% e) 4 white copies
% \end{minipage}
% \hfill
% \begin{minipage}{0.3\lw}
% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[8]{white}{Test}}}}\\%
% f) 8 white copies
% \end{minipage}
% \hfill
% \begin{minipage}{0.3\lw}
% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[16]{white}{Test}}}}\\%
% g) 16 white copies
% \end{minipage}\\[5pt]
% \begin{minipage}{0.3\lw}
% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[32]{white}{Test}}}}\\%
% h) 32 white copies
% \end{minipage}
% \hfill
% \begin{minipage}{0.3\lw}
% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[60]{white}{Test}}}}\\%
% i) 60 white copies
% \end{minipage}
% \hfill
% \begin{minipage}{0.3\lw}
% \resizebox{\lw}{!}{\colorbox{gray50}{{\Huge\contour[120]{white}{Test}}}}\\%
% j) 120 white copies
% \end{minipage}
% \end{minipage}
% \caption{Contours with different numbers of copies
% with a large distance between text and copies}
% \label{fig:anzahl}
% \end{figure}
%
%
% \section{Advanced internals}
%
% Normally, it is not planned to switch between outline and copy mode.
% If you really have to do it you can use the boolean
% \cs{ifcon@outline}.
% \cs{con@outlinetrue} switches on outlines, while replacing |true| by
% |false| switches them off.
% Don't forgett to surround it by \cs{makeatletter} and
% \cs{makeatother} to allow |@| in command names.
%
% See the difference between copy and outline mode:
% \medskip
%
% \begingroup
% \contourlength{0.05em}%
% \Huge
% \textcolor{white}{\contour{black}{Copies}}
% \makeatletter
% \con@outlinetrue
% \makeatother
% \textcolor{white}{\contour{black}{Outline}}
% \endgroup
% 
%
% \section{Acknowledgements}
%
% Thanks to Richard Pfeiffer who had the idea for this package and
% wrote some code that did it.
%
% Thanks to Dietrich Grau who asked me for support of DVIPSONE and who
% did the testing of all my code ideas for this driver since I do not
% have Y\&Y \TeX.
%
%
% \StopEventually{\PrintChanges \PrintIndex}
%
%
% \section{The implementation}
%
% Heading of the package:
%    \begin{macrocode}
%<package>\NeedsTeXFormat{LaTeX2e}
%<dvips>\ProvidesFile{dvips.cnt}
%<pdftex>\ProvidesFile{pdftex.cnt}
%<vtex>\ProvidesFile{vtex.cnt}
%<dvipsone>\ProvidesFile{dvipsone.cnt}
%<cfgfile>\ProvidesFile{contour.cfg}
%<package>\ProvidesPackage{contour}
%<package|drv|cfgfile>  [2004/11/18  v2.14  Print contoured text (HH, MH)]
%<*package>
%    \end{macrocode}
%
% \subsection{The package}
%
% This package requires the color package from the graphics bundle:
%    \begin{macrocode}
\RequirePackage{color}
%    \end{macrocode}
% This package requires the trig package:
%    \begin{macrocode}
\RequirePackage{trig}
%    \end{macrocode}
% A command that makes \cs{color} inactive prevent the background text
% color from being changed:
% \changes{2.10}{2004/08/23}{Bugfix: enable switching colors inside
%   \cs{contour} argument}%
%    \begin{macrocode}
\def\con@coloroff{%
  \def\@undeclaredcolor[##1]##2{}%
  \def\@declaredcolor##1{}%
}
%    \end{macrocode}
% Set text to a specified relative position without using space:
%    \begin{macrocode}
\newcommand*\con@put[3]{%
  \rlap{\hskip#1\raisebox{#2}[0pt]{#3}}%
}
%    \end{macrocode}
% \begin{macro}{\contourlength}
% Define the commands for changing the base length:
%    \begin{macrocode}
\newcommand*\contourlength[1]{\def\con@base@length{#1}}
\contourlength{0.03em}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\contournumber}
% Define the commands for changing the number of text copies:
%    \begin{macrocode}
\newcommand*\contournumber[1]{\def\con@default@copies{#1}}
\contournumber{16}
%    \end{macrocode}
% \end{macro}
% Define new offset length:
%    \begin{macrocode}
\newlength{\con@length}
%    \end{macrocode}
% Define the angles for using `\meta{\#1}' copies unless they've
% previously been defined. We use `trig' for this.
%    \begin{macrocode}
\newcommand*\con@define@copyangles[1]{%
  \edef\con@tempa{auto}%
  \edef\con@tempb{#1}%
%    \end{macrocode}
% Set the number of copies automatically.
%    \begin{macrocode}
  \ifx\con@tempa\con@tempb
    \expandafter\ifdim\f@size pt<15pt\relax
      \edef\con@tempb{16}%
    \else
      \expandafter\ifdim\f@size pt<25pt\relax
        \edef\con@tempb{32}%
      \else
        \expandafter\ifdim\f@size pt<50pt\relax
          \edef\con@tempb{60}%
        \else
          \edef\con@tempb{120}%
        \fi
      \fi
    \fi
  \fi
  \@tempcnta=\con@tempb\relax
  \@ifundefined{con@\number\@tempcnta @copies}{%
    \global\@namedef{con@\number\@tempcnta @copies}{}%
    \@tempdima=360\p@
    \divide\@tempdima by \@tempcnta
    \@tempdimb=\z@
    \@tempcntb=\z@
    \loop
      \ifnum\@tempcntb<\@tempcnta
        \edef\con@temp@fdim{\strip@pt\@tempdimb}%
        \CalculateSin{\con@temp@fdim}%
        \CalculateCos{\con@temp@fdim}%
        \advance\@tempcntb \@ne
        \advance\@tempdimb \@tempdima\relax
    \repeat
  }{}%
  \let\con@tempa\@undefined
  \let\con@tempb\@undefined
}
%    \end{macrocode}
% \begin{macro}{\contour}
% The starred version of \cs{contour} prints 32 copies.
%    \begin{macrocode}
\newcommand*\contour{\@ifstar{\@contour[32]}{\@contour}}
%    \end{macrocode}
%
%    \begin{macrocode}
\newcommand*\@contour[3][\con@default@copies]{%
  \ifvmode
    \leavevmode
  \fi
  \setlength\con@length{\con@base@length}%
%    \end{macrocode}
% Print outline or copies?
%    \begin{macrocode}
  \ifcon@outline
    \typeout{contour: Using real outline for `#3'\on@line.}%
    \@contour@outline{#2}{#3}%
  \else
    \begingroup
%    \end{macrocode}
% Calculate the copy angles.
%    \begin{macrocode}
      \con@define@copyangles{#1}%
      \typeout{contour: Using \the\@tempcnta\space copies for `#3'\on@line.}%
      \@tempdima=360\p@
      \divide\@tempdima by \@tempcnta\relax
      \@tempdimb=\z@
      \@tempcntb=\z@
%    \end{macrocode}
% Set color ans switch off color command inside argument.
%    \begin{macrocode}
      \color{#2}%
      \con@coloroff
%    \end{macrocode}
% Print the copies.
%    \begin{macrocode}
      \loop
        \ifnum\@tempcntb<\@tempcnta\relax
          \edef\con@temp@fdim{\strip@pt\@tempdimb}%
          \con@put
            {\UseSin{\con@temp@fdim}\con@length}%
            {\UseCos{\con@temp@fdim}\con@length}%
            {#3}%
          \advance\@tempcntb \@ne\relax
          \advance\@tempdimb\@tempdima\relax
      \repeat
    \endgroup
%    \end{macrocode}
% Print the main text.
%    \begin{macrocode}
    \mbox{#3}%
  \fi
}
%    \end{macrocode}
% By default, no driver is active.
%    \begin{macrocode}
\providecommand*\con@driver{\@empty}
%    \end{macrocode}
% Boolean for using outline or copies.
%    \begin{macrocode}
\newif\ifcon@outline
%    \end{macrocode}
% Options:
%    \begin{macrocode}
\DeclareOption{auto}{\contournumber{auto}}
\DeclareOption{dvips}{\def\con@driver{dvips.cnt}}
\DeclareOption{xdvi}{\ExecuteOptions{dvips}}
\DeclareOption{pdftex}{\def\con@driver{pdftex.cnt}}
\DeclareOption{vtex}{\def\con@driver{vtex.cnt}}
\DeclareOption{dvipsone}{\def\con@driver{dvipsone.cnt}}
\DeclareOption{outline}{\con@outlinetrue}
\DeclareOption{copies}{\con@outlinefalse}
%    \end{macrocode}
% Load configuration file if existing.
%    \begin{macrocode}
\InputIfFileExists{contour.cfg}{%
  \typeout{Loading configuration file `contour.cfg'.}%
}{%
  \typeout{No configuration file `contour.cfg' found.}%
}
%    \end{macrocode}
% Process the options.
%    \begin{macrocode}
\ProcessOptions\relax
%    \end{macrocode}
% Load the driver file.
%    \begin{macrocode}
\expandafter\ifx\con@driver\@empty
  \ifcon@outline
    \PackageError{contour}{Chosen package option `outline' but no
      driver defined}{Leave out the `outline' option or define a driver}%
  \else
    \PackageWarning{contour}{No driver defined (which does not matter
      when using copies)}%
  \fi
\else
  \InputIfFileExists{\con@driver}{%
    \typeout{contour: Using driver file `\con@driver'.}%
  }{%
    \PackageError{contour}{Driver file `\con@driver' does not exist}{}%
  }%
\fi
%</package>
%    \end{macrocode}
% \end{macro}
%
% \subsection{Driver Files}
%
% \subsubsection{Dvips}
%
% \begin{macro}{\@contour@outline}
% Prints the text and contour using real outlines.
% \cs{@contour@outline\marg{color}\marg{text}}
%    \begin{macrocode}
%<*dvips>
\newcommand*\@contour@outline[2]{%
  \begingroup
%    \end{macrocode}
% Double the width of the contour since the inner half is overprinted
% by the normal text; convert |pt| to |bp|.
%    \begin{macrocode}
    \setlength\con@length{2\con@length}%
    \setlength\con@length{0.99626400996\con@length}%
%    \end{macrocode}
% Set the contour color and disable color command.
%    \begin{macrocode}
    \color{#1}%
    \con@coloroff 
%    \end{macrocode}
% PostScript preamble to print an outline for the text.
%    \begin{macrocode}
    \special{ps:
%    \end{macrocode}
% First, save all graphics settings to avoid side effects.
%    \begin{macrocode}
      gsave
%    \end{macrocode}
% Start a new path and choose a round pen.
%    \begin{macrocode}
        newpath
        1 setlinejoin
        1 setlinecap
%    \end{macrocode}
% Set the line width and scale it according to the PostScript scale.
%    \begin{macrocode}
        Resolution 72 div DVImag mul
        \strip@pt\con@length\space mul setlinewidth
%    \end{macrocode}
% \changes{2.13}{2004/11/04}{More robust mechanism to change
%   Postscript internals for dvips}%
% Save |show| to be able to restore it later.
%    \begin{macrocode}
        /cntorigshow /show load def
%    \end{macrocode}
% Redefine the |show| command that prints a text to do the outline
% instead of the text.
%    \begin{macrocode}
        /show { false charpath } def
    }%
%    \end{macrocode}
% Typeset the outline text.
%    \begin{macrocode}
    \rlap{#2}%
%    \end{macrocode}
% PostScript postamble.
%    \begin{macrocode}
    \special{ps:
%    \end{macrocode}
% Finally, do the outline.
%    \begin{macrocode}
        stroke
%    \end{macrocode}
% Restore the original settings.
%    \begin{macrocode}
        /show /cntorigshow load def
      grestore
    }%
  \endgroup
%    \end{macrocode}
% Print the main text.
%    \begin{macrocode}
  \mbox{#2}%
}
%</dvips>
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{pdf\TeX}
%
% \begin{macro}{\@contour@outline}
% Prints the text and contour using real outlines.
% \cs{@contour@outline\marg{color}\marg{text}}
%    \begin{macrocode}
%<*pdftex>
\newcommand*\@contour@outline[2]{%
  \begingroup
%    \end{macrocode}
% Double the width of the contour since the inner half is overprinted
% by the normal text; convert |pt| to |bp|.
%    \begin{macrocode}
    \setlength\con@length{2\con@length}%
    \setlength\con@length{0.99626400996\con@length}%
%    \end{macrocode}
% Set the contour color and disable color command.
%    \begin{macrocode}
    \color{#1}%
    \con@coloroff 
%    \end{macrocode}
% PDF preamble.
%    \begin{macrocode}
    \pdfliteral{%
%    \end{macrocode}
% Save the graphics settings.
%    \begin{macrocode}
      q
%    \end{macrocode}
% Choose a round pen.
%    \begin{macrocode}
      1 j
      1 J
%    \end{macrocode}
% Switch text to print an outline instead of fill.
%    \begin{macrocode}
      1 Tr
%    \end{macrocode}
% Set the line width.
%    \begin{macrocode}
      \strip@pt\con@length\space w
    }%
%    \end{macrocode}
% Typeset the outline text.
%    \begin{macrocode}
    \rlap{#2}%
%    \end{macrocode}
% PDF postamble.
%    \begin{macrocode}
    \pdfliteral{%
%    \end{macrocode}
% Restore original settings.
%    \begin{macrocode}
      Q
    }%
  \endgroup
%    \end{macrocode}
% Print the main text.
%    \begin{macrocode}
  \mbox{#2}%
}
%</pdftex>
%    \end{macrocode}
% \end{macro}
%
%
%
% \subsubsection{V\TeX}
%
% \begin{macro}{\@contour@outline}
% Prints the text and contour using real outlines.
% \cs{@contour@outline\marg{color}\marg{text}}
%    \begin{macrocode}
%<*vtex>
\newcommand*\@contour@outline[2]{%
  \begingroup
%    \end{macrocode}
% Double the width of the contour since the inner half is overprinted
% by the normal text; convert |pt| to |bp|.
%    \begin{macrocode}
    \setlength\con@length{2\con@length}%
    \setlength\con@length{0.99626400996\con@length}%
%    \end{macrocode}
% Set the contour color and disable color command.
%    \begin{macrocode}
    \color{#1}%
    \con@coloroff 
%    \end{macrocode}
% PostScript preamble to print an outline for the text.
%
% At this point, V\TeX\ does an ugly job since it interprets this code
% immediately and thus puts the path itself into the output instead of
% just let the printer do the work.
% I do not know how to change this.
%    \begin{macrocode}
    \special{pS:
%    \end{macrocode}
% First, save all graphics settings to avoid side effects.
%    \begin{macrocode}
      save
%    \end{macrocode}
% Start a new path and choose a round pen.
%    \begin{macrocode}
        newpath
        1 setlinejoin
        1 setlinecap
%    \end{macrocode}
% Set the line width.
%    \begin{macrocode}
        \strip@pt\con@length\space setlinewidth
%    \end{macrocode}
% Redefine the command that prints a text to do the outline instead of
% the text.
%    \begin{macrocode}
        /show { false charpath } def
    }%
%    \end{macrocode}
% Typeset the outline text.
%    \begin{macrocode}
    \rlap{#2}%
%    \end{macrocode}
% PostScript postamble.
%    \begin{macrocode}
    \special{pS:
%    \end{macrocode}
% Finally, do the outline.
%    \begin{macrocode}
        stroke
%    \end{macrocode}
% Restore the original settings.
%    \begin{macrocode}
      restore
    }%
  \endgroup
%    \end{macrocode}
% Print the main text.
%    \begin{macrocode}
  \mbox{#2}%
}
%</vtex>
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{DVIPSONE}
% \changes{2.14}{2004/11/05}{Add support for DVIPSONE}%
%
% \begin{macro}{\@contour@outline}
% Prints the text and contour using real outlines.
% \cs{@contour@outline\marg{color}\marg{text}}
%    \begin{macrocode}
%<*dvipsone>
\newcommand*\@contour@outline[2]{%
%    \end{macrocode}
% First, print the text.
% This is a hack and avoids problems when \cs{contour} is used in some
% contexts, e.g., at the begin of the text.
%    \begin{macrocode}
  \rlap{#2}%
  \begingroup
%    \end{macrocode}
% Double the width of the contour since the inner half is overprinted
% by the normal text; convert |pt| to |bp|.
%    \begin{macrocode}
    \setlength\con@length{2\con@length}%
    \setlength\con@length{0.99626400996\con@length}%
%    \end{macrocode}
% Set the contour color and disable color command.
%    \begin{macrocode}
    \color{#1}%
    \con@coloroff 
%    \end{macrocode}
% PostScript preamble to print an outline for the text.
%    \begin{macrocode}
    \special{ps:
%    \end{macrocode}
% First, save all graphics settings to avoid side effects.
%    \begin{macrocode}
      gsave
%    \end{macrocode}
% Save the current position to be used for the new path.
%    \begin{macrocode}
        currentpoint
%    \end{macrocode}
% Start a new path and go back to the old position.
%    \begin{macrocode}
        newpath
        moveto
%    \end{macrocode}
% Choose a round pen.
%    \begin{macrocode}
        1 setlinejoin
        1 setlinecap
%    \end{macrocode}
% Set the line width and scale it according to the PostScript scale.
% The factor 65693.4 is chosen by trial and error and may be inexact.
%    \begin{macrocode}
        65693.4 \strip@pt\con@length\space mul setlinewidth
%    \end{macrocode}
% Save |show| to be able to restore it later.
%    \begin{macrocode}
        /cntorigshow /show load def
%    \end{macrocode}
% Redefine the |show| command that prints a text to do the outline
% instead of the text.
%    \begin{macrocode}
        /show { false charpath } def
    }%
%    \end{macrocode}
% Typeset the outline text.
%    \begin{macrocode}
    \rlap{#2}%
%    \end{macrocode}
% PostScript postamble.
%    \begin{macrocode}
    \special{ps:
%    \end{macrocode}
% Finally, do the outline and save the position.
%    \begin{macrocode}
        currentpoint
        stroke
%    \end{macrocode}
% Restore the original settings and position.
%    \begin{macrocode}
        /show /cntorigshow load def
      grestore
      moveto
    }%
  \endgroup
%    \end{macrocode}
% Print the main text.
%    \begin{macrocode}
  \mbox{#2}%
}
%</dvipsone>
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{Configuration Files}
%
% This configuration file is just a copy of a part of |graphics.cfg|
% from \TeX Live.
%    \begin{macrocode}
%<*cfgfile>
 % Select an appropriate default driver
\begingroup
  \chardef\x=0 %
  % check pdfTeX
  \@ifundefined{pdfoutput}{}{%
    \ifcase\pdfoutput
    \else
      \chardef\x=1 %
    \fi
  }%
  % check VTeX
  \@ifundefined{OpMode}{}{%
    \chardef\x=2 %
  }%
\expandafter\endgroup
\ifcase\x
  % default case
  \ExecuteOptions{dvips}%
\or
  % pdfTeX is running in pdf mode
  \ExecuteOptions{pdftex}%
\else
  % VTeX is running
  \ExecuteOptions{vtex}%
\fi
%</cfgfile>
%    \end{macrocode}
%
% \Finale