poetry.dtx (\maybe@unskip): Match the version in `mdwtab'.
[mdwtools] / mdwtools.tex
index feca1b6..c8e8932 100644 (file)
@@ -36,7 +36,7 @@
 %</mdwtools>
 % \end{meta-comment}
 %
-% \CheckSum{743}
+% \CheckSum{804}
 %% \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
 % loaded is by seeing if the |\documentclass| command has been redefined
 % to raise an error.  This isn't too hard, really.
 %
+% If my \package{strayman} document class is available, then I'd prefer to
+% use that.
+%
 %    \begin{macrocode}
 \ifx\documentclass\@twoclasseserror\else
-  \documentclass[a4paper]{ltxdoc}
+  \IfFileExists{strayman.cls}
+    {\documentclass[a4paper]{strayman}}
+    {\documentclass[a4paper]{ltxdoc}}
   \ifx\doneclasses\mdw@undefined\else\doneclasses\fi
 \fi
 %    \end{macrocode}
 %
+% If I can use better fonts, then that would be nice.
+%
+%    \begin{macrocode}
+\usepackage[T1]{fontenc}
+\IfFileExists{mdwfonts.sty}
+  {\usepackage[palatino, helvetica, courier, maths=cmr]{mdwfonts}}{}
+%    \end{macrocode}
+%
 % As part of my standard environment, I'll load some of my more useful
 % packages.  If they're already loaded (possibly with different options),
 % I'll not try to load them again.
 \@ifpackageloaded{sverb}{}{\usepackage{sverb}}
 %    \end{macrocode}
 %
+% If I'm not using the \package{ltxdoc} document class then I'll need some of
+% its definitions.  I've no idea why these aren't part of \package{doc}\ldots
+%
+% \begin{macro}{\cmd}
+% \begin{macro}{\cs}
+%    \begin{macrocode}
+\def\cmd#1{\expandafter\cmd@i\string#1\x}
+\def\cmd@i#1#2\x{\cs{#2}}
+\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
 %
+% \begin{macro}{\marg}
+% \begin{macro}{\oarg}
+% \begin{macro}{\parg}
+%    \begin{macrocode}
+\def\@arg#1#2#3{\texttt{#1}\meta{#2}\texttt{#3}}
+\def\marg#1{\@arg{\char`\{}{#1}{\char`\}}}
+\def\oarg#1{\@arg{[}{#1}{]}}
+\def\parg#1{\@arg{(}{#1}{)}}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+
 % \subsection{Some macros for interaction}
 %
 % I like the \LaTeX\ star-boxes, although it's a pain having to cope with
 %    \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}
 %
 %    \begin{macrocode}
   \def\do##1##2{%
-    ##2%
     \ifhave@multicol\addtocontents{##1}{%
       \protect\begin{multicols}{2}%
       \hbadness\@M%
     }\fi%
+    ##2%
   }%
   \docontents%
 %    \end{macrocode}