summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/dox
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-09-21 22:39:03 +0000
committerKarl Berry <karl@freefriends.org>2009-09-21 22:39:03 +0000
commit97748b815092e16107c3fbfbe08795cff718a5fa (patch)
tree832f306d645e13209f2450c05ee9e1c5ea42ab7e /Master/texmf-dist/tex/latex/dox
parent88d26d8a8079d7b343841bb875a83f89cb27e050 (diff)
dox 2.0 (21sep09)
git-svn-id: svn://tug.org/texlive/trunk@15409 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/dox')
-rw-r--r--Master/texmf-dist/tex/latex/dox/dox.sty165
1 files changed, 120 insertions, 45 deletions
diff --git a/Master/texmf-dist/tex/latex/dox/dox.sty b/Master/texmf-dist/tex/latex/dox/dox.sty
index 592dfa7a290..c493fb6b8b1 100644
--- a/Master/texmf-dist/tex/latex/dox/dox.sty
+++ b/Master/texmf-dist/tex/latex/dox/dox.sty
@@ -38,38 +38,74 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{dox}[2009/09/11 v1.0 Extensions to the doc package]
+\ProvidesPackage{dox}[2009/09/21 v2.0 Extensions to the doc package]
-\long\def\doxm@cro@#1#2{%
+\RequirePackage{kvoptions}
+\SetupKeyvalOptions{family=dox,prefix=dox@}
+
+\DeclareBoolOption{noprint}
+\DeclareBoolOption{noindex}
+\DeclareStringOption{idxtype}
+
+\long\def\@@doxenv#1#2{%
\endgroup%
- \topsep\MacroTopsep\trivlist
- \def\makelabel##1{\llap{##1}}%
- \if@inlabel
- \let\@tempa\@empty
- \count@\macro@cnt
- \loop\ifnum\count@>\z@
- \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne%
- \repeat
- \edef\makelabel##1{%
- \llap{\vtop to\baselineskip
-{\@tempa\hbox{##1}\vss}}}%
- \advance\macro@cnt\@ne
- \else
- \macro@cnt\@ne
- \fi
- \edef\@tempa{%
- \noexpand\item[%
- \expandafter\noexpand\csname Print#1Name\endcsname{\string#2}]}%
- \@tempa
- \global\advance\c@CodelineNo\@ne
- \@nameuse{SpecialMain#1Index}{#2}\nobreak
- \global\advance\c@CodelineNo\m@ne
- \ignorespaces}
-
-\newcommand\doxitem[3]{%
- \@ifundefined{Print#1Name}{%
- \expandafter\def\csname Print#1Name\endcsname##1{%
- \strut\MacroFont\string##1\ }}{}
+ \topsep\MacroTopsep%
+ \trivlist%
+ \edef\saved@macroname{\string#2}%
+ \def\makelabel##1{\llap{##1}}%
+ \if@inlabel%
+ \let\@tempa\@empty%
+ \count@\macro@cnt%
+ \loop\ifnum\count@>\z@%
+ \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne%
+ \repeat%
+ \edef\makelabel##1{\llap{\vtop to\baselineskip{\@tempa\hbox{##1}\vss}}}%
+ \advance\macro@cnt\@ne%
+ \else%
+ \macro@cnt\@ne%
+ \fi%
+ \ifdox@noprint%
+ \item%
+ \else%
+ \edef\@tempa{%
+ \noexpand\item[%
+ \expandafter\noexpand\csname Print#1Name\endcsname{\saved@macroname}]}%
+ \@tempa%
+ \fi%
+ \ifdox@noindex\else%
+ \global\advance\c@CodelineNo\@ne%
+ \@nameuse{SpecialMain#1Index}{#2}\nobreak%
+ \global\advance\c@CodelineNo\m@ne%
+ \fi%
+ \ignorespaces}
+\def\@doxenv#1[#2]{%
+ \@nameuse{dox@noprint\dox@noprintdefault}%
+ \@nameuse{dox@noindex\dox@noindexdefault}%
+ \setkeys{dox}{#2}%
+ \begingroup%
+ \catcode`\\12%
+ \MakePrivateLetters%
+ \@@doxenv{#1}}
+
+\def\@@doxdescribe#1#2{%
+ \endgroup%
+ \ifdox@noprint\else%
+ \marginpar{\raggedleft\@nameuse{PrintDescribe#1}{#2}}%
+ \fi%
+ \ifdox@noindex\else%
+ \@nameuse{Special#1Index}{#2}%
+ \fi%
+ \endgroup%
+ \@esphack\ignorespaces}
+\def\@doxdescribe#1[#2]{%
+ \leavevmode\@bsphack%
+ \begingroup%
+ \setkeys{dox}{#2}%
+ \begingroup%
+ \MakePrivateLetters%
+ \@@doxdescribe{#1}}
+
+\def\@doxcreatespecialmainindex#1#2#3{%
\expandafter\def\csname SpecialMain#1Index\endcsname##1{%
\@bsphack%
\special@index{%
@@ -77,28 +113,67 @@
\special@index{%
#3:\levelchar##1\actualchar%
{\string\ttfamily\space##1}\encapchar main}%
- \@esphack}
- \@ifundefined{PrintDescribe#1}{%
- \expandafter\def\csname PrintDescribe#1\endcsname##1{%
- \strut\MacroFont##1\ }}{}
- \expandafter\def\csname Special#1Index\endcsname##1{\@bsphack
+ \@esphack}}
+
+\def\@doxcreatespecialindex#1#2#3{%
+ \expandafter\def\csname Special#1Index\endcsname##1{%
+ \@bsphack%
\index{##1\actualchar{\protect\ttfamily##1}
(#2)\encapchar usage}%
\index{#3:\levelchar##1\actualchar{\protect\ttfamily##1}\encapchar
- usage}\@esphack}
- \expandafter\def\csname Describe@#1\endcsname##1{%
- \endgroup
- \marginpar{\raggedleft\@nameuse{PrintDescribe#1}{##1}}%
- \@nameuse{Special#1Index}{##1}\@esphack\ignorespaces}
+ usage}%
+ \@esphack}}
+
+\def\@doxcreatedescribe#1{%
\expandafter\def\csname Describe#1\endcsname{%
- \leavevmode\@bsphack\begingroup\MakePrivateLetters
- \@nameuse{Describe@#1}}
+ \@ifnextchar[%]
+ {\@doxdescribe{#1}}{\@doxdescribe{#1}[]}}}
+
+\def\@doxcreateenv#1#2{%
\expandafter\def\csname #2\endcsname{%
- \begingroup
- \catcode`\\12
- \MakePrivateLetters\doxm@cro@{#1}}
+ \@ifnextchar[%]
+ {\@doxenv{#1}}{\@doxenv{#1}[]}}
\expandafter\let\csname end#2\endcsname\endtrivlist}
+\let\SpecialMacroIndex\SpecialUsageIndex
+\@doxcreatedescribe{Macro}
+
+\def\SpecialMainMacroIndex#1{%
+ \SpecialMainIndex{#1}\nobreak%
+ \DoNotIndex{#1}}
+\@doxcreateenv{Macro}{macro}
+
+\@doxcreatedescribe{Env}
+\@doxcreateenv{Env}{environment}
+
+\newcommand\doxitem[4][]{%
+ \def\dox@idxtype{#3}%
+ \setkeys{dox}{#1}
+ \@ifundefined{Print#2Name}{%
+ \expandafter\def\csname Print#2Name\endcsname##1{%
+ \strut\MacroFont##1\ }}{}
+ \def\@doxexpr{\@doxcreatespecialmainindex{#2}}%
+ \expandafter\@doxexpr\expandafter{\dox@idxtype}{#4}%
+ \@ifundefined{PrintDescribe#2}{%
+ \expandafter\def\csname PrintDescribe#2\endcsname##1{%
+ \strut\MacroFont##1\ }}{}
+ \def\@doxexpr{\@doxcreatespecialindex{#2}}%
+ \expandafter\@doxexpr\expandafter{\dox@idxtype}{#4}%
+ \@doxcreatedescribe{#2}
+ \@doxcreateenv{#2}{#3}}
+
+\ProcessKeyvalOptions*
+\ifdox@noprint
+ \def\dox@noprintdefault{true}
+\else
+ \def\dox@noprintdefault{false}
+\fi
+\ifdox@noindex
+ \def\dox@noindexdefault{true}
+\else
+ \def\dox@noindexdefault{false}
+\fi
+
\endinput
%%
%% End of file `dox.sty'.