% Typewriter font, since it doesn't allow hyphenation by default anyway.)
%
% There are several files you'll need to create:
-% \begin{description} \def\makelabel#1{\hskip\labelsep\mttfamily#1\hfil}
+% \begin{description} \setdescriptionlabel{\mttfamily#1}
%
% \item [cmtt.sty] tells \LaTeX\ that there's a new encoding. It also
% provides some options for customising some aspects of the
% \end{description}
%
% The package accepts some options which may be useful:
-% \begin{description} \def\makelabel#1{\hskip\labelsep\sffamily#1\hfil}
+% \begin{description} \setdescriptionlabel{\sffamily#1}
%
% \item [override] overrides the meaning of the \mtt{\\ttfamily} command
% (and therefore also the \mtt{\\texttt} command too), making it the
% The types provided (and it's easy-ish to add more) are:
%
% \def\ch{\char`}
-% \begin{description} \def\makelabel{\hskip\labelsep\normalfont\ttfamily}
+% \begin{description} \setdescriptionlabel{\normalfont\ttfamily#1}
% \item [r] Right aligned equation
% \item [c] Centre-aligned equation
% \item [l] Left aligned equation
% |\arrayrulewidth|. However, there's an optional argument which can contain
% one of:
%
-% \begin{description}
-% \renewcommand\makelabel[1]{\kern\labelsep\ttfamily#1}
+% \begin{description} \setdescriptionlabel{\ttfamily#1}
% \item[thin] Use |\arrayrulewidth| as the line width. This is the default.
% \item[thick] Use |\arraythickrulewidth| as the line width. This is the
% same as giving a |*| after the command.
%</mdwtools>
% \end{meta-comment}
%
-% \CheckSum{743}
+% \CheckSum{765}
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
% \end{macrocode}
%
%
+% \subsection{Custom description lists}
+%
+% For some bizarre reason, the \LaTeX\ \env{description} environment sets
+% |\itemindent| so that the label starts |\labelsep| into the left margin,
+% and the default |\makelabel| must therefore contain a hack to compensate.
+% This is fixed in the \package{strayman} document class, and by the
+% \package{mdwlist} package in this collection. But this introduces a
+% problem: if I want to set a \env{description} list with custom labels, how
+% can I do this without messing up the spacing?
+%
+% Detection of the relevant packages is done in an awfully hacky way, because
+% \LaTeXe\ seems to go out of its way to forget which packages have been
+% loaded at |\begin{document}| time.
+%
+% \begin{macrocode}
+\def\setdescriptionlabel#1{%
+ \if1\ifx\sectindent\xxundefined% strayman?
+ \ifx\defaultdesc\xxundefined% mdwlist?
+ 1\else0\fi\else0\fi%
+ \def\makelabel##1{\hskip\labelsep\relax#1}%
+ \else%
+ \def\makelabel##1{#1}%
+ \fi%
+}
+% \end{macrocode}
+%
+%
% \subsection{A table environment}
%
% \begin{environment}{tab}
% are described below (if you're not interested in this sort of thing, skip
% to the next section).
%
-% \begin{description} \def\makelabel#1{\hskip\labelsep\cmd{#1}\hfil}
+% \begin{description} \setdescriptionlabel{\cmd{#1}}
% \item [stanza] is a \LaTeX\ counter which contains the current stanza
% number.
% \item [\thestanza] typesets the value of the |stanza| counter in normal
%
% You can modify the appearance of grammars using three length parameters:
%
-% \begin{description} \def\makelabel{\hskip\labelsep\cmd}
+% \begin{description} \setdescriptionlabel{\cmd{#1}}
%
% \item [\grammarparsep] is the amount of space inserted between production
% rules. It is a rubber length whose default value is 8\,pt, with
%
% The following length parameters may be altered:
%
-% \begin{description} \def\makelabel{\hskip\labelsep\cmd}
+% \begin{description} \setdescriptionlabel{\cmd{#1}}
%
% \item [\sdstartspace] The length of the rule between the arrows which
% begin each line of the syntax diagram and the first item on the line.