From 8720829c9cba68ab04a8d8e4f0e6e0fd31cabed7 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Wed, 22 May 2013 23:12:17 +0000
Subject: memoir (22may13)

git-svn-id: svn://tug.org/texlive/trunk@30639 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/doc/latex/memoir/memman.tex | 3679 ++++++++++++++++---------
 1 file changed, 2422 insertions(+), 1257 deletions(-)

(limited to 'Master/texmf-dist/doc/latex/memoir/memman.tex')

diff --git a/Master/texmf-dist/doc/latex/memoir/memman.tex b/Master/texmf-dist/doc/latex/memoir/memman.tex
index 8b912a8607f..bc3492acfa4 100644
--- a/Master/texmf-dist/doc/latex/memoir/memman.tex
+++ b/Master/texmf-dist/doc/latex/memoir/memman.tex
@@ -4,6 +4,9 @@
 %             Author: Peter Wilson
 %             Copyright 2001, 2002, 2003, 2004, 2008, 2009 Peter R. wilson
 %
+%   This work has the LPPL maintenance status "maintained".
+%   Maintainer: Lars Madsen (daleif at imf dot au dot dk)
+%
 %\listfiles
 \documentclass[10pt,letterpaper,extrafontsizes]{memoir}
 \listfiles
@@ -80,8 +83,8 @@
 
 % \svnidlong
 % {}
-% {$LastChangedDate: 2011-01-23 22:13:38 +0100 (Sun, 23 Jan 2011) $}
-% {$LastChangedRevision: 332 $}
+% {$LastChangedDate: 2013-04-26 18:44:39 +0200 (Fri, 26 Apr 2013) $}
+% {$LastChangedRevision: 447 $}
 % {$LastChangedBy: daleif $}
 
 
@@ -117,7 +120,11 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %#% extend
 
-
+\usepackage[draft]{fixme}
+\fxsetup{
+  layout=marginnote
+}
+ 
 \begin{document}
 
 
@@ -129,7 +136,7 @@
 
 
 \tightlists
-%%%%\firmlists
+%\firmlists
 \midsloppy
 \raggedbottom
 \chapterstyle{demo3}
@@ -178,8 +185,10 @@
 \end{center}
 \begin{center}
 \LARGE\textsf{Peter Wilson}\par
-\medskip
+\bigskip
 \normalsize\textsf{Maintained by Lars Madsen}\par
+\medskip
+\normalsize\textsf{Corresponding to \theclass\ version \memversion}\par
 \end{center}
 \vspace*{\fill}
 \def\THP{T\kern-0.2em H\kern-0.4em P}%   OK for CMR
@@ -202,6 +211,7 @@
 \setlength{\parskip}{\baselineskip}
 %%\ttfamily
 \textcopyright{} 2001 --- 2010 Peter R. Wilson \\
+\textcopyright{} 2011 --- 2013 Lars Madsen \\
 All rights reserved
 
 The Herries Press, Normandy Park, WA.
@@ -314,8 +324,8 @@ Manual last changed \svnyear/\svnmonth/\svnday
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-05-13 17:10:00 +0200 (Thu, 13 May 2010) $}
-{$LastChangedRevision: 210 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 \chapter{Preface}
@@ -569,7 +579,7 @@ have been made to both the class and this manual.
     There are other more minor changes and extensions\footnote{With thanks
 to, among others, Ignasi Furi\'{o} Caldentey (\url{ignasi@ipc4.uib.es}),
 Daniel Richard G. (\url{skunk@mit.edu}) and
-Vladimir Ivanovic (\url{vladimir@acm.org}).} 
+Vladimir G. Ivanovi\'c (\url{vladimir@acm.org}).} 
 which you may find if you recall the second edition.
 
 \chapter{Introduction to the fourth edition}
@@ -706,7 +716,7 @@ Karl Berry,
 Javier Bezos,
 Sven Bovin,
 Alan Budden,
-Ignasi Furi\'{o} Caldenty,
+Ignasi Furi\'{o} Caldentey,
 Ezequiel Mart\'{\i}n C\'{a}mara,
 David Carlisle,
 Steven Douglas Cochran,
@@ -1238,8 +1248,8 @@ been answered.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-09-27 11:32:07 +0200 (Mon, 27 Sep 2010) $}
-{$LastChangedRevision: 282 $}
+{$LastChangedDate: 2013-05-21 16:33:04 +0200 (Tue, 21 May 2013) $}
+{$LastChangedRevision: 469 $}
 {$LastChangedBy: daleif $}
 
 \chapter{Introduction to the eighth edition}
@@ -1297,12 +1307,13 @@ this~\cite{MEMCODE}. However if you want to see exactly how some part,
 or all of, \Mname\ is defined it is there for you to peruse.
 The document you are now reading is the separate comprehensive 
 User Manual~\cite{MEMMAN} which runs to about 500 pages, and from time to 
-time an Addendum~\cite{MEMADD} is released noting extensions to the class.
+time an Addendum %\cite{MEMADD} 
+is released noting extensions to the class.\footnote{Currently not in use.}
 Again, if you want to see how something was done in this Manual, which
 of course was prepared using \Mname\ itself, the source
 is available for you to read.
-There is also the \Lpack{memexsupp} package by Lars Madsen~\cite{MEMEXSUPP} 
-which provides some extra facilities for the class.
+% There is also the \Lpack{memexsupp} package by Lars Madsen~\cite{MEMEXSUPP} 
+% which provides some extra facilities for the class.
 
     The previous editions of the Manual consisted of two parts. The first
 discussing some aspects of book design and typography in
@@ -1765,7 +1776,7 @@ Javier Bezos,
 Stefano Bianchi,    % chaptersytyle
 Sven Bovin,
 Alan Budden,
-Ignasi Furi\'{o} Caldenty,
+Ignasi Furi\'{o} Caldentey,
 Ezequiel Mart\'{\i}n C\'{a}mara,
 David Carlisle,     % code
 Gustafo Cevolani, 
@@ -1808,7 +1819,7 @@ Peter Heslin,
 Timo Hoenig,             % thank you letter
 Morten H{\o}gholm,       % code
 Henrik Holm,
-Vladimir Ivanovich,
+Vladimir G. Ivanovi\'c,
 Martin J{\o}rgensen,     % bug report
 Stefan Kahrs,
 Christian Keil,          % typos
@@ -1871,12 +1882,14 @@ David Wilson.
 
 If I have inadvertently left anyone off the list I apologise, 
 and please let me know so that I can correct the 
-omisssion.\footnote{Peter is currently occasionably reachable via email
-at \texttt{herries dot press (at) earthlink dot net}, otherwise write
-the maintainer at \texttt{daleif+memoir at imf dot au dot dk}}
-Along those lines, if you have any questions please direct them 
-to the \url{comp.text.tex} newsgroup instead of directly to me as
-you are much more likely to get a satisfactory and timely response.
+omisssion.% \footnote{Peter is currently occasionably reachable via email
+% at \texttt{herries dot press (at) earthlink dot net}, otherwise write
+% the maintainer at \texttt{daleif at imf dot au dot dk}}
+\footnote{Please write the maintainer at \texttt{daleif at imf dot au
+    dot dk}} Along those lines, if you have any questions you may
+direct them to the \url{comp.text.tex} newsgroup or post them om
+\url{http://tex.stackexchange.com} as you are likely to get a
+satisfactory and timely response.
 
     Of course, none of this would have been possible without Donald Knuth's
 \tx\ system and the subsequent development of \ltx\ by Leslie Lamport.
@@ -1886,7 +1899,7 @@ you are much more likely to get a satisfactory and timely response.
 \chapter{Remarks to the user}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-    \Lclass{memoir} gives you many ways to change the appearance of your
+    The \Lclass{memoir} class gives you many ways to change the appearance of your
 document, and also provides some ready-made styles that might be
 appropriate for your purposes.
 
@@ -1919,26 +1932,25 @@ As the years go by support for \Lclass{memoir} will devolve from one
 person to another.\footnote{This is currently (July 2009) happening as
   Lars Madsen is taking over from Peter Wilson.}  Therefore it is
 probably safer to ask questions, complain, make suggestions, etc., on
-the newsgroup called \url{comp.text.tex}, which is archived and read
-by many, than correspond directly with the maintainer, who might well
-be away for some considerable time and perhaps not notice your email
-after having returned to base.
-
-Then dealing with memoir issues on \url{comp.text.tex}, please include
-the word \texttt{memoir} in the subject. That will help the memoir
-maintainer keep track of memoir related matters.
-
+a Q\&A site like \url{http:://tex.stackexchange.com} or on the the
+newsgroup \url{comp.text.tex}, which is archived and read by many,
+than correspond directly with the maintainer, who might well be away
+for some considerable time and perhaps not notice your email after
+having returned to base.
 
-If you do not have access to \url{comp.text.tex} you may also email
-the current maintainer at \texttt{daleif+memoir at imf dot au dot dk}.
+In either case please include the word \texttt{\theclass} in the
+subject, and if possible, please \emph{tag} the question with the
+\texttt{\theclass} tag.  That will help the memoir maintainer keep
+track of memoir related matters.
 
 \fancybreak{}
 
-\textit{From the maintainer:} As I do not regularly read \LaTeX\
-related forums (like \url{www.latex-community.org} or
-\url{tex.stackexchange.com}), it will be a good idea to either write
-me directly or re-post the question on \url{comp.text.tex} if noone
-comes up with a suitable answer for questions involving \Lclass{memoir}.
+\textit{From the maintainer:} It seems that traffic on
+\url{comp.text.tex} is less frequent. So most \theclass\ related
+questions should go to \url{http:://tex.stackexchange.com}, please
+remember to tag them properly, that really helps locating the
+\theclass\ related questions. If no-one comes up with an answer, you
+can also write me directly via \texttt{daleif (at) imf dot au dot dk}.
 
 
 
@@ -1947,8 +1959,8 @@ comes up with a suitable answer for questions involving \Lclass{memoir}.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-05-13 17:10:00 +0200 (Thu, 13 May 2010) $}
-{$LastChangedRevision: 210 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -2153,8 +2165,8 @@ an em, often a quad is 1em.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-07-15 22:37:02 +0200 (Thu, 15 Jul 2010) $}
-{$LastChangedRevision: 256 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 \chapter{Starting off} \label{chap:starting}
@@ -2760,8 +2772,8 @@ want to put \cmd{\raggedbottom} in the preamble\index{preamble}.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2011-01-16 18:03:46 +0100 (Sun, 16 Jan 2011) $}
-{$LastChangedRevision: 329 $}
+{$LastChangedDate: 2013-05-16 17:28:08 +0200 (Thu, 16 May 2013) $}
+{$LastChangedRevision: 464 $}
 {$LastChangedBy: daleif $}
 
 \chapter{Laying out the page} \label{chap:layingpage}
@@ -3095,9 +3107,12 @@ columns.
 %%%\DeleteShortVerb{\|}
 \centering
 \caption{Average characters per line} \label{tab:copyfitting}
-\begin{tabular}{r|rrrrrrrr} \hline
+\begin{tabular}{r !\quad rrrrrrrr} %|
+  \toprule
 Pts. & \multicolumn{8}{c}{Line length in picas} \\
-     & 10 & 14 & 18 & 22 & 26  & 30  & 35 & 40 \\ \hline
+\cmidrule{2-9}
+     & 10 & 14 & 18 & 22 & 26  & 30  & 35 & 40 \\ 
+\midrule
 80   & \textit{40} & \textbf{56} & \textbf{72} & 88 & 104 &     &    &    \\
 85   & \textit{38} & \textit{53} & \textbf{68} & 83 & 98 & 113 &    &    \\
 90   & \textit{36} & \textit{50} & \textbf{64} & 79 & 86 & 107 &    &    \\
@@ -3130,7 +3145,7 @@ Pts. & \multicolumn{8}{c}{Line length in picas} \\
 300  & 12 & 17 & 21 & 26 & 31 & 35 & 41 & \textit{47} \\
 320  & 11 & 16 & 20 & 25 & 29 & 34 & 39 & \textit{45} \\
 340  & 10 & 15 & 19 & 23 & 27 & 32 & 37 & 42 \\
-\hline
+\bottomrule
 \end{tabular}
 %%%\MakeShortVerb{\|}
 \end{table}
@@ -3359,6 +3374,16 @@ appearance as a spread\index{spread}, the spine margin\index{margin!spine}
 is normally half the \foredge{} margin\index{margin!foredge?\foredge}, 
 so that the white space is equally distributed around the sides of the text. 
 
+\begin{note}
+  One will often find that using \cmd{\settypeblocksize} without
+  subsequent use of \cmd{\setlrmargins} and \cmd{\setulmargins} will
+  result in errors as the relationships mentioned above are not met
+  (the \lnc{\textwidth} has changed, but not the margins).
+
+  We may add auto adjustments to a later version of \theclass.
+\end{note}
+
+
     There is more latitude in choosing the 
 proportions\index{proportion!margin} 
 of the upper and lower margins, though usually the upper 
@@ -3610,6 +3635,14 @@ is calculated from $B_{h} = P_{h} - U - L$.
 \end{tabular}
 \end{table}
 
+\begin{note}
+  Readers may find several folio designs in \cite{MEMDESIGN}.
+\end{note}
+
+
+
+\fancybreak{}
+
 \begin{syntax}
 \cmd{\setcolsepandrule}\marg{colsep}\marg{thickness} \\
 \end{syntax}
@@ -3766,7 +3799,20 @@ maximum width for a note, \lnc{\marginparwidth}, is set to \meta{width}
 and the minimum vertical distance between notes, \lnc{\marginparpush},
 is set to \meta{push}.
 
-\index{marginalia|)}
+\begin{note}
+  As of \theclass\ v3.6k, we have added an auto adjustment feature for
+  \lnc{\marginparwidth}, such that unless \cmd{\setmarginnotes} have
+  been used to make a specific choice, the \lnc{\marginparwidth} is
+  chosen according to the algorithm described in
+  Section~\ref{sec:auto-csmarg}. The algorithm relies on
+  \cmd{\marginparmargin} (if used) being set \emph{before}
+  \cmd{\checkandfixthelayout}.
+
+  We may add other auto adjusting features to future \theclass\ releases.
+\end{note}
+
+
+\index{marginalia|)} %|
 
 \section{Putting it together}
 
@@ -3784,54 +3830,56 @@ modified.
     The general process of setting up your own page layout\index{page layout} 
 is along these lines:
 \begin{itemize}
-\item Decide on the required finished page\indextwo{page}{size} size, 
-      and pick a stock\indextwo{stock}{size} size that is at least as 
-      large as the page.
-\item Use \cmd{\setstocksize}\index{stock!specifying size} to set the 
-      values of \lnc{\stockheight}
-      and \lnc{\stockwidth}, followed by \cmd{\settrimmedsize} to specify
-      the values\ of \lnc{\paperheight} and \lnc{\paperwidth}.
-\item Decide on the location of the page\index{page!location} with respect 
-      to the stock\index{stock}. If the page and stock\index{stock} sizes 
-      are the same, then call \verb?\settrims{0pt}{0pt}?.
-      If they are not the same size then decide on the appropriate 
-      values for \lnc{\trimtop} and \lnc{\trimedge} to position the page on
-      the stock\index{stock}, and then set\index{trim!specifying} these 
-      through \cmd{\settrims}.
-\item Decide on the size of the typeblock\indextwo{typeblock}{size} and 
-      use \cmd{\settypeblocksize}\index{typeblock!specifying size}
-      to specify the values of \lnc{\textheight} and \lnc{\textwidth}.
-\item If you need a binding\index{binding allowance} allowance, 
-      now is the time for \cmd{\setbinding}.
-\item Pick the value for the spine margin\index{margin!spine}, and use 
-     \cmd{\setlrmargins}\index{margin!specifying size}
-      to set the values for the \lnc{\spinemargin} and \lnc{\foremargin}.
-
-      An alternative sequence is to use \cmd{\setlrmarginsandblock} to
-      set the \lnc{\textwidth} for a particular choice of side 
-      margins\index{margin}.
-
-\item Pick the value for the upper margin\index{margin!upper} and 
-      use \cmd{\setulmargins} to set the values\index{margin!specifying size} 
-      for the \lnc{\uppermargin} and \cmd{\lowermargin}.
-
-      An alternative sequence is to use \cmd{\setulmarginsandblock} to
-      set the \lnc{\textheight} for a particular choice of upper and
-      lower margins\index{margin}.
-
-      The typeblock is now located\index{typeblock!location} on the page.
+\item Decide on the required finished page\indextwo{page}{size} size,
+  and pick a stock\indextwo{stock}{size} size that is at least as
+  large as the page.
+\item If needed, use \cmd{\setstocksize}\index{stock!specifying size}
+  to set the values of \lnc{\stockheight} and \lnc{\stockwidth},
+  followed by \cmd{\settrimmedsize} to specify the values\ of
+  \lnc{\paperheight} and \lnc{\paperwidth}.
+  
+  If you use and print on, say, A4, the \texttt{a4paper} class option
+  is enough, not \cmd{\setstocksize} needed.
+\item Decide on the location of the page\index{page!location} with
+  respect to the stock\index{stock}. If the page and
+  stock\index{stock} sizes are the same, then call
+  \verb?\settrims{0pt}{0pt}?.  If they are not the same size then
+  decide on the appropriate values for \lnc{\trimtop} and
+  \lnc{\trimedge} to position the page on the stock\index{stock}, and
+  then set\index{trim!specifying} these through \cmd{\settrims}.
+\item Decide on the size of the typeblock\indextwo{typeblock}{size}
+  and use \cmd{\settypeblocksize}\index{typeblock!specifying size} to
+  specify the values of \lnc{\textheight} and \lnc{\textwidth}.
+\item If you need a binding\index{binding allowance} allowance, now is
+  the time for \cmd{\setbinding}.
+\item Pick the value for the spine margin\index{margin!spine}, and use
+  \cmd{\setlrmargins}\index{margin!specifying size} to set the values
+  for the \lnc{\spinemargin} and \lnc{\foremargin}.
+
+  An alternative sequence is to use \cmd{\setlrmarginsandblock} to set
+  the \lnc{\textwidth} for a particular choice of side
+  margins\index{margin}.
+
+\item Pick the value for the upper margin\index{margin!upper} and use
+  \cmd{\setulmargins} to set the values\index{margin!specifying size}
+  for the \lnc{\uppermargin} and \cmd{\lowermargin}.
+
+  An alternative sequence is to use \cmd{\setulmarginsandblock} to set
+  the \lnc{\textheight} for a particular choice of upper and lower
+  margins\index{margin}.
+
+  The typeblock is now located\index{typeblock!location} on the page.
 
 \item Pick the values for the \lnc{\headheight} and \lnc{\footskip}
-      and use \cmd{\setheadfoot}\index{header!specifying size} 
-      to specify these.
+  and use \cmd{\setheadfoot}\index{header!specifying size} to specify
+  these.
 
-\item Pick your value for \cmd{\headskip} and use \cmd{\setheaderspaces}
-      to set this and \lnc{\headmargin}.
+\item Pick your value for \cmd{\headskip} and use
+  \cmd{\setheaderspaces} to set this and \lnc{\headmargin}.
 
-\item If you are going to have any marginal\index{marginalia} notes, 
-      use \cmd{\setmarginnotes}
-      to specify the values for \lnc{\marginparsep}, \lnc{\marginparwidth}
-      and \lnc{\marginparpush}.
+\item If you are going to have any marginal\index{marginalia} notes,
+  use \cmd{\setmarginnotes} to specify the values for
+  \lnc{\marginparsep}, \lnc{\marginparwidth} and \lnc{\marginparpush}.
 
 \end{itemize}
 
@@ -3943,7 +3991,7 @@ the adjusted value, and using integer arithmetic.\footnote{In this context
 `integer arithmetic' means that the result of a division will be rounded down.
 For example $99/10$ in `real arithmetic' results in $9.9$, whereas with
 integer arithmetic the result is 9, not 10.}
-The permissable values for \meta{algorithm} are:
+The permissible values for \meta{algorithm} are:
 \begin{itemize}
 \item[\texttt{fixed}] The \lnc{\textheight} is not altered. 
 \begin{equation} T = H \end{equation}
@@ -3952,14 +4000,20 @@ for \cmd{\flushbottom} pages.
 \item[\texttt{classic}] This is the default and is the one used by the standard
 classes. 
 \begin{equation} T = b \lfloor H/b \rfloor + t \end{equation}
-The relationship (\ref{eq:heightlines}) is maintained.
+The relationship (\ref{eq:heightlines}) is maintained. This algorithm
+gets as close to $H$ as possible from below.
 \item[\texttt{lines}] This is similar to \texttt{classic}, but results in a 
 smaller final value.
 \begin{equation} T = b \lfloor (H-b)/b \rfloor + t \end{equation}
 The relationship (\ref{eq:heightlines}) is maintained.
 \item[\texttt{nearest}] The calculated value is the nearest to the given value
 while still maintaining the relationship (\ref{eq:heightlines}).
-\begin{equation} T = b \lfloor (H - t + b/2)/b \rfloor + t \end{equation}
+\begin{equation} 
+  T = b \lfloor (H - t + b/2)/b \rfloor +  t 
+\end{equation} 
+In contrast to \texttt{classic}, \texttt{nearest}
+will get as close to $H$ as possible even if this means that $T$ ends
+up being slightly larger than $H$.
 \end{itemize}
 
 \begin{table}
@@ -4005,7 +4059,8 @@ the following in a page layout specification:
     The \cmd{\fixthelayout} macro finally implements the layout,
 making due adjustement for any binding\index{binding allowance} allowance,
 and calculates the values for all the standard \ltx\ layout 
-parameters\index{page layout!LaTeX parameters?\ltx\ parameters}.
+parameters\index{page layout!LaTeX parameters?\ltx\ parameters} (such
+that packages can use these expected values).
 If you have used the class macros to change
 the layout in any way, you must call \cmd{\checkandfixthelayout} after you have
 made all the necessary changes. As an aid, the final layout parameter values
@@ -4051,7 +4106,7 @@ information about the units.
     In \Lopt{twoside} printing the spine margin is normally the same on
 both recto and verso pages and, unless the spine and \foredge{} margins are the
 same, the typeblock is shifted side to side when printing the recto and 
-verso pages. Additionaly you can have different headers and footers for the
+verso pages. Additionally you can have different headers and footers for the
 recto and verso pages. However, in \Lopt{oneside} printing the typeblock 
 is not moved and the headers and footers are the same for both odd and 
 even pages.
@@ -4513,8 +4568,8 @@ effect.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2011-03-06 19:39:20 +0100 (Sun, 06 Mar 2011) $}
-{$LastChangedRevision: 360 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 
@@ -5643,13 +5698,192 @@ a single line of a paragraph somehow looks worse at the top of a page than
 at the bottom. If all else fails, the solution is either to live with the 
 odd line or to reword the text.
 
+\section{Text case}
+\label{sec:text-case}
+
+The standard kernel \cmd{\MakeUppercase}\marg{text} and
+\cmd{\MakeLowercase}\marg{text} 
+basically upper or lower case everything it can get its hands on. This
+is not particularly nice if the \meta{text} contain, say, math.
+
+In order to help with this we provide the \cmd{\MakeTextUppercase} and
+\cmd{\MakeTextLowercase} macros from the \Lpack{textcase} package
+(\cite{textcase}) by David Carlisle. The following is DCs own
+documentation of the provided code changed to match the typography we
+use.
+
+\fancybreak{}
+
+\begin{syntax}
+  \cmd{\MakeTextUppercase}\marg{text}\\
+  \cmd{\MakeTextLowercase}\marg{text}
+\end{syntax}
+\glossary(MakeTextUppercase)
+  {\cs{MakeTextUppercase}\marg{text}}
+  {Upper case \meta{text} by leave math, references, citations and
+    \cs{NoCaseChange}\marg{text} alone.}
+\glossary(MakeTextLowercase)
+  {\cs{MakeTextLowercase}\marg{text}}
+  {Lower case \meta{text} by leave math, references, citations and
+    \cs{NoCaseChange}\marg{text} alone.}
+\cmd{\MakeTextUppercase} and \cmd{\MakeTextLowercase} are versions of
+the standard \cmd{\MakeUppercase} and \cmd{\MakeLowercase} that do not
+change the case of any math sections in their arguments.
+\begin{verbatim}
+\MakeTextUppercase{abc\ae\ \( a = b \)  and $\alpha \neq a$ 
+  or even \ensuremath{x=y} and $\ensuremath{x=y}$}
+\end{verbatim}
+Should produce:
+\begin{quotation}
+ ABC\AE\ \( a = b \)  AND $\alpha \neq a$ 
+  OR EVEN \ensuremath{x=y} AND $\ensuremath{x=y}$
+\end{quotation}
+
+We incorporates some changes suggested by Donald Arseneau so that as
+well as math mode, the arguments of \cmd{\cite}, \cmd{\label} and
+\cmd{\ref} are also prevented from being uppercased.  So you can now
+go
+\begin{verbatim}
+\MakeTextUppercase{%
+   Text in section~\ref{sec:text-case}, about \cite[pp 2--4]{textcase}}
+\end{verbatim}
+which produces
+\begin{quotation}
+\MakeTextUppercase{%
+   Text in section~\ref{sec:text-case}, about \cite[pp 2--4]{textcase}}
+\end{quotation}
+If, instead, the standard \cmd{\MakeUppercase} were used here, the keys
+`sec:text-case' and `textcase' would be uppercased and generate errors about
+undefined references to SEC:TEXT-CASE  and TEXTCASE.
+
+\begin{syntax}
+  \cmd{\NoCaseChange}\marg{text}
+\end{syntax}
+\glossary(NoCaseChange)
+ {\cs{NoCaseChange}\marg{text}}
+ {The argument of this macro is not touched by \cs{MakeTextUppercase}
+   or \cs{MakeTextLowercase}.}
+Sometimes there may be a special section of text that should not be
+uppercased. This can be marked with \cmd{\NoCaseChange}, as follows.
+\begin{verbatim}
+\MakeTextUppercase{% 
+   Text \NoCaseChange{More Text} yet more text}
+\end{verbatim}
+which produces
+\begin{quotation}
+\MakeTextUppercase{%
+   Text \NoCaseChange{More Text} yet more text}
+\end{quotation}
+
+\cmd{\NoCaseChange} has other uses. If for some reason you need a
+tabular environment within an uppercased section, then you need
+to ensure that the name `tabular' and the preamble (eg `ll')
+does not get uppercased:
+\begin{verbatim}
+\MakeTextUppercase{%
+   Text \NoCaseChange{\begin{tabular}{ll}}%
+                       table&stuff\\goes&here
+        \NoCaseChange{\end{tabular}}
+   More text}
+\end{verbatim}
+which produces
+\begin{quotation}
+\MakeTextUppercase{%
+   Text \NoCaseChange{\begin{tabular}{ll}}%^^A
+                       table&stuff\\goes&here
+        \NoCaseChange{\end{tabular}}
+   More text}
+\end{quotation}
+
+\subsection{Nested text}
+The commands defined here only skip math sections and \cmd{\ref} arguments
+if they are not `hidden' inside a \verb|{ }| brace group. All text inside
+such a group will be made uppercase just as with the standard
+\cmd{\MakeUppercase}.
+\begin{verbatim}
+\MakeTextUppercase{a b {c $d$} $e$}
+\end{verbatim}
+produces
+\begin{quotation}
+ \MakeTextUppercase{a b {c $d$} $e$}
+\end{quotation}
+Of course, this restriction does not apply to the arguments of the
+supported commands \verb|\ensuremath|, \verb|\label|, \verb|\ref|, and
+\verb|\cite|.
+
+If you cannot arrange for your mathematics to be at the outer level of
+brace grouping, you should use the following basic technique (which
+works even with the standard \cmd{\MakeUppercase} command). Define a
+new command that expands to your math expression, and then use that
+command, with \cmd{\protect}, in the text to be uppercased. Note that
+if the text being uppercased is in a section title or other moving
+argument you may need to make the definition in the document preamble,
+rather than just before the section command, so that the command is
+defined when the table of contents file is read.
+\begin{verbatim}
+\MakeTextUppercase{%
+       Text \fbox{$a=b$ and $x=y$}}%
+
+\newcommand{\mathexprone}{$a=b$}
+\newcommand{\mathexprtwo}{$x=y$}
+\MakeTextUppercase{%
+       Text \fbox{\protect\mathexprone\ and \protect\mathexprtwo}}%
+\end{verbatim}
+which produces
+\begin{quotation}
+\MakeTextUppercase{%
+       Text \fbox{$a=b$ and $x=y$}}%
+
+\newcommand{\mathexprone}{$a=b$}
+\newcommand{\mathexprtwo}{$x=y$}
+\MakeTextUppercase{%
+       Text \fbox{\protect\mathexprone\ and \protect\mathexprtwo}}%
+\end{quotation}
+
+
+\fancybreak{}
+
+See also \cite{textcase} for some information about upper casing
+citations using a non-nummeric style.
+
+
+% \subsubsection{Citations}
+% As documented above, \cmd{\cite} and \cmd{\ref} commands are not
+% uppercased by \cmd{\MakeTextUppercase}. If you are using a non-numeric
+% citation scheme you may want the replacement text for \cmd{\cite} to
+% be uppercased.
+
+% It is difficult to arrange that \cmd{\MakeTextUppercase} uppercases
+% such text, not least because this would lead to interaction with the
+% many bibliography packages which redefine \cmd{\cite} one way or
+% another. One possibility to achieve this is to use Donald Arseneau's
+% cite package and to locally redefine \cmd{\citeform} to add
+% \cmd{\MakeUppercase} around the final text string produced by \cmd{\cite}.
+% \begin{verbatim}
+% \MakeTextUppercase{%
+%        Text \cite{bbb} and \cite{ccc}}
+
+% {\renewcommand\citeform{\MakeUppercase}\MakeTextUppercase{%
+%        Text \cite{bbb} and \cite{ccc}}}
+% \end{verbatim}
+% which produces\footnote{This is faked, so this document does not
+%  rely on \texttt{cite.sty} being installed}
+% \begin{quotation}
+%  TEXT [1] AND [David Carlisle 1997]
+
+%  TEXT [1] AND [DAVID CARLISLE 1997]
+% \end{quotation}
+
+
+
+
 %#% extend
 %#% extstart include titles.tex
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-05-13 17:10:00 +0200 (Thu, 13 May 2010) $}
-{$LastChangedRevision: 210 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 
@@ -5983,10 +6217,14 @@ in the argument to the new \cmd{\published} command.
 
 \begin{syntax}
 \senv{titlingpage} text \eenv{titlingpage} \\
+\senv{titlingpage*} text \eenv{titlingpage*} 
 \end{syntax}
 \glossary(titlingpage)%
   {\senv{titlingpage}}%
-  {Environment for a title page, but I don't recommend using it.}
+  {Environment for a title page, resets the page counter to 1 after it}
+\glossary(titlingpage*)%
+  {\senv{titlingpage*}}%
+  {Like \senv{titlingpage}, but does not reset the page counter.}
    When one of the standard classes is used with the \Lopt{titlepage}
 option, \cmd{\maketitle} puts the title elements on an unnumbered page
 and then starts a new page numbered page 1. 
@@ -6003,7 +6241,8 @@ environment which falls between the \Lopt{titlepage}
 option and the \Ie{titlepage} environment. Within the \Ie{titlingpage}
 environment you can use the \cmd{\maketitle} command, and any others 
 you wish. The \pstyle{titlingpage} pagestyle is used, and 
-at the end it starts another ordinary page numbered one. 
+at the end it starts another ordinary page numbered one
+(\senv{titlingpage*} does note reset the page number). 
 The \pstyle{titlingpage} pagestyle is initially defined to be the same
 as the \pstyle{empty} pagestyle.
 
@@ -6020,9 +6259,9 @@ with a \pstyle{plain} pagestyle:
 \end{titlingpage}
 \end{lcode}
 
-    However, I suggest that you ignore the \Ie{titlingpage} environment
-and just use regular \ltx\ typesetting without any special environment.
-That is like:
+However, it is not required to use \senv{titlingpage} to create a
+title page, you can use regular \ltx\ typesetting without any special
+environment.  That is like:
 \begin{lcode}
 \pagestyle{empty}
 %%% Title, author, publisher, etc.,  here
@@ -6321,17 +6560,32 @@ setting is the initialised value, giving the default appearance.
   {Typesets a thanks mark at the foot.}
     A thanks mark in the footnote\index{footnote} region is typeset by \cmd{\thanksfootmark}.
 The code for this is roughly:
+\LMnote{2012/07/02}{Text changed to reflect the actual code}
 \begin{lcode}
 \newcommand{\thanksfootmark}{%
   \hbox to\thanksmarkwidth{\hfil\normalfont%
-     \thanksscript{\thanksfootpre \thefootnote \thanksfootpost}}}
+     \thanksscript{\thefootnote}}}
 \end{lcode}
-where \cmd{\thanksfootpre} and \cmd{\thanksfootpost} are specified via the
-\cmd{\thanksfootextra} macro. You should not need to change the definition
+You should not need to change the definition
 of \cmd{\thanksfootmark} 
 but you may want to change the default definitions of one or more
 of the macros it uses.
 
+\begin{syntax}
+\cmd{\thanksscript}\marg{text} \\
+\end{syntax}
+\glossary(thanksfootmark)%
+  {\cs{thanksfootmark}}%
+  {Handle the inner part of the thanks mark at the foot.}
+This is initially defined as: 
+\begin{lcode}
+\newcommand{\thanksscript}[1]{\textsuperscript{#1}}
+\end{lcode}
+so that \cmd{\thanksscript} typesets its argument as a superscript, which
+is the default for thanks notes.
+
+
+
 \begin{comment}
 
 \begin{syntax}
@@ -6481,8 +6735,8 @@ and thanks notes are meant to be different.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-05-13 17:10:00 +0200 (Thu, 13 May 2010) $}
-{$LastChangedRevision: 210 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 \chapter{Abstracts}
@@ -6752,8 +7006,8 @@ optional argument of the \cmd{\twocolumn} command. In fact,
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2011-02-06 17:15:11 +0100 (Sun, 06 Feb 2011) $}
-{$LastChangedRevision: 342 $}
+{$LastChangedDate: 2013-05-13 16:55:11 +0200 (Mon, 13 May 2013) $}
+{$LastChangedRevision: 459 $}
 {$LastChangedBy: daleif $}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -6846,6 +7100,7 @@ starts at the next coming recto page. (Even when running under the
 \texttt{openany} option).
 
 
+
 \begin{syntax}
 \cmd{\backmatter} \\
 \end{syntax}
@@ -6865,10 +7120,10 @@ main- or backmatter, then you can change some internals to add these
 to be numbered in the same manner as we do with figures and
 tables. They are defined as 
 \begin{lcode}
-  \newcommand\@memfront@floats{%
+\newcommand\@memfront@floats{%
   \counterwithout{figure}{chapter}
   \counterwithout{table}{chapter}}
-\newcommand\@memmain@floats{%
+\newcommand\@memmain@floats{% 
    \counterwithin{figure}{chapter}
    \counterwithin{table}{chapter}}
 \newcommand\@memback@floats{%
@@ -6877,6 +7132,20 @@ tables. They are defined as
     \setcounter{figure}{0}
     \setcounter{table}{0}}
 \end{lcode}
+%
+The macros can also be changed in case you want to have consecutive
+figure numbering throughout, i.e.,
+\begin{lcode}
+\makeatletter
+\counterwithout{figure}{chapter}
+\counterwithout{table}{chapter}
+\renewcommand\@memfront@floats{}
+\renewcommand\@memmain@floats{}
+\newcommand\@memback@floats{}
+\makeatletter
+\end{lcode}
+in the preamble.
+
 
 
 
@@ -7026,6 +7295,7 @@ the bottom of the typeblock.
 \cmd{\raggedbottomsection} \\
 \cmd{\normalbottomsection} \\
 \lnc{\bottomsectionskip} \\
+\cmd{\bottomsectionpenalty}
 \end{syntax}
 \glossary(raggedbottomsection)%
   {\cs{raggedbottomsection}}%
@@ -7037,12 +7307,20 @@ the bottom of the typeblock.
 \glossary(bottomsectionskip)%
   {\cs{bottomsectionskip}}%
   {Amount of stretch on a \cs{raggedbottomsection} short page.}
+\glossary(bottomsectionpenalty)%
+  {\cs{bottomsectionpenalty}}%
+  {Penalty on a \cs{raggedbottomsection} short page.}
 The \cmd{\raggedbottomsection} declaration will typeset any pages that 
 are short because of a moved subhead as though \cmd{\raggedbottom}
 was in effect for the short page; other pages are not affected. The
 length \lnc{\bottomsectionskip} controls the amount of stretch on the short
 page. Setting it to zero allows the last line to be flush with the bottom
-of the typeblock. The default setting of 10mm appears to remove any stretch.
+of the typeblock. The default setting of 10mm appears to remove any
+stretch. \cmd{\bottomsectionpenalty} control the penalty it costs to
+make a page break at this point. The detault is zero as the stretch is
+usually enough, by setting it to
+a negative integer one can be a bit more incouraging regarding a
+possible page break.
 
 The declaration \cmd{\normalbottomsection}, which is the default,
 cancels any previous \cmd{\raggedbottomsection} declaration.
@@ -7149,12 +7427,12 @@ in the body of the document will be preceded by the value of
 default, may be used to switch off this behaviour.
 
 \LMnote{2010/11/19}{Added this caveat, following a question on ctt}
-\textbf{Caveat:} The inplementation of the named subappencides make
+\textbf{Caveat:} The implementation of the named subappendices make
 use of \cmd{\setsecnumformat}, thus if you have used this command to
-change the formating of the section number you will need to re-do this in
-a special nammer inside the \Ie{subappencides} environemt. Something
-like this (where a user wanted to use old style numerials for
-sectioning numbers)
+change the formating of the section number you will need to re-do this
+in a special manner inside the \Ie{subappendices}
+environemt. Something like this (where a user wanted to use old style
+numerials for sectioning numbers)
 \begin{verbatim}
 \begin{subappendices}
 \setsecnumformat{\sectionname\ 
@@ -7595,7 +7873,7 @@ wish to capture the \meta{title} to use in running headers.
 
 
 \section{Chapter headings}
-
+\label{sec:chapter-headings}
 \index{heading!chapter|(}
 
     The chapter headings are configurable in much the same way as book or part 
@@ -7665,13 +7943,33 @@ The general layout is shown in \fref{lay:chap}.
   {\cs{clearforchapter}}%
   {Selects a chapter's opening page.}
 The actual macro that sets the opening page for a chapter is 
-\cmd{\clearforchapter}. The \cmd{\openright}, \cmd{\openleft} and
-\cmd{\openany} define \cmd{\clearforchapter} to be respectively
+\cmd{\clearforchapter}. The class options \texttt{openright},
+\texttt{openleft} and \texttt{openany} (or their macro equivalents
+\cmd{\openright}, \cmd{\openleft} and
+\cmd{\openany}) define \cmd{\clearforchapter} to be respectively
 (see \S\ref{sec:moving}) 
 \cmd{\cleartorecto}, \cmd{\cleartoverso} and \cmd{\clearpage}. You can
 obviously change \cmd{\clearforchapter} to do more than just start a
 new page.
 
+\begin{syntax}
+\cmd{\memendofchapterhook} 
+\end{syntax}
+\glossary(memendofchapterhook)%
+  {\cs{memendofchapterhook}}%
+  {Hook executed at the very end of the \cs{chapter} command.}
+Where \cmd{\clearforchapter} comes at the very beginning,
+\cmd{\memendofchapterhook} comes at the very end of the \cmd{\chapter}
+command. It does nothing by default, but could be redefined to insert,
+say, \cmd{\clearpage}:
+\begin{verbatim}
+\makeatletter
+\renewcommand\memendofchapterhook{%
+  \clearpage\m@mindentafterchapter\@afterheading}
+\makeatother
+\end{verbatim}
+
+
     Some books have the chapter headings on a verso page, with perhaps
 an illustration\index{illustration} or epigraph\index{epigraph}, and 
 then the text starts on the opposite
@@ -7892,13 +8190,15 @@ headings style. To use the chapterstyle \cstyle{fred} just issue the command
 Different styles can be used in the same document.
 
 The simpler predefined styles include:
+\LMnote{2011/05/25}{I've moved the chapter style images to the
+  showcase appendix to save some space in the main part of the manual}
 \begin{itemize}
 \item[\cstyle{default}] 
 \glossary(defaultcs)%
   {\Pcstyle{default}}%
   {The default \Ppack{book} class chapterstyle.}
 The normal \ltx\ \Lclass{book} class chapter styling; shown in \fref{dcdefault}.
-\begin{demochap}[-3\onelineskip]{default}\end{demochap}
+%\begin{demochap}[-3\onelineskip]{default}\end{demochap}
 
 \item[\cstyle{section}] 
 \glossary(sectioncs)%
@@ -7908,7 +8208,7 @@ The heading is typeset like a section; that is,
 there is just the number and the title on one line. This is illustrated
 in \fref{dcsection}. 
 %%    See \Cref{chap:topsandtails} on \pref{chap:topsandtails} for an example.
-\begin{demochap}[2\onelineskip]{section}\end{demochap}
+%\begin{demochap}[2\onelineskip]{section}\end{demochap}
 
 \item[\cstyle{hangnum}] 
 \glossary(hangnumcs)%
@@ -7917,7 +8217,7 @@ in \fref{dcsection}.
 Like the \pstyle{section} style except that the chapter
 number is put in the margin\index{margin!left}, as shown in \fref{dchangnum}. 
 %%    See \Cref{chap:captions} on \pref{chap:captions} for an example.
-\begin{demochap}[2\onelineskip]{hangnum}\end{demochap}
+%\begin{demochap}[2\onelineskip]{hangnum}\end{demochap}
 
 \item[\cstyle{companion}]
 \glossary(companioncs)%
@@ -7926,7 +8226,7 @@ number is put in the margin\index{margin!left}, as shown in \fref{dchangnum}.
  This produces chapter headings like those of the
 \textit{LaTeX Companion} series of books. An example is in \fref{dccompanion}.
 %%    See \Cref{chap:signposts} on \pref{chap:signposts} for an example.
-\begin{demochap}[2\onelineskip]{companion}\end{demochap}
+%\begin{demochap}[2\onelineskip]{companion}\end{demochap}
 
 \item[\cstyle{article}]
 \glossary(articlecs)%
@@ -7938,7 +8238,7 @@ number is put in the margin\index{margin!left}, as shown in \fref{dchangnum}.
 heading in the \Lclass{article} class. This is similar to the 
 \cstyle{section} style but different fonts and spacings are used,
 as shown in \fref{dcarticle}.
-\begin{demochap}[-1\onelineskip]{article}\end{demochap}
+%\begin{demochap}[-1\onelineskip]{article}\end{demochap}
 
 \item[\cstyle{reparticle}]
 \glossary(reparticlecs)%
@@ -8111,6 +8411,8 @@ styles~\cite{CHAPSTYLES} and shows how they were created.
 \cstyle{default} style before each of the others to ensure that a previous 
 style's changes are not passed on to a following one.
 
+\LMnote{2011/05/25}{I've moved the chapter style images to the
+  showcase appendix to save some space in the main part of the manual}
 \begin{itemize}
 
 \item[\cstyle{bianchi}] 
@@ -8126,7 +8428,7 @@ style's changes are not passed on to a following one.
 is in \fref{dcbianchi}.
 
 %\begin{demochap}[2\onelineskip]{bianchi}\end{demochap}
-\begin{demochap}[-2\onelineskip]{bianchi}\end{demochap}
+%\begin{demochap}[-2\onelineskip]{bianchi}\end{demochap}
 
 \item[\cstyle{bringhurst}] The \cstyle{bringhurst} chapterstyle described
   in the manual and illustrated in \fref{dcbringhurst}.
@@ -8135,7 +8437,7 @@ is in \fref{dcbianchi}.
   {A raggedright, unnumbered, small caps chapterstyle with a textwidth
    rule below.}
 
-\begin{demochap}{bringhurst}\end{demochap}
+%\begin{demochap}{bringhurst}\end{demochap}
 
 
 \item[\cstyle{brotherton}]
@@ -8152,7 +8454,7 @@ except that the number is spelt out in words. It is demonstrated in
 untitled i.e., via \verb?\chapter{}?.
 
 %\begin{demochap}[2\onelineskip]{brotherton}\end{demochap}
-\begin{demochap}[-2\onelineskip]{brotherton}\end{demochap}
+%\begin{demochap}[-2\onelineskip]{brotherton}\end{demochap}
 
 
 \item[\cstyle{chappell}] 
@@ -8164,8 +8466,7 @@ The name and number are centered above a rule and the
 title in italics is below, again centered. It is illustrated in 
 \fref{dcchappell}.
 
-\begin{demochap}{chappell}
-\end{demochap}
+%\begin{demochap}{chappell}\end{demochap}
 
 \item[\cstyle{crosshead}] 
 \glossary(crossheadcs)%
@@ -8175,9 +8476,7 @@ The number and title are centered and set with a large bold font.
 It is illustrated in 
 \fref{dccrosshead}.
 
-\begin{demochap}[-2\onelineskip]{crosshead}
-\end{demochap}
-
+%\begin{demochap}[-2\onelineskip]{crosshead}\end{demochap}
 
 
 \item[\cstyle{culver}] 
@@ -8204,7 +8503,7 @@ as shown in \fref{dcculver}.
 }
 \end{comment}
 
-\begin{demochap}[-\onelineskip]{culver}\end{demochap}
+%\begin{demochap}[-\onelineskip]{culver}\end{demochap}
 
     He also wanted sections to just start with the number and the text to 
 immediately follow on the same line. That can be accomplished like this:
@@ -8228,7 +8527,7 @@ version of the regular font is used for both the number and the title.
 This style is shown in \fref{dcdash}.
 
 %\begin{demochap}[-2\onelineskip]{dash}\end{demochap}
-\begin{demochap}[-4\onelineskip]{dash}\end{demochap}
+%\begin{demochap}[-4\onelineskip]{dash}\end{demochap}
 
 %\item[\cstyle{default}] This was already in the class but it has been revised
 %     to re-initialize all the settings.
@@ -8249,7 +8548,7 @@ This style is shown in \fref{dcdash}.
 
 
 %\begin{demochap}[-2\onelineskip]{demo2}\end{demochap}
-\begin{demochap}[-\onelineskip]{demo2}\end{demochap}
+%\begin{demochap}[-\onelineskip]{demo2}\end{demochap}
 
 \item[\cstyle{demo3}]
 \glossary(demo3cs)%
@@ -8273,8 +8572,7 @@ is based on the design used in Dowding's \textit{Finer Points}~\cite{DOWDING96}.
 It is illustrated in 
 \fref{dcdowding}.
 
-\begin{demochap}[-2\onelineskip]{dowding}
-\end{demochap}
+%\begin{demochap}[-2\onelineskip]{dowding}\end{demochap}
 
 
 \item[\cstyle{ell}] 
@@ -8289,7 +8587,7 @@ It is illustrated in
 I will probably use this in my next book. 
 
 %\begin{demochap}[6\onelineskip]{ell}\end{demochap}
-\begin{demochap}{ell}\end{demochap}
+%\begin{demochap}{ell}\end{demochap}
 
 \item[\cstyle{ger}] 
 \glossary(gercs)%
@@ -8299,11 +8597,11 @@ I will probably use this in my next book.
 This style was created by 
 Gerardo\index{Garcia, Gerardo} Garcia\footnote{\ctt,
   \textit{Fancy Headings, Chapter Headings}, 2002/04/12} and is a two line,
-  raggedleft, large bold style with rules above and below. It is
+  raggedright, large bold style with rules above and below. It is
   demonstrated in \fref{dcger}.
 
 %\begin{demochap}{ger}\end{demochap}
-\begin{demochap}[-4\onelineskip]{ger}\end{demochap}
+%\begin{demochap}[-4\onelineskip]{ger}\end{demochap}
 
 \item[\cstyle{komalike}] 
 \glossary(komalikecs)%
@@ -8314,8 +8612,8 @@ A section-like style set with a sans serif type. It is like that in the
 It is illustrated in 
 \fref{dckomalike}.
 
-\begin{demochap}[-2\onelineskip]{komalike}
-\end{demochap}
+%\begin{demochap}[-2\onelineskip]{komalike}\end{demochap}
+
 
 \item[\cstyle{lyhne}] 
 \glossary(lyhnecs)%
@@ -8330,7 +8628,7 @@ It is illustrated in
   the \Lpack{graphicx} package.
 
 %\begin{demochap}[-\onelineskip]{lyhne}\end{demochap}
-\begin{demochap}[-2\onelineskip]{lyhne}\end{demochap}
+%\begin{demochap}[-2\onelineskip]{lyhne}\end{demochap}
 
 \item[\cstyle{madsen}] 
 \glossary(madsencs)%
@@ -8347,7 +8645,7 @@ It is illustrated in
   \Lpack{graphicx} package.
 
 %\begin{demochap}[2\onelineskip]{madsen}\end{demochap}
-\begin{demochap}[-2\onelineskip]{madsen}\end{demochap}
+%\begin{demochap}[-2\onelineskip]{madsen}\end{demochap}
 
 \item[\cstyle{ntglike}] 
 \glossary(ntglikecs)%
@@ -8358,8 +8656,7 @@ classes (\Lclass{boek} class) developed by the Dutch \tx\ User Group.
 It is illustrated in 
 \fref{dcntglike}.
 
-\begin{demochap}[-3\onelineskip]{ntglike}
-\end{demochap}
+%\begin{demochap}[-3\onelineskip]{ntglike}\end{demochap}
 
 
 
@@ -8391,7 +8688,7 @@ It is illustrated in
   paragraph, and with a horizontal rule underneath. It is illustrated
   in \fref{dcsouthall}.
 
-\begin{demochap}[-\onelineskip]{southall}\end{demochap}
+%\begin{demochap}[-\onelineskip]{southall}\end{demochap}
 
 \item[\cstyle{tandh}] 
 \glossary(tandhcs)%
@@ -8402,8 +8699,7 @@ the Thames \& Hudson \textit{Manual of Typography}~\cite{MCLEAN80} and
 is illustrated in 
 \fref{dctandh}.
 
-\begin{demochap}[-1\onelineskip]{tandh}
-\end{demochap}
+%\begin{demochap}[-1\onelineskip]{tandh}\end{demochap}
 
 
 \item[\cstyle{thatcher}] 
@@ -8420,7 +8716,8 @@ A style created by
   I have modified the original to
   cater for multiline titles, unnumbered chapters, and appendices.
 
-\begin{demochap}{thatcher}\end{demochap}
+%\begin{demochap}{thatcher}\end{demochap}
+
 
 
 \item[\cstyle{veelo}]
@@ -8438,7 +8735,7 @@ A style created by
 %%\savefigcnt=1
 %\demochapcnt=8
 %\begin{demochap}{veelo}\end{demochap}
-\begin{demochap}[-2\onelineskip]{veelo}\end{demochap}
+%\begin{demochap}[-2\onelineskip]{veelo}\end{demochap}
 
 \item[\cstyle{verville}]
 \glossary(vervillecs)%
@@ -8451,7 +8748,7 @@ A style created by
   and below, as in \fref{dcverville}. Unlike my posted version, 
   this one properly caters for unnumbered chapters.
 
-\begin{demochap}{verville}\end{demochap}
+%\begin{demochap}{verville}\end{demochap}
 
 \item[\cstyle{wilsondob}] 
 \glossary(wilsondobcs)%
@@ -8463,252 +8760,21 @@ Adrian Wilson's \textit{The Design of Books}~\cite{ADRIANWILSON93} and
 is illustrated in 
 \fref{dcwilsondob}.
 
-\begin{demochap}[-1\onelineskip]{wilsondob}
-\end{demochap}
+%\begin{demochap}[-1\onelineskip]{wilsondob}\end{demochap}
 
 \end{itemize}
 
 
-    The code for some of these styles is given below.
-    For details of how the other chapter styles are defined, 
-look at the
-documented class code. This should give you ideas if you want to define
-your own style.
-
-    Note that it is not necessary to define a new chapterstyle if you want
-to change the chapter headings --- you can just change the individual macros
-without putting them into a style.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
-\subsection{Chappell}
-
-    A style that includes rules is one that I based on the chapter heads
-in~\cite{CHAPPELL99} and which I have called \cstyle{chappell} after the
-first author. The style, which is shown in \fref{dcchappell}, can easily form
-the basis for general heads in non-technical books.
-\begin{lcode}
-\makechapterstyle{chappell}{%
-  \setlength{\beforechapskip}{0pt}
-  \renewcommand*{\chapnamefont}{\large\centering}
-  \renewcommand*{\chapnumfont}{\large}
-  \renewcommand*{\printchapternonum}{%
-    \vphantom{\printchaptername}%
-    \vphantom{\chapnumfont 1}%
-    \afterchapternum
-    \vskip -\onelineskip}
-  \renewcommand*{\chaptitlefont}{\Large\itshape}
-  \renewcommand*{\printchaptertitle}[1]{%
-    \hrule\vskip\onelineskip \centering\chaptitlefont ##1}}
-\end{lcode}
-
-
-The style centers the chapter number, draws a rule across the page under
-it, and below that comes the title, again centered. All the fiddling
-in the \cs{printchapternonum} macro is to try and ensure that the rule
-above the title is at the same height whether or not the chapter is numbered
-(the ToC being an example of an unnumbered heading).
-
-\subsection{Demo, Demo2 and demo3}
-
-    I created a \cstyle{demo} chapterstyle quite a time ago and used it 
-on occasions in earlier editions of this Manual. Here is the original code.
-\begin{lcode}
-\makechapterstyle{demo}{%
-  \renewcommand*{\printchaptername}{\centering}
-  \renewcommand*{\printchapternum}{\chapnumfont \numtoName{\c@chapter}}
-  \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
-  \renewcommand*{\printchaptertitle}[1]{%
-    \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1}
-  \renewcommand*{\afterchaptertitle}%
-                {\vskip\onelineskip \hrule\vskip \afterchapskip}
-}% end demo
-\end{lcode}
-
-This has one serious failing and what I now believe is a poor design 
-decision. The failing is that if you have any appendices that use the
-\cstyle{demo} chapterstyle then they are numbered instead of being lettered.
-The poor design is that the position of the title with respect to the top
-of the page is not the same for numbered and unnumbered chapters.
-    The \cstyle{demo2} chapterstyle below fixes both of these at the expense
-of simplicity (at least for me).
-\begin{lcode}
-\makechapterstyle{demo2}{%
-  \renewcommand*{\printchaptername}{\centering}
-  \renewcommand*{\printchapternum}{\chapnumfont 
-     \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}
-  \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
-  \renewcommand*{\printchaptertitle}[1]{%
-    \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1}
-  \renewcommand*{\afterchaptertitle}{%
-    \vskip\onelineskip \hrule\vskip \afterchapskip}
-  \setlength{\beforechapskip}{3\baselineskip}
-  \renewcommand*{\printchapternonum}{%
-    \vphantom{\chapnumfont One}
-    \afterchapternum%
-    \vskip\topskip}
-  \setlength{\beforechapskip}{2\onelineskip}
-}% end{demo2}
-\end{lcode}
-    You may find it instructive to compare the code for the \cstyle{demo} and 
-\cstyle{demo2} chapterstyles.
-
-    Thec \cstyle{demo} chapterstyle is still available in the class for
-backward compatibility reasons, but I strongly advise against anyone using it.
+The code for some of these styles is given in
+section~\ref{sec:chapter-styles} within the Showcase Appendix.  For
+details of how the other chapter styles are defined, look at the
+documented class code. This should give you ideas if you want to
+define your own style.
 
-    By chance I inadvertantly typest a chapterstyle that was a mixture
-of the \cstyle{pedersen} and \cstyle{demo2} styles. As a result there is
-now a \cstyle{demo3} chapterstyle as well. The only difference between the
-two styles is in the definition of \cs{chapnumfont} which in \cstyle{demo3}
-is:
-\begin{lcode}
-\renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape}
-\end{lcode}
-
-\subsection{Pedersen}
-
-    I have modified Troels Pedersen's original code to make it a little more
-efficient and flexible. 
+Note that it is not necessary to define a new chapterstyle if you want
+to change the chapter headings --- you can just change the individual
+macros without putting them into a style.
 
-\begin{lcode}
-\newcommand*{\colorchapnum}{}
-\newcommand*{\colorchaptitle}{}
-\makechapterstyle{pedersen}{%
-  \setlength{\beforechapskip}{-20pt}
-  \setlength{\afterchapskip}{10pt}
-  \renewcommand*{\chapnamefont}{\normalfont\LARGE\itshape}
-  \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape\colorchapnum}
-  \renewcommand*{\chaptitlefont}{\normalfont\huge\itshape\colorchaptitle}
-  \renewcommand*{\afterchapternum}{}
-  \renewcommand*{\printchaptername}{}
-  \setlength{\midchapskip}{20mm}
-  \renewcommand*{\chapternamenum}{}
-  \renewcommand*{\printchapternum}{%
-    \sidebar{\raisebox{0pt}[0pt][0pt]{\makebox[0pt][l]{%
-      \resizebox{!}{\midchapskip}{\chapnumfont\thechapter}}}}}
-  \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1}
-}
-\end{lcode}
-The chapter number is scaled up from its normal size and set in a 
-sidebar\index{sidebar}.
-
-\begin{syntax}
-\cmd{\colorchapnum} \cmd{\colorchaptitle} \\
-\end{syntax}
-\glossary(colorchapnum)
-  {\cs{colorchapnum}}%
-  {Color for the number in the \Pcstyle{pedersen} chapterstyle.}
-\glossary(colorchaptitle)
-  {\cs{colorchaptitle}}%
-  {Color for the title in the \Pcstyle{pedersen} chapterstyle.}
-  The title is set with \cmd{colorchaptitle} and the number with
-\cmd{colorchapnum}, both of which default to doing nothing. 
-Lars Madsen\index{Madsen, Lars}
-has suggested an attractive red color for these:
-\begin{lcode}
-\usepackage{color}
-\definecolor{ared}{rgb}{.647,.129,.149}
-\renewcommand{\colorchapnum}{\color{ared}}
-\renewcommand{\colorchaptitle}{\color{ared}}
-\chapterstyle{pedersen}
-\end{lcode}
-
-    The uncolored version is used for the chaptersyle for this chapter;
-because of setting the number in a sidebar\index{sidebar} it does not
-display well anywhere other than as a real chapter head.
-
-\subsection{Southall}
-
-    On 2006/01/08 Thomas Dye\index{Dye, Thomas} posted his \cstyle{southall} 
-chapterstyle on \url{comp.text.tex} and kindly gave me permission to 
-include it here. It is based on the headings in a Cambridge Press 
-book\footnote{Which I haven't seen} by Aidan Southall.
-It produces a simple numbered heading with the title set as a block paragraph,
-and with a horizontal rule underneath. His original code called for lining
-figures for the number but I have commented out that bit. I also changed
-the code to eliminate the need for the two new lengths that Thomas used.
-
-\begin{lcode}
-\makechapterstyle{southall}{%
-  \setlength{\afterchapskip}{5\baselineskip}
-  \setlength{\beforechapskip}{36pt}
-  \setlength{\midchapskip}{\textwidth}
-  \addtolength{\midchapskip}{-\beforechapskip}
-  \renewcommand*{\chapterheadstart}{\vspace*{2\baselineskip}}
-  \renewcommand*{\chaptitlefont}{\huge\rmfamily\raggedright}
-  \renewcommand*{\chapnumfont}{\chaptitlefont}
-  \renewcommand*{\printchaptername}{}
-  \renewcommand*{\chapternamenum}{}
-  \renewcommand*{\afterchapternum}{}
-  \renewcommand*{\printchapternum}{%
-    \begin{minipage}[t][\baselineskip][b]{\beforechapskip}
-      {\vspace{0pt}\chapnumfont%%%\figureversion{lining} 
-                   \thechapter}
-    \end{minipage}}
-  \renewcommand*{\printchaptertitle}[1]{%
-    \hfill\begin{minipage}[t]{\midchapskip}
-      {\vspace{0pt}\chaptitlefont ##1\par}\end{minipage}}
-  \renewcommand*{\afterchaptertitle}{%
-    \par\vspace{\baselineskip}%
-    \hrulefill \par\nobreak\noindent \vskip\afterchapskip}}
-\end{lcode}
-
-The resulting style is shown in \fref{dcsouthall}.
-
-
-\subsection{Veelo}
-
-    Bastiaan Veelo 
-posted the code for a new chapter style to \pixctt\ on 2003/07/22 under the
-title \textit{[memoir] [contrib] New chapter style}. His code, which
-I have slightly modified and changed the name to \cstyle{veelo},
-is below. I have also exercised editorial privilege on his comments.
-
-\begin{quote}
- I thought I'd share a new chapter style to be used with the memoir class. 
- The style is tailored for documents that are to be trimmed to a smaller 
- width. When the bound document is bent, black tabs will appear on the 
- fore side at the places where new chapters start as a navigational aid.
- We are scaling the chapter number, which most DVI viewers
- will not display accurately. \\[0.5\onelineskip]
-Bastiaan.
-\end{quote}
-
-    In the style as I modified it, \lnc{\beforechapskip} is used as the 
-height of the number and \lnc{\midchapskip} is used as the length of the
-black bar.
-\begin{lcode}
-\newlength{\numberheight}
-\newlength{\barlength}
-\makechapterstyle{veelo}{%
-  \setlength{\afterchapskip}{40pt}
-  \renewcommand*{\chapterheadstart}{\vspace*{40pt}}
-  \renewcommand*{\afterchapternum}{\par\nobreak\vskip 25pt}
-  \renewcommand*{\chapnamefont}{\normalfont\LARGE\flushright}
-  \renewcommand*{\chapnumfont}{\normalfont\HUGE}
-  \renewcommand*{\chaptitlefont}{\normalfont\HUGE\bfseries\flushright}
-  \renewcommand*{\printchaptername}{%
-    \chapnamefont\MakeUppercase{\@chapapp}}
-  \renewcommand*{\chapternamenum}{}
-  \setlength{\beforechapskip}{18mm}
-  \setlength{\midchapskip}{\paperwidth}
-  \addtolength{\midchapskip}{-\textwidth}
-  \addtolength{\midchapskip}{-\spinemargin}
-  \renewcommand*{\printchapternum}{%
-    \makebox[0pt][l]{\hspace{.8em}%
-      \resizebox{!}{\numberheight}{\chapnumfont \thechapter}%
-      \hspace{.8em}%
-      \rule{\midchapskip}{\beforechapskip}%
-     }}%
-   \makeoddfoot{plain}{}{}{\thepage}}
-\end{lcode}
-
-
-    If you use this style you will also need to use the \Lpack{graphicx} 
-package~\cite{GRAPHICX} because of the \cmd{\resizebox} macro. 
-The \cstyle{veelo} style works best for chapters that start 
-on recto pages.
 
 
 \index{chapterstyle|)}
@@ -9015,7 +9081,7 @@ macro that takes one argument (the number and title of the heading). So,
 if for some reason you wanted \cmd{\subsubsection} titles to be all uppercase,
 centered, and in the normal font, you can do
 \begin{lcode}
-\setsubsubsecheadtstyle{\normalfont\centering\MakeUppercase}
+\setsubsubsecheadstyle{\normalfont\centering\MakeUppercase}
 \end{lcode}
 
     As another example, although I don't recommend this, you can draw a
@@ -9058,7 +9124,8 @@ particular level of heading, but for a \cmd{\section} (i.e., when
 and for a \cmd{\subparagraph} (i.e., \verb?S = subpara?), which is a run-in 
 heading, it is \verb?-1em?.
 
-
+\fancybreak{$*$}
+\fancybreak{}
 
 \begin{syntax}
 \cmd{\@hangfrom}\marg{code} \\
@@ -9120,6 +9187,14 @@ For example, to put a colon and space after the number
 Note that you have to use \verb?#1? where you want the argument 
 (sectional number) of \cmd{\@seccntformat} to go.
 
+Note that \cmd{\setsecnumformat} applies to all \cmd{\section},
+\cmd{\subsection}, etc. If you want to change it only for, say,
+\cmd{\subsection}, use the \cmd{\setsubsechook} described below.
+
+
+\fancybreak{$*$}
+\fancybreak{}
+
 \begin{syntax}
 \cmd{\hangsecnum} \\
 \cmd{\defaultsecnum} \\
@@ -9180,15 +9255,54 @@ The macro \cmd{\Shook} is called immediately before the typesetting of the
 title; its default definition does nothing. The macro \cmd{\setShook} 
 redefines \cmd{\Shook} to be \meta{text}. You can use this hook, for example,
 to insert a \cmd{\sethangfrom} or \cmd{\setsecnumformat} command into the
-definition of a particular section division command.
+definition of a particular section division command. In that case,
+remember that if you want to refer to the \verb|#1| argument, in the
+argument for \cmd{\setsecnumformat}, then you have to double the
+\verb|#|, i.e. use \verb|##1|, see the example below.
 
 Here are some example lower level heads and the code used to produce them.
 
+
+
+\newcommand*{\shortcenter}[1]{%
+  \sethangfrom{\noindent ##1}%
+  \normalfont\boldmath\bfseries
+  \centering
+  \parbox{3in}{\centering #1}\par}
+
+\begin{egsource}{egsubheads}
+\setsubsubsecheadstyle{\bfseries\raggedright}
+    \subsubsection*{Bold raggedright}
+\setsubsubsecheadstyle{\scshape\raggedright}
+    \subsubsection*{Small caps raggedright}
+\setsubsubsecheadstyle{\itshape\raggedright}
+    \subsubsection*{Italic raggedright}
+\setsubsubsecheadstyle{\Large\centering}
+    \subsubsection*{Large centered}
+\setsubsubsecheadstyle{\large\centering\MakeUppercase}
+    \subsubsection*{large centered uppercase}
+\setsubsubsecheadstyle{\bfseries\centering}
+    \subsubsection*{Bold centered}
+\setsubsubsecheadstyle{\scshape\centering}
+    \subsubsection*{Small caps centered}
+\setsubsubsecindent{2\parindent}
+\setsubsubsecheadstyle{\scshape\raggedright}
+    \subsubsection*{Small caps indented}
+\setsubsubsecindent{0pt}
+\setsubsubsecheadstyle{\itshape\raggedleft}
+    \subsubsection*{Italic flushright}
 \newcommand*{\shortcenter}[1]{%
   \sethangfrom{\noindent ##1}%
   \normalfont\boldmath\bfseries
   \centering
   \parbox{3in}{\centering #1}\par}
+\setsubsubsecheadstyle{\shortcenter}
+\subsubsection*{Bold centered but taking up no more than 3 inches
+                if a long title}
+\end{egsource}
+
+\FloatBlock
+
 
 \begin{egresult}[A variety of subhead styles]{egsubheads}
 \setsubsubsecheadstyle{\bfseries\raggedright}
@@ -9232,36 +9346,6 @@ Here are some example lower level heads and the code used to produce them.
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 
-\begin{egsource}{egsubheads}
-\setsubsubsecheadstyle{\bfseries\raggedright}
-    \subsubsection*{Bold raggedright}
-\setsubsubsecheadstyle{\scshape\raggedright}
-    \subsubsection*{Small caps raggedright}
-\setsubsubsecheadstyle{\itshape\raggedright}
-    \subsubsection*{Italic raggedright}
-\setsubsubsecheadstyle{\Large\centering}
-    \subsubsection*{Large centered}
-\setsubsubsecheadstyle{\large\centering\MakeUppercase}
-    \subsubsection*{large centered uppercase}
-\setsubsubsecheadstyle{\bfseries\centering}
-    \subsubsection*{Bold centered}
-\setsubsubsecheadstyle{\scshape\centering}
-    \subsubsection*{Small caps centered}
-\setsubsubsecindent{2\parindent}
-\setsubsubsecheadstyle{\scshape\raggedright}
-    \subsubsection*{Small caps indented}
-\setsubsubsecindent{0pt}
-\setsubsubsecheadstyle{\itshape\raggedleft}
-    \subsubsection*{Italic flushright}
-\newcommand*{\shortcenter}[1]{%
-  \sethangfrom{\noindent ##1}%
-  \normalfont\boldmath\bfseries
-  \centering
-  \parbox{3in}{\centering #1}\par}
-\setsubsubsecheadstyle{\shortcenter}
-\subsubsection*{Bold centered but taking up no more than 3 inches
-                if a long title}
-\end{egsource}
 
 \newcommand{\marginbox}[1]{%
   \parbox[t][0pt]{6em}{\itshape\raggedleft\mbox{} #1}}
@@ -9296,6 +9380,24 @@ typeset the heading. The format for the number is reset via
 \cmd{\setparahook} and \cmd{\setsecnumformat}.
 
 
+\fancybreak{$*$}
+\fancybreak{}
+
+
+A different approach is to create new macros, each named by the type
+of sectional macro it formats, and then make the number format call
+these macros.
+In this example we will provide separate formatting for \cmd{\section} and \cmd{\subsection}. 
+\begin{lcode}
+  \setsecnumformat{\csname #1secnumformat\endcsname}
+  \newcommand\sectionsecnumformat{\thesection:\quad} 
+  \newcommand\subsectionsecnumformat{\fbox{\enspace\thesubsection\enspace}\enspace}
+\end{lcode}
+Since the macro is only called in the proper context, we can use
+\cmd{\thesection} directly in the code for \cmd{\section}.
+
+
+
 \index{heading!sections|)}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -9740,8 +9842,8 @@ normal size by the time subsubsection heads are reached, or before.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2011-01-25 18:04:45 +0100 (Tue, 25 Jan 2011) $}
-{$LastChangedRevision: 335 $}
+{$LastChangedDate: 2013-05-21 16:33:04 +0200 (Tue, 21 May 2013) $}
+{$LastChangedRevision: 469 $}
 {$LastChangedBy: daleif $}
 
 \chapterstyle{demo3}
@@ -9933,7 +10035,7 @@ For reference, the full list is given in \tref{tab:callthispagestyle}.
 \begin{table}
 \centering
 \caption{The use of \protect\cs{thispagestyle}} \label{tab:callthispagestyle}
-\begin{tabular}{ll} \toprule
+\begin{tabular}{l !{\qquad} l} \toprule
 Called from & Style \\ \midrule
 \cmd{\book}    & \pstyle{book} \\
 \cmd{\chapter} & \pstyle{chapter} \\
@@ -9949,6 +10051,7 @@ Called from & Style \\ \midrule
 \Ie{thebibliography} & \pstyle{chapter} \\
 \Ie{theindex} & \pstyle{chapter} \\
 \Ie{titlingpage} & \pstyle{titlingpage} \\
+\bottomrule
 \end{tabular}
 \end{table}
 
@@ -9966,6 +10069,10 @@ Called from & Style \\ \midrule
 is \cmd{\uppercaseheads} which specifies that the titles are to be
 automatically uppercased.
 
+\textbf{Change 2012:} The upper casing macro used by \cmd{\uppercaseheads} has
+been changed into \cmd{\MakeTextUppercase} such that the upper casing
+does not touch math, references or citations.
+
 
     For the \pstyle{myheadings} pagestyle above, you have to define your own
 titles to go into the header\index{header}. Each sectioning command, 
@@ -10388,7 +10495,7 @@ help is at hand.
   {Defines the \cs{typemark} macro using \meta{text} as the mark, where
   \meta{marks} is \texttt{left}, \texttt{both} or \texttt{right}.}
 \glossary(createmark)%
-  {\cs{createmark}\marg{sec}\marg{marks}\marg{show}\marg{prefix}\marg{postix}}%
+  {\cs{createmark}\marg{sec}\marg{marks}\marg{show}\marg{prefix}\marg{postfix}}%
   {Defines the \cs{secmark} macro where \meta{show} (\texttt{shownumber} 
    or \texttt{nonumber}) controls whether the division number will be
    displayed within \cs{mainmatter}, \meta{marks} is \texttt{left}, 
@@ -10440,7 +10547,7 @@ reload the page style, for example with the default page style in \theclass\
 \end{lcode}
 
 
-    The macro \cmd{\createmark}\marg{sec}\marg{marks}\marg{show}\marg{prefix}\marg{postix}
+    The macro \cmd{\createmark}\marg{sec}\marg{marks}\marg{show}\marg{prefix}\marg{postfix}
 defines the \verb?\<sec>mark? macro where \meta{sec} is a sectional division
 such as \texttt{part}, \texttt{chapter}, \texttt{section}, etc., 
 and \meta{show} (\texttt{shownumber} 
@@ -10516,7 +10623,7 @@ titles in the header. The \pstyle{headings} pagestyle can be easily modified
 to accomplish this by simply resetting the marks for part and chapter:
 \begin{lcode}
 \makepsmarks{headings}{%
-  \creatmark{part}{left}{shownumber}{\partname\ }{. \ }
+  \createmark{part}{left}{shownumber}{\partname\ }{. \ }
   \createmark{chapter}{right}{shownumber}{\@chapapp\ }{. \ }
   \createplainmark{toc}{both}{\contentsname}
   \createplainmark{lof}{both}{\listfigurename}
@@ -10645,11 +10752,11 @@ to spot things at the \foredge\ than those nearer the spine.
 The \pstyle{ruled} page style is like this. The general plan is defined as:
 \begin{lcode}
 \makepagestyle{ruled}
-\makeevenfootruled{\thepage}{}{} % page numbers at the outside
-\makeoddfoot{ruled}{}{}{\thepage}
-\makeheadrule{ruled}{\textwidth}{\normalrulethickness}
-\makeevenhead{ruled}{\scshape\leftmark}{}{} % small caps
-\makeoddhead{ruled}{}{}{\rightmark}
+\makeevenfoot {ruled}{\thepage}{}{} % page numbers at the outside
+\makeoddfoot  {ruled}{}{}{\thepage}
+\makeheadrule {ruled}{\textwidth}{\normalrulethickness}
+\makeevenhead {ruled}{\scshape\leftmark}{}{} % small caps
+\makeoddhead  {ruled}{}{}{\rightmark}
 \end{lcode}
 The other part of the specification has to ensure that the \cmd{\chapter}
 and \cmd{\section} commands make the appropriate marks for the headers.
@@ -10905,6 +11012,7 @@ zero-sized picture starts off with \verb?begin{picture}(0,0)...?.}
 \begin{syntax}
 \cmd{\framepichead} \\
 \cmd{\framepictextfoot} \\
+\cmd{\framepichook} \\
 \cmd{\showheadfootlocoff} \\
 \cmd{\showtextblockoff} \\
 \end{syntax}
@@ -10916,6 +11024,10 @@ zero-sized picture starts off with \verb?begin{picture}(0,0)...?.}
   {\cs{framepictextfoot}}%
   {Used by the \Ppstyle{showlocs} pagestyle to draw a box around the textblock
    and a line at the footer location.}
+\glossary(framepichook)%
+  {\cs{framepichook}}%
+  {First thing called inside the zero width pictures provided by
+    \cs{framepichead} and \cs{framepictextfoot}. Empty by default.}%
 \glossary(showtextblockoff)%
   {\cs{showtextblockoff}}%
   {Prevents \cs{framepictextfoot} from drawing a box around the textblock.}
@@ -10923,7 +11035,7 @@ zero-sized picture starts off with \verb?begin{picture}(0,0)...?.}
   {\cs{showheadfootlocoff}}%
   {Prevents \cs{framepichead} and \cs{framepictextfoot} from drawing
    lines at the header and footer locations.}
-
+%
 The macro \cmd{\framepichead} creates a zero-sized\index{zero-sized picture} 
 picture that draws a line at the header location, and the macro 
 \cmd{\framepictextfoot} creates a zero-sized\index{zero-sized picture} 
@@ -10934,9 +11046,16 @@ and also draws a box around the typeblock. Following the declaration
 locations. The declaration \cmd{\showtextblockoff} prevents
 \cmd{\framepictextfoot} from drawing a box around the textblock.
 
+In case you want to change the color of the \pstyle{showlocs}, simply do
+\begin{lcode}
+  \renewcommnand\framepichook{\color{red}}
+\end{lcode}
+
+
+
     If you generally want a box around the textblock you may want to create
 your own pagestyle using \cmd{\framepictextfoot} and the \pstyle{showlocs}
-code as a starting point.
+code as a starting point, see \path{memoir.cls} for details.
 
 
 \section{Other things to do with page styles}
@@ -10985,8 +11104,8 @@ like:
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-05-13 17:10:00 +0200 (Thu, 13 May 2010) $}
-{$LastChangedRevision: 210 $}
+{$LastChangedDate: 2013-05-22 16:29:23 +0200 (Wed, 22 May 2013) $}
+{$LastChangedRevision: 470 $}
 {$LastChangedBy: daleif $}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -11005,7 +11124,7 @@ paragraphing, like quotations\index{quotation} or lists.
 
 \section{Paragraphs}
 
-\index{paragraph|(}
+\index{paragraph|(} %|
 
     There are basically two parameters that control the appearance of normal
 paragraphs.
@@ -11061,7 +11180,7 @@ page, even if the textwidths on the two pages are different.
 
 \subsection{Hanging paragraphs}
 
-\index{paragraph!hanging|(}
+\index{paragraph!hanging|(} %|
 
     A hanging paragraph is one where the length of the first few lines differs
 from the length of the remaining lines. (A normal indented paragraph 
@@ -11146,9 +11265,9 @@ Nyman\index{Nyman, Patrick} which he posted on \ctt{} in January 2004.
 \end{lcode}
   
 
-\index{paragraph!hanging|)}
+\index{paragraph!hanging|)}%|
 
-\index{paragraph|)}
+\index{paragraph|)} %|
 
 \section{Flush and ragged}
 
@@ -11343,7 +11462,7 @@ a line may give a surprising result. If so, the following may help.
 \begin{syntax}
 \cmd{\atcentercr} \\
 \cmd{\break} \\
-\cmd{\memoirgdbs} \\
+\cmd{\memorigdbs} \\
 \cmd{\memorigpar} \\
 \end{syntax}
 \glossary(atcentercr)%
@@ -11352,8 +11471,8 @@ a line may give a surprising result. If so, the following may help.
 \glossary(break)%
   {\cs{break}}%
   {TeX macro to break a line.}
-\glossary(memoirgdbs)%
-  {\cs{memoirgdbs}}%
+\glossary(memorigdbs)%
+  {\cs{memorigdbs}}%
   {Stores the original definition of \texttt{\bs}\texttt{\bs}.} % not \cs{\}
 \glossary(memorigpar)%
   {\cs{memorigpar}}%
@@ -11366,7 +11485,7 @@ or \cmd{\break}, which is a \tx\ command to end a line.
    In some cases the paragraph shaping commands change the definitions 
 of \cmd{\\} or \cs{par}. Just in case you need to restore them, copies
 of the original definitions are in
-\cmd{\memoirgdbs} (for \cmd{\\}) and \cmd{\memorigpar} (for \cs{par}).
+\cmd{\memorigdbs} (for \cmd{\\}) and \cmd{\memorigpar} (for \cs{par}).
 
 \begin{syntax}
 \cmd{\flushleftright} \\
@@ -11616,9 +11735,9 @@ margins\index{margin!left}\index{margin!right} by equal amounts.
 Generally speaking it is not a 
 good idea to change the textwidth but sometimes it may be called for.
 
-    The commands and environment described below are similar to those
-in the \Lpack{chngpage} package~\cite{CHNGPAGE}, but do differ in some 
-respects.
+The commands and environment described below are similar to those in
+the originally found in the \Lpack{chngpage} package, but do differ in
+some respects.
 
 \begin{syntax}
 \senv{adjustwidth}\marg{left}\marg{right} text \eenv{adjustwidth} \\
@@ -11759,7 +11878,7 @@ if necessary reset it to its original value --- the default value for
 
 \section{Lists}
 
-\index{list|(}
+\index{list|(} %|
 
     Standard \ltx\ provides four kinds of lists. There is a general \Ie{list}
 environment which you can use to define your own particular kind of list,
@@ -11933,9 +12052,39 @@ counter typeset as a lowercase Roman numeral followed by a single parenthesis
 \begin{lcode}
 \begin{enumerate}[i)] 
 ...
-\end{lcode}
+\end{lcode} 
+
+
+\LMnote{2013/05/16}{Added hint about enumitem}
+\begin{hint}
+  \theclass\ does not provide high level interfaces to configure the
+  appearance. We provide some simple tools to adjust vertical spacing,
+  see below.
+
+  Users seeking more control can have a look at the \Lpack{enumitem}
+  package by Javier Bezos. If loaded as
+  \begin{lcode}
+    \usepackage[shortlabels]{enumitem}
+  \end{lcode}
+  then our
+  \begin{lcode}
+    \begin{enumerate}[i)] 
+     \item \label{item:tst}  ...
+  \end{lcode}
+  syntax will work out of the box.
+
+  One difference though: In \theclass\ \verb?\ref{item:tst}? will give you
+  `i', whereas, if \Lpack{enumitem} is loaded the full formatting is
+  returned from the cross reference, i.e., `i)'. This is fully
+  configurable in \Lpack{enumitem}.
+\end{hint}
+
+
+
+
+
+\index{list!tight|(} %|
 
-\index{list!tight|(}
 
 \begin{syntax}
 \cmd{\tightlists} \cmd{\defaultlists} \\
@@ -11960,6 +12109,7 @@ counter typeset as a lowercase Roman numeral followed by a single parenthesis
    the environments.}
 
 
+
 The normal LaTeX \Ie{description}, \Ie{itemize} and \Ie{enumerate} lists 
 have an open
 look about them when they are typeset as there is significant vertical space
@@ -11990,7 +12140,7 @@ that list. The \cmd{\tightlist} removes all the spaces while the
 \cmd{\firmlist} produces a list that still has some space but not as much
 as in an ordinary list.
 
-\index{list!tight|)}
+\index{list!tight|)} %|
 
 
 \begin{figure}
@@ -12000,7 +12150,7 @@ as in an ordinary list.
 \caption{The layout parameters for general lists}\label{fig:listlay}
 \end{figure}
 
-\index{list!new|(}
+\index{list!new|(} %|
 
 \begin{syntax}
 \senv{list}\marg{default-label}\marg{code} items \eenv{list} \\
@@ -12088,7 +12238,7 @@ It is a matter of taste whether you use the command or \verb?\begin{...}?
 and \verb?\end{...}? forms, but the latter does make it more obvious that
 an environment is being dealt with.
 
-\index{list!new|)}
+\index{list!new|)} %|
 
     Several \ltx\ environments are defined in terms of a very simple list,
 called a \Ie{trivlist}. Such a list has little internal structure
@@ -12168,7 +12318,7 @@ The example (\ref{eg:trivseps}) shows how it is possible to change the
 spacing around the \Ie{center} environment, but it applies equally to the 
 other environments.
 
-\index{list|)}
+\index{list|)} %|
 
 %#% extend
 
@@ -12176,8 +12326,8 @@ other environments.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-12-20 14:07:25 +0100 (Mon, 20 Dec 2010) $}
-{$LastChangedRevision: 327 $}
+{$LastChangedDate: 2013-05-08 17:14:46 +0200 (Wed, 08 May 2013) $}
+{$LastChangedRevision: 457 $}
 {$LastChangedBy: daleif $}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -12212,18 +12362,22 @@ standard classes, the unstarred versions add their respective titles to
 the \toc. The starred versions act like the standard classes' unstarred 
 versions as they don't add their titles to the \toc.
 
-    This chapter explains the inner workings behind the \toc, and friends,
+    This chapter explains the inner workings behind the \toc\ and friends,
 how to change their appearance and the apperance of the entries, and how to
 create new \listofx. If you don't need any of these then you can
 skip the remainder of the chapter.
 
  \section{General \prtoc\ methods}
 
-    To provide some background information this is a general description
-of how the standard \ltx\ classes process a Table of Contents (\toc).
-As the processing of List of Figures (\lof) and List of Tables (\lot) is 
-similar I will just discuss the \toc. You may wish to skip this section
-on your first reading.
+ In \S\ref{sec:class-prtoc-methods} we will provide the class
+ configuration interface for the various parts of the ToC. 
+
+ In order to understand how these macros are used, we start by
+ providing some background information this is a general description
+ of how the standard \ltx\ classes process a Table of Contents (\toc).
+ As the processing of List of Figures (\lof) and List of Tables (\lot)
+ is similar I will just discuss the \toc. You may wish to skip this
+ section on your first reading.
 
     The basic process is that each sectioning command writes out information
 about itself --- its number, title, and page --- to the \pixfile{toc} file.
@@ -12337,14 +12491,14 @@ which performs the actual typesetting of the \cmd{\contentsline} entry.
 \end{syntax}
 \glossary(@pnumwidth)%
   {\cs{@pnumwidth}\marg{length}}%
-  {Space for a page number in the \prtoc, etc.}
+  {Space for a page number in the \prtoc\ etc.}
 \glossary(@tocrmarg)%
   {\cs{@tocrmarg}\marg{length}}%
-  {Right hand margin for titles in the \prtoc, etc.}
+  {Right hand margin for titles in the \prtoc\ etc.}
 \glossary(@dotsep)%
   {\cs{@docsep}\marg{num}}%
   {Distance, as \meta{num} math units, bewteen dots in the dotted lines 
-   in the \prtoc, etc.}
+   in the \prtoc\ etc.}
 The general layout of a typeset entry is illustrated in \fref{fig:ltoc}. 
 There are three
 internal \ltx\ commands that are used in the typesetting. The page
@@ -12547,6 +12701,7 @@ document you have to do it like this:
  \end{itemize}
  
  \section{The class \prtoc{} methods} 
+ \label{sec:class-prtoc-methods}
 
   The class provides various means of changing the look of the \toc, etc.,
 without having to go through some of the above. 
@@ -12639,7 +12794,7 @@ is equivalent to \cs{listoffigures*}.
   {Set the ToC, etc., in one or two columns according to the class option.}
 
 
-In the standards classes the \toc, etc., are set in one column even if the
+In the standard classes the \toc, etc., are set in one column even if the
 document as a whole is set in two columns. This limitation is removed.
 Following the \cmd{\onecoltocetc} declaration, which is the default, the
 \toc\ and friends will be set in one column but after the \cmd{\twocoltocetc}
@@ -12657,21 +12812,23 @@ document class \Lopt{onecolumn} or \Lopt{twocolumn} option.
 \glossary(settocdepth)%
   {\cs{settocdepth}\marg{secname}}%
   {Sets the value of the \Pcn{tocdepth} counter in the \file{toc} file.}
-The class \cmd{\maxtocdepth} command sets the maximum 
-allowable value
-for the \Icn{tocdepth} counter. If used, the command must appear
-before the \cmd{\tableofcontents} command. By default, the class
-sets \verb?\maxtocdepth{section}?.
+% The class \cmd{\maxtocdepth} command sets the maximum 
+% allowable value
+% for the \Icn{tocdepth} counter. If used, the command must appear
+% before the \cmd{\tableofcontents} command. By default, the class
+% sets \verb?\maxtocdepth{section}?.
+\LMnote{2013/04/24}{As far as I can see \cs{maxtocdepth} is not used
+  anywhere. Manual clarified, see http://tex.stackexchange.com/a/97018/3929}
+The class \cmd{\maxtocdepth} command sets the \Icn{tocdepth}
+counter. It is currently not used in the \Lclass{memoir} class.
 
-    The \Lclass{memoir} class command \cmd{\settocdepth} is somewhat
-analagous to the \cmd{\setsecnumdepth} command 
-described in \S\ref{sec:secnumbers}.
-It sets the value of the \Icn{tocdepth} counter and puts it into
-the \toc{} to (temporarily) modify what will appear. 
-The command can only be used after the preamble\index{preamble}
-but may be used before calling the \cmd{\tableofcontents}.
-The \cmd{\settocdepth} and \cmd{\maxtocdepth} macros are from the 
-\Lpack{tocvsec2} package~\cite{TOCVSEC2}.
+
+The \Lclass{memoir} class command \cmd{\settocdepth} is somewhat
+analagous to the \cmd{\setsecnumdepth} command described in
+\S\ref{sec:secnumbers}.  It sets the value of the \Icn{tocdepth}
+counter and puts it into the \toc{} to (temporarily) modify what will
+appear.  The \cmd{\settocdepth} and \cmd{\maxtocdepth} macros are from
+the \Lpack{tocvsec2} package~\cite{TOCVSEC2}.
 
 
 \begin{syntax}
@@ -12710,7 +12867,7 @@ of the \cmd{\contentsname}, \cmd{\listfigurename} and \cmd{\listtablename}
 commands.
 
  The commands for controlling the typesetting of the \toc, \lof\ and \lot\ 
-titles all follow a similar pattern So for convenience (certainly mine, 
+titles all follow a similar pattern, so for convenience (certainly mine, 
 and hopefully yours) in the following descriptions I will use \texttt{X},
 as listed in \tref{tab:Xlistofxtitles},
 to stand for the file extension for the appropriate \listofx. That is, any
@@ -13055,8 +13212,9 @@ margin\index{margin!left} (\textit{indent} in \fref{fig:ltoc}). It
  an entry.
  This is a simplified pseudo-code version for the typesetting of numbered 
  and unnumbered entries.
+\LMnote{2012/07/29}{Added extra brace pair}
  \begin{lcode}
- {\cftKfont {\cftKname \cftKpresnum SNUM\cftKaftersnum\hfil} \cftKaftersnumb TITLE}
+ {\cftKfont {{\cftKname \cftKpresnum SNUM\cftKaftersnum\hfil} \cftKaftersnumb TITLE}}
          {\cftKleader}{\cftKformatpnum{PAGE}}\cftKafterpnum\par
 
  {\cftKfont TITLE}{\cftKleader}{\cftKformatpnum{PAGE}}\cftKafterpnum\par
@@ -13067,16 +13225,31 @@ and \texttt{PAGE}
 \begin{lcode}
 {\cftKpresnum SNUM\cftaftersnum\hfil}
 \end{lcode}
- is typeset within a box of width \lnc{\cftKnumwidth}.
+ is typeset within a box of width \lnc{\cftKnumwidth}, see the
+ \cs{...numberlinebox} macros later on.
 
 \begin{syntax}
 \cmd{\cftKfont} \\
 \end{syntax}
 \glossary(cftKfont)%
-  {\cs{cftKfont}}%
-  {Controls the appearance of the number and title of a `K' entry in a \listofx.}
- This controls the appearance of the title (and its preceding number, 
- if any). It may be changed using \cmd{\renewcommand}.
+{\cs{cftKfont}}%
+{Controls the appearance of the number and title of a `K' entry in a \listofx.}
+This controls the appearance of the title (and its preceding number, 
+if any). It may be changed using \cmd{\renewcommand}. 
+
+\cmd{\cftKfont} takes no arguments as such, but the the number and
+title is presented to it as an argument. Thus one may end
+\cmd{\cftKfont} with a macro taking one argument, say
+\cmd{\MakeUppercase}, and which then readjust the text as needed.
+
+\begin{caveat}
+  Please read the section entitled
+  \emph{\titleref{sec:about-upper-og}} on
+  page~\pageref{sec:about-upper-og} if you consider using upper/lower
+  cased TOC entries and especially if you are also using the
+  \Lpack{hyperref} package.
+\end{caveat}
+
 
 \begin{syntax}
 \cmd{\cftKname} \\
@@ -13121,15 +13294,29 @@ number in a \toc\ and `Fig.' before each figure number in a \lof\ do:
 
 
 \begin{syntax}
-\cmd{\booknumberline}\marg{num} \\
+\cmd{\numberline}\marg{num} \\
+\cmd{\partnumberline}\marg{num} \\
 \cmd{\partnumberline}\marg{num} \\
 \cmd{\chapternumberline}\marg{num} \\
 \end{syntax}
+\glossary(numberline)
+  {\cs{numberline}\marg{num}}
+  {Typeset sectional number for \cs{section} and siblings in ToC}
+\glossary(partnumberline)
+  {\cs{partnumberline}\marg{num}}
+  {Typeset part number in ToC}
+\glossary(booknumberline)
+  {\cs{booknumberline}\marg{num}}
+  {Typeset book number in ToC}
+\glossary(chapternumberline)
+  {\cs{chapternumberline}\marg{num}}
+  {Typeset chapter number in ToC}
 In the \toc, the macros \cmd{\booknumberline}, \cmd{\partnumberline} and 
 \cmd{\chapternumberline}
 are responsible respectively for typesetting the \cmd{\book}, \cmd{\part} 
 and \cmd{\chapter}
-numbers. Internally they use \cmd{\cftKpresnum}, \cmd{\cftKaftersnum}
+numbers, whereas \cmd{\numberline} does the same for the sectional
+siblings. Internally they use \cmd{\cftKpresnum}, \cmd{\cftKaftersnum}
 and \cmd{\cftKaftersnumb} as above. If you do not want, say, 
 the \cmd{\chapter} number to appear you
 can do:
@@ -13137,6 +13324,83 @@ can do:
 \renewcommand{\chapternumberline}[1]{}
 \end{lcode}
 
+
+\begin{syntax}
+  \cmd{\numberlinehook}\marg{num}\\
+  \cmd{\cftwhatismyname}\\
+  \cmd{\booknumberlinehook}\marg{num}\\
+  \cmd{\partnumberlinehook}\marg{num}\\
+  \cmd{\chapternumberlinehook}\marg{num}\\
+  \cmd{\numberlinebox}\marg{length}\marg{code}\\
+  \cmd{\booknumberlinebox}\marg{length}\marg{code}\\
+  \cmd{\partnumberlinebox}\marg{length}\marg{code}\\
+  \cmd{\chapternumberlinebox}\marg{length}\marg{code}\\
+\end{syntax}
+\glossary(numberlinehook)
+ {\cs{numberlinehook}\marg{num}}
+ {The first thing to be called within \cs{numberline}, does nothing by
+ default.}
+\glossary(cftwhatismyname)
+ {\cs{cftwhatismyname}}
+ {Since \cs{numberline} is shared by \cs{section} and siblings, 
+   \cs{cftwhatismyname} can be used to tell which section type is
+   calling \cs{numberlinehook}}
+\glossary(partnumberlinehook)
+ {\cs{partnumberlinehook}\marg{num}}
+ {The first thing to be called within \cs{partnumberline}, does nothing by
+ default.}
+\glossary(booknumberlinehook)
+ {\cs{booknumberlinehook}\marg{num}}
+ {The first thing to be called within \cs{booknumberline}, does nothing by
+ default.}
+\glossary(chapternumberlinehook)
+ {\cs{chapternumberlinehook}\marg{num}}
+ {The first thing to be called within \cs{chapternumberline}, does nothing by
+ default.}
+\glossary(numberlinebox)
+ {\cs{numberlinebox}\marg{length}\marg{code}}
+ {The box command used to typeset the sectional number within the ToC,
+   note that it will automatically align to the left}
+\glossary(partnumberlinebox)
+ {\cs{partnumberlinebox}\marg{length}\marg{code}}
+ {The box command used to typeset the part number within the ToC, 
+   note that it will automatically align to the left}
+\glossary(booknumberlinebox)
+ {\cs{booknumberlinebox}\marg{length}\marg{code}}
+ {The box command used to typeset the book number within the ToC, 
+   note that it will automatically align to the left}
+\glossary(chapternumberlinebox)
+ {\cs{chapternumberlinebox}\marg{length}\marg{code}}
+ {The box command used to typeset the chapter number within the ToC, 
+   note that it will automatically align to the left}
+Inside the four \cs{...numberline} macros, the first thing we do is to
+give the \cs{...numberline} argument to a hook. By default this hook
+does nothing. But, with the right
+tools,\footnote{Which we do not currently supply\dots, but have a look
+at Sniplet~\ref{snip:autotoc} on page~\pageref{snip:autotoc}.}
+they can be used to record the widths of the sectional number. Which then
+can be used to automatically adjust the various \meta{numwidth} and
+\meta{indent} within the \cs{cftsetindents} macro. In order to 
+tell the section types apart (they all use \cmd{\numberline}), the
+value of the \cmd{\cftwhatismyname} macro will locally reflect the
+current type. 
+
+As mentioned earlier, the \cmd{\book}, \cmd{\part} and \cmd{\chapter}
+numbers are typeset inside a box of certain fixed withs. Sometimes it
+can be handy \emph{not} having this box around. For this you can
+redefine one of the four \cs{...numberlinebox} macros listed
+above. For example via
+\begin{lcode}
+  \renewcommand\chapternumberlinebox[2]{#2}
+\end{lcode}
+The first argument is the width of the box to be made.  All four
+macros are defined similar to this (where \texttt{\#1} is a length)
+\begin{lcode}
+\newcommand\chapternumberlinebox[2]{%
+  \hb@xt@#1{#2\hfil}}
+\end{lcode}
+
+
 \begin{comment}
 \Note{}  Because the \Lpack{hyperref} package~\cite{HYPERREF} 
 does not understand
@@ -13161,13 +13425,21 @@ the \Lpack{memhfixc} package, which comes with memoir.
  The spacing between any dots in the leader is controlled by \cmd{\cftKdotsep} 
  (\cmd{\@dotsep} in \fref{fig:ltoc}).
  It can be changed by \cmd{\renewcommand} and its value must be either a
- number (e.g., 6.6 or \cmd{\cftdotsep}) or \cmd{\cftnodots} (to disable the dots).
- The spacing
- is in terms of \emph{math units} where there are 18mu to 1em.
+ number (e.g., 6.6 or \cmd{\cftdotsep}) or \cmd{\cftnodots} (to
+ disable the dots). The spacing is in terms of \emph{math units} where
+ there are 18mu to 1em. 
 
+The default leaders macro is similar to
+\begin{lcode}
+  \newcommand{\cftsectionleader}{\normalfont\cftdotfill{\cftsectiondotsep}}
+\end{lcode}
+Note that the spacing of the dots is affected by the font size (as the
+math unit is affected by the font size). Also note that the
+\cmd{\cftchapterleader} is bold by default.
 
 \begin{syntax}
 \cmd{\cftKformatpnum}\marg{pnum} \\
+\cmd{\cftKformatpnumhook}\marg{num}\\
 \cmd{\cftKpagefont} \\
 \end{syntax}
 \glossary(cftKformatpnum)%
@@ -13176,20 +13448,31 @@ the \Lpack{memhfixc} package, which comes with memoir.
 \glossary(cftKpagefont)%
   {\cs{cftKpagefont}}%
   {Font for the page number of a  `K' entry in a \listofx.} 
+\glossary(cftKformatpnumhook)%
+ {\cs{cftKformatpnumhook}\marg{num}}%
+ {When formatting the page number in the ToC (via
+   \cs{cftKformatpnum}) this hook is given the page value. Does nothing by default}%
 The macro \cmd{\cftKformatpnum} typesets an entry's page number, using
 the \cmd{\cftKpagefont}.\footnote{This addition to the class was suggested
 by Dan\index{Luecking, Daniel} Luecking, \ctt\ \textit{Re: setting numbers in toc in their natural width box,} 2007/08/15.}
 The default definition is essentially:
 \begin{lcode}
 \newcommand*{\cftKformatpnum}[1]{%
+  \cftKformatpnumhook{#1}%
   \hbox to \@pnumwidth{\hfil{\cftKpagefont #1}}}
 \end{lcode}
 which sets the number right justified in a box \lnc{\@pnumwidth} wide.
 To have, say, a \cmd{\part} page number left justified in its box, do:
 \begin{lcode}
 \renewcommand*{\cftpartformatpnum}[1]{%
+  \cftpartformatpnumhook{#1}%
   \hbox to \@pnumwidth{{\cftpartpagefont #1}}}
 \end{lcode}
+The \cmd{\cftKformatpnumhook} does nothing by default (other than
+eating the argument), but could be redefined to record the widest page
+number and report it back, even reusing it to auto adjust on the next
+run to set \cs{@pnumwidth} (see \cmd{\setpnumwidth}).
+
 
 \begin{syntax}
 \cmd{\cftKafterpnum} \\
@@ -13291,6 +13574,22 @@ Note that the same font should be used for the title, leader and page
  \addtolength{\cftKnumwidth}{\mylen} % add the extra space
  \end{lcode} 
 
+\LMnote{2012/07/29}{Added this example}
+\item To set the chapter number and title as just
+  `NUM\enspace\textperiodcentered\enspace TITLE', i.e. un-boxed number
+  plus a symbolic separator, use
+  \begin{lcode}
+  \renewcommand\cftchapteraftersnumb{\enspace\textperiodcentered\enspace}
+  \renewcommand\chapternumberlinebox[2]{#2}  
+  \end{lcode}
+  -- of couse, it works best, only if the TITLE is a single line.
+
+
+\item Make chapter titles lower case small caps
+  \begin{lcode}
+    \renewcommand\cftchapterfont{\scshape\MakeTextLowercase}
+  \end{lcode}
+  -- here we do not touch the case of any math.
 
  \item To set the section numbers flushright:
  \begin{lcode}
@@ -13502,9 +13801,52 @@ alterations to a \listofx\ on the fly. For example:
 If you do not use \cmd{\cftinsertcode} \emph{before} calling the command to
 type the \listofx\ that it is intended for then nothing will happen. No
 harm will come if a matching \cmd{\cftinserthook} is never used. No harm
-occures either if you call \cmd{\cftinserthook} and there is no prior
+occurs either if you call \cmd{\cftinserthook} and there is no prior
 matching \cmd{\cftinsertcode}.
 
+One use of these \toc{} hooks is reusing the \toc{} data to, say,
+create chapter \toc's. The code for this is shown in
+Sniplet~\ref{snip:chaptertoc} on page~\pageref{snip:chaptertoc}. In
+the sniplet we use the following two hooks that are executed right
+before and right after \cmd{\chapter}, \cmd{\part}, \cmd{\book},
+\cmd{\appendixpage}  writes to the \toc{}. By default
+they do nothing.\footnote{More hooks may be added in later releases.}
+\begin{syntax}
+  \cmd{\mempreaddchaptertotochook}\\
+  \cmd{\mempostaddchaptertotochook}\\
+  \cmd{\mempreaddparttotochook}\\
+  \cmd{\mempostaddparttotochook}\\
+  \cmd{\mempreaddbooktotochook}\\
+  \cmd{\mempostaddbooktotochook}\\
+  \cmd{\mempreaddapppagetotochook}\\
+  \cmd{\mempostaddapppagetotochook}
+\end{syntax}
+\glossary(mempreaddchaptertotochook)%
+  {\cs{mempreaddchaptertotochook}}%
+  {Hook executed right \emph{before} \cs{chapter} writes to the \protect\toc{}}
+\glossary(mempostaddchaptertotochook)%
+  {\cs{mempostaddchaptertotochook}}%
+  {Hook executed right \emph{after} \cs{chapter} writes to the \protect\toc{}}
+\glossary(mempreaddparttotochook)%
+  {\cs{mempreaddparttotochook}}%
+  {Hook executed right \emph{before} \cs{part} writes to the \protect\toc{}}
+\glossary(mempostaddparttotochook)%
+  {\cs{mempostaddparttotochook}}%
+  {Hook executed right \emph{after} \cs{part} writes to the \protect\toc{}}
+\glossary(mempreaddbooktotochook)%
+  {\cs{mempreaddbooktotochook}}%
+  {Hook executed right \emph{before} \cs{book} writes to the \protect\toc{}}
+\glossary(mempostaddbooktotochook)%
+  {\cs{mempostaddbooktotochook}}%
+  {Hook executed right \emph{after} \cs{book} writes to the \protect\toc{}}
+\glossary(mempreaddapppagetotochook)%
+  {\cs{mempreaddapppagetotochook}}%
+  {Hook executed right \emph{before} \cs{appendixpage} writes to the \protect\toc{}}
+\glossary(mempostaddapppagetotochook)%
+  {\cs{mempostaddapppagetotochook}}%
+  {Hook executed right \emph{after} \cs{appendixpage} writes to the \protect\toc{}}
+
+
 
 \LMnote{2010/06/09}{Ineffective to have this seceral places in the manual.}
 \subsubsection{Extra chapter material in the ToC}
@@ -13518,6 +13860,56 @@ the \pixfile{toc} file. Further information as to the definition of
 this macro can be found in section~\ref{sec:chapter-precis}.
 
 
+\LMnote{2012/09/21}{added}
+\subsubsection{About upper og lower casing TOC entries}
+\label{sec:about-upper-og}
+
+Some designs call for upper (or lower casing) TOC entries. This
+\emph{is} possible but the solution depends on whether the
+\Lpack{hyperref} package is used or not.
+
+Without \Lpack{hyperref} one can simply end the \cs{cftKfont} with say
+\cs{MakeTextUppercase} and the \texttt{K}-type entry will be upper cased.
+
+With \Lpack{hyperref} the possibilities are limited. Explanation: The
+upper/lower casing macros are not that robust, and need the content to
+be simple.\footnote{For some definition of simple.} When
+\Lpack{hyperref} is used, the hyperlink is wrapped around the entry
+before \cs{cftKfont} gains access to it, and is thus generally too
+complicated for, say, \cs{MakeTextUppercase} to handle. The follow
+workaround draw inspiration from
+\url{http://tex.stackexchange.com/q/11892/3929}.
+\begin{syntax}
+  \cmd{\settocpreprocessor}\marg{type}\marg{code}
+\end{syntax}
+\glossary(settocpreprocessor)%
+  {\cs{settocpreprocessor}\marg{type}\marg{code}}
+  {Provide a method for preprocessing certain TOC entries before they
+    are written to the \texttt{.toc} file.}
+Here \meta{type} is one of \texttt{chapter}, \texttt{part} or
+\texttt{book}.\footnote{If needed we will attempt to add a similar
+  feature to the rest of the sectional types, please write the
+  maintainer.} And \meta{code} can be something like this example:
+\begin{verbatim}
+\makeatletter
+\settocpreprocessor{chapter}{%
+  \let\tempf@rtoc\f@rtoc%
+  \def\f@rtoc{%
+    \texorpdfstring{\MakeTextUppercase{\tempf@rtoc}}{\tempf@rtoc}}%
+}
+\makeatother
+\end{verbatim}
+Where \cs{f@rtoc} is a placeholder inside \cmd{\chapter}, \cmd{\part}
+and \cmd{\book}, holding the material to be written to the actual TOC
+file before \Lpack{hyperref} accesses it. This way the upper casing is
+sneaked into the TOC file, and the bookmark part of \Lpack{hyperref}
+will not complain about the \cmd{\MakeTextUppercase} in the data. Of
+course, you will not have upper cased titles in the bookmark list.
+
+
+
+
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 
@@ -14222,8 +14614,8 @@ before the stuff you want to have moved out of, say, a part.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2011-02-18 14:23:02 +0100 (Fri, 18 Feb 2011) $}
-{$LastChangedRevision: 352 $}
+{$LastChangedDate: 2013-05-10 17:06:52 +0200 (Fri, 10 May 2013) $}
+{$LastChangedRevision: 458 $}
 {$LastChangedBy: daleif $}
 
 
@@ -14264,7 +14656,7 @@ of the float across the top of both columns\index{float!double column}
 in a \Lopt{twocolumn} document. In a \Lopt{onecolumn} document there 
 is no difference between the starred and unstarred forms.
 
-\index{float!new|(}
+\index{float!new|(} %)| emacs
 
 \begin{syntax}
  \cmd{\newfloat}\oarg{within}\marg{fenv}\marg{ext}\marg{capname} \\
@@ -14466,11 +14858,11 @@ be done using the \Lpack{ragged2e} package and
 
 
 
-\index{float!new|)}
+\index{float!new|)} %|
 
 \section{Setting off a float} \label{sec:floatsetoff}
 
-\index{float!set off|(}
+\index{float!set off|(} %|
 
     Sometimes it is desireable to set off a float, more probably
 an illustration than a tabular, from its surroundings. The \Ie{framed}
@@ -14567,11 +14959,11 @@ RULED FIGURE AND CAPTION
 %\end{shaded}
 \end{shadefigure}
 
-\index{float!set off|)}
+\index{float!set off|)}%|
 
  \section{Multiple floats} \label{sec:multfloats}
 
-\index{float!multiple|(}
+\index{float!multiple|(}%|
 
 You can effectively put what you like inside a float box. Normally there 
 is just a single picture or tabular in a float but you can include 
@@ -14855,11 +15247,11 @@ Subcaptions are discussed below in \Sref{sec:subcaps}.
 \PWnote{2009/08/23}{Improved cross references between \cs{newsubfloat} 
 and \cs{subcaption}.}
 
-\index{float!multiple|)}
+\index{float!multiple|)}%|
 
  \section{Where \ltx\ puts floats} \label{sec:floatplace}
 
-\index{float!placement|(}
+\index{float!placement|(}%|
 
  The general format for a float environment is: \\
  \senv{float}\oarg{loc} ... \eenv{float} 
@@ -15200,11 +15592,11 @@ must be larger than the \cmd{\floatpagefraction} by an amount sufficient
 to take account of the maximum text page separation value.
  
 
-\index{float!placement|)}
+\index{float!placement|)} % |
 
 \section{Captions}
 
-\index{caption|(}
+\index{caption|(} %)|
 
  Some publishers require, and some authors prefer, captioning styles
 other than the one style provided by standard \ltx. 
@@ -15227,7 +15619,7 @@ those supplied by the \Lpack{ccaption} package~\cite{CCAPTION}.
 
 \section{Caption styling} 
 
-\index{caption!style|(}
+\index{caption!style|(} %)|
 
     Just as a reminder, the default appearance of a caption for, say,
 a table looks like this:
@@ -15265,6 +15657,19 @@ Notice that no space is put between the delimeter and the title unless
 it is specified in the \meta{delim} parameter. 
 The class initially specifies \verb?\captiondelim{: }? to give the normal 
 delimeter.
+% \begin{syntax}
+%   \cmd{\captiondelimnocap}\marg{code}
+% \end{syntax}
+% \glossary(captiondelimnocap)%
+%   {\cs{captiondelimnocap}\marg{code}}%
+%   {Used as the delimiter after the caption number when the caption is
+%     empty. Empty by default.}
+% Whenever the caption text is empty, it looks a little strange to have
+% \texttt{Figure 2.3:} and nothing else. Instead, in this case we replace
+% \cmd{\captiondelim} by \cmd{\captiondelimnocap}, which is empty by
+% default, i.e., we end up with \texttt{Figure 2.3} instead.
+
+
 
 \begin{syntax}
 \cmd{\captionnamefont}\marg{fontspec} \\
@@ -15529,7 +15934,7 @@ example for the style of the caption in \tref{tab:style}:
   \captionstyle{\centerlastline\\}
   \captiontitlefont{\scshape}
   \setlength{\belowcaptionskip}{10pt}
-  \ifx \@empty#1 \caption{#2}\else \caption[#1]{#2}}
+  \ifx \@empty#1 \caption{#2}\else \caption[#1]{#2}\fi}
 \end{lcode}
 Remember that any code that involves the \idxatincode\texttt{@} sign must 
 be either in
@@ -15555,12 +15960,12 @@ The additional commands makes it work in both cases, forcing the
 name to be centered as well as the last line of a multiline title,
 thus giving a balanced appearence.
 
- \index{caption!style|)}
+ \index{caption!style|)}%|
 
 
  \section{Continuation captions and legends}
 
-\index{caption!continued|(}
+\index{caption!continued|(}%|
 
 \begin{syntax}
 \cmd{\contcaption}\marg{text} \\
@@ -15627,10 +16032,10 @@ thus giving a balanced appearence.
    \end{tabular}
    \end{shadetable}
 
-\index{caption!continued|)}
+\index{caption!continued|)}%|
 
 \index{legend}
-\index{caption!anonymous|(}
+\index{caption!anonymous|(}%|
 
 \begin{syntax}
 \cmd{\legend}\marg{text} \\
@@ -15813,8 +16218,8 @@ tables\index{table} as:
    \addcontentsline{lot}{table}{#1}}
  \end{lcode}
 
-\index{caption!anonymous|)}
-\index{caption!outside a float|(}
+\index{caption!anonymous|)}%|
+\index{caption!outside a float|(}%|
 
   The \cmd{\legend} command produces a plain, unnumbered heading. It can also
 be useful sometimes to have named and numbered captions outside
@@ -15823,7 +16228,7 @@ if you want the table\index{table} or picture\index{illustration}
 to appear at a precise location in your document.
 
 
-\index{caption!fixed|(}
+\index{caption!fixed|(}%|
 
 \begin{syntax}
 \cmd{\newfixedcaption}\oarg{capcommand}\marg{command}\marg{float} \\
@@ -15919,14 +16324,14 @@ ordered according the
 page number in the typeset document, \emph{not} your source input order).
 
 
-\index{caption!fixed|)}
+\index{caption!fixed|)}%|
 
-\index{caption!outside a float|)}
+\index{caption!outside a float|)}%|
 
  \section{Bilingual captions}
 
-\index{caption!bilingual|(}
-\index{bilingual captions|(}
+\index{caption!bilingual|(}%|
+\index{bilingual captions|(}%|
 
     Some documents require bilingual (or more) captions. The class 
  provides a set of commands for bilingual captions. Extensions to the
@@ -16118,15 +16523,15 @@ caption with respect to the first.
 a post-caption line for the second caption. The class initially specifies
 \verb?\midbicaption{}?.
 
-\index{bilingual captions|)}
-\index{caption!bilingual|)}
+\index{bilingual captions|)}%|
+\index{caption!bilingual|)}%|
 
  \section{Subcaptions}  \label{sec:subcaps}
 
-\index{caption!subcaption|(}
-\index{figure!subfigure|(}
-\index{table!subtable|(}
-\index{float!subfloat|(}
+\index{caption!subcaption|(}%|
+\index{figure!subfigure|(}%|
+\index{table!subtable|(}%|
+\index{float!subfloat|(}%|
 
      The \Lpack{subfigure} package enables the captioning of 
 sub-figures within a larger figure\index{figure}, 
@@ -16401,14 +16806,14 @@ declaration, which is the default, undoes any previous \cmd{\hangsubcaption}
 or \cmd{\shortsubcaption} declaration, so that subcaptions are normally
 centered.
 
-\index{float!subfloat|)}
-\index{table!subtable|)}
-\index{figure!subfigure|)}
-\index{caption!subcaption|)}
+\index{float!subfloat|)}%|
+\index{table!subtable|)}%|
+\index{figure!subfigure|)}%|
+\index{caption!subcaption|)}%|
 
 \section{Side captions}
 
-\index{caption!side|(}
+\index{caption!side|(}%|
 
     Typically captions are put either above or below the element they
 are describing. Sometimes it is desireable to put a caption at the
@@ -16711,11 +17116,11 @@ you use a sidecaption in a wrapped float from, say, the \Lpack{wrapfig}
 package, make sure that the sidecaption gets placed where it won't be 
 overlaid by the main text.
 
-\index{caption!side|)}
+\index{caption!side|)}%|
 
- \section{How \ltx\ makes captions} \label{sec:ltx}
+ \section{How \ltx\ makes captions} \label{sec:ltx}%|
 
-\index{caption!\ltx\ methods|(}
+\index{caption!\ltx\ methods|(}%|
 
  This section provides an overview of how \ltx\ creates captions and
  gives some examples of how to change the captioning style directly.
@@ -16948,13 +17353,13 @@ tools that you need to make most, if not all, of any likely caption styles.
 \let\fnum@figure\oldfnum@figure
 \makeatother
 
-\index{caption!\ltx\ methods|)}
+\index{caption!\ltx\ methods|)}%|
 
 
  \section{Footnotes in captions}
 
-\index{caption!footnote|(}
-\index{footnote!in caption|(}
+\index{caption!footnote|(}%|
+\index{footnote!in caption|(}%|
 
     If you want to have a caption with a footnote, think long and hard
  as to whether this is really essential. It is not normally considered
@@ -17018,12 +17423,37 @@ marks\index{footnote!mark} to match correctly with the
 footnote\index{footnote!text} text.
 
  At this point, you are on your own.
+\index{footnote!in caption|)}%|
+\index{caption!footnote|)}%|
+
+
+\section{The class versus the caption package (and its friends)}
+\label{sec:class-versus-caption}
+
+For some, the configurations for captions provided by the class, are
+either a bit too complicated or not complicated enough.
+
+The \Lpack{caption} package by Alex Sommerfeldt may provide a simpler
+and much more extensive configuration interface for captions. The
+package can be used with the class, but there are a few caveats:
+\begin{enumerate}[(a)]
+\item All of the special configuration macros provided by the class
+  will no longer have any effect (\Lpack{caption} overwrites the core,
+  and thus our interfaces will have no effect),
+\item \cmd{\abovecaptionskip} will be reset to 10\,pt, and
+  \cmd{\belowcaptionskip} to zero. (The class would set both to
+  0.5\cmd{\onelineskip}, so if you need to change these, move the
+  change until after \Lpack{caption} has been loaded) 
+\end{enumerate}
 
-\index{footnote!in caption|)}
-\index{caption!footnote|)}
 
 
-\index{caption|)}
+
+
+
+
+
+\index{caption|)}%|
 
 
 %#% extend
@@ -17033,8 +17463,8 @@ footnote\index{footnote!text} text.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-09-13 11:11:29 +0200 (Mon, 13 Sep 2010) $}
-{$LastChangedRevision: 273 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 
@@ -18887,7 +19317,7 @@ characters:
 \item[\pixposarg{r}] right justified. 
 \end{itemize}
 
- Each column is normaly the same 
+ Each column is normally the same 
 width,\index{tabular!automatic!column width}\index{tabular!automatic!table width}
 which is large enough to accomodate
 the widest entry in the list.
@@ -19004,8 +19434,8 @@ illustrate these points.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-09-17 00:43:51 +0200 (Fri, 17 Sep 2010) $}
-{$LastChangedRevision: 274 $}
+{$LastChangedDate: 2013-05-02 16:10:51 +0200 (Thu, 02 May 2013) $}
+{$LastChangedRevision: 454 $}
 {$LastChangedBy: daleif $}
 
 \chapter{Page notes} \label{chap:mnotes}
@@ -19128,7 +19558,7 @@ the separator. Its default definition is:
 \glossary(feetbelowfloat)%
   {\cs{feetbelowfloat}}%
   {Typeset footnotes below bottom floats.}
-In the standard classes, footnotes on a page that has a float at the
+In\fxnote{this needs checking} the standard classes, footnotes on a page that has a float at the
 bottom are typeset before the float. I think that this looks
 peculiar. Following the \cmd{\feetbelowfloat} declaration footnotes 
 will be typeset at the bottom of the page below any bottom 
@@ -20331,133 +20761,709 @@ In the margin you will find the result of the following code:
   And several paragraphs}\sidefootnote{And number three}
 
 
+\LMnote{2013/05/02}{Moved here from backmatter.tex}
 
+\section{Endnotes}
+\label{sec:endnotes}
 
+\LMnote{2010/10/28}{several \cs{printpagenotes} was spelled wrong}
 
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%% start membook
-
-
-%#% extend
-
+\reimplemented{December 2010}{The former implementation had some
+  difficulties handling certain types of input. A few of the macros
+  used to format the output are no longer supported/used in the new
+  implementation.}
 
 
+    Endnotes are often used instead of footnotes so as not to interrupt the
+flow of the main text. Although endnotes are normally put at the end of 
+the document, they may instead be put at the end of each chapter.
 
+    The \Lpack{endnotes} package already uses the command \cmd{\endnote} for
+an endnote, so the class uses \cmd{\pagenote} for an endnote so as not 
+to clash if you prefer to use the package. 
+\LMnote{2011/01/23}{The implementation has nothing to do with the
+  current pagenote package, thus the remark is removed}
+% The following was originally supplied as the \Lpack{pagenote}
+% package~\cite{PAGENOTE}. 
 
+\begin{syntax}
+\cmd{\makepagenote} \\
+\cmd{\pagenote}\oarg{id}\marg{text} \\
+\cmd{\printpagenotes} \cmd{\printpagenotes*} \\
+\end{syntax}
+\glossary(makepagenote)%
+  {\cs{makepagenote}}%
+  {Preamble command for enabling page/end notes.}%
+\glossary(printpagenotes)%
+  {\cs{printpagenotes}}%
+  {Input the pagenote \file{ent} file for printing, then close it to any 
+   more notes.}%
+\glossary(printpagenotes*)%
+  {\cs{printpagenotes*}}%
+  {Input the pagenote \file{ent} file for printing, then empty it ready for 
+   further notes.}%
 
+   The general principle is that notes are written out to a file which
+is then input at the place where the notes are to be printed. The note 
+file has an \pixfile{ent} extension, like the table of contents file
+has a \pixfile{toc} extension.
 
-%#% extstart include decorative-text.tex
+    You have to put \cmd{\makepagenote} in your preamble if you want 
+endnotes. This will open the \pixfile{ent} note file which is called
+\verb?\jobname.ent?.
 
-\svnidlong
-{$Ignore: $}
-{$LastChangedDate: 2010-05-13 17:10:00 +0200 (Thu, 13 May 2010) $}
-{$LastChangedRevision: 210 $}
-{$LastChangedBy: daleif $}
+   In the body of the text use use \cmd{\pagenote} to create an endnote, just
+as you would use \cmd{\footnote} to create a footnote. In the books that I have
+checked there are two common methods of identifying an endnote:
+\begin{enumerate}
+\item Like a footnote, put a number in the text at the location 
+of the note and use the same number to identify the note when it
+finally gets printed.\label{pagenote:id1}
+\item Put no mark in the text, but when it is finally 
+      printed\pagenote[Put no mark \ldots finally printed]{This manual uses
+      both footnotes and endnotes. For identifying the endnotes I have used the
+      `words' method for identifying the parent location of an endnote, so as not
+      to start confusing the reader with two sets of note marks in the body of the
+      text. Typically either footnotes or endnotes are used, not both, so the
+      question of distinguishing them does not normally arise.}
+use a few words from the text to identify the origin of the note. The page number
+is often used as well with this method.\label{pagenote:id2}
+\end{enumerate}
+The \meta{text} argument of \cmd{\pagenote} is the contents of the note and
+if the optional \meta{id} argument is not used the
+result is similar to having used \cmd{\footnote} --- a number in the main text
+and the corresponding number in the endnotes listing (as 
+in \ref{pagenote:id1} above). For the second reference style 
+(\ref{pagenote:id2} above) use the 
+optional \meta{id} argument for the `few words', and no mark will be put
+into the main text but \meta{id} will be used as the identification in
+the listing.
 
+   For one set of endnotes covering the whole document put 
+\cmd{\printpagenotes} where you want them printed, typically before
+any bibliography or index. The \cmd{\printpagenotes} macro inputs the
+\pixfile{ent} endnote file for printing and then closes it to any further
+notes.
 
-%%%%% end membook
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+For notes
+at the end of each chapter put \cmd{\printpagenotes*}, which inputs
+the \pixfile{ent} file for printing then empties it ready for more notes,
+at the end of each chapter.
 
+   The simple use is like this:
+\begin{lcode}
+\documentclass[...]{memoir}
+...
+\makepagenote
+...
+\begin{document}
+\chapter{One}
+...\pagenote{An end note.} ...
+...\pagenote{Fascinating information.}
+...
+\chapter{Last}% chapter 9
+...\pagenote{Another note.}% 30th note
+...
+...
+\printpagenotes
+...
+\end{document}
+\end{lcode}
+This will result in an endnote listing looking like \fref{fig:endnote}.
 
+\begin{figure}
+\centering
+\begin{minipage}{0.8\textwidth}
+\begin{framed}
+\noindent{\bfseries\Large Notes}\\[\baselineskip]
+{\bfseries Chapter 1 One} \\[\baselineskip]
+1. An end note \\
+2. Fascinating information. \\
+.............. \\[\baselineskip]
+{\bfseries Chapter 9 Last} \\[\baselineskip]
+1. Another note \\[\baselineskip]
+\end{framed}
+\end{minipage}
+\caption{Example endnote listing}\label{fig:endnote}
+\end{figure}
 
+For notes at the end of each chapter:
+\begin{lcode}
+\documentclass[...]{memoir}
+...
+\makepagenote
+...
+\begin{document}
+\chapter{One}
+...\pagenote{An end note.} ...
+...
+\printpagenotes*
+\chapter{Last}
+...\pagenote{Another note.} ...
+...
+\printpagenotes*
+%%% no more chapters
+...
+\end{document}
+\end{lcode}
 
+\begin{syntax}
+\cmd{\continuousnotenums} \\
+\cmd{\notepageref} \\
+\end{syntax}
+\glossary(continuousnotenums)%
+  {\cs{continuousnotenums}}%
+  {Declaration to make the numbering of endnotes continuous throughout the
+   document.}%
+\glossary(notepageref)%
+  {\cs{notepageref}}%
+  {Declaration that page numbers are available to notes in the endnote listing.}
+   The \Icn{pagenote} counter is used for the notes. By default the endnotes 
+are numbered per chapter. If you want the numbering
+to be continuous throughout the document use the \cmd{\continuousnotenums}
+declaration. Normally the information on which page a note was created is
+discarded but will be made available to notes in the endnote listing
+following the \cmd{\notepageref} declaration.  Both
+\cmd{\continuousnotenums} and \cmd{\notepageref} can only be used in
+the preamble.
 
+\LMnote{2011/01/23}{Because of the new implementation this is no
+  longer needed as the writing to file is no longer delayed.}
+% Because of how TeX writes information to files, when the
+% \cmd{\notepageref} declaration is used there must be no notes on the
+% page where \cmd{\printpagenotes} or \cmd{\printpagenotes*} closes the
+% \pixfile{ent} file.  If necessary, a \cmd{\clearpage} or similar must
+% be used before the print command.
 
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\clearpage
-%%%\pagestyle{companion}
-%%\chapterstyle{companion}
-\defaultsecnum
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\chapter{Decorative text} \label{chap:signposts}
+\begin{syntax}
+\cmd{\notesname} \\
+\cmd{\notedivision} \\
+\end{syntax}
+\glossary(notesname)%
+  {\cs{notesname}}%
+  {Name for endnotes, default \texttt{Notes}.}%
+\glossary(notedivision)%
+  {\cs{notedivision}}%
+  {Heading printed by the \cs{printpagenotes} and \cs{printpagenotes*} macros.}
 
+  When \cmd{\printpagenotes} (or \cmd{\printpagenotes*}) is called the
+  first thing it does is call the macro \cmd{\notedivision}. By
+  default this is defined as:
+\begin{lcode}
+\newcommand*{\notedivision}{\chapter{\notesname}}
+\end{lcode}
+with
+\begin{lcode}
+  \newcommand*{\notesname}{Notes}
+\end{lcode}
+In other words, it will print out a heading for the notes that will be read
+from the \file{ent} file. \verb?\print...? then closes the \pixfile{ent} file 
+for writing and after this \verb?\input?s it to get and process the notes.
 
-\newcommand{\tepi}[2]{\epigraph{#1}{#2}}
 
-% \tepi{My soul, seek not the life of immortals; but enjoy to the full
-%       the resources that are within your reach}
-%      {\textit{Pythian Odes \\ Pindar}}
-\tepi{Too servile a submission to the books and opinions of the ancients
-      has spoiled many an ingenious man, and plagued the world with an
-      abundance of pedants and coxcombs.}
-     {James Puckle (1677?--1724)}
+\subsection{Changing the appearance}
 
+\subsubsection{In the text}
+\label{sec:in-the-text}
 
-    By now we have covered most aspects of typesetting. As far as
-the class is concerned this chapter describes the slightly more fun 
-task of typesetting epigraphs\index{epigraph}.
 
-     Some authors like to add an interesting quotation\index{quotation} 
-at either the start or end of a chapter. The class provides commands
-to assist in the typesetting of a single epigraph. Other authors like to 
-add many such quotations\index{quotation} and the class provides 
-environments to cater for these as well.
-Epigraphs can be typeset at either the left, the center or the right of 
-the typeblock\index{typeblock}. A few example epigraphs are exhibited here, and
-others can be found in an article by
-Christina Thiele~\cite{TTC199} where she reviewed the \Lpack{epigraph}
-package~\cite{EPIGRAPH} which is included in the class.
+\begin{syntax}
+\cmd{\notenumintext}\marg{num} \\
+\end{syntax}
+\glossary(notenumintext)%
+  {\cs{notenumintext}\marg{num}}%
+  {Typesets the number \meta{num} of a page note in the main text.}%
+The \Icn{pagenote} counter is used for pagenotes. The macro
+\cmd{\notenumintext} is called by \cmd{\pagenote} with the value of the
+\Icn{pagenote} counter as the \meta{num} argument to print the
+value of the \Icn{pagenote} counter in the main text. By default it is 
+printed as a 
+superscript, but this can be changed, or even eliminated.
+\begin{lcode}
+\newcommand*{\notenumintext}[1]{\textsuperscript{#1}}
+\end{lcode}
 
- \section{Epigraphs} 
-\index{epigraph|(}
+\subsubsection{In the page note list}
+\label{sec:page-note-list}
 
-% \tepi{The whole is more than the sum of the parts.}
-%      {\textit{Metaphysica \\ Aristotle}}
+  
+\LMnote{2011/01/23}{Added to make the formating code easier to understand}
 
- %\subsection{The \texttt{epigraph} command}
+To better understand how a page note entry is formatted in the page
+note list, we start with the following  pseudo code (it is not exactly
+what you will see in the \texttt{.ent} file, but macros will end up
+being called in this manner)
+\begin{syntax}
+\cmd{\prenoteinnotes}\\
+\cmd{\noteidinnotes}\marg{notenum}\marg{id}\\
+\cmd{\pageinnotes}\marg{auto generated note label key}\\
+\cmd{\prenotetext}\\
+\quad\meta{Page note text}\\
+\cmd{\postnotetext}\\
+\cmd{\postnoteinnotes}
+\end{syntax}
+At the start and end we have the two macros \cmd{\prenoteinnotes} and
+\cmd{\postnoteinnotes}, they take care of preparing for and ending an
+entry in the list. The list is typeset in a manner where each item is
+(at least) a paragraph, so the default definition is
+\begin{lcode}
+\newcommand{\prenoteinnotes}{\par\noindent}
+\newcommand{\postnoteinnotes}{\par}
+\end{lcode}
+\glossary(prenoteinnotes)%
+  {\cs{prenoteinnotes}}%
+  {Called by \cs{noteentry} to initialise the printing of an endnote.}%
+\glossary(postnoteinnotes)%
+  {\cs{postnoteinnotes}}%
+  {Called by \cs{noteentry} to finish the printing of an endnote.}%
+A user could change this to make it look a bit more like a list
+construction. For example the following would give a hanging
+indentation
+\begin{lcode}
+\renewcommand{\prenoteinnotes}{\par\noindent\hangindent 2em}
+\end{lcode}
 
-  The original inspiration for \cmd{\epigraph} was Doug Schenck's
- for the epigraphs in our book~\cite{EBOOK}. That was hard wired for
- the purpose at hand. The version here provides much more flexibility.
+\fancybreak{}
 
 
+The \cmd{\noteidinnotes} calls \cmd{\idtextinnotes} to print the note \meta{id}
+if it was given as the optional argument to \cmd{pagenote}, 
+otherwise it calls \cmd{\notenuminnotes} to print the note number.
 \begin{syntax}
-\cmd{\epigraph}\marg{text}\marg{source} \\
+\cmd{\noteidinnotes}\marg{notenum}\marg{id} \\
+\cmd{\idtextinnotes}\marg{id} \\
+\cmd{\notenuminnotes}\marg{num} \\
 \end{syntax}
-\glossary(epigraph)%
-  {\cs{epigraph}\marg{text}\marg{source}}%
-  {Typesets the \meta{text} and \meta{source} of an epigraph.}
- The command \cmd{\epigraph}  typesets
- an epigraph using \meta{text} as the main text of the epigraph and
- \meta{source} being the original author (or book, article, etc.)
- of the quoted text. By default the epigraph is placed at the right hand 
- side of the typeblock\index{typeblock}, and the \meta{source} is typeset at the bottom
- right of the \meta{text}.
+\glossary(noteidinnotes)%
+  {\cs{noteidinnotes}\marg{notenum}\marg{id}}%
+  {Prints an endnote's number or id in the endnote listing.}%
+\glossary(idtextinnotes)%
+  {\cs{idtextinnotes}\marg{id}}%
+  {Prints an endnote's \meta{id} text}%
+\glossary(notenuminnotes)%
+  {\cs{notenuminnotes}\marg{num}}%
+  {Typesets the number \meta{num} of a page note in the note listing.}%
+These are defined respectively as:
+\begin{lcode}
+\newcommand*{\idtextinnotes}[1]{[#1]\space}
+\newcommand*{\notenuminnotes}[1]{\normalfont #1.\space}
+\end{lcode}
 
+\fancybreak{}
 
+Next we execute \cmd{\pageinnotes}\marg{note label key} which does
+nothing by default. But if \cmd{\notepageref} is issued in the
+preamble two things happen, (1) each page note issues a label such
+that we can refer back to its page, and (2) \cmd{\pageinnotes} calls
+\cmd{\printpageinnotes} (or if \Lpack{hyperref} is loaded
+\cmd{\printpageinnoteshyperref}) 
 \begin{syntax}
-\senv{epigraphs}  \\
-  \cmd{\qitem}\marg{text}\marg{source} \\
-  ... \\
-\eenv{epigraphs} \\
+\cmd{\pageinnotes}\marg{auto generated note label key}\\
+\cmd{\printpageinnotes}\marg{auto generated note label key}\\  
+\cmd{\printpageinnoteshyperref}\marg{auto generated note label key}
 \end{syntax}
-\glossary(epigraphs)%
-  {\senv{epigraphs}}%
-  {Environment for several epigraphs.}
-\glossary(qitem)%
-  {\cs{qitem}\marg{text}\marg{source}}%
-  {Typesets the \meta{text} and \meta{source} of an epigraph in an 
-   \texttt{epigrpahs} environment.}
- The \Ie{epigraphs} environment typesets a list of epigraphs, and by default
- places them at the right hand side of the typeblock\index{typeblock}.
-  Each epigraph in an \Ie{epigraphs} environment is specified by a 
- \cmd{\qitem} (analagous to the \cmd{\item}
- command in ordinary list environments).
- By default, the \meta{source} is typeset at the bottom right of the
- \meta{text}. 
-
- 
- \section{General}
+\glossary(pageinnotes)%
+{\cs{pageinnotes}\marg{pagenum}}%
+{Controls the printing of an endnote's page reference number.}%
+\glossary(printpageinnotes)%
+{\cs{printpageinnotes}\marg{pagenum}}%
+{Prints an endnote's page reference number.}%
+\glossary(printpageinnoteshypreref)%
+{\cs{printpageinnoteshyperref}\marg{pagenum}}%
+{Prints an endnote's page reference number whenever the
+  \protect\Lpack{hyperref} package is used, it will include a
+  hyperlink back to the page in question.}%
+Default definitions
+\begin{lcode}
+\newcommand*{\printpageinnotes}[1]{%
+    (\pagerefname\ \pageref{#1})\space}
+\newcommand\printpageinnoteshyperref[1]{%
+   (\hyperref[#1]{\pagerefname\ \pageref*{#1}})\space}
+\end{lcode}
+That is if \Lpack{hyperref} is loaded the entire text \meta{page 3}
+will be the text of a hyperlink.
 
- \tepi{Example is the school of mankind, and they will learn at no other.}
-      {\textit{Letters on a Regicide Peace}\\ \textsc{Edmund Burke}}
+\bigskip
 
-   The commands described in this section apply to both the \cmd{\epigraph}
-command and the \Ie{epigraphs} environment. But first of all, note that an
-epigraph immediately after a heading\index{heading} will cause the 
-first paragraph\index{paragraph!indentation}
-of the following text to be indented. If you want the initial paragraph
+\begin{syntax}
+  \cmd{\prenotetext}\\
+  \cmd{\postnotetext}\\
+\end{syntax}
+\glossary(prenotetext)%
+  {\cs{prenotetext}}%
+  {Called within a page note list entry to initialise the printing
+    of the text part of an endnote.}%
+\glossary(postnotetex)%
+  {\cs{postnotetext}}%
+  {Called within a page note list entry to finish the printing of an
+    endnote.}%
+The actual text part of the page note is enclosed by
+\cmd{\prenotetext} and \cmd{postnotetext}. By default they do nothing,
+but could easily be redefined such that (only) the entry text would be
+in italic: 
+\begin{lcode}
+\renewcommand\prenotetext{\begingroup\itshape}
+\renewcommand\postnotetext{\endgroup}
+\end{lcode}
+
+
+
+%%%%%%%%%%%
+
+
+\LMnote{2011/01/25}{Covered above}
+% \begin{syntax}
+% \cmd{\notenuminnotes}\marg{num} \\
+% \end{syntax}
+% \glossary(notenuminnotes)%
+%   {\cs{notenuminnotes}\marg{num}}%
+%   {Typesets the number \meta{num} of a page note in the note listing.}%
+% In the note listing \cmd{\notenuminnotes} is used to print the number
+% of a note. The default definitions are:
+
+% \begin{lcode}
+% \newcommand*{\notenuminnotes}[1]{\normalfont #1.\space}
+% \end{lcode}
+
+
+
+\LMnote{2011/01/25}{Covered above, \cmd{\noteentry} is not used anymore}
+% \begin{syntax}
+% \cmd{\noteentry}\marg{notenum}\marg{id}\marg{text}\marg{pagenum} \\
+% \cmd{\prenoteinnotes} \\
+% \cmd{\postnoteinnotes} \\
+% \end{syntax}
+% \glossary(noteentry)%
+%   {\cs{noteentry}\marg{notenum}\marg{id}\marg{text}\marg{pagenum}}%
+%   {Typesets a pagenote with number \meta{notenum}, identifier \meta{id},
+%    contents \meta{text}, created on page \meta{pagenum}.}
+% \glossary(prenoteinnotes)%
+%   {\cs{prenoteinnotes}}%
+%   {Called by \cs{noteentry} to initialise the printing of an endnote.}
+% \glossary(postnoteinnotes)%
+%   {\cs{postnoteinnotes}}%
+%   {Called by \cs{noteentry} to finish the printing of an endnote.}
+% The \cmd{\pagenote} macro writes \cmd{\noteentry}, with the appropriate 
+% values for the arguments, to the \pixfile{ent} file, 
+% where \meta{notenum} is the note number (from the \Icn{pagenote} counter),
+% \meta{id} and \meta{text} are as supplied to
+% \cmd{\pagenote}, and if the \cmd{\notepageref} declaration option is used, 
+% \meta{pagenum} is the page number, otherwise it is empty. 
+% The \cmd{\noteentry} macro controls the typesetting of the note.
+
+% The default definition of \cmd{\noteentry} is
+% \begin{lcode}
+% \newcommand{\notentry}[4]{%
+%   \prenoteinnotes
+%   \noteidinnotes{#1}{#2}\pageinnotes{#4}\noteinnotes{#3}%
+%   \postnoteinnotes}
+% \end{lcode}
+% and the definitions of other macros are:
+% \begin{lcode}
+% \newcommand{\prenoteinnotes}{\par\noindent}
+% \newcommand{\postnoteinnotes}{\par}
+% \end{lcode}
+% so that (the first paragraph of) each note is printed as a non-indented 
+% paragraph.
+
+%     If you would prefer, say, hanging paragraphs try:
+% \begin{lcode}
+% \renewcommand{\prenoteinnotes}{\par\noindent\hangindent 2em}
+% \end{lcode}
+
+% \begin{syntax}
+% \cmd{\noteidinnotes}\marg{notenum}\marg{id} \\
+% \cmd{\idtextinnotes}\marg{id} \\
+% \cmd{\notenuminnotes}\marg{num} \\
+% \end{syntax}
+% \glossary(noteidinnotes)%
+%   {\cs{noteidinnotes}\marg{notenum}\marg{id}}%
+%   {Prints an endnote's number or id in the endnote listing.}%
+% \glossary(idtextinnotes)%
+%   {\cs{idtextinnotes}\marg{id}}%
+%   {Prints an endnote's \meta{id} text}%
+% The \cmd{\noteidinnotes} calls \cmd{\idtextinnotes} to print the note \meta{id}
+% if it was given as the optional argument to \cmd{pagenote}, 
+% otherwise it calls \cmd{\notenuminnotes} to print the note number.
+% These are defined respectively as:
+% \begin{lcode}
+% \newcommand*{\idtextinnotes}[1]{[#1]\space}
+% \newcommand*{\notenuminnotes}[1]{\normalfont #1.\space}
+% \end{lcode}
+
+% \begin{syntax}
+% \cmd{\pageinnotes}\marg{pagenum} \\
+% \cmd{\printpageinnotes}\marg{pagenum} \\
+% \end{syntax}
+% \glossary(pageinnotes)%
+%   {\cs{pageinnotes}\marg{pagenum}}%
+%   {Controls the printing of an endnote's page reference number.}%
+% \glossary(printpageinnotes)%
+%   {\cs{printpageinnotes}\marg{pagenum}}%
+%   {Prints an endnote's page reference number.}%
+% The macro \cmd{\pageinnotes} controls the printing of a note's page 
+% reference. If the
+% \cmd{\notepageref} declaration has been used it calls
+% \cmd{\printpageinnotes} to do the actual printing. Its definition is:
+% \begin{lcode}
+% \newcommand*{\printpageinnotes}[1]{%
+%   (\pagerefname\ #1)\space}
+% \end{lcode}
+
+% \begin{syntax}
+% \cmd{\noteinnotes}\marg{text} \\
+% \end{syntax}
+% \glossary(noteinnotes)%
+%   {\cs{noteinnotes}\marg{text}}%
+%   {Prints the text of an endnote.}%
+% The macro \cmd{\noteinnotes}\marg{text} is simply:
+% \begin{lcode}
+% \newcommand{\noteinnotes}[1]{#1}
+% \end{lcode}
+% and is used to print the text of a note.
+
+
+
+
+\bigskip
+
+
+
+\LMnote{2011/01/25}{rewritten a bit}
+\begin{syntax}
+\cmd{\addtonotes}\marg{text} \\
+\end{syntax}
+\glossary(addtonotes)%
+  {\cs{addtonotes}\marg{text}}%
+  {Inserts \meta{text} into the endnotes \file{ent} file.}%
+The macro \cmd{\addtonotes} inserts \meta{text} into the \pixfile{ent}
+file. 
+
+\begin{note}
+  As the argument to \cmd{\pagenote} and \cmd{\addtonotes} is moving
+  you may have to \cmd{\protect} any fragile commands. If you get
+  strange error messages, try using \cmd{\protect} and see if they go
+  away.
+\end{note}
+\fancybreak{}
+
+Internally in \cmd{\pagenote} \cmd{\addtonotes} is used to provide
+chapter devisions into the note list. It will detect both numbered and
+unnumbered chapters. The actual text is provided using
+\begin{syntax}
+\cmd{\pagenotesubhead}\marg{chapapp}\marg{num}\marg{title} \\
+\cmd{\pagenotesubheadstarred}\marg{chapapp}\marg{num}\marg{title} \\
+\cmd{\pnchap} \cmd{\pnschap} \\
+\end{syntax}
+\glossary(pagenotesubhead)%
+  {\cs{pagenotesubhead}\marg{chapapp}\marg{num}\marg{title}}%
+  {Typesets a subheading for notes from chapter or appendix \meta{chapapp} 
+   \meta{num} called \meta{title}.}%
+\glossary(pagenotesubheadstarred)%
+  {\cs{pagenotesubheadstarred}\marg{chapapp}\marg{num}\marg{title}}%
+  {Typesets a subheading for notes from unnumbered chapter or appendix
+    \meta{chapapp}  \meta{num} called \meta{title}.}%
+\glossary(pnchap)%
+  {\cs{pnchap}}%
+  {Chapter title for \cs{pagenotesubhead}. Defaults to the ToC entry.}
+\glossary(pnschap)%
+{\cs{pnschap}}%
+{Starred chapter title for \cs{pagenotesubhead}. Defaults to the regular title.}
+  
+The macro \cmd{\pagenotesubhead} typesets the subheadings in an
+endnote list.  The \meta{chapapp} argument is normally
+\cmd{\chaptername} but if the notes are from an appendix then
+\cmd{\appendixname} is used instead. \meta{num} is the number of the
+chapter, or blank if there is no number. Lastly, \meta{title} is
+\cmd{\pnchap} for regular chapters which defaults to the ToC entry, or
+\cmd{\pnschap} for starred chapters which defaults to the normal
+title. The default definition of \cmd{\pagenotesubhead} is very
+simply:
+\begin{lcode}
+\newcommand*{\pagenotesubhead}[3]{%
+  \section*{#1 #2 #3}}
+\newcommand\pagenotesubheadstarred{\pagenotesubhead} % i.e. the same
+\end{lcode}
+By default this means that the header for starred chapters will be
+something like >>Chapter Title<<, which may look odd. In that case
+redefine \cmd{\pagenotesubheadstarred} to something similar to 
+\begin{lcode}
+\renewcommand\pagenotesubheadstarred{\section*{#3}}
+\end{lcode}
+Just remember that unless you have specified \cmd{\continuousnotenums}
+in the preamble the note counter (\Icn{pagenote}) will only be reset
+at the start of any numbered chapters (because it is tied to changes
+in the chapter counter).
+
+The scheme is set up under the assumption that notes will only be
+printed at the end of the document. If you intend to put them at the
+end of each chapter, then you will probably want to change the
+definitions of the \cmd{\notedivision} and \cmd{\pagenotesubhead}
+macros. For example:
+\begin{lcode}
+\renewcommand*{\notedivision}{\section*{\notesname}}
+\renewcommand*{\pagenotesubhead}[3]{}
+\end{lcode}
+and remember to use \cmd{\printpagenotes*} at each place you want the
+current set of notes to be printed.
+
+\fancybreak{}
+
+Say you have written a document with footnotes, but later on decide on
+using end notes (page notes) instead. In that case you can use
+\cmd{\foottopagenote} to make \cmd{\footnote}, \cmd{\footnotemark} and
+\cmd{\footnotetext} works as if it was implemented using end notes. On
+the other hand \cmd{\pagetofootnote} makes all  page notes into
+footnotes (note that this might not work, because there are places
+where page notes can be issued but foot notes cannot).
+
+\begin{syntax}
+\cmd{\foottopagenote}\\ \cmd{\pagetofootnote} \\
+\end{syntax}
+\glossary(foottopagenote)%
+  {\cs{foottopagenote}}%
+  {Declaration which turns \cs{footnote}s into \cs{pagenote}s.}%
+\glossary(pagetofootnote)%
+  {\cs{pagetofootnote}}%
+  {Declaration which turns \cs{pagenote}s into \cs{footnote}s.}%
+  % You can have both footnotes and endnotes in the same
+  % document. However you may start with all footnotes and later
+  % decide you would have preferred endnotes instead, or
+  % \emph{vice-versa}. The \cmd{\foottopagenote} declaration makes
+  % \cmd{\footnote}s behave as \cmd{\pagenote}s, and
+  % \cmd{\pagetofootnote} has the opposite effect.
+In either conversion the optional argument will be
+ignored as for \cmd{\pagenote} it can be arbitrary text whereas for
+\cmd{\footnote} it must be a number.
+
+
+
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% start membook
+
+
+%#% extend
+
+
+
+
+
+
+
+%#% extstart include decorative-text.tex
+
+\svnidlong
+{$Ignore: $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
+{$LastChangedBy: daleif $}
+
+
+%%%%% end membook
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\clearpage
+%%%\pagestyle{companion}
+%%\chapterstyle{companion}
+\defaultsecnum
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\chapter{Decorative text} \label{chap:signposts}
+
+
+\newcommand{\tepi}[2]{\epigraph{#1}{#2}}
+
+% \tepi{My soul, seek not the life of immortals; but enjoy to the full
+%       the resources that are within your reach}
+%      {\textit{Pythian Odes \\ Pindar}}
+\tepi{Too servile a submission to the books and opinions of the ancients
+      has spoiled many an ingenious man, and plagued the world with an
+      abundance of pedants and coxcombs.}
+     {James Puckle (1677?--1724)}
+
+
+    By now we have covered most aspects of typesetting. As far as
+the class is concerned this chapter describes the slightly more fun 
+task of typesetting epigraphs\index{epigraph}.
+
+     Some authors like to add an interesting quotation\index{quotation} 
+at either the start or end of a chapter. The class provides commands
+to assist in the typesetting of a single epigraph. Other authors like to 
+add many such quotations\index{quotation} and the class provides 
+environments to cater for these as well.
+Epigraphs can be typeset at either the left, the center or the right of 
+the typeblock\index{typeblock}. A few example epigraphs are exhibited here, and
+others can be found in an article by
+Christina Thiele~\cite{TTC199} where she reviewed the \Lpack{epigraph}
+package~\cite{EPIGRAPH} which is included in the class.
+
+ \section{Epigraphs} 
+\index{epigraph|(}
+
+% \tepi{The whole is more than the sum of the parts.}
+%      {\textit{Metaphysica \\ Aristotle}}
+
+ %\subsection{The \texttt{epigraph} command}
+
+  The original inspiration for \cmd{\epigraph} was Doug Schenck's
+ for the epigraphs in our book~\cite{EBOOK}. That was hard wired for
+ the purpose at hand. The version here provides much more flexibility.
+
+
+\begin{syntax}
+\cmd{\epigraph}\marg{text}\marg{source} \\
+\end{syntax}
+\glossary(epigraph)%
+  {\cs{epigraph}\marg{text}\marg{source}}%
+  {Typesets the \meta{text} and \meta{source} of an epigraph.}
+ The command \cmd{\epigraph}  typesets
+ an epigraph using \meta{text} as the main text of the epigraph and
+ \meta{source} being the original author (or book, article, etc.)
+ of the quoted text. By default the epigraph is placed at the right hand 
+ side of the typeblock\index{typeblock}, and the \meta{source} is typeset at the bottom
+ right of the \meta{text}.
+
+
+\begin{syntax}
+\senv{epigraphs}  \\
+  \cmd{\qitem}\marg{text}\marg{source} \\
+  ... \\
+\eenv{epigraphs} \\
+\end{syntax}
+\glossary(epigraphs)%
+  {\senv{epigraphs}}%
+  {Environment for several epigraphs.}
+\glossary(qitem)%
+  {\cs{qitem}\marg{text}\marg{source}}%
+  {Typesets the \meta{text} and \meta{source} of an epigraph in an 
+   \texttt{epigrpahs} environment.}
+ The \Ie{epigraphs} environment typesets a list of epigraphs, and by default
+ places them at the right hand side of the typeblock\index{typeblock}.
+  Each epigraph in an \Ie{epigraphs} environment is specified by a 
+ \cmd{\qitem} (analagous to the \cmd{\item}
+ command in ordinary list environments).
+ By default, the \meta{source} is typeset at the bottom right of the
+ \meta{text}. 
+
+ 
+ \section{General}
+
+ \tepi{Example is the school of mankind, and they will learn at no other.}
+      {\textit{Letters on a Regicide Peace}\\ \textsc{Edmund Burke}}
+
+   The commands described in this section apply to both the \cmd{\epigraph}
+command and the \Ie{epigraphs} environment. But first of all, note that an
+epigraph immediately after a heading\index{heading} will cause the 
+first paragraph\index{paragraph!indentation}
+of the following text to be indented. If you want the initial paragraph
 to have no indentation, then start it with the \cmd{\noindent} command.
 
 \begin{syntax}
@@ -20804,8 +21810,8 @@ for epigraphs after the title (or the equivalents for \cmd{\book} pages).
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-05-13 17:10:00 +0200 (Thu, 13 May 2010) $}
-{$LastChangedRevision: 210 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -21964,8 +22970,8 @@ and the result is shown on the next page.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-10-28 23:30:16 +0200 (Thu, 28 Oct 2010) $}
-{$LastChangedRevision: 305 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -23298,16 +24304,16 @@ currently associated with the input stream \meta{stream}. This
 provides the same functionality as \cmd{\input}\marg{filename}.
 
 \begin{syntax}
-\cmd{\readline}\marg{stream} \\
+\cmd{\readaline}\marg{stream} \\
 \end{syntax}
-\glossary(readline)%
-  {\cs{readline}\marg{stream}}%
+\glossary(readaline)%
+  {\cs{readaline}\marg{stream}}%
   {Reads a single line from the file associated with the input \meta{stream}.}
-The \cmd{\readline} reads\index{file!read!single line} what \tx\ 
+The \cmd{\readaline} reads\index{file!read!single line} what \tx\ 
 considers to be one line from
 the file that is currently associated with the input stream \meta{stream}.
 
-Multiple lines can be read by calling \cmd{\readline} multiple times.
+Multiple lines can be read by calling \cmd{\readaline} multiple times.
 A warning is issued if there are no more lines to be read (i.e., the
 end of the file has been reached).
 
@@ -23949,8 +24955,8 @@ In increasing or decreasing order of probability (your choice) they are:
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-05-13 17:10:00 +0200 (Thu, 13 May 2010) $}
-{$LastChangedRevision: 210 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -24316,8 +25322,8 @@ will require the use of \cmd{\titleref} and so the declaration
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2011-01-25 13:33:59 +0100 (Tue, 25 Jan 2011) $}
-{$LastChangedRevision: 334 $}
+{$LastChangedDate: 2013-05-02 16:10:51 +0200 (Thu, 02 May 2013) $}
+{$LastChangedRevision: 454 $}
 {$LastChangedBy: daleif $}
 
 
@@ -26150,571 +27156,7 @@ pdflatex memman
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-\section{Endnotes}
-\label{sec:endnotes}
-
-\LMnote{2010/10/28}{several \cs{printpagenotes} was spelled wrong}
-
-\reimplemented{December 2010}{The former implementation had some
-  difficulties handling certain types of input. A few of the macros
-  used to format the output are no longer supported/used in the new
-  implementation.}
-
-
-    Endnotes are often used instead of footnotes so as not to interrupt the
-flow of the main text. Although endnotes are normally put at the end of 
-the document, they may instead be put at the end of each chapter.
-
-    The \Lpack{endnotes} package already uses the command \cmd{\endnote} for
-an endnote, so the class uses \cmd{\pagenote} for an endnote so as not 
-to clash if you prefer to use the package. 
-\LMnote{2011/01/23}{The implementation has nothing to do with the
-  current pagenote package, thus the remark is removed}
-% The following was originally supplied as the \Lpack{pagenote}
-% package~\cite{PAGENOTE}. 
-
-\begin{syntax}
-\cmd{\makepagenote} \\
-\cmd{\pagenote}\oarg{id}\marg{text} \\
-\cmd{\printpagenotes} \cmd{\printpagenotes*} \\
-\end{syntax}
-\glossary(makepagenote)%
-  {\cs{makepagenote}}%
-  {Preamble command for enabling page/end notes.}%
-\glossary(printpagenotes)%
-  {\cs{printpagenotes}}%
-  {Input the pagenote \file{ent} file for printing, then close it to any 
-   more notes.}%
-\glossary(printpagenotes*)%
-  {\cs{printpagenotes*}}%
-  {Input the pagenote \file{ent} file for printing, then empty it ready for 
-   further notes.}%
-
-   The general principle is that notes are written out to a file which
-is then input at the place where the notes are to be printed. The note 
-file has an \pixfile{ent} extension, like the table of contents file
-has a \pixfile{toc} extension.
-
-    You have to put \cmd{\makepagenote} in your preamble if you want 
-endnotes. This will open the \pixfile{ent} note file which is called
-\verb?\jobname.ent?.
-
-   In the body of the text use use \cmd{\pagenote} to create an endnote, just
-as you would use \cmd{\footnote} to create a footnote. In the books that I have
-checked there are two common methods of identifying an endnote:
-\begin{enumerate}
-\item Like a footnote, put a number in the text at the location 
-of the note and use the same number to identify the note when it
-finally gets printed.\label{pagenote:id1}
-\item Put no mark in the text, but when it is finally 
-      printed\pagenote[Put no mark \ldots finally printed]{This manual uses
-      both footnotes and endnotes. For identifying the endnotes I have used the
-      `words' method for identifying the parent location of an endnote, so as not
-      to start confusing the reader with two sets of note marks in the body of the
-      text. Typically either footnotes or endnotes are used, not both, so the
-      question of distinguishing them does not normally arise.}
-use a few words from the text to identify the origin of the note. The page number
-is often used as well with this method.\label{pagenote:id2}
-\end{enumerate}
-The \meta{text} argument of \cmd{\pagenote} is the contents of the note and
-if the optional \meta{id} argument is not used the
-result is similar to having used \cmd{\footnote} --- a number in the main text
-and the corresponding number in the endnotes listing (as 
-in \ref{pagenote:id1} above). For the second reference style 
-(\ref{pagenote:id2} above) use the 
-optional \meta{id} argument for the `few words', and no mark will be put
-into the main text but \meta{id} will be used as the identification in
-the listing.
-
-   For one set of endnotes covering the whole document put 
-\cmd{\printpagenotes} where you want them printed, typically before
-any bibliography or index. The \cmd{\printpagenotes} macro inputs the
-\pixfile{ent} endnote file for printing and then closes it to any further
-notes.
-
-For notes
-at the end of each chapter put \cmd{\printpagenotes*}, which inputs
-the \pixfile{ent} file for printing then empties it ready for more notes,
-at the end of each chapter.
-
-   The simple use is like this:
-\begin{lcode}
-\documentclass[...]{memoir}
-...
-\makepagenote
-...
-\begin{document}
-\chapter{One}
-...\pagenote{An end note.} ...
-...\pagenote{Fascinating information.}
-...
-\chapter{Last}% chapter 9
-...\pagenote{Another note.}% 30th note
-...
-...
-\printpagenotes
-...
-\end{document}
-\end{lcode}
-This will result in an endnote listing looking like \fref{fig:endnote}.
-
-\begin{figure}
-\centering
-\begin{minipage}{0.8\textwidth}
-\begin{framed}
-\noindent{\bfseries\Large Notes}\\[\baselineskip]
-{\bfseries Chapter 1 One} \\[\baselineskip]
-1. An end note \\
-2. Fascinating information. \\
-.............. \\[\baselineskip]
-{\bfseries Chapter 9 Last} \\[\baselineskip]
-1. Another note \\[\baselineskip]
-\end{framed}
-\end{minipage}
-\caption{Example endnote listing}\label{fig:endnote}
-\end{figure}
-
-For notes at the end of each chapter:
-\begin{lcode}
-\documentclass[...]{memoir}
-...
-\makepagenote
-...
-\begin{document}
-\chapter{One}
-...\pagenote{An end note.} ...
-...
-\printpagenotes*
-\chapter{Last}
-...\pagenote{Another note.} ...
-...
-\printpagenotes*
-%%% no more chapters
-...
-\end{document}
-\end{lcode}
-
-\begin{syntax}
-\cmd{\continuousnotenums} \\
-\cmd{\notepageref} \\
-\end{syntax}
-\glossary(continuousnotenums)%
-  {\cs{continuousnotenums}}%
-  {Declaration to make the numbering of endnotes continuous throughout the
-   document.}%
-\glossary(notepageref)%
-  {\cs{notepageref}}%
-  {Declaration that page numbers are available to notes in the endnote listing.}
-   The \Icn{pagenote} counter is used for the notes. By default the endnotes 
-are numbered per chapter. If you want the numbering
-to be continuous throughout the document use the \cmd{\continuousnotenums}
-declaration. Normally the information on which page a note was created is
-discarded but will be made available to notes in the endnote listing
-following the \cmd{\notepageref} declaration.  These declarations should 
-be put in your preamble. 
-
-\LMnote{2011/01/23}{Because of the new implementation this is no
-  longer needed as the writing to file is no longer delayed.}
-% Because of how TeX writes information to files, when the
-% \cmd{\notepageref} declaration is used there must be no notes on the
-% page where \cmd{\printpagenotes} or \cmd{\printpagenotes*} closes the
-% \pixfile{ent} file.  If necessary, a \cmd{\clearpage} or similar must
-% be used before the print command.
-
-\begin{syntax}
-\cmd{\notesname} \\
-\cmd{\notedivision} \\
-\end{syntax}
-\glossary(notesname)%
-  {\cs{notesname}}%
-  {Name for endnotes, default \texttt{Notes}.}%
-\glossary(notedivision)%
-  {\cs{notedivision}}%
-  {Heading printed by the \cs{printpagenotes} and \cs{printpagenotes*} macros.}
-
-  When \cmd{\printpagenotes} (or \cmd{\printpagenotes*}) is called the
-  first thing it does is call the macro \cmd{\notedivision}. By
-  default this is defined as:
-\begin{lcode}
-\newcommand*{\notesname}{Notes}
-\newcommand*{\notedivision}{\chapter{\notesname}}
-\end{lcode}
-In other words, it will print out a heading for the notes that will be read
-from the \file{ent} file. \verb?\print...? then closes the \pixfile{ent} file 
-for writing and after this \verb?\input?s it to get and process the notes.
-
-
-\subsection{Changing the appearance}
-
-\subsubsection{In the text}
-\label{sec:in-the-text}
-
-
-\begin{syntax}
-\cmd{\notenumintext}\marg{num} \\
-\end{syntax}
-\glossary(notenumintext)%
-  {\cs{notenumintext}\marg{num}}%
-  {Typesets the number \meta{num} of a page note in the main text.}%
-The \Icn{pagenote} counter is used for pagenotes. The macro
-\cmd{\notenumintext} is called by \cmd{\pagenote} with the value of the
-\Icn{pagenote} counter as the \meta{num} argument to print the
-value of the \Icn{pagenote} counter in the main text. By default it is 
-printed as a 
-superscript, but this can be changed, or even eliminated.
-\begin{lcode}
-\newcommand*{\notenumintext}[1]{\textsuperscript{#1}}
-\end{lcode}
-
-\subsubsection{In the page note list}
-\label{sec:page-note-list}
-
-  
-\LMnote{2011/01/23}{Added to make the formating code easier to understand}
-
-To better understand how a page note entry is formatted in the page
-note list, we start with the following  pseudo code
-\begin{syntax}
-\cmd{\prenoteinnotes}\\
-\cmd{\noteidinnotes}\marg{notenum}\marg{id}\\
-\cmd{\pageinnotes}\marg{auto generated note label key}\\
-\cmd{\prenotetext}\\
-\quad\meta{Page note text}\\
-\cmd{\postnotetext}\\
-\cmd{\postnoteinnotes}
-\end{syntax}
-At the start and end we have the two macros \cmd{prenoteinnotes} and
-\cmd{\postnoteinnotes}, they take care of preparing for and ending an
-entry in the list. The list is typeset in a manner where each item is
-(at least) a paragraph, so the default definition is
-\begin{lcode}
-\newcommand{\prenoteinnotes}{\par\noindent}
-\newcommand{\postnoteinnotes}{\par}
-\end{lcode}
-\glossary(prenoteinnotes)%
-  {\cs{prenoteinnotes}}%
-  {Called by \cs{noteentry} to initialise the printing of an endnote.}
-\glossary(postnoteinnotes)%
-  {\cs{postnoteinnotes}}%
-  {Called by \cs{noteentry} to finish the printing of an endnote.}
-A user could change this to make it look a bit more like a list
-construction. For example the following would give a hanging
-indentation
-\begin{lcode}
-\renewcommand{\prenoteinnotes}{\par\noindent\hangindent 2em}
-\end{lcode}
-
-\fancybreak{}
-
-
-The \cmd{\noteidinnotes} calls \cmd{\idtextinnotes} to print the note \meta{id}
-if it was given as the optional argument to \cmd{pagenote}, 
-otherwise it calls \cmd{\notenuminnotes} to print the note number.
-\begin{syntax}
-\cmd{\noteidinnotes}\marg{notenum}\marg{id} \\
-\cmd{\idtextinnotes}\marg{id} \\
-\cmd{\notenuminnotes}\marg{num} \\
-\end{syntax}
-\glossary(noteidinnotes)%
-  {\cs{noteidinnotes}\marg{notenum}\marg{id}}%
-  {Prints an endnote's number or id in the endnote listing.}%
-\glossary(idtextinnotes)%
-  {\cs{idtextinnotes}\marg{id}}%
-  {Prints an endnote's \meta{id} text}%
-\glossary(notenuminnotes)%
-  {\cs{notenuminnotes}\marg{num}}%
-  {Typesets the number \meta{num} of a page note in the note listing.}%
-These are defined respectively as:
-\begin{lcode}
-\newcommand*{\idtextinnotes}[1]{[#1]\space}
-\newcommand*{\notenuminnotes}[1]{\normalfont #1.\space}
-\end{lcode}
-
-\fancybreak{}
-
-Next we execute \cmd{\pageinnotes}\marg{note label key} which does
-nothing by default. But if \cmd{\notepageref} is issued in the
-preamble two things happen, (1) each page note issues a label such
-that we can refer back to its page, and (2) \cmd{\pageinnotes} calls
-\cmd{\printpageinnotes} (or if \Lpack{hyperref} is loaded
-\cmd{\printpageinnoteshyperref}) 
-\begin{syntax}
-\cmd{\pageinnotes}\marg{auto generated note label key}\\
-\cmd{\printpageinnotes}\marg{auto generated note label key}\\  
-\cmd{\printpageinnoteshyperref}\marg{auto generated note label key}
-\end{syntax}
-\glossary(pageinnotes)%
-{\cs{pageinnotes}\marg{pagenum}}%
-{Controls the printing of an endnote's page reference number.}%
-\glossary(printpageinnotes)%
-{\cs{printpageinnotes}\marg{pagenum}}%
-{Prints an endnote's page reference number.}%
-\glossary(printpageinnoteshypreref)%
-{\cs{printpageinnoteshyperref}\marg{pagenum}}%
-{Prints an endnote's page reference number whenever the
-  \protect\Lpack{hyperref} package is used, it will include a
-  hyperlink back to the page in question.}%
-Default definitions
-\begin{lcode}
-\newcommand*{\printpageinnotes}[1]{%
-    (\pagerefname\ \pageref{#1})\space}
-\newcommand\printpageinnoteshyperref[1]{%
-   (\hyperref[#1]{\pagerefname\ \pageref*{#1}})\space}
-\end{lcode}
-That is if \Lpack{hyperref} is loaded the entire text \meta{page 3}
-will be the text of a hyperlink.
-
-\bigskip
-
-\begin{syntax}
-  \cmd{\prenotetext}\\
-  \cmd{\postnotetext}\\
-\end{syntax}
-\glossary(prenotetext)%
-  {\cs{prenotetext}}%
-  {Called within a page note list entry to initialise the printing
-    of the text part of an endnote.}%
-\glossary(postnotetex)%
-  {\cs{postnotetext}}%
-  {Called within a page note list entry to finish the printing of an
-    endnote.}%
-The actual text part of the page note is enclosed by
-\cmd{\prenotetext} and \cmd{postnotetext}. By default they do nothing,
-but could easily be redefined such that (only) the entry text would be
-in italic: 
-\begin{lcode}
-\renewcommand\prenotetext{\begingroup\itshape}
-\renewcommand\postnotetext{\endgroup}
-\end{lcode}
-
-
-
-%%%%%%%%%%%
-
-
-\LMnote{2011/01/25}{Covered above}
-% \begin{syntax}
-% \cmd{\notenuminnotes}\marg{num} \\
-% \end{syntax}
-% \glossary(notenuminnotes)%
-%   {\cs{notenuminnotes}\marg{num}}%
-%   {Typesets the number \meta{num} of a page note in the note listing.}%
-% In the note listing \cmd{\notenuminnotes} is used to print the number
-% of a note. The default definitions are:
-
-% \begin{lcode}
-% \newcommand*{\notenuminnotes}[1]{\normalfont #1.\space}
-% \end{lcode}
-
-
-
-\LMnote{2011/01/25}{Covered above, \cmd{\noteentry} is not used anymore}
-% \begin{syntax}
-% \cmd{\noteentry}\marg{notenum}\marg{id}\marg{text}\marg{pagenum} \\
-% \cmd{\prenoteinnotes} \\
-% \cmd{\postnoteinnotes} \\
-% \end{syntax}
-% \glossary(noteentry)%
-%   {\cs{noteentry}\marg{notenum}\marg{id}\marg{text}\marg{pagenum}}%
-%   {Typesets a pagenote with number \meta{notenum}, identifier \meta{id},
-%    contents \meta{text}, created on page \meta{pagenum}.}
-% \glossary(prenoteinnotes)%
-%   {\cs{prenoteinnotes}}%
-%   {Called by \cs{noteentry} to initialise the printing of an endnote.}
-% \glossary(postnoteinnotes)%
-%   {\cs{postnoteinnotes}}%
-%   {Called by \cs{noteentry} to finish the printing of an endnote.}
-% The \cmd{\pagenote} macro writes \cmd{\noteentry}, with the appropriate 
-% values for the arguments, to the \pixfile{ent} file, 
-% where \meta{notenum} is the note number (from the \Icn{pagenote} counter),
-% \meta{id} and \meta{text} are as supplied to
-% \cmd{\pagenote}, and if the \cmd{\notepageref} declaration option is used, 
-% \meta{pagenum} is the page number, otherwise it is empty. 
-% The \cmd{\noteentry} macro controls the typesetting of the note.
-
-% The default definition of \cmd{\noteentry} is
-% \begin{lcode}
-% \newcommand{\notentry}[4]{%
-%   \prenoteinnotes
-%   \noteidinnotes{#1}{#2}\pageinnotes{#4}\noteinnotes{#3}%
-%   \postnoteinnotes}
-% \end{lcode}
-% and the definitions of other macros are:
-% \begin{lcode}
-% \newcommand{\prenoteinnotes}{\par\noindent}
-% \newcommand{\postnoteinnotes}{\par}
-% \end{lcode}
-% so that (the first paragraph of) each note is printed as a non-indented 
-% paragraph.
-
-%     If you would prefer, say, hanging paragraphs try:
-% \begin{lcode}
-% \renewcommand{\prenoteinnotes}{\par\noindent\hangindent 2em}
-% \end{lcode}
-
-% \begin{syntax}
-% \cmd{\noteidinnotes}\marg{notenum}\marg{id} \\
-% \cmd{\idtextinnotes}\marg{id} \\
-% \cmd{\notenuminnotes}\marg{num} \\
-% \end{syntax}
-% \glossary(noteidinnotes)%
-%   {\cs{noteidinnotes}\marg{notenum}\marg{id}}%
-%   {Prints an endnote's number or id in the endnote listing.}%
-% \glossary(idtextinnotes)%
-%   {\cs{idtextinnotes}\marg{id}}%
-%   {Prints an endnote's \meta{id} text}%
-% The \cmd{\noteidinnotes} calls \cmd{\idtextinnotes} to print the note \meta{id}
-% if it was given as the optional argument to \cmd{pagenote}, 
-% otherwise it calls \cmd{\notenuminnotes} to print the note number.
-% These are defined respectively as:
-% \begin{lcode}
-% \newcommand*{\idtextinnotes}[1]{[#1]\space}
-% \newcommand*{\notenuminnotes}[1]{\normalfont #1.\space}
-% \end{lcode}
-
-% \begin{syntax}
-% \cmd{\pageinnotes}\marg{pagenum} \\
-% \cmd{\printpageinnotes}\marg{pagenum} \\
-% \end{syntax}
-% \glossary(pageinnotes)%
-%   {\cs{pageinnotes}\marg{pagenum}}%
-%   {Controls the printing of an endnote's page reference number.}%
-% \glossary(printpageinnotes)%
-%   {\cs{printpageinnotes}\marg{pagenum}}%
-%   {Prints an endnote's page reference number.}%
-% The macro \cmd{\pageinnotes} controls the printing of a note's page 
-% reference. If the
-% \cmd{\notepageref} declaration has been used it calls
-% \cmd{\printpageinnotes} to do the actual printing. Its definition is:
-% \begin{lcode}
-% \newcommand*{\printpageinnotes}[1]{%
-%   (\pagerefname\ #1)\space}
-% \end{lcode}
-
-% \begin{syntax}
-% \cmd{\noteinnotes}\marg{text} \\
-% \end{syntax}
-% \glossary(noteinnotes)%
-%   {\cs{noteinnotes}\marg{text}}%
-%   {Prints the text of an endnote.}%
-% The macro \cmd{\noteinnotes}\marg{text} is simply:
-% \begin{lcode}
-% \newcommand{\noteinnotes}[1]{#1}
-% \end{lcode}
-% and is used to print the text of a note.
-
-
-
-
-\bigskip
-
-
-
-\LMnote{2011/01/25}{rewritten a bit}
-\begin{syntax}
-\cmd{\addtonotes}\marg{text} \\
-\end{syntax}
-\glossary(addtonotes)%
-  {\cs{addtonotes}\marg{text}}%
-  {Inserts \meta{text} into the endnotes \file{ent} file.}%
-The macro \cmd{\addtonotes} inserts \meta{text} into the \pixfile{ent}
-file. 
-
-\textbf{Note:} As the argument to \cmd{\pagenote} and
-\cmd{\addtonotes} is moving you may have to \cmd{\protect} any fragile
-commands. If you get strange error messages, try using \cmd{\protect}
-and see if they go away.
-
-\fancybreak{}
-
-Internally in \cmd{\pagenote} \cmd{\addtonotes} is used to provide
-chapter devisions into the note list. It will detect both numbered and
-unnumbered chapters. The actual text is provided using
-\begin{syntax}
-\cmd{\pagenotesubhead}\marg{chapapp}\marg{num}\marg{title} \\
-\cmd{\pagenotesubheadstarred}\marg{chapapp}\marg{num}\marg{title} \\
-\cmd{\pnchap} \cmd{\pnschap} \\
-\end{syntax}
-\glossary(pagenotesubhead)%
-  {\cs{pagenotesubhead}\marg{chapapp}\marg{num}\marg{title}}%
-  {Typesets a subheading for notes from chapter or appendix \meta{chapapp} 
-   \meta{num} called \meta{title}.}%
-\glossary(pagenotesubheadstarred)%
-  {\cs{pagenotesubheadstarred}\marg{chapapp}\marg{num}\marg{title}}%
-  {Typesets a subheading for notes from unnumbered chapter or appendix
-    \meta{chapapp}  \meta{num} called \meta{title}.}%
-\glossary(pnchap)%
-  {\cs{pnchap}}%
-  {Chapter title for \cs{pagenotesubhead}. Defaults to the ToC entry.}
-\glossary(pnschap)%
-{\cs{pnschap}}%
-{Starred chapter title for \cs{pagenotesubhead}. Defaults to the regular title.}
-  
-The macro \cmd{\pagenotesubhead} typesets the subheadings in an
-endnote list.  The \meta{chapapp} argument is normally
-\cmd{\chaptername} but if the notes are from an appendix then
-\cmd{\appendixname} is used instead. \meta{num} is the number of the
-chapter, or blank if there is no number. Lastly, \meta{title} is
-\cmd{\pnchap} for regular chapters which defaults to the ToC entry, or
-\cmd{\pnschap} for starred chapters which defaults to the normal
-title. The default definition of \cmd{\pagenotesubhead} is very
-simply:
-\begin{lcode}
-\newcommand*{\pagenotesubhead}[3]{%
-  \section*{#1 #2 #3}}
-\newcommand\pagenotesubheadstarred{\pagenotesubhead} % i.e. the same
-\end{lcode}
-By default this means that the header for starred chapters will be
-something like >>Chapter Title<<, which may look odd. In that case
-redefine \cmd{\pagenotesubheadstarred} to something similar to 
-\begin{lcode}
-\renewcommand\pagenotesubheadstarred{\section*{#3}}
-\end{lcode}
-Just remember that unless you have specified \cmd{\continuousnotenums}
-in the preamble the note counter (\Icn{pagenote}) will only be reset
-at the start of any numbered chapters (because it is tied to changes
-in the chapter counter).
-
-The scheme is set up under the assumption that notes will only be
-printed at the end of the document. If you intend to put them at the
-end of each chapter, then you will probably want to change the
-definitions of the \cmd{\notedivision} and \cmd{\pagenotesubhead}
-macros. For example:
-\begin{lcode}
-\renewcommand*{\notedivision}{\section*{\notesname}}
-\renewcommand*{\pagenotesubhead}[3]{}
-\end{lcode}
-and remember to use \cmd{\printpagenotes*} at each place you want the
-current set of notes to be printed.
-
-\fancybreak{}
-
-Say you have written a document with footnotes, but later on decide on
-using end notes (page notes) instead. In that case you can use
-\cmd{\foottopagenote} to make \cmd{\footnote}, \cmd{\footnotemark} and
-\cmd{\footnotetext} works as if it was implemented using end notes. On
-the other hand \cmd{\pagetofootnote} makes all  page notes into
-footnotes (note that this might not work, because there are places
-where page notes can be issued but foot notes cannot).
-
-\begin{syntax}
-\cmd{\foottopagenote}\\ \cmd{\pagetofootnote} \\
-\end{syntax}
-\glossary(foottopagenote)%
-  {\cs{foottopagenote}}%
-  {Declaration which turns \cs{footnote}s into \cs{pagenote}s.}%
-\glossary(pagetofootnote)%
-  {\cs{pagetofootnote}}%
-  {Declaration which turns \cs{pagenote}s into \cs{footnote}s.}%
-  % You can have both footnotes and endnotes in the same
-  % document. However you may start with all footnotes and later
-  % decide you would have preferred endnotes instead, or
-  % \emph{vice-versa}. The \cmd{\foottopagenote} declaration makes
-  % \cmd{\footnote}s behave as \cmd{\pagenote}s, and
-  % \cmd{\pagetofootnote} has the opposite effect.
-In either conversion the optional argument will be
-ignored as for \cmd{\pagenote} it can be arbitrary text whereas for
-\cmd{\footnote} it must be a number.
+\LMnote{2013/05/02}{Section about endnotes moved page-notes.tex}
 
 
 
@@ -26723,8 +27165,8 @@ ignored as for \cmd{\pagenote} it can be arbitrary text whereas for
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-12-06 00:21:35 +0100 (Mon, 06 Dec 2010) $}
-{$LastChangedRevision: 315 $}
+{$LastChangedDate: 2013-05-17 16:33:35 +0200 (Fri, 17 May 2013) $}
+{$LastChangedRevision: 466 $}
 {$LastChangedBy: daleif $}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -26790,7 +27232,7 @@ marking in the \Lclass{iso} class~\cite{ISOCLASS}.
   {\cs{nochangemarks}}%
   {Do not print change marks.}
 The change marking macros only work properly when the \Lopt{draft} class
-option is used. Additionaly, the marks are only printed when the 
+option is used. Additionally, the marks are only printed when the 
 \cmd{\changemarks} declaration is in effect. Using \cmd{\nochangemarks}
 switches off any marking.
 
@@ -26827,7 +27269,7 @@ marks can be placed on each page, usually to indicate where the stock should
 be trimmed to obtain the planned page size. 
 
 \begin{syntax}
-\cmd{\showtrimsoff} \cmd{\showtrimeson} \\
+\cmd{\showtrimsoff} \cmd{\showtrimson} \\
 \end{syntax}
 \glossary(showtrimsoff)%
   {\cs{showtrimsoff}}%
@@ -26841,6 +27283,23 @@ declaration switches off the trim marks; the \cmd{\showtrimson} declaration,
 which is the default, switches on the trim marks. These declarations do
 nothing if the \Lopt{showtrims} option has not been used.
 
+\LMnote{2013/05/01}{added caveat}
+\begin{caveat}
+  Most modern \LaTeX\ editors make use of the \emph{synctex} features
+  in, say, pdf\LaTeX\ to enable \emph{reverse search} from the PDF
+  previewer back tot he source code in the editor. That is, click in a
+  certain manner in the PDF previewer and you will be taken to the
+  corresponding (or there about) line in the source code.
+
+  Apparently the \emph{synctex} feature does not like the trimmarks
+  the class provide, or the \pstyle{showlocs} page style. The code
+  line one is referred back to may be off by tens of lines.
+
+  Currently, there is no known workarounds for this deficiency.
+\end{caveat}
+
+
+
     Trim marks can be placed at each corner of the (trimmed) page, and also
 at the middle of each side of the page.
 
@@ -27500,14 +27959,15 @@ values. For example:
 
 \section{Odd/even page checking}
 
-    It is difficult to check robustly if the current page is odd or even but 
-the class does provide a robust method based on writing out a label and then
-checking the page reference for the label. This requires at least two \ltx\
-runs to stabilise. This has been extracted from the original 
-\Lpack{chngpage} package~\cite{CHNGPAGE}. (The class code and \Lpack{chngpage}
-code is similar but not identical. There is a later package, 
-\Lpack{changepage}~\cite{CHANGEPAGE}
-which contains code that is identical to the class.)
+It is difficult to check robustly if the current page is odd or even
+but the class does provide a robust method based on writing out a
+label and then checking the page reference for the label. This
+requires at least two \ltx\ runs to stabilise. This has been extracted
+from the original \Lpack{chngpage} package (which is no longer
+available). (The class code and \Lpack{chngpage} code is similar but
+not identical. There is a later package,
+\Lpack{changepage}~\cite{CHANGEPAGE} which contains code that is
+identical to the class.)
 
 
 \begin{syntax}
@@ -28095,6 +28555,10 @@ is equivalent to
 The command \cmd{\checkifinteger} ckecks if \meta{num} is an integer 
 (not less than zero). If it is then \piif{ifinteger} is set \ptrue, 
 otherwise it is set \pfalse.
+%
+\begin{note}
+  Please note that \cmd{\checkifinteger} may only work on simple input.
+\end{note}
 
 
 \section{Checking the processor}
@@ -29105,8 +29569,8 @@ The macro \cs{parg}\marg{arg} prints \parg{arg} for a parenthesized argument.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-07-01 01:44:23 +0200 (Thu, 01 Jul 2010) $}
-{$LastChangedRevision: 249 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 \chapter{For package users} \label{chap:packageusers}
@@ -29261,8 +29725,8 @@ of the standard commands needs to be replaced.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-10-01 17:39:01 +0200 (Fri, 01 Oct 2010) $}
-{$LastChangedRevision: 285 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 
@@ -29841,8 +30305,8 @@ in your document's preamble\index{preamble}.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-05-13 17:10:00 +0200 (Thu, 13 May 2010) $}
-{$LastChangedRevision: 210 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 \PWnote{2009/07/05}{Added thesis design chapter}
@@ -30869,8 +31333,8 @@ than Archibald Smythe University will permit.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-05-13 17:10:00 +0200 (Thu, 13 May 2010) $}
-{$LastChangedRevision: 210 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 \chapter{Packages and macros}
@@ -31100,8 +31564,7 @@ serves my needs.
 
 
 %#% extend
-%#% extstart include sniplets.tex
-
+%#% extstart include showcases.tex
 
 \svnidlong
 {$Ignore: $}
@@ -31109,19 +31572,359 @@ serves my needs.
 {$LastChangedRevision: 210 $}
 {$LastChangedBy: daleif $}
 
+\chapter{Showcases}
+\label{cha:showcases}
+
+The \theclass\ memoir class has several features that involve a
+\emph{style} and it provide several of these styles. This chapter is
+used to showcase these styles.
+
+\section{Chapter styles}
+\label{sec:chapter-styles}
+
+\index{chapterstyle|(}
+
+For more about defining chapter styles, see
+section~\ref{sec:chapter-headings}, page~\pageref{sec:chapter-headings}.
+
+\begin{demochap}[-3\onelineskip]{default}\end{demochap}
+
+\begin{demochap}[2\onelineskip]{section}\end{demochap}
+
+\begin{demochap}[2\onelineskip]{hangnum}\end{demochap}
+
+\begin{demochap}[2\onelineskip]{companion}\end{demochap}
+
+\begin{demochap}[-1\onelineskip]{article}\end{demochap}
+
+\begin{demochap}[-2\onelineskip]{bianchi}\end{demochap}
+
+\begin{demochap}{bringhurst}\end{demochap}
+
+\begin{demochap}[-2\onelineskip]{brotherton}\end{demochap}
+
+\begin{demochap}{chappell}\end{demochap}
+
+\begin{demochap}[-2\onelineskip]{crosshead}\end{demochap}
+
+\begin{demochap}[-\onelineskip]{culver}\end{demochap}
+
+\begin{demochap}[-4\onelineskip]{dash}\end{demochap}
+
+\begin{demochap}[-\onelineskip]{demo2}\end{demochap}
+
+\begin{demochap}[-2\onelineskip]{dowding}\end{demochap}
+
+\begin{demochap}{ell}\end{demochap}
+
+\begin{demochap}[-4\onelineskip]{ger}\end{demochap}
+
+\begin{demochap}[-2\onelineskip]{komalike}\end{demochap}
+
+\begin{demochap}[-2\onelineskip]{lyhne}\end{demochap}
+
+\clearpage
+
+\begin{demochap}[-2\onelineskip]{madsen}\end{demochap}
+
+\begin{demochap}[-3\onelineskip]{ntglike}\end{demochap}
+
+\begin{demochap}[-\onelineskip]{southall}\end{demochap}
+
+\begin{demochap}[-1\onelineskip]{tandh}\end{demochap}
+
+\begin{demochap}{thatcher}\end{demochap}
+
+\begin{demochap}[-2\onelineskip]{veelo}\end{demochap}
+
+\begin{demochap}{verville}\end{demochap}
+
+\FloatBlock
+
+
+\begin{demochap}[-1\onelineskip]{wilsondob}\end{demochap}
+
+
+The code for some of these styles is given in below.  For details of
+how the other chapter styles are defined, look at the documented class
+code. This should give you ideas if you want to define your own style.
+
+Note that it is not necessary to define a new chapterstyle if you want
+to change the chapter headings --- you can just change the individual
+macros without putting them into a style.
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+\subsection{Chappell}
+
+    A style that includes rules is one that I based on the chapter heads
+in~\cite{CHAPPELL99} and which I have called \cstyle{chappell} after the
+first author. The style, which is shown in \fref{dcchappell}, can easily form
+the basis for general heads in non-technical books.
+\begin{lcode}
+\makechapterstyle{chappell}{%
+  \setlength{\beforechapskip}{0pt}
+  \renewcommand*{\chapnamefont}{\large\centering}
+  \renewcommand*{\chapnumfont}{\large}
+  \renewcommand*{\printchapternonum}{%
+    \vphantom{\printchaptername}%
+    \vphantom{\chapnumfont 1}%
+    \afterchapternum
+    \vskip -\onelineskip}
+  \renewcommand*{\chaptitlefont}{\Large\itshape}
+  \renewcommand*{\printchaptertitle}[1]{%
+    \hrule\vskip\onelineskip \centering\chaptitlefont ##1}}
+\end{lcode}
+
+
+The style centers the chapter number, draws a rule across the page under
+it, and below that comes the title, again centered. All the fiddling
+in the \cs{printchapternonum} macro is to try and ensure that the rule
+above the title is at the same height whether or not the chapter is numbered
+(the ToC being an example of an unnumbered heading).
+
+\subsection{Demo, Demo2 and demo3}
+
+    I created a \cstyle{demo} chapterstyle quite a time ago and used it 
+on occasions in earlier editions of this Manual. Here is the original code.
+\begin{lcode}
+\makechapterstyle{demo}{%
+  \renewcommand*{\printchaptername}{\centering}
+  \renewcommand*{\printchapternum}{\chapnumfont \numtoName{\c@chapter}}
+  \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
+  \renewcommand*{\printchaptertitle}[1]{%
+    \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1}
+  \renewcommand*{\afterchaptertitle}%
+                {\vskip\onelineskip \hrule\vskip \afterchapskip}
+}% end demo
+\end{lcode}
+
+This has one serious failing and what I now believe is a poor design 
+decision. The failing is that if you have any appendices that use the
+\cstyle{demo} chapterstyle then they are numbered instead of being lettered.
+The poor design is that the position of the title with respect to the top
+of the page is not the same for numbered and unnumbered chapters.
+    The \cstyle{demo2} chapterstyle below fixes both of these at the expense
+of simplicity (at least for me).
+\begin{lcode}
+\makechapterstyle{demo2}{%
+  \renewcommand*{\printchaptername}{\centering}
+  \renewcommand*{\printchapternum}{\chapnumfont 
+     \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}
+  \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
+  \renewcommand*{\printchaptertitle}[1]{%
+    \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1}
+  \renewcommand*{\afterchaptertitle}{%
+    \vskip\onelineskip \hrule\vskip \afterchapskip}
+  \setlength{\beforechapskip}{3\baselineskip}
+  \renewcommand*{\printchapternonum}{%
+    \vphantom{\chapnumfont One}
+    \afterchapternum%
+    \vskip\topskip}
+  \setlength{\beforechapskip}{2\onelineskip}
+}% end{demo2}
+\end{lcode}
+    You may find it instructive to compare the code for the \cstyle{demo} and 
+\cstyle{demo2} chapterstyles.
+
+    Thec \cstyle{demo} chapterstyle is still available in the class for
+backward compatibility reasons, but I strongly advise against anyone using it.
+
+    By chance I inadvertantly typest a chapterstyle that was a mixture
+of the \cstyle{pedersen} and \cstyle{demo2} styles. As a result there is
+now a \cstyle{demo3} chapterstyle as well. The only difference between the
+two styles is in the definition of \cs{chapnumfont} which in \cstyle{demo3}
+is:
+\begin{lcode}
+\renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape}
+\end{lcode}
+
+\subsection{Pedersen}
+
+    I have modified Troels Pedersen's original code to make it a little more
+efficient and flexible. 
+
+\begin{lcode}
+\newcommand*{\colorchapnum}{}
+\newcommand*{\colorchaptitle}{}
+\makechapterstyle{pedersen}{%
+  \setlength{\beforechapskip}{-20pt}
+  \setlength{\afterchapskip}{10pt}
+  \renewcommand*{\chapnamefont}{\normalfont\LARGE\itshape}
+  \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape\colorchapnum}
+  \renewcommand*{\chaptitlefont}{\normalfont\huge\itshape\colorchaptitle}
+  \renewcommand*{\afterchapternum}{}
+  \renewcommand*{\printchaptername}{}
+  \setlength{\midchapskip}{20mm}
+  \renewcommand*{\chapternamenum}{}
+  \renewcommand*{\printchapternum}{%
+    \sidebar{\raisebox{0pt}[0pt][0pt]{\makebox[0pt][l]{%
+      \resizebox{!}{\midchapskip}{\chapnumfont\thechapter}}}}}
+  \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1}
+}
+\end{lcode}
+The chapter number is scaled up from its normal size and set in a 
+sidebar\index{sidebar}.
+
+\begin{syntax}
+\cmd{\colorchapnum} \cmd{\colorchaptitle} \\
+\end{syntax}
+\glossary(colorchapnum)
+  {\cs{colorchapnum}}%
+  {Color for the number in the \Pcstyle{pedersen} chapterstyle.}
+\glossary(colorchaptitle)
+  {\cs{colorchaptitle}}%
+  {Color for the title in the \Pcstyle{pedersen} chapterstyle.}
+  The title is set with \cmd{colorchaptitle} and the number with
+\cmd{colorchapnum}, both of which default to doing nothing. 
+Lars Madsen\index{Madsen, Lars}
+has suggested an attractive red color for these:
+\begin{lcode}
+\usepackage{color}
+\definecolor{ared}{rgb}{.647,.129,.149}
+\renewcommand{\colorchapnum}{\color{ared}}
+\renewcommand{\colorchaptitle}{\color{ared}}
+\chapterstyle{pedersen}
+\end{lcode}
+
+    The uncolored version is used for the chaptersyle for this chapter;
+because of setting the number in a sidebar\index{sidebar} it does not
+display well anywhere other than as a real chapter head.
+
+\subsection{Southall}
+
+    On 2006/01/08 Thomas Dye\index{Dye, Thomas} posted his \cstyle{southall} 
+chapterstyle on \url{comp.text.tex} and kindly gave me permission to 
+include it here. It is based on the headings in a Cambridge Press 
+book\footnote{Which I haven't seen} by Aidan Southall.
+It produces a simple numbered heading with the title set as a block paragraph,
+and with a horizontal rule underneath. His original code called for lining
+figures for the number but I have commented out that bit. I also changed
+the code to eliminate the need for the two new lengths that Thomas used.
+
+\begin{lcode}
+\makechapterstyle{southall}{%
+  \setlength{\afterchapskip}{5\baselineskip}
+  \setlength{\beforechapskip}{36pt}
+  \setlength{\midchapskip}{\textwidth}
+  \addtolength{\midchapskip}{-\beforechapskip}
+  \renewcommand*{\chapterheadstart}{\vspace*{2\baselineskip}}
+  \renewcommand*{\chaptitlefont}{\huge\rmfamily\raggedright}
+  \renewcommand*{\chapnumfont}{\chaptitlefont}
+  \renewcommand*{\printchaptername}{}
+  \renewcommand*{\chapternamenum}{}
+  \renewcommand*{\afterchapternum}{}
+  \renewcommand*{\printchapternum}{%
+    \begin{minipage}[t][\baselineskip][b]{\beforechapskip}
+      {\vspace{0pt}\chapnumfont%%%\figureversion{lining} 
+                   \thechapter}
+    \end{minipage}}
+  \renewcommand*{\printchaptertitle}[1]{%
+    \hfill\begin{minipage}[t]{\midchapskip}
+      {\vspace{0pt}\chaptitlefont ##1\par}\end{minipage}}
+  \renewcommand*{\afterchaptertitle}{%
+    \par\vspace{\baselineskip}%
+    \hrulefill \par\nobreak\noindent \vskip\afterchapskip}}
+\end{lcode}
+
+The resulting style is shown in \fref{dcsouthall}.
+
+
+\subsection{Veelo}
+
+    Bastiaan Veelo 
+posted the code for a new chapter style to \pixctt\ on 2003/07/22 under the
+title \textit{[memoir] [contrib] New chapter style}. His code, which
+I have slightly modified and changed the name to \cstyle{veelo},
+is below. I have also exercised editorial privilege on his comments.
+
+\begin{quote}
+ I thought I'd share a new chapter style to be used with the memoir class. 
+ The style is tailored for documents that are to be trimmed to a smaller 
+ width. When the bound document is bent, black tabs will appear on the 
+ fore side at the places where new chapters start as a navigational aid.
+ We are scaling the chapter number, which most DVI viewers
+ will not display accurately. \\[0.5\onelineskip]
+Bastiaan.
+\end{quote}
+
+    In the style as I modified it, \lnc{\beforechapskip} is used as the 
+height of the number and \lnc{\midchapskip} is used as the length of the
+black bar.
+\begin{lcode}
+\newlength{\numberheight}
+\newlength{\barlength}
+\makechapterstyle{veelo}{%
+  \setlength{\afterchapskip}{40pt}
+  \renewcommand*{\chapterheadstart}{\vspace*{40pt}}
+  \renewcommand*{\afterchapternum}{\par\nobreak\vskip 25pt}
+  \renewcommand*{\chapnamefont}{\normalfont\LARGE\flushright}
+  \renewcommand*{\chapnumfont}{\normalfont\HUGE}
+  \renewcommand*{\chaptitlefont}{\normalfont\HUGE\bfseries\flushright}
+  \renewcommand*{\printchaptername}{%
+    \chapnamefont\MakeUppercase{\@chapapp}}
+  \renewcommand*{\chapternamenum}{}
+  \setlength{\beforechapskip}{18mm}
+  \setlength{\midchapskip}{\paperwidth}
+  \addtolength{\midchapskip}{-\textwidth}
+  \addtolength{\midchapskip}{-\spinemargin}
+  \renewcommand*{\printchapternum}{%
+    \makebox[0pt][l]{\hspace{.8em}%
+      \resizebox{!}{\numberheight}{\chapnumfont \thechapter}%
+      \hspace{.8em}%
+      \rule{\midchapskip}{\beforechapskip}%
+     }}%
+   \makeoddfoot{plain}{}{}{\thepage}}
+\end{lcode}
+
+
+    If you use this style you will also need to use the \Lpack{graphicx} 
+package~\cite{GRAPHICX} because of the \cmd{\resizebox} macro. 
+The \cstyle{veelo} style works best for chapters that start 
+on recto pages.
+
+\index{chapterstyle|)}
+
+
+%#% extend
+%#% extstart include sniplets.tex
+
+
+\svnidlong
+{$Ignore: $}
+{$LastChangedDate: 2013-05-16 17:28:08 +0200 (Thu, 16 May 2013) $}
+{$LastChangedRevision: 464 $}
+{$LastChangedBy: daleif $}
+
+
+\defaultlists
+
+
 \LMnote{2010/02/09}{Started the sniplet chapter}
 \chapter{Sniplets}
 \label{cha:sniplets}
 
+\cftinserthook{toc}{start-sniplets}
+
+
 This chapter is (over time) meant to hold various pieces of code for
 \theclass\ that we have gathered over the years or others have
-contributed, and which we think might be useful for others. 
+contributed, and which we think might be useful for others.  In some
+cases they will have been moved from the text to this place, in order
+to make the manual less cluttered.
+
+
+If you have some \theclass\ related code you would like to share, feel
+free to send it to \verb?daleif@imf.au.dk?.
+
 
-If you have some \theclass\ related code you would like to share feel
-free to send it to \verb?daleif+memoir@imf.au.dk?.
 
+\sniplettoc
 
-\begin{sniplet}\label{snip:1}
+
+\begin{sniplet}[Mirroring the output]\label{snip:1}
   The \theclass\ class is not quite compatible with the \Lpack{crop}
   package. This is usually not a problem as we provide our own
   crop marks. But \Lpack{crop} provide one feature that we do not:
@@ -31143,7 +31946,7 @@ free to send it to \verb?daleif+memoir@imf.au.dk?.
   \end{lcode}
 \end{sniplet}
 
-\begin{sniplet}\label{snip:2}
+\begin{sniplet}[Remove pagenumber if only one page]\label{snip:2}
   Memoir counts all the pages used. You can use this information
   in various ways. For example, say you are preparing a setup to write
   small assignments in, these may or may not be just one page. How do
@@ -31155,7 +31958,7 @@ free to send it to \verb?daleif+memoir@imf.au.dk?.
   \end{lcode}
 \end{sniplet}
 
-\begin{sniplet}\label{snip:veelo}
+\begin{sniplet}[A kind of draft note]\label{snip:veelo}
   Bastiaan Veelo\index{Veelo, Bastiaan} has kindly provided example code 
   for another form of a side note, as follows.
 \begin{lcode}
@@ -31202,7 +32005,7 @@ file) without the \cs{makeat...} commands.
 
 
 \LMnote{2010/03/12}{Added this sniplet inspired by a thread on ctt}
-\begin{sniplet}
+\begin{sniplet}[Adding indentation to footnotes]
 
 At times a document design calls for a footnote configuration equal to
 the default but everything indented more to the right. This can be
@@ -31221,7 +32024,7 @@ since it is reset in the footnotes.
 
 
 \LMnote{2010/03/12}{Added this sniplet inspired by a thread on ctt}
-\begin{sniplet}
+\begin{sniplet}[Background image and trimmarks]
 This sniplet comes from another problem described in \textsc{ctt}. If
 one use the \Lpack{eso-pic} package to add a background image, this
 image ends up on top of the trim marks. To get it \emph{under} the
@@ -31234,21 +32037,316 @@ trim marks Rolf Niepraschk suggested the following trick
 ...
 \end{lcode}
   
+\end{sniplet}
+
+
+\LMnote{2012/09/21}{Sniplet showcasing autoadjusting numwidths in the toc}
+\begin{sniplet}[Autoadjusted number widths in the ToC]
+  \label{snip:autotoc}
+
+  When the \toc{} is typeset the chapter, section etc. number is
+  typeset within a box of a certain fixed with (one width for each
+  sectional type).  If this width is too small for the current
+  document, the user have to manually adjust this width.
+
+  In this sniplet we present a method where we automatically record
+  the widest.
 
+  It a later \theclass\ version, we may add similar code to the core.
+
+  There are two ways to record the widest entries of the various
+  types, either preprocess the entire \toc{} or measure it as a part
+  of the \toc{} typesetting, store it in the \texttt{.aux} and reuse
+  it on the next run. We will use the later approach. There is one
+  caveat: The \texttt{.aux} file is read at \verb|\begin{document}|,
+    so we need to postpone our adjustments via \verb|\AtBeginDocument|.
+
+  The following solution use some \toc{} related hooks within the
+  class, plus the \Lpack{etoolbox} and \Lpack{calc} packages.
+
+  First we create some macros to store information within the
+  \texttt{.aux} file, and retrieve it again.
+
+  \begin{lcode}
+    \makeatletter
+    \newcommand\mem@auxrestore[2]{\csgdef{stored@value@#1}{#2}}
+    \newcommand\memstorevalue[2]{%
+      \@bsphack%
+      \immediate\write\@mainaux{\string\mem@auxrestore{#1}{#2}}%
+      \@esphack}
+    \newcommand\RetrieveStoredLength[1]{%
+      \ifcsdef{stored@value@#1}{\csuse{stored@value@#1}}{0pt}}%
+    \makeatletter
+  \end{lcode}
+  Here \cs{RetrieveStoredLength} can be used in most \cmd{\setlength}
+  cases, at least when the \Lpack{calc} package is loaded. The
+  argument will be the name of the variable one asked to be stored. If
+  no corresponding value has been found for a given name, 0\,pt is returned.
+
+  Next we need to prepare the hooks. In this case we will show how to
+  take care of \cmd{\chapter}, \cmd{\section} and \cmd{\subsection}.
+  \cmd{\chapter} is relatively easy:\footnote{In some cases you may
+    want to use \texttt{%
+      \{%
+      \cs{@chapapp@head}%
+      \cs{@cftbsnum} 
+      \#1%
+      \cs{@cftasnum}%
+      \}%
+    }}
+  \begin{lcode}
+    \newlength\tmplen        % scratch length
+    \newlength\widestchapter % guess, they are zero by default
+    \renewcommand\chapternumberlinehook[1]{%
+      \settowidth\tmplen{\hbox{\cftchapterfont#1}}%
+      \ifdimgreater\tmplen\widestchapter{%
+        \global\widestchapter=\tmplen}{}}
+  \end{lcode}
+  We use an alternative syntax to make the \cs{widestchapter} global.
+
+  Handling \cmd{\section} and \cmd{\subsection} is slightly more
+  tricky, as they both use \cmd{numberline}. Instead we rely on the
+  local value of the magic macro \cmd{\cftwhatismyname}. 
+  \begin{lcode}
+    \newlength\widestsection
+    \newlength\widestsubsection
+    \renewcommand\numberlinehook[1]{%
+      % use a loop handler to loop over a list of possible
+      % types. \forcsvlist comes from etoolbox
+      \forcsvlist{\ToCHookListHandler{#1}}{section,subsection,subsubsection,%
+        paragraph,subparagraph,figure,table}}
+    % the actual handler.
+    \newcommand\ToCHookListHandler[2]{%
+      \edef\tmpstr{#2}%
+      \ifdefstrequal{\cftwhatismyname}{\tmpstr}{%
+        \settowidth\tmplen{\hbox{\csuse{cft\cftwhatismyname font}#1}}%
+        \ifcslength{widest#2}{% is this length defined?
+          \ifdimgreater\tmplen{\csuse{widest#2}}{%
+            \global\csuse{widest#2}=\tmplen}{}}{}}{}}
+  \end{lcode}
+  Even though the list mention more macros, we only use those we have
+  added corresponding lengths for.
+
+  Next we need to store the values at the end of the document
+  \begin{lcode}
+    \AtBeginDocument{\AtEndDocument{
+        \memstorevalue{widestchapter}{\the\widestchapter}
+        \memstorevalue{widestsection}{\the\widestsection}
+        \memstorevalue{widestsubsection}{\the\widestsubsection}
+      }}
+  \end{lcode}
+
+  Here is how to get the standard class setup for a three level
+  TOC. We also add a little extra padding to the boxes. Remember that
+  it may take a few compilations before the \toc{} settles down.
+  \begin{lcode}
+    \newlength\cftnumpad         % padding
+    \setlength\cftnumpad{0.5em}
+    \AtBeginDocument{
+      \cftsetindents{chapter}{0pt}{%
+        \RetrieveStoredLength{widestchapter}+\cftnumpad}
+      \cftsetindents{section}{%
+        \cftchapterindent+\cftchapternumwidth}{%
+        \RetrieveStoredLength{widestsection}+\cftnumpad}
+      \cftsetindents{subsection}{%
+        \cftsectionindent+\cftsectionnumwidth}{%
+        \RetrieveStoredLength{widestsubsection}+\cftnumpad}
+    }
+  \end{lcode}
 \end{sniplet}
 
 
+\begin{sniplet}[Using class tools to make a chapter ToC]
+  \label{snip:chaptertoc}
+
+  By using a few hooks, we will be able to create a simple chapter
+  toc. First a few notes:
+  \begin{enumerate}[(a)]
+    \setlength\itemsep{0.5em}
+  \item In this class, the TOC data can be reused, thus we can load
+    the TOC data as many times as we would like.
+  \item Data in the TOC is stored as arguments the \cs{contentsline}
+    macro, say (see also \fref{fig:tocloflotfiles} on
+    page~\pageref{fig:tocloflotfiles})
+\begin{verbatim}
+\contentsline{chapter}{\chapternumberline {1}Test}{3}
+\end{verbatim}
+   where the first argument determins which macro is used to process
+   the data. Each of these macros look at the value of the \Pcn{tocdepth}
+   counter to know whether to typeset or not. 
+ \item Using some hooks we can insert local changes to \Pcn{tocdepth}
+   in order to only typeset the sections from the current chapter.
+ \end{enumerate}
+ 
+The idea is to be able to add hooks at key points in the \toc{} data,
+and then use these hooks to enable and disable typesetting.
+
+We will need to add hooks just after a chapter line (like the one
+above), and we will need to be able to insert hooks just before items
+that mark the end of a chapter, that is the next \cmd{\chapter},
+\cmd{\part}, \cmd{\book}, plus a macro like \cmd{\appendixpage} which
+also write to the \toc{}.
 
 
 
 
+
+ 
+  First we define hooks that add hooks into the TOC. We use a counter
+  to make each start and end hook unique. We add \emph{end markers}
+  above the \toc{} entries for \cs{chapter}, \cs{part} and
+  \cs{book}.
+\begin{lcode}
+\newcounter{tocmarker}
+\renewcommand\mempreaddchaptertotochook{\cftinserthook{toc}{end-\thetocmarker}}
+\renewcommand\mempreaddparttotochook   {\cftinserthook{toc}{end-\thetocmarker}}
+\renewcommand\mempreaddbooktotochook   {\cftinserthook{toc}{end-\thetocmarker}}
+\renewcommand\mempreaddapppagetotochook{\cftinserthook{toc}{end-\thetocmarker}}
+% start marker
+\renewcommand\mempostaddchaptertotochook{%
+  \stepcounter{tocmarker}\cftinserthook{toc}{start-\thetocmarker}}
+\let\normalchangetocdepth\changetocdepth % for later
+\end{lcode}
+The hooks inserted into the TOC file, does nothing by default. You
+will notice that the line above will now look like:
+\begin{verbatim}
+\cftinsert {end-0}
+\contentsline{chapter}{\chapternumberline {1}Test}{3}
+\cftinsert {start-1}
+...
+\cftinsert {end-1}
+\contentsline{chapter}{\chapternumberline {2}Test}{5}
+\end{verbatim}
+Thus to get a chapter toc command we need to make sure that (1) all
+entries are disabled, (2) at \texttt{start-1} we reenable TOC entries,
+and (3) at \texttt{end-1} disable TOC entries again. Here is the rest
+of the code, explained via comments.
+\begin{lcode}
+\makeatletter
+\newcommand\chaptertoc{
+  % make changes local, remember counters a global
+  \begingroup
+  % store current value, to be restored later
+  \setcounter{@memmarkcntra}{\value{tocdepth}}
+  % when ever \settocdepth is used, it adds the new value to the 
+  % ToC data. This cause problems when we want to disable all
+  % entries. Luckily the data is added via a special macro, we we
+  % redefine it, remember we stored the original value earlier.
+  \let\changetocdepth\@gobble
+  % disable all entries (using our copy from above)
+  \normalchangetocdepth{-10}
+  % enable toc data within our block, we go as far as subsubsection
+  \cftinsertcode{start-\thetocmarker}{\normalchangetocdepth{3}}
+  % when the block is done, disable the remaining
+  \cftinsertcode{end-\thetocmarker}{\normalchangetocdepth{-10}}
+  % remove the spacing above the toc title
+  \let\tocheadstart\relax
+  % remove the toc title itself
+  \let\printtoctitle\@gobble
+  % remove space below title
+  \let\aftertoctitle\relax
+  % reformat TOC entries:
+  \setlength{\cftsectionindent}{0pt}
+  \setlength{\cftsubsectionindent}{\cftsectionnumwidth}
+  \setlength{\cftsubsubsectionindent}{\cftsubsectionindent}
+  \addtolength{\cftsubsubsectionindent}{\cftsubsectionnumwidth}
+  \renewcommand\cftsectionfont{\small}
+  \renewcommand\cftsectionpagefont{\small}
+  \renewcommand\cftsubsectionfont{\small}
+  \renewcommand\cftsubsectionpagefont{\small}
+  \renewcommand\cftsubsubsectionfont{\small}
+  \renewcommand\cftsubsubsectionpagefont{\small}
+  % include the actual ToC data
+  \tableofcontents*
+  \endgroup
+  % restore tocdepth
+  \setcounter{tocdepth}{\value{@memmarkcntra}}
+  % to indent or not after the chapter toc
+  \m@mindentafterchapter
+  % space between chapter toc and text
+  \par\bigskip
+  % handles indentation after the macro
+  \@afterheading}
+\makeatother
+\end{lcode}
+\end{sniplet}
+
+Note that if the \cmd{\chapterprecistoc} or \cmd{\chapterprecis} has
+been used then that data is also added to the \toc{} data, and we will
+need to locally disable it in the chapter \toc{}. This can be done by
+adding
+\begin{lcode}
+  \let\precistoctext\@gobble
+\end{lcode}
+to the \cmd{\chaptertoc} definition above, just make sure it is added
+before calling
+before \cmd{\tableofcontents*}.
+
+
+%%%%%
+%%  Appendix ToC
+%%%%
+
+
+\begin{sniplet}[An appendix ToC]
+  \label{snip:apptoc}
+  Here we assume a structure like
+\begin{verbatim}
+\tableofcontents*
+\chapter
+\chapter
+\chapter
+\appendix
+\appendixpage
+\appendixtableofcontents
+\chapter
+\chapter
+\chapter
+\end{verbatim}
+where the first \toc{} should just show until (and including) 
+\cmd{\appendixpage}, and \cmd{\appendixtableofcontents} should only
+list the appendices. 
+
+We also assume that no \cmd{\settocdepth}'s have been issued after
+\cmd{\appendixpage}.
+
+
+We only need a single hook after \cmd{\appendixpage}.
+\begin{lcode}
+\renewcommand\mempostaddapppagetotochook{\cftinserthook{toc}{BREAK}}
+\cftinsertcode{BREAK}{\changetocdepth{-10}}
+\let\normalchangetocdepth\changetocdepth     % needed for later
+\end{lcode}
+Then the definition of the actual appendix \toc{}:
+\begin{lcode}
+\makeatletter
+\newcommand\appendixtableofcontents{
+  \begingroup
+  \let\changetocdepth\@gobble
+  \normalchangetocdepth{-10}
+  \cftinsertcode{BREAK}{\normalchangetocdepth{3}}
+  \renewcommand\contentsname{Appendices overview}
+  \tableofcontents*
+  \endgroup
+}
+\makeatother
+\end{lcode}
+
+
+\end{sniplet}
+
+
+
+
+\cftinserthook{toc}{end-sniplets}
+
 %#% extend
 %#% extstart include pictures.tex
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-09-13 11:11:29 +0200 (Mon, 13 Sep 2010) $}
-{$LastChangedRevision: 273 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -32619,8 +33717,8 @@ exactly how many blobs to use for the curve.
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-05-13 17:10:00 +0200 (Thu, 13 May 2010) $}
-{$LastChangedRevision: 210 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 
@@ -33989,8 +35087,8 @@ but in this case the best place to look for further information is in the
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2010-05-13 17:10:00 +0200 (Thu, 13 May 2010) $}
-{$LastChangedRevision: 210 $}
+{$LastChangedDate: 2013-04-24 17:14:15 +0200 (Wed, 24 Apr 2013) $}
+{$LastChangedRevision: 442 $}
 {$LastChangedBy: daleif $}
 
 
@@ -36449,6 +37547,64 @@ recognized.
 %%\index{memoir class!warning|)}
 \Iclasssub{memoir}{warning|)}
 
+%#% extend
+%#% extstart include comments.tex
+
+\svnidlong
+{$Ignore: $}
+{$LastChangedDate: 2013-05-15 17:07:24 +0200 (Wed, 15 May 2013) $}
+{$LastChangedRevision: 463 $}
+{$LastChangedBy: daleif $}
+
+\chapter{Comments}
+\label{cha:comments}
+
+\section{Algorithms}
+\label{sec:algorithms}
+
+Over time we may use this section to explain, or list some of the
+algorithms for some of the macros in the class. The information may be
+useful to some.
+
+\subsection{Autoadjusting \cs{marginparwidth}}
+\label{sec:auto-csmarg}
+
+This algorithm is used within \cmd{\fixthelayout} unless the user have
+used \cmd{\setmarginnotes}.
+
+\noindent
+\begin{framed}
+  \vskip-2\baselineskip
+  \begin{small}
+\begin{verbatim}
+if twocolumn then
+  marginparwidth = min{inner margin,outer margin}
+else
+  if twoside then
+    if marginpar always left or always right then
+      marginparwidth = min{inner margin,outer margin}
+    else if marginpar in outer margin then
+      marginparwidth = outer margin
+    else if marginpar in inner margin then
+      marginparmargin = inner margin
+    end if
+  else
+    if marginpar in left margin then
+      marginparwidth = inner margin
+    else
+      marginparwidth = outer margin
+    end if
+  end if
+end if
+marginparwidth = marginparwidth - 2marginparsep
+if marginparwidth < 1pt then
+  marginparwidth = 1pt
+end if
+\end{verbatim}
+  \end{small}
+\end{framed}
+
+
 %#% extend
 
 %#% extstart input backend.tex
@@ -36684,6 +37840,15 @@ access CTAN is available at \url{http://www.tug.org}.
   \newblock (Available from CTAN via
              \CTANurl{/macros/latex/required/tools/})
 
+\bibitem[Car04]{textcase} % casing intentional
+ David Carlisle.
+\newblock \emph{The \Lpack{textcase} package}.
+\newblock October, 2004.
+\newblock (Available from CTAN in 
+      \texttt{/macros/latex/contrib/textcase})
+
+
+
 %%% keep
 \bibitem[Car05]{COLOR}
   David Carlisle.
@@ -37861,5 +39026,5 @@ Computer Modern family.
 %%% mode: latex
 %%% TeX-master: t
 %%% TeX-source-specials-mode: t
-%%% TeX-PDF-mode: nil
+%%% TeX-PDF-mode: t
 %%% End: 
-- 
cgit v1.2.3

