Debian Codegraph @

texmf-dist/doc/latex/underscore/miscdoc.sty

raw
1 \ProvidesPackage{miscdoc}[2010/01/20 v1.2 documentation macros misc latex pkgs]
2
3 % miscdoc.sty
4 % Copyright 2010 Robin Fairbairns
5 %
6 % This work may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.3
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in
10 % http://www.latex-project.org/lppl.txt
11 % and version 1.3 or later is part of all distributions of LaTeX
12 % version 2005/12/01 or later.
13 %
14 % This work has the LPPL maintenance status `maintained'.
15 %
16 % The Current Maintainer of this work is Robin Fairbairns.
17 %
18 % This work consists of the file miscdoc.sty (only)
19
20 \setcounter{errorcontextlines}{1274}
21
22 % The package arose from a small exercise to document packages whose
23 % previous documentation consisted solely of comments in the package files.
24 % The macros here defined are lifted from the author's faq.sty
25 % (written for the UK TeX FAQ, CTAN:help/uk-tex-faq) or are inspired
26 % by others' work (credited where the author is known) ... except
27 % where they came as a flash of inspiration while actually writing the
28 % documentation.
29
30 % this option suggested by Heiko Oberdiek, 2010-01-29
31 \DeclareOption{hyper}{%
32 \AtEndOfPackage{%
33 \RequirePackage[pdfusetitle]{hyperref}
34 \RequirePackage{bookmark}
35 \bookmarksetup{numbered,open,openlevel=1}
36 }
37 }
38 \ProcessOptions\relax
39
40 % note: T1 encoding assumed
41 \usepackage{lmodern}
42 \usepackage[T1]{fontenc}
43 \usepackage{booktabs}
44
45 % from faq.sty
46 \newcommand\cs[1]{\texttt{\char`\\#1}}
47 \let\csx\cs
48 \def\bsbs{\cs{\char`\\}}
49
50 % \cmdinvoke\cs<argument sequence>
51 % \cs typeset as above
52 % <argument sequence> may consist of optional or mandatory arguments;
53 %
54 % the `arguments' are simply typesett \texttt, as yet -- if something
55 % fancier is needed, there's a bunch of code needs rewriting here...
56 \DeclareRobustCommand\cmdinvoke{\@ifstar
57 {\let\@tempa\emph\@scmdinvoke}%
58 {\let\@tempa\relax\@scmdinvoke}%
59 }
60 \def\@scmdinvoke#1{\texttt{\symbol{92}#1}%
61 \futurelet\@let@token\@cmdinvoke
62 }
63 \def\@cmdinvoke{\ifx\@let@token\bgroup
64 \let\@tempb\@cmdinvoke@lbrace
65 \else
66 \ifx\@let@token[% ]
67 \let\@tempb\@cmdinvoke@lbrack
68 \else
69 \ifx\@let@token(% )
70 \let\@tempb\@cmdinvoke@lparen
71 \else
72 \let\@tempb\@empty
73 \fi
74 \fi
75 \fi
76 \@tempb
77 }
78 \def\@cmdinvoke@lbrace#1{\penalty0\hskip0pt\relax
79 \texttt{\symbol{123}\@tempa{#1}\symbol{125}}%
80 \futurelet\@let@token\@cmdinvoke
81 }
82 \def\@cmdinvoke@lbrack[#1]{\penalty-150\hskip0pt\relax
83 \texttt{[\@tempa{#1}]}%
84 \futurelet\@let@token\@cmdinvoke
85 }
86 \def\@cmdinvoke@lparen(#1){\penalty-150\hskip0pt\relax
87 \texttt{(\@tempa{#1})}%
88 \futurelet\@let@token\@cmdinvoke
89 }
90 % and extension -- versions that take a single extra (delimiter)
91 % argument, such as \delcmdinvoke{lscrunge}( ... awful syntax, but...
92 \DeclareRobustCommand\delcmdinvoke{\@ifstar
93 {\let\@tempa\emph\@sdelcmdinvoke}%
94 {\let\@tempa\relax\@sdelcmdinvoke}%
95 }
96 \def\@sdelcmdinvoke#1#2{\texttt{\symbol{92}#1#2}%
97 \futurelet\@let@token\@cmdinvoke
98 }
99
100 % sui generis
101 \newcommand\newitem{\par\addvspace{1ex}\noindent}
102
103 % inspired by doc.sty in latex distribution
104 \newcommand\meta[1]{\ensuremath{\langle}\emph{#1}\ensuremath{\rangle}}
105
106 % meaningful names, as in faq.sty
107 \newcommand\environment[1]{\texttt{#1}}
108 \newcommand\pkgoption[1]{\texttt{#1}}
109 \newcommand\extension[1]{\texttt{.#1}}
110 \newcommand\Package[1]{\textsf{#1}}
111 \def\option{\@ifnextchar[\@optionb\@option}% ]
112 \def\@optionb[#1]{{\normalfont\ttfamily[#1]}}
113 \def\@option#1{\texttt{#1}}
114
115 \let\FontName\textsf