\documentclass[a4paper]{article}
\usepackage[a4paper]{geometry}

%\usepackage{miscdoc}  % no idea where that package is (maybe just on Robin's home machine)
%
% so go manual ...

\newcommand\Package[1]{\texttt{#1}}
\newcommand\cs[1]{\texttt{\textbackslash#1}}
\newcommand\meta[1]{$\langle$\textnormal{\itshape#1}$\rangle$}
\newcommand\marg[1]{\texttt{\{\meta{#1}\}}}

\usepackage[T1]{fontenc}  % needed for \textbackslash

%\usepackage[scaled=0.85]{luximono}

\def\labelformat{} \usepackage{fncylab} % testing

\begin{document}
\title{The \Package{fncylab} package}
\author{Robin Fairbairns\thanks{Email:
    \emph{robin.fairbairns@cl.cam.ac.uk} --- no longer active}}
\date{2019-08-23, version 1.1}
\maketitle

As of 2019 the \LaTeX{} kernel already contains these extra commands
and the modification to \cs{refstepcounter}. So on nevery kernels
this package is no longer necessary and will silently exit.

\section{Introduction}

The package provides support for arbitrary structuring of the way
label references look.  The command \cs{labelformat}\marg{ctr}\marg{defn}
specifies the structure of a label:
\begin{description}
\item[\emph{\texttt{ctr}}] the counter that will define the label
  (e.g., \texttt{section}, \texttt{figure}, \texttt{enumi} for outer
  level list label references, etc.)
\item[\emph{\texttt{defn}}] the definition of how the counter will be
  formatted in a reference.  In this argument, \texttt{\#1}
  (\emph{not} \texttt{\#\#1} as one might expect) substitutes the
  `raw' value of the thing which is the source of the label.
\end{description}

The package makes use of a built-in LaTeX facility (which actually
needs a bit of patching before it's usable); this allows the precise
layout of the references to labels generated from any LaTeX counter
to be altered.  Note that the way in which the counter itself is
represented in references depends on \cs{the\meta{counter}}\,---\,it's
the same as the way the counter gets printed.

\section{An example}

The \LaTeX{} code:
\begin{quote}
\begin{verbatim}
\labelformat{section}{section #1}
...
\section{The Blah Field}\label{blah}
...
... As we saw above in~\ref{blah} ...
\end{verbatim}
\end{quote}
will typeset its last line as
\begin{quote}
  \dots\@ As we saw above in section 3 \dots
\end{quote}

For references at the start of a sentence, the package defines a
command \cs{Ref}, which is used as one might expect:
\begin{quote}
\begin{verbatim}
... \Ref{blah} shows us that ...
\end{verbatim}
\end{quote}
which will typeset as
\begin{quote}
  \dots\@ Section 3 shows us that \dots
\end{quote}

A demonstration of \cs{labelformat}, using the \Package{enumerate}
package, may be found in the file \texttt{fncylab-example.tex}, which
is part of the distribution.
\end{document}
