% \iffalse
% Copyright (C) 2004 TeX Users Group.
% 
%    This program is free software; you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation; either version 2 of the License, or
%    (at your option) any later version.
%
%    This program is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with this program; if not, write to the Free Software
%    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
%
%<*driver>
\ProvidesFile{pracjourn.dtx}
%</driver>
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{pracjourn}
%<*class>
    [2007/08/25 v0.4n PracTeX Journal Class]
%</class>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{hyperref,multicol}
\EnableCrossrefs
\CodelineIndex
\RecordChanges

\makeatletter
\usepackage{amsmath,amssymb,array,calc,graphicx,hyperref,ifpdf,ifthen,varioref}
\usepackage[osf]{mathpazo}
\renewcommand\sfdefault{lmss}
\renewcommand\ttdefault{lmtt}
\usepackage[T1]{fontenc}
\ifpdf\IfFileExists{microtype.sty}{\usepackage[protrusion=true,expansion=false]{microtype}}{}\fi
\linespread{1.069}      % Palatino needs more space between lines
\frenchspacing         % Remove ugly extra space after punctuation
\hypersetup{colorlinks, breaklinks, linktocpage,
  linkcolor=red, citecolor=red, filecolor=blue, urlcolor=blue}
\setlength\extrarowheight{2pt} % Make tables bearable
% Crude referencing commands:
\newcommand\tabref[1]{Table~\vref{tab:#1}}
\newcommand\figref[1]{Figure~\vref{fig:#1}}
\newcommand\secref[1]{Section~\vref{sec:#1}}
% Various labelling commands:
\newcommand*\name[1]{\textsc{#1}}
\newcommand*\pkg[2][]{\relax
  \edef\@tempa{#1}\relax
  \ifx\@tempa\@empty
    \textsf{#2}\else
    \href{#1}{\textsf{#2}}\fi}
\newcommand*\env[1]{\textsf{#1}}
\let\latin\textit
\def\eg{\latin{e.g.}}
\def\ie{\latin{i.e.}}
\def\etc{\@ifnextchar.{\latin{etc}}{\latin{etc.}\@}}
% Better float parameters: (from the TeX FAQ)
\renewcommand{\topfraction}{.85}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.15}
\renewcommand{\floatpagefraction}{.66}
\renewcommand{\dbltopfraction}{.66}
\renewcommand{\dblfloatpagefraction}{.66}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}
% Section heading customisation:
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3ex \@plus -1ex \@minus -.2ex}%
                                   {2ex \@plus 0.2ex}%
                                   {\centering\normalsize\scshape}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-2.5ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus 0.2ex}%
                                     {\centering\normalsize\itshape}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-2ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus 0.2ex}%
                                     {\centering\normalfont\normalsize}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                    {3.25ex \@plus1ex \@minus.2ex}%
                                    {-1em}%
                                    {\normalfont\normalsize\itshape}}
\let\subparagraph\undefined
\def\@maketitle{%
  \newpage
  {\centering
   {\large\@title\par}\vskip1em
   \textsc\@author\par\vskip1em
   \@date\par}\vskip2em}
% Abstract customisation:
\renewenvironment{abstract}{%
  \begin{trivlist}\item[]
    \setlength\leftskip{0.15\textwidth}
    \setlength\rightskip{0.15\textwidth}
    \small\textit{Abstract}\quad}{\end{trivlist}}                                      
% TOC customisation: Make it two-column to save space;
%   Remove leaders in the TOC, replace with \quad.
\setcounter{tocdepth}{2}
\renewcommand\tableofcontents{%
  \section*{\contentsname}
  \begin{trivlist}\item[]
    \begin{multicols}{2}
      \setlength\parskip{0pt}
      \small
      \@starttoc{toc}%
    \end{multicols}
  \end{trivlist}}
\renewcommand*\l@section[2]{%
  \ifnum \c@tocdepth >\z@
    \addpenalty\@secpenalty
    \addvspace{1.0em \@plus\p@}%
    \setlength\@tempdima{1.5em}%
    \begingroup
      \raggedright
      \parindent \z@ 
      \rightskip \z@
      \parfillskip \@flushglue
      \leavevmode
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\quad\nobreak#2\hfil\par
    \endgroup
  \fi}
\def\@dottedtocline#1#2#3#4#5{% 
  \ifnum #1>\c@tocdepth \else 
    {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip \@flushglue
     \parindent #2\relax\@afterindenttrue 
     \interlinepenalty\@M 
     \leavevmode 
     \raggedright
     \@tempdima #3\relax 
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip 
     {#4}\quad\nobreak#5\hfil\par}% 
  \fi}
% Better footnotes:
\let\old@makefntext\@makefntext
\renewcommand\@makefntext[1]{%
  \vspace{2pt}%
  \setlength\parindent{-1.8em}%
  \setlength\leftskip{1.8em}%
  \makebox[1.8em][l]{\normalfont\small\@thefnmark.}#1}
% LOGOS, tuned for Palatino:
\def\TeX{T\kern-.15em\lower.5ex\hbox{E}\kern-.07em X\spacefactor1000\relax}

\newcommand\TODO[1]{\marginpar{\raggedright\itshape\color{red}TODO: #1}}

\begin{document}
  \DocInput{pracjourn.dtx}
\end{document}
%</driver>
%
% \fi
%
% \CheckSum{0}
%
%
% \changes{v0.0}{2004/10/03}{KB: Initial version}
% \changes{v0.2}{2004/11/13}{KB: Palatino, no date printing}
% \changes{v0.3}{2005/01/03}{AO: Add \cmd\TPJissue, \cmd\TPJrevision, \cmd\TPJcopyright}
% \changes{v0.3}{2005/01/03}{AO: Rewrite using \LaTeXe{} idioms}
% \changes{v0.3a}{2005/01/03}{AO: changes to \cmd\TPJissue, \cmd\TPJrevision, \cmd\TPJcopyright}
% \changes{v0.3b}{2005/01/07}{AO: change \cmd\evensidemargin}
%
%
% \GetFileInfo{pracjourn.dtx}
%
% \DoNotIndex{\if}
%
% \title{The \textsf{pracjourn} class}
% \author{%
%  Karl Berry \\
%  Arthur Ogawa\\
%  Will Robertson\\
%  Correspondence to: \texttt{pracjourn@tug.org}}
% \date{\filedate\qquad\fileversion}
%
% \maketitle
%
% \begin{abstract}
%   \noindent\textsf{pracjourn} is a class based on \texttt{article.cls}, 
%   to be used for typesetting articles in The Prac\TeX\ Journal, 
%   \url{http://tug.org/pracjourn}.
% \end{abstract}
%
% \tableofcontents
% 
% \section{Introduction}
%
% The \pkg{pracjourn} \LaTeX{} document class is to be used for
% articles written for the The Prac\TeX\ Journal,
% \url{http://tug.org/pracjourn}.  The source for the document class
% resides at \url{http://tug.org/pracjourn/dtx}, and is also
% available at CTAN.
%
% \section{Usage}
%
% Refer to the sample document, \url{www.tug.org/pracjourn/dtx/pjsample.tex},
% for context. Issue a |\documentclass{pracjourn}| command at
% the beginning of your document as usual. No class options are necessary.
%
% This document class automatically loads the packages 
% \pkg{color}, \pkg{graphicx}, \pkg{hyperref}, and \pkg{textcomp}. 
% These are all standard packages in every \TeX\ distribution.
%
% \subsection{Formatting}
%
% Page metrics are appropriate for printing on either A4 or
%   letter size paper. The type size is 12/15.5 Palatino. 
% Except in exceptional circumstances, please refrain from 
%   using typefaces other than those defined by this class.
%
% Hyperlinks are inserted automatically in the relevant locations in
% a dark blue colour. If you wish to adjust this colour to suit your
% own colour requirements, simply redefine the \texttt{linkcolour}. E.g.,
% to change it to dark red,\\
% \indent|\definecolor{linkcolour}{rgb}{0.7,0.2,0.2}|.
%
% \subsection{Author/article metadata}
%
% All author and article information must be defined before \cmd\maketitle, which 
% should probably be the first thing after |\begin{document}|.
% 
% \DescribeMacro{\author}
% \DescribeMacro{\title}
% \DescribeMacro{\abstract}
% The \cmd\author, \cmd\title, and \cmd\abstract\ commands are used to
%   define those pieces of metadata about the article, and are mandatory.
% Note that the \cmd\abstract\ is a plain old command, \emph{not} an environment.
%
% \DescribeMacro{\noabstract}
% Should you have a reason for not having an abstract,
%     this may be signified by declaring \cmd\noabstract\ instead.
%
% \DescribeMacro{\license}
% It is optional to specify a copyright and/or license declaration, 
%   to be typeset in the footer of the first page, with the \cmd\license\
%   command.\footnote{The \cmd\TPJcopyright\ command, which used to provide this
%   functionality is still provided for backwards compatibility.}
%
% \DescribeMacro{\email}
% \DescribeMacro{\website}
% \DescribeMacro{\address}
% Additional author information may be specified, to be typeset appropriately,
%   with the following commands: \cmd\email, \cmd\website, and \cmd\address.
%   
%   If the \pkg{switcheml} package is installed somewhere that
%     \TeX\ will find it, it is loaded for the purpose of obfuscating
%     the typeset email address. This is done to prevent harvesting by
%     spammers, but if the package cannot be found the email address
%     will by typeset as a hyperlink. 
%
% \DescribeMacro{\hyperlinkemail}
%   Should you wish to typeset your
%     email address as a hyperlink (that is, theoretically harvestable
%     by spammers) despite having \pkg{switcheml} installed, you may
%     simply include the command \cmd\hyperlinkemail\ anywhere before
%     \verb|\begin{document}|.
%
% \subsubsection{Adding more author/article information}
%
% As previously
% mentioned, this class provides the \cmd\email, \cmd\website, and \cmd\address\
% macros for typesetting that information in the header block. These commands are defined 
% in the source code of the class file with (something like) the following:\footnote{\cmd\typesetemail\ is an internal command defined by either \cmd\hyperlinkemail\ or \cmd\obfuscateemail.}
% \begin{quote}
%   |\addinfo[\typesetemail]{Email}|\\
%   |\addinfo[\url]{Website}|\\
%   |\addinfo{Address}|
%  \end{quote}
% Additional blocks my be added on a per-article basis in the same manner.
%
% \DescribeMacro{\addinfo}
% To be specific, the \cmd\addinfo\ command takes one mandatory argument,
% which is the title of the item to be added to the list, and one optional
% argument, which is used to define the formatting of the block.
%
% This command will then define the macro used to input the additional information
% by taking the lowercase of the title of the information and turning it into
% a \TeX\ macro.
%
% \DescribeMacro{\newinfo}
% If lowercasing the heading to create the macro name is impractical 
% (due to accents, for example), then this command can be used instead:
% \begin{quote}
%   |\newinfo\resume[\color{red}]{R\'esum\'e}|
%  \end{quote}
%
% The names used in the article metadata (`Email', `R\'esum\'e', etc.) can be redefined as follows:
% \begin{quote}
%   |\renewcommand\emailname{Email}|\\
%   |\renewcommand\resumename{Resume}|
%  \end{quote}
% These macros are defined automatically by \cmd\addinfo/\cmd\newinfo.
%
% \DescribeMacro{\addinfospace}
% If you wish to add some vertical space after the previous item in the front matter,
% the \cmd\addinfospace\marg{height} command will insert some. This may be necessary
% after multi-line blocks, which require some breathing room.
%
% \DescribeMacro{\clearinfo}
% If you don't like the ordering of the information blocks or you wish to edit
% the formatting of the current setup, the \cmd\clearinfo\ command allows you to start
% fresh and redefine the info blocks however you may wish.
%
% \subsection{Additional user commands}
% \DescribeMacro{\dash} For `smart' dashes in text. Thinly spaced from the text, it ignores surrounding spaces, and permits only succeeding line breaks.
%   \begin{quote}
%  |use like this \dash for consistent dashes|
%   \end{quote}
%   produces `use like this \unskip\thinspace\nobreak\textemdash\thinspace for consistent dashes'.
%
%
% \DescribeMacro{\note} For easier footnotes. This command ignores preceding space, so linebreaks before the footnote text in the source will not give the wrong spacing.
%   \begin{quote}
%  |And here's an example.|\\
%  |  \note{Albeit a trivial one.}|\\
%  |And continuing|
%   \end{quote}
%   produces `And here's an example.
%    \unskip\footnote{Albeit a trivial one.}
%   And continuing'.
%
% \DescribeEnv{itemise} For non-US writers, it is probably more natural
% to use |\begin{itemise}| over what \LaTeX\ provides by default.
%
% \DescribeMacro{\ctanfile}
% \changes{v0.4j}{2006/02/09}{Implemented.}
% \DescribeMacro{\ctanloc}
% \changes{v0.4j}{2006/02/09}{Implemented.}
% These commands are used to refer to online locations and documentation within the Comprehensive \TeX\ Archive Network. Usage is as follows:
% \begin{quote}
%   |\ctanfile{macros/latex/contrib/titlesec/titlesec.pdf}|\\
%   |\ctanloc{macros/latex/contrib/titlesec/}|
% \end{quote}
% It will print the input prefixed with `CTAN:' and provide a hyperlink to the location.
%
% \subsection{TPJ internal commands}
% 
% Two commands are to be used at the direction of the Prac\TeX\
%   production team: \cmd\TPJrevision\ and \cmd\TPJissue. These
%   commands typeset information in the header of the first page
%   relating to the revision number (or date) of the article and the
%   issue number of the journal.
% 
% This document class creates a file \verb+_rev.tex+ in the
%   current directory (if a \cmd\TPJrevision{} statement is present)
%   and reads a file \verb+_iss.tex+, if present.  Please keep a
%   separate directory for each article you develop for TPJ.
%
% \subsection{Logos}
%
% \begingroup
%
% \DeclareRobustCommand\TeX{T\kern-.15em\lower.5ex\hbox{E}\kern-.07em X\spacefactor1000\relax}
% \DeclareRobustCommand\LaTeX{L\kern-.32em\raise.37ex\hbox{\scalebox{0.76}{A}}\kern-.15em\TeX}
% \DeclareRobustCommand\LaTeXe{\LaTeX2$_{\textstyle\varepsilon}$}
% \DeclareRobustCommand\BibTeX{B{\textsc i\kern-.025em\textsc b}\kern-.08em\TeX}
% \DeclareRobustCommand\logofamily{%
%   \not@math@alphabet\logofamily\relax
%   \fontencoding{U}\fontfamily{logo}\selectfont}
% \def\textlogo#1{{\logofamily#1}}
% \DeclareRobustCommand\MF{\textlogo{METAFONT}\@}
% \DeclareRobustCommand\MP{\textlogo{METAPOST}\@}
% \DeclareRobustCommand\ConTeXt{C\kern-.03em on\-\kern-.10em\TeX\kern-0.04em t}%
% \DeclareRobustCommand\pdfTeX{pdf\/\TeX}
% \DeclareRobustCommand\pdfLaTeX{pdf\/\LaTeX}
% \DeclareRobustCommand\PS{PostScript}
% \DeclareRobustCommand\PracTeX{Prac\kern-0.07em\TeX}
% \DeclareRobustCommand\TPJ{The \PracTeX\ Journal}
% \DeclareRobustCommand\XeTeX{\relax
%       X\lower.5ex\hbox{\kern-.07em\reflectbox{E}}\relax
%       \kern-.15em\TeX}
% \DeclareRobustCommand\ExTeX{\textrm{\relax
%    \ensuremath{\textstyle\varepsilon\sb{\kern-0.15em\mathcal{X}}}\relax
%    \kern-.15em\TeX}}
% The following logos and abbreviations are defined for your
% convenience: 
% \begin{multicols}{2}\everypar{\parindent0pt\parskip0pt}
% \def\showlogo#1{\@for\@ii:=#1\do{\expandafter\cmd\@ii:\hfill\@ii\endgraf}}
% \noindent\showlogo{\noexpand\TeX,\LaTeX,\LaTeXe,\BibTeX,\MF,\MP,
%   \ConTeXt,\pdfTeX,\pdfLaTeX,\XeTeX,\ExTeX,\PracTeX,\TPJ,\PS}
% \end{multicols}
% \endgroup
%
% \StopEventually{\clearpage\PrintChanges\clearpage\PrintIndex}
%
% \section{History}
%
% The first revision of this class was written by Karl Berry.
% KB: Gratefully based on the \texttt{dtxtut} skeleton.
%
% Revised by Arthur Ogawa, 2004/01/03, to include new features, per
% Lance Carnes, as follows:
%
% \begin{enumerate}
% \item Define an \cmd\articleID{} macro which typesets the article
%   identification in a block somewhere on the first page of the
%   article, and which can be used to identify the article/revision
%   date for reader comments.  E.g. if this appears in the article
%   source file:
% \begin{verbatim}
% \author{A.U. Thor}
% \title{Pracjourn Sample}
% \TPJissue{TPJ Vol 1 No 1, 2005-1-15}
% \TPJrevision{2005-2-12}%
% \TPJcopyright{\textcopyright\ 2005 TeX Users Group}
% \end{verbatim}
%   it will become a block of text typeset on the first page of the
%   article.  See
%   e.g. \href{http://www.ams.org/bull/2004-41-04/S0273-0979-04-01032-8/S0273-0979-04-01032-8.pdf}{this example PDF}.
%
% \item Write the information from the argument of the
%   \cmd\articleID{} macro into a file called \verb+_id.tex+.  Put
%   this file in the same directory as the source file, and overwrite
%   any previous files of the same name.
%
% \item Define a \cmd\TPJcopyright{} macro which will print a
%   copyright notice at the bottom of the first page.
%   E.g. \cmd\TPJcopyright\verb+{2005 TeX Users Group}+ will produce
%   ``\copyright2005 TeX Users Group'' in the page footer of the title
%   page.
%
% \item The page measures should work with both Letter and A4 paper
%   sizes.
% \end{enumerate}
%
% Revised again by Will Robertson, mid-2005, to implement some
% extra things. This snow-balled into the current version, a description
% of which here would be redundant.
%
% \clearpage
% \section{Implementation}
%
% The is fairly poorly documented, and the
% class has undergone a multitude of small changes over the TPJ issues
% 2005-4, 2006-1. It should now be fairly stable, and over time it's
% conceivable (but unlikely) that the descriptions herein will be improved.
%
% \subsection{Base class and options}
%
% Use \LaTeX's \pkg{article} class, but at a bigger default type size.
%
% KB: 12pt seems a little too big, 11pt seems a little too small.
% Implementing 11.5pt is not obvious.
%
% \changes{v0.3}{2004/01/03}{AO: Override the default option list of
%   \pkg{article.cls}}
%
% If the document instance calls for options that conflict with the
% following choices, then the document wins.  However our default
% option list is not the same as those of \pkg{article.cls}.
%    \begin{macrocode}
\let\ExecuteOptions@ltx\ExecuteOptions
\def\ExecuteOptions#1{%
 \ExecuteOptions@ltx{letterpaper,12pt,oneside,onecolumn,final}%
}%
\LoadClassWithOptions{article}
\let\ExecuteOptions\ExecuteOptions@ltx
%    \end{macrocode}
%
% \subsection{Metrics}
%
% Default leading (from \texttt{classes.dtx}) for 11pt is 13.6pt
% leading, for 12pt is 14.5pt.  We want more---this factor gives us
% 12pt type on 15.5pt leading.
%    \begin{macrocode}
\linespread{1.069}
%    \end{macrocode}
% 
% Change the text width to something that works for both A4 and
% Letter paper, as well as possible.
%
% xx The vertical dimensions need to be changed as well, perhaps
% for a 9in text height, taking account of the headline and
% footline.
%    \begin{macrocode}
\setlength\textwidth{432pt}
\setlength\oddsidemargin{18pt}% xx depend on letter/a4
\setlength\evensidemargin{18pt}
%    \end{macrocode}
%
% \subsection{Package loading}
%
% Palatino, including math (sc option for true small caps, not in TL
% 2003).  Try for \pkg{mathpazo}; if not available use \pkg{palatino}.
%
% Enable pdf\TeX's margin kerning, if available, but \emph{not} font expansion,
% which increases the size and complexity of the resultant PDF. This side-effect
% may be deemed negligible in the future.
%
% \changes{v0.3}{2004/01/03}{AO: rewrite using \cs{IfFileExists} idiom.}
% \changes{v0.4e}{2005/08/22}{WR: requires the textcomp package}
% \changes{v0.4g}{2005/11/04}{WR: use \pkg{microtype}, if available}
% \changes{v0.4l}{2006/08/14}{WR: use LM fonts if available, with T1 encoding}
%
% The \pkg{textcomp} package is loaded in order to provide a nice looking copyright logo, amongst other things.
%
%    \begin{macrocode}
\IfFileExists{lmodern.sty}{%
  \RequirePackage{lmodern}
  \usepackage[T1]{fontenc}}{}
\IfFileExists{mathpazo.sty}
             {\RequirePackage[sc]{mathpazo}}
             {\renewcommand\rmdefault{ppl}}
\IfFileExists{microtype.sty}{%
  \RequirePackage[protrusion=true,expansion=false]{microtype}}{}
\RequirePackage{textcomp}             
%    \end{macrocode}
% \pkg{hyperref} is used for creating live hyperlinks, as well as
% providing \cmd\url\ for typesetting URLs easily. All hyperlinks
% are coloured in a dark shade of blue.
%    \begin{macrocode}
\RequirePackage{color,hyperref,graphicx}
\definecolor{linkcolour}{rgb}{0,0.2,0.6}
\hypersetup{colorlinks,breaklinks,
            linkcolor=linkcolour,citecolor=linkcolour,
            filecolor=linkcolour, urlcolor=linkcolour}
%    \end{macrocode}
% \TODO{update this to use the successor to the switcheml package}
% If the \pkg{switcheml} package is installed in the author's
% system, use it to obfuscate their email address by default. Otherwise, just
% use a hyperlink. The commands to do this are defined in a later section.
%
%
% An author may specify \cmd\hyperlinkemail\ explicitly
% should they not care to obfuscate their email address even with the \pkg{switcheml}
% package installed.
%    \begin{macrocode}
\IfFileExists{switcheml.sty}
             {\RequirePackage{switcheml}
              \AtBeginDocument{\@ifx@undefined{\typesetemail}{\obfuscateemail}{}}}
             {\AtBeginDocument{\@ifx@undefined{\typesetemail}{\hyperlinkemail}{}}}
%    \end{macrocode}
%
%
% \subsection{Amendments from \pkg{article}}
%
% \begin{macro}{\maketitle}
% Printing the date of the last \TeX\ run in the title block does
% not seem warranted---if someone reprocesses the document with no
% changes, we wouldn't want the date to change.
%
% xx use rcs.sty or something?
%
% xx include bibtex id?
%
% \changes{v0.3}{2004/01/03}{AO: reproduce entire definition from
%   \texttt{article.cls}, with modifications.}
% \changes{v0.3}{2004/01/03}{AO: \cmd\thispagestyle{titlepage}. Do
%   not empty out \cmd\@author, \cmd\@title, etc.}
% \changes{v0.4b}{2005/06/26}{WR: removed some twocolumn conditional code.}
% \changes{v0.4b}{2005/06/26}{WR: added check for an abstract}
%    \begin{macrocode}
\renewcommand\maketitle{\par
  \iftpj@noabstract\else
    \@ifx@undefined{\tpj@info@\string\abstract}
      {\ClassError{pracjourn}
        {Please specify an \string\abstract\space before \string\maketitle}
        {It is a PracTeX Journal requirement to include an abstract.   \MessageBreak 
                                                                       \MessageBreak
         If you have exceptional reasons for not having one in this    \MessageBreak
         article, write \string\noabstract\space somewhere before \string\maketitle.}}{}
  \fi
  \begingroup
    \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
    \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
    \long\def\@makefntext##1{\parindent 1em\noindent
            \hb@xt@1.8em{%
                \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
    \newpage
    \global\@topnum\z@   % Prevents figures from going at top of page.
    \@maketitle
    \thispagestyle{titlepage}\@thanks
  \endgroup
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@maketitle\relax
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}%
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\@maketitle}
%
% \changes{v0.4a}{2005/06/13}{WR: various changes to accommodate extras.}
%    \begin{macrocode}
\def\@maketitle{%
  \newpage
  \null
  \write@ID@aux\read@issue
  \begin{flushleft}
    \let\footnote\thanks
    \begingroup\LARGE \@title  \par\endgroup
    \vspace{2ex}%
    \begingroup\large \@author \par\endgroup
  \end{flushleft}
%    \end{macrocode}
% This is where the extra author information is typeset. As various
% pieces of information are defined, they fill up the \cmd{\tpj@optional@author@info}
% macro, which is subsequently used here as per the definition of the author.
%    \begin{macrocode}
  \tpj@optional@author@info
  \iftpj@noabstract\else
    \vspace{2ex}%
    \tpj@info@container{\abstractname}{\abstract}
  \fi}
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Formatting changes}
% \begin{macro}{\section}
% \begin{macro}{\subsection}
% \begin{macro}{\subsubsection}
% \begin{macro}{\paragraph}
% \begin{macro}{\subparagraph}
% Remove bold from the all the section headings, just for something a
% little different. This is verbatim from \texttt{article.cls} with a
% bunch of \cmd\bfseries's omitted. \TODO{just use titlesec instead}
%    \begin{macrocode}
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                     {-3.5ex \@plus -1ex \@minus -.2ex}%
                                     {2.3ex \@plus.2ex}%
                                     {\normalfont\Large\raggedright}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\large\raggedright}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\raggedright}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                     {3.25ex \@plus1ex \@minus.2ex}%
                                     {-1em}%
                                     {\normalfont\normalsize\itshape}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
                                     {3.25ex \@plus1ex \@minus .2ex}%
                                     {-1em}%
                                     {\normalfont\normalsize\itshape}}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
% \changes{v0.4i}{2006/01/19}{Added \cs{raggedright} to section headings.}
% \end{macro}
%
% \paragraph{Lists}
% \begin{environment}{itemize}
% \begin{environment}{enumerate}
% \begin{environment}{description}
% \TODO{just use enumitem instead}
% Decrease the amount of vertical space between items in the list environments. To do this, save the old environment macros under new names, and then change the `real' environments to call the originals plus some space-adjusting parameters.
%
%
% Note that description lists shouldn't contain more than on paragraph.
%    \begin{macrocode}
\let\tpj@itemize\itemize     
\let\tpj@enditemize\enditemize 
\let\tpj@enum\enumerate     
\let\tpj@endenum\endenumerate 
\let\tpj@desc\description     
\let\tpj@enddesc\enddescription 
\renewenvironment{itemize}
  {\tpj@itemize\parskip0pt}{\tpj@enditemize}
\renewenvironment{enumerate}
  {\tpj@enum\parskip0pt}{\tpj@endenum}
\renewenvironment{description}
  {\tpj@desc\parskip0pt\parindent1.8em}{\tpj@enddesc}
%    \end{macrocode}
% \changes{v0.4g}{2006/01/05}{Space removed between list items.}
% \end{environment}
% \end{environment}
% \end{environment}
% \begin{environment}{itemise}
% Provide an environment with the correct spelling of `itemize'.
%    \begin{macrocode}
\let\itemise\itemize     
\let\enditemise\enditemize   
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\labelitemi(...)}
% Get rid of the nasty blob that is the \cmd\textbullet, and replace
% it with more unobtrusive dashes.
%    \begin{macrocode}
\renewcommand\labelitemi{\normalfont\bfseries\textendash}
\renewcommand\labelitemii{\normalfont\bfseries\textperiodcentered}
%    \end{macrocode}
% \changes{v0.4g}{2006/01/05}{Itemise bullets changed.}
% \end{macro}
%
% \begin{macro}{\descriptionlabel}
% Change the description label to italics instead of bold.
%    \begin{macrocode}
\renewcommand*\descriptionlabel[1]{\hspace\labelsep
                                \normalfont\itshape #1}
%    \end{macrocode}
% \end{macro}
%
% \paragraph{Footnotes}
% Here we change the footnote formatting a little bit from the default. 
% \begin{macro}{\@makefntext}
% Make the footnote number at the bottom of the page not a superscript (recommended by Bringhurst, if you're curious---the superscript is there originally to get the number out of the way, but that's no longer needed when you're labelling the note with the number).
%    \begin{macrocode}
\def\@makefntext#1{%
  \parindent 0em\relax
  \makebox[1.5em][l]{\normalfont\footnotesize\@thefnmark.}#1}
%    \end{macrocode}
% \changes{v0.4f}{2005/10/06}{WR: Removed the footnote superscript.}
% \changes{v0.4g}{2005/11/01}{WR: Added a period after the footnote number.}
% \changes{v0.4l}{2006/08/05}{WR: Fixed number \& text size difference. Oops. Removed \cmd\strut\ to allow \textsf{bigfoot} compatibility.}
% \end{macro}  
%
% \subsection{TPJ additions}
%
% \subsubsection{Boolean logic}
%
% \begin{macro}{\@ifx@empty}
% \begin{macro}{\@ifx@undefined}
% \begin{macro}{\@ifeof}
%   The following three procedures implement part of the boolean logic
%   facility, an expansion-only calculating engine.
%    \begin{macrocode}
\def\@ifx@empty#1{% Implicit #2#3
  \ifx#1\@empty
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi}%
\def\@ifx@undefined#1{% Implicit #2#3
  \ifx#1\@undefined
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi}%
\def\@ifeof#1{% Implicit #2#3
 \ifeof#1
   \expandafter\@firstoftwo
 \else
   \expandafter\@secondoftwo
 \fi}%
\def\boolean@true#1{\let#1\@firstoftwo}%
\def\boolean@false#1{\let#1\@secondoftwo}%
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{Titlepage pagestyle}
%
% \begin{macro}{\ps@titlepage}
% The \cmd{\ps@titlepage} procedure effects a page style
% called \texttt{titlepage}, which applies only to the title page.
% The \cmd{\titlepage@head} procedure sets type in the page header,
% \cmd{\titlepage@foot} in the page footer.
%
% \changes{v0.3}{2004/01/03}{AO: add page header and footer to title page} 
%    \begin{macrocode}
\def\ps@titlepage{%
  \def\@oddhead{\titlepage@head\hfil}%
  \let\@evenhead\@oddhead
  \def\@oddfoot{\hfil\titlepage@foot}%
  \let\@evenfoot\@oddfoot}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\titlepage@head}
%
% This is the text block before the article title. Changes depending
% on the production stage.
%
% \changes{v0.4b}{2005/06/26}{WR: More conditional text.}
% \changes{v0.4b}{2005/06/26}{WR: Added hyperref link to email article
%   comments for both reviewers and readers.}
% \changes{v0.4c}{2005/06/27}{WR: Tweaked conditionals; revision date is important even after publication!}
% \changes{v0.4c}{2005/06/27}{WR: Added error check for \cmd\TPJrevision\ defined without \cmd\TPJissue.}
% \changes{v0.4d}{2005/07/17}{WR: Make the header \cmd\small.}
% \changes{v0.4e}{2005/07/17}{WR: Removed email comments links.}
% \changes{v0.4k}{2006/02/20}{WR: Simplified \& made smaller.}
%    \begin{macrocode}
\def\titlepage@head{\footnotesize
  \parbox{\linewidth}{%
    \@ifx@empty\@TPJissue{For submission to \TPJ}{\@TPJissue}\par
    \@ifx@empty\@TPJissue
       {\@ifx@empty\@TPJrevision{Draft of \today}{Article revision \@TPJrevision}}%
       {\@ifx@empty\@TPJrevision
          {\ClassError{pracjourn}
            {\string\TPJrevision\space must be defined if 
             \string\TPJissue\space is also}
            {It is a requirement for PracTeX Journal articles to contain\MessageBreak
             revision information for version tracking. Please input this\MessageBreak
             information, or omit \protect\TPJissue.}}
          {Article revision \@TPJrevision}}}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\titlepage@foot}
% To typeset the optional copyright declaration by the author.
%
% \changes{v0.4d}{2005/07/17}{WR: Removed \cmd\copyright\ from the copyright 
%   notice and put the whole thing in a lowered \cmd\vbox\ to allow multi-line declarations.}
% \changes{v0.4k}{2006/02/20}{WR: Made smaller.}
%    \begin{macrocode}
\def\titlepage@foot{%
  \vtop{\raggedleft\footnotesize\@TPJcopyright}}%
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
% Better float parameters: (from the TeX FAQ)
\renewcommand{\topfraction}{.85}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.15}
\renewcommand{\floatpagefraction}{.66}
\renewcommand{\dbltopfraction}{.66}
\renewcommand{\dblfloatpagefraction}{.66}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}
%    \end{macrocode}
%
% \subsubsection{Additional author/article information}
%
% \begin{macro}{\addinfo}
%
% This command defines a new block of information to be typeset
% in the title block of the document. For every new item, a new
% \cmd{\tpj@info@container} is appended to \cmd{\tpj@optional@author@info}, which
% is called in \cmd{\@maketitle}.
%
%    \begin{macrocode}
\newcommand\addinfo[2][]{%
  \def\@tempa{\new@addinfo{#1}{#2}}%
  \lowercase{\expandafter\@tempa\expandafter{\csname#2\endcsname}}}
\newcommand\new@addinfo[3]{%
  \tpj@define@info@block{#3}%
  \expandafter\newcommand
    \csname\expandafter\@gobble\string#3name\endcsname{#2}%
  \g@addto@macro\tpj@optional@author@info{%
    \tpj@info@container[#1]{\csname\expandafter\@gobble\string#3name\endcsname}{#3}}}
%    \end{macrocode}
% \changes{v0.4d}{2005/07/30}{WR: Name change to user-space.}
% \end{macro}
%
% \begin{macro}{\newinfo}
% E.g., |\newinfo\resume[\resfont]{R\'esum\'e}|
%    \begin{macrocode}
\newcommand\newinfo[1]{%
  \@ifnextchar[{\@newinfo{#1}}{\@newinfo{#1}[]}}
\def\@newinfo#1[#2]#3{%
  \tpj@define@info@block{#1}%
  \expandafter\newcommand
    \csname\expandafter\@gobble\string#1name\endcsname{#3}%
  \g@addto@macro\tpj@optional@author@info{%
    \tpj@info@container[#2]{%
      \csname\expandafter\@gobble\string#1name\endcsname}{#1}}}
%    \end{macrocode}
% \changes{v0.4n}{2007/08/13}{WR: A better \cmd\addinfo}
% \end{macro}
%
% \begin{macro}{\addinfospace}
% Adds some space after the previous item in the frontmatter.
%    \begin{macrocode}
\newcommand\addinfospace[1]{\g@addto@macro\tpj@optional@author@info{\vspace{#1}}}  
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tpj@define@info@block}
%   \changes{v0.4a}{2005/06/13}{WR: Implemented for new \cmd{\@maketitle}.}
% This macro actually does the work of \cmd\addinfo. 
% It takes the name of a piece of info to be typeset in the
% title block of the article.
%
% This is much easier (but uglier, in hindsight |:(| ) than
% |\begin{abstract}...\end{abstract}| contortions
% (cf. \texttt{ltugboat.cls}).
%    \begin{macrocode}
\newcommand\tpj@define@info@block[1]{%
  \newcommand#1[1]{\expandafter\def\csname tpj@info@\string#1\endcsname{##1}}}
%    \end{macrocode}
% \changes{v0.4n}{2007/08/13}{Change for better info blocks}
% \end{macro}
%
% \begin{macro}{\clearinfo}
% If the \cmd{\tpj@optional@author@info} macro needs to be cleared for some reason,\footnotemark
% the \cmd\clearinfo\ command will come quite in handy. This command is also used to
% initialise the macro in question.
% \footnotetext{The only reason I can think of to do this is to re-arrange the order of
%   the items in the title block of the article.}
% \changes{v0.4d}{2005/07/30}{WR: Implemented to allow for re-definition of standard information blocks.}
%    \begin{macrocode}
\newcommand\clearinfo{\let\tpj@optional@author@info\@empty}
\clearinfo
%    \end{macrocode}
% \end{macro}
%
% \paragraph{Optional fields}
%
% These are the default information blocks.
% \cmd\typesetemail\ is defined by one of either \cmd\hyperlinkemail\ or \cmd\obfuscateemail.
%
%    \begin{macrocode}
\addinfo[\typesetemail]{Email}
\addinfo[\url]{Website}
\addinfo[\linespread{0.9}\selectfont]{Address}
%    \end{macrocode}
%
% \paragraph{Abstract} We bypass \cmd\addinfo\ 
% so that the abstract info block is not added 
% to the \cmd{\tpj@optional@author@info} macro.
%
% The abstract block itself is called directly in \cmd{\@maketitle}.
%
%    \begin{macrocode}
\let\abstract\relax
\tpj@define@info@block\abstract
\def\abstractname{Abstract}
%    \end{macrocode}
%
% \begin{macro}{\noabstract}
% However, the abstract may indeed be suppressed if that is the author's wish.
% \changes{v0.4d}{2005/07/25}{WR: Implemented to turn off the abstract.}
%    \begin{macrocode}
\newif\iftpj@noabstract
\newcommand\noabstract{\tpj@noabstracttrue}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\endabstract}
% If an abstract environment is used, give an error. Maybe I should
% just support the environment, instead.
%    \begin{macrocode}
\def\endabstract{%
  \ClassError{pracjourn}
   {Please input the abstract with \string\abstract{...}, before \string\begin{document}}
   {Instead of the \string\begin{abstract}...\string\end{abstract} \MessageBreak 
    environment, use \string\abstract{...}. Paragraphs are allowed!\MessageBreak 
                                                                   \MessageBreak 
    Because the abstract is typeset with the title block,          \MessageBreak 
    it must be input before the \string\begin{document}\space command.}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\TPJissue}
% \changes{v0.4k}{2006/02/20}{WR: More user-friendly.}
% \begin{macro}{\TPJrevision}
% \changes{v0.4k}{2006/02/20}{WR: More user-friendly.}
% \begin{macro}{\TPJcopyright}
%
% \changes{v0.3}{2004/01/03}{AO: add commands specifying issue,
%   revision, copyright.} 
%
% The three user-level commands
% \cmd\TPJissue, \cmd\TPJrevision, and \cmd\TPJcopyright{} specify
% the issue, the revision, and the copyright information of the
% document.
%
% Since these commands are like \cmd\author{} and \cmd\title, one
% might wish to disable them upon executing the \cmd\titlepage{}
% procedure. But we do not.
%
% If the document has a \cmd\TPJrevision{} statement, the title page
% header contains words to that effect, otherwise it bears the current
% date.
%
% If the document lacks a \cmd\TPJcopyright{} statement, the title
% page footer contains nothing.
%    \begin{macrocode}
\newcommand{\TPJissue}[2]{\gdef\@TPJissue{\TPJ, #1, No.\,#2}}%
\newcommand{\TPJrevision}[3]{\gdef\@TPJrevision{#1/#2/#3}}%
\newcommand{\TPJcopyright}[1]{\gdef\@TPJcopyright{#1}}%
\let\@TPJissue\@empty
\let\@TPJrevision\@empty
\let\@TPJcopyright\@empty
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\license}
%
% For consistency with the other user commands of this class, \cmd\license\
% is defined as an alias of \cmd\TPJcopyright.
%
% \changes{v0.4d}{2005/07/30}{WR: name change from \cmd\TPJcopyright\
%   for consistency with other commands.}
%
%    \begin{macrocode}
\let\license\TPJcopyright
%    \end{macrocode}
%
% \end{macro}
%
% \begin{macro}{\tpj@info@container}
% This is the macro that typesets the optional author info for
% fields defined as above. It splits it all up in minipages, in a
% smaller font and with more compressed leading than the main
% document text.\footnote{\LaTeX's \cmd\@hangfrom\ (or whatever it is) could well
% have been much easier.} It takes the name of the info as a mandatory
% argument, which is used to typeset the info label as well as
% retrieve the actual data from the |\tpj@info@#3| macro (see
% \cmd{\addinfo}).
%
% An optional argument is used as a hook to typeset the info data in
% the equivalent form |#1{#2}|.
%
% For example, to typeset the info defined by the author in the
% \cmd\abstract\ (recall, this is set up due to a corresponding
% |\addinfo{Abstract}{\abstract}|---see above), input
% |\tpj@info@container{Abstract}|. To typeset it, say, in italics,
% it would be possible to write
% |\tpj@info@container[\textit]{Abstract}|.
%
% \changes{v0.4a}{2005/06/13}{WR: Implemented for new \cmd\@maketitle.}
% \changes{v0.4d}{2005/06/29}{WR: Warn if a title block command is used after \cmd\maketitle.}
%
%    \begin{macrocode}
\newcommand\tpj@info@container[3][]{%
%    \end{macrocode}
% After \cmd\maketitle, redefine the info command to return an error.
%    \begin{macrocode}
  \gdef#3{\ClassError{pracjourn}{#2 must be defined BEFORE \string\maketitle}{}}
%    \end{macrocode}
% Now, we typeset the info block, but only if the info has actually been specified by the author.
%    \begin{macrocode}
  \expandafter\ifx\csname tpj@info@\string#3\endcsname\relax\else
    \noindent\small
%    \end{macrocode}
% On the left, right-aligned sans serif item label, e.g., `Abstract':
%    \begin{macrocode}
    \begin{minipage}[t]{0.15\textwidth}
      \noindent\hfill\sffamily#2
    \end{minipage}\hfill
%    \end{macrocode}
% On the right, the content, defined by, e.g., \cmd\abstract:
%    \begin{macrocode}
    \begin{minipage}[t]{0.825\textwidth}
      \linespread{1.0}\selectfont
      \setlength\parindent{1.5em}%
      \noindent\ignorespaces
      \expandafter#1\expandafter{\csname tpj@info@\string#3\endcsname}
    \end{minipage}\par
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Email \& hyperlink macros}
%
% \begin{macro}{\typesetemail}
%
% We define the macro \cmd\typesetemail\ to be used for self-explanatory purposes.
% The class contains methods to define it in one of two ways.
%
% \begin{macro}{\hyperlinkemail}
% 
% The \cmd\hyperlinkemail\ command defines \cmd\typesetemail\ to use the \pkg{hyperref}
% package's facilities to create a hyperlink email address in the output document.
%
% \begin{macro}{\obfuscateemail}
% 
% The \cmd\obfuscateemail\ command defines \cmd\typesetemail\ to use the \pkg{switcheml}
% package's facilities to create a machine-obfuscated email address in the output 
% document.\footnote{The \pkg{switcheml} package defines, among a couple of other things, a macro for
% typesetting email addresses that obfuscates their representation in the PDF file,
% ensuring protection against harvesting email addresses from web-public
% PDF documents.}
%
%    \begin{macrocode}
\newcommand\obfuscateemail{%
  \def\typesetemail##1{\ttfamily\switchemail{##1}}}
\newcommand\hyperlinkemail{%
  \def\typesetemail##1{\ttfamily\tpj@compose@mailto{##1}{Re: PracTeX Journal article}{##1}}}
%    \end{macrocode}  
% \end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\tpj@compose@mailto}
%
% This macro takes three arguments to typeset a mailto email
% hyperlink. The |#1| takes the email address, |#2| takes the
% default subject of the email, and |#3| is the text to appear in
% the output as the hyperlink.
%
% All spaces in the hyperlink source are converted to |%20| to
% accommodate Mac~OS~X's PDF reader; this isn't necessary for Adobe
% Reader. Oh well.
%
% \changes{v0.4b}{2005/06/26}{WR: Implemented; creates a workable mailto
%   hyperlink.}
%
%    \begin{macrocode}
\newcommand\tpj@compose@mailto[3]{%
  \edef\@tempa{mailto:#1?subject=#2 }%
  \edef\@tempb{\expandafter\html@spaces\@tempa\@empty}%
  \href{\@tempb}{#3}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\html@spaces}
% \changes{v0.4b}{2005/06/25}{WR: Implemented to overcome the mailto
%   problems in Mac~OS~X's PDF reader.}  

% This macro takes a string and (hopefully) converts all spaces (or
% is it all whitespace?) to `\%20', creating a string that can be
% used for encoding the subject of the email comments hyperlink in
% \cmd{\titlepage@head}. Using \cmd\catcode, we remove the comment
% ability of the \verb|%| character, making it a normal letter.
% (This code was heavily influenced by the \LaTeX\ kernel's
% \cmd{\zap@space} command.)
%    \begin{macrocode}
\catcode`\%=11
\def\html@spaces#1 #2{#1%20\ifx#2\@empty\else\expandafter\html@spaces\fi#2} 
\catcode`\%=14
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{User commands}
% 
% \begin{macro}{\note}
% \begin{macro}{\dash}
% \begin{macro}{\ctanfile}
% \begin{macro}{\ctanloc}
% Fairly straightforward.
%    \begin{macrocode}
\newcommand\note[1]{\unskip\footnote{#1}}
\DeclareRobustCommand\dash{%
  \unskip\nobreak\thinspace\textemdash\thinspace\ignorespaces}
\pdfstringdefDisableCommands{\renewcommand{\dash}{ - }}
\newcommand\ctanfile[1]{%
  \href{http://www.ctan.org/get?fn=/#1}
       {\path{CTAN:#1}}}
\newcommand\ctanloc[1]{%
  \href{http://www.ctan.org/tex-archive/#1}
       {\path{CTAN:#1}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsubsection{Logos}
%
% \begin{macro}{\tpf@deflogo}
% Wrapper for both \cmd\DeclareRobustCommand\ and \cmd\pdfstringdefDisableCommand.
%    \begin{macrocode}
\newcommand\tpj@deflogo{\@dblarg\tpj@@deflogo}
\newcommand\tpj@@deflogo[3][\@nil]{%
  \expandafter\DeclareRobustCommand\csname#2\endcsname{#3}%
  \pdfstringdefDisableCommands{%
    \expandafter\def\csname#2\endcsname{#1}}}
%    \end{macrocode}
% \changes{v0.4m}{2006/11/19}{WR: Implemented to improve logo/hyperref handling.}
% \end{macro}
%
% \changes{v0.4a}{2005/06/05}{WR: Incorporated code from \pkg{texnames}
%   and \pkg{mflogo}.}
%
% The \pkg{texnames} and \pkg{mflogo} packages have been incorporated
% into the class in order to remove the dependence on external
% packages and to tune the logos for Palatino. First, here are the
% relevant parts\footnote{No-one still refers to AMSTeX and SLITeX and
%   so on, right?} of \texttt{texnames.sty}, v1.10, tuned for Palatino
% and adapted to use \cs{textsc} where appropriate:
%    \begin{macrocode}
\tpj@deflogo{TeX}{T\kern-.15em\lower.5ex\hbox{E}\kern-.07em X\spacefactor1000\relax}
\tpj@deflogo{LaTeX}{L\kern-.32em\raise.37ex\hbox{\scalebox{0.76}{A}}\kern-.15em\TeX}
\tpj@deflogo{LaTeXe}{\LaTeX2$_{\textstyle\varepsilon}$}
\tpj@deflogo{BibTeX}{B{\textsc i\kern-.025em\textsc b}\kern-.08em\TeX}
%    \end{macrocode}
% And now \texttt{mflogo.sty}, unchanged in its entirety:
%    \begin{macrocode}
\DeclareRobustCommand\logofamily{%
  \not@math@alphabet\logofamily\relax
  \fontencoding{U}\fontfamily{logo}\selectfont}
\DeclareTextFontCommand{\textlogo}{\logofamily}
\tpj@deflogo[MetaFont]{MF}{\textlogo{META}\@dischyph\textlogo{FONT}\@}
\tpj@deflogo[MetaPost]{MP}{\textlogo{META}\@dischyph\textlogo{POST}\@}
%    \end{macrocode}
% Now some new definitions. Despite the fact that it makes no
% difference with the main font used for this class, I define
% \cs{pdfTeX} with some italic correction to set a good
% precedent. Compare Computer Modern with and without:
% {\usefont{OT1}{cmr}{m}{n}pdf\/\TeX}
% vs.~{\usefont{OT1}{cmr}{m}{n}pdf\TeX}; I find the former more
% attractive because the ascender of the `f' doesn't collide.
%    \begin{macrocode}
\tpj@deflogo{ConTeXt}{C\kern-.03em on\-\kern-.10em\TeX\kern-0.04em t}%
\tpj@deflogo{pdfTeX}{pdf\/\TeX}
\tpj@deflogo{pdfLaTeX}{pdf\/\LaTeX}
\newcommand\PS{PostScript}
\tpj@deflogo{PracTeX}{Prac\kern-0.07em\TeX}
\newcommand\TPJ{The \PracTeX\ Journal}
\tpj@deflogo{XeTeX}{%
      X\lower.5ex\hbox{\kern-.07em\reflectbox{E}}%
      \kern-.15em\TeX}
\tpj@deflogo{ExTeX}{\textrm{\relax
 \ensuremath{\textstyle\varepsilon_{\kern-0.15em\mathcal{X}}}\relax
 \kern-.15em\TeX}}
%    \end{macrocode}
% \changes{v0.4j}{2006/02/09}{Added \cmd\XeTeX\ logo.}
% \changes{v0.4k}{2006/02/09}{Added \cmd\ExTeX\ logo.}
%
% \subsubsection{Version tracking}
%
% \begin{macro}{\write@ID@aux}
% \changes{v0.3}{2004/01/03}{AO: add ID file}
% Establish an auxiliary file, \verb+_id.tex+, for TPJ tracking information.
% 
%    \begin{macrocode}
\def\write@ID@aux{%
 \@ifx@empty\@TPJrevision{}{%
  \begingroup
   \let\thanks\@gobble
   \immediate\openout\ID@aux _rev.tex
%  \immediate\write\ID@aux{\@percentchar\space 
%    This file generated by the pracjourn document class}%
   \immediate\write\ID@aux{\@TPJrevision}%
   \immediate\closeout\ID@aux
  \endgroup
 }%
}%
\newwrite\ID@aux
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\read@iss@aux} 
%    \begin{macrocode}
\def\read@issue{%
 \openin\@inputcheck _iss.tex
 \@ifeof\@inputcheck{}
   {\ifx\@TPJissue\@empty\else
      \typeout{---------^^J
               pracjourn: \protect\TPJissue\space info overwritten due to _iss.tex file^^J
               ---------}
    \fi
    \read\@inputcheck to\@TPJissue
    \closein\@inputcheck
    \expandafter\parse@iss\@TPJissue\@nil}}
%    \end{macrocode}
% \changes{v0.3}{2004/01/03}{AO: read the "issue" file.}
% \changes{v0.4i}{2006/02/02}{WR: {\ttfamily\char`\_iss.tex} behaviour finally sorted out.}
% \end{macro}
%
% \begin{macro}{\parse@iss}
% \changes{v0.4k}{2006/02/20}{WR: Implemented for better article headers.}
%    \begin{macrocode}
\def\parse@iss TPJ #1 No #2, #3-#4-#5\@nil{%
  \@tempcnta#2\relax
  \protected@xdef\@TPJissue{\TPJ, #1, No.\,\the\@tempcnta}}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Miscellaneous}
%
% \begin{macro}{\set@pdfpage}
%   \changes{v0.3}{2004/01/03}{AO: add commands setting pdftex's page
%     metrics from LaTeX's} 
%
% The PDF\TeX{} parameters \cmd\pdfpagewidth\ and
% \cmd\pdfpageheight\ determine the
% CropBox/BleedBox/TrimBox/ArtBox. The procedure \cmd\setpdfpage{}
% sets them to the values of the \LaTeX{} \cmd\paperwidth{} and
% \cmd\paperheight.  If PDF\TeX{} is not the engine, nothing is
% done.
%
% We arrange for the procedure to be executed at Begin Document
% time.
%    \begin{macrocode}
\def\set@pdfpage{%
 \@ifx@undefined\pdfoutput{}{%
  \pdfpagewidth =\paperwidth
  \pdfpageheight=\paperheight
  \relax}}
\AtBeginDocument{\set@pdfpage}
%    \end{macrocode}
% \end{macro}
%
% \makeatother
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \Finale
\endinput
