<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% $Id: ltxdockit.sty,v 1.2d 2011/03/25 20:33:14 lehman stable $
%
% Copyright (c) 2008-2011 Philipp Lehman.
%
% Permission is granted to copy, distribute and/or modify this
% software under the terms of the LaTeX Project Public License
% (LPPL), version 1.3.
%
% The LPPL maintenance status of this software is
% 'author-maintained'.
%
% This software is provided 'as is', without warranty of any kind,
% either expressed or implied, including, but not limited to, the
% implied warranties of merchantability and fitness for a
% particular purpose.

\def\ltd@rcsid$#1: #2 #3 #4 #5${#4 v#3}

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ltxdockit}
[\ltd@rcsid $Id: ltxdockit.sty,v 1.2d 2011/03/25 20:33:14 lehman stable $
 LaTeX documentation kit]

\RequirePackage{etoolbox}
\RequirePackage{listings}
\RequirePackage{color}
\RequirePackage{xspace}
\RequirePackage{ifpdf}
\RequirePackage{hyperref}

\newcount\ltd@tempcnta
\newlength{\ltd@tempdima}
\newlength{\marglistwidth}
\newlength{\marglistsep}

\AtEndPreamble{%
  \deflength{\marglistwidth}{(\oddsidemargin+1in)*85/100}%
  \deflength{\marglistsep}{10pt}}

\newcommand*{\marglistfont}{\bfseries}
\newcommand*{\margnotefont}{}
\newcommand*{\optionlistfont}{\bfseries}
\newcommand*{\ltxsyntaxfont}{\ttfamily}
\newcommand*{\ltxsyntaxlabelfont}{\bfseries}
\newcommand*{\changelogfont}{\normalfont}
\newcommand*{\changeloglabelfont}{\bfseries}
\newcommand*{\verbatimfont}{\ttfamily}
\newcommand*{\displayverbfont}{\ttfamily}
\renewcommand*{\verbatim@font}{\verbatimfont}

\definecolor{spot}{rgb}{0,0.2,0.6}
\definecolor{boxframe}{gray}{0.8}
\definecolor{boxfill}{rgb}{0.95,0.95,0.99}
\newcommand*{\defaultcolor}{\color{black}}
\newcommand*{\spotcolor}{\color{spot}}

% markup

\newrobustcmd*{\cs}[1]{\mbox{\verbatimfont\textbackslash#1}}
\newrobustcmd*{\cmd}[1]{\mbox{\verbatimfont\textbackslash#1}}
\newrobustcmd*{\env}[1]{\mbox{\verbatimfont#1}}
\newrobustcmd*{\len}[1]{\mbox{\verbatimfont\textbackslash#1}}
\newrobustcmd*{\cnt}[1]{\mbox{\verbatimfont#1}}
\newrobustcmd*{\prm}[1]{%
  \ifblank{#1}
    {}
    {\mbox{%
       \ensuremath\langle
       \normalfont\textit{#1}%
       \ensuremath\rangle}}}
\newrobustcmd*{\mprm}[1]{%
  \mbox{%
    {\verbatimfont\{}\prm{#1}%
    {\verbatimfont\}}}}
\newrobustcmd*{\oprm}[1]{%
  \mbox{%
    {\verbatimfont[}\prm{#1}%
    {\verbatimfont]}}}
\newrobustcmd*{\opt}[1]{\mbox{\verbatimfont#1}}
\newrobustcmd*{\kvopt}[2]{{%
  \verbatimfont#1\penalty\@M
  \hskip 0em plus 0.15em\relax
  =\penalty\hyphenpenalty
  \hskip 0em plus 0.15em\relax #2}}

\csdef{*}{\textasteriskcentered}
\newrobustcmd*{\file}[1]{\mbox{\verbatimfont#1}}
\newrobustcmd*{\sty}[1]{\mbox{\verbatimfont#1}}
\newrobustcmd*{\bin}[1]{\mbox{\verbatimfont#1}}
\newrobustcmd*{\acr}[1]{\mbox{%
  \ifx\f@family\rmdefault
    \textsc{\MakeLowercase{#1}}%
  \else
    #1%
  \fi}}
\newrobustcmd*{\keyval}{%
  \begingroup\verbatimfont
  \prm{key}=\penalty\hyphenpenalty
  \prm{value}\endgroup
  \xspace}

\ifpdf
  \pdfstringdefDisableCommands{%
    \def\cs#1{\textbackslash#1}%
    \def\cmd#1{\textbackslash#1}%
    \def\env#1{'#1'}%
    \def\len#1{\textbackslash#1}%
    \def\cnt#1{'#1'}%
    \def\prm#1{'#1'}%
    \def\mprm#1{\{#1\}}%
    \def\oprm#1{[#1]}%
    \def\opt#1{'#1'}%
    \def\kvopt#1#2{'#1'='#2'}%
    \def\keyval{'key'='value'}%
    \let\file\@firstofone
    \let\sty\@firstofone
    \let\bin\@firstofone
    \let\acr\@firstofone}%
  \def\ltd@pdfbookmark#1#2{%
    \edef\ltd@pdfanchor{%
      \the\c@part\ifundef\c@chapter{}{\the\c@chapter}%
      \the\c@section\the\c@subsection\the\c@subsubsection
      \the\c@paragraph\the\c@subparagraph
      \string:\detokenize{#1}}%
    \belowpdfbookmark{#2}{\ltd@pdfanchor}}
\else
  \let\ltd@pdfbookmark\@gobbletwo
\fi

\newenvironment*{marglist}
  {\list{}{%
     \setlength{\labelwidth}{\marglistwidth}%
     \setlength{\labelsep}{\marglistsep}%
     \setlength{\leftmargin}{0pt}%
     \renewcommand*{\makelabel}[1]{\hss\marglistfont##1}}}
  {\endlist}

\newenvironment*{keymarglist}
  {\marglist
   \setlength{\itemsep}{0pt}%
   \raggedright}
  {\endmarglist}

% references

\newcommand*{\secref}{\refs{\S}{\S\S}}
\newcommand*{\Secref}{\refs{\S}{\S\S}}
\newcommand*{\apxref}{\refs{appendix}{appendices}}
\newcommand*{\Apxref}{\refs{Appendix}{Appendices}}
\newcommand*{\tabref}{\refs{table}{tables}}
\newcommand*{\Tabref}{\refs{Table}{Tables}}

\newrobustcmd*{\refs}[3]{%
  \begingroup
  \@tempcnta\z@
  \def\do##1{\advance\@tempcnta\@ne}%
  \docsvlist{#3}%
  \@tempcntb\@ne
  \def\@tempa{\def\@tempa{%
    \advance\@tempcntb\@ne
    \ifnumequal{\@tempcnta}{2}
      { and }
      {, }}}%
  \def\do##1{\@tempa\ref{##1}}%
  \ifnumgreater{\@tempcnta}{1}{#2}{#1}~\docsvlist{#3}%
  \endgroup}

% syntax

\newenvironment*{ltxsyntax}
  {\list{}{%
     \setlength{\labelwidth}{\marglistwidth}%
     \setlength{\labelsep}{0pt}%
     \setlength{\leftmargin}{0pt}%
     \renewcommand*{\makelabel}[1]{%
       \hss\ltxsyntaxfont\ltxsyntaxlabelfont##1}}%
   \let\csitem\ltd@csitem
   \let\cmditem\ltd@cmditem
   \let\envitem\ltd@envitem
   \let\lenitem\ltd@csitem
   \let\boolitem\ltd@boolitem
   \let\cntitem\ltd@item
   \let\optitem\ltd@item}
  {\endlist}

\def\ltd@itemsave{%
  \ltd@tempcnta\@itempenalty
  \ltd@tempdima\itemsep
  \@itempenalty\@M}
\def\ltd@itemrest{%
  \@itempenalty\ltd@tempcnta
  \itemsep\ltd@tempdima}

\def\ltd@syntaxsetup{%
  \@makeother\[%
  \@makeother\]%
  \@makeother\&lt;%
  \@makeother\&gt;%
  \@makeother\|}%

\def\ltd@itembreak{%
  \ltd@goodbreak
  \let\ltd@goodbreak\goodbreak}
\let\ltd@goodbreak\relax

\def\ltd@item{%
  \@ifstar
    {\boolfalse{@tempswa}\ltd@item@i}
    {\booltrue{@tempswa}\ltd@item@i}}
\def\ltd@item@i#1{%
  \ifbool{@tempswa}
    {\ltd@item@ii{#1\hspace\marglistsep}{#1}}
    {\ltd@item@ii{#1\hspace\marglistsep}{}}}
\def\ltd@item@ii#1#2{%
  \ltd@itemsave
  \ifhmode
    \itemsep\z@
  \else
    \ltd@itembreak
  \fi
  \item[#1]%
  \ltd@itemrest
  \ifblank{#2}{}{\ltd@pdfbookmark{#2}{#1}}}

\def\ltd@csitem{%
  \@ifstar
    {\boolfalse{@tempswa}\ltd@csitem@i}
    {\booltrue{@tempswa}\ltd@csitem@i}}
\def\ltd@csitem@i#1{%
  \ifbool{@tempswa}
    {\ltd@item@ii{\textbackslash#1\hspace\marglistsep}{#1}}
    {\ltd@item@ii{\textbackslash#1\hspace\marglistsep}{}}}

\def\ltd@boolitem#1{%
  \ltd@item@ii{\textbackslash#1true\hspace\marglistsep}{}%
  \leavevmode\vspace{-\parsep}%
  \ltd@item@ii{\textbackslash#1false\hspace\marglistsep}{}%
  \leavevmode\vspace{\numexpr-2\baselineskip}}

\def\ltd@cmditem{%
  \@ifstar
    {\boolfalse{@tempswa}\ltd@cmditem@i}
    {\booltrue{@tempswa}\ltd@cmditem@i}}
\def\ltd@cmditem@i#1{%
  \ifbool{@tempswa}
    {\ltd@cmditem@ii{\textbackslash#1}{#1}}
    {\ltd@cmditem@ii{\textbackslash#1}{}}}
\def\ltd@cmditem@ii#1#2{%
  \ltd@itemsave
  \ifhmode
    \itemsep-\topsep
  \else
    \ltd@itembreak
  \fi
  \item[#1]%
  \ltd@itemrest
  \ifblank{#2}{}{\ltd@pdfbookmark{#2}{#1}}%
  \begingroup
  \ltd@syntaxsetup
  \ltxsyntaxfont
  \let\@tempa\@empty
  \ltd@parseargs}

\def\ltd@envitem#1{%
  \ltd@itembreak
  \item[\textbackslash begin]\{{\ltxsyntaxfont\ltxsyntaxlabelfont#1}\}%
  \ltd@pdfbookmark{#1}{#1}%
  \begingroup
  \ltd@syntaxsetup
  \ltxsyntaxfont
  \def\@tempa{%
    \ltd@itemsave
    \itemsep\z@
    \item[\textbackslash end]\{{\ltxsyntaxfont\ltxsyntaxlabelfont#1}\}%
    \ltd@itemrest}%
  \ltd@parseargs}

\def\ltd@parseargs{%
  \leavevmode
  \futurelet\@let@token\ltd@parseargs@space}
\def\ltd@parseargs@space{%
  \ifx\@let@token\@sptoken
    \expandafter\ltd@gobblespace
  \else
    \expandafter\ltd@parseargs@i
  \fi}
\def\ltd@parseargs@i{%
  \ifx\@let@token\\%
    \expandafter\ltd@printarg@i
  \else
    \expandafter\ltd@parseargs@ii
  \fi}
\def\ltd@parseargs@ii{%
  \ifx\@let@token*%
    \expandafter\ltd@printarg@ii
  \else
    \expandafter\ltd@parseargs@iii
  \fi}
\def\ltd@parseargs@iii{%
  \ifx\@let@token[%]
    \expandafter\ltd@printarg@iii
  \else
    \expandafter\ltd@parseargs@iv
  \fi}
\def\ltd@parseargs@iv{%
  \ifx\@let@token(%)
    \expandafter\ltd@printarg@iv
  \else
    \expandafter\ltd@parseargs@v
  \fi}
\def\ltd@parseargs@v{%
  \ifx\@let@token&lt;%&gt;
    \expandafter\ltd@printarg@v
  \else
    \expandafter\ltd@parseargs@vi
  \fi}
\def\ltd@parseargs@vi{%
  \ifx\@let@token|%
    \expandafter\ltd@printarg@vi
  \else
    \expandafter\ltd@parseargs@vii
  \fi}
\def\ltd@parseargs@vii{%
  \ifx\@let@token\bgroup
    \expandafter\ltd@printarg@vii
  \else
    \expandafter\ltd@parseargs@end
  \fi}
\def\ltd@parseargs@end{%
  \@tempa\endgroup
  \nobreak\vspace*{\itemsep}}

\def\ltd@printarg@i#1{\%\nobreak\par\ltd@parseargs}
\def\ltd@printarg@ii#1{{\ltxsyntaxfont\ltxsyntaxlabelfont#1}\ltd@parseargs}
\def\ltd@printarg@iii[#1]{[\prm{#1}]\ltd@parseargs}
\def\ltd@printarg@iv(#1){(\prm{#1})\ltd@parseargs}
\def\ltd@printarg@v&lt;#1&gt;{\prm{#1}\ltd@parseargs}
\def\ltd@printarg@vi|#1|{#1\ltd@parseargs}
\def\ltd@printarg@vii#1{\{\prm{#1}\}\ltd@parseargs}
\csdef{ltd@gobblespace} {\ltd@parseargs}

% options

\newenvironment*{optionlist}
  {\list{}{%
     \setlength{\labelwidth}{\marglistwidth}%
     \setlength{\labelsep}{\z@}%
     \setlength{\leftmargin}{0pt}%
     \renewcommand*{\makelabel}[1]{\hss\optionlistfont##1}}%
   \ltd@optionlist}
  {\endlist}

\newenvironment*{optionlist*}
  {\list{}{%
     \setlength{\labelwidth}{0pt}%
     \setlength{\labelsep}{0pt}%
     \setlength{\leftmargin}{0pt}%
     \renewcommand*{\makelabel}[1]{\hss\optionlistfont##1}}%
   \ltd@optionlist
   \let\ltd@pdfbookmark\@gobbletwo
   \let\ltd@option@i\ltd@option@ii
   \def\legitem##1{\item[##1]\item\relax}}
  {\endlist}

\def\ltd@optionlist{%
  \let\optitem\ltd@ol@optitem
  \let\varitem\ltd@ol@varitem
  \let\valitem\ltd@ol@valitem
  \let\choitem\ltd@ol@choitem
  \let\boolitem\ltd@ol@boolitem
  \let\intitem\ltd@ol@intitem
  \let\legitem\ltd@ol@legitem}

\newcommand*{\ltd@ol@optitem}[3][]{%
  \ifblank{#1}
    {\ltd@option{#2}{#2}{#3}{}}
    {\ltd@option{#2}{#2}{#3}{\ltd@textverb{#1}}}}%

\newcommand*{\ltd@ol@varitem}[3][]{%
  \ifblank{#1}
    {\ltd@option{#2}{\prm{#2}}{#3}{}}
    {\ltd@option{#2}{\prm{#2}}{#3}{\ltd@textverb{#1}}}}%

\newcommand*{\ltd@ol@valitem}[3][]{%
  \ifblank{#1}
    {\ltd@option{#2}{#2}{\prm{#3}}{}}
    {\ltd@option{#2}{#2}{\prm{#3}}{\ltd@textverb{#1}}}}%

\newcommand*{\ltd@ol@choitem}[3][]{%
  \ifblank{#1}
    {\ltd@option{#2}{#2}{\ltd@verblist{#3}}{}}
    {\ltd@option{#2}{#2}{\ltd@verblist{#3}}{\ltd@textverb{#1}}}}%

\newcommand*{\ltd@ol@boolitem}[2][]{%
  \ifblank{#1}
    {\ltd@option{#2}{#2}{\ltd@verblist{true,false}}{}}
    {\ltd@option{#2}{#2}{\ltd@verblist{true,false}}{\ltd@textverb{#1}}}}%

\newcommand*{\ltd@ol@intitem}[2][]{%
  \ifblank{#1}
    {\ltd@option{#2}{#2}{\prm{integer}}{}}
    {\ltd@option{#2}{#2}{\prm{integer}}{\ltd@textverb{#1}}}}%

\def\ltd@ol@legitem#1{%
  \item[#1\hspace{\marglistsep}]%
  \ltd@pdfbookmark{#1}{#1}}%

\def\ltd@textverb#1{{\displayverbfont#1}}

\def\ltd@verblist#1{%
  \begingroup
  \let\@tempa\@empty
  \def\do##1{\@tempa\ltd@textverb{##1}\def\@tempa{, }}%
  \docsvlist{#1}%
  \endgroup}

\def\ltd@option#1#2#3#4{%
  \@ifnextchar[%]
    {\ltd@option@i{#1}{#2}{#3}{#4}}
    {\ltd@option@i{#1}{#2}{#3}{#4}[]}}

\def\ltd@option@i#1#2#3#4[#5]{%
  \item[#2]%
  \ltd@pdfbookmark{#1}{#1}%
  \begingroup\raggedright
  \ltd@textverb{=}%
  \settowidth\@tempdimb{\ltd@textverb{=}}%
  \@tempdima=\dimexpr\linewidth-\@tempdimb\relax
  \ifblank{#4}
    {}
    {\settowidth\@tempdimb{default: #4}%
     \@tempdima=\dimexpr\@tempdima-\@tempdimb-2em\relax}%
  \parbox[t]{\@tempdima}{\raggedright #3}%
  \ifblank{#4}
    {}
    {\hfill default:~#4}%
  \ifblank{#5}
    {}
    {\marginpar{\margnotefont #5}}%
  \par\endgroup
  \nobreak\vspace{\itemsep}}

\def\ltd@option@ii#1#2#3#4[#5]{%
  \item[#2]%
  \ltd@pdfbookmark{#1}{#1}%
  \begingroup\raggedright
  \ltd@textverb{=}%
  \settowidth\@tempdimb{{\optionlistfont#2}\ltd@textverb{=}}%
  \@tempdima=\dimexpr\linewidth-\@tempdimb\relax
  \ifblank{#4}
    {}
    {\settowidth\@tempdimb{default: #4}%
     \@tempdima=\dimexpr\@tempdima-\@tempdimb-2em\relax}%
  \parbox[t]{\@tempdima}{\raggedright #3}%
  \ifblank{#4}
    {}
    {\hfill default:~#4}%
  \ifblank{#5}
    {}
    {\marginpar{\margnotefont #5}}%
  \par\endgroup
  \nobreak\vspace{\itemsep}}

\newenvironment*{valuelist}[1][]
  {\list{}{%
     \ifblank{#1}
       {\setlength{\labelwidth}{5em}}
       {\settowidth{\labelwidth}{\optionlistfont#1}}%
     \setlength{\labelsep}{1em}%
     \setlength{\leftmargin}{\labelwidth}%
     \addtolength{\leftmargin}{\labelsep}%
     \setlength{\itemsep}{0pt}%
     \renewcommand*{\makelabel}[1]{\optionlistfont##1\hss}}}
  {\endlist}

\newenvironment*{valuelist*}
  {\list{}{%
     \setlength{\labelwidth}{0pt}%
     \setlength{\labelsep}{0pt}%
     \setlength{\leftmargin}{0pt}%
     \renewcommand*{\makelabel}[1]{\hss\optionlistfont##1}%
     \let\@@item\item
     \def\item[##1]{%
       \@itempenalty-\@highpenalty
       \@@item[##1]%
       \@itempenalty\@M
       \@@item\relax}}}
  {\endlist}

\newenvironment*{argumentlist}[1]
  {\list{}{%
     \settowidth{\labelwidth}{\displayverbfont#1}%
     \setlength{\labelsep}{1em}%
     \setlength{\leftmargin}{\labelwidth}%
     \addtolength{\leftmargin}{\labelsep}%
     \setlength{\itemsep}{0pt}%
     \renewcommand*{\makelabel}[1]{\displayverbfont##1\hss}}}
  {\endlist}

% changelog

\newenvironment*{changelog}
  {\list{}{%
     \setlength{\leftmargin}{0pt}%
     \setlength{\itemsep}{0pt}%
     \renewcommand*{\makelabel}[1]{##1\hss}%
     \raggedright\changelogfont}%
   \def\release##1##2{%
     \@release{##1}{##2}%
     \list{}{%
       \setlength{\leftmargin}{1.5em}%
       \setlength{\itemindent}{-1.5em}%
       \setlength{\itemsep}{0pt}}%
     \samepage
     \begingroup
     \def\item{\endgroup\item\@itempenalty\z@}}%
   \def\endrelease{\endlist}%
   \def\@release##1##2{%
     \begingroup
     \changeloglabelfont
     \item\relax
     \ltd@pdfbookmark{##1}{##1 (##2)}%
     ##1\quad##2\par\nobreak
     \endgroup}
   \def\see##1{%
     \leaders\hbox{$\m@th\mkern4.5mu\hbox{.}\mkern4.5mu$}%
     \hfill\makebox[3em][l]{\ref{##1}}}}
  {\endlist}

% verbatim

\newlength{\lstenvsep}
\setlength{\lstenvsep}{\partopsep}
\addtolength{\lstenvsep}{\topsep}

\lstset{%
  aboveskip=\lstenvsep,
  belowskip=\lstenvsep,
  basicstyle=\displayverbfont\small,
  commentstyle=\itshape,
  keywordstyle=\spotcolor,
  emphstyle=\spotcolor,
  numbers=none,
  basewidth=0.5em,
  fontadjust=true,
  flexiblecolumns=true,
  keepspaces=false}

\lstdefinestyle{plain}{%
  escapechar={\#}}
\lstdefinestyle{highlight}{%
  moredelim=[is][\spotcolor]{&lt;&lt;}{&gt;&gt;}}
\lstdefinestyle{latex}{%
  alsoletter={\\},
  moredelim=[is][\spotcolor]{&lt;&lt;}{&gt;&gt;}}
\lstdefinestyle{ifthen}{%
  alsoletter={\\},
  keywords={\\and,\\or,\\not,\\AND,\\OR,\\NOT},
  otherkeywords={=,&lt;,&gt;,\\(,\\)}}

\lstnewenvironment{ltxcode}[1][]
  {\lstset{style=latex,#1}}
  {}

\lstnewenvironment{ltxexample}[1][]
  {\lstset{%
     aboveskip=1.5\lstenvsep,
     xleftmargin=3pt,
     xrightmargin=3pt,
     frame=single,
     backgroundcolor=\color{boxfill},
     fillcolor=\color{white},
     rulecolor=\color{boxframe},
     framesep=2.5pt,
     framerule=0.5pt,
     style=latex,#1}}
  {}

\endinput
</pre></body></html>