% \iffalse meta-comment
%
% Copyright (C) 1989--1993 by Frank Mittelbach, Rainer Schoepf.
% All rights reserved.
% 
% This file is part of the NFSS2 (New Font Selection Scheme) package.
% 
%  This package 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.
% 
% 
% IMPORTANT NOTICE:
% 
% For error reports in case of UNCHANGED versions see readme files.
% 
% Please do not request updates from us directly.  Distribution is
% done through Mail-Servers and TeX organizations.
% 
% You are not allowed to change this file.  You may however copy
% this file to a file with a different name and then change the copy
% if you obey the restrictions on file changes described in
% readme.mz.
% 
% You are allowed to distribute this file under the condition that
% it is distributed together with all files mentioned in readme.mz8.
% If you receive only some of these files from someone, complain!
% 
% You are NOT ALLOWED to distribute this file alone.  You are NOT
% ALLOWED to take money for the distribution or use of either this
% file or a changed version, except for a nominal charge for copying
% etc.
% \fi

\def\filename{beton}
\def\fileversion{v1.1 (TEST)}
\def\filedate{94/01/24}

%\iffalse
%
%% File `beton.dtx'.
%% Copyright (C) 1992--1994 Frank Jensen, all rights reserved.
%
% Please send error reports and suggestions for improvements to:
%
%                          Frank Jensen
%                          Aalborg University
%                          DK-9220 Aalborg \O
%                          Denmark
%               Internet:  <fj@iesd.auc.dk>
%
%\fi
%% \CheckSum{92}
%% \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         \~}
%%
%
% \def\eulername{euler}
% \def\concretename{concrete}
%
% \title{The \texttt{\filename} package}
% \author{Frank Jensen}
%
% \maketitle
%
% \MakeShortVerb\|
%
% \section{Introduction}
%
% The purpose of this package is to provide a setup so that documents
% using the package will automatically be typeset with the Concrete
% fonts designed by Don Knuth.
%
% This package is based on Knuth's macros for the book ``Concrete
% Mathematics''~\cite{concrete}.  Knuth's macros can be found through
% anonymous ftp to \texttt{labrea.stanford.edu}: look for the file
% \texttt{gkpmac.tex} in directory \texttt{pub/tex/local/lib}.  Also,
% the fonts can be found at that site: look in directory
% \texttt{pub/tex/local/cm}.
%
% The Concrete fonts look best with a larger value for |\baselineskip|
% than the value used with the Computer Modern fonts.  Therefore, this
% package makes some decisions about line spacing that override the
% values specified by the standard \LaTeX\ packages.  See
% Section~\ref{beton:baselineskip-settings} for further details.
%
% In \cite{concrete}, the margin contains numerous humorous notes,
% so-called `graffiti', contributed by the students that attended the
% course by Graham, Knuth, and Patashnik.  These graffiti are typeset
% in a nine point slanted condensed version of the Concrete fonts.
% The current version of the \texttt{\filename} package does not
% provide any commands to support such graffiti.  However, such
% commands could easily be provided, e.g., by changing the
% |\marginpar| command.
%
% The \texttt{\filename} package deals with the {\em text font\/}
% issues of~\cite{concrete}; i.e., it does not make any decisions
% about page layout (such as the height and width of the text area),
% font size, numbering scheme (e.g., \cite{concrete}~uses the page
% number for the numbering of tables [but not figures, since the book
% doesn't have any numbered illustrations]; use a separate package to
% get such a scheme), math fonts (use the \texttt{\eulername} package
% to get this distinctive part of the look of~\cite{concrete}), or the
% amount of space above and below displayed equations.  However, the
% \texttt{\filename} package does set up the following:
% \begin{itemize}
%    \item Concrete fonts for text
%	(Section~\ref{beton:font-definitions}).
%    \item Increased value for |\baselineskip|
%	(Section~\ref{beton:baselineskip-settings}); an option
%	(\texttt{standard-baselineskips}) is provided to turn this
%	feature off.
%    \item An option (\texttt{oldstyle-equation-numbers}) to request
%	`oldstyle' numerals for equation numbers
%	(Section~\ref{beton:equation-numbers}).
%    \item An option (\texttt{concrete-math}) to request `concrete'
%	math, if you insist (Section~\ref{beton:concrete-math}).
%    \item Some commands to `fine tune' the typography
%	(Section~\ref{beton:miscellany}).
% \end{itemize}
%
% Last, a note about the name of this package: ``beton'' is the danish
% word for the `hard' meaning of the english word ``concrete'' (and
% since there already exists a package of the name
% \texttt{\concretename} by Frank Mittelbach and Rainer Sch\"opf, I
% chose \texttt{\filename} for mnemonic reasons).
%
% \StopEventually{
% \begin{thebibliography}{1}
%    \bibitem{concrete}  {\sc R. L. Graham, D. E. Knuth, and O.
%    Patashnik}. {\it Concrete Mathematics}, Addison-Wesley, 1989.
% \end{thebibliography}
% }
%
% \section{Hello world}
%
% First, we announce the package.
%    \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{\filename}[\filedate\space\fileversion]
\typeout{Package: `\filename' \fileversion\space <\filedate> (FJ)}
%    \end{macrocode}
%
% \section{Font definitions}\label{beton:font-definitions}
%
% The Concrete family comes in medium normal, medium italic, medium
% slanted, and medium caps and small caps.  The \texttt{.fd} file for
% this family is defined in the \texttt{cmfonts.fdd} file.
%
% There are no bold variants of the Concrete fonts.  However,
% in~\cite{concrete}, Knuth chose the bold extended font from the
% Computer Modern (Roman) family to go with the Concrete fonts.  The
% \texttt{.fd} file for the Concrete fonts does {\em not\/} perform
% this substitution; if you want this substitution, you have to do it
% yourself (the procedure is described below).
%
% Instead of the CMR bold extended font, I recommend the CM Sans Serif
% demibold condensed font.\footnote{In 1992, I was involved in the
% production of a math book using Concrete for text and Euler for
% math; in that book, all headings were set in CM Sans Serif demibold
% condensed.  (The layout and the choice of fonts were decided by a
% reputable danish designer.)}  Simply put the following lines in the
% preamble or in a package file:
% $$\vbox
%{\hbox{|\DeclareFontShape\encodingdefault{ccr}{bx}{n}{<->sub*cmss/sbc/n}{}|}
% \hbox{|\DeclareFontShape\encodingdefault{ccr}{bx}{it}{<->sub*cmss/sbc/it}{}|}
% \hbox{|\DeclareFontShape\encodingdefault{ccr}{bx}{sl}{<->sub*cmss/sbc/sl}{}|}
%\hbox{|\DeclareFontShape\encodingdefault{ccr}{bx}{sc}{<->sub*cmss/sbc/sc}{}|}}
% $$
% Or, alternatively, use the medium weight Concrete (Roman) fonts for
% headings (and other places where bold is commonly used); this is the
% default.  In my opinion, both alternatives are better than CMR bold
% extended.
%
% There is also a math italic version of the Concrete fonts; the
% \texttt{.fd} file for this is also defined in \texttt{cmfonts.fdd}.
%
% To typeset graffiti, special nine point condensed variants of the
% Concrete slanted and the Concrete math italic fonts were designed.
%
% We set the default family for |\rm| to Concrete Roman:
%    \begin{macrocode}
\def\rmdefault{ccr}
%    \end{macrocode}
% \section{Baselineskip settings}\label{beton:baselineskip-settings}
%
% Knuth chose a high value for |\baselineskip| to compensate for the
% relatively heavy (compared to Computer Modern) weight of the
% Concrete fonts.
%
% \begin{macro}{\beton@baselineskip@table}
% We specify the desired value for |\baselineskip| at various point
% sizes in a style similar to font definitions.  Here is a tentative
% specification for the most important sizes of the Concrete fonts:
%    \begin{macrocode}
\def\beton@baselineskip@table
   {<\@viiipt>10<\@ixpt>11.5<\@xpt>13<\@xipt>14.5<\@xiipt>16}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@setfontsize}
% All standard \LaTeX\ classes and packages use the |\@setfontsize|
% macro to specify point size and baselineskip.  We modify this macro
% to check |\beton@baselineskip@table| for an alternative baselineskip
% value.
%    \begin{macrocode}
\let\beton@old@setfontsize=\@setfontsize
\def\@setfontsize#1#2#3%   #2 is the font size; #3 is the baselineskip value
   {\edef\@tempa{\def\noexpand\@tempb####1<#2}%
    \@tempa>##2<##3\@nil{\def\beton@baselineskip@value{##2}}%
    \edef\@tempa{\noexpand\@tempb\beton@baselineskip@table<#2}%
    \@tempa><\@nil
    \ifx\beton@baselineskip@value\@empty
       \def\beton@baselineskip@value{#3}%
    \fi
    \beton@old@setfontsize{#1}{#2}\beton@baselineskip@value}
%    \end{macrocode}
% (Implementation note: Perhaps we should use the |\every@size| token
% register?)
% \end{macro}
% The |\baselineskip| values specified in the above table should be
% appropriate for most purposes, i.e., for one-column material in the
% normal article/report/book formats.  However, it is usually
% desirable to use a smaller vaue for |\baselineskip| in two-column
% material.  We therefore provide the option
% \texttt{standard-baselineskips} to turn off the above automatic
% mechanism for baselineskip settings.
%    \begin{macrocode}
\DeclareOption{standard-baselineskips}
   {\let\@setfontsize=\beton@old@setfontsize}
%    \end{macrocode}
%
% \section{Equation numbers}\label{beton:equation-numbers}
%
% \begin{macro}{\theequation}\begin{macro}{\beton@oldstyle}
% In~\cite{concrete}, equation numbers are typeset with oldstyle
% numerals (from the math italic font).  You have to specify the
% \texttt{oldstyle-equation-numbers} option to get them.
%    \begin{macrocode}
\DeclareOption{oldstyle-equation-numbers}
   {\@ifundefined{chapter}
       {\def\theequation{{\protect\beton@oldstyle\arabic{equation}}}}
       {\def\theequation{{\protect\beton@oldstyle\thechapter}.%
                         {\protect\beton@oldstyle\arabic{equation}}}}}
\def\beton@oldstyle{\usefont{OML}{ccm}{m}{it}}
%    \end{macrocode}
% Here, we assume that |\thechapter| generates a number ({\em note\/}
% that in appendices, we will get math italic letters as `chapter
% numbers'!).  We also assume the standard format for equation
% numbers.
%
% The |\beton@oldstyle| macro is also used in the definition of
% the~|\t| accent macro (Section~\ref{beton:miscellany}).
% \end{macro}\end{macro}
%
% \section{Concrete math}\label{beton:concrete-math}
%
% The Concrete fonts were designed to blend well with the Euler math
% fonts, so I recommend the \texttt{\eulername} package to go with the
% \texttt{\filename} package.  If, however, for some reason, you wish
% to use the few Concrete fonts available for math, you can specify
% the \texttt{concrete-math} option for the \texttt{\filename} package. 
%
% The \texttt{concrete-math} option selects Concrete Roman for math
% symbol font `operators' and Concrete math italic for math symbol
% font `letters'.  No bold versions and no `symbols' or `largesymbols'
% symbol fonts are available.
%    \begin{macrocode}
\DeclareOption{concrete-math}
   {\DeclareSymbolFont{operators}{OT1}{ccr}{m}{n}%
    \DeclareSymbolFont{letters}{OML}{ccm}{m}{it}}
%    \end{macrocode}
% We specify OT1 encoding (not |\encodingdefault|) for the `operators'
% symbol font, since uppercase greek letters still come from this font
% in the standard setup.
%
% \section{Miscellany}\label{beton:miscellany}
%
% \begin{macro}{\dash}\begin{macro}{\qback}\begin{macro}{\t}
% Knuth added a little extra space around em-dashes
% in~\cite{concrete}; this is obtained by typing |\dash---|. Also, the
% ending double-quote is pulled a little closer to commas and periods
% (|,\qback''| and |.\qback''|).
%
% The `tie-after' (|\t|) accent macro needs a math italic font:
% Knuth's macros use CM (my hypothesis is that this is due to 
% historical reasons: Knuth may have decided to switch to 
% oldstyle numerals for equation numbers {\em after\/} he wrote the
% |\t| macro).  I believe Concrete should be used: Surely, it is best
% to have the accent come from the same font [family] as the accentee?
%    \begin{macrocode}
\def\dash---{\thinspace---\hskip.16667em\relax}
\def\qback{\kern-.15em} % between , or . and ''
\def\t#1{{\edef\next{\the\font}\beton@oldstyle\accent"7F\next#1}}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
% \section{Processing options}
%
% Finally, we must remember to process the options:
%    \begin{macrocode}
\ProcessOptions
%</package>
%    \end{macrocode}
%
% \DeleteShortVerb\|
% \Finale
% \endinput
%
% The driver file:
%    \begin{macrocode}
%<*driver>
\documentclass{ltxdoc}
\usepackage{beton}

\DeclareFontShape\encodingdefault{ccr}{bx}{n}{<->sub*cmss/sbc/n}{}
\DeclareFontShape\encodingdefault{ccr}{bx}{it}{<->sub*cmss/sbc/it}{}
\DeclareFontShape\encodingdefault{ccr}{bx}{sl}{<->sub*cmss/sbc/sl}{}
\DeclareFontShape\encodingdefault{ccr}{bx}{sc}{<->sub*cmss/sbc/sc}{}

\EnableCrossrefs         
%\DisableCrossrefs % Say \DisableCrossrefs if index is ready

%\OnlyDescription  % Comment out for implementation details

\begin{document}
   \DocInput{beton.dtx}
\end{document}
%</driver>
%    \end{macrocode}

\endinput
