From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/section/section-doc.pdf | Bin 0 -> 349952 bytes macros/latex/contrib/section/section-doc.tex | 506 ++++++++++++++++++++ macros/latex/contrib/section/section.sty | 691 +++++++++++++++++++++++++++ 3 files changed, 1197 insertions(+) create mode 100644 macros/latex/contrib/section/section-doc.pdf create mode 100644 macros/latex/contrib/section/section-doc.tex create mode 100644 macros/latex/contrib/section/section.sty (limited to 'macros/latex/contrib/section') diff --git a/macros/latex/contrib/section/section-doc.pdf b/macros/latex/contrib/section/section-doc.pdf new file mode 100644 index 0000000000..6caa737287 Binary files /dev/null and b/macros/latex/contrib/section/section-doc.pdf differ diff --git a/macros/latex/contrib/section/section-doc.tex b/macros/latex/contrib/section/section-doc.tex new file mode 100644 index 0000000000..172ce7835e --- /dev/null +++ b/macros/latex/contrib/section/section-doc.tex @@ -0,0 +1,506 @@ +\documentclass[pagesize=auto, numbers=enddot]{scrartcl} + +\usepackage{fixltx2e} +\usepackage{etex} +\usepackage{xspace} +\usepackage{lmodern} +\usepackage[T1]{fontenc} +\usepackage{textcomp} +\usepackage{array} +\usepackage{microtype} +\usepackage{hyperref} + +\newcommand*{\mail}[1]{\href{mailto:#1}{\texttt{#1}}} +\newcommand*{\pkg}[1]{\textsf{#1}} +\newcommand*{\cls}[1]{\textsf{#1}} +\newcommand*{\cs}[1]{\texttt{\textbackslash#1}} +\makeatletter +\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}} +\makeatother +\newcommand*{\meta}[1]{\textlangle\textsl{#1}\textrangle} +\newcommand*{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}} +\newcommand*{\oarg}[1]{\texttt{[}\meta{#1}\texttt{]}} + +\addtokomafont{title}{\rmfamily} +\deffootnote{1em}{1em}{\textsuperscript{\thefootnotemark}} + +\title{The \pkg{section} package\thanks{This manual corresponds to \pkg{section.sty}~v1.4, dated~10 Mar 99.}} +\author{Oliver Pretzel\thanks{\mail{o.pretzel@ic.ac.uk}}} +\date{10 Mar 99} + + +\begin{document} + +\maketitle + +\begin{abstract} + \noindent + Leslie Lamport in writing \LaTeX\ assumed that authors would write + complete \texttt{.sty} (\texttt{.clo}) files to implement the design decisions for their + publications. However, the overwhelming majority of \LaTeX\ publications use the + standard styles supplied by Lamport. These implement a particular set of + typographic conventions, which while consistent are not of universal validity, + for instance many publishers and authors would like a full stop: + `4. Introduction' + rather than + `4 Introduction'. + + This file modifies the standard classes so that other conventions can be + more easily implemented. Careful use of the file will allow a greater + variation in the appearance of \LaTeX\ documents. +\end{abstract} + + +\setcounter{section}{-1} +\section{Changes to section implementation.} + +The file redefines the way \LaTeX\ deals with negative indents for section +headings, placing the number in the margin and the heading itself flush +with the margin. With negative indents it sets starred section headings +flush (as it does when \cmd{\thesection} is empty. +Standard \LaTeX\ indenting can be produced by typing +% +\begin{verbatim} +>> \let\ifind\iffalse +\end{verbatim} +% +This file's version can be reestablished by typing +% +\begin{verbatim} +>> \let\ifind\ifdim +\end{verbatim} + +The file also changes the way \LaTeX\ reacts to empty numbers when sections have +non-negative indents, placing the heading where the number would go, rather +than further indented (as in standard \LaTeX). +This effect can be removed by redefining an internal macro \cmd{\@makesvsec} (see +below). + +The indents, pre- and postskips for section headings are placed in registers +so that they are constant throughout a document and (just as the heading sizes) +do not react to surrounding size changes. You can change this back to ordinary +\LaTeX\ behaviour by \cmd{\def}ing them as macros rather than setting the register +values (in that case you should probably use \verb|\smaller\larger| from +\pkg{SMALLER.STY} for the \cmd{\...size} commands). + +\emph{WARNING}\quad\LaTeX\ typesets headings that run on by manipulating \cmd{\everypar}. If you +make local changes to the heading style of such a section inside braces or a +group you must ensure that a non-empty paragraph occurs before the closing +brace. Otherwise some strange effects may occur, because the \cmd{\everypar} tokens +will be evaluated outside the group (this is a feature of \LaTeX, not of +\pkg{SECTION.STY}). If your group ends with an empty section of this type just +follow it with \cmd{\leavevmode} or an explicit space: \verb*|\ |. + +A detailed description of the format of \LaTeX\ sectioning commands is given +below (in paragraph~\ref{sec:9}). This is partially taken from the file \texttt{LATEX.TEX}. +We first list the macros for local control which you can use without knowing +this structure. + +The file sets vertical distances that \LaTeX\ expressed in terms of `em's and +`ex's in equivalent `\cmd{\baselineskip}'s, as `em' is a measure of the horizontal +size of a font and `ex' is not a true measure of the full height of a line. +Earlier vesions used `ex's. + +The original values are placed as comments. + + +\section{Sizing commands for Parts, Chapters and Titles etc} + +These are set to \cmd{\large} or whatever +% +\begin{flushleft} + \begin{tabular}{@{}>{\texttt{>{}> }}lll@{}} + \cmd{\chsize}: & Chapter, Part Heading & (\verb|\LARGE\large|) \\ + \cmd{\hdsize}: & Chapter, Part Title Text & (\verb|\Huge\huge\LARGE|) \\ + \cmd{\ttsize}: & Title of Document & (\verb|\Huge\huge\LARGE|) \\ + \cmd{\ausize}: & Author & (\verb|\LARGE\Large|) \\ + \cmd{\dasize}: & Date. & (\verb|\Large\large|) \\ + \cmd{\secsize}: & Section & (\verb|\Large\large|) \\ + \cmd{\subsize}: & Subsection & (\verb|\large\normalsize|) + \end{tabular} +\end{flushleft} +% +\texttt{subsubsection} and below use \cmd{\normalsize} + + +\section{Layout commands for headings.} + +\begin{itemize} +\item + \cmd{\hdpos}: Positioning of heading (\cmd{\raggedright}) (\cmd{\centering} \cmd{\raggedleft}) + (see section~\ref{sec:9}); + +\item counter \texttt{hddpth} (default~0) \\ + Maximum section level for \cmd{\hdpos} (chapters and parts \emph{ALWAYS} use \texttt{hdpos}). + To centre section headings and above: +\begin{verbatim} +\let\hdpos\centering\setcounter{hddepth}{1} +\end{verbatim} + +\item \cmd{\fpind}: Indenting of first paragraph after \cmd{\Part} \cmd{\Chapter} + and also to override setting via \meta{preskip} for sections. + \cmd{\let} to \cmd{\@afterindenttrue} to indent, \cmd{\@afterindentfalse} for flush, + \cmd{\relax}: flush after \cmd{\Part} \cmd{\Chapter}, negative \meta{preskip}s; indented otherwise + (\LaTeX\ default behaviour). +\end{itemize} + + +\section{Fonts} + +\begin{itemize} +\item \cmd{\ttfnt}: font for title entries. +\item \cmd{\hdfnt}: font for all other headings (Part, Chapter \dots\ subparagraph). +\item \cmd{\fefnt}: font for theorem headings and description labels (\texttt{fe} = feature). +\item \cmd{\thfnt}: font for theorem statements. +\item \cmd{\pgfnt}: font for page numbers. +\item \cmd{\mkfnt}: font for page headings (\texttt{mk} = mark). +\item \cmd{\mkcse}: case for page headings. + These can also be used to add other initial commands such as spaces or + symbols. +\end{itemize} + + +\section{Optional punctuation (standard|my preference)} %| + +These marks are transferred via auxiliary files for tables of contents etc. +They should be \cmd{\def}'d if their current value is to be transferred, and \cmd{\let} +if the value in force when the file auxiliary is read should be used. + +\begin{flushleft} + \begin{tabular}{@{}>{\texttt{>{}> }}lll@{}} + \cmd{\hddot} & (\verb+{}+|\verb+.+) & (after inline headings, theorems etc) \\ %| + \cmd{\cpdot} & (\verb+:+|\verb+.+) & (in figure/table captions - also apears in list of figures. \\ %| + \cmd{\nmdot} & (\verb+{}+|\verb+.+) & (after section numbers etc) \\ %| + \end{tabular} +\end{flushleft} +% +If these are \cmd{\let} to a single letter they are not expanded in the +\texttt{.toc}\dots\ files. So to remove \cmd{\cpdot} from list of figures: +% +\begin{verbatim} +\let\cpdot\relax\listoffigures\let\cpdot: +\end{verbatim} + + +\section{Spacing parameters.} + +The macros for chapters and parts have been altered so that all the +vertical spacing commands are in a single macro in each case. +% +\begin{itemize} +\item + \cmd{\part} inserts initial vertical space directly (preceded by \verb+\hbox{}+ if it + is to be immovable) and passes the space between Part n and title + in \cmd{\@tempskipa} and the space below the heading in \cmd{\@tempskipb}. + +\item + Both \cmd{\chapter} and \cmd{\chapter*} call \cmd{\@makechapterhead}\marg{chaptertitle}. + This passes \marg{chaptertitle} on to \cmd{\@makeschapterhead} together with the + vertical spacing. Default setting is +% +\begin{verbatim} +\def\@makechapterhead#1{% + \hbox{}\@makeschapterhead{#1}{50\p@}{20\p@}{40\p@}} +\end{verbatim} +% + \verb+\hbox{}+ makes first skip immovable, + the first length is space above the heading, + The second is the space between Chapter nn and the chapter title + The third is the space below the heading. + For both Part and Chapter the middle space is removed if either the + section name or title are missing. + If both are missing, the first space is also removed + +\item + \begin{sloppypar} + For sections and below the spaces are kept in registers: + \cmd{\secpreskp} and \cmd{\secpsrskp} \cmd{\secindent} used for \cmd{\section} + \cmd{\subpreskp} and \cmd{\subpstskp} \cmd{\subindent} used for \cmd{\subsection}/\cmd{\subsubsection} + \cmd{\paragraph} uses \cmd{\subindent} \cmd{\subpreskp} \cmd{\parpstskp} + \cmd{\subparagraph} uses \cmd{\parindent} \cmd{\subpreskp} \cmd{\parpstskp} + \end{sloppypar} + +\item + \cmd{\secindent} \cmd{\subindent}\quad Heading indentation + +\item + \cmd{\secpreskp} \cmd{\subpreskp}\quad Space before + +\item + \cmd{\secpstskp} \cmd{\subpstskp} \cmd{\parpstskp}\quad Space after. +\end{itemize} + + +\section{Internal modifications} + +Sections with negative indents have heading flush with margin. + +If \cmd{\thesection} is \cmd{\empty} +% +\begin{flushleft} + \verb+\let\thesection\empty+ or \verb+\def\thesection{}+ +\end{flushleft} +% +then \texttt{section} does not step the section counter. +If the section produces empty output for a value then +the section will start flush at the margin or \cmd{\secindent} if it is positive +and there will be no \cmd{\nmdot}. +It will produce (flush) page headings and a table of contents entry. +Similarly if \cmd{\thechapter} or \cmd{\thepart} are defined to be empty they will +suppress the heading line `Chapter\dots'\ and not step the counter. +To restore standard \LaTeX\ behaviour temporarily define \cmd{\thesection} to be +\cmd{\empty} +% +\begin{verbatim} +\def\thesection{\empty} +\end{verbatim} +% +In that case you can adjust post number spacing in the heading. +% +\begin{verbatim} +\section[Heading]{\hskip-1em Heading} +\end{verbatim} +% +You can also redefine \cmd{\@makesecdot} see paragraph~\ref{sec:7}. + +\emph{WARNING}\quad\cmd{\let}ting \cmd{\thesection} etc to an unexpandable token (like \cmd{\relax}) will +cause strange effects under \LaTeX\ because its value will not be expanded. + +\cmd{\maketitle} suppresses page headings (\verb+\thispagestyle{empty}+) and only resets +\cmd{\@title} etc locally. So place in a group if you want to preserve these for +later reference (eg.\ in headers). + + +\section{New internal macros} +\label{sec:7} + +Place any modifications in the section \texttt{REDEFINITIONS} of the main code +% +\begin{itemize} +\item \cmd{\@secdot} contains section number and \cmd{\nmdot} if the number is non-empty. + +\item \cmd{\@makesecdot}\marg{NAME} defines \cmd{\@secdot}. + To make \LaTeX\ step the section counter independently of the definition + of \cmd{\thesection} and always print \cmd{\nmdot}: +\begin{verbatim} +\def\@makesecdot#1{\refstepcounter{#1}% + \edef\@secdot{\csname the#1\endcsname}} +\end{verbatim} + If you want \cmd{\nmdot} suppressed when \cmd{\thesection} produces no output: +\begin{verbatim} +\def\@makesecdot#1{\refstepcounter{#1}% + \edef\@secdot{% + \expandafter\@gobifnul\csname the#1\endcsname\nmdot}} +\end{verbatim} + +\item \cmd{\@makesvsec}\marg{INDENT} defines the \cmd{\@svsec} macro used by \LaTeX\ to typeset the + section number\dots Its parameter is the indent so that it can react + differently to negative indents. (it does \emph{NOT} make the indent). + To obtain standard \LaTeX\ behaviour: +\begin{verbatim} +\def\@makesvsec#1{\def\@svsec{\@secdot\quad}} +\end{verbatim} + To make positioning commands apply to the heading ignoring the number: +\begin{verbatim} +\def\@makesvsec#1{\def\@svsec{\llap{@secdot\quad}}} +\end{verbatim} + Do \emph{NOT} forget the \verb+#1+. + +\item \cmd{\@contmark}\marg{NAME}\marg{LEVEL}\marg{HEADING} makes contents line and sectionmark. +\end{itemize} + +Contents headlines are defined by +% +\begin{itemize} +\item \cmd{\@tocheadline}\quad + This allows these lines to be adjusted similarly to the \cmd{\@dotted\-tocline} + commands for other contents lines. The format of these is defined below (in + paragraph~\ref{sec:11}). + +\item \verb+@tocpagenum#1+ sets \verb+#1+ flush right in \cmd{\@tocheadline}. \\ + Redefine (\verb+\let\@tocpagenum\@gobble+) to remove page numbers. +\begin{verbatim} +\def\l@part{\@tocheadline{0}{2.25em}{3em}{\let\@tocpagenum\@gobble + \centering\large\bf}} +\end{verbatim} + Centres parts lines of contents but leaves chapters unchanged +\begin{verbatim} +\def\l@part{\@tocheadline{0}{2.25em}{3em}{\let\@tocpagenum\@gobble + \centering\def\numberline##1{\hskip-\secindent + \hbox to\secindent{##1\hfil}}\large\bf}}# +\end{verbatim} + Same but centring ignores part number. +\begin{verbatim} +\def\l@part{\@tocheadline{0}{2.25em}{3em}{\let\@tocpagenum\@gobble + \centering\def\numberline##1{\hfilneg + \hbox to\z@{##1\hss}\hfil}\large\bf}} +\end{verbatim} + Centres heading with number flush left\\ + Contents lines use \cmd{\secindent} as a temporary register + +\item \cmd{\makeheading} (set to \cmd{\section*}, \cmd{\chapter*}) + Makes headings for contents, index etc. + To put Contents itself in the contents list, redefine (locally): +\begin{verbatim} +\let\thesection\empty\let\makeheading\section +\end{verbatim} +\end{itemize} + + +\section{Additional macros} + +\begin{itemize} +\item \cmd{\@ifempty}\marg{test}\marg{yes}\marg{no} like \cmd{\@ifundefined} but tests for empty + (fails iff test starts with \verb+~+ of catcode~12 (other)). +\item \cmd{\@gobifnul}\marg{a}\marg{b} = \cmd{\@ifempty}\marg{a}\verb+{}{+\meta{a}\meta{b}\verb+}+. +\end{itemize} + + +\section{Description of sectioning values} +\label{sec:9} + +\cmd{\@startsection}\marg{NAME}\marg{LEVEL}\marg{INDENT}\marg{PRESKIP}\marg{POSTSKIP} \\ +\hphantom{\cmd{\@startsection}}\marg{STYLE}\meta{optional~\texttt{*}}\oarg{ALTHEADING}\marg{HEADING} \\ +Generic command to start a section. +% +\begin{flushleft} + \begin{tabular}{@{}p{0.2\linewidth}@{\makebox[0.03\linewidth]{:}}p{0.77\linewidth}@{}} + \meta{NAME} & e.\,g.,\ `\texttt{subsection}' must be the name of a section counter \\ + \meta{LEVEL} & a number, denoting depth of section~-- section~=~1; number increases down the hierarchy. \\ + \meta{INDENT} & Indentation of heading from left margin \\ + \meta{PRESKIP} & Absolute value~=~skip to leave above the heading. If negative, then paragraph indent of text following heading is suppressed. \\ + \meta{POSTSKIP} & if positive, then skip to leave below heading, else negative of skip to leave to right of run-on heading. \\ + \meta{ALTHEADING} & for page headings and contents. \\ + \meta{STYLE} & commands to set style + \end{tabular} +\end{flushleft} +% +If `\texttt{*}' missing, then increments the counter. If it is present, then +there should be no \meta{ALTHEADING} argument. +Uses the counter `\texttt{secnumdepth}' whose value is the highest section +level that is to be numbered and entered into \cmd{\@dottedtocline}. + + +\section{Treatment of Section Entries} + +\begin{description} +\item[\meta{NAME} (fixed)] + Determines the counter to use. + +\item[\meta{LEVEL} (fixed)] + If level is greater than \verb|\counter{secnumdepth}| (default~2) no + indexentry or number + +\item[\meta{INDENTS}:] + \cmd{\secindent} (sections), \cmd{\subindent} (subsections, \dots\ ,paragraphs). + Subparagraphs have \cmd{\parindent} fixed. These are dimensions. + + Recommended: $\pm\cmd{\parindent}$ or 0\,pt + + If indent is negative then \pkg{SECTION.STY} causes the section number to be set + flush right that distance from margin. Heading or text follows at the margin + itself. + + Unnumbered headings are set at the margin if indent is negative. If the + indent is non-negative they are set flush left with the number position. + +\item[\meta{PRESKIPS}] + \cmd{\secpreskp} (sections), \cmd{\subpreskp} (subsections \dots\ subparagraphs) + +\item[\meta{POSTSKIPS}] + \cmd{\secpstskp} (sections), \cmd{\subpstskp} (subsections, subsubsections) \\ + \cmd{\parpstskp} (paragraphs, subparagraphs) + + Recommended: leave \meta{PRESKIPS}' abs values unchanged, They are set $-$ve to + have flush first paragraphs. Use \cmd{\secpreskp}--\cmd{\secpreskp} to indent them. \\ + Recommended: set \meta{POSTSKIPS} to $-1$\,em or $-\cmd{\parindent}$ to make sections run on. + + By assigning these values to registers \pkg{SECTION.STY} makes them independent of + the surrounding font and size. Set the registers if you want this, redefine + them as macros if you want them to be font and size dependent. + +\item[\meta{STYLE}] + \cmd{\secsize} \cmd{\subsize} \cmd{\hdfnt} size and fonts. + \cmd{\secsize} for sections, + \cmd{\subsize} for subsections. + Subsubsections and below have \cmd{\normalsize} (fixed). + \cmd{\hdfnt} is universal for all headings. +\end{description} + + +\section{Contents entries.} +\label{sec:11} + +\cmd{\@tocheadline}\marg{LEVEL}\marg{PRESKIP}\marg{INDENT}\marg{STYLE} \\ +\hphantom{\cmd{\@tocheadline}}\marg{ENTRY}\marg{PAGENUM} \\ +\cmd{\@dottedtocline}\marg{LEVEL}\marg{MARGIN}\marg{INDENT}\marg{ENTRY}\marg{PAGENUM} + +\begin{flushleft} + \begin{tabular}{@{}p{0.145\linewidth}@{\makebox[0.03\linewidth]{:}}p{0.825\linewidth}@{}} + \meta{LEVEL} & determines if entry made. \\ + \meta{PRESKIP} & vertical gap above. \\ + \meta{INDENT} & This must leave enough room for the chapter or section number \newline It is added to the margin for the next level. \\ + \meta{MARGIN} & Left margin inherited from level above (zero for headlines). \\ + \meta{STYLE} & Font sizing and setting. \\ + \end{tabular} +\end{flushleft} +% +\LaTeX\ assumes that the \meta{ENTRY} for sections be defined by a macro \cmd{\l@section}. +These are defined in the standard document styles but can be changed. +All entries of the \cmd{\l@section} commands are fixed. \pkg{SECTION.STY} does not +change the commands using \cmd{\@dottedtocline} in the style file. Those that do +not do so (\cmd{\l@part}, \cmd{\l@chapter}) are modified to use \cmd{\@tocheadline}. + +\meta{INDENT} for sections in \cls{article} and chapters in \cls{report} is rather tight at +1.5\,em. If you increase it should also increase the \meta{MARGIN}S for lower +sections. + + +\section{The following internal \LaTeX\ macros are redefined:} + +\begin{flushleft} + \begin{tabular}{@{}>{\raggedright\arraybackslash}p{0.3\linewidth}p{0.67\linewidth}@{}} + \cmd{\part} \cmd{\@part} \cmd{\@spart} \cmd{\@endpart} \cmd{\@chapter} \cmd{\@schapter} & (also \cs{fi} moved) \\ + \cmd{\@makechapterhead} \cmd{\@makeschapterhead} & functions of these have been significantly changed. \\ + \cmd{\ps@headings} \cmd{\ps@myheadings} \\ + \cmd{\section} \cmd{\subsection} \cmd{\subsubsection} \cmd{\paragraph} \cmd{\subparagraph} \\ + \cmd{\thebibliography} \cmd{\theindex} \\ + \cmd{\@begintheorem} \cmd{\@oparbegintheorem} \\ + \cmd{\@makecaption} & optional style features added \\ + \cmd{\@startsection} & \cmd{\fpind} and does not pass \verb|#4| to \cmd{\@sect}, \cmd{\@ssect} \\ + \cmd{\@sect}, \cmd{\@ssect} & ignored parameter removed \newline \cmd{\llap} \cmd{\@secdot} used to adjust spacing if \cmd{\p@section} defined used for number style. calls \cmd{\@makesecdot} \newline \cmd{\@sect} only: \cmd{\@makesvsec} and \cmd{\@contmark}, which is moved in \cmd{\@svsechd} so that \cmd{\unskip} in \cmd{\@xsect} works). \\ + \cmd{\maketitle} \cmd{\@maketitle} & suppress page number, reset \cmd{\@title}\dots\ locally \\ + \cmd{\numberline} & adds space after number, so overfull box if too close to heading. \\ + \end{tabular} +\end{flushleft} + + +\section*{Changes} + +\begin{description} +\item[Ver 1.3 (3. Apr 98)] + If $\cmd{\secindent} < 0$, then \cmd{\section*} produces a flush heading, not outdented. + \cmd{\hdpos} takes level as parameter and is used for all sections, not just + \cmd{\part} and \cmd{\chapter}. + `ex' measurements replaced by \cmd{\baselineskip} equivalents. + +\item[Ver 1.31] + Bugfix: \cmd{\relax} added to \cmd{\@alph}, \cmd{\@Alph} to enable use with \cmd{\@ifempty} test. + +\item[Ver 1.32] + \begin{sloppypar} + Bugfixes: \cmd{\hdpos} added to \cmd{\@ssect}, unused macro \cmd{\secpos} removed, + \cmd{\nobreak} added after \cmd{\thechapter} in \cmd{\makechapterhead} + \end{sloppypar} + +\item[Ver 1.4] + \cmd{\hdpos} made simple macro again. Counter \cmd{\hddepth} determines when it + should be used. Functions of \cmd{\@makechapterhead}, \cmd{\@smakechapterhead} + changed to make editing vertical spacing of chapters easier. + \cmd{\part}\cmd{\@part}\cmd{\@spart} rewritten so that all spacing info in \cmd{\part}. + \cmd{\part} calls \cmd{\@spart} which finishes off the heading. +\end{description} +% +Memory use $< 200$ words. + +\end{document} diff --git a/macros/latex/contrib/section/section.sty b/macros/latex/contrib/section/section.sty new file mode 100644 index 0000000000..11fdd0e9f7 --- /dev/null +++ b/macros/latex/contrib/section/section.sty @@ -0,0 +1,691 @@ +% SECTION.STY +% (c) (1992-1994) Oliver Pretzel (o.pretzel@ic.ac.uk) +% Created 29 Oct 94 version 1.4: 10 Mar 99. +% For use with Latex Standard Styles +% Adds control of section heading style to standard LaTeX. +% For LaTeX2.09 (OFSS and NFSS) and LaTeX2e. +% +% Optional features are set to standard. +% +% DOCUMENTATION at end of file +% +% WARNING: conflicts with REFMAN.STY. +% +% ALL RIGHTS RESERVED +% +% This file may be distributed freely. +% It may be modified for local use (please inform me of such modifications) +% Modified versions may only be distributed if +% 1. The name is changed +% 2. A statement acknowledging the modification heads the file. +% +% DO NOT USE \neq in this file +\chardef\neq\the\catcode`\@ +\makeatletter\@makeother\" +% +\typeout{`section.sty' <1.4>} +%************************* +\ifx\reset@font\undefined\let\reset@font\relax\fi +% +% Options +% +\ifx\secindent\undefined + \newdimen\secindent + \newskip\secpreskp + \newskip\secpstskp + \newdimen\subindent + \newskip\subpreskp + \newskip\subpstskp + \newskip\parpstskp + \newcount\c@hddepth +\fi +%implict multiplication removes stretch +\secindent0pt% no indentation +\secpreskp1.2\baselineskip plus .35\baselineskip minus.07\baselineskip +%\secpreskp3.5ex plus 1 ex minus.2ex +\secpreskp-\secpreskp +\secpstskp.8\baselineskip plus .07\baselineskip +%\secpstskp2.3ex plus .2ex +\subindent0pt +\subpreskp1.13\baselineskip plus .35\baselineskip minus.07\baselineskip +%\subpreskp3.25ex plus 1 ex minus.2ex +\subpreskp-\subpreskp +\subpstskp.53\baselineskip plus.07\baselineskip +%\subpstskp1.5ex plus.2ex +\parpstskp-.8\baselineskip +%\parpstskp-1em +\ifx\chapter\undefined + \def\chsize{\Large}\def\hdsize{\huge}\else + \def\chsize{\huge}\def\hdsize{\Huge} +\fi +\let\ttsize\LARGE +\let\ausize\large +\let\dasize\large +\let\hdpos\raggedright +\c@hddepth\z@ +\let\secsize\Large +\let\subsize\large +\let\fpind\relax +% +\def\nmdot{} +\def\cpdot{:} +\def\hdfnt{\reset@font\bf} +\def\ttfnt{\reset@font\rm} +\def\pgfnt{\reset@font\rm} +\def\mkfnt{\reset@font\sl} +\let\mkcse\uppercase +\def\hddot{} +\def\fefnt{\reset@font\bf} +\def\thfnt{\reset@font\it} +% +\def\fnum@figure{\figurename~\thefigure\cpdot} +\def\fnum@table{\tablename~\thetable\cpdot} +% +% +% theorems +% +\def\@begintheorem#1#2{% + \trivlist \item[\hskip \labelsep{\fefnt #1\ #2\hddot}]\thfnt} +\def\@opargbegintheorem#1#2#3{\trivlist + \item[\hskip \labelsep{\fefnt #1\ #2\ (#3)\hddot}]\thfnt} +% +{\@makeother\~ +\long\gdef\@ifempty#1#2#3{\if~#1~#2\else#3\fi} +} +\long\def\@gobifnul#1#2{\@ifempty{#1}\@empty{#1#2}} +%\@Alph and \@alph \relax added to allow \@ifempty test when counter<=0 +\def\@alph#1{% + \ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or + k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or + y\or z\else\@ctrerr\fi\relax} +\def\@Alph#1{% + \ifcase#1\or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or + K\or L\or M\or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or + Y\or Z\else\@ctrerr\fi\relax} +%LaTeX 209 +\ifx\@ialph\undefined\else\let\@ialph\undefined\let\@Ialph\undefined\fi +% +% Figures and Tables +% +\long\def\@makecaption#1#2{\vskip 10\p@ + \setbox\@tempboxa\hbox{#1\ #2}\ifdim \wd\@tempboxa >\hsize + #1\ #2\par\else\hbox to\hsize{\hfil\box\@tempboxa\hfil}\fi} +% +% Modified LateX Sectioning Commands +% +\ifx\chapter\undefined +% +%Article +% +\def\part{\par\vskip1.4\baselineskip\@tempskipa\z@ + \@tempskipb\baselineskip\@afterindentfalse\secdef\@part\@spart} +\def\@part[#1]#2{\ifnum \c@secnumdepth >\m@ne\@makesecdot{part}% + \addcontentsline{toc}{part}{\protect\numberline{\thepart\nmdot}{#1}}\else + \addcontentsline{toc}{part}{#1}\fi\@mkboth{}{} + {\parindent\z@\hdpos\interlinepenalty\@M\ifnum\c@secnumdepth>\m@ne + \@ifempty\thepart\@empty{\chsize\hdfnt\partname~\thepart\par\nobreak + \vskip\@tempskipa}\fi}\@spart{#2}} +\def\@spart#1{\@ifempty{#1}\removelastskip{\parindent\z@\hdpos + \interlinepenalty\@M\hdsize\hdfnt#1\par}\nobreak\vskip\@tempskipb + \fpind\@afterheading} +\def\maketitle{\par\begingroup\def\thefootnote{\fnsymbol{footnote}}% + \def\@makefnmark{\hbox to\z@{$\m@th^{\@thefnmark}$\hss}}% + \if@twocolumn\twocolumn[\@maketitle]% + \else\newpage\global\@topnum\z@\@maketitle\fi + \thispagestyle{empty}\@thanks\endgroup + \setcounter{footnote}{0}\let\maketitle\relax\let\@maketitle\relax + \def\@thanks{}\def\@author{}\def\@title{}\let\thanks\relax} +\def\@maketitle{\null \vskip \tw@ em\begin{center}% + {\ttsize\ttfnt\@title\par}\vskip1.2\baselineskip{\ausize\ttfnt%1.5em + \lineskip.4\baselineskip\begin{tabular}[t]{c}\@author\end{tabular}\par}%.5em + \vskip.8\baselineskip{\dasize\ttfnt\@date}\end{center}% 1em + \par\vskip1.2\baselineskip}% 1.5em +\if@twoside + \def\ps@headings{\let\@mkboth\markboth + \def\@oddfoot{}\def\@evenfoot{} + \def\@evenhead{\pgfnt\thepage\hfil\mkfnt\leftmark}% + \def\@oddhead{\mkfnt\rightmark\hfil\pgfnt\thepage}% + \def\sectionmark##1{\markboth{\mkcse{\ifnum\c@secnumdepth>\z@\@gobifnul + \thesection{\@ifempty{##1}\@empty{\nmdot\quad}}\fi##1}}{}}% + \def\subsectionmark##1{\markright{\ifnum\c@secnumdepth>\@ne\@gobifnul + \thesubsection{\@ifempty{##1}\@empty{\nmdot\quad}}\fi##1}}} +\else + \def\ps@headings{\let\@mkboth\markboth + \def\@oddfoot{}\def\@evenfoot{} + \def\@oddhead{\mkfnt\rightmark\hfil\pgfnt\thepage}% + \def\sectionmark##1{\markright{\mkcse{\ifnum\c@secnumdepth>\z@ + \@gobifnul\thesection{\@ifempty{##1}\@empty{\nmdot\quad}}\fi##1}}}} +\fi +\def\ps@myheadings{\let\@mkboth\@gobbletwo + \def\@oddhead{\mkfnt\rightmark \hfil\pgfnt\thepage}\def\@oddfoot{}% + \def\@evenhead{\pgfnt\thepage\hfil\mkfnt\leftmark}\def\@evenfoot{}% + \def\sectionmark##1{}\def\subsectionmark##1{}} +\def\tableofcontents{\makeheading{\contentsname + \@mkboth{\mkcse{\contentsname}}{\mkcse{\contentsname}}}% + \@starttoc{toc}} +\def\listoffigures{\makeheading{\listfigurename + \@mkboth{\mkcse{\listfigurename}}{\mkcse{\listfigurename}}}% + \@starttoc{lof}} +\def\listoftables{\makeheading{\listtablename\@mkboth + {\mkcse{\listtablename}}{\mkcse{\listtablename}}}% + \@starttoc{lot}} +\def\thebibliography#1{\makeheading{\refname\@mkboth + {\mkcse{\refname}}{\mkcse{\refname}}}\list + {\@biblabel{\arabic{enumiv}}}{\settowidth\labelwidth{\@biblabel{#1}}% + \leftmargin\labelwidth\advance\leftmargin\labelsep + \usecounter{enumiv}\let\p@enumiv\@empty + \def\theenumiv{\arabic{enumiv}}}% + \def\newblock{\hskip .11em plus.33em minus.07em}% + \sloppy\clubpenalty4000\widowpenalty4000\sfcode`\.=\@m\relax} +\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi + \columnseprule \z@\columnsep 35\p@\twocolumn[\makeheading{\indexname}]% + \@mkboth{\mkcse{\indexname}}{\mkcse{\indexname}}% + \thispagestyle{plain}\parindent\z@ + \parskip\z@ plus.3\p@\relax\let\item\@idxitem} +\def\l@part{\@tocheadline{0}{1.8\baselineskip}{3em}{\large\bf}}%2.25em +\def\l@section{\@tocheadline{1}{1em}{1.8em}{\bf}} +\def\makeheading{\section*} +\else +% +%Report/Book +% +\def\part{\cleardoublepage\thispagestyle{plain}% + \if@twocolumn\onecolumn\@tempswatrue\else \@tempswafalse\fi + \@tempskipa20\p@\@tempskipb\fill\hbox{}\vfil\secdef\@part\@spart} +\def\@part[#1]#2{\ifnum\c@secnumdepth>-2\@makesecdot{part}% + \addcontentsline{toc}{part}{\protect\numberline{\thepart\nmdot}#1}\else + \addcontentsline{toc}{part}{#1}\fi\@mkboth{}{}% + {\parindent\z@\hdpos\ifnum\c@secnumdepth>-2\@ifempty\thepart\@empty + {\chsize\hdfnt\partname~\thepart\par\vskip\@tempskipa}\fi + \@spart{#2}}} +\def\@spart#1{\@ifempty{#1}\removelastskip{\hdpos\hdsize\hdfnt#1\par}% + \vskip\@tempskipb\newpage\if@twoside\hbox{}\thispagestyle{empty}\newpage\fi + \if@tempswa\twocolumn\fi} +\let\@endpart\undefined +\def\@makeschapterhead#1#2#3#4{\vskip#2{\parindent\z@\hdpos + \if@nobreak\ifnum\c@secnumdepth>\m@ne\@ifempty\thechapter\@empty + {\chsize\hdfnt\@chapapp~\thechapter \par\nobreak\vskip#3}\fi\fi + \@ifempty{#1}\removelastkip{\hdsize\hdfnt#1\par}\nobreak\vskip#4}} +\def\@makechapterhead#1{\hbox{}\@makeschapterhead{#1}{50\p@}{20\p@}{40\p@}} +\def\@chapter[#1]#2{\ifnum\c@secnumdepth>\m@ne\@makesecdot{chapter}% +\typeout{\@chapapp\space\thechapter}\fi\@contmark{chapter}\z@{#1}% + \addtocontents{lof}{\protect\addvspace{10\p@}}% + \addtocontents{lot}{\protect\addvspace{10\p@}}\@nobreaktrue + \if@twocolumn\@topnewpage[\@makechapterhead{#2}]\else\@makechapterhead{#2}\fi + \fpind\@afterheading} +\def\@schapter#1{\@nobreakfalse\if@twocolumn + \@topnewpage[\@makechapterhead{#1}]\else + \@makechapterhead{#1}\fi\fpind\@afterheading} +\if@twoside + \def\ps@headings{\let\@mkboth\markboth\def\@oddfoot{}\def\@evenfoot{}% + \def\@evenhead{\pgfnt\thepage\hfil\mkfnt\leftmark}% + \def\@oddhead{\hbox{}\mkfnt\rightmark\hfil\pgfnt\thepage}% + \def\chaptermark##1{\markboth{\mkcse{\ifnum + \c@secnumdepth>\m@ne\expandafter\@gobifnul\@chapapp\ \@gobifnul + \thechapter{\@ifempty{##1}\@empty{\nmdot\quad}}\fi##1}}{}}% + \def\sectionmark##1{\markright{\mkcse{\ifnum \c@secnumdepth >\z@\@gobifnul + \thesection{\@ifempty{##1}\@empty{\nmdot\quad}}\fi ##1}}}} +\else + \def\ps@headings{\let\@mkboth\markboth + \def\@oddfoot{}\def\@evenfoot{}% + \def\@oddhead{\mkfnt \rightmark \hfil\pgfnt\thepage}% + \def\chaptermark##1{\markright {\mkcse{\ifnum + \c@secnumdepth>\m@ne \expandafter\@gobifnul\@chapapp\ \@gobifnul + \thechapter{\@ifempty{##1}\@empty{\nmdot\quad}}\fi##1}}}} +\fi +\def\ps@myheadings{\let\@mkboth\@gobbletwo + \def\@oddhead{\mkfnt\rightmark \hfil\pgfnt\thepage}% + \def\@oddfoot{}\def\@evenhead{\pgfnt \thepage\hfil\mkfnt + \leftmark}\def\@evenfoot{}% + \def\chaptermark##1{}\def\sectionmark##1{}% + \def\subsectionmark##1{}} +\def\maketitle{\begin{titlepage}% + \let\footnotesize\small \let\footnoterule\relax \setcounter{page}{0}% + \null \vfil \vskip 5\baselineskip \begin{center}% 60pt + {\ttsize\ttfnt\@title\par}\vskip2.45\baselineskip {\ausize\ttfnt\lineskip + .62\baselineskip%3em .75em + \begin{tabular}[t]{c}\@author \end{tabular}\par}% + \vskip 1.25\baselineskip {\dasize \ttfnt \@date \par} \end{center} \par%1.5em + \@thanks \vfil \null \end{titlepage}% + \setcounter{footnote}{0} \let\thanks\relax + \def\@thanks{}\def\@author{}\def\@title{}\let\maketitle\relax}% +\def\tableofcontents{\@restonecolfalse + \if@twocolumn\@restonecoltrue\onecolumn\fi\makeheading{\contentsname + \@mkboth{\mkcse{\contentsname}}{\mkcse{\contentsname}}}% + \@starttoc{toc}\if@restonecol\twocolumn\fi} +\def\listoffigures{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi + \makeheading{\listfigurename\@mkboth{\mkcse{\listfigurename}}% + {\mkcse{\listfigurename}}}\@starttoc{lof}\if@restonecol\twocolumn\fi} +\def\listoftables{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi + \makeheading{\listtablename\@mkboth{\mkcse{\listtablename}}% + {\mkcse{\listtablename}}}\@starttoc{lot}\if@restonecol\twocolumn\fi} +\def\thebibliography#1{\makeheading{\bibname\@mkboth + {\mkcse{\bibname}}{\mkcse{\bibname}}}\list + {\@biblabel{\arabic{enumiv}}}{\settowidth\labelwidth{\@biblabel{#1}}% + \leftmargin\labelwidth\advance\leftmargin\labelsep + \usecounter{enumiv}\let\p@enumiv\@empty + \def\theenumiv{\arabic{enumiv}}}% + \def\newblock{\hskip .11em plus.33em minus.07em}% + \sloppy\clubpenalty4000\widowpenalty4000\sfcode`\.=\@m} +\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi + \columnseprule\z@\columnsep 35\p@\twocolumn\makeheading{\indexname + \@mkboth{\mkcse{\indexname}}{\mkcse{\indexname}}}% + \thispagestyle{plain}\parindent\z@ + \parskip\z@ plus .3\p@\relax\let\item\@idxitem} +\def\l@part{\@tocheadline{\z@}{1.8\baselineskip}{3em}{\large\bf}}%2.25em +\def\l@chapter{\@tocheadline{\@ne}{1em}{1.8em}{\bf}} +\def\makeheading{\chapter*} +\fi +% +%Article, Book, Report +% +\def\section{\@startsection +{section}{\@ne}{\secindent}{\secpreskp}{\secpstskp}{\secsize\hdfnt}} +\def\subsection{\@startsection +{subsection}{\tw@}{\subindent}{\subpreskp}{\subpstskp}{\subsize\hdfnt}} +\def\subsubsection{\@startsection +{subsubsection}{3}{\subindent}{\subpreskp}{\subpstskp}{\normalsize\hdfnt}} +\def\paragraph{\@startsection{paragraph}{4}{\subindent}% +{\subpreskp}{\parpstskp}{\normalsize\hdfnt}} +\def\subparagraph{\@startsection{subparagraph}% +{5}{\parindent}{\subpreskp}{\parpstskp}{\normalsize\hdfnt}} +% +% section layout +% +\def\@makesecdot#1{\expandafter\let\expandafter\@secdot\csname the#1\endcsname + \ifx\@secdot\@empty\else\refstepcounter{#1}\toks@\expandafter{% + \csname p@#1\endcsname}\edef\@secdot{% + \the\toks@\expandafter\@gobifnul\csname the#1\endcsname\nmdot}\fi} + %not \@secdot +\def\@makesvsec#1{\ifind #1<\z@\def\@svsec{\llap{\@secdot}\hskip-#1}\else + \def\@svsec{\@gobifnul\@secdot\quad}\fi} +\def\@contmark#1#2#3{\csname #1mark\endcsname{#3}\addcontentsline + {toc}{#1}{\ifnum #2>\c@secnumdepth\else\protect\numberline{\@secdot}\fi#3}} +\def\@startsection#1#2#3#4#5#6{\if@noskipsec\leavevmode\fi + \par\@tempskipa #4\@afterindenttrue + \ifdim\@tempskipa<\z@\@tempskipa-\@tempskipa\@afterindentfalse\fi + \fpind\if@nobreak\everypar{}\else + \addpenalty{\@secpenalty}\addvspace{\@tempskipa}\fi\@ifstar + {\@ssect{#3}{#5}{#6}}{\@dblarg{\@sect{#1}{#2}{#3}{#5}{#6}}}} +\def\@sect#1#2#3#4#5[#6]#7{\@tempskipa #4\let\@svsec\@empty + \ifnum#2>\c@secnumdepth\else\@makesecdot{#1}\@makesvsec{#3}\fi + \ifdim\@tempskipa>\z@ + \begingroup#5\@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty + \@M\ifnum#2>\c@hddepth\else\hdpos\fi#7\par}\endgroup + \@contmark{#1}{#2}{#6}\else + \def\@svsechd{\@contmark{#1}{#2}{#6}#5\hskip#3\@svsec + \@gobifnul{#7}\hddot}\fi\@xsect{#4}} +\def\@ssect#1#2#3#4{\@tempskipa #2\relax\ifdim \@tempskipa>\z@ + \begingroup #3\@hangfrom{\ifind #1< \z@\else \hskip #1\fi}{\interlinepenalty + \@M\ifnum#2>\c@hddepth\else\hdpos\fi#4\par}\endgroup\else + \def\@svsechd{#3\ifind #1<\z@\else + \hskip #1\fi\@gobifnul{#4}\hddot}\fi\@xsect{#2}} +\let\ifind\ifdim +% +% contents lines +% +\def\@tocheadline#1#2#3#4#5#6{\ifnum#1>\c@tocdepth\else + \addpenalty\@secpenalty\vskip#2 plus\p@\begingroup + \interlinepenalty\@M\rightskip\@tocrmarg\parfillskip-\@tocrmarg + \secindent#3\noindent\leavevmode\hangindent\secindent + \reset@font\rm#4#5\@tocpagenum{#6}\par\endgroup + \penalty\@highpenalty\fi} +\def\@dottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else + \vskip \z@ plus.2\p@\begingroup\leftskip#2\interlinepenalty\@M + \rightskip\@tocrmarg\parfillskip-\@tocrmarg\secindent#3% + \noindent\leavevmode\hangindent\secindent\reset@font\rm#4\nobreak\leaders + \hbox{$\m@th \mkern \@dotsep mu.\mkern \@dotsep mu$}\hfill \nobreak + \hbox to\@pnumwidth{\hfil\reset@font\rm #5}\par\endgroup\fi} +\def\@tocpagenum#1{\nobreak\hfill\nobreak\hbox to\@pnumwidth{\hss#1}} +\def\numberline#1{\hbox to \secindent{#1\hfil} } +% +% REDEFINITIONS here: +% +% This line must be last line of code +\catcode`\@\neq\let\neq\ne\endinput + +******************* + DOCUMENTATION +******************* +Leslie Lamport in writing LaTeX assumed that authors would write +complete .sty (.clo) files to implement the design decisions for their +publications. However, the overwhelming majority of LaTeX publications use the +standard styles supplied by Lamport. These implement a particular set of +typographic conventions, which while consistent are not of universal validity, +for instance many publishers and authors would like a full stop: +`4. Introduction' +rather than +`4 Introduction'. + +This file modifies the standard classes so that other conventions can be +more easily implemented. Careful use of the file will allow a greater +variation in the appearance of LaTeX documents. + +0. Changes to section implementation. +The file redefines the way LaTeX deals with negative indents for section +headings, placing the number in the margin and the heading itself flush +with the margin. With negative indents it sets starred section headings +flush (as it does when \thesection is empty. +Standard LaTeX indenting can be produced by typing +>> \let\ifind\iffalse +This file's version can be reestablished by typing +>> \let\ifind\ifdim + +The file also changes the way LaTeX reacts to empty numbers when sections have +non-negative indents, placing the heading where the number would go, rather +than further indented (as in standard LaTeX). +This effect can be removed by redefining an internal macro \@makesvsec (see +below). + +The indents, pre- and postskips for section headings are placed in registers +so that they are constant throughout a document and (just as the heading sizes) +do not react to surrounding size changes. You can change this back to ordinary +LaTeX behaviour by \def ing them as macros rather than setting the register +values (in that case you should probably use \smaller\larger from +SMALLER.STY for the \...size commands). + +WARNING LaTeX typesets headings that run on by manipulating \everypar. If you +make local changes to the heading style of such a section inside braces or a +group you must ensure that a non-empty paragraph occurs before the closing +brace. Otherwise some strange effects may occur, because the \everypar tokens +will be evaluated outside the group (this is a feature of LaTeX, not of +SECTION.STY). If your group ends with an empty section of this type just +follow it with \leavevmode or an explicit space: \ . + +A detailed description of the format of LaTeX sectioning commands is given +below (in paragraph 9). This is partially taken from the file LATEX.TEX. +We first list the macros for local control which you can use without knowing +this structure. + +The file sets vertical distances that LaTeX expressed in terms of `em's and +`ex's in equivalent `\baselineskip's, as `em' is a measure of the horizontal +size of a font and `ex' is not a true measure of the full height of a line. +Earlier vesions used `ex's. + +The original values are placed as comments. + +1. Sizing commands for Parts, Chapters and Titles etc +These are set to \large or whatever + +>> \chsize: Chapter, Part Heading (\LARGE\large) +>> \hdsize: Chapter, Part Title Text (\Huge\huge\LARGE) +>> \ttsize: Title of Document (\Huge\huge\LARGE) +>> \ausize: Author (\LARGE\Large) +>> \dasize: Date. (\Large\large) +>> \secsize: Section (\Large\large) +>> \subsize: Subsection (\large\normalsize) + subsubsection and below use \normalsize + +2. Layout commands for headings. +>> \hdpos: Positioning of heading (\raggedright) (\centering \raggedleft) + (see section 9); +>> counter hddpth (default 0) + Maximum section level for \hdpos (chapters and parts ALWAYS use hdpos). + To centre section headings and above: + \let\hdpos\centering\setcounter{hddepth}{1} +>> \fpind: Indenting of first paragraph after \Part \Chapter + and also to override setting via preskip for sections. + \let to \@afterindenttrue to indent, \@afterindentfalse for flush, + \relax: flush after \Part \Chapter, negative preskips; indented otherwise + (LaTeX default behaviour). + +3. Fonts +>> \ttfnt: font for title entries. +>> \hdfnt: font for all other headings (Part, Chapter..subparagraph). +>> \fefnt: font for theorem headings and description labels (fe=feature). +>> \thfnt: font for theorem statements. +>> \pgfnt: font for page numbers. +>> \mkfnt: font for page headings (mk=mark). +>> \mkcse: case for page headings. + These can also be used to add other initial commands such as spaces or + symbols. + +4. Optional punctuation (standard|my preference) + These marks are transferred via auxiliary files for tables of contents etc. + They should be \def'd if their current value is to be transferred, and \let + if the value in force when the file auxiliary is read should be used. + +>> \hddot ({}|.) (after inline headings, theorems etc) +>> \cpdot (:|.) (in figure/table captions - also apears in list of figures. +>> \nmdot ({}|.) (after section numbers etc) + +If these are \let to a single letter they are not expanded in the + .toc.. files. So to remove \cpdot from list of figures: + \let\cpdot\relax\listoffigures\let\cpdot: + +5. Spacing parameters. + The macros for chapters and parts have been altered so that all the + vertical spacing commands are in a single macro in each case. + +>> \part inserts initial vertical space directly (preceded by \hbox{} if it + is to be immovable) and passes the space between Part n and title + in \@tempskipa and the space below the heading in \@tempskipb. +>> Both \chapter and \chapter* call \@makechapterhead{chaptertitle}. + This passes {chaptertitle} on to \@makeschapterhead together with the + vertical spacing. Default setting is + \def\@makechapterhead#1{\hbox{}\@makeschapterhead{#1}{50\p@}{20\p@}{40\p@}} + \hbox{} makes first skip immovable, + the first length is space above the heading, + The second is the space between Chapter nn and the chapter title + The third is the space below the heading. + For both Part and Chapter the middle space is removed if either the + section name or title are missing. + If both are missing, the first space is also removed + +>> For sections and below the spaces are kept in registers: + \secpreskp and \secpsrskp \secindent used for \section + \subpreskp and \subpstskp \subindent used for \subsection/\subsubsection + \paragraph uses \subindent \subpreskp \parpstskp + \subparagraph uses \parindent \subpreskp \parpstskp + +>> \secindent \subindent Heading indentation +>> \secpreskp \subpreskp Space before +>> \secpstskp \subpstskp \parpstskp Space after. + +6. Internal modifications + + Sections with negative indents have heading flush with margin. + + If \thesection is \empty + \let\thesection\empty or \def\thesection{} + then section does not step the section counter. + If the section produces empty output for a value then + the section will start flush at the margin or \secindent if it is positive + and there will be no \nmdot. + It will produce (flush) page headings and a table of contents entry. + Similarly if \thechapter or \thepart are defined to be empty they will + suppress the heading line `Chapter..' and not step the counter. + To restore standard LaTeX behaviour temporarily define \thesection to be + \empty + \def\thesection{\empty} + In that case you can adjust post number spacing in the heading. + \section[Heading]{\hskip-1em Heading} + You can also redefine \@makesecdot see paragraph 7. + +WARNING \letting \thesection etc to an unexpandable token (like \relax) will +cause strange effects under LaTeX because its value will not be expanded. + + \maketitle suppresses page headings (\thispagestyle{empty}) and only resets + \@title etc locally. So place in a group if you want to preserve these for + later reference (eg. in headers). + +7. New internal macros + Place any modifications in the section REDEFINITIONS of the main code + +> \@secdot contains section number and \nmdot if the number is non-empty. +> \@makesecdot{NAME} defines \@secdot. + To make LaTeX step the section counter independently of the definition + of \thesection and always print \nmdot: + \def\@makesecdot#1{\refstepcounter{#1}% + \edef\@secdot{\csname the#1\endcsname}} + If you want \nmdot suppressed when \thesection produces no output: + \def\@makesecdot#1{\refstepcounter{#1}% + \edef\@secdot{\expandafter\@gobifnul\csname the#1\endcsname\nmdot}} +> \@makesvsec{INDENT} defines the \@svsec macro used by LaTeX to typeset the + section number.. Its parameter is the indent so that it can react + differently to negative indents. (it does NOT make the indent). + To obtain standard LaTeX behaviour: + \def\@makesvsec#1{\def\@svsec{\@secdot\quad}} + To make positioning commands apply to the heading ignoring the number: + \def\@makesvsec#1{\def\@svsec{\llap{@secdot\quad}}} + Do NOT forget the #1. +> \@contmark{NAME}{LEVEL}{HEADING} makes contents line and sectionmark. + + Contents headlines are defined by +> \@tocheadline + This allows these lines to be adjusted similarly to the \@dottedtocline + commands for other contents lines. The format of these is defined below (in + paragraph 11). +>@tocpagenum#1 sets #1 flush right in \@tocheadline. + Redefine (\let\@tocpagenum\@gobble) to remove page numbers. + \def\l@part{\@tocheadline{0}{2.25em}{3em}{\let\@tocpagenum\@gobble + \centering\large\bf}} + Centres parts lines of contents but leaves chapters unchanged + \def\l@part{\@tocheadline{0}{2.25em}{3em}{\let\@tocpagenum\@gobble + \centering\def\numberline##1{\hskip-\secindent + \hbox to\secindent{##1\hfil}}\large\bf}} + Same but centring ignores part number. + \def\l@part{\@tocheadline{0}{2.25em}{3em}{\let\@tocpagenum\@gobble + \centering\def\numberline##1{\hfilneg + \hbox to\z@{##1\hss}\hfil}\large\bf}} + Centres heading with number flush left + Contents lines use \secindent as a temporary register + +>\makeheading (set to \section*, \chapter*) + Makes headings for contents, index etc. + To put Contents itself in the contents list, redefine (locally): + \let\thesection\empty\let\makeheading\section + +8. Additional macros +> \@ifempty{test}{yes}{no} like \@ifundefined but tests for empty + (fails iff test starts with ~ of catcode 12 (other) ). +> \@gobifnul{a}{b} = \@ifempty{a}{}{ab}. + +9. Description of sectioning values + + \@startsection {NAME}{LEVEL}{INDENT}{PRESKIP}{POSTSKIP}{STYLE} + optional * [ALTHEADING]{HEADING} + Generic command to start a section. + + NAME : e.g., 'subsection' must be the name of a section counter + LEVEL : a number, denoting depth of section -- section=1; + number increases down the hierarchy. + INDENT : Indentation of heading from left margin + PRESKIP : Absolute value = skip to leave above the heading. + If negative, then paragraph indent of text following + heading is suppressed. + POSTSKIP : if positive, then skip to leave below heading, else + negative of skip to leave to right of run-on heading. + ALTHEADING : for page headings and contents. + STYLE : commands to set style + If '*' missing, then increments the counter. If it is present, then + there should be no [ALTHEADING] argument. + Uses the counter 'secnumdepth' whose value is the highest section + level that is to be numbered and entered into \@dottedtocline. + +10. Treatment of Section Entries + + NAME (fixed) Determines the counter to use. + + LEVEL (fixed) If level is greater than \counter{secnumdepth} (default 2) no + indexentry or number + + INDENTS: \secindent (sections), \subindent (subsections,...,paragraphs). + Subparagraphs have \parindent fixed. These are dimensions. + + Recommended: +-\parindent or 0pt + + If indent is negative then SECTION.STY causes the section number to be set + flush right that distance from margin. Heading or text follows at the margin + itself. + + Unnumbered headings are set at the margin if indent is negative. If the + indent is non-negative they are set flush left with the number position. + + PRESKIPS \secpreskp (sections), \subpreskp(subsections..subparagraphs) + POSTSKIPS \secpstskp (sections),\subpstskp(subsections,subsubsections) + \parpstskp (paragraphs,subparagraphs) + + Recommended: leave PRESKIPS' abs values unchanged, They are set -ve to + have flush first paragraphs. Use \secpreskp-\secpreskp to indent them. + Recommended: set POSTSKIPS to -1em or -\parindent to make sections run on. + + By assigning these values to registers SECTION.STY makes them independent of + the surrounding font and size. Set the registers if you want this, redefine + them as macros if you want them to be font and size dependent. + + STYLE \secsize \subsize \hdfnt size and fonts. + \secsize for sections, + \subsize for subsections. + Subsubsections and below have \normalsize (fixed). + \hdfnt is universal for all headings. + +11. Contents entries. + + \@tocheadline{LEVEL}{PRESKIP}{INDENT}{STYLE}{ENTRY}{PAGENUM} + \@dottedtocline{LEVEL}{MARGIN}{INDENT}{ENTRY}{PAGENUM} + + LEVEL : determines if entry made. + PRESKIP : vertical gap above. + INDENT : This must leave enough room for the chapter or section number + : It is added to the margin for the next level. + MARGIN : Left margin inherited from level above (zero for headlines). + STYLE : Font sizing and setting. + + LaTeX assumes that the ENTRY for sections be defined by a macro \l@section. + These are defined in the standard document styles but can be changed. + All entries of the \l@section commands are fixed. SECTION.STY does not + change the commands using \@dottedtocline in the style file. Those that do + not do so (\l@part, \l@chapter) are modified to use \@tocheadline. + + INDENT for sections in {article} and chapters in {report} is rather tight at + 1.5em. If you increase it should also increase the MARGINS for lower + sections. + +12. The following internal LaTeX macros are redefined: + + \part\@part\@spart\@endpart + \@chapter\@schapter (also \fi moved) + \@makechapterhead functions of these have been significantly + \@makeschapterhead changed. + + \ps@headings\ps@myheadings + \section\subsection + \subsubsection\paragraph + \subparagraph + \thebibliography + \theindex + \@begintheorem + \@oparbegintheorem + \@makecaption optional style features added + \@startsection \fpind and does not pass #4 to \@sect,\@ssect + \@sect,\@ssect ignored parameter removed + \llap \@secdot used to adjust spacing + if \p@section defined used for number style. + calls \@makesecdot + \@sect only: \@makesvsec and + \@contmark, which is moved in + \@svsechd so that \unskip in \@xsect works). + \maketitle\@maketitle suppress page number, reset \@title.. locally + \numberline adds space after number, so overfull box if + too close to heading. + +CHANGES + Ver 1.3 (3.Apr 98) + If \secindent < 0, then \section* produces a flush heading, not outdented. + \hdpos takes level as parameter and is used for all sections, not just + \part and \chapter. + `ex' measurements replaced by \baselineskip equivalents. + Ver 1.31 + Bugfix: \relax added to \@alph, \@Alph to enable use with \@ifempty test. + Ver 1.32 + Bugfixes: \hdpos added to \@ssect, unused macro \secpos removed, + \nobreak added after \thechapter in \makechapterhead + Ver 1.4 + \hdpos made simple macro again. Counter \hddepth determines when it + should be used. Functions of \@makechapterhead, \@smakechapterhead + changed to make editing vertical spacing of chapters easier. + \part\@part\@spart rewritten so that all spacing info in \part. + \part calls \@spart which finishes off the heading. + Memory use < 200 words. +End of SECTION.STY \ No newline at end of file -- cgit v1.2.3