diff options
author | Karl Berry <karl@freefriends.org> | 2016-12-09 22:52:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-12-09 22:52:26 +0000 |
commit | 30ed8d918cbb70e45a28309fba2e067c46d6c5d5 (patch) | |
tree | 5e32b6ae11ec75aec9614420c30431347b571dc5 /Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty | |
parent | 71acfa00b64d95aa6d981e5af4b7253a8094da30 (diff) |
dtxdescribe (9dec16)
git-svn-id: svn://tug.org/texlive/trunk@42661 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty | 385 |
1 files changed, 385 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty b/Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty new file mode 100644 index 00000000000..e6d503be509 --- /dev/null +++ b/Master/texmf-dist/tex/latex/dtxdescribe/dtxdescribe.sty @@ -0,0 +1,385 @@ +%% +%% This is file `dtxdescribe.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% dtxdescribe.dtx (with options: `package') +%% This is a generated file. +%% Copyright 2016 Brian Dunn +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. + + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{dtxdescribe} + [2016/12/08 v0.10 Describe additional object types in dtx source files.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +\RequirePackage{etoolbox}[2011/01/03]% + +\RequirePackage{xparse} + +\RequirePackage{xifthen} + +\RequirePackage{xcolor} +\definecolor{myurlcolor}{rgb}{0,0,.7} +\definecolor{mylinkcolor}{rgb}{.7,0,0} + +\RequirePackage{caption} + +\RequirePackage{newfloat} + +\RequirePackage{fancyvrb} + +\RequirePackage{xstring} + + + + +\RequirePackage{pict2e} +\setlength{\unitlength}{1pt} + +\newcommand*{\warningsign}{% +\begin{picture}(10,9) +\put(4,1){\scriptsize!} +\put(0,0){\line(500,866){5}} +\put(10,0){\line(-500,866){5}} +\put(0,0){\line(1,0){10}} +\end{picture} +} + + +\renewcommand*{\PrintEnvName}[1] +{\strut{\scriptsize{}Env}\quad\MacroFont#1\ } + +\newcommand*{\DTXD@printtype}[1] +{\raggedleft\strut{\scriptsize#1}\quad\MacroFont} + +\renewcommand{\usage}[1]{\textit{\hyperpage{#1}}} + +\let\DTXD@origwrindex\@wrindex + +\newcommand*{\DTXD@margintag}[3]{% +\@ifundefined{@captype}{% not float? +\leavevmode% +\marginpar{% +\DTXD@printtype{% +#3% margintag +\ifblank{#1}{}{ \texttt{#1}}% class +}% Desc@Type +\texttt{#2}% name +}% marginpar +}{}% not float? +} + +\newcommand*{\DTXD@index}[5]{% +\@bsphack% +\begingroup% +\DTXD@origwrindex{% +#2\actualchar{\protect\ttfamily#2} % name +(#4)% index tag +\ifblank{#1}{}{ [#1]}% class +\encapchar #5}% +\begingroup% +\DTXD@origwrindex{% +#4s:\levelchar% index tag +\ifblank{#1}{}{[#1]:\levelchar}% class +#2\actualchar{\protect\ttfamily#2}% name +\encapchar #5}% +\ifblank{#1}{}{% class given +\begingroup% +\DTXD@origwrindex{% +#1\actualchar[#1]:\levelchar% class +#2\actualchar{\protect\ttfamily#2} % name +(#4)% index tag +\encapchar #5}% +}% class given +\@esphack% +\ignorespaces% +} + +\newcommand*{\DTXD@margintagindex}[5]{% +\DTXD@margintag{#1}{#2}{#3}% +\DTXD@index{#1}{#2}{#3}{#4}{#5}% +} +\begingroup\lccode`\|=`\\ +\lowercase{\endgroup\def\removebs#1{\if#1|\else#1\fi}} +\newcommand*{\DTXD@macroname}[1]{\expandafter\removebs\string#1} + +\newcommand*{\DTXD@verbatimcmd}[1]{% +\string\verb\quotechar*\verbatimchar\string#1\verbatimchar% +} + +\newcommand*{\DTXD@cmdmargintagindex}[5]{% +\@bsphack% +\@ifundefined{@captype}{% not float? +\leavevmode% +\marginpar{% +\DTXD@printtype{% +#3% margin tag +\ifblank{#1}{}{ \texttt{#1}}% class +}% Desc@Type +\cmd{#2}% name +}% marginpar +}{}% not float? +\begingroup% +\DTXD@origwrindex{% +\ifblank{#1}{}{#1\actualchar[#1]:\levelchar}% class +\DTXD@macroname{#2}\actualchar\DTXD@verbatimcmd{#2} % name +(#4)% index tag +\encapchar #5}% +\begingroup% +\DTXD@origwrindex{% +#4s:\levelchar% index tag +\ifblank{#1}{}{[#1]:\levelchar}% class +\DTXD@verbatimcmd{#2}% name +\encapchar #5}% +\@esphack% +\ignorespaces% +} + + + +\renewcommand*{\DescribeMacro}[2][]{% +\@bsphack% +\@ifundefined{@captype}{% not float? +\leavevmode% +\marginpar{% +\raggedleft% +\ifblank{#1}{}{{\scriptsize#1} }% class +\cmd{#2}% name +}% marginpar +}{}% not float? +\begingroup% +\DTXD@origwrindex{% +\DTXD@macroname{#2}\actualchar\DTXD@verbatimcmd{#2}% name +\ifblank{#1}{}{\levelchar[#1]}% class +\encapchar usage}% +\ifthenelse{\isempty{#1}}% +{}% no class +{% class given +\begingroup% +\DTXD@origwrindex{% +#1\actualchar[#1]:\levelchar% +\DTXD@macroname{#2}\actualchar\DTXD@verbatimcmd{#2}% +\encapchar usage}% +}% class given +\@esphack% +\ignorespaces% +} + +\renewcommand*{\DescribeEnv}[2][] +{\DTXD@margintagindex{#1}{#2}{Env}{environment}{usage}} + + +\newcommand*{\DTXD@filename}{} + +\newcommand*{\DTXD@filemarginparindex}[5]{% +\renewcommand{\DTXD@filename}{\detokenize{#2}}% +\StrSubstitute{\DTXD@filename}% +{\detokenize{_}}{\detokenize{\_}}[\DTXD@filename]% +\DTXD@margintag{}{#2}{#3}% +\DTXD@index{#1}{\DTXD@filename}{#3}{#4}{#5}% +\endgroup% +\ignorespaces% +} +\newcommand*{\DTXD@DescribeFile}[2][]{% +\DTXD@filemarginparindex{#1}{#2}{File}{file}{usage}% +} +\newcommand*{\DescribeFile}{% +\begingroup\catcode`\_=12 \DTXD@DescribeFile% +} +\newcommand*{\DTXD@DescribeProgram}[2][]{% +\DTXD@filemarginparindex{#1}{#2}{Prog}{program}{usage}% +} +\newcommand*{\DescribeProgram}{% +\begingroup\catcode`\_=12 \DTXD@DescribeProgram% +} + +\newcommand*{\DTXD@DescribeCommand}[2][]{% +\DTXD@filemarginparindex{#1}{#2}{Cmd}{command}{usage}% +} +\newcommand*{\DescribeCommand}{% +\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*{\DescribeOption}[2][] +{\DTXD@margintagindex{#1}{#2}{Opt}{option}{usage}} +\newcommand*{\DescribeArgument}[2][] +{\DTXD@margintagindex{#1}{#2}{Arg}{argument}{usage}} +\newcommand*{\DescribeBoolean}[2][] +{\DTXD@margintagindex{#1}{#2}{Bool}{boolean}{usage}} +\newcommand*{\DescribeLength}[2][] +{\DTXD@cmdmargintagindex{#1}{#2}{Len}{length}{usage}} +\newcommand*{\DescribeCounter}[2][] +{\DTXD@margintagindex{#1}{#2}{Ctr}{counter}{usage}} +\newcommand*{\DescribeKey}[2][] +{\DTXD@margintagindex{#1}{#2}{Key}{key}{usage}} +\newcommand*{\DescribeObject}[2][]{% +\@ifundefined{@captype}{% not float? +\@bsphack% +\leavevmode\marginpar{\raggedleft{\scriptsize#1} \texttt{#2}}% +}{}% not float? +\ifthenelse{\isempty{#1}} +{\begingroup% +\DTXD@origwrindex{% +#2\actualchar{\protect\ttfamily#2}% +\encapchar usage% +}% +}% +{% +\begingroup% +\DTXD@origwrindex{% +#2\actualchar{\protect\ttfamily#2} [#1]% +\encapchar usage% +}% +\begingroup% +\DTXD@origwrindex{% +#1\actualchar[#1]:\levelchar#2\actualchar{\protect\ttfamily#2}% +\encapchar usage% +}% +}% +\@esphack% +} +\newcommand*{\DescribeOther}[2][]{% +\@ifundefined{@captype}{% not float? +\@bsphack% +\leavevmode\marginpar{\raggedleft{\scriptsize#1} #2}% +}{}% not float? +\ifthenelse{\isempty{#1}} +{% +\begingroup% +\DTXD@origwrindex{#2\encapchar usage}% +}% +{% +\begingroup% +\DTXD@origwrindex{#2 [#1]\encapchar usage}% +\begingroup% +\DTXD@origwrindex{#1\actualchar[#1]:\levelchar#2\encapchar usage}% +}% +\@esphack% +} + + +\newcommand{\margintag}[1]{% +\@ifundefined{@captype}{% not float? +\marginpar{\raggedleft\textcolor{blue!70!black}{#1}}% +\ignorespaces% +}{}% not float? +} + +\newcommand{\watchout}[1][]{% +\@ifundefined{@captype}{% not float? +\marginpar{\hspace*{\fill}% +\textcolor{red!50!black}{\warningsign\normalsize\quad#1}}% +\ignorespaces% +}{}% not float? +} + + +\definecolor{DTXD@examplerulecolor}{rgb}{.9,.9,.9} + + +\NewDocumentEnvironment{dtxexample}{s +O{} m} +{% start dtxexample +\VerbatimOut[gobble=2,tabsize=4]{ex_cut.tex}% +}% start dtxexample +{% end dtxexample +\endVerbatimOut +\par +\addvspace{\bigskipamount} +\IfBooleanTF{#1}{\vspace{\bigskipamount}}{\minipage{\linewidth}}% +\captionsetup{type=dtxdexample}% +\hrule\medskip +\caption{#3} +\textcolor{DTXD@examplerulecolor}{\smallskip\hrule} +\smallskip +{\scriptsize\itshape Code:} +\VerbatimInput[tabsize=4]{ex_cut.tex} +\unskip +\textcolor{DTXD@examplerulecolor}{\hrule} +\smallskip +{\scriptsize\itshape Result:} + +\ifstrempty{#2} +{} +{{\itshape\small #2}} +\IfBooleanTF{#1}{}{\endminipage}% +} % end dtxexample + +\AfterEndEnvironment{dtxexample} +{% +\par\unskip\input{ex_cut.tex}% +\medskip\hrule% +} + +\DeclareFloatingEnvironment[ +fileext=lox, +listname={List of Examples}, +name=Example, +placement=hbp +]{dtxdexample} + +\captionsetup*[dtxdexample]{ +format=hang, +font=bf, +justification=raggedright, +singlelinecheck=false, +skip=0pt, +position=top, +} + +\AtBeginDocument{ +\@ifpackageloaded{cleveref}{\crefname{dtxdexample}{example}{examples}}{} +} + + +\endinput +%% +%% End of file `dtxdescribe.sty'. |