| 1 |
%% |
| 2 |
%% This is file `bracealign-doc.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% bracealign.dtx (with options: `docstyle') |
| 8 |
%% |
| 9 |
%% This is a generated file. |
| 10 |
%% |
| 11 |
%% Copyright (C) 2025 by Julien Labbé <[email protected]> |
| 12 |
%% |
| 13 |
%% This file may be distributed and/or modified under the conditions of the LaTeX |
| 14 |
%% Project Public License (LPPL), either version 1.3c of this license or (at your |
| 15 |
%% option) any later version. The latest version of this license is in the file |
| 16 |
%% https://www.latex-project.org/lppl.txt |
| 17 |
%% |
| 18 |
\RequirePackage{xcolor} |
| 19 |
\RequirePackage{metalogo} |
| 20 |
\PassOptionsToPackage{hyperref}{xcolor} |
| 21 |
\RequirePackage[many]{tcolorbox} |
| 22 |
\tcbuselibrary{listings} |
| 23 |
\tcbuselibrary{documentation} |
| 24 |
\hypersetup{hidelinks} |
| 25 |
\definecolor{bracealign_lavender}{rgb}{0.92,0.92,1} |
| 26 |
\definecolor{bracealign_darkblue}{rgb}{0.1,0.2,0.5} |
| 27 |
\definecolor{bracealign_darkgreen}{rgb}{0,0.39,0} |
| 28 |
\definecolor{bracealign_beige}{rgb}{.96,.96,.86} |
| 29 |
\colorlet{bracealign_commands}{bracealign_darkblue} |
| 30 |
\colorlet{bracealign_keys}{bracealign_darkgreen} |
| 31 |
\colorlet{bracealign_lengths}{violet} |
| 32 |
\colorlet{bracealign_options}{Definition} % from tcolorbox documentation |
| 33 |
\lstdefinestyle{lstbracealigndoc}{% |
| 34 |
language = [LaTeX]TeX, |
| 35 |
alsoletter = {_,:},% for expl3 |
| 36 |
columns = fullflexible, |
| 37 |
keepspaces = true, |
| 38 |
keywordstyle = {\bfseries\color{bracealign_darkblue}}, |
| 39 |
texcsstyle = *{\bfseries\color{bracealign_darkblue}}, |
| 40 |
commentstyle = {\color{gray}}, |
| 41 |
identifierstyle = {\color{bracealign_darkgreen}}, |
| 42 |
morekeywords = {},% keywordsprefix needs a morekeywords before |
| 43 |
keywordsprefix = {\\}, |
| 44 |
literate = *{\$}{{\textcolor{red}{\$}}}{1} |
| 45 |
{\&}{{\textcolor{red}{\&}}}{1} |
| 46 |
{\}}{{\textcolor{darkgray}{\}}}}{1} |
| 47 |
{\{}{{\textcolor{darkgray}{\{}}}{1} |
| 48 |
{\\\\}{{\textcolor{red}{\textbackslash\textbackslash}}}{2} |
| 49 |
{\%\ \ \ \ }{}0, |
| 50 |
basicstyle = \ttfamily\footnotesize, |
| 51 |
frame = none, |
| 52 |
framesep = 0pt, |
| 53 |
aboveskip = 0pt, |
| 54 |
belowskip = 0pt, |
| 55 |
} |
| 56 |
\lstdefinestyle{lstbracealigncode}{% |
| 57 |
style = lstbracealigndoc, |
| 58 |
backgroundcolor = \color{bracealign_beige}, |
| 59 |
breakindent = 1cm, |
| 60 |
numbers = left, |
| 61 |
numberstyle = \scriptsize\ttfamily\color{gray}, |
| 62 |
aboveskip = \smallskipamount, |
| 63 |
belowskip = \smallskipamount, |
| 64 |
} |
| 65 |
\tcbset{% copied and adapted from tcolorbox.doc.s_main.sty |
| 66 |
documentation listing style=lstbracealigndoc,% |
| 67 |
doc keypath=bracealign, |
| 68 |
size=small,% |
| 69 |
% verbatim ignore percent, |
| 70 |
%% styles |
| 71 |
docexample/.style={% |
| 72 |
bicolor jigsaw, |
| 73 |
before skip balanced=\medskipamount, |
| 74 |
after skip balanced=\medskipamount, |
| 75 |
fonttitle=\bfseries, |
| 76 |
fontlower=\normalfont, |
| 77 |
halign lower=center, |
| 78 |
colframe=bracealign_darkblue, |
| 79 |
colback=bracealign_lavender, |
| 80 |
colbacklower=white, |
| 81 |
drop fuzzy shadow, |
| 82 |
}, |
| 83 |
color key=bracealign_keys, |
| 84 |
color command=bracealign_commands, |
| 85 |
color length=bracealign_lengths, |
| 86 |
doc head key={fontlower=\footnotesize, collower=darkgray}, |
| 87 |
before doc body={\parskip=\smallskipamount}, |
| 88 |
} |
| 89 |
\DeclareTotalTCBox{\code}{ v } |
| 90 |
{ |
| 91 |
verbatim, |
| 92 |
colframe=bracealign_beige, |
| 93 |
colback=bracealign_beige, |
| 94 |
sharp corners, |
| 95 |
size=tight, |
| 96 |
left=2pt, |
| 97 |
right=2pt, |
| 98 |
} |
| 99 |
{% |
| 100 |
\strut\lstinline[basicstyle=\ttfamily\small\color{bracealign_darkblue}]!#1!% |
| 101 |
} |
| 102 |
\begin{filecontents*}{\jobname.mst} |
| 103 |
actual '=' |
| 104 |
\end{filecontents*} |
| 105 |
\tcbset{% |
| 106 |
index actual={=}, |
| 107 |
index colorize=true, |
| 108 |
index gather all, |
| 109 |
index format=pgfsection, |
| 110 |
} |
| 111 |
\def\tcb@doc@index@pgfsection{% |
| 112 |
\def\index@prologue{% |
| 113 |
\section*{\kvtcb@text@index}\addcontentsline{toc}{section}{\kvtcb@text@index} |
| 114 |
{\small% |
| 115 |
Entries listed in the categories ``commands" and ``internal macros" also |
| 116 |
include references to package implementation. } |
| 117 |
\bigskip\par\noindent% |
| 118 |
}% |
| 119 |
\tcb@doc@index@pgf@% |
| 120 |
} |
| 121 |
\newcommand{\indexmacro}[1]{% |
| 122 |
\begingroup |
| 123 |
\let\lst@UM\@empty% |
| 124 |
\index{{Commands!#1=\tcbIndexPrintComC {#1}}}% |
| 125 |
\endgroup |
| 126 |
} |
| 127 |
\newcommand{\indexmacrointernal}[1]{% |
| 128 |
\begingroup |
| 129 |
\let\lst@UM\@empty% |
| 130 |
\index{{Internal macros!#1=\tcbIndexPrintComC {#1}}}% |
| 131 |
\endgroup |
| 132 |
} |
| 133 |
\newcommand{\indexlength}[1]{% |
| 134 |
\begingroup |
| 135 |
\let\lst@UM\@empty% |
| 136 |
\index{{Lengths!#1=\tcbIndexPrintLenC {#1}}}% |
| 137 |
\endgroup |
| 138 |
} |
| 139 |
\let\macrocode\relax |
| 140 |
\lstnewenvironment{macrocode}{% |
| 141 |
\lstset{% |
| 142 |
name=macrocode, |
| 143 |
firstnumber=auto, |
| 144 |
style=lstbracealigncode, |
| 145 |
showlines=false, |
| 146 |
keepspaces=true, |
| 147 |
texcs = [2]{% commands |
| 148 |
bracealignsetup |
| 149 |
,bracealign_add_brace:e |
| 150 |
,bracealign_add_brace:n |
| 151 |
,bracealign_add_brace:N |
| 152 |
,bracealign_bracealign:n |
| 153 |
}, |
| 154 |
index = [2][texcs2],% |
| 155 |
indexstyle = [2]\indexmacro,% |
| 156 |
texcs = [3]{% lengths |
| 157 |
}, |
| 158 |
index = [3][texcs3],% |
| 159 |
indexstyle = [3]\indexlength,% |
| 160 |
texcs = [4]{% internal macros (@@ → __bracealign with DocStrip) |
| 161 |
@@_define_switches:e |
| 162 |
,@@_define_switches:n |
| 163 |
,@@_define_switches:N |
| 164 |
,@@_finalize:n |
| 165 |
,@@_initialize:n |
| 166 |
,@@_update_active_braces: |
| 167 |
,@@_use_strutcontent:n |
| 168 |
,l@@_active_brace_seq |
| 169 |
,l@@_default_brace_clist |
| 170 |
,l@@_overbrace_bool |
| 171 |
,l@@_overbracket_bool |
| 172 |
,l@@_overparen_bool |
| 173 |
,l@@_underbrace_bool |
| 174 |
,l@@_underbracket_bool |
| 175 |
,l@@_underparen_bool |
| 176 |
}, |
| 177 |
index = [4][texcs4],% |
| 178 |
indexstyle = [4]\indexmacrointernal,% |
| 179 |
morekeywords = [2]{% |
| 180 |
bracealign/add-brace |
| 181 |
,bracealign/add-braces |
| 182 |
,bracealign/default-braces |
| 183 |
,bracealign/nooverbrace |
| 184 |
,bracealign/nooverbracket |
| 185 |
,bracealign/nooverparen |
| 186 |
,bracealign/nounderbrace |
| 187 |
,bracealign/nounderbracket |
| 188 |
,bracealign/nounderparen |
| 189 |
,bracealign/overbrace |
| 190 |
,bracealign/overbracket |
| 191 |
,bracealign/overparen |
| 192 |
,bracealign/underbrace |
| 193 |
,bracealign/underbracket |
| 194 |
,bracealign/underparen |
| 195 |
}, |
| 196 |
index = [3][keywords2],% |
| 197 |
indexstyle = [3]\lstindexmacro,% |
| 198 |
} |
| 199 |
\csname\@lst @SetFirstNumber\endcsname |
| 200 |
}{% |
| 201 |
\csname \@lst @SaveFirstNumber\endcsname |
| 202 |
} |
| 203 |
\DeclareDocumentEnvironment{macro}{m}{% |
| 204 |
\count@\escapechar \escapechar=-1 |
| 205 |
\edef\macroname{\string#1} |
| 206 |
\escapechar\count@ |
| 207 |
\marginpar{% |
| 208 |
\parbox{0.88\linewidth}{% |
| 209 |
\scriptsize\flushright\ifcsdef{r@com:\macroname}{\refCom*{\macroname}}{\cs{\macroname}}% |
| 210 |
}% |
| 211 |
} |
| 212 |
}{% end of macro environment |
| 213 |
} |
| 214 |
\def\refDoc#1{\tcb@ref@doc{#1}} |
| 215 |
\newcommand{\pkg}[1]{\textsf{#1}} |
| 216 |
\ExplSyntaxOn |
| 217 |
\cs_new_protected:Nn \bracealigndoc_cs:n |
| 218 |
{ |
| 219 |
\str_set:Nn \l_tmpa_str { #1 } |
| 220 |
\exp_args:Ne \texttt{ \c_backslash_str \str_use:N \l_tmpa_str } |
| 221 |
} |
| 222 |
\cs_generate_variant:Nn \bracealigndoc_cs:n { e } |
| 223 |
\RenewDocumentCommand{\cs}{ m }{\bracealigndoc_cs:e { #1} } |
| 224 |
\ExplSyntaxOff |
| 225 |
\newrobustcmd{\tcbIndexPrintOptionCA}[1]{% adapted from \tcbIndexPrintKeyCA |
| 226 |
\tcb@Index@Print@CA{#1}{bracealign_options}{package option}% |
| 227 |
} |
| 228 |
\newrobustcmd{\tcbIndexPrintOptionC}[1]{% adapted from \tcbIndexPrintKeyCA |
| 229 |
\tcb@Index@Print@C{#1}{bracealign_options}% |
| 230 |
} |
| 231 |
\DeclareDocumentEnvironment{docOption}{ O{} m }{% |
| 232 |
\begin{docKey*}[] |
| 233 |
[doc name={#2}, doc label={opt:#2}, color key=bracealign_options, #1] |
| 234 |
{#2}{}{}% |
| 235 |
\kvtcb@index@command{% |
| 236 |
\kvtcb@doc@sortindex\idx@actual\tcbIndexPrintOptionCA{#2}% |
| 237 |
}% |
| 238 |
\kvtcb@index@command{% |
| 239 |
{Package options}\idx@level\kvtcb@doc@sortindex\idx@actual% |
| 240 |
\tcbIndexPrintOptionC{#2}% |
| 241 |
}% |
| 242 |
}{% |
| 243 |
\end{docKey*}% |
| 244 |
} |
| 245 |
\def\refOpt{\refDoc{key:opt}} |
| 246 |
\endinput |
| 247 |
%% |
| 248 |
%% End of file `bracealign-doc.sty'. |