<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%\usepackage{hhmuf,hhflxbox}         % for presentation
%\usepackage{hhcount}                % for presentation
%\usepackage{amssymb,epic,curves}    % for illustrations
%\usepackage{verbatim}               % for verbatim displaying of examples
%\usepackage{xspace}                 % for ease of typing

\makeatletter

% The following has been copied from my personal tools style file hhutils.sty
% (NB: This is _not_ the same file as the public style file hhutils0.sty!)

\def\={\verb=}
\def\&lt;#1&gt;{\macroname{#1}}
\def\:{\linebreak[1]}

% The following input definitions used for examples:

% \input hhst11a.tex and hhst11b.tex are input where needed
% \input hhst12a.tex up to hhst12e.tex are input where needed
\input hhst22a.tex
% hhst22b.tex, hhst22c.tex and hhst22d.tex are input where they are needed
\input hhst22e.tex
% hhst23a.tex is input where needed
\input hhst24a.tex
% hhst24b.tex is input where needed
\input hhst32a.tex
\input hhst32b.tex
\input hhst32c.tex

\def\dashbox(#1,#2)(#3,#4){
  \dashline{40}(#1,#2)(#1,#4)\dashline{40}(#1,#4)(#3,#4)
  \dashline{40}(#1,#2)(#3,#2)\dashline{40}(#3,#2)(#3,#4)}
\def\hmeasure(#1,#2)(#3,#4){
  \put(#1,#2){\makebox(0,0)[l]{$\blacktriangleleft$}}
  \put(#3,#4){\makebox(0,0)[r]{$\blacktriangleright$}}
  \drawline(#1,#2)(#3,#4)}
\def\vmeasure(#1,#2)(#3,#4){
  \put(#1,#2){\makebox(0,0)[b]{$\blacktriangledown$}}
  \put(#3,#4){\makebox(0,0)[t]{$\blacktriangle$}}
  \drawline(#1,#2)(#3,#4)}

\def\fancycolumn#1#2#3#4#5#6#7#8{%
  \sbox#1{%
    \sfrcalclength{#2}{#3}{#4}%
    \def\\##1;##2;{\vrule height\@tempdimq width ##1pt\kern ##2pt}%
    \\0.05;0.15;\\0.60;0.44;\\1.11;0.65;\\1.45;0.77;\\1.57;0.77;%
    \\1.45;0.65;\\1.11;0.44;\\0.60;0.15;\\0.05;0;}%
  \sfrsetoffsets{15pt}{#3}{#4}#5#6#7#8}%
\def\fancytympan#1#2#3#4#5#6#7#8{%
  \sbox#1{%
    \sfrcalclength{#2}{#3}{#4}%
    \unitlength\@tempdimq
    \vbox{\hsize\@tempdimq\offinterlineskip
      \hbox{\begin{picture}(1,0.1)
        \thicklines
        \put(0,0){\line(1,0){1}}
        \put(0,0){\line(5,1){0.5}}
        \put(0.5,0.1){\line(5,-1){0.5}}
        \thinlines
        \put(0.5,0.05){\circle*{0.072}}
      \end{picture}}
      \hbox{\vrule width\@tempdimq height 2pt}}}%
  \sfrsetoffsets{\ht#1}{#3}{#4}#5#6#7#8}%

% THE FOLLOWING DEFINITION IS ALSO INCLUDED VERBATIM AS AN EXAMPLE!
\newenvironment{templeboxed}{%
  \begin{sframed}%
    [1]\fancycolumn[2]\fancytympan[1]\fancycolumn[-]\-
    \begin{separboxed}{3pt}
      \begin{broadboxed}{30pt}
}{%
      \end{broadboxed}%
    \end{separboxed}%
  \end{sframed}%
}

\makeatother



\title[\hhmuf, \hhflxbox\ and \hhcount packages]{HH Gets Carried Away: the \hhmuf, \hhflxbox\ and \hhcount packages}
\author[Herman Haverkort]{Herman Haverkort\\\emph{Email}: \texttt{herman@fgbbs.iaf.nl}}
\begin{Article}

\begin{abstract}
\end{abstract}

In this article I present some of the features of three packages,
\hhmuf, \hhflbox\ and \hhcount, that I have written recently. However,
this presentation is far from complete.  A more detailed manual and
the packages themselves can be obtained from the author at {\sc fgbbs}
(tel. +31 85 21 70 41) or CTAN
(\path|macros/latex/contrib/supported/hh|. \hhmuf\ offers `multinotes'
---special cheery footnotes to be used in special situations,
including so-called `forbidden environments'.  \hhflxbox's provides
self-scaling frames: encircling macros are provided but you can define
whatever features you like by means of the macros provided. Finally
\hhcount is presented: macros to handle simple and composite counters
in a fancy way.  \scheiding

\section{Some Features of the \hhmuf Package}

\subsection{Reusable Footnotes and Recycled Markers}

Suppose you have to typeset some tables containing many entries which are
amplified by footnotes outside the table. Several entries, possibly but not
necessarily in the same table, refer to the same footnote.
If references to the same footnote appear in different tables on different
pages, the footnote text should be set on all pages involved,
while the footnote marker should be the same each time the footnote is
set. The first to avoid unnecessary turning over, the second to avoid
confusion.

Typesetting such tables is not very easy in basic \LaTeX. A relatively easy
way to do the job is probably as follows:\begin{enumerate}
\item first get markers for all the footnotes and define macros to set
      the footnote markers;
\item then define a macro \&lt;tablenotes&gt; which typesets the footnotes;
\item then typeset the tables, using the macros defined in the steps
      mentioned above;
\end{enumerate}
Here is some example input:

\verbatiminput{hhst11a.tex}
And the resulting output:

\input hhst11a.tex

This article is too short to demonstrate it, but when typesetting multiple
tables this way problems are likely to arise. If you typeset
another table on the same page, calling \&lt;tablenotes&gt; again will cause the
footnote texts to be typeset twice on the same page. If you typeset
another table on another page, {\em all} table footnote texts will be
typeset on that page, even if the table which is on that page does
not refer to all of them.

The \hhmuf package solves these problems, although the solution of
the twice-on-the-same-page problem may be buggy in rare contexts.
If you use the \hhmuf package you can replace the previous listing by
the following:

\verbatiminput{hhst11b.tex}
And get this result:

\input hhst11b.tex

You will note that \=\mufhire= {\it label\/}\=:{={\it footnote text\/}\=}=
is used to define footnotes. Its opponent is, of course,
\=\muffire= {\it label\/}\=:=, which undefines footnotes, while
\=\muf= {\it label\/}\=:{}= is used to set previously defined
footnotes. As shown in the example, \=\muf=\:\=:{={\it footnote text\/}\=}=
can be used to set incidental footnotes. \=\muf=\:\=:{={\it footnote text\/}\=}=
actually acts as an abbreviation for hiring, typesetting and firing
an incidental note. Thus it is well-suited for setting normal in-text
footnotes.

\hhmuf does not use common footnote markers. Most common sets of
symbols have a well-defined order which makes them ill-suited for
\hhmuf since the \hhmuf macros do not respect that order.
While defining footnotes, markers are assigned in turn. Thus there is
no need to restart footnote numbering every chapter or every page,
because you never run out of markers, unless you hire a lot of them
without ever firing any. Restarting footnote numbering does
not make sense anyway because there is no such
thing as a {\em first} marker.

The set of markers used by \hhmuf can be fully specified by the user,
either by selecting one of the predefined sets or by compiling a new one.
The predefined sets are the following:
\begin{center}
\begin{tabular}{|l|l|}\hline
  set name &amp; markers included\\
\hline\hline
  black    &amp; $\bullet$\,$\blacklozenge$\,$\blacktriangledown$\,$\clubsuit
              $\,$\blacksquare$\,$\blacktriangle$\,$\blacktriangleleft$\,$\spadesuit$\\
\hline
  circlox  &amp; $\oslash$\,$\odot$\,$\boxtimes$\,$\oplus$\,$\square$\,$\circledast$\,$\boxminus
              $\,$\otimes$\,$\circledcirc$\,$\boxdot$\,$\circleddash$\,$\boxplus$\\
\hline
  fuss     &amp; $\ast$\,$\diamondsuit$\,$\circledast$\,$\divideontimes$\,$\sharp
              $\,$\star$\,$\clubsuit$\,$\aleph$\,$\infty$\,$\circlearrowleft$\\
\hline
  geometry &amp; $\blacklozenge$\,$\square$\,$\blacktriangledown$\,$\vartriangle$\,$\blacksquare
              $\,$\triangleleft$\,$\blacktriangle$\,$\lozenge$\,$\blacktriangleleft$\,$\triangledown$\\
\hline
  misc     &amp; $\spadesuit$\,$\triangle$\,$\ominus$\,$\clubsuit$\,$\times
              $\,$\diamondsuit$\,$\otimes$\,$\wr$\,$\odot$\,$\vee
              $\,$\oplus$\,$\infty$\,$\star$\,$\oslash$\,$+$\,$\triangleleft$\,$\top$\,$\bullet$\,$\nabla$\\
\hline
  music    &amp; $\sharp$\,$\flat$\,$\natural$\\
\hline
  strokes  &amp; $\top$\,$\times$\,$\curlyvee$\,$+$\,$\veebar$\,$\nshortparallel$\,$\barwedge$\,$\wr$\\
\hline
\end{tabular}
\end{center}
For details see the documentation in the package file.

\subsection{The Forbidden Environment Problem}

Suppose I typed several pieces of text that have to be typeset all
in the same special way. For that purpose I (re)defined an environment
\envirname{specialtext}:

\verbatiminput{hhst12a.tex}
\newenvironment{specialtext}{}{}\input hhst12a.tex
\input hhst12b.tex
Then I defined a package option in the package I used to typeset
my document. If I specified that option when loading the package,
then \envirname{specialtext} would be defined as follows:

\verbatiminput{hhst12c.tex}
\input hhst12c.tex
Now problems arise. I typeset the same text again:
\input hhst12b.tex
The paragraph is shown framed all right, but something went wrong with
the footnote. With the new definition of \envirname{specialtext},
the footnote suddenly appears in a `forbidden' environment and therefore it
actually disappears. Although the in-text marker is typeset, there is
no note at the foot of the page.

While writing this article I discovered Kresten Krab Thorup's style
file {\tt ftn.sty}\rlap{,}\footnote{Available at {\sc ctan} as
{\tt macros/latex209/contrib/misc/ftn.sty}}
which attempts to solve this problem but does so
quite buggily. Footnotes disappear when forbidden environments are nested.
When multiple footnotes are type-set in forbidden environments, footnotes
are repeated and their numbering is wrong. A modified version of
{\tt ftn.sty} exists (by Zdenek Wagner), which solves the repetition problem
correctly, and suppresses incorrect numbers by omitting them: at least that
is what I got. I tried to contact Krab Thorup about making
{\tt ftn.sty} more robust, but have not so far succeeded.
Nevertheless Krab Thorup's style file contained some very useful ideas,
which I combined with my own ideas to construct a set of macros which
seem to be quite robust. I will now show you the result: how easy it is
to use \hhmuf's footnotes in forbidden environments.

The kind of unpleasant surprises presented above is easy to prevent when
typesetting footnotes with \&lt;muf&gt; instead of \&lt;footnote&gt;,
as in:

\verbatiminput{hhst12d.tex}
When using the first definition of \envirname{specialtext}, this
yields:
\input hhst12a.tex
\input hhst12d.tex
In the following example the second definition of \envirname{specialtext}
is used, but I added one line of code to `protect' the environment:

\verbatiminput{hhst12e.tex}

And here is the result:
\input hhst12e.tex
\input hhst12d.tex

Without changing the text in my document, I could redefine
\envirname{specialtext} to use forbidden environments in such a way
that my footnotes did not disappear. \&lt;mufoff&gt; did the job.

\subsection{Shortcomings: \envirname{minipage} Fans Beware!}
\hhmuf does not support \envirname{minipage}s yet. If \&lt;muf&gt; is used
in a \envirname{minipage} environment, the footnote will be placed
at the foot of the `master page' instead of under the \envirname{minipage}!

\scheiding

\section{The \hhflxbox Package}
\hhflxbox contains a number of boxing macros. The kernel consists of
\&lt;iframe&gt;, which boxes things and sets self-scaling frames around, and
\&lt;sframe&gt;, which sets more complex self-scaling and -stretching frames.
Besides \hhflxbox provides the encircling macros \&lt;ringbox&gt;, \&lt;bellybox&gt;
and \&lt;outringbox&gt; (which use \&lt;iframe&gt;), the macros \&lt;sepbox&gt; and
\&lt;separbox&gt;, which set empty space around boxes, and \&lt;broadbox&gt;, which
boxes its argument in a \&lt;vbox&gt; of which the width is the line width
minus some specified value.

\subsection{\&lt;sepbox&gt; and \&lt;separbox&gt;}
For the introduction of \&lt;sepbox&gt; and \&lt;separbox&gt; it is convenient to
look at \&lt;bellybox&gt; first. \&lt;bellybox&gt; is one of the
\hhflxbox macros which can be used to encircle things, for example
\bellybox:{3}, which is set with: \=\bellybox=\:\=:{3}=.

You probably notice that the circle around the digit is somewhat
tight. This problem can be solved by putting a \&lt;separbox&gt; around the
digit, as in \=\bellybox=\:\=:{\separbox=\:\={1pt}{3}}=, which
yields: \bellybox:{\separbox{1pt}{3}}.
Actually \=\separbox=\:\={={\it dimension\/}\=}{={\it stuff\/}\=}= puts
{\it dimension\/} wide empty space around {\it stuff\/} on all sides.

A more general form is:\\
\=\sepbox=\:\=(={\it leftspace\/}\=,={\it topspace\/}%
\=,={\it rightspace\/}\=,={\it bottomspace\/}\=){={\it stuff\/}\=}=
which adds empty spaces of the specified widths to the sides of the box
containing {\it stuff\/}.

\subsection{\&lt;iframe&gt;: Isomorphous Frames}
\&lt;iframe&gt; is only a frame drawing {\em tool}: it does not draw frames
itself but it can take care of the proper positioning and scaling of frames
drawn by other macros. To explain the functioning of \&lt;iframe&gt; it is
probably best to give an example of the development of a framing macro
using \&lt;iframe&gt;.

Suppose we want to set self-scaling frames which have the following shape:
\begin{center}\unitlength.01pt\sillyshape\end{center}
then we could imagine a box-shaped area in the frame which will contain
the frame's contents (the inner dashed box in the figure below). Also
we could imagine a box surrounding the frame (the outer dashed box in
the figure).
\begin{center}\unitlength.05pt\noindent
  \hbox{%
    \rlap{\sillyshape}%
    \begin{picture}(2000,2000)
      \thinlines
      \dashbox(0,0)(2000,2000)\dashbox(134,500)(1866,1500)
      \hmeasure(134,500)(0,500)\put(67,450){\makebox(0,0)[t]{$x$}}
      \vmeasure(134,500)(134,0)\put(184,150){\makebox(0,0)[l]{$y$}}
      \hmeasure(134,1250)(1866,1250)\put(1000,1300){\makebox(0,0)[b]{$w$}}
      \vmeasure(584,500)(584,1500)\put(634,800){\makebox(0,0)[l]{$h=1000$}}
    \end{picture}}%
\end{center}

Since \&lt;iframe&gt; expects the inner box height to be $1000$ times the
\&lt;unitlength&gt;, all dimensions have to be chosen so that the inner box
height equals $1000$ indeed. Then \&lt;iframe&gt; can scale the frame by
setting the \&lt;unitlength&gt;. Furthermore \&lt;iframe&gt; expects the lower left
corner of the outer box to have coordinates $(0,0)$. Taking these
expectations in account we can design a macro which draws the frame:

\verbatiminput{hhst22a.tex}

\noindent (\&lt;arc&gt; is defined in the \packagename{curves} package by
I.~L.~Maclaine-Cross.)  Now we can define a silly shape framing macro
by defining \&lt;sillyframe&gt;
as: \=\iframe=\:\=\sillyshape=\:\=(=$x$\=,=$y$\=){=$w$\=}{0pt}\ifrch=\:%
\=\ifrcv=\:\=:{#1}=. Actually we will set \=#1= in a
\=\sepbox=\:\=(0pt,2pt,0pt,2pt){#1}= to prevent the frame from touching
its contents. In the above example we have $x=134$, $y=500$ and $w=1732$,
so we write:

\verbatiminput{hhst22b.tex}

\input{hhst22b.tex}

Note that I do not claim this kind of silly frame to be good-looking:
it is just an example.

The dimension \=0pt= in the example above determines the minimal height
of the silly frame's inner box. Sometimes it is necessary to define it
because \LaTeX's picture environment suppresses small line segments.

The macro \&lt;ifrch&gt; determines what should be done if the frame's
contents width/height ratio is too small. By specifying \&lt;ifrch&gt;
we instruct \&lt;iframe&gt; to center the contents. Instead of
\&lt;ifrch&gt; we could have specified \&lt;ifrl&gt; or \&lt;ifrr&gt; to
have the contents flush left or right.

The macro \&lt;ifrcv&gt; determines what should be done if the frame's
contents height/width ratio is too small. \&lt;ifrcv&gt; yields
vertical centering, while \&lt;ifrt&gt; and \&lt;ifrb&gt; yield top and bottom
flushing.

If we put frames around for example page numbers, then
the self-scaling properties of isomorphous frames may have an unpleasant
result: numbers of the same type, like
page number \sillyframe{\oldstylenums{21}} and
page number \sillyframe{\oldstylenums{25}}, might get differently sized
frames because of their different natural sizes. This can be solved by
redefining \&lt;sillyframe&gt; to specify a {\em unit name}, since all things
typeset with the same unit name get equally sized frames. The unit name,
for example \=pagenr=, should be placed between the vertical alignment
specification and the colon, like in:

\verbatiminput{hhst22c.tex}
which yields (after compiling our document twice):

\input hhst22c.tex

However, this is not fully satisfactory yet: now the frames are equally
sized but the first frame is positioned higher than the second.
This is no bug, it is a feature. No really, it is! It is, however, a
sometimes unwanted feature. The solution is using \&lt;lcenter&gt; to center
the frames on their line, like in:

\verbatiminput{hhst22d.tex}

\noindent resulting in:

\input hhst22d.tex

\leavevmode\jarframe{As} a final example of isomorphous frames, consider
the following framing macro.
Note that the inner box height is $1000$ again, as expected
by \&lt;iframe&gt;.
\begin{center}\unitlength.05pt\noindent
  \hbox{%
    \rlap{\jarshape}%
    \begin{picture}(1800,1500)
      \thinlines
      \dashbox(0,0)(1800,1500)\dashbox(300,180)(1500,1180)
      \hmeasure(300,180)(0,180)\put(150,280){\makebox(0,0)[br]{$x=300$}}
      \vmeasure(300,180)(300,0)\put(400,60){\makebox(0,0)[l]{$y=180$}}
      \hmeasure(300,930)(1500,930)\put(1050,980){\makebox(0,0)[b]{$w=1200$}}
      \vmeasure(550,180)(550,1180)\put(600,500){\makebox(0,0)[l]{$h=1000$}}
    \end{picture}}%
\end{center}

\verbatiminput{hhst22e.tex}

\subsection{\&lt;ringbox&gt;, \&lt;bellybox&gt; and \&lt;outringbox&gt;: Encircling}

\=\ringbox{={\it optional unit name\/}\=}:{={\it stuff\/}\=}= sets
a circle around {\it stuff\/}. The specification of a unit name is optional;
its use is explained above.

\&lt;outringbox&gt; is very much like \&lt;ringbox&gt;,
but the following example demonstrates their difference:

\verbatiminput{hhst23a.tex}
yields:

\input hhst23a.tex

If \&lt;ringbox&gt; is used, the circle contributes to the width, height and
depth of the result. If \&lt;outringbox&gt; is used, the circle does not
contribute any width, height or depth, so that the text is typeset as
if the circle were not present and the circle were added after typesetting
the text.

The result of \&lt;bellybox&gt; is a circle which contributes a bit to the
dimensions of the encircled result but also sticks out a bit
(by 10 percent of its radius to be sort of exact). So \&lt;bellybox&gt; is
an intermediate form of \&lt;ringbox&gt; and \&lt;outringbox&gt;.

\subsection{\&lt;sframe&gt;: Stretchable Frames}

Putting \&lt;sframe&gt; to good use is a rather complex task. \&lt;sframe&gt;
assembles user-defined frame components which actually are macros which
set the values of a box and several dimension registers. Therefore I
decided to give only an example of what can be achieved in this article;
for explanation see the manual and demo files available at {\sc fgbbs}.

If one has defined suitable macros \&lt;fancycolumn&gt; and \&lt;fancytympan&gt;, one
can define:

\verbatiminput{hhst24a.tex}

\noindent  which should be read as: after 3pt wide empty space is set
around \=#1=, first add columns to the left and the right, second put
a tympan on top of the result, and never put anything at the foot.
Then typing this:

\verbatiminput{hhst24b.tex}
will yield:

\leavevmode\input hhst24b.tex

\subsection{\&lt;broadbox&gt; for Setting Line Wide Frames}

\noindent
\begin{templeboxed}
\&lt;broadbox&gt; can be useful to set frames that fill the line. Its use is best
explained through an example. Suppose we want to set a paragraph of text
in a line wide temple box. Then the lines will be filled by (from left to
right): a column, empty space added by \&lt;separbox&gt;, text, empty space and
a column. In other words: the whole line is available for setting text,
except for the space needed by the columns and the empty space set by
\&lt;separbox&gt;. The columns are 12pt each while \&lt;separbox&gt; adds 3pt wide empty
space to the left and the right: that makes a total of 30pt. So we write:
\=\templebox=\:\={\broadbox=\:\={30pt}{\broadbox= \=can= \=be= \ldots
\=\textit=\:\={dimension}.}}=, which yields a paragraph typeset like this.
So \=\broadbox=\:\={={\it dimension\/}\=}{={\it stuff\/}\=}= sets {\it stuff\/}
in a \&lt;vbox&gt; which has width line width minus \textit{dimension}.
\end{templeboxed}

\subsection{Environment Versions}

Some of the macros defined in \hhflxbox are available as \LaTeX\
environments. For example: instead of \=\broadbox=\:\={30pt}{={\it
text to be boxed\/}\=}= one could also use \=\begin=\:\={broadboxed}{30pt}=
{\it text to be boxed\/}\=\end=\:\={broadboxed}=. Similarly one
could use the environments \envirname{sepboxed}, \envirname{separboxed}
and \envirname{sframed} instead of the macros \&lt;sepbox&gt;, \&lt;separbox&gt;
and \&lt;sframe&gt;.

Actually I have to confess something: I lied to you about the
typesetting of the section about \&lt;broadbox&gt;. I did it with:

\begin{verbatim}
\newenvironment{templeboxed}{%
  \begin{sframed}%
    [1]\fancycolumn [2]\fancytympan
    [1]\fancycolumn [-]\-
    \begin{separboxed}{3pt}
      \begin{broadboxed}{30pt}
}{%
      \end{broadboxed}%
    \end{separboxed}%
  \end{sframed}%
}

\begin{templeboxed}%
  \broadbox can be useful to set frames that
       :        :        :        :        :
  width line width minus dimension.
\end{templeboxed}
\end{verbatim}

I hope you will forgive me my cheating. I mean, without using
these environments, typesetting verbatim stuff is so troublesome\ldots

\scheiding

\section{Some Features of the \hhcount Package}

\subsection{Simple Number Formatting}

Let us start by summarizing the simple
number formatting macros which are provided by \hhcount:
\begin{center}
\begin{tabular}{|l|c||c|}\hline
  example input         &amp; \vbox{\hbox{corresp.\strut}%
                            \hbox{output\strut}} &amp;
                                               \vbox{\hbox{other example\strut}%
                                                     \hbox{output\strut}} \\
\hline\hline
  \=\fctabdigit{2}=      &amp; \fctabdigit{2}        &amp; \fctabdigit{29}       \\
\hline
  \=\fcolddigit{2}=      &amp; \fcolddigit{2}        &amp; \fcolddigit{29}       \\
\hline
  \=\fcloweralpha{2}=    &amp; \fcloweralpha{2}      &amp; \fcloweralpha{29}     \\
\hline
  \=\fcbigalpha{2}=      &amp; \fcbigalpha{2}        &amp; \fcbigalpha{29}       \\
\hline
  \=\fcsmallalpha{2}=    &amp; \fcsmallalpha{2}      &amp; \fcsmallalpha{29}     \\
\hline
  \=\fclowerroman{2}=    &amp; \fclowerroman{2}      &amp; \fclowerroman{29}     \\
\hline
  \=\fcbigroman{2}=      &amp; \fcbigroman{2}        &amp; \fcbigroman{29}       \\
\hline
  \=\fcsmallroman{2}=    &amp; \fcsmallroman{2}      &amp; \fcsmallroman{29}     \\
\hline
  \=\fcbigromanlined{2}= &amp; \fcbigromanlined{2}   &amp; \fcbigromanlined{29}  \\
\hline
  \=\fcsmallromanlined{2}= &amp; \fcsmallromanlined{2} &amp; \fcsmallromanlined{29} \\
\hline
  \=\fcbigdice{2}=       &amp; \fcbigdice{2}         &amp; \fcbigdice{29}        \\
\hline
  \=\fcsmalldice{2}=     &amp; \fcsmalldice{2}       &amp; \fcsmalldice{29}      \\
\hline
  \=\fcbigscore{2}=      &amp; \fcbigscore{2}        &amp; \fcbigscore{29}       \\
\hline
  \=\fcsmallscore{2}=    &amp; \fcsmallscore{2}      &amp; \fcsmallscore{29}     \\
\hline
  \=\fcfnsymbol{2}=      &amp; \fcfnsymbol{2}        &amp;                       \\
\hline
\end{tabular}
\end{center}

The next step in complexity are number formatting macros which give
context-dependent output. This is implemented by using the {\it context
switches} \=\if@fcoldstyle= and \=\if@fcsmall=, which are set by
context switching macros like \&lt;fcinheading&gt; and \&lt;fcintext&gt;. We say that
a context switching macro is active if it was the last one to affect
the context switches.
\begin{center}
\begin{tabular}{|l|c|c|}\hline
  example input         &amp; \vbox{\hbox{output when\strut}%
                            \hbox{\&lt;fcinheading&gt;\strut}%
                            \hbox{is active\strut}}
                                              &amp; \vbox{\hbox{output when\strut}%
                                                    \hbox{\&lt;fcintext&gt;\strut}%
                                                    \hbox{is active\strut}}  \\
\hline\hline
  \=\fcdigit{14}=      &amp; {\fcinheading\fcdigit{14}} &amp; {\fcintext\fcdigit{14}} \\
\hline
  \=\fcalpha{14}=      &amp; {\fcinheading\fcalpha{14}} &amp; {\fcintext\fcalpha{14}} \\
\hline
  \=\fcroman{14}=      &amp; {\fcinheading\fcroman{14}} &amp; {\fcintext\fcroman{14}} \\
\hline
  \=\fcromanlined{14}= &amp; {\fcinheading\fcromanlined{14}}
                                              &amp; {\fcintext\fcromanlined{14}} \\
\hline
  \=\fcdice{14}=       &amp; {\fcinheading\fcdice{14}}  &amp; {\fcintext\fcdice{14}}  \\
\hline
  \=\fcscore{14}=      &amp; {\fcinheading\fcscore{14}} &amp; {\fcintext\fcscore{14}} \\
\hline
\end{tabular}
\end{center}

By default \&lt;fcinheading&gt; is active; \&lt;fcintext&gt; is active when using
\&lt;ref&gt; or \&lt;pageref&gt; (those two macros are redefined by \hhcount).

\subsection{How to Define Composite Counters}

I will now try to give an impression of the way in which composite
counters can be defined using \hhcount. However, this is \emph{not} a manual.
After reading the following paragraphs you may be able to hack a
composite counter together yourself, by imitating what is done below
and experimenting with some small modifications of your own. If you
want to be taught how to use \hhcount efficiently and effectively, then
you should read the manual.

Suppose we want to set up a three-level section numbering system for
some sub-document in another document, for example the rules of a club
embedded in some booklet about that club.
The section numbers should be composed from the values of three
\hbox{(sub-)}counters: {\tt ruleschapter},
{\tt rulessection} and {\tt rulesparagraph}. Chapter numbers
should be represented by capital alphabetic characters;
elementary section and paragraph numbers by arabic digits.
What should be done?

First we select a {\it series identifier} for our composite counter.
Series identifiers are natural numbers which are assigned to
composite counters. Each composite counter should be assigned a unique
identifier. Because identifiers {\tt 1} to {\tt 8} and {\tt 12}
are reserved for common purposes we select {\tt 9} for our rules section
numbers.

Then we define a macro which expands to the series identifier:

\verbatiminput{hhst32a.tex}

Next we specify how the three sub-counters are to be combined:

\verbatiminput{hhst32b.tex}

And finally we define how the counter is to be formatted:

\verbatiminput{hhst32c.tex}

If you want to understand the definition above, read the manual.

\subsection{The Result}

Now the composite counter can be accessed by the macros
\&lt;theruleschapter&gt;, \&lt;therulessection&gt; and \&lt;therulesparagraph&gt;,
which give results like: ``\fancycounter9-1-0-0-!'',
``\fancycounter9-1-2-0-!'' and ``\fancycounter9-1-2-3-!''.
The macros \=\stepcounter=\:\={ruleschapter}=,
\=\stepcounter=\:\={rulessection}= and
\=\stepcounter=\:\={rulesparagraph}= can be used to step the counter.

When \&lt;fcinheading&gt; is active, rules paragraph numbers will be set like
``{\fcinheading\fancycounter9-1-2-3-!}'', but when \&lt;fcintext&gt; is active,
the same number will be set like ``{\fcintext\fancycounter9-1-2-3-!}''.

More complex distinctions in representation of counters are possible.
\hhcount provides a set of macros which can be used in the last argument
of \&lt;setcounterformat&gt;. Those macros enable definition of counters
which are set like ``A2.3'' in headings and like ``section {\sc a}\02.,
par. \03.'' in text etc. For details see the manual.

\subsection{\hhcount and \texttt{makeindex}}

Composite section numbers like ``A2.3'' cannot be handled by the
{\tt makeindex} program. Besides, {\tt makeindex} has problems
with sorting alphabetic numbers since it cannot determine whether
or not they are roman numbers. \hhcount provides a way to get around
these problems.

All composite numbers defined by \hhcount constructs
are internally represented by a sequence of natural numbers, separated
by hyphens and embedded in a macro call. A typical example is
\=\fancycounter= \=9-1-2-3-!=. The first number represents the
series identifier (\=9= in the example), while the following
numbers represent the values of the relevant sub-counters.

\hhcount provides macros \&lt;initfancycounters&gt;, \&lt;indextolabels&gt; and
\&lt;indextopages&gt;. The first redefines the section and page numbering
systems to use \hhcount's composite counters. \&lt;indextolabels&gt; sort of
redefines \&lt;index&gt; to use the redefined section numbers and strip the
\&lt;fancycounter&gt; and the \=-!= off the composite counter representation.
\&lt;indextopages&gt; does the similar thing for page numbers.
In both cases the result is a sequence of natural numbers,
separated by hyphens, which can be handled perfectly well by
{\tt makeindex}.
By embodying the appropriate definitions in your index style
(\hbox{\tt .ist}) file {\tt makeindex} will undo the stripping after
sorting the page or section numbers, so that your index entries will
still be typeset as defined by means of \hhcount macros. Thus section
numbers like ``A2.3'' can be used for references in the index.
Inserting equation, table and figure numbers in the index is just as
easy. It is
even possible to have different kind of composite numbers in the
same index, for example page as well as section numbers, because
the series identifiers are not stripped off so that it remains possible
to determine the proper series and formatting of each composite number.
For details see the manual.

\subsection{Bugs and Deficiencies}

Class files tend to make the \TeX\ compiler show on your terminal
which chapter of your book or report is being processed. Error messages
often contain the page number. When using \hhcount
there is a chance that the chapter and page numbers shown on your
terminal look weird: you will be shown the internal representation
of your counter (\=\fancycounter= \=9-1-0-0-!= for example). This is
caused by an incorrect timing of macro expansion: in this case
\&lt;fancycounter&gt; is expanded too late (that is to say, not at all).

Late expansion with \hhcount is typically a problem with
error and other messages: I would be highly surprised if someone
discovers something like \=\fancycounter= \=9-1-0-0-!= outside
verbatim environments in a typeset document. However, when compiling your
document you might run into early expansion, which causes severe errors.
With the latest version of \hhcount this problem does not seem to
emerge in `usual' contexts; however I am not sure.

Front matter, appendix and back matter peculiarities (with respect
to page and section numbering) are not automatically supported
by \hhcount. Class
files are too different in that respect. If \hhcount is to be used
to handle the section and page numbering in documents containing
front matter and appendices, it would probably be best to incorporate
\hhcount in the class file, instead of loading it as an additional
package.

\subsection{Gamesters Page Numbers}

The following redefines the {\tt page} counter so that page numbers
will be set as dice (I designed this for a gamesters society):

\begin{verbatim}
\def\fcpageseries{12}
\combinecounters\fcpageseries{\\{page}}
\setcounterformat\fcpageseries{#1}{%
  \fcorfinally
  \fcformat{#1}\fcdice
  \fcordespair}
\end{verbatim}

I could not resist giving you this as an final example.

\end{Article}


</pre></body></html>