diff options
author | Karl Berry <karl@freefriends.org> | 2019-07-16 21:13:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-07-16 21:13:53 +0000 |
commit | d2055c0169cf583fb9af2de4061319e5b31a4303 (patch) | |
tree | d83d9c6ad15e0b0d5748a0db5cc6c75cb5c1e179 /Master/texmf-dist/tex | |
parent | 444bab00733dfef06cba9e2ba93c8f63fb00a014 (diff) |
dtxdescribe (16jul19)
git-svn-id: svn://tug.org/texlive/trunk@51652 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty | 202 |
1 files changed, 144 insertions, 58 deletions
diff --git a/Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty b/Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty index 5c1d41e1ff2..d5a58b29837 100644 --- a/Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty +++ b/Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty @@ -18,7 +18,7 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{dtxdescribe} - [2019/03/22 v1.01 Describe additional object types in dtx source files.] + [2019/07/16 v1.02 Describe additional object types in source files.] @@ -93,6 +93,15 @@ + +\AtBeginDocument{ + \@ifpackageloaded{makeidx}{}{ + \@ifpackageloaded{splitidx}{}{ + \RequirePackage{makeidx} + \makeindex + }} +} + \RequirePackage{etoolbox}[2011/01/03]% \RequirePackage{xparse} @@ -112,55 +121,60 @@ \RequirePackage{xstring} \AtBeginDocument{ -\pdfstringdefDisableCommands{ -\def\quad{ } -\def\\{ } -\def\pkg#1{#1} -\def\ctr#1{#1} -\def\bool#1{#1} -\def\optn#1{#1} -\def\env#1{#1} -\def\cs#1{\textbackslash#1} -\def\,{ } -\def\LuaLaTeX{LuaLaTeX} -\def\XeLaTeX{XeLaTeX} -\def\TeX{TeX} -\def\LaTeX{LaTeX} -\def\LaTeXe{LaTeX2e} -\def\LuaTeX{LuaTeX} -\def\LuaLaTeX{LuaLaTeX} -\def\XeTeX{XeTeX} -\def\AmS{AMS} -\def\Dash{ --- } -\def\dash{ -- } -\def\Slash{/} -\def\prog#1{\detokenize{#1}} -\def\progcode#1{#1} -\def\filenm#1{\detokenize{#1}} -\def\brand#1{#1} -\def\acro#1{#1} -\def\HTML{HTML} -\def\ODT{ODT} -\def\SVG{SVG} -\def\PNG{PNG} -\def\GIF{GIF} -\def\JPG{JPG} -\def\EPS{EPS} -\def\PDF{PDF} -\def\DVI{DVI} -\def\UTF{UTF} -\def\URL{URL} -\def\element#1{#1} -\def\attribute#1{#1} -\def\HTML{HTML} -\def\HTMLfive{HTML5} -\def\CSS{CSS} -\def\CSSthree{CSS3} -\def\EPUB{EPUB} -\def\TOC{TOC} -\def\LOF{LOF} -\def\LOT{LOT} -} + \@ifpackageloaded{hyperref}{ + \pdfstringdefDisableCommands{% + \def\quad{ }% + \def\\{ }% + \def\pkg#1{#1}% + \def\ctr#1{#1}% + \def\bool#1{#1}% + \def\optn#1{#1}% + \def\env#1{#1}% + \def\cs#1{\textbackslash#1}% + \def\,{ }% + \def\LuaLaTeX{LuaLaTeX}% + \def\XeLaTeX{XeLaTeX}% + \def\TeX{TeX}% + \def\LaTeX{LaTeX}% + \def\LaTeXe{LaTeX2e}% + \def\LuaTeX{LuaTeX}% + \def\LuaLaTeX{LuaLaTeX}% + \def\XeTeX{XeTeX}% + \def\AmS{AMS}% + \def\Dash{ --- }% + \def\dash{ -- }% + \def\Slash{/}% + \def\prog#1{\detokenize{#1}}% + \def\progcode#1{#1}% + \def\filenm#1{\detokenize{#1}}% + \def\brand#1{#1}% + \def\acro#1{#1}% + \def\HTML{HTML}% + \def\ODT{ODT}% + \def\SVG{SVG}% + \def\PNG{PNG}% + \def\GIF{GIF}% + \def\JPG{JPG}% + \def\EPS{EPS}% + \def\PDF{PDF}% + \def\DVI{DVI}% + \def\UTF{UTF}% + \def\URL{URL}% + \def\element#1{#1}% + \def\attribute#1{#1}% + \def\HTML{HTML}% + \def\HTMLfive{HTML5}% + \def\CSS{CSS}% + \def\CSSthree{CSS3}% + \def\EPUB{EPUB}% + \def\TOC{TOC}% + \def\LOF{LOF}% + \def\LOT{LOT}% + } + } + { + \newcommand*{\hyperpage}[1]{#1} + } } @@ -178,21 +192,88 @@ \end{picture} } +\@ifpackageloaded{doc}{ + \newcommand*{\DTXD@gobble}{2} +}{ + \newcommand*{\DTXD@gobble}{0} +} + \setlength{\marginparsep}{1em} \setlength{\marginparpush}{.7ex} \setlength{\parindent}{0em} \setlength{\parskip}{2ex} +\ifdef{\IndexMin} + {\setlength{\IndexMin}{40ex}} + {\newlength{\IndexMin}} + +\@ifclassloaded{ltxdoc}{}{ + \def\cmd#1{\cs{\expandafter\cmd@to@cs\string#1}} + \def\cmd@to@cs#1#2{\char\number`#2\relax} + \DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}} + \providecommand\marg[1]{% + {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}} + \providecommand\oarg[1]{% + {\ttfamily[}\meta{#1}{\ttfamily]}} + \providecommand\parg[1]{% + {\ttfamily(}\meta{#1}{\ttfamily)}} + \providecommand\url{\texttt} +} -\setlength{\IndexMin}{40ex} - - +\AtBeginDocument{ + \@ifpackageloaded{doc}{}{ + \newenvironment*{macro}[1]{% + \PackageError{dtxdescribe} + {The 'macro' environment is only\MessageBreak + available when using the doc package\MessageBreak + with a .dtx source file} + {This environment only makes sense for .dtx source.} + }{} + \newenvironment*{environment}[1]{% + \PackageError{dtxdescribe} + {The 'environment' environment is only\MessageBreak + available when using the doc package\MessageBreak + with a .dtx source file} + {This environment only makes sense for .dtx source.} + }{} + \def\MacroFont{\fontencoding\encodingdefault + \fontfamily\ttdefault + \fontseries\mddefault + \fontshape\updefault + \small}% + \@ifundefined{actualchar}{\def\actualchar{@}}{} + \@ifundefined{quotechar}{\def\quotechar{"}}{} + \@ifundefined{levelchar}{\def\levelchar{!}}{} + \@ifundefined{encapchar}{\def\encapchar{|}}{} + \@ifundefined{verbatimchar}{\def\verbatimchar{+}}{} + \setlength\marginparpush{0pt} \setlength\marginparwidth{8pc} + \reversemarginpar + \DeclareRobustCommand\meta[1]{% + \ensuremath\langle + \ifmmode \expandafter \nfss@text \fi + {% + \meta@font@select + \edef\meta@hyphen@restore + {\hyphenchar\the\font\the\hyphenchar\font}% + \hyphenchar\font\m@ne + \language\l@nohyphenation + #1\/% + \meta@hyphen@restore + }\ensuremath\rangle + } + \def\meta@font@select{\itshape} + } +} + + +\providecommand*{\PrintEnvName}{} \renewcommand*{\PrintEnvName}[1] {\strut{\scriptsize{}Env}\quad\MacroFont#1\ } \newcommand*{\DTXD@printtype}[1] {\raggedleft\strut{\scriptsize\sffamily#1}\quad\MacroFont} +\providecommand{\usage}{} \renewcommand{\usage}[1]{\textit{\hyperpage{#1}}} \let\DTXD@origwrindex\@wrindex @@ -277,6 +358,7 @@ } +\providecommand*{\DescribeMacro}{} \renewcommand*{\DescribeMacro}[2][]{% \@bsphack% \@ifundefined{@captype}{% not float? @@ -305,6 +387,7 @@ \ignorespaces% } +\providecommand*{\DescribeEnv}{} \renewcommand*{\DescribeEnv}[2][] {\DTXD@margintagindex{#1}{#2}{Env}{environment}{usage}} @@ -371,6 +454,7 @@ \@bsphack% \leavevmode% \marginpar{% + \raggedleft% \ifblank{#1}{}{\raggedleft{\scriptsize[#1]} } \texttt{#2}% }% @@ -395,12 +479,14 @@ }% }% \@esphack% +\ignorespaces% } \newcommand*{\DescribeOther}[2][]{% \@ifundefined{@captype}{% not float? \@bsphack% \leavevmode% \marginpar{% + \raggedleft% \ifblank{#1}{}{\raggedleft{\scriptsize[#1]} }% #2% }% @@ -417,6 +503,7 @@ \DTXD@origwrindex{#1\actualchar[#1]:\levelchar#2\encapchar usage}% }% \@esphack% +\ignorespaces% } @@ -573,10 +660,9 @@ \newcommand*{\dtxexampleresultname}{Result:} - \NewDocumentEnvironment{dtxexample}{s +O{} m} {% start dtxexample -\VerbatimOut[gobble=2,tabsize=4]{dtxexample_cut.tex}% +\VerbatimOut[gobble=\DTXD@gobble,tabsize=4]{dtxexample_cut.tex}% }% start dtxexample {% end dtxexample \endVerbatimOut @@ -645,11 +731,11 @@ position=top, \newcommand*{\fqqquad}{\hspace*{3em}} \DefineVerbatimEnvironment{sourceverb}{Verbatim} - {gobble=2,tabsize=4,xleftmargin=2em} + {gobble=\DTXD@gobble,tabsize=4,xleftmargin=2em} \BeforeBeginEnvironment{sourceverb}{\vspace*{-.5\parskip}} -\DefineVerbatimEnvironment{fsourceverb}{Verbatim} - {gobble=2,tabsize=4,xleftmargin=2em,frame=lines} + \DefineVerbatimEnvironment{fsourceverb}{Verbatim} + {gobble=\DTXD@gobble,tabsize=4,xleftmargin=2em,frame=lines} \BeforeBeginEnvironment{fsourceverb}{\vspace*{-.5\parskip}} \newenvironment{sourcedisplay} |