| 1 |
% \iffalse |
| 2 |
% |
| 3 |
%% File `beton.dtx'. |
| 4 |
%% Copyright (C) 1992--1995 Frank Jensen. All rights reserved. |
| 5 |
% |
| 6 |
% Please send error reports and suggestions for improvements to: |
| 7 |
% |
| 8 |
% Frank Jensen |
| 9 |
% Aalborg University |
| 10 |
% DK-9220 Aalborg \O |
| 11 |
% Denmark |
| 12 |
% Internet: <[email protected]> |
| 13 |
% |
| 14 |
% \fi |
| 15 |
|
| 16 |
\def\fileversion{v1.3} |
| 17 |
\def\filedate{1995/03/05} |
| 18 |
|
| 19 |
% \CheckSum{112} |
| 20 |
%% \CharacterTable |
| 21 |
%% {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 |
| 22 |
%% 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 |
| 23 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 24 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 25 |
%% Dollar \$ Percent \% Ampersand \& |
| 26 |
%% Acute accent \' Left paren \( Right paren \) |
| 27 |
%% Asterisk \* Plus \+ Comma \, |
| 28 |
%% Minus \- Point \. Solidus \/ |
| 29 |
%% Colon \: Semicolon \; Less than \< |
| 30 |
%% Equals \= Greater than \> Question mark \? |
| 31 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 32 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 33 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 34 |
%% Right brace \} Tilde \~} |
| 35 |
% |
| 36 |
% \iffalse |
| 37 |
%<*driver> |
| 38 |
\documentclass{ltxdoc} |
| 39 |
\usepackage[concrete-math]{beton} |
| 40 |
\AtBeginDocument |
| 41 |
{\DeclareFontShape\encodingdefault{ccr}{bx}{n}{<->sub*cmss/sbc/n}{}% |
| 42 |
\DeclareFontShape\encodingdefault{ccr}{bx}{it}{<->sub*cmss/sbc/it}{}% |
| 43 |
\DeclareFontShape\encodingdefault{ccr}{bx}{sl}{<->sub*cmss/sbc/sl}{}% |
| 44 |
\DeclareFontShape\encodingdefault{ccr}{bx}{sc}{<->sub*cmss/sbc/sc}{}} |
| 45 |
\begin{document} |
| 46 |
\DocInput{beton.dtx} |
| 47 |
\end{document} |
| 48 |
%</driver> |
| 49 |
% \fi |
| 50 |
% |
| 51 |
% \newcommand\beton{\texttt{beton}} |
| 52 |
% \newcommand\euler{\texttt{euler}} |
| 53 |
% |
| 54 |
% \title{The \beton\ package} |
| 55 |
% \author{Frank Jensen} |
| 56 |
% \date{\filedate} |
| 57 |
% |
| 58 |
% \maketitle |
| 59 |
% |
| 60 |
% \section{Introduction} |
| 61 |
% |
| 62 |
% The purpose of the \beton\ package is to provide a setup so that |
| 63 |
% documents using the package will automatically be typeset with the |
| 64 |
% Concrete fonts designed by Don Knuth. |
| 65 |
% |
| 66 |
% The \beton\ package is based on Knuth's macros for the book |
| 67 |
% ``Concrete Mathematics''~\cite{concrete}. Knuth's macros can be |
| 68 |
% found through anonymous ftp to \texttt{labrea.\allowbreak |
| 69 |
% stanford.edu}: look for the file \texttt{gkpmac.tex} in directory |
| 70 |
% \texttt{pub/tex/local/lib}. Also, the fonts can be found at that |
| 71 |
% site: look in directory \texttt{pub/tex/local/cm}. |
| 72 |
% |
| 73 |
% The Concrete fonts look best with a larger value for |\baselineskip| |
| 74 |
% than the value normally used with the Computer Modern fonts. |
| 75 |
% Therefore, the \beton\ package makes some decisions about line |
| 76 |
% spacing that override the values specified by the standard \LaTeX\ |
| 77 |
% classes and packages. See Section~\ref{beton:baselineskip-settings} |
| 78 |
% for further details. |
| 79 |
% |
| 80 |
% In \cite{concrete}, the margin contains numerous humorous notes, |
| 81 |
% so-called `graffiti', contributed by the students that attended the |
| 82 |
% course by Graham, Knuth, and Patashnik. These graffiti are typeset |
| 83 |
% in a nine point slanted condensed version of the Concrete fonts. |
| 84 |
% The current version of the \beton\ package does not provide any |
| 85 |
% commands to support such graffiti. However, such commands could |
| 86 |
% easily be provided, e.g., by changing the |\marginpar| command. |
| 87 |
% |
| 88 |
% The \beton\ package deals with the \emph{text font} issues |
| 89 |
% of~\cite{concrete}; i.e., it does not make any decisions about page |
| 90 |
% layout (such as the height and width of the text area), font size, |
| 91 |
% numbering scheme (e.g., \cite{concrete}~uses the page number for the |
| 92 |
% numbering of tables [but not figures, since the book doesn't have |
| 93 |
% any numbered illustrations]; use a separate package to get such a |
| 94 |
% scheme), math fonts (use the \euler\ package to get this distinctive |
| 95 |
% part of the look of~\cite{concrete}), or the amount of space above |
| 96 |
% and below displayed equations. However, the \beton\ package does |
| 97 |
% set up the following: |
| 98 |
% \begin{itemize} |
| 99 |
% \item Concrete fonts for text |
| 100 |
% (Section~\ref{beton:font-definitions}). |
| 101 |
% \item Increased value for |\baselineskip| |
| 102 |
% (Section~\ref{beton:baselineskip-settings}). This may not be |
| 103 |
% appropriate for documents with short lines (e.g., two-column |
| 104 |
% documents), so an option (\texttt{standard-baselineskips}) is |
| 105 |
% provided to turn this feature off. |
| 106 |
% \item An option (\texttt{oldstyle-equation-numbers}) to request |
| 107 |
% `oldstyle' numerals for equation numbers |
| 108 |
% (Section~\ref{beton:equation-numbers}). |
| 109 |
% \item An option (\texttt{concrete-math}) to request `concrete' |
| 110 |
% math, if you insist |
| 111 |
% (Section~\ref{beton:concrete-math}).\footnote{Footnote numbers |
| 112 |
% are typeset in math mode, so if the math fonts are not |
| 113 |
% properly set up, these numbers will come out wrong. The |
| 114 |
% \euler\ package and the \texttt{concrete-math} option will |
| 115 |
% both provide a proper setup.} |
| 116 |
% \item Some commands to `fine tune' the typography |
| 117 |
% (Section~\ref{beton:miscellany}). |
| 118 |
% \end{itemize} |
| 119 |
% |
| 120 |
% Last, a note about the name of the present package: ``beton'' is the |
| 121 |
% danish word for the `hard' meaning of the english word ``concrete'' |
| 122 |
% (and since there already exists a package of the name ``concrete'' |
| 123 |
% by Frank Mittelbach and Rainer Sch\"opf, I chose ``beton'' for |
| 124 |
% mnemonic reasons). |
| 125 |
% |
| 126 |
% \StopEventually { |
| 127 |
% \begin{thebibliography}{1} |
| 128 |
% \bibitem{concrete} |
| 129 |
% \textsc{R. L. Graham}, \textsc{D. E. Knuth}, and |
| 130 |
% \textsc{O. Patashnik}. |
| 131 |
% \newblock \textit{Concrete Mathematics}. |
| 132 |
% \newblock Addison-Wesley, 1989. |
| 133 |
% \end{thebibliography} |
| 134 |
% } |
| 135 |
% |
| 136 |
% \section{Hello world} |
| 137 |
% |
| 138 |
% First, we announce the package. |
| 139 |
% \begin{macrocode} |
| 140 |
%<*package> |
| 141 |
\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 142 |
\ProvidesPackage{beton}[\filedate\space\fileversion] |
| 143 |
\typeout{Package: `beton' \fileversion\space <\filedate> (FJ)} |
| 144 |
% \end{macrocode} |
| 145 |
% |
| 146 |
% \section{Font definitions}\label{beton:font-definitions} |
| 147 |
% |
| 148 |
% The Concrete family comes in medium normal, medium italic, medium |
| 149 |
% slanted, and medium caps and small caps. The \texttt{.fd} files for |
| 150 |
% this family are defined in the \texttt{cmfonts.fdd} file (part of |
| 151 |
% the \LaTeX\ `base' distribution). Note that these \texttt{.fd} |
| 152 |
% files are \emph{not} generated during the normal installation |
| 153 |
% process for \LaTeX; you have to explicitly run \LaTeX\ on the |
| 154 |
% \texttt{cmextra.ins} file. |
| 155 |
% |
| 156 |
% There are no bold variants of the Concrete fonts. However, |
| 157 |
% in~\cite{concrete}, Knuth chose the bold extended font from the |
| 158 |
% Computer Modern (Roman) family to go with the Concrete fonts. The |
| 159 |
% \texttt{.fd} files for the Concrete fonts implement this choice. |
| 160 |
% |
| 161 |
% Instead of the CMR bold extended font, I recommend the CM Sans Serif |
| 162 |
% demibold condensed font.\footnote{In 1992, I was involved in the |
| 163 |
% production of a math book using Concrete for text and Euler for |
| 164 |
% math; in that book, all headings were set in CM Sans Serif demibold |
| 165 |
% condensed. (The layout and the choice of fonts were decided by a |
| 166 |
% reputable danish designer.)} Simply put the following lines in the |
| 167 |
% preamble or in a package file (do \emph{not} put spaces within the |
| 168 |
% arguments to |\DeclareFontShape|): |
| 169 |
%\begin{verbatim} |
| 170 |
%\AtBeginDocument |
| 171 |
% {\DeclareFontShape\encodingdefault{ccr}{bx}{n}{<->sub*cmss/sbc/n}{}% |
| 172 |
% \DeclareFontShape\encodingdefault{ccr}{bx}{it}{<->sub*cmss/sbc/it}{}% |
| 173 |
% \DeclareFontShape\encodingdefault{ccr}{bx}{sl}{<->sub*cmss/sbc/sl}{}% |
| 174 |
% \DeclareFontShape\encodingdefault{ccr}{bx}{sc}{<->sub*cmss/sbc/sc}{}} |
| 175 |
%\end{verbatim} |
| 176 |
% Or, alternatively, use the medium weight Concrete (Roman) fonts for |
| 177 |
% headings (and other places where bold is commonly used). In my |
| 178 |
% opinion, both alternatives are better than CMR bold extended. |
| 179 |
% |
| 180 |
% There is also a math italic version of the Concrete fonts; the |
| 181 |
% \texttt{.fd} file for this subfamily is also defined in |
| 182 |
% \texttt{cmfonts.fdd}. |
| 183 |
% |
| 184 |
% To typeset graffiti, special nine point condensed variants of the |
| 185 |
% Concrete slanted and the Concrete math italic fonts were designed. |
| 186 |
% These variants are not used by the current version of the \beton\ |
| 187 |
% package. |
| 188 |
% |
| 189 |
% We set the default family for |\rm| to Concrete Roman: |
| 190 |
% \begin{macrocode} |
| 191 |
\def\rmdefault{ccr} |
| 192 |
% \end{macrocode} |
| 193 |
% \section{Baselineskip settings}\label{beton:baselineskip-settings} |
| 194 |
% |
| 195 |
% Knuth chose a high value for |\baselineskip| to compensate for the |
| 196 |
% relatively heavy (compared to Computer Modern) weight of the |
| 197 |
% Concrete fonts. |
| 198 |
% |
| 199 |
% \begin{macro}{\beton@baselineskip@table} |
| 200 |
% We specify the desired values for |\baselineskip| at various point |
| 201 |
% sizes in a style similar to font definitions. Here is a tentative |
| 202 |
% specification for the most important sizes of the Concrete fonts: |
| 203 |
% \begin{macrocode} |
| 204 |
\def\beton@baselineskip@table |
| 205 |
{<\@viiipt>10<\@ixpt>11.5<\@xpt>13<\@xipt>14.5<\@xiipt>16} |
| 206 |
% \end{macrocode} |
| 207 |
% \end{macro} |
| 208 |
% |
| 209 |
% \begin{macro}{\@setfontsize} |
| 210 |
% All the standard \LaTeX\ size-changing commands (|\small|, |\large|, |
| 211 |
% etc.)\ are defined in terms of the |\@setfontsize| macro. This |
| 212 |
% macro is called with the following three arguments: |#1|~is the |
| 213 |
% size-changing command; |#2|~is the font size; |#3|~is the |
| 214 |
% |\baselineskip| value. We modify this macro to check |
| 215 |
% |\beton@baselineskip@table| for an alternative |\baselineskip| |
| 216 |
% value. |
| 217 |
% \begin{macrocode} |
| 218 |
\def\beton@new@setfontsize#1#2#3% |
| 219 |
{\edef\@tempa{\def\noexpand\@tempb####1<#2}% |
| 220 |
\@tempa>##2<##3\@nil{\def\beton@baselineskip@value{##2}}% |
| 221 |
\edef\@tempa{\noexpand\@tempb\beton@baselineskip@table<#2}% |
| 222 |
\@tempa><\@nil |
| 223 |
\ifx\beton@baselineskip@value\@empty |
| 224 |
\def\beton@baselineskip@value{#3}% |
| 225 |
\fi |
| 226 |
\beton@old@setfontsize{#1}{#2}\beton@baselineskip@value} |
| 227 |
% \end{macrocode} |
| 228 |
% Since the \texttt{oldlfont} and \texttt{newlfont} packages redefine |
| 229 |
% the |\@setfontsize| macro, we defer our changes until the end of the |
| 230 |
% preamble. (See also Section~\ref{options}.) |
| 231 |
% \begin{macrocode} |
| 232 |
\AtBeginDocument |
| 233 |
{\let\beton@old@setfontsize=\@setfontsize |
| 234 |
\let\@setfontsize=\beton@new@setfontsize} |
| 235 |
% \end{macrocode} |
| 236 |
% \end{macro} |
| 237 |
% The |\baselineskip| values specified in the above table should be |
| 238 |
% appropriate for most purposes, i.e., for one-column material in the |
| 239 |
% normal article/report/book formats. However, it is usually |
| 240 |
% desirable to use a smaller vaue for |\baselineskip| in two-column |
| 241 |
% material. We therefore provide the option |
| 242 |
% \texttt{standard-baselineskips} to turn off the above automatic |
| 243 |
% mechanism for |\baselineskip| settings. (An alternative way to |
| 244 |
% exercise control over the |\baselineskip| settings is to redefine |
| 245 |
% the |\beton@baselineskip@table| macro.) |
| 246 |
% \begin{macrocode} |
| 247 |
\DeclareOption{standard-baselineskips} |
| 248 |
{\AtBeginDocument{\let\@setfontsize=\beton@old@setfontsize}} |
| 249 |
% \end{macrocode} |
| 250 |
% Note that the |\let|-assignment has to be executed after |
| 251 |
% |\beton@old@setfontsize| has been defined; this is ensured by |
| 252 |
% |\AtBeginDocument| and the fact that options to the \beton\ package |
| 253 |
% is processed at the end of the package (Section~\ref{options}). |
| 254 |
% |
| 255 |
% \section{Equation numbers}\label{beton:equation-numbers} |
| 256 |
% |
| 257 |
% \begin{macro}{\theequation}\begin{macro}{\beton@oldstyle} |
| 258 |
% In~\cite{concrete}, equation numbers are typeset with oldstyle |
| 259 |
% numerals (from the math italic font). You have to specify the |
| 260 |
% \texttt{oldstyle-equation-numbers} option to get them. |
| 261 |
% \begin{macrocode} |
| 262 |
\DeclareOption{oldstyle-equation-numbers} |
| 263 |
{\@ifundefined{chapter} |
| 264 |
{\def\theequation{{\beton@oldstyle\arabic{equation}}}} |
| 265 |
{\def\theequation{{\beton@oldstyle\thechapter}.% |
| 266 |
{\beton@oldstyle\arabic{equation}}}}} |
| 267 |
\DeclareRobustCommand\beton@oldstyle{\usefont{OML}{ccm}\f@series{it}} |
| 268 |
% \end{macrocode} |
| 269 |
% Here, we assume that |\thechapter| generates a number (\emph{note} |
| 270 |
% that in appendices, we will get math italic letters as `chapter |
| 271 |
% numbers'!). We also assume the standard format for equation |
| 272 |
% numbers. |
| 273 |
% |
| 274 |
% The |\beton@oldstyle| macro is also used in the definition of |
| 275 |
% the~|\t| accent macro (Section~\ref{beton:miscellany}). |
| 276 |
% \end{macro}\end{macro} |
| 277 |
% |
| 278 |
% \begin{macro}{\oldstylenums} |
| 279 |
% \begin{macro}{\TextOldstyle}\begin{macro}{\MathOldstyle} |
| 280 |
% We provide a new definition of the |\oldstylenums| macro: this |
| 281 |
% definition allows us to modify the generation of oldstyle numerals |
| 282 |
% in text and in math separately, using two hooks, |\TextOldstyle| and |
| 283 |
% |\MathOldstyle|. |
| 284 |
% \begin{macrocode} |
| 285 |
\DeclareRobustCommand\oldstylenums[1]% |
| 286 |
{\begingroup |
| 287 |
\spaceskip\fontdimen\tw@\font |
| 288 |
\TextOldstyle \MathOldstyle #1% |
| 289 |
\endgroup} |
| 290 |
% \end{macrocode} |
| 291 |
% In text, oldstyle digits should come from the Concrete fonts. |
| 292 |
% \begin{macrocode} |
| 293 |
\let\TextOldstyle=\beton@oldstyle |
| 294 |
% \end{macrocode} |
| 295 |
% By default, oldstyle digits in math come from the `letters' symbol |
| 296 |
% font (this is also true if the \texttt{concrete-math} option to the |
| 297 |
% \beton\ package is specified). |
| 298 |
% \begin{macrocode} |
| 299 |
\providecommand\MathOldstyle{\mathgroup\symletters} |
| 300 |
% \end{macrocode} |
| 301 |
% \end{macro}\end{macro}\end{macro} |
| 302 |
% |
| 303 |
% \section{Concrete math}\label{beton:concrete-math} |
| 304 |
% |
| 305 |
% The Concrete fonts were designed to blend well with the Euler math |
| 306 |
% fonts, so I recommend the \euler\ package to go with the \beton\ |
| 307 |
% package. If, however, for some reason, you wish to use the few |
| 308 |
% Concrete fonts available for math, you can specify the |
| 309 |
% \texttt{concrete-math} option for the \beton\ package. |
| 310 |
% |
| 311 |
% The \texttt{concrete-math} option selects Concrete Roman for math |
| 312 |
% symbol font `operators' and Concrete math italic for math symbol |
| 313 |
% font `letters'. No bold versions and no `symbols' or `largesymbols' |
| 314 |
% symbol fonts are available. |
| 315 |
% \begin{macrocode} |
| 316 |
\DeclareOption{concrete-math} |
| 317 |
{\DeclareSymbolFont{operators}{OT1}{ccr}{m}{n}% |
| 318 |
\DeclareSymbolFont{letters}{OML}{ccm}{m}{it}} |
| 319 |
% \end{macrocode} |
| 320 |
% We specify OT1 encoding (not |\encodingdefault|) for the `operators' |
| 321 |
% symbol font, since uppercase greek letters still come from this font |
| 322 |
% in the standard setup. |
| 323 |
% |
| 324 |
% \section{Miscellany}\label{beton:miscellany} |
| 325 |
% |
| 326 |
% \begin{macro}{\dash}\begin{macro}{\qback}\begin{macro}{\t} |
| 327 |
% Knuth added a little extra space around em-dashes |
| 328 |
% in~\cite{concrete}; this is obtained by typing |\dash---|. Also, the |
| 329 |
% ending double-quote is pulled a little closer to commas and periods |
| 330 |
% (|,\qback''| and |.\qback''|). |
| 331 |
% |
| 332 |
% The `tie-after' (|\t|) accent macro needs a math italic font: |
| 333 |
% Knuth's macros use CM (my hypothesis is that this is due to |
| 334 |
% historical reasons: Knuth may have decided to switch to |
| 335 |
% oldstyle numerals for equation numbers \emph{after} he wrote the |
| 336 |
% |\t| macro). I believe Concrete should be used: Surely, it is best |
| 337 |
% to have the accent come from the same font [family] as the accentee? |
| 338 |
% \begin{macrocode} |
| 339 |
\def\dash---{\thinspace---\hskip.16667em\relax} |
| 340 |
\def\qback{\kern-.15em} % between , or . and '' |
| 341 |
\def\t#1{{\edef\next{\the\font}\beton@oldstyle\accent"7F\next#1}} |
| 342 |
% \end{macrocode} |
| 343 |
% \end{macro}\end{macro}\end{macro} |
| 344 |
% |
| 345 |
% \section{Processing options}\label{options} |
| 346 |
% |
| 347 |
% Finally, we must remember to process the options: |
| 348 |
% \begin{macrocode} |
| 349 |
\ProcessOptions |
| 350 |
% \end{macrocode} |
| 351 |
% At this point, we have completed our changes to the |\@setfontsize| |
| 352 |
% macro (through the |\AtBeginDocument| hook). To make the changes |
| 353 |
% take effect (i.e., setting the correct |\baselineskip| value), we |
| 354 |
% execute the |\normalsize| command. |
| 355 |
% \begin{macrocode} |
| 356 |
\AtBeginDocument{\normalsize} |
| 357 |
%</package> |
| 358 |
% \end{macrocode} |
| 359 |
% |
| 360 |
% \Finale |
| 361 |
\endinput |