%^^A* copyright
% \iffalse
%
%   This program is part of the Frankenstein bundle for LaTeX2e.
%
%   Copyright (C) 1995, 1996 Matt Swift <swift@bu.edu>
%
%   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., 675 Mass Ave, Cambridge, MA 02139, USA.
%
%      NOTE:  I am willing to specially license this code.
%             Please simply contact me with your proposal.
%
%^^A   NOTE:  \DocInput will start reading after this \fi:
% \fi  
%
%^^A* checks
%
%^^A NOTE:  The character table, with two %'s, will get written to all files.
%% \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         \~}
%
% \CheckSum{88}
%
%^^A** abstract
% \begin{abstract}
%   Inserts various hooks into block elements and footnotes.
% \end{abstract}
%
% \part{Discussion}
%
% \StopEventually{}
%
% \part{Implementation}
%
% \section{Version control}
%
%  \begin{macro}{\fileinfo}
%  \begin{macro}{\fileversion}
%  \begin{macro}{\filedate}
%  \begin{macro}{\docdate}
%  \begin{macro}{\PPOptArg}
% These definitions must be the first ones in the file.
%    \begin{macrocode}
\def\fileinfo{Block Control}
\def\fileversion{v1.0}
\def\filedate{1996/03/26}
\def\docdate{1996/03/26}
\edef\PPOptArg {%
  \filedate\space \fileversion\space \fileinfo
}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%  \end{macro}
%
% Stop right here if we're just loading the file's information, and don't want
% to load this code for typesetting its documentation (only makes sense for
% certain packages).  The |JuStLaAdInFoRmAtIoN| flag will be set by the
% documentation driver; the |DoXNeeDME| flag will be set in the
% \ext{dtx} file, and will appear above if it's set.
%    \begin{macrocode}
\makeatletter
\@ifundefined{JuStLoAdInFoRmAtIoN} {%
  }{% ELSE
  \@ifundefined{DoXNeeDME} {%
    }{% ELSE
    \UndefineCS\JuStLoAdInFoRmAtIoN
    \usepackage{blkcntrl}%
  }
  \makeatother
  \endinput
}
%    \end{macrocode}
%
% Now we check for \LaTeX2e and declare the package.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{blkcntrl}[\PPOptArg]
%    \end{macrocode}
%
% ^^A NOTE: We have to compensate for the above backslashes, which are not
% ^^A actually in the doctex file I work on.
%%
% \AddToCheckSum{26}
% 
% \makeatletter
%   \@ifundefined{DoXNeeDME} {} {\AddToCheckSum{2}}
% \makeatother
%
%
% \section{Requirements}
%
%    \begin{macrocode}
\RequirePackage{moredefs,relsize}
%    \end{macrocode}
%
% \section{General get-control hook hacks}
%
% \begin{macro}{\if@in@footnote@}
% \begin{macro}{\@in@footnote@true}
% \begin{macro}{\@in@footnote@false}
% \begin{macro}{\PreFootnote}
% \begin{macro}{\PreChunk}
% \begin{macro}{\PreQuote}
% \begin{macro}{\PreQuotation}
% \begin{macro}{\PreVerse}
% \begin{macro}{\@makefntext}
%   I think macros are much more convenient as hooks than tokens.  I use the
%   prefixes |Pre| or |Post|.
%   We want to add a hook to the usual definition here, to gain some control
%  over relative sizing in footnotes.
%    \begin{macrocode}
\defcommand\@makefntext [1] {%
  \setlength\parindent{\@ne em}%
  \noindent
  \hbox to 1.8em{\hss\@makefnmark}%
  {\PreFootnote #1}%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\newboolean{@in@footnote@}
\newcommand\PreFootnote {%
  \@in@footnote@true
}
\ReserveCS\PreChunk
\newcommand\PreQuote {%
  \PreChunk
}
\newcommand\PreQuotation {%
  \PreChunk
}
\newcommand\PreVerse {%
  \PreChunk
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% Additions to the above hooks should be made with \cs{\addto@macro}.
% Deletions should be accomplished by scoping.
%
% \begin{environment}{verse}
% \begin{environment}{quotation}
% \begin{environment}{quote}
%   These environments are the same for the standard document classes, and the
%   only change is to insert the above hooks.
%
%   The hook cannot be put into the second argument, which is called before the
%   paragraph preceding the environment has been ended (unless the environment
%   started a new one).  
%    \begin{macrocode}
\renewenvironment{verse}
               {\let\\\@centercr
               \relax\begin{list}{}{\setlength{\itemsep}{\z@}%
                        \setlength{\itemindent}{-1.5em}%
                        \setlength{\listparindent}{\itemindent}%
                        \setlength{\rightmargin}{\leftmargin}%
                        \addtolength{\leftmargin}{1.5em}}%
                \item[]\PreVerse\relax}
               {\end{list}}
\renewenvironment{quotation}
               {\begin{list}{}{\setlength{\listparindent}{1.5em}%
                        \setlength{\itemindent}{\listparindent}%
                        \setlength{\rightmargin}{\leftmargin}%
                        \setlength{\parsep}{\z@ \@plus\p@}}%
                \item[]\PreQuotation\relax}
               {\end{list}}
\renewenvironment{quote}
               {\begin{list}{}{\setlength{\rightmargin}{\leftmargin}}%
                \item[]\PreQuote\relax}
               {\end{list}}
%    \end{macrocode}
% \end{environment}
% \end{environment}
% \end{environment}
%
% \section{Some formatting that needs the extra control }
%
% ^^A FIX:  use new booleanoption commands
% \begin{macro}{\if@smallblocks@}
% \begin{macro}{\@smallblocks@true}
% \begin{macro}{\@smallblocks@false}
% \begin{macro}{\smallblocks}
%   \mbox{}
%    \begin{macrocode}
\newboolean{@smallblocks@}

\newcommand\smallblocks {%
  \@smallblocks@true
  \addto@macro\PreChunk {%
    \if@in@footnote@\else
      \relsize{-1}%
    \fi
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \Finale
