diff options
author | Karl Berry <karl@freefriends.org> | 2024-11-09 16:32:59 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-11-09 16:32:59 +0000 |
commit | b94ea95d490be6d0c64ee9099823e0e6051ba8c4 (patch) | |
tree | a6c7f64a43802f24330491cd9f5ed1f035e93c13 /Master | |
parent | bc5a8ee89a80a5326d93f721b78b3f21825a41cc (diff) |
nlctdoc (9nov24)
git-svn-id: svn://tug.org/texlive/trunk@72810 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/nlctdoc/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/nlctdoc/nlctdoc.cls | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/nlctdoc/nlctuserguide.sty | 780 |
3 files changed, 695 insertions, 91 deletions
diff --git a/Master/texmf-dist/doc/latex/nlctdoc/README b/Master/texmf-dist/doc/latex/nlctdoc/README index 0fddcd3120f..d8c7eb5ef12 100644 --- a/Master/texmf-dist/doc/latex/nlctdoc/README +++ b/Master/texmf-dist/doc/latex/nlctdoc/README @@ -1,4 +1,4 @@ -nlctdoc.cls and nlctuserguide.sty v1.10 (2023-09-29): +nlctdoc.cls and nlctuserguide.sty v1.11 (2024-11-09): This class and package is provided "as is" solely for the benefit of anyone who wants to compile the documentation for diff --git a/Master/texmf-dist/tex/latex/nlctdoc/nlctdoc.cls b/Master/texmf-dist/tex/latex/nlctdoc/nlctdoc.cls index f48b30f0c5c..d03ef8dda25 100644 --- a/Master/texmf-dist/tex/latex/nlctdoc/nlctdoc.cls +++ b/Master/texmf-dist/tex/latex/nlctdoc/nlctdoc.cls @@ -4,7 +4,7 @@ % copy the code here to another file and modify it for your own purposes. % There's no guarantee that it will work with other packages. % -% Copyright 2013-2023 Nicola Talbot +% Copyright 2013-2024 Nicola Talbot % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -18,7 +18,7 @@ % for existing documents that use it. \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{nlctdoc}[2023/09/29 v1.10 (NLCT)] +\ProvidesClass{nlctdoc}[2024/11/09 v1.11 (NLCT)] \RequirePackage{ifpdf} \RequirePackage{ifxetex} % tex4ht stopped working with koma during TL2013. diff --git a/Master/texmf-dist/tex/latex/nlctdoc/nlctuserguide.sty b/Master/texmf-dist/tex/latex/nlctdoc/nlctuserguide.sty index bb474690d2c..f2dc355469b 100644 --- a/Master/texmf-dist/tex/latex/nlctdoc/nlctuserguide.sty +++ b/Master/texmf-dist/tex/latex/nlctdoc/nlctuserguide.sty @@ -4,7 +4,7 @@ % copy the code here to another file and modify it for your own purposes. % There's no guarantee that it will work with other packages. % -% Copyright 2022-2023 Nicola Talbot +% Copyright 2022-2024 Nicola Talbot % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -15,7 +15,7 @@ % version 2005/12/01 or later. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{nlctuserguide}[2023/09/29 v1.10 (NLCT)] +\ProvidesPackage{nlctuserguide}[2024/11/09 v1.11 (NLCT)] \newcommand{\nlctdoc@loadxr}{} \DeclareOption{xr}{\renewcommand{\nlctdoc@loadxr}{\RequirePackage{xr-hyper}}} @@ -44,6 +44,99 @@ \DeclareOption{deephierarchy}{\setcounter{secnumdepth}{5}} +\newcommand{\nlct@definesymbols}{% + \nlct@definefontsymbols +} + +\newcommand{\nlct@definefontsymbols}{% +% requires stix or boisk + \newrobustcmd{\tabsym}{% + \BeginAccSupp{method=hex,unicode,ActualText=21B9}% + \ensuremath{\barleftarrowrightarrowbar}% + \EndAccSupp{}% + } +% requires stix + \newrobustcmd{\upsym}{% + \BeginAccSupp{method=hex,unicode,ActualText=2B71}% + \ensuremath{\baruparrow}% + \EndAccSupp{}% + } +} + +\newcommand{\nlct@definetikzsymbols}{% + \RequirePackage{tikz}% + \usetikzlibrary{arrows.meta}% + \newsavebox\tabsbox + \sbox\tabsbox{% + \resizebox{!}{8pt}{% + \begin{tikzpicture}[thick] + \draw[arrows={Bar[width=8pt]Triangle[width=6pt,length=5pt]-}] + (0,0) -- (14pt,0); + \draw[arrows={-Triangle[width=6pt,length=5pt]Bar[width=8pt]}] + (0,-7pt) -- (14pt,-7pt); + \end{tikzpicture}% + }% + } + \newrobustcmd{\tabsym}{% + \BeginAccSupp{method=hex,unicode,ActualText=21B9}% + \thinspace + \usebox\tabsbox + \thinspace + \EndAccSupp{}% + }% + \newrobustcmd{\upsym}{% + \BeginAccSupp{method=hex,unicode,ActualText=2B71}% + \begin{tikzpicture} + \draw[arrows={-To[width=6pt,length=5pt]Bar[width=8pt]}] + (0,0) -- (0,2ex); + \end{tikzpicture} + \EndAccSupp{}% + }% +} + +\DeclareOption{fontsymbols}{% + \renewcommand{\nlct@definesymbols}{% + \nlct@definefontsymbols + }% +} + +\DeclareOption{tikzsymbols}{% + \renewcommand{\nlct@definesymbols}{% + \nlct@definetikzsymbols + }% +} + +\newcommand{\nlct@indexmarks}{} +\newcommand{\nlctpostindexname}[1]{} + +\DeclareOption{noindexmarks}{\renewcommand{\nlct@indexmarks}{}} + +\DeclareOption{indexmarks}{% + \renewcommand{\nlct@indexmarks}{% + \@ifpackageloaded{scrbase}% + {% + \RequirePackage{scrlayer-scrpage}% + \lofoot[\nlctindexfirstmark]{\nlctindexfirstmark}% + \lofoot[\nlctindexfirstmark]{\nlctindexfirstmark}% + \refoot[\nlctindexlastmark]{\nlctindexlastmark}% + \rofoot[\nlctindexlastmark]{\nlctindexlastmark}% + \renewcommand{\nlctpostindexname}[1]{\glsxtrbookindexmarkentry{##1}}% + }% + {}% + }% +} + +% default options: +\PassOptionsToPackage{ + record=nameref, + indexcounter, + floats, + symbols, + accsupp, + nosuper, + stylemods={mcols,bookindex,topic,longextra} +}{glossaries-extra} + \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{glossaries-extra}} \ProcessOptions @@ -51,20 +144,25 @@ \RequirePackage{iftex} \RequirePackage{etoolbox} +\nlct@indexmarks +\nlct@definesymbols + \newcommand{\nlct@ifattachsupported}[2]{#2} \newcommand{\nlct@doifattachsupported}[1]{\nlct@ifattachsupported{#1}{}} \ifPDFTeX \RequirePackage[T1]{fontenc} \renewcommand{\nlct@ifattachsupported}[2]{#1} - \providecommand{\pdf@filesize}[1]{\pdffilesize#1} % \strong is provided by fontspec \providecommand*{\strong}[1]{\textbf{#1}} \else \RequirePackage{fontspec} - \setmainfont{Linux Libertine O} + % v1.11 changed font from Linux Libertine O to Liberation + \setmainfont{FreeSerif} + \setsansfont{FreeSans}[Scale=.9] + \setmonofont{FreeMono}[Scale=1.1] \ifluatex \newcommand{\nlctdocsymbolgrouplabel}[3]{% @@ -82,9 +180,6 @@ \renewcommand{\nlct@ifattachsupported}[2]{#1} \RequirePackage{luatex85}% need \pdfxform for attachfile - % copied from pdftexcmds.sty - \providecommand{\pdf@filesize}[1]{\directlua0{% - oberdiek.pdftexcmds.filesize("\luaescapestring{#1}")}} \fi \fi @@ -100,11 +195,13 @@ \RequirePackage{varioref} \RequirePackage{xcolor} -\newcommand*{\nlct@doifkoma}[1]{} -\@ifclassloaded{scrreprt}{\let\nlct@doifkoma\@firstofone} +\newcommand*{\nlct@doifkoma}[1]{\nlct@ifkoma{#1}{}} +\newcommand*{\nlct@ifkoma}[2]{#2} + +\@ifclassloaded{scrreprt}{\let\nlct@ifkoma\@firstoftwo} { - \@ifclassloaded{scrartcl}{\let\nlct@doifkoma\@firstofone} - {\@ifclassloaded{scrbook}{\let\nlct@doifkoma\@firstofone}{}} + \@ifclassloaded{scrartcl}{\let\nlct@ifkoma\@firstoftwo} + {\@ifclassloaded{scrbook}{\let\nlct@ifkoma\@firstoftwo}{}} } \nlct@doifkoma{% @@ -127,7 +224,7 @@ \RequirePackage{mfirstuc}[2022/10/14] % Requires glossaries-extra v1.49+ -\RequirePackage[record=nameref,indexcounter,floats,symbols,nosuper,stylemods={mcols,bookindex,topic,longextra}]{glossaries-extra}[2022/10/14] +\RequirePackage{glossaries-extra}[2022/10/14] \nlct@doifattachsupported{\RequirePackage{attachfile}} \renewcommand{\thepart}{\Roman{part}} @@ -138,6 +235,25 @@ \newcommand*{\thispackagename}{\jobname} \newcommand*{\thispackage}{\styfmt{\thispackagename}} \newcommand*{\examplesdir}{\jobname-examples} +\newcommand{\nlct@v@version}{} +\newcommand{\nlct@version}{} +\newcommand{\nlct@date}{} +\ExplSyntaxOn +\NewDocumentCommand \versiondate { m m } +{ + \tl_set:Nx \nlct@version { \tl_trim_spaces:n { #1 } } + \tl_set:Nx \nlct@date { \tl_trim_spaces:n { #2 } } + \tl_if_empty:NF \nlct@version + { + \tl_set:Nx \nlct@v@version { version ~ \nlct@version } + } + \tl_if_empty:NF \nlct@date + { + \tl_put_right:Nx \nlct@v@version { ~ \nlct@date } + } + \date{\nlct@v@version} +} +\ExplSyntaxOff \newcommand{\htmlavailable}{This document is also available as \href{\jobname.html}{HTML (\filefmt{\jobname.html})}.} @@ -146,6 +262,10 @@ \renewcommand{\title}[1]{\gdef\@title{#1}\hypersetup{pdftitle={\text_purify:n{#1}}}} \ExplSyntaxOff + \newrobustcmd{\visiblespace}{% + \texttt{\verbvisiblespace}% + } + \newcommand{\TeXLive}{\TeX\ Live} \newcommand{\MikTeX}{Mik\TeX} @@ -186,10 +306,11 @@ \newrobustcmd*{\ctanref}[2]{\href{https://ctan.org/#1}{#2}% \glsxtrdopostpunc{\footnote{\href{https://ctan.org/#1}{\nolinkurl{ctan.org/#1}}}}% } -\MFUexcl{\ctanpkg} +\MFUexcl{\ctanref} \newrobustcmd*{\ctanpkg}[1]{\href{https://ctan.org/pkg/#1}{\nolinkurl{ctan.org/pkg/#1}}} \MFUexcl{\ctanpkg} + \newrobustcmd*{\ctanpkgmirror}[2]{% \href{http://mirrors.ctan.org/pkg/#1}{#2}% \glsxtrdopostpunc{\footnote{\href{http://mirrors.ctan.org/pkg/#1}{\nolinkurl{mirrors.ctan.org/pkg/#1}}}}% @@ -297,6 +418,28 @@ \egroup } +\newcommand*{\@ref@numname}[1]{\ref{#1} (\nameref{#1})} +\newcommand*{\s@ref@numname}[1]{\ref*{#1} (\nameref*{#1})} + +\newcommand*{\@numname@refslist}[4]{% + \bgroup + \let\DTLlistformatitem\@ref@numname + \renewcommand*{\DTLlistformatsep}{#2}% + \renewcommand*{\DTLlistformatlastsep}{#3}% + #1\DTLformatlist{#4}% + \egroup +} + +\newcommand*{\s@numname@refslist}[4]{% + \bgroup + \let\DTLlistformatitem\s@ref@numname + \renewcommand*{\DTLlistformatsep}{#2}% + \renewcommand*{\DTLlistformatlastsep}{#3}% + #1\DTLformatlist{#4}% + \egroup +} + + \newcommand{\sectionrefprefix}{\S} \newrobustcmd{\sectionref}{\@ifstar\s@sectionref\@sectionref} \MFUblocker{\sectionref} @@ -397,6 +540,8 @@ \newcommand*{\@exampleref}[1]{\examplerefprefix\nlct@ns@ref@cs{#1}} \newcommand*{\s@exampleref}[1]{\examplerefprefix\ref*{#1}} +\newrobustcmd*{\examplenameref}[1]{\exampleref{#1} (\nameref{#1})} + \newrobustcmd*{\Exampleref}{\@ifstar\s@Exampleref\@Exampleref} \newcommand*{\@Exampleref}[1]{\Examplerefprefix\nlct@ns@ref@cs{#1}} \newcommand*{\s@Exampleref}[1]{\Examplerefprefix\ref*{#1}} @@ -412,6 +557,12 @@ {\@refslist{\examplesrefprefix}{\refslistsep}{\refslistlastsep}}% } +\newrobustcmd{\examplesnameref}{% + \@ifstar + {\s@numname@refslist{\examplesrefprefix}{\refslistsep}{\refslistlastsep}}% + {\@numname@refslist{\examplesrefprefix}{\refslistsep}{\refslistlastsep}}% +} + \newrobustcmd{\Examplesref}{% \@ifstar {\s@refslist{\Examplesrefprefix}{\refslistsep}{\refslistlastsep}}% @@ -419,11 +570,19 @@ } \MFUaddmap{\examplesref}{\Examplesref} +\newrobustcmd{\mExampleref}[1]{\Exampleref{#1}\examplemarginref{#1}} +\newrobustcmd{\mexampleref}[1]{\exampleref{#1}\examplemarginref{#1}} + +\newrobustcmd{\examplemarginref}[1]{% + \marginpar{\footnotesize\hyperref[#1]{\codesym}\ref{#1}\plabel{#1-backref}}% +} + \newcommand*{\plabel}[2][]{\protected@edef\@currentlabelname{#1}\label{#2}} \newcommand*{\pref}[2][]{on page~\pageref{#2}} \newcommand*{\phyperref}[2]{\hyperref[#2]{#1} on page~\pageref{#2}} \newcommand*{\dash}{\,---\,} +\newcommand{\Slash}{\,\slash\,}% v1.11 \newcommand*{\tick}{\ding{51}} @@ -441,6 +600,10 @@ \newcommand{\unlimited}{$\infty$} +{\catcode`\^^I12\relax +\gdef\nlctliteraltabchar{^^I} +} + \newcommand{\fnsymmark}[1]{\rlap{#1}} \newcommand{\asteriskmarker}{\textasteriskcentered} @@ -643,17 +806,20 @@ engine (\XeLaTeX\ or \LuaLaTeX)} \newcommand*{\icontext}[1]{\stepcounter{icon}\glstext[counter=icon]{sym.#1}} \newtcolorbox{warning}[1][]{breakable, + before upper={\parindent12pt\noindent}, title={\icon{warning}}, coltitle=red,colbacktitle=red!20!white, colframe=red,colback=red!5!white, enhanced,attach boxed title to top right={yshift=\boxtitleshift},#1} \newtcolorbox{important}[1][]{breakable,title={\icon{important}}, + before upper={\parindent12pt\noindent}, coltitle=red,colbacktitle=red!20!white, colframe=red,colback=red!5!white, enhanced,attach boxed title to top right={yshift=\boxtitleshift},#1} \newtcolorbox{information}[1][]{breakable,title={\icon{information}}, + before upper={\parindent12pt\noindent}, coltitle=teal,colbacktitle=teal!20!white, colframe=teal,colback=teal!5!white, enhanced,attach boxed title to top right={yshift=\boxtitleshift},#1} @@ -664,26 +830,34 @@ engine (\XeLaTeX\ or \LuaLaTeX)} \newcommand{\nlctdefaultafter}{\par\noindent\ignorespacesafterend} +\newcommand{\nlctpinnedafter}{\nlctdefaultafter} % v1.11 +\newcommand{\nlctpinnedbefore}{\allowbreak\par\noindent} % v1.11 + \newtcolorbox{pinnedbox}[1][]{unbreakable,title={\icon{definition}}, coltitle=black,colbacktitle=defbackground, colframe=black,colback=defbackground,halign=flush left, enhanced,attach boxed title to top right={yshift=\boxtitleshift}, - after={\nlctdefaultafter}, + after={\nlctpinnedafter},before={\nlctpinnedbefore}, #1 } +\newcommand{\nlctdefnafter}{\nopagebreak\nlctdefaultafter} % v1.11 +\newcommand{\nlctdefnbefore}{\allowbreak\par\noindent} % v1.11 + \newtcolorbox{defnbox}[1][]{unbreakable, colframe=black,colback=defbackground,halign=flush left, - after={\nlctdefaultafter}, + after={\nlctdefnafter},before={\nlctdefnbefore}, #1 } +\newcommand{\nlctsettingsafter}{\nopagebreak\nlctdefaultafter} % v1.11 +\newcommand{\nlctsettingsbefore}{\allowbreak\par\noindent} % v1.11 \newtcolorbox{settingsbox}[1][]{title={\icon{valuesetting}},unbreakable, coltitle=black,colbacktitle=defbackground!20!white, colframe=black,colback=defbackground!20!white,halign=flush left, enhanced,attach boxed title to top right={yshift=\boxtitleshift}, - after={\nlctdefaultafter}, + after={\nlctsettingsafter}, before={\nlctsettingsbefore}, #1 } @@ -705,14 +879,29 @@ engine (\XeLaTeX\ or \LuaLaTeX)} \newcommand{\cmd}[1]{\texttt{\code@cmd{#1}}} \newcommand{\code@cbeg}[1]{\cmd{begin}\marg{#1}} \newcommand{\code@cend}[1]{\cmd{end}\marg{#1}} -\newcommand{\code@comment}[1]{\mbox{\textcolor{comment}{\glspercentchar\ #1}}}% +{\obeylines\newcommand{\code@comment}[1]{% + \mbox{\textcolor{comment}{\glspercentchar\ #1}}\@ifnextchar +{}{\par}}\global\let\code@comment\code@comment\newcommand{\code@comment@dbsp}[1]{% + \mbox{\textcolor{comment}{\glspercentchar\ #1}}\@ifnextchar +{}{\par}\dbspace}\global\let\code@comment@dbsp\code@comment@dbsp} \newcommand{\araraline}[1]{\glspercentchar\ arara: #1} \newcommand{\araracont}{\araraline{-\/-> }} +\newcommand{\commentnl}[1]{\comment{#1}\nl} + \newcommand*{\setupcodeenvfmts}{% \let\cbeg\code@cbeg \let\cend\code@cend \let\comment\code@comment + \let\commentdbsp\code@comment@dbsp + \def\nl{\mbox{}\newline}% + \def\nlsp{\nl\null\space}% + \def\dbspace{\mbox{}\space\space}% + \def\dbdbspace{\dbspace\dbspace}% + \def\dbdbdbspace{\dbspace\dbspace\dbspace}% + \def\nldbsp{\nl\null\dbspace}% + \def\nldbdbsp{\nl\null\dbdbspace}% + \def\nldbdbdbsp{\nl\null\dbdbdbspace}% \renewcommand*{\envfmt}[1]{##1}% \renewcommand*{\styfmt}[1]{##1}% \renewcommand*{\clsfmt}[1]{##1}% @@ -791,7 +980,7 @@ engine (\XeLaTeX\ or \LuaLaTeX)} coltitle=black,colbacktitle=white, colframe=black,colback=white, after={\nlctdefaultafter}, - enhanced,attach boxed title to top right={yshift=\boxtitleshift},#1} + enhanced,breakable,attach boxed title to top right={yshift=\boxtitleshift},#1} \newtcolorbox{coderesult}[1][]{skin=bicolor, title={\icon{code} \icon{result}}, @@ -836,7 +1025,8 @@ halign upper=flush left,halign lower=justify, \newcommand*{\summarylocfont}{\footnotesize} -\newcommand*{\summarylocwidth}{\marginparwidth} +\newcommand*{\summarylocinnersep}{.3333em} +\newcommand*{\summarylocwidth}{\marginparwidth-.6666em} \definecolor{summaryloc}{rgb}{.75,.936,1} % LightBlue1 @@ -850,11 +1040,20 @@ halign upper=flush left,halign lower=justify, \smash {% \tikz[baseline=(N.west)] - \node[anchor=west,fill=summaryloc,text width=\summarylocwidth,rounded corners,font=\summarylocfont] (N) {#1};% + \node[anchor=west, + outer sep=0pt, + inner sep=\summarylocinnersep, + fill=summaryloc, + text width=\summarylocwidth, + align=flush left, + rounded corners,font=\summarylocfont + ] (N) {#1};% }% }% } +\newcommand{\summarymarginpar}[1]{\marginpar{#1}} + \ifdef\@ptsize { \ifboolexpr{ test {\ifdefstring\@ptsize{1}} @@ -940,6 +1139,10 @@ halign upper=flush left,halign lower=justify, \renewcommand*{\create@example@pages@sep}{#1}} \newcommand{\create@example@pages@sep}{1em} +\define@key{nlctexample}{pagesperrow}{% + \renewcommand*{\create@example@pages@perrow}{#1}} +\newcommand{\create@example@pages@perrow}{\@nlct@num} + \define@key{nlctexample}{tex}{\renewcommand*{\create@example@tex}{#1}} \newcommand*{\create@example@tex}{arara --working-directory \examplesdir} @@ -974,12 +1177,126 @@ halign upper=flush left,halign lower=justify, \renewcommand*{\example@title}{#1}% } -\newcommand{\example@do@label}{} +\newcommand{\nlctpostexampletitle}{\par} + +\define@choicekey{nlctexample}{titleskip}% + [\nlct@titleskip@val\nlct@titleskip@nr]% + {none,thin,small,medium}% + {% + \ifcase\nlct@titleskip@nr\relax + \renewcommand{\nlctpostexampletitle}{\endgraf}% + \or + \renewcommand{\nlctpostexampletitle}{\vspace{1pt plus 1pt}\endgraf}% + \or + \renewcommand{\nlctpostexampletitle}{\smallskip\endgraf}% + \or + \renewcommand{\nlctpostexampletitle}{\medskip\endgraf}% + \fi + } + +\newcommand{\example@do@label}{% + \ifdefempty\nlct@example@label + {}% + {% + \ifdefempty\example@title{}% + {\protected@edef\@currentlabelname{\example@title}}% + \label{\nlct@example@label}% + \example@do@extag + }% +} \newcommand{\example@label@info}{} +\newcommand{\nlct@example@label}{} \define@key{nlctexample}{label}{% \renewcommand{\example@label@info}{\glspercentchar\space Label: "#1"^^J}% - \renewcommand*{\example@do@label}{\label{#1}}% + \renewcommand*{\nlct@example@label}{#1}% +} + +% v1.11+ +\newcommand{\example@do@extag}{} + +\newcommand{\nlctextag}[1]{% + \protected@write\@auxout{}{\string\nlctdoc@extag{#1}{\nlct@example@label}}% +} + +\ExplSyntaxOn +\newcommand{\nlctdoc@extag}[2]{ + \clist_map_inline:nn { #1 } + { + \seq_if_exist:cF { g__nlctdoc_example_tag_ ##1 _seq } + { + \seq_new:c { g__nlctdoc_example_tag_ ##1 _seq } + } + \seq_gput_right:cn { g__nlctdoc_example_tag_ ##1 _seq } { #2 } + } +} + +\int_new:N \l_nlctdoc_extag_item_threshold_int +\int_set:Nn \l_nlctdoc_extag_item_threshold_int { 4 } + +% Syntax: \exampletagref{tag}{trailing punctuation} +\NewDocumentCommand \exampletagref { m m } +{ + \seq_if_exist:cTF { g__nlctdoc_example_tag_ #1 _seq } + { + \seq_if_empty:cTF { g__nlctdoc_example_tag_ #1 _seq } + { + ??\PackageWarning { nlctuserguide } + { No ~ labels ~ found ~ for ~ tag ~ `#1' } + } + { + \exp_args:Ncx + \__nlctdoc_examplerefs:Nnn + { g__nlctdoc_example_tag_ #1 _seq } + { \seq_count:c { g__nlctdoc_example_tag_ #1 _seq } } + { #2 } + } + } + { + ??\PackageWarning { nlctuserguide } + { No ~ reference ~ found ~ for ~ tag ~ `#1' } + } +} +\cs_new:Nn \__nlctdoc_examplerefs:Nnn +{ + \int_compare:nNnTF { #2 } = { \c_one_int } + { + \exp_args:Nx \examplenameref { \seq_item:Nn #1 { \c_one_int } } #3 + } + { + \int_compare:nNnTF + { #2 } < { \l_nlctdoc_extag_item_threshold_int } + { + \exp_args:Nx \examplesnameref { \seq_use:Nn #1 { , } } #3 + } + { + \exampletagrefprelist + \begin{itemize} + \seq_map_indexed_inline:Nn #1 + { + \item \ref{ ##2 } + \exampletagreflistpretitle + \nameref{ ##2 } + \int_compare:nNnTF + { ##1 } = { #2 } + { #3 } { \exampletagreflistsep } + } + \end{itemize} + } + } +} +\ExplSyntaxOff +\newcommand{\exampletagreflistsep}{;} +\newcommand{\exampletagreflistpretitle}{. } +\newcommand{\exampletagrefprelist}{the following examples:} + +\define@key{nlctexample}{tag}{% + \renewcommand{\example@do@extag}{\nlctextag{#1}}% +} + +\newcommand{\nlct@exbacklink}{} +\define@key{nlctexample}{link}{% + \renewcommand{\nlct@exbacklink}{#1}% } \newcounter{example} @@ -991,17 +1308,23 @@ halign upper=flush left,halign lower=justify, \newcommand{\codepar}{\par\mbox{}\par} +\newcommand{\glscmd}[1]{\glsentrytext{#1}} + \newcommand{\nlctexamplelets}{% \let\gls\glsentrytext + \let\glssymbol\glsentrysymbol \let\glscmd\glsentrytext \let\env\@firstofone \let\ctr\@firstofone \let\texorpdfstring\@secondoftwo + \def\starredcs##1{\glsentrytext{##1}*}% \def\cmd##1{\glsbackslash##1}% \def\csfmt##1{\glsbackslash##1}% \def\cbeg##1{\glsbackslash begin{##1}}% \def\cend##1{\glsbackslash end{##1}}% \def\comment##1{\glspercentchar\space ##1^^J}% + \def\commentnl##1{\glspercentchar\space ##1^^J}% + \def\commentdbsp##1{\glspercentchar\space ##1^^J\dbspace}% \def\%{\glspercentchar}% \edef\#{\expandafter\@gobble\string\#}% % v1.10: @@ -1011,14 +1334,25 @@ halign upper=flush left,halign lower=justify, \def\codepar{^^J^^J}% \def\marg##1{\glsopenbrace##1\glsclosebrace}% \def\oarg##1{[##1]}% +% v1.11: + \def\nl{^^J}% + \def\nlsp{^^J\space}% + \def\dbspace{\space\space}% + \def\dbdbspace{\dbspace\dbspace}% + \def\dbdbdbspace{\dbspace\dbspace\dbspace}% + \def\nldbsp{^^J\dbspace}% + \def\nldbdbsp{^^J\dbdbspace}% + \def\nldbdbdbsp{^^J\dbdbdbspace}% + \let\tabsym\nlctliteraltabchar + \let\visiblespace\space } \newcommand{\@create@example@write}{\@create@example@write@detok} \newcommand{\createexamplefirstline}{% \nlct@ifattachsupported - {\glspercentchar\space This file is embedded in \jobname.pdf^^J}% - {\glspercentchar\space This file is an example from \jobname.pdf^^J}% + {\glspercentchar\space This file is embedded in \jobname.pdf \nlct@v@version^^J}% + {\glspercentchar\space This file is an example from \jobname.pdf \nlct@v@version^^J}% } \newcommand{\@create@example@write@detok}[2]{% @@ -1075,10 +1409,10 @@ halign upper=flush left,halign lower=justify, \ifdefempty\create@example@graphicsopts {% \DTLnumitemsinlist{\create@example@pages}{\@nlct@num}% - \edef\create@example@graphicsopts{width=\the\dimexpr\linewidth/\@nlct@num-\create@example@pages@sep}% + \edef\create@example@graphicsopts{width=\the\dimexpr(\linewidth-\create@example@pages@sep*(\create@example@pages@perrow-1))/\create@example@pages@perrow} }{}% - \@for\@nlct@page:=\create@example@pages\do{\hfill - \s@example@image[page=\@nlct@page]{\nlct@image@file}\hfill}% + \@for\@nlct@page:=\create@example@pages\do{\hfil + \s@example@image[page=\@nlct@page]{\nlct@image@file}\hfil}% }% \@endfortrue }% @@ -1101,6 +1435,22 @@ halign upper=flush left,halign lower=justify, \newcommand{\listofexamplesname}{List of Examples} \newcommand{\listofexampleslabel}{\label{sec:listofexamples}} +% v1.11: +\newcommand{\listofexamplesheader}{% +\par +If an example shows the icon \exampleattachtexicon\ then the source +code is embedded in the PDF as an attachment. If your PDF viewer +supports attachments, you can extract the self-contained example +file to try it out for yourself. Alternatively, you can click on the +download icon \exampledownloadtexicon\ which will try downloading +the example source code from your closest CTAN mirror, but make sure +that this user manual matches the version on CTAN first. You can +also try using: +\texdocref{-l \jobname-example\meta{nnn}} +where \meta{nnn} is the example number zero-padded to three digits +to find out if the example files are installed on your device.\par +\bigskip +} \ifdef\chapter { @@ -1109,12 +1459,12 @@ halign upper=flush left,halign lower=justify, \newcommand{\listofexamples}{% \@ifstar{\chapter*{\listofexamplesname}\@starttoc{loe}}% - {\chapter{\listofexamplesname}\listofexampleslabel\@starttoc{loe}}} + {\chapter{\listofexamplesname}\listofexampleslabel\listofexamplesheader\@starttoc{loe}}} } { \newcommand{\listofexamples}{% \@ifstar{\section*{\listofexamplesname}\@starttoc{loe}}% - {\section{\listofexamplesname}\listofexampleslabel\@starttoc{loe}}} + {\section{\listofexamplesname}\listofexampleslabel\listofexamplesheader\@starttoc{loe}}} } \newcommand{\l@example}{\l@table} @@ -1126,10 +1476,24 @@ halign upper=flush left,halign lower=justify, \newcommand{\nlctexampletag}{\Examplename~\theexample} +\newcommand{\nlctbacklink}[1]{% + \ifdefempty\nlct@exbacklink + {% + \ifdefempty\nlct@example@label{}% + {% + \ifcsdef{r@\nlct@example@label-backref}% + {\hyperref[\nlct@example@label-backref]{\upsym}}% + {}% + }% + }% + {\hyperref[\nlct@exbacklink]{\upsym}}% + #1% +} + \newcommand{\nlctexampletitlefmt}[1]{% \nlctexampletitlefont \raggedright\exhyphenpenalty 0 % space intended - \nlctexampletag\ifstrempty{#1}{}{: #1}\par + \nlctbacklink{\nlctexampletag}\ifstrempty{#1}{}{: #1}\par } \newcommand{\nlct@ex@title@attachments}[2]{% @@ -1158,17 +1522,6 @@ halign upper=flush left,halign lower=justify, \nlctdownloadlinkstrue \newcommand*{\nlctdownloadlink}[1]{http://mirrors.ctan.org/macros/latex/contrib/\thispackagename/#1} -\newcommand*{\nlct@testfile}[2]{% - \IfFileExists{#1}{}% - {% - \PackageWarning{nlctuserguide}{File `#1' doesn't exist. - Changing examples directory to `.'}% - \gdef\examplesdir{.}% - #2% - }% - \global\let\nlct@testfile\@gobblethree -} - \newcommand{\@loe@disable@cmds}{% \def\dequals{\protect\dequals}% \def\dhyphen{\protect\dhyphen}% @@ -1182,8 +1535,30 @@ halign upper=flush left,halign lower=justify, \def\appfmt##1{\protect\appfmt{##1}}% } +\ExplSyntaxOn +\newcommand{\example@filesize}[1]{ + \file_size:n { \examplesdir / \nlct@example@filebasename #1 } +} +\newcommand{\example@filetimestamp}[1]{ + \file_timestamp:n { \examplesdir / \nlct@example@filebasename #1 } +} +\newcommand\nlct@run[1]{ + \sys_if_shell_unrestricted:TF + { \sys_shell_now:e { #1 } } + { + \PackageInfo { nlctuserguide } + { + Not ~ running ~ ` #1 ' \MessageBreak + Unrestricted ~ shell ~ not ~ enabled. ~ + Execute ~ outside ~ of ~ TeX ~ and ~ rerun + } + } +} +\ExplSyntaxOff + \newcommand{\@createexample}[3][]{% - \begingroup + \begin{minipage}[t]{\linewidth}% + \raggedright \refstepcounter{example}% \setkeys{nlctexample}{#1}% \example@do@label @@ -1225,13 +1600,7 @@ halign upper=flush left,halign lower=justify, \immediate\openout\nlct@exampleout=\examplesdir/\nlct@example@filebasename.tex \@create@example@write{#2}{#3}% \immediate\closeout\nlct@exampleout - \nlct@testfile{\examplesdir/\nlct@example@filebasename}% - {% - \immediate\openout\nlct@exampleout=\nlct@example@filebasename.tex - \@create@example@write{#2}{#3}% - \immediate\closeout\nlct@exampleout - }% - \immediate\write18{\create@example@tex\space\nlct@example@filebasename.tex}% + \nlct@run{\create@example@tex\space\nlct@example@filebasename.tex}% \nlct@ifattachsupported {% \bgroup @@ -1241,7 +1610,9 @@ halign upper=flush left,halign lower=justify, \nlctexampletagattachfont \textattachfile[mimetype={application/x-tex}, author={\@pdfauthor},color={0 0 0}, - size={\pdf@filesize{\examplesdir/\nlct@example@filebasename.tex}}, + size={\example@filesize{.tex}}, + created={\example@filetimestamp{.tex}}, + modified={\example@filetimestamp{.tex}}, subject={\example@pdf@title\space (source code)}, description={\example@attachdesc\space (source code)}]% {\examplesdir/\nlct@example@filebasename.tex}{\exampleattachtexicon}% @@ -1255,7 +1626,9 @@ halign upper=flush left,halign lower=justify, \space \textattachfile[mimetype={application/pdf}, author={\@pdfauthor},color={0 0 0}, - size={\pdf@filesize{\examplesdir/\nlct@example@filebasename.pdf}}, + size={\example@filesize{.pdf}}, + created={\example@filetimestamp{.pdf}}, + modified={\example@filetimestamp{.pdf}}, subject={\example@pdf@title\space (PDF)}, description={\example@attachdesc\space (PDF)}]% {\examplesdir/\nlct@example@filebasename.pdf}{\exampleattachpdficon}% @@ -1272,7 +1645,8 @@ halign upper=flush left,halign lower=justify, \fi \fi }% - \par\egroup\noindent + \nlctpostexampletitle + \egroup\noindent }% {% \nlctexampletitlebox{\example@tex@title}\hfill @@ -1280,11 +1654,13 @@ halign upper=flush left,halign lower=justify, \href{\nlctdownloadlink{\examplesdir/\nlct@example@filebasename.tex}}{\exampledownloadtexicon} \quad \href{\nlctdownloadlink{\examplesdir/\nlct@example@filebasename.pdf}}{\exampledownloadpdficon} - \par\egroup\noindent + \nlctpostexampletitle + \egroup\noindent \fi } \nlct@include@exampleimage - \endgroup + \par + \end{minipage}% } \newenvironment{example}[2]{% @@ -1367,6 +1743,7 @@ halign upper=flush left,halign lower=justify, \def\dunderscore{\_}% \let\-\empty \let\csfmtfont\@firstofone + \let\NoCaseChange\@firstofone } \definecolor{cs}{rgb}{.328,.436,.1} % dark green @@ -1387,6 +1764,10 @@ halign upper=flush left,halign lower=justify, \newcommand*{\csfmtcolourfont}[1]{\texttt{\textcolor{cs}{#1}}} \newcommand*{\csfmt}[1]{\csfmtfont{\codebackslash #1}} +\newcommand*{\cspuncfmt}[1]{\csfmt{#1}} % v1.11 + +\MFUblocker{\csfmt}% v1.11 +\MFUblocker{\cspuncfmt}% v1.11 \newcommand{\codebackslash}{\texorpdfstring{\char`\\}{\string\\}} @@ -1399,7 +1780,53 @@ halign upper=flush left,halign lower=justify, \texorpdfstring{\csfmt{#1\meta{#2}#3\meta{#4}#5}}{\string\\#1\string<#2\string>#3\string<#4\string>#5}% } -\newcommand{\starredcs}[1]{\glslink{#1}{\csfmt{#1*}}} +\newcommand{\starredcs}[1]{\gls{#1}[\csfmtfont{*}]} +\newcommand{\starredenv}[1]{\gls{env.#1}[\envfmt{*}]} % v1.11 + +\newcommand{\thectr}[1]{\glslink{ctr.#1}{\csfmt{the#1}}} % v1.11 +\newcommand{\theHctr}[1]{\glslink{ctr.#1}{\csfmt{theH#1}}} % v1.11 + +\newcommand*{\glscsname}[2][]{\glslink[#1]{#2}{\csfmtfont{#2}}} + +% v1.11 +\NewDocumentCommand{\predcs}{O{}m}{% + \glsxtrifhasfield{explsuffix}{#2}% + {% + \let\explsuffix\glscurrentfieldvalue + \gls[#1]{#2}% + }% + {\gls[#1]{#2}}% +} + +\NewDocumentCommand{\condcsT}{O{}m}{% + {% + \def\explTFsuffix{T}% + \gls[#1]{#2}% + }% +} + +\NewDocumentCommand{\condcsF}{O{}m}{% + {% + \def\explTFsuffix{F}% + \gls[#1]{#2}% + }% +} + +\newcommand*{\@expfunclink}[3]{\glslink[#3]{#2}{\csfmt{#1}}} + +\NewDocumentCommand{\expfunc}{O{}mm}{% + \ifglsentryexists{#2}% + {% + \glsxtrifhasfield{base}{#2}% + {% + \expandafter\@expfunclink\expandafter{\glscurrentfieldvalue:#3}{#2}{#1}% + }% + {% + \gls[#1]{#2}% + }% + }% + {\gls[#1]{#2:#3}}% +} \glsxtraddlabelprefix{dual.} \glsxtraddlabelprefix{idx.} @@ -1414,8 +1841,6 @@ halign upper=flush left,halign lower=justify, \newdglsfield{name}{\idxn} \newdglsfield{first}{\idxf} -\newcommand*{\glscsname}[2][]{\glslink[#1]{#2}{\csfmtfont{#2}}} - \newcommand{\optionlistprefix}{opt.} \newcommand{\optionlistitemformat}[1]{\glsentrytext{#1}} \newcommand{\optionlisttag}{Option} @@ -1436,7 +1861,7 @@ halign upper=flush left,halign lower=justify, } \newrobustcmd{\options}[1]{% - {\def\andname{and} + {\def\andname{and}% \let\glsseeitemformat\optionlistitemformat \glsxtrtaggedlist{\optionlisttag}{\optionlisttags}{\optionlistprefix}{#1}% }% @@ -1524,6 +1949,7 @@ halign upper=flush left,halign lower=justify, \newcommand*{\styoptfmt}[1]{\texorpdfstring{\textcolor{styopt}{\optfmt{#1}}}{#1}} \newcommand*{\clsoptfmt}[1]{\texorpdfstring{\textcolor{styopt}{\optfmt{#1}}}{#1}} \newcommand*{\ctrfmt}[1]{\texorpdfstring{\textsf{#1}}{#1}} + \edef\longswitch{\string-\/\string-} \edef\pdflongswitch{\string-\string-} @@ -1556,7 +1982,9 @@ halign upper=flush left,halign lower=justify, }% } -\newrobustcmd*{\texmeta}[1]{{\normalfont\normalcolor$\langle$\emph{#1}$\rangle$}} +\newcommand{\faded}[1]{\texorpdfstring{\textcolor{gray}{#1}}{#1}} + +\newrobustcmd*{\texmeta}[1]{{\normalfont$\langle$\emph{#1}$\rangle$}} \newcommand*{\meta}[1]{% \texorpdfstring{\ifmmode\text{\texmeta{#1}}\else\texmeta{#1}\fi}{\string<#1\string>}% @@ -1593,6 +2021,9 @@ halign upper=flush left,halign lower=justify, {#1}% } +\newcommand{\homedir}{\string~}% v1.11 +\newcommand{\homefilefmt}[1]{\filefmt{\homedir\slash#1}} + \newcommand*{\filefmt}[1]{\texorpdfstring{\texttt{#1}}{#1}} \newcommand*{\extfmt}{\filefmt} @@ -1654,7 +2085,11 @@ halign upper=flush left,halign lower=justify, {} \ifdef\backmatter -{\appto\backmatter{\setupglossaries{numberedsection=nolabel}}} +{ + \appto\backmatter{% + \def\theHchapter{backmatter.\arabic{chapter}}% + \setupglossaries{numberedsection=nolabel}}% + } {} \ifdef\appendix @@ -1691,19 +2126,36 @@ halign upper=flush left,halign lower=justify, \ifdef\chapter { - \preto\chapter{\setcounterlevels{0}{chapter}} + \nlct@ifkoma + { + \AddtoDoHook{heading/preinit/chapter}{\setcounterlevels{0}{chapter}} + } + { + \preto\chapter{\setcounterlevels{0}{chapter}} + } \setcounterlevels{0}{chapter} } { \setcounterlevels{1}{section} } -\preto\part{\setcounterlevels{-1}{part}} -\preto\section{\setcounterlevels{1}{section}} -\preto\subsection{\setcounterlevels{2}{subsection}} -\preto\subsubsection{\setcounterlevels{3}{subsubsection}} -\preto\paragraph{\setcounterlevels{4}{paragraph}} -\preto\subparagraph{\setcounterlevels{4}{subparagraph}} +\nlct@ifkoma + { + \AddtoDoHook{heading/preinit/part}{\setcounterlevels{-1}{part}} + \AddtoDoHook{heading/preinit/section}{\setcounterlevels{1}{section}} + \AddtoDoHook{heading/preinit/subsection}{\setcounterlevels{2}{subsection}} + \AddtoDoHook{heading/preinit/subsubsection}{\setcounterlevels{3}{subsubsection}} + \AddtoDoHook{heading/preinit/paragraph}{\setcounterlevels{4}{paragraph}} + \AddtoDoHook{heading/preinit/subparagraph}{\setcounterlevels{4}{subparagraph}} + } + { + \preto\part{\setcounterlevels{-1}{part}} + \preto\section{\setcounterlevels{1}{section}} + \preto\subsection{\setcounterlevels{2}{subsection}} + \preto\subsubsection{\setcounterlevels{3}{subsubsection}} + \preto\paragraph{\setcounterlevels{4}{paragraph}} + \preto\subparagraph{\setcounterlevels{4}{subparagraph}} + } \newcommand{\mainfmt}[1]{\glsnumberformat{#1}} @@ -1716,6 +2168,10 @@ halign upper=flush left,halign lower=justify, \createtarget{#1}{\glossentryname{#1}}% } +\renewcommand*{\GlsXtrStandaloneEntryOther}[2]{% + \createtarget{#1}{\glossentrynameother{#1}{#2}}% +} + % \targetorhyperlink{label}{text} \newcommand*{\targetorhyperlink}[2]{% \glsxtrifhasfield*{target}{#1}% @@ -1789,6 +2245,18 @@ halign upper=flush left,halign lower=justify, \glsxtrglossentry{pkg.#2}% } +% v1.11 +\newrobustcmd*{\inlinefiledef}[2][filedef]{% + \mainglsadd{file.#2}{#1}% + \glsxtrglossentry{file.#2}% +} + +% v1.11 +\newrobustcmd*{\inlineappdef}[2][appdef]{% + \mainglsadd{app.#2}{#1}% + \glsxtrglossentry{app.#2}% +} + \newcommand*{\mainglsadd}[3][]{% \ifstrempty{#3}% {\def\mainglsaddcounter{}}% @@ -1838,17 +2306,30 @@ halign upper=flush left,halign lower=justify, \glsxtrifhasfield{syntax}{opt.#2}{\dequals\glscurrentfieldvalue}{}}% } +\newcommand{\@cmddef@init}{% + \let\csfmtfont\@firstofone + \def\cmdfont##1{\textbf{\texttt{##1}}}% + \def\explTFsuffix{\@explboolsyntaxfmt{TF}}% +} + \newcommand*{\s@cmddef}[2][]{% \def\cmdtitle{\icon{definition}}% \def\postnote{}% \ifnotdefaultstatus{#2}{\def\cmdtitle{\statussym}\def\postnote{\hfill\statustext}}{}% \begin{pinnedbox}[title=\cmdtitle] - \let\csfmtfont\@firstofone - \def\cmdfont##1{\textbf{\texttt{##1}}}% + \@cmddef@init \gathermodifiers{#2}% + \gathervariants{#2}% \cmddefsyntax{#1}{#2}% \def\tagsep{\hfill}% - \ifdefempty\nlctmodifierlist{}% + \ifdefempty\nlctmodifierlist + {% + \ifdefempty\nlctvariantlist + {}% + {\tagsep\summarytagfmt{\nlctvarianttag}\nlctvariantlist\relax + \let\tagsep\space + }% + }% {\tagsep\summarytagfmt{\nlctmodifiertag}\nlctmodifierlist\relax \let\tagsep\space }% @@ -1858,6 +2339,15 @@ halign upper=flush left,halign lower=justify, \ifdefempty\nlctmodifierglslist{}% {\@for\@nlct@label:=\nlctmodifierglslist\do {\par\cmddefsyntax{#1}{\@nlct@label}}}% + \glsxtrifhasfield{explsuffix}{#2}% + {% + \let\explsuffix\glscurrentfieldvalue + \let\explTFsuffix\relax + \let\TFsyntax\relax + \par\texttt{\glsentryname{#2}% + \syntax{#2}}% + }% + {}% \glsxtrifhasfield*{note}{#2}% {% \ifx\cmdnotefmt\@gobble @@ -1898,6 +2388,29 @@ halign upper=flush left,halign lower=justify, }% } +\newcommand{\gathervariants}[1]{% + \protected@edef\nlctcmddeflabel{#1}% + \def\nlctvarianttag{}% + \def\nlctvariantlist{}% + \def\nlctvariantglslist{}% + \glsxtrforcsvfield*{#1}{variants}{\cmddefvarianthandler}% +} + +\newcommand{\cmddefvarianthandler}[1]{% + \ifglsentryexists{\nlctcmddeflabel:#1}% + {% + \ifdefempty\nlctvariantglslist + {\eappto\nlctvariantglslist{\nlctcmddeflabel#1}}% + {\eappto\nlctvariantglslist{,\nlctcmddeflabel#1}}% + }% + {% + \ifdefempty\nlctvariantlist + {\def\nlctvarianttag{variant}}% + {\def\nlctvarianttag{variants}\appto\nlctvariantlist{ }}% + \eappto\nlctvariantlist{\noexpand\code{#1}}% + }% +} + \newrobustcmd*{\envdef}{\@ifstar\s@envdef\@envdef} \newcommand*{\@envdef}[2][]{% \pdfbookmark[\cmddefbookmarklevel]{\glsentryname{env.#2}}{env.#2}% @@ -2041,26 +2554,44 @@ halign upper=flush left,halign lower=justify, \noindent\ignorespaces } -\newcommand*{\defaultoptdefbookmarklevel}{\number\numexpr\currentcounterlevel+1 } +\ExplSyntaxOn +\newcommand*{\defaultoptdefbookmarklevel}{ \int_eval:n { \currentcounterlevel + \c_one_int } } +\ExplSyntaxOff \newcommand*{\optdefbookmarklevel}{\defaultoptdefbookmarklevel} \newrobustcmd*{\optiondef}{\@ifstar\s@optiondef\@optiondef} -\newcommand*{\@optiondef}[1]{% - \glsifcategory{opt.#1}{commandoption}% +\NewDocumentCommand{\@optiondef}{ t+ o m }{% + \IfBooleanTF{#1}% {% - \edef\optdefbookmarklevel{\number\numexpr\cmddefbookmarklevel+1 }% + \edef\optdefbookmarklevel{\defaultoptdefbookmarklevel}% }% {% - \edef\optdefbookmarklevel{\defaultoptdefbookmarklevel}% + \IfValueTF{#2}% + {% + \edef\optdefbookmarklevel{\number#2}% + }% + {% + \glsifcategory{opt.#3}{commandoption}% + {% + \edef\optdefbookmarklevel{\number\numexpr\cmddefbookmarklevel+1 }% + }% + {% + \edef\optdefbookmarklevel{\defaultoptdefbookmarklevel}% + }% + }% }% - \pdfbookmark[\optdefbookmarklevel]{\glsentryname{opt.#1}}{optdef.#1}% - \nopagebreak\s@optiondef{#1}% + \pdfbookmark[\optdefbookmarklevel]{\glsentryname{opt.#3}}{optdef.#3}% + \nopagebreak\s@optiondef{#3}% } \newcommand{\optnotefmt}[1]{#1} +\newcommand{\optiondefhook}{}% v1.11 + \newcommand*{\s@optiondef}[1]{% + \bgroup + \optiondefhook \getinitordefval{opt.#1}% \def\postnote{}% \ifnotdefaultstatus{opt.#1}% @@ -2086,6 +2617,7 @@ halign upper=flush left,halign lower=justify, {\ifdefempty\postnote{}{\preto\postnote{\hfill}}}% \postnote \end{settingsbox}% + \egroup \noindent\ignorespaces } @@ -2314,6 +2846,9 @@ halign upper=flush left,halign lower=justify, \newcommand{\glsbibwritefield}[2]{,^^J#1={\detokenize{#2}}} \glsaddstoragekey{modifiers}{}{\modifiers} +\glsaddstoragekey{variants}{}{\variants} +\glsaddstoragekey{base}{}{\fnbase} +\glsaddstoragekey{explsuffix}{}{\explsuffixfield} \glsaddstoragekey{syntax}{}{\syntax} \glsaddstoragekey{defaultvalue}{}{\optdefval} \glsaddstoragekey{initvalue}{}{\optinitval} @@ -2321,6 +2856,7 @@ halign upper=flush left,halign lower=justify, \glsaddstoragekey{note}{}{\note} \glsaddstoragekey{providedby}{}{\providedbyinfo} \glsaddstoragekey{pdftitlecasename}{}{\pdftitlecasename} +\glsaddstoragekey{extra}{}{\glsextra} \glsaddstoragekey{defaultkeys}{}{\defaultkeys} @@ -2332,6 +2868,12 @@ halign upper=flush left,halign lower=justify, \newcommand{\conditionsyntax}{ \meta{true}\csfmt{else} \meta{false}\csfmt{fi}} +\newrobustcmd{\@explboolsyntaxfmt}[1]{\underline{\emph{#1}}} + +\newcommand{\explsuffix}{} +\newcommand{\explTFsuffix}{TF} +\newcommand{\TFsyntax}{\margm{true} \margm{false}} + \newrobustcmd{\initvalnotefmt}[1]{\textrm{\em #1}} \newcommand{\nlctuserguidebibextrapreamble}{} @@ -2349,6 +2891,7 @@ halign upper=flush left,halign lower=justify, \def\name{\glsbibwritefield{name}}% \def\desc{\glsbibwritefield{description}}% \def\defval{\glsbibwritefield{defaultvalue}}% + \def\defvalempty{\glsbibwritefield{defaultvalue}{\initvalnotefmt{empty}}}% \def\initval{\glsbibwritefield{initvalue}}% \def\initvalvaries{\glsbibwritefield{initvalue}{\initvalnotefmt{varies}}}% \def\initvalempty{\glsbibwritefield{initvalue}{\initvalnotefmt{empty}}}% @@ -2366,7 +2909,11 @@ halign upper=flush left,halign lower=justify, \def\gfilemetameta##1##2##3##4##5##6{\glsbibwriteentry{file}{file.##1##2##3##4##5}{\field{name}{\metametafilefmt{##1}{##2}{##3}{##4}{##5}}##6}}% \def\gext##1##2{\glsbibwriteentry{fileformat}{ext.##1}{\field{parent}{fileformat}\field{name}{\extfmt{##1}}##2}}% \def\gcmd##1##2{\glsbibwriteentry{command}{##1}{\field{name}{\csfmt{##1}}##2}}% + \def\gcmdpunc##1##2##3{\glsbibwriteentry{command}{##1}{\field{name}{\cspuncfmt{##2}}##3}}% \def\gcond##1##2{\glsbibwriteentry{command}{##1}{\field{name}{\csfmt{##1}}\syntax{\conditionsyntax}##2}}% + \def\gexplcond##1##2##3{\glsbibwriteentry{command}{##1:##2}{\field{name}{\csfmt{##1\explsuffix:##2\explTFsuffix}}##3}}% + \def\gexplpred##1##2##3{\glsbibwriteentry{command}{##1:##2}{\field{name}{\csfmt{##1\explsuffix:##2\explTFsuffix}}\field{explsuffix}{\dsb p}##3}}% + \def\gfn##1##2##3##4{\glsbibwriteentry{command}{##1}{\field{name}{\csfmt{##1:##2}}\field{variants}{##3}\field{base}{##1}##4}}% \def\gcmdmeta##1##2##3##4{\glsbibwriteentry{command}{##1##2##3}{\field{name}{\csmetafmt{##1}{##2}{##3}}##4}}% \def\gcmdmetameta##1##2##3##4##5##6{\glsbibwriteentry{command}{##1##2##3##4##5}{\field{name}{\csmetametafmt{##1}{##2}{##3}{##4}{##5}}##6}}% \def\gmod##1##2{\glsbibwriteentry{punctuation}{idx.mod.##1}{##2}}% @@ -2406,6 +2953,7 @@ halign upper=flush left,halign lower=justify, \immediate\openout\nlctuserguidebib=\jobname-gls.bib\relax \immediate\write\nlctuserguidebib{\glspercentchar\space Encoding: UTF-8} \immediate\write\nlctuserguidebib{@preamble{"\string\providecommand*{\string\csfmt}[1]{\string\glsbackslash\string\glsbackslash\glshashchar1}^^J + \string\providecommand*{\string\cspuncfmt}[1]{\string\glsbackslash\glshashchar1}^^J \string\providecommand{\string\dhyphen}{-}^^J \string\providecommand{\string\longargfmt}{--}^^J \string\providecommand{\string\shortargfmt}{-}^^J @@ -2480,6 +3028,8 @@ halign upper=flush left,halign lower=justify, \newcommand{\nlctuserguideletterrules}{\glsxtrGeneralLatinIrules} \newcommand{\nlctuserguideextrarules}{\string< \glsxtrMathItalicGreekIrules} +\renewcommand*{\glsxtrresourceinit}{\GlsXtrResourceInitEscSequences} + \newcommand{\nlctuserguideloadgls}[1]{% \GlsXtrLoadResources[src=\jobname-gls, break-at-not-match={original entrytype=(switchpunctuation|punctuation|command)}, @@ -2518,10 +3068,13 @@ halign upper=flush left,halign lower=justify, icon=symbol, \nlctuserguidecustomentryaliases }, - replicate-fields={name=pdftitlecasename}, - replicate-missing-field-action={fallback}, - interpret-fields={pdftitlecasename}, - field-case-change={pdftitlecasename=title}, + assign-fields= + { + sort = name + "¯" + extra , + pdftitlecasename = \INTERPRET { \FIRSTUC { name } } + [ entrytype->original =/term|index/ ] , + pdftitlecasename = name + }, category={same as original entry}, dual-category={same as primary}, combine-dual-locations={primary}, @@ -2537,6 +3090,8 @@ halign upper=flush left,halign lower=justify, save-child-count,save-root-ancestor, symbol-sort-fallback=name, not-match={original entrytype=(icon|nonindexed)}, + labelify-replace={{\string\\-}{}}, + labelify={alias}, #1 ]% \GlsXtrLoadResources[src=\jobname-gls, @@ -2730,6 +3285,8 @@ halign upper=flush left,halign lower=justify, } \newcommand{\summaryentrycommand}[1]{% + \bgroup + \def\explTFsuffix{\@explboolsyntaxfmt{TF}}% \textbf{\linkedentryname{#1}}% \syntax{#1}% \glsxtrifhasfield{initvalue}{#1}% @@ -2739,12 +3296,31 @@ halign upper=flush left,halign lower=justify, }% {% \gathermodifiers{#1}% - \ifdefempty\nlctmodifierlist{}% + \ifdefempty\nlctmodifierlist + {% + \gathervariants{#1}% + \ifdefempty\nlctvariantlist + {}% + {% + \hfill\summarytagfmt{\nlctvarianttag}\nlctvariantlist + \gdef\summaryentry@post@fill{\quad }% + }% + }% {% \hfill\summarytagfmt{\nlctmodifiertag}\nlctmodifierlist \gdef\summaryentry@post@fill{\quad }% }% }% + \glsxtrifhasfield{explsuffix}{#1}% + {% + \let\explsuffix\glscurrentfieldvalue + \let\explTFsuffix\relax + \let\TFsyntax\relax + \par\glossentryname{#1}% + \syntax{#1}% + }% + {}% + \egroup } \newcommand{\summaryentrypackageoption}{\summaryentryoption} @@ -2803,7 +3379,8 @@ halign upper=flush left,halign lower=justify, \newglossarystyle{summary} {% \renewenvironment{theglossary}% - {\setlength{\parindent}{0pt}% + {% + \setlength{\parindent}{0pt}% \setlength{\parskip}{0pt plus 0.3pt}% \raggedbottom \def\entryskip{\def\entryskip{\summaryentryskip}}% @@ -2950,7 +3527,7 @@ halign upper=flush left,halign lower=justify, \syntax{##2}% }% }% - \ifstrempty{##3}{}{\marginpar{\summaryloc{##3}}}% + \ifstrempty{##3}{}{\summarymarginpar{\summaryloc{##3}}}% \do@alias {% \summaryentry@post@fill @@ -3143,7 +3720,9 @@ halign upper=flush left,halign lower=justify, \preto\glossarypreamble{\glsadd[format=summarylocfmt]{#2}\createtarget{#2}{\strut}}% \ifglshasdesc{#2}% {% - \appto\glossarypreamble{\glossentrydesc{#2}\glspostdescription + \appto\glossarypreamble{% + \def\glscurrententrylabel{#2}% + \glossentrydesc{#2}\glspostdescription \glspar\medskip\glspar}% }{}% \renewcommand{\GlsXtrLocationField}{primarylocations}% @@ -3165,18 +3744,43 @@ halign upper=flush left,halign lower=justify, }% } +\ExplSyntaxOn +\cs_if_exist:NT \glsxtrbookindexsubsubitem +{ + \renewcommand{\glsxtrbookindexsubsubitem}[1]{ + \glstreeitem \hspace* { \dim_eval:n { #10 pt + 10pt } } + } +} +\ExplSyntaxOff + +% v1.11: +\newcommand{\nlctindexfirstmark}{} +\newcommand{\nlctindexlastmark}{} +\newcommand\nlctprebookindex{} +\newcommand\nlctindexmarkfmt[1]{{\small#1}} + \newcommand*{\printuserguideindex}[1][]{% \printunsrtglossary*[label=index,type=index,target=false,title=\indexname,style=bookindex,#1]% {% - \let\glsextrapostnamehook\statushook + \renewcommand{\nlctindexfirstmark}{% + \nlctindexmarkfmt\glsxtrbookindexfirstmark}% + \renewcommand{\nlctindexlastmark}{% + \nlctindexmarkfmt\glsxtrbookindexlastmark}% + \renewcommand\glsextrapostnamehook[1]{% + \statushook{##1}% + \glsxtrifhasfield{extra}{##1}{ (\glscurrentfieldvalue)}{}% + }% \renewcommand*{\glsxtrbookindexprelocation}[1]{% \glsxtrifhasfield{location}{##1}% {\,\textcolor{lightgray}{\dotfill}\,}% {}% }% - \let\printunsrtglossaryentryprocesshook\filteremptylocation - \let\glsxtrbookindexname\linkedentryname + \renewcommand*\glsxtrbookindexname[1]{% + \linkedentryname{##1}\nlctpostindexname{##1}}% + \renewcommand*{\glsxtrbookindexsubname}[1]{\linkedentryname{##1}}% + \let\printunsrtglossaryentryprocesshook\filteremptylocation \def\printunsrtglossarypredoglossary{% + \nlctprebookindex \ifnum\totalindexitems<21\relax \renewcommand*{\glsxtrbookindexmulticolsenv}{multicols*}% \fi}% |