From 4d0cb3164bdec74c01f560fe6fa184314ac063d7 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 12 Jan 2019 23:07:09 +0000 Subject: dtxdescribe (12jan19) git-svn-id: svn://tug.org/texlive/trunk@49682 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/dtxdescribe/dtxdescribe.sty | 428 +++++++++++++++++++-- 1 file changed, 405 insertions(+), 23 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty b/Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty index 359c83d3342..06933159d97 100644 --- a/Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty +++ b/Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty @@ -19,7 +19,44 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{dtxdescribe} - [2018/03/30 v0.11 Describe additional object types in dtx source files.] + [2019/01/11 v1.00 Describe additional object types in dtx source files.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -90,12 +127,20 @@ \end{picture} } +\setlength{\marginparsep}{1em} +\setlength{\marginparpush}{.7ex} + +\setlength{\parindent}{0em} +\setlength{\parskip}{2ex} + +\setlength{\IndexMin}{40ex} + \renewcommand*{\PrintEnvName}[1] {\strut{\scriptsize{}Env}\quad\MacroFont#1\ } \newcommand*{\DTXD@printtype}[1] -{\raggedleft\strut{\scriptsize#1}\quad\MacroFont} +{\raggedleft\strut{\scriptsize\sffamily#1}\quad\MacroFont} \renewcommand{\usage}[1]{\textit{\hyperpage{#1}}} @@ -107,7 +152,7 @@ \marginpar{% \DTXD@printtype{% #3% margintag -\ifblank{#1}{}{ \texttt{#1}}% class +\ifblank{#1}{}{ #1}% class }% Desc@Type \texttt{#2}% name }% marginpar @@ -159,7 +204,7 @@ \marginpar{% \DTXD@printtype{% #3% margin tag -\ifblank{#1}{}{ \texttt{#1}}% class +\ifblank{#1}{}{ #1}% class }% Desc@Type \cmd{#2}% name }% marginpar @@ -187,7 +232,7 @@ \leavevmode% \marginpar{% \raggedleft% -\ifblank{#1}{}{{\scriptsize#1} }% class +\ifblank{#1}{}{{\scriptsize\textsf{#1}} }% class \cmd{#2}% name }% marginpar }{}% not float? @@ -196,7 +241,7 @@ \DTXD@macroname{#2}\actualchar\DTXD@verbatimcmd{#2}% name \ifblank{#1}{}{\levelchar[#1]}% class \encapchar usage}% -\ifthenelse{\isempty{#1}}% +\ifblank{#1}% {}% no class {% class given \begingroup% @@ -219,7 +264,7 @@ \renewcommand{\DTXD@filename}{\detokenize{#2}}% \StrSubstitute{\DTXD@filename}% {\detokenize{_}}{\detokenize{\_}}[\DTXD@filename]% -\DTXD@margintag{}{#2}{#3}% +\DTXD@margintag{#1}{#2}{#3}% \DTXD@index{#1}{\DTXD@filename}{#3}{#4}{#5}% \endgroup% \ignorespaces% @@ -244,10 +289,20 @@ \begingroup\catcode`\_=12 \DTXD@DescribeCommand% } -\newcommand*{\DescribePackage}[2][] -{\DTXD@margintagindex{#1}{#2}{Pkg}{package}{usage}} -\newcommand*{\DescribeClass}[2][] -{\DTXD@margintagindex{#1}{#2}{Cls}{class}{usage}} +\newcommand*{\DTXD@DescribePackage}[2][]{% +\DTXD@filemarginparindex{#1}{#2}{Pkg}{package}{usage}% +} +\newcommand*{\DescribePackage}{% +\begingroup\catcode`\_=12 \DTXD@DescribePackage% +} + +\newcommand*{\DTXD@DescribeClass}[2][]{% +\DTXD@filemarginparindex{#1}{#2}{Cls}{class}{usage}% +} +\newcommand*{\DescribeClass}{% +\begingroup\catcode`\_=12 \DTXD@DescribeClass% +} + \newcommand*{\DescribeOption}[2][] {\DTXD@margintagindex{#1}{#2}{Opt}{option}{usage}} \newcommand*{\DescribeArgument}[2][] @@ -265,7 +320,7 @@ \@bsphack% \leavevmode\marginpar{\raggedleft{\scriptsize#1} \texttt{#2}}% }{}% not float? -\ifthenelse{\isempty{#1}} +\ifblank{#1}% {\begingroup% \DTXD@origwrindex{% #2\actualchar{\protect\ttfamily#2}% @@ -291,7 +346,7 @@ \@bsphack% \leavevmode\marginpar{\raggedleft{\scriptsize#1} #2}% }{}% not float? -\ifthenelse{\isempty{#1}} +\ifblank{#1}% {% \begingroup% \DTXD@origwrindex{#2\encapchar usage}% @@ -306,28 +361,163 @@ } +\newcommand*{\DescribeDefaultcolor}{green!50!black} + +\newcommand{\DescribeDefault}[1]{% + \margintag{% + \footnotesize% + \textcolor{\DescribeDefaultcolor}{% + Default: \texttt{#1}% + }% + }% +} + +\newcommand{\ItemDescribeMacro}[2][]{% +\item[\cmd{#2}:]% +\setlength{\parskip}{1.5ex}% +\DescribeMacro[#1]{#2}% +} + +\newcommand{\ItemDescribeEnv}[2][]{% +\item[\env{#2}:]% +\setlength{\parskip}{1.5ex}% +\DescribeEnv[#1]{#2}% +} + +\newcommand{\ItemDescribeArgument}[2][]{% +\item[\texttt{#2}:]% +\setlength{\parskip}{1.5ex}% +\DescribeArgument[#1]{#2}% +} + +\newcommand{\ItemDescribeBoolean}[2][]{% +\item[\texttt{#2}:]% +\setlength{\parskip}{1.5ex}% +\DescribeBoolean[#1]{#2}% +} + +\newcommand{\ItemDescribeLength}[2][]{% +\item[\cmd{#2}:]% +\setlength{\parskip}{1.5ex}% +\DescribeLength[#1]{#2}% +} + +\newcommand{\ItemDescribeCounter}[2][]{% +\item[\texttt{#2}:]% +\setlength{\parskip}{1.5ex}% +\DescribeCounter[#1]{#2}% +} + +\newcommand{\ItemDescribeKey}[2][]{% +\item[\texttt{#2}:]% +\setlength{\parskip}{1.5ex}% +\DescribeKey[#1]{#2}% +} + +\newcommand{\DTXD@ItemDescribePackage}[2][]{% +\item[\texttt{#2}:]% +\setlength{\parskip}{1.5ex}% +\DescribePackage[#1]{#2}% +\endgroup +} + +\newcommand{\ItemDescribePackage}{% +\begingroup\catcode`\_=12 \DTXD@ItemDescribePackage% +} + +\newcommand{\DTXD@ItemDescribeClass}[2][]{% +\item[\texttt{#2}:]% +\setlength{\parskip}{1.5ex}% +\DescribeClass[#1]{#2}% +\endgroup +} + +\newcommand{\ItemDescribeClass}{% +\begingroup\catcode`\_=12 \DTXD@ItemDescribeClass% +} + +\newcommand{\ItemDescribeOption}[2][]{% +\item[\texttt{#2}:]% +\setlength{\parskip}{1.5ex}% +\DescribeOption[#1]{#2}% +} + +\newcommand{\DTXD@ItemDescribeFile}[2][]{% +\item[\texttt{#2}:]% +\setlength{\parskip}{1.5ex}% +\DescribeFile[#1]{#2}% +\endgroup +} + +\newcommand{\ItemDescribeFile}{% +\begingroup\catcode`\_=12 \DTXD@ItemDescribeFile% +} + +\newcommand{\DTXD@ItemDescribeProgram}[2][]{% +\item[\texttt{#2}:]% +\setlength{\parskip}{1.5ex}% +\DescribeProgram[#1]{#2}% +\endgroup +} + +\newcommand{\ItemDescribeProgram}{% +\begingroup\catcode`\_=12 \DTXD@ItemDescribeProgram% +} + +\newcommand{\DTXD@ItemDescribeCommand}[2][]{% +\item[\texttt{#2}:]% +\setlength{\parskip}{1.5ex}% +\DescribeCommand[#1]{#2}% +\endgroup +} + +\newcommand{\ItemDescribeCommand}{% +\begingroup\catcode`\_=12 \DTXD@ItemDescribeCommand% +} + +\newcommand{\ItemDescribeObject}[2][]{% +\item[\texttt{#2}:]% +\setlength{\parskip}{1.5ex}% +\DescribeObject[#1]{#2}% +} + +\newcommand{\ItemDescribeOther}[2][]{% +\item[\texttt{#2}:]% +\setlength{\parskip}{1.5ex}% +\DescribeOther[#1]{#2}% +} + + +\newcommand*{\margintagcolor}{blue!70!black} + \newcommand{\margintag}[1]{% \@ifundefined{@captype}{% not float? -\marginpar{\raggedleft\textcolor{blue!70!black}{#1}}% +\marginpar{\raggedleft\textcolor{\margintagcolor}{#1}}% \ignorespaces% }{}% not float? } +\newcommand*{\watchoutcolor}{red!50!black} + \newcommand{\watchout}[1][]{% \@ifundefined{@captype}{% not float? -\marginpar{\raggedleft% -\textcolor{red!50!black}{\warningsign\normalsize\quad#1}}% -\ignorespaces% + \marginpar{% + \raggedleft% + \textcolor{\watchoutcolor}{\warningsign\normalsize\quad#1}% + }% + \ignorespaces% }{}% not float? } - \definecolor{DTXD@examplerulecolor}{rgb}{.9,.9,.9} +\newcommand*{\dtxexamplecodename}{Code:} + +\newcommand*{\dtxexampleresultname}{Result:} \NewDocumentEnvironment{dtxexample}{s +O{} m} {% start dtxexample -\VerbatimOut[gobble=2,tabsize=4]{ex_cut.tex}% +\VerbatimOut[gobble=2,tabsize=4]{dtxexample_cut.tex}% }% start dtxexample {% end dtxexample \endVerbatimOut @@ -339,12 +529,12 @@ \caption{#3} \textcolor{DTXD@examplerulecolor}{\smallskip\hrule} \smallskip -{\scriptsize\itshape Code:} -\VerbatimInput[tabsize=4]{ex_cut.tex} +{\scriptsize\itshape\dtxexamplecodename} +\VerbatimInput[tabsize=4]{dtxexample_cut.tex} \unskip \textcolor{DTXD@examplerulecolor}{\hrule} \smallskip -{\scriptsize\itshape Result:} +{\scriptsize\itshape\dtxexampleresultname} \ifstrempty{#2} {} @@ -354,7 +544,7 @@ \AfterEndEnvironment{dtxexample} {% -\par\unskip\input{ex_cut.tex}% +\par\unskip\input{dtxexample_cut.tex}% \medskip\hrule% } @@ -378,6 +568,198 @@ position=top, \@ifpackageloaded{cleveref}{\crefname{dtxdexample}{example}{examples}}{} } +\newenvironment{noindmacro}[1] +{ + \setlength{\parskip}{\marginparpush} + \leavevmode\par\DTXD@margintag{}{\cmd{#1}}{} +} +{\unskip} +\newenvironment{noindenvironment}[1] +{ + \setlength{\parskip}{\marginparpush} + \leavevmode\par\DTXD@margintag{}{#1}{Env} +} +{\unskip} +\newcommand*{\fquad}{\hspace*{1em}} + +\newcommand*{\fqquad}{\hspace*{2em}} + +\newcommand*{\fqqquad}{\hspace*{3em}} +\DefineVerbatimEnvironment{sourceverb}{Verbatim} + {gobble=2,tabsize=4,xleftmargin=2em} +\BeforeBeginEnvironment{sourceverb}{\vspace*{-.5\parskip}} + +\DefineVerbatimEnvironment{fsourceverb}{Verbatim} + {gobble=2,tabsize=4,xleftmargin=2em,frame=lines} +\BeforeBeginEnvironment{fsourceverb}{\vspace*{-.5\parskip}} + +\newenvironment{sourcedisplay} +{ + \leavevmode + \par + \fqquad\minipage{\linewidth-2em} + \ttfamily +} +{% + \endminipage + \par +} + +\newenvironment{UIdisplay} +{ + \leavevmode + \par + \fqquad\minipage{\linewidth-2em} + \sffamily\bfseries +} +{ + \endminipage + \par +} + +\newcommand*{\userentryname}{Enter~$\Rightarrow$} + +\newcommand{\userentry}[1]{% +\par +\fqquad% +\begin{minipage}{\linewidth-2em} + {\footnotesize \userentryname}\quad\cmds{#1} +\end{minipage} +\par +} + +\newenvironment{docsidebar}[1][] +{% + \quote\unskip\medskip + \setlength{\parskip}{1.5ex}% + \ifblank{#1}{}{\textit{#1}\newline}% + \rule[.5\bigskipamount]{\linewidth}{.4pt}% + \newline% +} +{% + \leavevmode\par + \rule[\bigskipamount]{\linewidth}{.4pt} + \endquote\unskip +} +\providerobustcmd*{\pkg}[1]{\mbox{\textsf{#1}}} + +\providerobustcmd*{\env}[1]{\mbox{\texttt{#1}}} + +\providerobustcmd*{\ctr}[1]{\mbox{\texttt{#1}}} + +\providerobustcmd*{\bool}[1]{\mbox{\texttt{#1}}} + +\providerobustcmd*{\optn}[1]{\mbox{\texttt{#1}}} + +\providerobustcmd*{\TOC}{\acro{TOC}} + +\providerobustcmd*{\LOF}{\acro{LOF}} + +\providerobustcmd*{\LOT}{\acro{LOT}} + + +\providerobustcmd*{\cmds}[1]{\mbox{\textbf{\texttt{#1}}}} + +\providerobustcmd*{\progcode}[1]{\mbox{\texttt{#1}}} + +\newcommand*{\DTXD@prog}[1]{% + \mbox{\textsf{\textsl{\detokenize{#1}}}}% + \endgroup% +} + +\providerobustcmd*{\prog}{% + \begingroup% + \catcode`\_=12% + \DTXD@prog% +} + +\newcommand*{\DTXD@filenm}[1]{% + \mbox{\texttt{\detokenize{#1}}}% + \endgroup% +} + +\providerobustcmd*{\filenm}{% + \begingroup% + \catcode`\_=12% + \DTXD@filenm% +} + +\providerobustcmd*{\UI}[1]{\textbf{\textsf{#1}}} +\providerobustcmd*{\ODT}{\acro{ODT}} + +\providerobustcmd*{\SVG}{\acro{SVG}} + +\providerobustcmd*{\PNG}{\acro{PNG}} + +\providerobustcmd*{\GIF}{\acro{GIF}} + +\providerobustcmd*{\JPG}{\acro{JPG}} + +\providerobustcmd*{\EPS}{\acro{EPS}} + +\providerobustcmd*{\PDF}{\acro{PDF}} + +\providerobustcmd*{\DVI}{\acro{DVI}} +\providerobustcmd*{\UTF}{\acro{UTF}} + +\providerobustcmd*{\URL}{\acro{URL}} + +\providerobustcmd*{\element}[1]{\texttt{<#1>}} + +\providerobustcmd*{\attribute}[1]{\mbox{\texttt{#1}}} + +\providerobustcmd*{\HTML}{\acro{HTML}} + +\providerobustcmd*{\HTMLfive}{\HTML\textsc{5}} + +\providerobustcmd*{\CSS}{\acro{CSS}} + +\providerobustcmd*{\CSSthree}{\CSS\textsc{3}} + +\providerobustcmd*{\EPUB}{\acro{EPUB}} +\providerobustcmd*{\tikz}{Ti\textit{k}z} + +\providerobustcmd*{\MathML}{Math\acro{ML}} + +\providerobustcmd*{\CTAN}{\acro{CTAN}} + +\providerobustcmd*{\TDS}{\acro{TDS}} +\providerobustcmd*{\brand}[1]{\textsc{#1}} + +\providerobustcmd*{\acro}[1]{\textsc{\lowercase{#1}}} + +\providerobustcmd*{\supregistered}{\textsuperscript{\textregistered}} +\providerobustcmd*{\LuaTeX}{\mbox{Lua\TeX}} +\providerobustcmd*{\LuaLaTeX}{\mbox{Lua\LaTeX}} +\providerobustcmd*{\XeTeXrevE} + {\hspace{-.1667em}\raisebox{-.5ex}{E}\hspace{-.125em}} + +\AtBeginDocument{ +\@ifpackageloaded{graphics}{ + \renewrobustcmd*{\XeTeXrevE} + {\hspace{-.1667em}\raisebox{-.5ex}{\reflectbox{E}}\hspace{-.125em}} +}{} +} + +\providerobustcmd*{\XeTeX}{\mbox{X\XeTeXrevE\TeX}} +\providerobustcmd*{\XeLaTeX}{\mbox{X\XeTeXrevE\LaTeX}} +\providerobustcmd*{\AmS}{% + \leavevmode\hbox{$\mathcal A\kern-.2em\lower.376ex% + \hbox{$\mathcal M$}\kern-.2em\mathcal S$}% +} +\providerobustcmd*{\LyX}{\textsf{LyX}} +\providerobustcmd*{\BibTeX}{\mbox{B\textsc{ib}\TeX}} +\providerobustcmd*{\MakeIndex}{\prog{MakeIndex}} +\providerobustcmd*{\ConTeXt}{\mbox{Con\TeX{}t}} +\providerobustcmd*{\MiKTeX}{\mbox{MiK\TeX}} +\DeclareRobustCommand{\thinskip}{\hskip 0.16667em\relax} +\def\endash{–} +\def\emdash{—} +\newcommand{\thinbrspace}{\hspace{.16667em}\penalty\exhyphenpenalty\hspace{0pt}} +\newcommand{\thinthinbrspace}{\hspace{.08333em}\penalty\exhyphenpenalty\hspace{0pt}} +\newrobustcmd{\Dash}{\unskip\thinspace\emdash\thinbrspace} +\newrobustcmd{\dash}{\unskip\thinspace\endash\thinbrspace} +\newrobustcmd{\Slash}{\unskip\hspace{.08333em}/\thinthinbrspace} \endinput %% -- cgit v1.2.3