Debian Codegraph @

texmf-dist/source/latex/foilhtml/foilhtml.dtx

raw
1 % \iffalse
2 %<*driver>
3 \ProvidesFile{foilhtml.drv}
4 %</driver>
5 %<*driver|package>
6 %<+package>\ProvidesPackage{foilhtml}
7 [1998/02/17 v1.2 Sectioning Commands for FoilTeX]
8 %% Copyright Boris Veytsman 1997
9 %
10 % \fi
11 % \CheckSum{2423}
12 %%
13 %% \CharacterTable
14 %% {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
15 %% 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
16 %% Digits \0\1\2\3\4\5\6\7\8\9
17 %% Exclamation \! Double quote \" Hash (number) \#
18 %% Dollar \$ Percent \% Ampersand \&
19 %% Acute accent \' Left paren \( Right paren \)
20 %% Asterisk \* Plus \+ Comma \,
21 %% Minus \- Point \. Solidus \/
22 %% Colon \: Semicolon \; Less than \<
23 %% Equals \= Greater than \> Question mark \?
24 %% Commercial at \@ Left bracket \[ Backslash \\
25 %% Right bracket \] Circumflex \^ Underscore \_
26 %% Grave accent \` Left brace \{ Vertical bar \|
27 %% Right brace \} Tilde \~}
28 % \iffalse
29 %</driver|package>
30 %
31 %
32 % \section{Documentation driver}
33 %
34 % Nothing interesting here\dots
35 % \begin{macrocode}
36 %<*driver>
37 \documentclass{ltxdoc}
38 \DoNotIndex{\@Alph,\@alph,\@arabic,\@badmath}
39 \DoNotIndex{\@centercr}
40 \DoNotIndex{\@empty,\@ignoretrue}
41 \DoNotIndex{\@ixpt}
42 \DoNotIndex{\@M,\@minus,\@ne,\@plus}
43 \DoNotIndex{\\,\addtolength}
44 \DoNotIndex{\advance}
45 \DoNotIndex{\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
46 \DoNotIndex{\bullet}
47 \DoNotIndex{\cdot,\cr,\day,\DeclareOption}
48 \DoNotIndex{\def,\DocInput,\documentclass}
49 \DoNotIndex{\DoNotIndex,\egroup,\ifx,\else,\fi,\endtrivlist}
50 \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
51 \DoNotIndex{\endlist,\everycr,\ExecuteOptions}
52 \DoNotIndex{\filedate,\filename,\fileversion}
53 \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
54 \DoNotIndex{\hsize,\hskip,\hspace,\hss,\ifcase,\or,\fi}
55 \DoNotIndex{\ifvmode,\fi,\ifnum,\fi,\input}
56 \DoNotIndex{\kern,\leavevmode,\let,\leftmark}
57 \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark}
58 \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
59 \DoNotIndex{\NeedsTeXFormat,\newdimen}
60 \DoNotIndex{\newpage,\nobreak,\noindent,\number}
61 \DoNotIndex{\p@}
62 \DoNotIndex{\pagestyle,\par}
63 \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
64 \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
65 \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
66 \DoNotIndex{\rightmargin,\rlap,\rmfamily}
67 \DoNotIndex{\setbox,\setcounter,\setlength}
68 \DoNotIndex{\skip,\slshape,\space}
69 \DoNotIndex{\trivlist,\typeout,\tw@}
70 \DoNotIndex{\vskip,\vspace,\year,\z@}
71 %
72 \DoNotIndex{\@ptsize,\@sptoken,\addtocounter,\afterassignment}
73 \DoNotIndex{\AtEndOfPackage,\baselineskip,\boxmaxdepth,\clearpage}
74 \DoNotIndex{\clubpenalty,\csname,\CurrentOption,\DeclareRobustCommand}
75 \DoNotIndex{\eject,\endcsname,\evensidemargin,\expandafter}
76 \DoNotIndex{\footnotesize,\footskip,\fromaddress,\futurelet}
77 \DoNotIndex{\headheight,\headsep,\hfuzz,\ignorespaces}
78 \DoNotIndex{\InputIfFileExists,\large,\lineskip,\loop}
79 \DoNotIndex{\MakeUppercase,\MessageBreak,\mbox,\multiply}
80 \DoNotIndex{\newcount,\newif,\newlength,\newtoks,\nolinebreak}
81 \DoNotIndex{\nopagebreak,\normalfont,\normalsize,\null,\newline}
82 \DoNotIndex{\oddsidemargin,\PackageError,\PackageInfo}
83 \DoNotIndex{\paperheight,\paperwidth,\parbox,\parindent}
84 \DoNotIndex{\PassOptionsToPackage,\ProvidesPackage,\RequirePackage}
85 \DoNotIndex{\rule,\selectfont,\sffamily,\sloppy,\small,\spaceskip}
86 \DoNotIndex{\stepcounter,\textheight,\textwidth,\the,\topmargin}
87 \DoNotIndex{\unhbox,\voidb@x,\vsize,\vfuzz,\widowpenalty,\xspaceskip}
88 \DoNotIndex{\AtBeginDocument,\AtEndDocument}
89 \DoNotIndex{\n}
90 \usepackage{enumerate}
91 \CodelineIndex
92 \RecordChanges
93 \EnableCrossrefs
94 \renewcommand{\partname}{Part}
95 %
96 % We want |foilhtml.dtx| to produce the code and interface, but
97 % |foilhtml.drv| to produce only interface
98 %
99 %<+driver>\OnlyDescription
100 %<+driver>\renewcommand{\part}[2][dummy]{}
101 %
102 % We generate foilhtml.ins---just in case\ldots
103 %
104 \begin{filecontents}{foilhtml.ins}
105 \def\batchfile{foilhtml.ins}
106 \input docstrip
107 \keepsilent
108
109 \declarepreamble\cfg
110
111 The first part of this file contains default options for your site.
112 The second part (inside AtEndOfPackage declaration) should contain
113 customization commands specific to your site.
114
115 Good luck
116 \endpreamble
117
118 \Msg{Generating files...}
119 \generate{%
120 \file{foilhtml.drv}{\from{foilhtml.dtx}{driver}}%
121 \file{foilhtml.sty}{\from{foilhtml.dtx}{package}}%
122 \usepreamble\cfg\file{foilhtml.cfg}{\from{foilhtml.dtx}{cfg}}%
123 \usepreamble\empty\usepostamble\empty\file{foils.perl}%
124 {\from{foilhtml.dtx}{foils}}}
125 \Msg{Generating Perl scripts for obsolete versions of LaTeX2HTML...}
126 \generate{%
127 \usepreamble\empty\usepostamble\empty\file{foilhtml-96.perl}%
128 {\from{foilhtml.dtx}{foilhtml}}
129 \usepreamble\empty\usepostamble\empty\file{foils-97.perl}%
130 {\from{foilhtml.dtx}{foils-97}}}
131 \obeyspaces
132 \Msg{}
133 \Msg{**********************************************************}
134 \Msg{* To finish the installation, put the files foilhtml.sty *}
135 \Msg{* and foilhtml.cfg to a directory read by LaTeX, and the *}
136 \Msg{* script foils.perl to the subdirectory styles of the *}
137 \Msg{* main LaTeX2HTML directory. *}
138 \Msg{* Happy LaTeXing & good luck! *}
139 \Msg{**********************************************************}
140 \Msg{}
141 \end{filecontents}
142
143 \begin{document}
144 \DocInput{foilhtml.dtx}
145 \end{document}
146 %</driver>
147 % \end{macrocode}
148 % \fi
149 % \newcommand{\FH}{\textsf{FoilHTML}}
150 % \newcommand{\Perl}{\textsf{Perl}}
151 % \newcommand{\latextohtml}{\LaTeX 2\texttt{HTML}}
152 % \DeclareRobustCommand\FoilTeX{{\normalfont{\sffamily Foil}\kern-.03em{\rmfamily\TeX}}}
153 %
154 % \GetFileInfo{foilhtml.drv}
155 %
156 % \title{Sectioning commands in \FoilTeX\ and conversion to HTML
157 % format: \FH\ Package
158 % \thanks{This file
159 % has version number \fileversion, last
160 % revised \filedate.}
161 % \thanks{\copyright Boris Veytsman, 1998}}
162 % \author{Boris Veytsman\thanks{E-mail: \texttt{[email protected]},
163 % Home page: \texttt{http://www.plmsc.psu.edu/}\~{}\texttt{boris}}}
164 % \date{\filedate}
165 % \maketitle
166 %
167 % \begin{abstract}
168 % The standard \FoilTeX\ system is based on a visual rather than
169 % logical formatting. Thus automatic conversion of \FoilTeX\
170 % documents to HTML format is difficult. In particular, the
171 % well-known \latextohtml\ converter gives unsatisfactory results
172 % when used on \FoilTeX\ documents.
173 %
174 % This package provides integration between \FoilTeX\ and
175 % \latextohtml. It adds sectioning commands and elements of logical
176 % formatting to \FoilTeX\ and provides support for \FoilTeX\ commands
177 % in \latextohtml. It also supports automatic creation of
178 % \latextohtml\ images with proper font sizes and shapes when
179 % converting \FoilTeX\ documents.
180 % \end{abstract}
181 %
182 % \tableofcontents
183 %
184 % \part{User Interface}
185 %
186 % \section{Introduction}
187 %
188 % Many people like to put the contents of their talks and lectures on
189 % the World Wide Web using tools like Nikos Drakos'
190 % \latextohtml~\cite{LaTeX2HTML}. Unfortunately, when one tries to
191 % convert the documents prepared in \FoilTeX~\cite{FoilTeX}, several
192 % problems emerge:
193 % \begin{enumerate}
194 % \item \FoilTeX\ does not have proper sectioning commands. Instead it
195 % has command like |\foilhead| and |\rotatefoilhead|, that are not
196 % recognized by \latextohtml.
197 % \item \FoilTeX\ has commands like |\MyLogo| and |\Restriction| that
198 % have no correspondence in the HTML format.
199 % \item The equations and pictures processed by \latextohtml\ are too
200 % large and (for pictures) use Sans Serif fonts. This produces ugly
201 % |gif| inserts in HTML files.
202 % \end{enumerate}
203 %
204 % This package solves these problems by two methods:
205 % \begin{enumerate}
206 % \item It provides a \Perl\ script to teach \latextohtml\ the basic
207 % constructions of \FoilTeX\ and put the correct headers in the \latextohtml\
208 % |images.tex| file.
209 % \item It provides a \LaTeX\ package that implements sectioning
210 % commands in \FoilTeX.
211 % \end{enumerate}
212 %
213 %
214 % \section{Installation}
215 % Since \FH\ is an \emph{add-on} to \FoilTeX\ and \latextohtml, you need both
216 % these programs installed and working prior to installation of
217 % \FH. This package is intended for \LaTeXe\ \emph{only}; I don't have
218 % enough time to port and test it under \LaTeX2.09. It is tested under
219 % \FoilTeX2.1 and \latextohtml96--\latextohtml98.
220 %
221 % The \FH\ distribution consists of the following files:
222 % \begin{itemize}
223 % \item |readme.v12|---Read Me file
224 % \item |foilhtml.dtx|---the fully documented code
225 % \item |foilhtml.ins|---the \LaTeX\ program extracting
226 % the code from the |.dtx| file.
227 % \end{itemize}
228 % To install the package:
229 % \begin{enumerate}
230 % \item Run \LaTeX\ on |foilhtml.ins|. This will
231 % create the following files:
232 % \begin{itemize}
233 % \item |foils.perl|---\Perl{} script for \latextohtml98
234 % \item |foilhtml.sty| and |foilhtml.cfg|---\LaTeX\ style file and the
235 % configuration file for user-customization,
236 % \item |foilhtml.drv|---documentation driver.
237 % \item |foilhtml-96.perl| and |foils-97.perl|---obsolete versions of
238 % \Perl{} scripts required \emph{only} if you have an obsolete installation
239 % of \latextohtml.
240 % \end{itemize}
241 % \item Install the script |foils.perl| in the directory where your
242 % \latextohtml{} scripts reside (usually it is
243 % |styles| subdirectory of the main \latextohtml{} directory,
244 % e.~g. |/usr/local/lib/latex2html/styles|).
245 % \item Tune the configuration file |foilhtml.cfg| according to your
246 % taste and put it together with the file |foilhtml.sty| to the
247 % directory read by \LaTeX\footnote{If you use |kpathsea| (e.~g. if
248 % you have te\TeX\ distribution), you will need to run |texhash| to
249 % update your search database}.
250 % \item Run \LaTeX\ on |foilhtml.drv| to produce the
251 % documentation\footnote{The documentation driver |foilhtml.drv|
252 % reads the contents of the file |foilhtml.dtx|, so do not delete
253 % the latter until you produced the documentation.}.
254 % \item (Optional) to produce the documentation \emph{and} the code run
255 % \LaTeX\ through the file |foilhtml.dtx|
256 % \end{enumerate}
257 %
258 % \subsection{Obsolete versions}
259 %
260 % If you have older versions of \latextohtml, your best options is to upgrade.
261 % However, if you cannot do this by some reason, you can use the previous
262 % versions of the perl scripts. Just rename the files |foilhtml-96.perl|
263 % \emph{or} |foils-97.perl| to |foilhtml.perl| or |foils.perl| correspondingly
264 % and install them in the |styles| subdirectory.
265 %
266 % \section{Basic Usage}
267 %
268 % The usage of \FH\ could be very simple. Just add to the preamble of your
269 % document |\usepackage{foilhtml}|, for example
270 % \begin{verbatim}
271 % \documentclass[20pt,dvips]{foils}
272 % \usepackage{foilhtml,html}
273 % \end{verbatim}
274 % and your \FoilTeX\ documents will be correctly parsed by
275 % \latextohtml\footnote{Actually, if you use \latextohtml97-1 or later, you
276 % don't need even to load the package |foilhtml|: unlike the old
277 % versions of \latextohtml, this one parses both \cs{usepackage} and
278 % \cs{documentclass} commands. However, you will want to load this
279 % package if you need the new \FoilTeX{} commands described below.}.
280 % The \FoilTeX-specific commands
281 % \DescribeMacro{\foilhead}\DescribeMacro{\rotatefoilhead} |\foilhead| and
282 % |\rotatefoilhead| will be translated by \latextohtml\ as
283 % starred |\subsection*| commands (this behavior could be changed in your
284 % |.latex2html-init| file---see Section~\ref{sec:config}).
285 %
286 % However, this is not the full story. In addition, you will be able
287 % to use ``normal'' sectioning
288 % commands like |\section| and |\chapter| and even
289 % |\tableofcontents|. By default, commands |\part| and |\chapter|
290 % produce new foils containing only titles of the corresponding, and
291 % the command |\section| starts a new foil. The starred forms of these
292 % commands produce unnumbered sections that are not included in the table of
293 % contents.
294 %
295 % In the ``vanilla'' \FoilTeX\ the commands |\foilhead| and
296 % |rotatefoilhead| have both logical (they are close to sectioning
297 % commands) and visual meanings. If you want to convert your documents
298 % to HTML, you need to adhere to logical formatting. Therefore, their
299 % usage is discouraged. Most important, you should \emph{not} use the
300 % commands |\foilhead{}| and |\rotatefoilhead{}| without arguments to
301 % produce blank pages: they will be treated by \latextohtml\ as
302 % |\subsection*{}| commands with blank subsection name. Instead, use
303 % |\clearpage| and the commands |\portraitfoils| and |\landscapefoils|,
304 % described below.
305 %
306 % While the sectioning commands take care of the logical formatting,
307 % it is impossible to get rid of visual formatting of foils
308 % altogether. \FH\ package provides some new commands for visual
309 % formatting.
310 %
311 % \DescribeMacro{\portraitfoils}\DescribeMacro{\landscapefoils}
312 % \DescribeMacro{\portraitfoils*}\DescribeMacro{\landscapefoils*}
313 % The commands |\portraitfoils| and |\landscapefoils| start a new foil
314 % with the selected orientation. Their starred forms do not eject the
315 % page, and the selected orientation begins only from the next
316 % sectioning command at the level of |section| or greater. Note that the
317 % explicit commands |\foilhead| and |\rotatefoilhead| might change the
318 % orientation of the produced pages. However, the default orientation
319 % will be restored by the next sectioning command on the level of
320 % |section| or greater.
321 %
322 % \section{Customization}
323 % \label{sec:config}
324 % \FH\ should work ``right out of the box''. However, there some ways
325 % to customize its behavior for picky users.
326 %
327 % \subsection{Configuring the \latextohtml{} behavior}
328 % There are three \Perl\ variables that control translation that could
329 % be set in your
330 % |.latex2html-init| file
331 %
332 % \DescribeMacro{$FOILHEADLEVEL}
333 % The value of |$FOILHEADLEVEL| describes the level of sectioning for
334 % explicit |foilhead| and |rotatefoilhead| commands. By default it is
335 % 4 (subsection). Other values are 1 (part), 2 (chapter), etc.\ up to 7
336 % (subparagraph).
337 %
338 % \DescribeMacro{$FOILCLASS}\DescribeMacro{$FOILOPTIONS}
339 % The header of the |images.tex| is
340 % \begin{verbatim}
341 % \documentclass[$FOILOPTIONS]{$FOILCLASS}
342 % \end{verbatim}
343 % The defaults are |10pt| and |article|. The variables can be set to any
344 % valid \LaTeX\ values.
345 %
346 % For example, the following lines in your |.latex2html-init| file:
347 % \begin{verbatim}
348 % $FOILHEADLEVEL = 2;
349 % $FOILOPTIONS = '12pt';
350 % $FOILCLASS = 'book';
351 % \end{verbatim}
352 % produce HTML file with |foilhead| commands translated as
353 % Chapters, and the images created as for a 12pt book.
354 %
355 % \subsection{\LaTeX\ variables and options}
356 % There are several ways to change the look of the \LaTeX\
357 % document.
358 %
359 % \DescribeMacro{\contentsname}
360 % By default, the Table of Contents is titled ``Outline'' in the
361 % printed document. This could be changed by changing the macro
362 % |\contentsname| like this:
363 % \begin{verbatim}
364 % \renewcommand{\contentsname}{The Outline of Today's Talk}
365 % \end{verbatim}
366 % Note that the in the HTML version Table of Contents is still called
367 % ``Contents''. This could be changed separately in your
368 % |.latex2html-init| file.
369 %
370 % \DescribeMacro{[pagesintoc]}\DescribeMacro{[nopagesintoc]}
371 % By default, the Table of Contents does not include the page numbers
372 % of the corresponding sections (they have little sense for a
373 % lecture). However, if you wish to include them in the Table of
374 % Contents, use package option |pagesintoc|. The package option
375 % |nopagesintoc| (default) suppresses the page numbers.
376 %
377 % By default, |foilhtml| does \emph{not} number even the non-starred
378 % sections, subsections, etc. This behavior is determined by the variable
379 % |secnumdepth| (by default 0). This variable has the same meaning
380 % here, as in the standard \LaTeX\ classes. All
381 % sectioning units of the level larger than |secnumdepth| are
382 % numbered, and the others are not.
383 %
384 % \subsection{\LaTeX\ configuration file}
385 % If the file |foilhtml.cfg| exists, it is loaded by the style
386 % |foilhtml.sty|. If you use some customization code often, you can
387 % put it there. A sample configuration file is provided in the
388 % distribution; feel free to hack it.
389 %
390 % \section{New versions and bug reports}
391 %
392 % Feel free to send bug reports to |[email protected]|. You can find
393 % new versions of the package on my home page
394 % (|http://www.plmsc.psu.edu/|\~{}|boris| or on CTAN.
395 %
396 % \section{Legalese}
397 %
398 % The package \FH\ is provided ``as is'' and comes with absolutely no
399 % warranty of any kind, either expressed or implied, including, but not
400 % limited to, the implied warranties of merchantability and fitness for
401 % a particular purpose. The entire risk as to the quality and
402 % performance of the program is with you. Should the program prove
403 % defective, you assume the cost of all necessary servicing, repair or
404 % correction.
405 %
406 % In no event unless required by applicable law will the author of the
407 % program be liable to you for damages, including any general, special,
408 % incidental or consequential damages arising out of any use of the
409 % program or out of inability to use the program (including but not
410 % limited to loss of data or data being rendered inaccurate or losses
411 % sustained by you or by third parties as a result of a failure of the
412 % program to operate with any other programs), even if such holder or
413 % other party has been advised of the possibility of such damages.
414 %
415 % \FH\ package is covered by the same license as the current \LaTeXe\
416 % package (see the files |legal.txt| and |modguide.tex| in the \LaTeXe\
417 % distribution).
418 %
419 % The program \FoilTeX\ is copyrighted by IBM Corporation and covered
420 % by a separate license.
421 %
422 % The program \latextohtml\ is copyrighted by Nikos Drakos and covered by a
423 % separate license.
424 %
425 %
426 % \StopEventually{%
427 % \clearpage
428 % \begin{thebibliography}{1}
429 %
430 % \bibitem{LaTeX2HTML}
431 % Nikos Drakos, Jens Lippmann, and Ross Moore
432 % \newblock The {\latextohtml{}} translator.
433 % \newblock CTAN, 1996, 1997.
434 %
435 % \bibitem{FoilTeX}
436 % Jim Hafner.
437 % \newblock The {\FoilTeX{}} class package.
438 % \newblock CTAN, 1997.
439 %
440 % \bibitem{classes}
441 % Leslie Lamport, Frank Mittelbach, and Johannes Braams.
442 % \newblock Standard document classes for {\LaTeX{}} version 2e.
443 % \newblock CTAN, 1997.
444 %
445 % \bibitem{ltdefns}
446 % Johannes Braams, David Carlisle, Alan Jeffrey, Leslie Lamport, Frank
447 % Mittelbach, Chris Rowley, and Rainer Sch{\"o}pf.
448 % \newblock ltdefns.dtx.
449 % \newblock CTAN, 1997.
450 %
451 % \end{thebibliography}
452 % }
453 %
454 % \clearpage
455 % \part{Implementation}
456 % \section{\Perl\ code}
457 % \changes{v1.1}{1997/08/11}{Added support for \latextohtml97-1}
458 % \changes{v1.2}{1998/02/17}{Added support for \latextohtml98-1}
459 % \changes{v1.2}{1998/02/17}{Old perl scripts now have distinct names}
460 % \begin{macrocode}
461 %<*foilhtml|foils-97|foils>
462 % \end{macrocode}
463 % First, the header:
464 % \begin{macrocode}
465 ######################################################
466 #
467 %<+foilhtml># This is file `foilhtml.perl',
468 %<+foils># This is file `foils.perl',
469 # generated with the docstrip utility.
470 #
471 # Copyright Boris Veytsman 1998
472 #
473 # You are *not* allowed to modify this file.
474 #
475 # You are *not* allowed to distribute this file.
476 # For distribution of the original source see
477 # the terms for copying and modification in the file
478 # foilhtml.dtx
479 #
480 % \end{macrocode}
481 %
482 % \DescribeMacro{$FOILHEADLEVEL}
483 % Now we define |\foilhead| and |\rotatefoihead| as sectioning
484 % commands. By default their level is ``section'', but this can be used
485 % by setting |$FOILHEADLEVEL| to 1 (part), 2 (chapter), 3 (section),
486 % etc. up to 7 (subparagraph). Note that this will affect only \latextohtml\
487 % sectioning commands. The typesetting will the same: |<H1>|-level
488 % headings. Note, that article class does not have chapters,
489 % so if you want to make |$FOILHEADLEVEL| to be 2, you need to
490 % redefine |$FOILCLASS| below. Otherwise \TeX ing |images.tex| will
491 % give an error.
492 %
493 % \begin{macrocode}
494 $FOILHEADLEVEL = 4 unless defined($FOILHEADLEVEL);
495 %section_commands=('foilhead',$FOILHEADLEVEL,
496 'rotatefoilhead',$FOILHEADLEVEL,%section_commands);
497
498 %new_section_headings = ('foilhead', 'H1','rotatefoilhead','H1');
499 &generate_new_sectioning_subs;
500
501 sub generate_new_sectioning_subs{
502 local($key, $val);
503 while ( ($key, $val) = each %new_section_headings) {
504 eval "sub do_cmd_$key {"
505 . 'local($after) = @_;'
506 . '&do_cmd_section_helper(' . $val . ');}';
507 %section_commands=($key,$val,%section_commands);
508 }
509 };
510 % \end{macrocode}
511 %
512 % Now the redefinition of the |images.tex| headers. We just lift the
513 % definition from the original \latextohtml\ and make some modifications.
514 %
515 % \DescribeMacro{$FOILCLASS}\DescribeMacro{$FOILOPTIONS}
516 % We substitute the header |\documentclass|\oarg{options}|{foils}| by
517 % the header |\documentclass[$FOILOPTIONS]{$FOILCLASS}| (note that
518 % \FoilTeX\ options have no meaning in the HTML world, so we can
519 % safely drop them). The defaults are |10pt| and |article|, but this
520 % could be easily changed in the init file.
521 % \begin{macrocode}
522 $FOILCLASS = 'article' unless defined $FOILCLASS;
523 $FOILOPTIONS = '10pt' unless defined $FOILOPTIONS;
524 % \end{macrocode}
525 %
526 % The processing is different for different versions of
527 % \latextohtml{}. First, the 96 version:
528 %
529 %
530 % \begin{macrocode}
531 %</foilhtml|foils-97|foils>
532 %<*foilhtml>
533 sub make_latex{
534 # This is the environment in which to process constructs that cannot be
535 # translated to HTML.
536 # The environment tex2html_wrap will be wrapped around any shorthand
537 # environments (e.g. $, \(, \[).
538 # The tex2html_wrap environment will be treated as an unrecognised
539 # evironment by the translator and its contents (i.e. the 'shorthand'
540 # environment) will be passed to latex for processing as usual.
541 local($contents) = @_;
542 local($preamble) = $preamble;
543 # Make the @ character a normal letter ...
544 $preamble =~
545 s/\\documentclass.*/
546 \\documentclass\[$FOILOPTIONS\]{$FOILCLASS}\\makeatletter/;
547 # ... and make it special again after the preamble
548 ($DEBUG ? "\\nonstopmode" : "\\batchmode") .
549 "\n$preamble\n\\makeatother\n" .
550 "\\newenvironment{tex2html_wrap}{}{}\n" .
551 "\\newwrite\\lthtmlwrite\n" .
552 "\\def\\lthtmltypeout#1%\n" .
553 "{{\\let\\protect\\string\\immediate\\write\\lthtmlwrite{#1}}}%\n" .
554 "\\newbox\\sizebox\n" .
555 # "\\textheight 250cm\n" .
556 "\\begin{document}\n" .
557 "\\pagestyle{empty}\n" .
558 "$contents\n".
559 "\\end{document}";
560 }
561 % \end{macrocode}
562 %
563 % The 97 version is much longer:
564 %
565 % \begin{macrocode}
566 %</foilhtml>
567 %<*foils-97>
568 sub make_latex{
569 # This is the environment in which to process constructs that cannot be
570 # translated to HTML.
571 # The environment tex2html_wrap will be wrapped around any shorthand
572 # environments (e.g. $, \(, \[).
573 # The tex2html_wrap environment will be treated as an unrecognised
574 # evironment by the translator and its contents (i.e. the 'shorthand'
575 # environment) will be passed to latex for processing as usual.
576 local($contents) = @_;
577 local($preamble) = $preamble;
578 local($preamble_aux) = $preamble_aux;
579 # Make the @ character a normal letter ...
580 $preamble =~
581 s/\\documentclass.*/
582 \\documentclass\[$FOILOPTIONS\]{$FOILCLASS}\\makeatletter/;
583 # ... and make it special again after the preamble
584 # remove the \begin/\end for tex2html_nowrap and tex2html_deferred environments
585 $preamble =~s/\\(begin|end)\s*\{(tex2html_(nowrap|deferred|nomath)[_a-z]*|imagesonly)\}//g;
586 $preamble = "\\documentclass\{article\}%\\usepackage{html}%\n\\makeatletter"
587 unless ($preamble);
588 $preamble_aux = '' unless (($preamble_aux)&&($contents =~ /\\(hyper)?(ref|cite)/));
589
590 local($paperwidth) = '';
591 if ($PAPERSIZE) { $paperwidth = &adjust_textwidth($PAPERSIZE); }
592 else { $paperwidth = &adjust_textwidth("a5"); }
593 local($kern) = ($EXTRA_IMAGE_SCALE ? $EXTRA_IMAGE_SCALE/2 : ".5" );
594 $kern = $kern * $MATH_SCALE_FACTOR;
595 ($DEBUG ? "\\nonstopmode" : "\\batchmode") .
596 "\n$preamble\n$preamble_aux\\makeatother\n" .
597 "\\ifx\\AtBeginDocument\\undefined \\newcommand{\\AtBeginDocument}[1]{}\\fi\n" .
598 "\\newenvironment{tex2html_wrap}{}{}\n" .
599 "\\newbox\\sizebox\n" . "$paperwidth" .
600 "\\newwrite\\lthtmlwrite\n" . "\\makeatletter\n" .
601 "\\let\\realnormalsize=\\normalsize\n\\topskip=0pt\n\\def\\preveqno{}" .
602 "\\let\\real\@float=\\\@float \\let\\realend\@float=\\end\@float\n" .
603 "\\def\\\@float{\\let\\\@savefreelist\\\@freelist\\real\@float}\n" .
604 # "\\def\\\@float{\\\@dbflt}\n" .
605 "\\def\\end\@float{\\realend\@float\\global\\let\\\@freelist\\\@savefreelist}\n" .
606 "\\let\\real\@dbflt=\\\@dbflt \\let\\end\@dblfloat=\\end\@float\n" .
607 "\\let\\\@largefloatcheck=\\relax\n" .
608 "\\def\\\@dbflt{\\let\\\@savefreelist\\\@freelist\\real\@dbflt}\n" .
609 "\\def\\adjustnormalsize{\\def\\normalsize{\\mathsurround=0pt \\realnormalsize" .
610 "\\parindent=0pt\\abovedisplayskip=0pt\\belowdisplayskip=0pt}\\normalsize}\n" .
611 "\\def\\lthtmltypeout#1{{\\let\\protect\\string\\immediate\\write\\lthtmlwrite{#1}}}%\n" .
612 "\\newcommand\\lthtmlhboxmathA{\\adjustnormalsize\\setbox\\sizebox=\\hbox\\bgroup}%\n" .
613 "\\newcommand\\lthtmlvboxmathA{\\adjustnormalsize\\setbox\\sizebox=\\vbox\\bgroup%\n".
614 " \\let\\ifinner=\\iffalse }%\n" .
615 "\\newcommand\\lthtmlboxmathZ{\\\@next\\next\\\@currlist{}{\\def\\next{\\voidb\@x}}%\n" .
616 # " \\expandafter\\box\\next\\edef\\next{\\egroup\\def\\noexpand\\thiseqn{\\theequation}}\\next}%\n" .
617 " \\expandafter\\box\\next\\egroup}%\n" .
618 "\\newcommand\\lthtmlmathtype[1]{\\def\\lthtmlmathenv{#1}}%\n" .
619 # "\\newcommand\\lthtmllogmath{\\lthtmltypeout{latex2htmlSize%\n" .
620 "\\newcommand\\lthtmllogmath{\\lthtmltypeout{l2hSize %\n" .
621 ":\\lthtmlmathenv:\\the\\ht\\sizebox::\\the\\dp\\sizebox::\\the\\wd\\sizebox.\\preveqno}}%\n" .
622 "\\newcommand\\lthtmlfigureA[1]{\\let\\\@savefreelist\\\@freelist
623 \\lthtmlmathtype{#1}\\lthtmlvboxmathA}%\n" .
624 "\\newcommand\\lthtmlfigureZ{\\lthtmlboxmathZ\\lthtmllogmath\\copy\\sizebox
625 \\global\\let\\\@freelist\\\@savefreelist}%\n" .
626 "\\newcommand\\lthtmldisplayA[1]{\\lthtmlmathtype{#1}\\lthtmlvboxmathA}%\n" .
627 "\\newcommand\\lthtmldisplayB[1]{\\edef\\preveqno{(\\theequation)}%\n" .
628 " \\lthtmldisplayA{#1}\\let\\\@eqnnum\\relax}%\n" .
629 "\\newcommand\\lthtmldisplayZ{\\lthtmlboxmathZ\\lthtmllogmath\\lthtmlsetmath}%\n" .
630 "\\newcommand\\lthtmlinlinemathA[1]{\\lthtmlmathtype{#1}\\lthtmlhboxmathA" .
631 " \\vrule height1.5ex width0pt }%\n" .
632 "\\newcommand\\lthtmlinlinemathZ{\\egroup\\expandafter\\ifdim\\dp\\sizebox>0pt %\n" .
633 " \\expandafter\\centerinlinemath\\fi\\lthtmllogmath\\lthtmlsetmath}\n" .
634 "\\def\\lthtmlsetmath{\\hbox{\\vrule width.5pt\\vtop{\\vbox{%\n" .
635 " \\kern.5pt\\kern$kern pt\\hbox{\\hglue.5pt\\copy\\sizebox\\hglue$kern pt}\\kern.5pt%\n" .
636 " \\ifdim\\dp\\sizebox>0pt\\kern$kern pt\\fi}%\n" .
637 " \\ifdim\\hsize>\\wd\\sizebox \\hrule depth1pt\\fi}}}\n" .
638 "\\def\\centerinlinemath{\\dimen1=\\ht\\sizebox\n" .
639 " \\ifdim\\dimen1<\\dp\\sizebox \\ht\\sizebox=\\dp\\sizebox\n" .
640 " \\else \\dp\\sizebox=\\ht\\sizebox \\fi}\n\n" .
641 "\\def\\lthtmlcheckvsize{\\ifdim\\ht\\sizebox<\\vsize\\expandafter\\vfill\n" .
642 " \\else\\expandafter\\vss\\fi}%\n" .
643 # "\\def\\\@enddocumenthook{\\ifnum\\count0>1 \\ifvoid\\\@cclv\\penalty-\\\@MM\\fi\\fi}\n" .
644 "\\makeatletter\n" .
645 $LaTeXmacros . "\n" . # macros defined in extension files
646 # "\\usepackage{lthimages}\n" .
647 "\n\\begin{document}\n" .
648 "\\pagestyle{empty}\\thispagestyle{empty}%\n" .
649 "\\lthtmltypeout{latex2htmlLength hsize=\\the\\hsize}%\n" .
650 "\\lthtmltypeout{latex2htmlLength vsize=\\the\\vsize}%\n" .
651 "\\lthtmltypeout{latex2htmlLength hoffset=\\the\\hoffset}%\n" .
652 "\\lthtmltypeout{latex2htmlLength voffset=\\the\\voffset}%\n" .
653 "\\lthtmltypeout{latex2htmlLength topmargin=\\the\\topmargin}%\n" .
654 "\\lthtmltypeout{latex2htmlLength topskip=\\the\\topskip}%\n" .
655 "\\lthtmltypeout{latex2htmlLength headheight=\\the\\headheight}%\n" .
656 "\\lthtmltypeout{latex2htmlLength headsep=\\the\\headsep}%\n" .
657 "\\lthtmltypeout{latex2htmlLength parskip=\\the\\parskip}%\n" .
658 "\\lthtmltypeout{latex2htmlLength oddsidemargin=\\the\\oddsidemargin}%\n" .
659 "\\makeatletter\n" .
660 "\\if\@twoside\\lthtmltypeout{latex2htmlLength evensidemargin=\\the\\evensidemargin}%\n" .
661 "\\else\\lthtmltypeout{latex2htmlLength evensidemargin=\\the\\oddsidemargin}\\fi%\n" .
662 "\\makeatother\n" .
663 "$contents\n".
664 # "\\clearpage\n" .
665 "\\end{document}";
666 }
667 %</foils-97>
668 % \end{macrocode}
669 %
670 % And 98 version is even longer...
671 % \begin{macrocode}
672 %<*foils>
673 sub make_latex{
674 # This is the environment in which to process constructs that cannot be
675 # translated to HTML.
676 # The environment tex2html_wrap will be wrapped around any shorthand
677 # environments (e.g. $, \(, \[).
678 # The tex2html_wrap environment will be treated as an unrecognised
679 # evironment by the translator and its contents (i.e. the 'shorthand'
680 # environment) will be passed to latex for processing as usual.
681 local($contents) = @_;
682 local($preamble) = $preamble;
683 local($aux_preamble) = $aux_preamble;
684 while ($preamble =~ s/^(\@.*\n)/$prelatex .= $1;''/e) {}
685 print "\nPRE-LATEX: $prelatex" if (($prelatex)&&($VERBOSITY > 1));
686
687 # Make the @ character a normal letter ...
688 $preamble =~ s/\\par([^A-Za-z])/\n$1/g;
689 $preamble =~
690 s/\\documentclass.*/
691 \\documentclass\[$FOILOPTIONS\]{$FOILCLASS}\\makeatletter/;
692 # ... and make it special again after the preamble
693 # remove the \begin/\end for tex2html_nowrap and tex2html_deferred environments
694 $preamble =~s/\\(begin|end)\s*\{(tex2html_(nowrap|deferred|nomath|preform)[_a-z]*|imagesonly)\}//g;
695 $preamble = "\\documentclass\{article\}%\n\\usepackage{html,color}%\n\\makeatletter"
696 unless ($preamble);
697 if (($LATEX_DUMP)&&(!($preamble =~ /\\usepackage\{ldump\}/))) {
698 $*=1;
699 $preamble =~ s/(\\document(class|style)[^\n]*\n)/$1\\usepackage\{ldump\}\n/;
700 $*=0;
701 }
702 $LOAD_LATEX_COLOR = "\\usepackage[dvips]{color}" unless $LOAD_LATEX_COLOR;
703 $LATEX_COLOR = "\\pagecolor[gray]{.85}" unless $LATEX_COLOR;
704 if ($preamble =~ /(^|\s*[^%])\s*\\documentstyle/) {
705 # \usepackage is invalid in LaTeX 2.09 and LaTeX-2e compatibility mode
706 $LATEX_COLOR = ''; $LOAD_LATEX_COLOR = '';
707 }
708
709 $preamble .= $LOAD_LATEX_COLOR."\n" unless ($preamble =~ /[,\{]color[,\}]/);
710 $preamble .= $LATEX_COLOR."\n" unless ($preamble =~ /\\pagecolor/);
711
712 $aux_preamble = '' unless (($aux_preamble)&&($contents =~ /\\(hyper)?(ref|cite)/));
713
714 local($paperwidth) = '';
715 if ($PAPERSIZE) { $paperwidth = &adjust_textwidth($PAPERSIZE); }
716 else { $paperwidth = &adjust_textwidth("a5"); }
717 local($kern) = ($EXTRA_IMAGE_SCALE ? $EXTRA_IMAGE_SCALE/2 : ".5" );
718 $kern = $kern * $MATH_SCALE_FACTOR;
719 $prelatex . ($DEBUG ? "\\nonstopmode" : "\\batchmode") .
720 "\n$preamble\n$aux_preamble\n" .
721 "\\count\@=\\the\\catcode`\\_ \\catcode`\\_=8 \n" .
722 "\\newenvironment{tex2html_wrap}{}{} \\catcode`\\_=\\count\@\n" .
723 "\\makeatother\n" .
724 "\\ifx\\AtBeginDocument\\undefined \\newcommand{\\AtBeginDocument}[1]{}\\fi\n" .
725 "\\newbox\\sizebox\n" . "$paperwidth" .
726 "\\newwrite\\lthtmlwrite\n" . "\\makeatletter\n" .
727 "\\let\\realnormalsize=\\normalsize\n\\global\\topskip=2sp\n\\def\\preveqno{}" .
728 "\\let\\real\@float=\\\@float \\let\\realend\@float=\\end\@float\n" .
729 "\\def\\\@float{\\let\\\@savefreelist\\\@freelist\\real\@float}\n" .
730 # "\\def\\\@float{\\\@dbflt}\n" .
731 "\\def\\end\@float{\\realend\@float\\global\\let\\\@freelist\\\@savefreelist}\n" .
732 "\\let\\real\@dbflt=\\\@dbflt \\let\\end\@dblfloat=\\end\@float\n" .
733 "\\let\\\@largefloatcheck=\\relax\n" .
734 "\\def\\\@dbflt{\\let\\\@savefreelist\\\@freelist\\real\@dbflt}\n" .
735 "\\def\\adjustnormalsize{\\def\\normalsize{\\mathsurround=0pt \\realnormalsize\n" .
736 " \\parindent=0pt\\abovedisplayskip=0pt\\belowdisplayskip=0pt}\\normalsize}%\n" .
737 "\\def\\lthtmltypeout#1{{\\let\\protect\\string\\immediate\\write\\lthtmlwrite{#1}}}%\n" .
738 "\\newcommand\\lthtmlhboxmathA{\\adjustnormalsize\\setbox\\sizebox=\\hbox\\bgroup}%\n" .
739 "\\newcommand\\lthtmlvboxmathA{\\adjustnormalsize\\setbox\\sizebox=\\vbox\\bgroup%\n".
740 " \\let\\ifinner=\\iffalse }%\n" .
741 "\\newcommand\\lthtmlboxmathZ{\\\@next\\next\\\@currlist{}{\\def\\next{\\voidb\@x}}%\n" .
742 # " \\expandafter\\box\\next\\edef\\next{\\egroup\\def\\noexpand\\thiseqn{\\theequation}}\\next}%\n" .
743 " \\expandafter\\box\\next\\egroup}%\n" .
744 "\\newcommand\\lthtmlmathtype[1]{\\def\\lthtmlmathenv{#1}}%\n" .
745 "\\newcommand\\lthtmllogmath{\\lthtmltypeout{l2hSize %\n" .
746 ":\\lthtmlmathenv:\\the\\ht\\sizebox::\\the\\dp\\sizebox::\\the\\wd\\sizebox.\\preveqno}}%\n" .
747 "\\newcommand\\lthtmlfigureA[1]{\\let\\\@savefreelist\\\@freelist
748 \\lthtmlmathtype{#1}\\lthtmlvboxmathA}%\n" .
749 "\\newcommand\\lthtmlfigureZ{\\lthtmlboxmathZ\\lthtmllogmath\\copy\\sizebox
750 \\global\\let\\\@freelist\\\@savefreelist}%\n" .
751 "\\newcommand\\lthtmldisplayA[1]{\\lthtmlmathtype{#1}\\lthtmlvboxmathA}%\n" .
752 "\\newcommand\\lthtmldisplayB[1]{\\edef\\preveqno{(\\theequation)}%\n" .
753 " \\lthtmldisplayA{#1}\\let\\\@eqnnum\\relax}%\n" .
754 "\\newcommand\\lthtmldisplayZ{\\lthtmlboxmathZ\\lthtmllogmath\\lthtmlsetmath}%\n" .
755 "\\newcommand\\lthtmlinlinemathA[1]{\\lthtmlmathtype{#1}\\lthtmlhboxmathA" .
756 " \\vrule height1.5ex width0pt }%\n" .
757 "\\newcommand\\lthtmlinlineA[1]{\\lthtmlmathtype{#1}\\lthtmlhboxmathA}%\n" .
758 "\\newcommand\\lthtmlinlineZ{\\egroup\\expandafter\\ifdim\\dp\\sizebox>0pt %\n" .
759 " \\expandafter\\centerinlinemath\\fi\\lthtmllogmath\\lthtmlsetinline}\n" .
760 "\\newcommand\\lthtmlinlinemathZ{\\egroup\\expandafter\\ifdim\\dp\\sizebox>0pt %\n" .
761 " \\expandafter\\centerinlinemath\\fi\\lthtmllogmath\\lthtmlsetmath}\n" .
762 "\\def\\lthtmlsetinline{\\hbox{\\vrule width.1em\\vtop{\\vbox{%\n" .
763 " \\kern.1em\\copy\\sizebox}\\ifdim\\dp\\sizebox>0pt\\kern.1em\\else\\kern.3pt\\fi\n" .
764 " \\ifdim\\hsize>\\wd\\sizebox \\hrule depth1pt\\fi}}}\n" .
765 "\\def\\lthtmlsetmath{\\hbox{\\vrule width.1em\\setbox1=\\vtop{\\vbox{%\n" .
766 " \\kern.1em\\kern$kern pt\\hbox{\\hglue.17em\\copy\\sizebox\\hglue$kern pt}}\\kern.3pt%\n" .
767 # " \\ifdim\\dp\\sizebox>0pt\\kern.1em \\kern$kern pt\\fi}%\n" .
768 " \\ifdim\\dp\\sizebox>0pt\\kern.1em\\fi \\kern$kern pt%\n" .
769 " \\ifdim\\hsize>\\wd\\sizebox \\hrule depth1pt\\fi}\\message{ht\\the\\ht1: dp\\the\\dp1}\\box1}}\n" .
770 "\\def\\centerinlinemath{%\\dimen1=\\ht\\sizebox\n" .
771 # " \\ifdim\\dimen1<\\dp\\sizebox \\ht\\sizebox=\\dp\\sizebox\n" .
772 " \\dimen1=\\ifdim\\ht\\sizebox<\\dp\\sizebox \\dp\\sizebox\\else\\ht\\sizebox\\fi\n" .
773 # " \\vrule width0pt depth\\dp\\sizebox \n" .
774 # " \\else \\dp\\sizebox=\\ht\\sizebox \\fi}\n\n" .
775 " \\advance\\dimen1by.5pt \\vrule width0pt height\\dimen1 depth\\dimen1 \n".
776 " \\dp\\sizebox=\\dimen1\\ht\\sizebox=\\dimen1\\relax}\n\n" .
777 "\\def\\lthtmlcheckvsize{\\ifdim\\ht\\sizebox<\\vsize\\expandafter\\vfill\n" .
778 " \\else\\expandafter\\vss\\fi}%\n" .
779 # "\\def\\\@enddocumenthook{\\ifnum\\count0>1 \\ifvoid\\\@cclv\\penalty-\\\@MM\\fi\\fi}\n" .
780 "\\makeatletter \\tracingstats = 1 \n" .
781 $LaTeXmacros . "\n" # macros defined in extension files
782 # "\\usepackage{lthimages}\n" .
783 . (($LATEX_DUMP)? "\\latexdump\n" : '')
784 . "\n\\begin{document}\n" .
785 "\\pagestyle{empty}\\thispagestyle{empty}%\n" .
786 "\\lthtmltypeout{latex2htmlLength hsize=\\the\\hsize}%\n" .
787 "\\lthtmltypeout{latex2htmlLength vsize=\\the\\vsize}%\n" .
788 "\\lthtmltypeout{latex2htmlLength hoffset=\\the\\hoffset}%\n" .
789 "\\lthtmltypeout{latex2htmlLength voffset=\\the\\voffset}%\n" .
790 "\\lthtmltypeout{latex2htmlLength topmargin=\\the\\topmargin}%\n" .
791 "\\lthtmltypeout{latex2htmlLength topskip=\\the\\topskip}%\n" .
792 "\\lthtmltypeout{latex2htmlLength headheight=\\the\\headheight}%\n" .
793 "\\lthtmltypeout{latex2htmlLength headsep=\\the\\headsep}%\n" .
794 "\\lthtmltypeout{latex2htmlLength parskip=\\the\\parskip}%\n" .
795 "\\lthtmltypeout{latex2htmlLength oddsidemargin=\\the\\oddsidemargin}%\n" .
796 "\\makeatletter\n" .
797 "\\if\@twoside\\lthtmltypeout{latex2htmlLength evensidemargin=\\the\\evensidemargin}%\n" .
798 "\\else\\lthtmltypeout{latex2htmlLength evensidemargin=\\the\\oddsidemargin}\\fi%\n" .
799 "\\makeatother\n"
800 . "$contents\n"
801 # "\\clearpage\n" .
802 . "\\end{document}";
803 }
804 %</foils>
805 % \end{macrocode}
806 % Since they are different, we must prevent loading |foilhtml.perl| if
807 % we use |foils.perl|. Of course, we asked in the user guide \emph{not}
808 % to install |foilhtml.perl| for 97-1, but one cannot be sure anybody
809 % will RTFM\ldots
810 %
811 % \begin{macrocode}
812 %<*foils-97|foils>
813 $DONT_INCLUDE = "foilhtml:".$DONT_INCLUDE;
814 % \end{macrocode}
815 %
816 %
817 % And now the ignored \FoilTeX\ commands. They are common for both
818 % versions of \latextohtml.
819 % \begin{macrocode}
820 %</foils-97|foils>
821 %<*foilhtml|foils-97|foils>
822 &ignore_commands( <<_IGNORED_CMDS_);
823 portraitfoils
824 lanscapefoils
825 MyLogo # {}
826 Restriction # {}
827 LogoOff
828 LogoOn
829 rightfooter # {}
830 rightheader # {}
831 leftheader # {}
832 newnonfloat #{} #{}
833 foilheadskip # &ignore_numeric_argument
834 abovefloatskip # &ignore_numeric_argument
835 captionwidth # &ignore_numeric_argument
836 titleauthorskip # &ignore_numeric_argument
837 authorauthorskip # &ignore_numeric_argument
838 authordateskip # &ignore_numeric_argument
839 dateabstractskip # &ignore_numeric_argument
840 zerolistvertdimens
841 _IGNORED_CMDS_
842 % \end{macrocode}
843 %
844 % The famous last line:
845 % \begin{macrocode}
846 1; # This should be the last line
847 %</foilhtml|foils-97|foils>
848 % \end{macrocode}
849 %
850 % \section{\LaTeX\ style}
851 % \subsection{Initialization and processing options}
852 % First, let us ask (not so) nicely for \LaTeX\
853 % \begin{macrocode}
854 %<*package>
855 \NeedsTeXFormat{LaTeX2e}
856 % \end{macrocode}
857 %
858 % \begin{macro}{\@pagesintoc}
859 % Now let us check whether we need pages in toc:
860 % \begin{macrocode}
861 \newif\if@pagesintoc
862 \DeclareOption{pagesintoc}{\@pagesintoctrue}
863 \DeclareOption{nopagesintoc}{\@pagesintocfalse}
864 \ExecuteOptions{nopagesintoc}
865 % \end{macrocode}
866 % \end{macro}
867 %
868 % \begin{macro}{\c@secnumdepth}
869 % We need to set |secnumdepth| before loading the configuration file:
870 % \begin{macrocode}
871 \setcounter{secnumdepth}{0}
872 % \end{macrocode}
873 % \end{macro}
874 % Now let us check the configuration file:
875 % \begin{macrocode}
876 \InputIfFileExists{foilhtml.cfg}{%
877 \typeout{Loading configuration file foilhtml.cfg}}{%
878 \typeout{Configuration file foilhtml.cfg is not found. Using default
879 options.}}
880 % \end{macrocode}
881 %
882 % And now we construct a sample configuration file
883 % \begin{macrocode}
884 %</package>
885 %<*cfg>
886 %%
887 %% The default options go here
888 %%
889 \ExecuteOptions{nopagesintoc}
890 %%
891 \AtEndOfPackage{\setcounter{secnumdepth}{0} % Customization goes here
892 }
893 %</cfg>
894 %<*package>
895 % \end{macrocode}
896 %
897 % \DescribeMacro{\if@portraitfoils}
898 % The flag |\if@portraitfoils| controls what kind of foils we produce
899 % for sectioning commands: portrait or rotated. We put it here because
900 % we want the global option |landscape| to work intelligently\ldots
901 % \begin{macrocode}
902 \newif\if@portraitfoils
903 \@portraitfoilstrue
904 \DeclareOption{landscape}{\@portraitfoilsfalse}
905 % \end{macrocode}
906 %
907 % Processing options:
908 % \begin{macrocode}
909 \ProcessOptions
910 % \end{macrocode}
911 %
912 % \subsection{Checking the caller}
913 % Let us check where we are. The package could be loaded either from
914 % |foils| document class or from |article| (or other) documentclass
915 % (e.~g. from |images.tex|). We don't want to do anything in the
916 % latter case. So let us check whether some \FoilTeX\ command is
917 % defined:
918 % \begin{macrocode}
919 \@ifundefined{foilhead}{%
920 % \end{macrocode}
921 % If we are \emph{not} called by \FoilTeX, we should disable
922 % \FoilTeX-specific commands. The \latextohtml{} script does not allow
923 % them in the document body, but, unfortunately, leaves them in the
924 % preamble. So we take care of them:
925 % \begin{macrocode}
926 \def\portraitfoils{\relax}%
927 \def\lanscapefoils{\relax}%
928 \def\MyLogo{\@gobble}%
929 \def\Restriction{\@gobble}%
930 \def\LogoOff{\relax}%
931 \def\LogoOn{\relax}%
932 \def\rightfooter{\@gobble}%
933 \def\rightheader{\@gobble}%
934 \def\leftheader{\@gobble}%
935 \def\newnonfloat{\@gobbletwo}%
936 \newdimen\foilheadskip
937 \newdimen\abovefloatskip
938 \newdimen\captionwidth
939 \newdimen\titleauthorskip
940 \newdimen\authorauthorskip
941 \newdimen\authordateskip
942 \newdimen\dateabstractskip
943 \def\zerolistvertdimens{\relax}%
944 }{%
945 % \end{macrocode}
946 %
947 % \subsection{Rotating commands}
948 % \begin{macro}{\portraitfoils}
949 % \begin{macro}{\portraitfoils*}
950 % \begin{macro}{\landscapefoils}
951 % \begin{macro}{\landscapefoils*}
952 % The rotating commands set |\if@portraitfoils| and (for unstarred
953 % variants) eject the foil using |\foilhead|
954 % \begin{macrocode}
955 \newcommand{\portraitfoils}{%
956 \@ifstar{\@portraitfoilstrue}{%
957 \@portraitfoilstrue\foilhead[-\foilheadskip]{}}}
958 \newcommand{\landscapefoils}{%
959 \@ifstar{\@portraitfoilsfalse}{%
960 \@portraitfoilsfalse\rotatefoilhead[-\foilheadskip]{}}}
961 % \end{macrocode}
962 % \end{macro}\end{macro}\end{macro}\end{macro}
963 %
964 % \subsection{Sectioning commands}
965 %
966 % The stuff here is mostly stolen from
967 % |classes.dtx|~\cite{classes}---however, we implement the high level
968 % sectioning commands through |\foilhead|.
969 %
970 % \begin{macro}{\chaptermark}
971 % First, mark commands (anybody uses marks for foils out here?) The
972 % file |latex.ltx| defines all of them but |\chaptermark|, so we
973 % will oblige\ldots
974 % \begin{macrocode}
975 \newcommand*\chaptermark[1]{}
976 % \end{macrocode}
977 % \end{macro}
978 %
979 % \begin{macro}{\c@part}
980 % \begin{macro}{\c@chapter}
981 % \begin{macro}{\c@section}
982 % \begin{macro}{\c@subsection}
983 % \begin{macro}{\c@subsubsection}
984 % \begin{macro}{\c@paragraph}
985 % \begin{macro}{\c@subparagraph}
986 % Now the counters: (almost verbatim from |classes.dtx|):
987 % \begin{macrocode}
988 \newcounter {part}
989 \newcounter {chapter}
990 \newcounter {section}
991 \newcounter {subsection}[section]
992 \newcounter {subsubsection}[subsection]
993 \newcounter {paragraph}[subsubsection]
994 \newcounter {subparagraph}[paragraph]
995 % \end{macrocode}
996 % \end{macro}
997 % \end{macro}
998 % \end{macro}
999 % \end{macro}
1000 % \end{macro}
1001 % \end{macro}
1002 % \end{macro}
1003 %
1004 % \begin{macro}{\thepart}
1005 % \begin{macro}{\thechapter}
1006 % \begin{macro}{\thesection}
1007 % \begin{macro}{\thesubsection}
1008 % \begin{macro}{\thesubsubsection}
1009 % \begin{macro}{\theparagraph}
1010 % \begin{macro}{\thesubparagraph}
1011 % \begin{macrocode}
1012 \renewcommand \thepart {\@Roman\c@part}
1013 \renewcommand \thechapter {\@arabic\c@chapter}
1014 \renewcommand \thesection {\@arabic\c@section}
1015 \renewcommand\thesubsection {\thesection.\@arabic\c@subsection}
1016 \renewcommand\thesubsubsection{\thesubsection .\@arabic\c@subsubsection}
1017 \renewcommand\theparagraph {\thesubsubsection.\@arabic\c@paragraph}
1018 \renewcommand\thesubparagraph {\theparagraph.\@arabic\c@subparagraph}
1019 % \end{macrocode}
1020 % \end{macro}
1021 % \end{macro}
1022 % \end{macro}
1023 % \end{macro}
1024 % \end{macro}
1025 % \end{macro}
1026 % \end{macro}
1027 %
1028 % \begin{macro}{\part}
1029 % \begin{macro}{\part*}
1030 % The commands |\part| and |\part*| are implemented through |\secdef|
1031 % macro:
1032 % \begin{macrocode}
1033 \newcommand\part{%
1034 \@afterindentfalse\clearpage
1035 \secdef\@part\@spart}
1036 % \end{macrocode}
1037 % \end{macro}
1038 % \end{macro}
1039 %
1040 % \begin{macro}{\@part}
1041 % \begin{macro}{\@spart}
1042 % The actual typesetting is done by |\@part| and |\@spart|
1043 % commands. They produce foils with just the title on them in
1044 % |\Huge\bfseries| font. By the way, we still print \emph{Logo} and
1045 % \emph{Restriction} on them. Maybe we should set them to null?
1046 % \begin{macrocode}
1047 \def\@part[#1]#2{%
1048 \ifnum \c@secnumdepth >-2\relax
1049 \refstepcounter{part}%
1050 \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
1051 \if@portraitfoils
1052 \foilhead{\huge\bfseries\partname~\thepart\\[1ex]%
1053 \Huge\bfseries #2}%
1054 \else
1055 \rotatefoilhead{\huge\bfseries\partname~\thepart\\[1ex]%
1056 \Huge\bfseries #2}%
1057 \fi
1058 \else
1059 \addcontentsline{toc}{part}{#1}%
1060 \if@portraitfoils
1061 \foilhead{\Huge\bfseries #2}%
1062 \else
1063 \rotatefoilhead{\Huge\bfseries #2}%
1064 \fi
1065 \fi
1066 \markboth{}{}%
1067 \clearpage}
1068 \def\@spart#1{%
1069 \if@portraitfoils
1070 \foilhead{\Huge\bfseries #1}%
1071 \else
1072 \rotatefoilhead{\Huge\bfseries #1}%
1073 \fi
1074 \markboth{}{}%
1075 \clearpage}
1076 % \end{macrocode}
1077 % \end{macro}\end{macro}
1078 %
1079 % \begin{macro}{\chapter}
1080 % \begin{macro}{\chapter*}
1081 % The commands |\chapter| and |\chapter*| are implemented through |\secdef|
1082 % macro:
1083 % \begin{macrocode}
1084 \newcommand\chapter{%
1085 \@afterindentfalse\clearpage
1086 \secdef\@chapter\@schapter}
1087 % \end{macrocode}
1088 % \end{macro}
1089 % \end{macro}
1090 %
1091 % \begin{macro}{\@chapter}
1092 % \begin{macro}{\@schapter}
1093 % The |\@chapter| and |\@schapter| commands produce foils with just
1094 % the title on them in
1095 % |\huge\bfseries| font. Once again, we still print \emph{Logo} and
1096 % \emph{Restriction} on them. Maybe we should set them to null?
1097 % \begin{macrocode}
1098 \def\@chapter[#1]#2{%
1099 \ifnum \c@secnumdepth >-1\relax
1100 \refstepcounter{chapter}%
1101 \addcontentsline{toc}{chapter}{\thechapter\hspace{1em}#1}%
1102 \if@portraitfoils
1103 \foilhead{\LARGE\bfseries\chaptername~\thechapter\\[1ex]%
1104 \huge\bfseries #2}%
1105 \else
1106 \rotatefoilhead{\LARGE\bfseries\chaptername~\thechapter\\[1ex]%
1107 \huge\bfseries #2}%
1108 \fi
1109 \else
1110 \addcontentsline{toc}{chapter}{#1}%
1111 \if@portraitfoils
1112 \foilhead{\huge\bfseries #2}%
1113 \else
1114 \rotatefoilhead{\huge\bfseries #2}%
1115 \fi
1116 \fi
1117 \markboth{}{}%
1118 \clearpage}
1119 \def\@schapter#1{%
1120 \if@portraitfoils
1121 \foilhead{\huge\bfseries #1}%
1122 \else
1123 \rotatefoilhead{\huge\bfseries #1}%
1124 \fi
1125 \markboth{}{}%
1126 \clearpage}
1127 % \end{macrocode}
1128 % \end{macro}\end{macro}
1129 %
1130 % \begin{macro}{\section}
1131 % \begin{macro}{\section*}
1132 % Once again, |\secdef|:
1133 % \begin{macrocode}
1134 \newcommand\section{%
1135 \@afterindentfalse\clearpage
1136 \secdef\@section\@ssection}
1137 % \end{macrocode}
1138 % \end{macro}
1139 % \end{macro}
1140 %
1141 % \begin{macro}{\if@subnewfoil}
1142 % All previous commands had titles on separate foils. Now the situation
1143 % is different: we want the text follow the heading. The only problem
1144 % we have is with subsection: should it start a new foil or not? The
1145 % decision is the following: subsection does not start a new foil only
1146 % if it follows a section title. To implement this we use the mechanism
1147 % similar to |\@nobreak| in standard classes: a flag |\if@subnewfoil|
1148 % is initially set to true. Each section command sets it to false, but
1149 % any new paragraph will set it to true.
1150 % \begin{macrocode}
1151 \newif\if@subnewfoil
1152 \@subnewfoiltrue
1153 % \end{macrocode}
1154 % \end{macro}
1155 %
1156 % \begin{macro}{\@section}
1157 % \begin{macro}{\@ssection}
1158 % The commands |\section| and |\section*| produce new foils with the
1159 % section titles on them. Also, they set |\if@subnewfoil| to false, so
1160 % new subsection will start on the same foil if no new text is
1161 % present.
1162 % \begin{macrocode}
1163 \def\@section[#1]#2{%
1164 \ifnum \c@secnumdepth >0\relax
1165 \refstepcounter{section}%
1166 \addcontentsline{toc}{section}{\thesection\hspace{1em}#1}%
1167 \markboth{\MakeUppercase{\thesection~#2}}{%
1168 \MakeUppercase{\thesection~#2}}%
1169 \if@portraitfoils
1170 \foilhead{\Large\bfseries\thesection~#2}%
1171 \else
1172 \rotatefoilhead{\Large\bfseries\thesection~#2}%
1173 \fi
1174 \else
1175 \addcontentsline{toc}{section}{#1}%
1176 \markboth{\MakeUppercase{#2}}{\MakeUppercase{#2}}%
1177 \if@portraitfoils
1178 \foilhead{\Large\bfseries #2}%
1179 \else
1180 \rotatefoilhead{\Large\bfseries #2}%
1181 \fi
1182 \fi
1183 \global\@subnewfoilfalse\everypar{\global\@subnewfoiltrue\everypar{}}}
1184 \def\@ssection#1{%
1185 \if@portraitfoils
1186 \foilhead{\Large\bfseries #1}%
1187 \else
1188 \rotatefoilhead{\Large\bfseries #1}%
1189 \fi
1190 \markboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}%
1191 \global\@subnewfoilfalse\everypar{\global\@subnewfoiltrue\everypar{}}}
1192 % \end{macrocode}
1193 % \end{macro}\end{macro}
1194 %
1195 % \begin{macro}{\subsection}
1196 % \begin{macro}{\subsection*}
1197 % We start a new page unless immediately after a section title:
1198 % \begin{macrocode}
1199 \newcommand\subsection{%
1200 \@afterindentfalse\if@subnewfoil\clearpage\fi\global\@subnewfoiltrue
1201 \secdef\@subsection\@ssubsection}
1202 % \end{macrocode}
1203 % \end{macro}
1204 % \end{macro}
1205 %
1206 % \begin{macro}{\@subsection}
1207 % \begin{macro}{\@ssubsection}
1208 % \begin{macrocode}
1209 \def\@subsection[#1]#2{%
1210 \ifnum \c@secnumdepth >1\relax
1211 \refstepcounter{subsection}%
1212 \addcontentsline{toc}{subsection}{\thesubsection\hspace{1em}#1}%
1213 \begin{center}\large\bfseries\thesubsection~#2\end{center}%
1214 \else
1215 \addcontentsline{toc}{subsection}{#1}%
1216 \begin{center}\large\bfseries #2\end{center}%
1217 \fi}
1218 \def\@ssubsection#1{%
1219 \begin{center}\large\bfseries #1\end{center}}%
1220 % \end{macrocode}
1221 % \end{macro}\end{macro}
1222 %
1223 % All lower lever headings are shamelessly copied from
1224 % |classes.dtx|~\cite{classes} with one addition: they all set
1225 % |\@subnewfoiltrue|. The quotes are from |classes.dtx|.
1226 %
1227 % \begin{macro}{\subsubsection}
1228 % \begin{quote}
1229 % This gives a normal heading with white space above and below the
1230 % heading, the title set in |\normalsize\bfseries|, and no
1231 % indentation on the first paragraph.
1232 % \end{quote}
1233 % \begin{macrocode}
1234 \newcommand\subsubsection{\global\@subnewfoiltrue%
1235 \@startsection{subsubsection}{3}{\z@}%
1236 {-3.25ex\@plus -1ex \@minus -.2ex}%
1237 {1.5ex \@plus .2ex}%
1238 {\normalfont\normalsize\bfseries}}
1239 % \end{macrocode}
1240 % \end{macro}
1241 %
1242 % \begin{macro}{\paragraph}
1243 % \begin{quote}
1244 % This gives a run-in heading with white space above and to the
1245 % right of the heading, the title set in |\normalsize\bfseries|.
1246 % \end{quote}
1247 % \begin{macrocode}
1248 \newcommand\paragraph{\global\@subnewfoiltrue%
1249 \@startsection{paragraph}{4}{\z@}%
1250 {3.25ex \@plus1ex \@minus.2ex}%
1251 {-1em}%
1252 {\normalfont\normalsize\bfseries}}
1253 % \end{macrocode}
1254 % \end{macro}
1255 %
1256 % \begin{macro}{\subparagraph}
1257 % \begin{quote}
1258 % This gives an indented run-in heading with white space above and
1259 % to the right of the heading, the title set in
1260 % |\normalsize\bfseries|.
1261 % \end{quote}
1262 % \begin{macrocode}
1263 \newcommand\subparagraph{\global\@subnewfoiltrue%
1264 \@startsection{subparagraph}{5}{\parindent}%
1265 {3.25ex \@plus1ex \@minus .2ex}%
1266 {-1em}%
1267 {\normalfont\normalsize\bfseries}}
1268 % \end{macrocode}
1269 % \end{macro}
1270 %
1271 % \subsection{Table of Contents}
1272 %
1273 %
1274 %
1275 %
1276 % First, the typesetting parameters. Once again, from |classes.dtx|:
1277 %
1278 % \begin{macro}{\@pnumwidth}
1279 % \begin{macro}{\@tocrmarg}
1280 % \begin{macro}{\@dotsep}
1281 % \begin{quote}
1282 % This command uses the following three parameters, which are set
1283 % with a |\newcommand| (so em's can be used to make them depend upon
1284 % the font).
1285 % \begin{description}
1286 % \item[\texttt{\bslash @pnumwidth}] The width of a box in which the
1287 % page number is put.
1288 % \item[\texttt{\bslash @tocrmarg}] The right margin for multiple
1289 % line entries. One wants |\@tocrmarg| $\ge$ |\@pnumwidth|
1290 % \item[\texttt{\bslash @dotsep}] Separation between dots, in mu
1291 % units. Should be defined as a number like 2 or 1.7
1292 % \end{description}
1293 % \end{quote}
1294 % \begin{macrocode}
1295 \newcommand\@pnumwidth{1.55em}
1296 \newcommand\@tocrmarg{2.55em}
1297 \newcommand\@dotsep{4.5}
1298 \setcounter{tocdepth}{3}
1299 % \end{macrocode}
1300 % \end{macro}
1301 % \end{macro}
1302 % \end{macro}
1303 %
1304 % \begin{macro}{\@nopagetocline}
1305 % The standard \LaTeX\ kernel~\cite{ltdefns} defines |\@dottedtocline| for
1306 % formatting the Table of Contents entries. We define an analogous
1307 % command for contents line \emph{without} page number. Its parameters
1308 % are the same as for |\@dottedtocline| but the last one (page).
1309 % \begin{macrocode}
1310 \def\@nopagetocline#1#2#3#4{%
1311 \ifnum #1>\c@tocdepth \else
1312 \vskip \z@ \@plus.2\p@
1313 {\leftskip #2\relax
1314 \parindent #2\relax\@afterindenttrue
1315 \interlinepenalty\@M
1316 \leavevmode
1317 \@tempdima #3\relax
1318 \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
1319 {#4}\hfil%
1320 \par}%
1321 \fi}
1322 % \end{macrocode}
1323 % \end{macro}
1324 %
1325 % \begin{macro}{\tableofcontents}
1326 % We implement table of contents as a new |\section*|:
1327 % \begin{macrocode}
1328 \newcommand\tableofcontents{%
1329 \section*{\contentsname}%
1330 \@starttoc{toc}%
1331 \clearpage\global\@subnewfoiltrue}%
1332 % \end{macrocode}
1333 % \end{macro}
1334 %
1335 % The actual typesetting is done by commands |\l@|\meta{name}. Here we
1336 % define them. Once again, verbatim from |classes.dtx| plus check for
1337 % |\if@pagesintoc|.
1338 %
1339 % \begin{macro}{\l@part}
1340 % \begin{quote}
1341 % First we make sure that if a pagebreak should occur, it occurs
1342 % \emph{before} this entry. Also a little whitespace is added and a
1343 % group begun to keep changes local.
1344 % \end{quote}
1345 % \begin{macrocode}
1346 \newcommand*\l@part[2]{%
1347 \ifnum \c@tocdepth >-2\relax
1348 \addpenalty\@highpenalty
1349 \addvspace{2.25em \@plus\p@}%
1350 \begingroup
1351 % \end{macrocode}
1352 % \begin{quote}
1353 % The macro |\numberline| requires that the width of the box that
1354 % holds the part number is stored in \LaTeX's scratch register
1355 % |\@tempdima|. Therefore we put it there.
1356 % \end{quote}
1357 % \begin{macrocode}
1358 \setlength\@tempdima{3em}%
1359 % \end{macrocode}
1360 % \begin{quote}
1361 % The we set |\parindent| to 0pt and use |\rightskip| to leave
1362 % enough room for the pagenumbers. To prevent overfull box messages
1363 % the |\parfillskip| is set to a negative value.
1364 % \end{quote}
1365 % \begin{macrocode}
1366 \parindent \z@
1367 \if@pagesintoc
1368 \rightskip \@pnumwidth
1369 \parfillskip -\@pnumwidth
1370 \fi
1371 % \end{macrocode}
1372 % Unlike standard classes, the entry is set in |\Large| bold font
1373 % (they use |\large|)
1374 % \begin{quote}
1375 % We make sure to
1376 % leave vertical mode, set the part title and add the pagenumber,
1377 % set flush right.
1378 % \end{quote}
1379 % \begin{macrocode}
1380 {\leavevmode
1381 \Large \bfseries #1\hfil
1382 \if@pagesintoc\hb@xt@\@pnumwidth{\hss #2}\fi
1383 }\par
1384 % \end{macrocode}
1385 % \begin{quote}
1386 % Prevent a pagebreak immediately after this entry, but use
1387 % |\everypar| to reset the |\if@nobreak| switch. Finally we close
1388 % the group.
1389 % \end{quote}
1390 % \begin{macrocode}
1391 \nobreak
1392 \global\@nobreaktrue
1393 \everypar{\global\@nobreakfalse\everypar{}}%
1394 \endgroup
1395 \fi}
1396 % \end{macrocode}
1397 % \end{macro}
1398 %
1399 % \begin{macro}{\l@chapter}
1400 % \begin{quotation}
1401 % This macro formats the entries in the table of contents for
1402 % chapters. It is very similar to |\l@part|
1403 %
1404 % First we make sure that if a pagebreak should occur, it occurs
1405 % \emph{before} this entry. Also a little whitespace is added and a
1406 % group begun to keep changes local.
1407 % \end{quotation}
1408 % \begin{macrocode}
1409 \newcommand*\l@chapter[2]{%
1410 \ifnum \c@tocdepth >\m@ne
1411 \addpenalty{-\@highpenalty}%
1412 \vskip 1.0em \@plus\p@
1413 % \end{macrocode}
1414 % \begin{quote}
1415 % The macro |\numberline| requires that the width of the box that
1416 % holds the part number is stored in \LaTeX's scratch register
1417 % |\@tempdima|. Therefore we put it there. We begin a group, and
1418 % change some of the paragraph parameters.
1419 % \end{quote}
1420 % \begin{macrocode}
1421 \setlength\@tempdima{1.5em}%
1422 \begingroup
1423 \parindent \z@
1424 \if@pagesintoc
1425 \rightskip \@pnumwidth
1426 \parfillskip -\@pnumwidth
1427 \fi
1428 % \end{macrocode}
1429 % Then we leave vertical mode and switch to a large bold font.
1430 % \begin{macrocode}
1431 \leavevmode \large\bfseries
1432 % \end{macrocode}
1433 % \begin{quote}
1434 % Because we do not use |\numberline| here, we have do some fine
1435 % tuning `by hand', before we can set the entry. We discourage but
1436 % not disallow a pagebreak immediately after a chapter entry.
1437 % \end{quote}
1438 % \begin{macrocode}
1439 \advance\leftskip\@tempdima
1440 \hskip -\leftskip
1441 #1\nobreak\hfil
1442 \if@pagesintoc\nobreak\hb@xt@\@pnumwidth{\hss #2}\fi\par
1443 \penalty\@highpenalty
1444 \endgroup
1445 \fi}
1446 % \end{macrocode}
1447 % \end{macro}
1448 %
1449 % \begin{macro}{\l@section}
1450 % Our class is a sort of a cross between article and book/report.
1451 % Therefore we want the special formatting used in the article
1452 % class\ldots
1453 % \begin{quotation}
1454 % In the article document class the entry in the table of contents
1455 % for sections looks much like the chapter entries for the report
1456 % and book document classes.
1457 %
1458 % First we make sure that if a pagebreak should occur, it occurs
1459 % \emph{before} this entry. Also a little whitespace is added and a
1460 % group begun to keep changes local.
1461 % \end{quotation}
1462 % \begin{macrocode}
1463 \newcommand*\l@section[2]{%
1464 \ifnum \c@tocdepth >\z@
1465 \addpenalty\@secpenalty
1466 \addvspace{1.0em \@plus\p@}%
1467 % \end{macrocode}
1468 % \begin{quote}
1469 % The macro |\numberline| requires that the width of the box that
1470 % holds the part number is stored in \LaTeX's scratch register
1471 % |\@tempdima|. Therefore we put it there. We begin a group, and
1472 % change some of the paragraph parameters.
1473 % \end{quote}
1474 % \begin{macrocode}
1475 \setlength\@tempdima{1.5em}%
1476 \begingroup
1477 \parindent \z@
1478 \if@pagesintoc
1479 \rightskip \@pnumwidth
1480 \parfillskip -\@pnumwidth
1481 \fi
1482 % \end{macrocode}
1483 % \begin{quote}
1484 % Then we leave vertical mode and switch to a bold font.
1485 % \end{quote}
1486 % \begin{macrocode}
1487 \leavevmode \bfseries
1488 % \end{macrocode}
1489 % \begin{quote}
1490 % Because we do not use |\numberline| here, we have do some fine
1491 % tuning `by hand', before we can set the entry. We discourage but
1492 % not disallow a pagebreak immediately after a chapter entry.
1493 % \end{quote}
1494 % \begin{macrocode}
1495 \advance\leftskip\@tempdima
1496 \hskip -\leftskip
1497 #1\nobreak\hfil
1498 \if@pagesintoc\nobreak\hb@xt@\@pnumwidth{\hss #2}\fi\par
1499 \endgroup
1500 \fi}
1501 % \end{macrocode}
1502 % \end{macro}
1503 %
1504 % \begin{macro}{\l@subsection}
1505 % \begin{macro}{\l@subsubsection}
1506 % \begin{macro}{\l@paragraph}
1507 % \begin{macro}{\l@subparagraph}
1508 % Lower level headings are made through |\@dottedtocline| and
1509 % |\@nopagetocline|:
1510 % \begin{macrocode}
1511 \newcommand*\l@subsection[2]{%
1512 \if@pagesintoc
1513 \@dottedtocline{2}{1.5em}{2.3em}{#1}{#2}%
1514 \else
1515 \@nopagetocline{2}{1.5em}{2.3em}{#1}%
1516 \fi}
1517 \newcommand*\l@subsubsection[2]{%
1518 \if@pagesintoc
1519 \@dottedtocline{3}{3.8em}{3.2em}{#1}{#2}%
1520 \else
1521 \@nopagetocline{3}{3.8em}{3.2em}{#1}%
1522 \fi}
1523 \newcommand*\l@paragraph[2]{%
1524 \if@pagesintoc
1525 \@dottedtocline{4}{7.0em}{4.1em}{#1}{#2}%
1526 \else
1527 \@nopagetocline{4}{7.0em}{4.1em}{#1}%
1528 \fi}
1529 \newcommand*\l@subparagraph[2]{%
1530 \if@pagesintoc
1531 \@dottedtocline{5}{10em}{5em}{#1}{#2}%
1532 \else
1533 \@nopagetocline{5}{10em}{5em}{#1}%
1534 \fi}
1535 % \end{macrocode}
1536 % \end{macro}
1537 % \end{macro}
1538 % \end{macro}
1539 % \end{macro}
1540 %
1541 % \subsection{Bibliography}
1542 % \begin{macro}{\thebibliography}
1543 % Jim Hafner~\cite{FoilTeX} reimplemented |\thebibliography|. He deleted
1544 % the |\section*| command. Now we put it back!
1545 % \begin{macrocode}
1546 \renewenvironment{thebibliography}[1]{
1547 \section*{\refname}
1548 \list{\@biblabel{\arabic{enumiv}}}%
1549 {\settowidth\labelwidth{\@biblabel{#1}}%
1550 \leftmargin\labelwidth
1551 \advance\leftmargin\labelsep
1552 \if@openbib
1553 \advance\leftmargin\bibindent
1554 \itemindent -\bibindent
1555 \listparindent \itemindent
1556 \parsep \z@
1557 \fi
1558 \usecounter{enumiv}%
1559 \let\p@enumiv\@empty
1560 \renewcommand\theenumiv{\arabic{enumiv}}}
1561 \if@openbib
1562 \renewcommand\newblock{\par}
1563 \else
1564 \renewcommand\newblock{\hskip .11em \@plus .33em \@minus -.07em}
1565 \fi
1566 \sloppy\clubpenalty4000\widowpenalty4000%
1567 \sfcode`\.=\@m\relax}%
1568 {\def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
1569 \endlist}
1570 % \end{macrocode}
1571 % \end{macro}
1572 %
1573 % \subsection{Names}
1574 %
1575 % \begin{macro}{\contentsname}
1576 % \begin{macro}{\partname}
1577 % \begin{macro}{\chaptername}
1578 % We add names for Table of Contents, chapters and parts.
1579 % \begin{macrocode}
1580 \newcommand\contentsname{Outline}%
1581 \newcommand\partname{Part}%
1582 \newcommand\chaptername{Chapter}%
1583 % \end{macrocode}
1584 % \end{macro}
1585 % \end{macro}
1586 % \end{macro}
1587 %
1588 % \subsection{Wrapping up}
1589 %
1590 % And now let us finish this |\if@undefined| stuff
1591 % \begin{macrocode}
1592 }
1593 % \end{macrocode}
1594 %
1595 % \Finale
1596 % \clearpage
1597 % \PrintChanges
1598 % \clearpage
1599 % \PrintIndex
1600 %
1601 \endinput
1602
1603
1604
1605
1606
1607
1608