diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/ltxdockit/ltxdockit.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/ltxdockit/ltxdockit.sty | 501 |
1 files changed, 501 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/ltxdockit/ltxdockit.sty b/Master/texmf-dist/tex/latex/ltxdockit/ltxdockit.sty new file mode 100644 index 00000000000..11ea12c6189 --- /dev/null +++ b/Master/texmf-dist/tex/latex/ltxdockit/ltxdockit.sty @@ -0,0 +1,501 @@ +% $Id: ltxdockit.sty,v 1.1 2008/10/12 19:50:56 lehman stable $ +% +% Copyright (c) 2008 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. + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{ltxdockit}[2008/10/12 v1.1 latex documentation kit] +\RequirePackage{etoolbox} +\RequirePackage{listings} +\RequirePackage{color} +\RequirePackage{xspace} +\RequirePackage{ifpdf} +\RequirePackage{hyperref} + +\newcount\ltd@tempcnta +\newdimen\ltd@tempdima +\newlength{\marglistwidth} +\newlength{\marglistsep} +\newif\ifpdfbookmarks + +\AtEndPreamble{% + \setlength{\marglistwidth}{\oddsidemargin}% + \addtolength{\marglistwidth}{1in}% + \setlength{\marglistwidth}{0.85\marglistwidth}% + \setlength{\marglistsep}{10pt}} + +\newcommand*{\marglistfont}{\bfseries} +\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}{\@ifstar\ltd@scmd\ltd@cmd} +\def\ltd@cmd#1{\mbox{\verbatimfont\textbackslash#1}} +\begingroup +\catcode`\ =\active% +\gdef\ltd@scmd#1{\mbox{\verbatimfont% +\catcode`\ =\active\let \textvisiblespace% +\textbackslash\scantokens{#1\relax}}}% +\endgroup +\newrobustcmd*{\env}[1]{\mbox{\verbatimfont#1}} +\newrobustcmd*{\len}[1]{\mbox{\verbatimfont\textbackslash#1}} +\newrobustcmd*{\cnt}[1]{\mbox{\verbatimfont#1}} +\newrobustcmd*{\prm}[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}} + +\newrobustcmd*{\file}[1]{\mbox{\verbatimfont#1}} +\newrobustcmd*{\sty}[1]{\mbox{\verbatimfont#1}} +\newrobustcmd*{\bin}[1]{\mbox{\verbatimfont#1}} +\newrobustcmd*{\acr}[1]{% + \ifx\f@family\rmdefault + \textsc{\MakeLowercase{#1}}% + \else + #1% + \fi} +\csdef{*}{\textasteriskcentered} +\newrobustcmd*{\keyval}{% + \begingroup\verbatimfont + \prm{key}=\penalty\hyphenpenalty + \prm{value}\endgroup + \xspace} + +\ifpdf + \pdfbookmarkstrue + \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@pdfinit{% + \ifpdfbookmarks + \let\ltd@pdflast\Hy@currentbookmarklevel + \numdef\ltd@pdflevel{\Hy@currentbookmarklevel+1} + \fi} + \def\ltd@pdfrestore{% + \ifpdfbookmarks + \global\let\Hy@currentbookmarklevel\ltd@pdflast + \fi} + \def\ltd@pdfbookmark#1#2{% + \ifpdfbookmarks + \def\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:\detokenize{#1}}% + \pdfbookmark[\ltd@pdflevel]{#2}{\ltd@pdfanchor} + \fi} +\else + \pdfbookmarksfalse + \let\ltd@pdfinit\relax + \let\ltd@pdfrestore\relax + \let\ltd@pdfbookmark\@gobbletwo +\fi + +\newenvironment*{marglist} + {\list{}{% + \setlength{\labelwidth}{\marglistwidth}% + \setlength{\labelsep}{\marglistsep}% + \setlength{\leftmargin}{0pt}% + \renewcommand*{\makelabel}[1]{\hss\marglistfont##1}}} + {\endlist} + +% syntax + +\newenvironment*{ltxsyntax} + {\ltd@pdfinit + \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 + \ltd@pdfrestore} + +\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\<% + \@makeother\>% + \@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{% + \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<%> + \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<#1>{\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} + {\ltd@pdfinit + \list{}{% + \setlength{\labelwidth}{\marglistwidth}% + \setlength{\labelsep}{\z@}% + \setlength{\leftmargin}{0pt}% + \renewcommand*{\makelabel}[1]{\hss\optionlistfont##1}}% + \ltd@optionlist} + {\endlist + \ltd@pdfrestore} + +\newenvironment*{optionlist*} + {\ltd@pdfinit + \list{}{% + \setlength{\labelwidth}{0pt}% + \setlength{\labelsep}{0pt}% + \setlength{\leftmargin}{0pt}% + \renewcommand*{\makelabel}[1]{\hss\optionlistfont##1}}% + \ltd@optionlist + \def\legitem##1{\item[##1]\item\relax}} + {\endlist + \ltd@pdfrestore} + +\def\ltd@optionlist{% + \newcommand*{\optitem}[3][]{% + \ifblank{##1} + {\ltd@option{##2}{##3}{}} + {\ltd@option{##2}{##3}{\ltd@textverb{##1}}}}% + \newcommand*{\valitem}[3][]{% + \ifblank{##1} + {\ltd@option{##2}{\prm{##3}}{}} + {\ltd@option{##2}{\prm{##3}}{\ltd@textverb{##1}}}}% + \newcommand*{\boolitem}[2][]{% + \ifblank{##1} + {\ltd@option{##2}{\ltd@textverb{true}, + \ltd@textverb{false}}{}} + {\ltd@option{##2}{\ltd@textverb{true}, + \ltd@textverb{false}}{\ltd@textverb{##1}}}}% + \newcommand*{\intitem}[2][]{% + \ifblank{##1} + {\ltd@option{##2}{\prm{integer}}{}} + {\ltd@option{##2}{\prm{integer}}{\ltd@textverb{##1}}}}% + \newcommand*{\legitem}[1]{% + \item[##1\hspace{\marglistsep}]% + \ltd@pdfbookmark{##1}{##1}}% + \def\ltd@textverb##1{{\displayverbfont##1}}% + \def\ltd@option##1##2##3{% + \item[##1]% + \ltd@pdfbookmark{##1}{##1}% + \ltd@textverb{=}{##2}% + \ifblank{##3}{}{\hfill default: ##3}% + \par\nobreak\vspace{\itemsep}}} + +\newenvironment*{valuelist} + {\list{}{% + \setlength{\labelwidth}{5em}% + \setlength{\labelsep}{0.5em}% + \setlength{\leftmargin}{\labelwidth}% + \addtolength{\leftmargin}{\labelsep}% + \setlength{\itemsep}{0pt}% + \renewcommand*{\makelabel}[1]{\displayverbfont##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} + {\ltd@pdfinit + \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[2.75em][l]{\ref{##1}}}} + {\endlist + \ltd@pdfrestore} + +% 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]{<<}{>>}} +\lstdefinestyle{latex}{% + alsoletter={\\}, + moredelim=[is][\spotcolor]{<<}{>>}} +\lstdefinestyle{ifthen}{% + alsoletter={\\}, + keywords={\\and,\\or,\\not,\\AND,\\OR,\\NOT}, + otherkeywords={=,<,>,\\(,\\)}} + +\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 |