From 556dfa7ef108ed2946da8b8f32106f881d064ce9 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sun, 19 May 2019 21:26:20 +0000
Subject: rgltxdoc (19may19)

git-svn-id: svn://tug.org/texlive/trunk@51166 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/rgltxdoc/rgltxdoc.sty | 61 +++++++++++++++++++----
 1 file changed, 52 insertions(+), 9 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/rgltxdoc/rgltxdoc.sty')

diff --git a/Master/texmf-dist/tex/latex/rgltxdoc/rgltxdoc.sty b/Master/texmf-dist/tex/latex/rgltxdoc/rgltxdoc.sty
index d750caa078d..df61ef9f4ff 100644
--- a/Master/texmf-dist/tex/latex/rgltxdoc/rgltxdoc.sty
+++ b/Master/texmf-dist/tex/latex/rgltxdoc/rgltxdoc.sty
@@ -20,7 +20,7 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
 \ProvidesPackage{rgltxdoc}
-    [2019/01/05 v1 Common documentation code used for Richard Grewe's packages]
+    [2019/05/04 v1.2 Common documentation code used for Richard Grewe's packages]
 \RequirePackage{ifluatex}
 \RequirePackage{etoolbox}
 \ifbool{luatex}{
@@ -29,7 +29,8 @@
   \setmainlanguage[variant=american]{english}
 }{
   \RequirePackage[utf8]{inputenc}
-  \RequirePackage[english]{babel}
+  \@ifpackageloaded{babel}{}
+    {\RequirePackage[english]{babel}}
 }
 \RequirePackage[a4paper,twoside=false]{geometry}
 \RequirePackage[DIV=9,BCOR=2.25cm]{typearea}
@@ -47,9 +48,9 @@
   \DeclareFontShape{T1}{lmtt}{m}{it}{<->sub*lmtt/m/sl}{}
 }
 \RequirePackage{microtype}
-\RequirePackage{csquotes}
+\RequirePackage[autostyle=true]{csquotes}
 \MakeOuterQuote{"}
-\RequirePackage{enumitem}
+\RequirePackage[inline]{enumitem}
 \RequirePackage[columns=2]{idxlayout}
 \RequirePackage{varioref}
 \RequirePackage{hypdoc}
@@ -72,11 +73,46 @@
   {#1}{\SpecialEnvIndex}
 \NewNiceDescription{Counter}{#1}{#1}
                    {\SpecialOtherIndex{counter}{counters}}
-\newcommand\SpecialOtherIndex[3]{\@bsphack
+\NewNiceDescription{Key}{#1\,\textrm{=}\,\null}
+  {\begingroup
+   \newcommand\vmeta[1]{{\normalfont\meta{##1}}}%
+   \setkeys[rgltxdoc]{DescOpt}{#1}%
+   \setbox\z@\hbox{\qquad\let\rgltxdoc@@sep\@empty
+     \rgltxdoc@opt{default}{\cmdrgltxdoc@DescOpt@def}%
+     \rgltxdoc@opt{initially}{\cmdrgltxdoc@DescOpt@init}}%
+   \parbox[t]{\linewidth-\wd\z@}{%
+     \raggedright\cmdrgltxdoc@DescOpt@vals}%
+   \box\z@\endgroup}
+  {\SpecialOtherIndex{option-key}{option-keys}}
+\usepackage{xkeyval,calc}
+\define@key[rgltxdoc]{DescOpt}{vals}{%
+  \def\cmdrgltxdoc@DescOpt@vals{}\let\rgltxdoc@@sep\@empty%
+  \def\do##1{%
+    \protected@eappto\cmdrgltxdoc@DescOpt@vals{\rgltxdoc@@sep\texttt{##1}}%
+    \def\rgltxdoc@@sep{, }}%
+  \docsvlist{#1}}
+\define@cmdkey[rgltxdoc]{DescOpt}{init}{}
+\define@cmdkey[rgltxdoc]{DescOpt}{def}{}
+\newcommand\rgltxdoc@opt[2]{\ifdef{#2}
+  {\rgltxdoc@@sep\textsl{#1: }\texttt{#2}%
+   \def\rgltxdoc@@sep{, }}
+  {}}
+\newcommand*\SpecialOtherIndex[3]{%
+  \@bsphack
+  \begingroup
+    \HD@target
+    \let\HDorg@encapchar\encapchar
+    \edef\encapchar usage{%
+      \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}%
+    }%
+    \rgltxdoc@nohyp@SpecialOtherIndex{#1}{#2}{#3}%
+  \endgroup
+  \@esphack}
+\newcommand\rgltxdoc@nohyp@SpecialOtherIndex[3]{%
   \index{#3\actualchar{\protect\ttfamily#3}
     (#1)\encapchar usage}%
   \index{#2:\levelchar#3\actualchar
-    {\protect\ttfamily#3}\encapchar usage}\@esphack}
+    {\protect\ttfamily#3}\encapchar usage}}
 \RequirePackage{pbox}
 \newcommand\rgltxdoc@Desc{\medskip\par\noindent\rgltxdoc@DescRec}
 \newcommand\rgltxdoc@DescRec[4]{%
@@ -84,9 +120,8 @@
     {\rgltxdoc@DescRec@i{#1}{#2}{#3}{#4}}%
     {\rgltxdoc@DescRec@i{#1}{#2}{#3}{#4}[]}}
 \def\rgltxdoc@DescRec@i#1#2#3#4[#5]#6#7{%
-  \leavevmode\null\hbox to\z@{\hss%
-    \pbox[t]{3\marginparwidth}{\ttfamily #1{#6}}%
-    \ifstrempty{#7}{\quad}{}}%
+  \rgltxdoc@inmargin{\ttfamily #1{#6}}%
+    {\ifstrempty{#7}{\quad}{}}%
   #2{#7}\relax
   \ifstrempty{#5}%
     {#3{#6}}%
@@ -94,6 +129,10 @@
   \ifnumgreater{#4}{1}%
     {\\\rgltxdoc@DescRec{#1}{#2}{#3}{#4-1}}%
     {\ifstrempty{#7}{}{\smallskip\par\noindent}\ignorespaces}}
+\newcommand\rgltxdoc@inmargin[2]{%
+  \leavevmode\null\hbox to\z@{\hss%
+    \pbox[t]{3\marginparwidth}{#1}%
+    #2}}
 \RequirePackage{keyvaltable}
 \kvtSet{headbg=black!10,rowbg=white..black!5}
 \NewKeyValTable{KeyDesc}{%
@@ -114,6 +153,9 @@
   \IfFileExists{#1.sty}
     {\textsf{#1}}
     {\rgltxdoc@err{Package `#1' not found. Spelling?}}}
+\newcommand\pkgnames{%
+  \def\do##1{\pkgname{##1}\def\do####1{, \pkgname{####1}}}%
+  \docsvlist}
 \newcommand\cmarg[1]{\mbox{\texttt{\string{#1\string}}}}
 \newcommand\coarg[1]{\mbox{\texttt{[#1]}}}
 \RequirePackage{hologo}
@@ -148,6 +190,7 @@
     {\expandafter\rgltxdoc@curlbltype@i\cref@currentlabel\@nil}}
 \def\rgltxdoc@curlbltype@i[#1][#2][#3]#4\@nil{#1}
 \newcommand\rgltxdoc@SaveSecs{%
+  \def\addcontentsline##1##2##3{}%
   \@for\SC:=chapter,section,subsection,subsubsection\do{%
     \@ifundefined{c@\SC}{}
       {\csedef{rgltx@@ctr@\SC}{\the\value{\SC}}%
-- 
cgit v1.2.3

