| 1 |
%% $Id: hvdoctools.sty 559 2022-05-27 06:59:29Z herbert $ |
| 2 |
%% |
| 3 |
%% This file is distributed under the terms of the LaTeX Project Public |
| 4 |
%% License from CTAN archives in directory macros/latex/base/lppl.txt. |
| 5 |
%% Either version 1.3 or, at your option, any later version. |
| 6 |
%% |
| 7 |
% Copyright 2019 Herbert Voss [email protected] |
| 8 |
%% |
| 9 |
\ProvidesPackage{hvdoctools}[% |
| 10 |
2019/11/27 v.0.01 (Herbert Voss) macros for package documentation (hv)] |
| 11 |
% |
| 12 |
\NeedsTeXFormat{LaTeX2e} |
| 13 |
|
| 14 |
\RequirePackage{makeidx}\makeindex |
| 15 |
|
| 16 |
\def\Lfile#1{\texttt{#1}\index{#1@\texttt{#1} (file)}} |
| 17 |
\def\Lext#1{\texttt{.#1}\index{#1@\texttt{.#1} (file extension)}} |
| 18 |
\def\Ldim#1{\texttt{\textbackslash#1}\index{#1@\texttt{\textbackslash#1} (length)}} |
| 19 |
\def\Lcs#1{\texttt{\textbackslash#1}\index{#1@\texttt{\textbackslash#1}}} |
| 20 |
\def\nxLcs#1{\texttt{\textbackslash#1}} |
| 21 |
\def\Lenv#1{\texttt{#1}\index{#1@\texttt{#1} (environment)}} |
| 22 |
\def\Lpack#1{\texttt{#1}\index{#1@\texttt{#1} (package)}} |
| 23 |
\let\LPack\Lpack |
| 24 |
\def\Lprog#1{\texttt{#1}\index{#1@\texttt{#1} (program)}} |
| 25 |
\def\Lcolor#1{\texttt{#1}\index{#1@\texttt{#1} (color)}} |
| 26 |
\def\Loption#1{\texttt{#1}\index{#1@\texttt{#1} (package option)}} |
| 27 |
\def\Lkeyword#1{\texttt{#1}\index{#1@\texttt{#1} (keyword)}\index{Keyword!#1@\texttt{#1}}} |
| 28 |
\def\Lkeyval#1{\texttt{#1}\index{#1@\texttt{#1} (value)}} |
| 29 |
\def\Lskip#1{\texttt{\textbackslash#1}\index{#1@\texttt{\textbackslash#1} (skip)}} |
| 30 |
\def\Lkeyset#1{\expandafter\Lkeyset@i#1\@nil} |
| 31 |
\def\Lkeyset@i#1=#2\@nil{\texttt{#1=#2}% |
| 32 |
\index{#1@\texttt{#1} (keyword)}\index{Keyword!#1@\texttt{#1}} |
| 33 |
\index{#2@\texttt{#2} (value)}\index{Value!#2@\texttt{#2}}} |
| 34 |
|
| 35 |
\def\LKeyset#1{\expandafter\LKeyset@i#1\@nil} |
| 36 |
\def\LKeyset@i#1=#2\@nil{\texttt{#1=#2}% |
| 37 |
\index{#1@\texttt{#1} (keyword)}\index{Keyword!#1@\texttt{#1}}} |
| 38 |
\newsavebox\boxdef |
| 39 |
\newenvironment{BDef} |
| 40 |
{\begin{lrbox}{\boxdef} |
| 41 |
\def\arraystretch{1.0} |
| 42 |
\begin{tabular}{@{}l@{}l@{}l@{}}} |
| 43 |
{\end{tabular}\end{lrbox} |
| 44 |
{\BCmd\fbox{\usebox\boxdef}\endBCmd} |
| 45 |
\aftergroup\@afterindentfalse\aftergroup\@afterheading |
| 46 |
} |
| 47 |
\def\Lclass#1{\texttt{#1}\index{#1@\texttt{#1} (doc class)}} |
| 48 |
|
| 49 |
\newskip\BDefaboveskip |
| 50 |
\newskip\BDefbelowskip |
| 51 |
\newskip\BDefinlineskip |
| 52 |
\setlength\BDefaboveskip{0pt plus 2pt}% first-level list topsep |
| 53 |
\setlength\BDefbelowskip{10pt} |
| 54 |
\setlength\BDefinlineskip{6pt} |
| 55 |
|
| 56 |
\newenvironment{BCmd}{ |
| 57 |
\@beginparpenalty-\@lowpenalty |
| 58 |
\topsep\BDefaboveskip |
| 59 |
\fboxsep3pt |
| 60 |
\flushleft} |
| 61 |
{\@endparpenalty\@M |
| 62 |
\@topsepadd\BDefbelowskip |
| 63 |
\endflushleft} |
| 64 |
|
| 65 |
\newenvironment{BCmd*}{% |
| 66 |
\@beginparpenalty\@M |
| 67 |
\topsep\BDefinlineskip |
| 68 |
\fboxsep3pt |
| 69 |
\flushleft} |
| 70 |
{\@endparpenalty5000 |
| 71 |
\endflushleft} |
| 72 |
|
| 73 |
\def\OptArgs{\colorbox{black!20}{\texttt{[Options]}}\kern1pt} |
| 74 |
\def\OptArg{\@ifnextchar*\OptArg@i{\OptArg@ii*}}% star version without braces |
| 75 |
\def\OptArg@i*#1{\colorbox{black!20}{\texttt{#1}}\kern1pt} |
| 76 |
\def\OptArg@ii*#1{\colorbox{black!20}{\texttt{[#1]}}\kern1pt} |
| 77 |
\def\DBS{{\ttfamily\textbackslash\textbackslash}} |
| 78 |
|
| 79 |
\newcommand\Larg [1]{{\normalfont\itshape#1\/}} |
| 80 |
\newcommand\Larga[1]{$\langle$\Larg{#1}$\rangle$}% angles |
| 81 |
\newcommand\Largb[1]{\lcb\Larg{#1}\rcb} % curly brace |
| 82 |
\newcommand\Largs[1]{\lsb\Larg{#1}\rsb} % square brackets |
| 83 |
\newcommand\Largr[1]{\lrb\Larg{#1}\rrb} % round brackets |
| 84 |
\newcommand\LBEG[1]{{\normalfont\ttfamily\bs{}begin\lcb#1\rcb}\xLenv{#1}} |
| 85 |
\newcommand\LmBEG[1]{{\normalfont\ttfamily\bs{}begin\lcb#1\rcb}\xLmenv{#1}} |
| 86 |
\newcommand\LEND[1]{{\normalfont\ttfamily\bs{}end\lcb#1\rcb}\xLenv{#1}} |
| 87 |
\newcommand\LmEND[1]{{\normalfont\ttfamily\bs{}end\lcb#1\rcb}\xLmenv{#1}} |
| 88 |
|
| 89 |
\DeclareRobustCommand\bs{{\normalfont\ttfamily\textbackslash}} % \let\bslash=\bs |
| 90 |
\DeclareRobustCommand\lcb{{\normalfont\ttfamily\textbraceleft}} |
| 91 |
\DeclareRobustCommand\rcb{{\normalfont\ttfamily\textbraceright}} |
| 92 |
\DeclareRobustCommand\lsb{{\normalfont\ttfamily[}} |
| 93 |
\DeclareRobustCommand\rsb{{\normalfont\ttfamily]}} |
| 94 |
\DeclareRobustCommand\lrb{{\normalfont\ttfamily(}} |
| 95 |
\DeclareRobustCommand\rrb{{\normalfont\ttfamily)}} |
| 96 |
\DeclareRobustCommand\false{{\ttfamily false}} |
| 97 |
\DeclareRobustCommand\true{{\ttfamily true}} |
| 98 |
|
| 99 |
|
| 100 |
\endinput |