| 1 |
% \iffalse meta-comment |
| 2 |
% arara: lualatex: { branch: developer, draft: true } |
| 3 |
% arara: clean: { files: [ enumext-01.pdf, enumext-02.pdf, enumext-03.pdf, enumext-04.pdf, enumext-05.pdf ] } |
| 4 |
% arara: lualatex: { branch: developer, shell: true } |
| 5 |
% arara: clean: { extensions: [ aux, log, out, glo, gls, hd, ind, ilg, idx, toc, atfi ] } |
| 6 |
% arara: clean: { files: [ userdoc.idx, userdoc.ilg, userdoc.ind ] } |
| 7 |
% arara: halt |
| 8 |
% |
| 9 |
% File: enumext.dtx |
| 10 |
% |
| 11 |
% Copyright (C) 2024-2026 by Pablo González L <[email protected]> |
| 12 |
% |
| 13 |
% This work may be distributed and/or modified under the conditions of the |
| 14 |
% LaTeX Project Public License, either version 1.3c of this license or (at |
| 15 |
% your option) any later version. The latest version of this license is in |
| 16 |
% |
| 17 |
% https://www.latex-project.org/lppl.txt |
| 18 |
% |
| 19 |
% and version 1.3c or later is part of all distributions of LaTeX version |
| 20 |
% 2005/12/01 or later. |
| 21 |
% |
| 22 |
% This work is "maintained" (as per the LPPL maintenance status) |
| 23 |
% by Pablo González L. |
| 24 |
% |
| 25 |
% This work consists of the files enumext.dtx and enumext.sty. |
| 26 |
% |
| 27 |
% \fi |
| 28 |
% |
| 29 |
% \iffalse |
| 30 |
%<*driver> |
| 31 |
\documentclass[full]{l3doc} |
| 32 |
% Remove `"` and `|` for short verbatim defined in l3doc, then set short |...| |
| 33 |
\AtBeginDocument |
| 34 |
{ |
| 35 |
\DeleteShortVerb \" |
| 36 |
\DeleteShortVerb \| |
| 37 |
\lstMakeShortInline[language=enumext-doc,basicstyle=\ttfamily]\| |
| 38 |
} |
| 39 |
% imakeidx also opens a write stream for the .idx file, and that conflicts |
| 40 |
% with the one opened by l3doc. Here we close that write stream: |
| 41 |
\makeatletter |
| 42 |
\immediate\closeout\@indexfile |
| 43 |
\makeatother |
| 44 |
% and later we will copy the write stream opened by imakeidx into \@indexfile |
| 45 |
% so that entries written to both streams end up in the same file. |
| 46 |
\usepackage[english]{babel} |
| 47 |
\usepackage[top=0.5in,bottom=0.3in,left=1.70in,right=0.7in,footskip=0.2in,headheight=1cm,headsep=0.27cm]{geometry} |
| 48 |
\usepackage[osf,nomath,mono=false,ScaleSF=0.95,ScaleRM=0.95]{libertinus-otf} |
| 49 |
% Set Monospace font, fix 'quotes' in verbatim |
| 50 |
\usepackage{sourcecodepro} |
| 51 |
\defaultfontfeatures[\ttfamily] |
| 52 |
{ |
| 53 |
Numbers = OldStyle, |
| 54 |
Scale = 0.84249, |
| 55 |
Extension = .otf, |
| 56 |
} |
| 57 |
\setmonofont[ |
| 58 |
UprightFont = *-Regular, |
| 59 |
ItalicFont = *-RegularIt, |
| 60 |
BoldFont = *-Semibold, |
| 61 |
BoldItalicFont = *-SemiboldIt, |
| 62 |
RawFeature = {+zero,+ss01}]{SourceCodePro} |
| 63 |
\newfontfamily\mysourcecodeprolight{SourceCodePro-Regular.otf}[ |
| 64 |
Scale = 0.80,FakeStretch =0.75, |
| 65 |
FontFace = {m}{it}{Font =SourceCodePro-RegularIt.otf,Color=FF0000}] |
| 66 |
\RenewDocumentCommand{\MacroLongFont}{} |
| 67 |
{ |
| 68 |
\mysourcecodeprolight\small |
| 69 |
} |
| 70 |
% The character of visible space is now taken from Latin Modern Mono |
| 71 |
% to prevent fonts in T1. The original definition for xetex/luatex is |
| 72 |
% \def\verbvisiblespace{\usefont{OT1}{cmtt}{m}{n}\asciispace} |
| 73 |
\def\verbvisiblespace{{\fontfamily{lmtt}\selectfont\char"2423}} |
| 74 |
|
| 75 |
\usepackage{unicode-math} |
| 76 |
\setmathfont[Scale = 0.95]{latinmodern-math.otf} |
| 77 |
\usepackage{fontawesome5} |
| 78 |
\newfontfamily\fetamontotf{ffmw10.otf}[ |
| 79 |
Scale = 0.95,% |
| 80 |
RawFeature = {+latn,+rand,+kern,+size},% |
| 81 |
FontFace = {b}{n}{ffmw10.otf},% fix replace font |
| 82 |
] |
| 83 |
\usepackage[svgnames]{xcolor} |
| 84 |
\usepackage[sf,bf,compact,medium,pagestyles]{titlesec} |
| 85 |
\usepackage{lastpage,microtype,attachfile2} |
| 86 |
\usepackage{adjustbox,multicol,listings,accsupp,titletoc} |
| 87 |
\usepackage{imakeidx,tikz,enumext} % main |
| 88 |
\usepackage{scontents} |
| 89 |
\usepackage{shellesc} |
| 90 |
\usepackage[contents]{colordoc} |
| 91 |
% \show\docCodelineNo |
| 92 |
\def\textnew#1{\color{color-def}#1\/} |
| 93 |
\def\AltMacroFont{\fontencoding\encodingdefault |
| 94 |
\fontfamily\ttdefault |
| 95 |
\fontseries\mddefault |
| 96 |
\fontshape\updefault |
| 97 |
\small |
| 98 |
}% |
| 99 |
% Patching colordoc.sty to work with l3doc.cls |
| 100 |
\ExplSyntaxOn |
| 101 |
\cs_new_eq:cN { liii@xmacro@code } \__codedoc_xmacro_code:n |
| 102 |
\ExplSyntaxOff |
| 103 |
\begingroup |
| 104 |
\makeatletter |
| 105 |
\catcode`\[\@ne\catcode`\]\tw@ |
| 106 |
\@makebracesactive |
| 107 |
\gdef{[\@openingbrace[\char'173]] |
| 108 |
\gdef}[\@closingbrace[\char'175]] |
| 109 |
\catcode`\|\z@\catcode`\%12 |
| 110 |
\catcode`\ \active\catcode`\\\active |
| 111 |
|gdef|xmacro@code#1% \end{macrocode}[|liii@xmacro@code[#1]|end[macrocode]] |
| 112 |
|catcode`| 12|gdef|sxmacro@code#1% \end{macrocode*}[|liii@xmacro@code[#1]|end[macrocode*]] |
| 113 |
|endgroup |
| 114 |
% Patching colordoc.sty to work with doc v3 (TeX Live 2023 & lualatex-dev) |
| 115 |
\usepackage{etoolbox} |
| 116 |
\makeatletter |
| 117 |
\@ifpackagelater{doc}{2022-06-01}% |
| 118 |
{\patchcmd\macro@finish |
| 119 |
{\ifnot@excluded % \if |
| 120 |
\edef\@tempa{\noexpand\SpecialIndex{\bslash\macro@namepart}}% |
| 121 |
\@tempa \fi}% |
| 122 |
{\maybe@index@macro \macro@namepart} |
| 123 |
{}{\FAILED}% |
| 124 |
\let\default@color\current@color |
| 125 |
}% |
| 126 |
{} |
| 127 |
\makeatother |
| 128 |
|
| 129 |
\EnableCrossrefs |
| 130 |
% \PageIndex, \CodelineIndex undoes what \PageIndex does |
| 131 |
% \CodelineIndex tries to open another write stream for the index file. We don't |
| 132 |
% want that, so we temporarily make \makeindex a no-op: |
| 133 |
\let\ORGmakeindex\makeindex |
| 134 |
\def\makeindex{} |
| 135 |
\CodelineIndex |
| 136 |
\let\makeindex\ORGmakeindex |
| 137 |
\DoNotIndex{\ , \1,\^} |
| 138 |
\expandafter\DoNotIndex\expandafter{\string\{} |
| 139 |
\expandafter\DoNotIndex\expandafter{\string\}} |
| 140 |
\expandafter\DoNotIndex\expandafter{\string\begin} |
| 141 |
\newcommand{\HP}[1]{\emph{\hyperpage{#1}}\normalsize} |
| 142 |
\ExplSyntaxOn |
| 143 |
\cs_new_protected:Npn \StartImplementation |
| 144 |
{ \bool_set_true:N \l__codedoc_in_implementation_bool } |
| 145 |
\bool_set_false:N \l__codedoc_in_implementation_bool |
| 146 |
\cs_new_protected:Npn \MYSortIndex #1 #2 |
| 147 |
{ |
| 148 |
\bool_if:NTF \l__codedoc_in_implementation_bool |
| 149 |
{ \index{#1\actualchar#2|HP} } |
| 150 |
{ \index[userdoc]{#1\actualchar#2|HP} } |
| 151 |
} |
| 152 |
\ExplSyntaxOff |
| 153 |
% imakeidx config |
| 154 |
\indexsetup{level=\section,firstpagestyle=myheader,othercode=\pagestyle{myheader}} |
| 155 |
\makeindex[name=userdoc,options={-q -s gind.ist},columnsep=15pt,title={Index of Documentation}] |
| 156 |
\makeindex[options={-q -s gind.ist},columnsep=15pt,title={Index of Implementation}] |
| 157 |
% Now, after imakeidx opens the write stream for the index file, we copy |
| 158 |
% the reference to \@indexfile: |
| 159 |
\makeatletter |
| 160 |
\expandafter\let\expandafter\@indexfile\csname \jobname @idxfile\endcsname |
| 161 |
\makeatother |
| 162 |
% Set \parindent |
| 163 |
\setlength{\parindent}{0pt} |
| 164 |
% Colors |
| 165 |
\definecolor{optcolor}{rgb}{0.281,0.275,0.485} |
| 166 |
\definecolor{pkgcolor}{rgb}{0,0.5,0.5} |
| 167 |
\definecolor{araracolor}{rgb}{0, 0.72, 0.28} |
| 168 |
\definecolor{linkcolor}{rgb}{0.04,0.38,0.04} |
| 169 |
\definecolor{rulecolor}{rgb}{0.96,0.96,0.96} |
| 170 |
% Only for arara... I like arara :) |
| 171 |
\usepackage[scale=0.85]{comfortaa} |
| 172 |
\newcommand{\araratext}[1]{{\small\normalfont\comfortaa\color{araracolor}\bfseries#1}} |
| 173 |
\newcommand*\arara{\araratext{ar\kern-.03emar\kern-.03ema}} |
| 174 |
% User level commands |
| 175 |
\ExplSyntaxOn |
| 176 |
% Logo |
| 177 |
\NewDocumentCommand{\pkglogo}{} |
| 178 |
{ |
| 179 |
\group_begin: |
| 180 |
\LibertinusSansOsF{\textcolor{pkgcolor}{enum}\textcolor{OrangeRed}{ext}} |
| 181 |
\group_end: |
| 182 |
} |
| 183 |
% Custom \meta[...]{...}, \marg[...]{...} and \oarg[...]{...} with color |
| 184 |
\NewDocumentCommand{\mymeta}{O{}m} |
| 185 |
{ |
| 186 |
\userdoc_meta_generic:Nnn \userdoc_meta:n { #1 } { #2 } |
| 187 |
} |
| 188 |
\NewDocumentCommand{\mymarg}{O{}m} |
| 189 |
{ |
| 190 |
\userdoc_meta_generic:Nnn \userdoc_marg:n { #1 } { #2 } |
| 191 |
} |
| 192 |
\NewDocumentCommand{\myoarg}{O{}m} |
| 193 |
{ |
| 194 |
\userdoc_meta_generic:Nnn \userdoc_oarg:n { #1 } { #2 } |
| 195 |
} |
| 196 |
\NewDocumentCommand{\myparg}{O{}m} |
| 197 |
{ |
| 198 |
\userdoc_meta_generic:Nnn \userdoc_parg:n { #1 } { #2 } |
| 199 |
} |
| 200 |
% Variables and keys |
| 201 |
\tl_new:N \l_userdoc_meta_font_tl |
| 202 |
\keys_define:nn { userdoc / mymeta } |
| 203 |
{ |
| 204 |
type .choice:, |
| 205 |
type / tt .code:n = \tl_set:Nn \l_userdoc_meta_font_tl { \ttfamily }, |
| 206 |
type / rm .code:n = \tl_set:Nn \l_userdoc_meta_font_tl { \rmfamily }, |
| 207 |
type .initial:n = tt, |
| 208 |
cf .tl_set:N = \l_userdoc_meta_color_tl, |
| 209 |
cf .initial:n = optcolor, |
| 210 |
ac .tl_set:N = \l_userdoc_meta_anglecolor_tl, |
| 211 |
ac .initial:n = lightgray, |
| 212 |
sbc .tl_set:N = \l_userdoc_meta_brackcolor_tl, |
| 213 |
sbc .initial:n = gray, |
| 214 |
cbc .tl_set:N = \l_userdoc_meta_bracecolor_tl, |
| 215 |
cbc .initial:n = gray, |
| 216 |
pbc .tl_set:N = \l_userdoc_meta_parencolor_tl, |
| 217 |
pbc .initial:n = gray, |
| 218 |
} |
| 219 |
% Internal commands |
| 220 |
\cs_new_protected:Npn \userdoc_meta_generic:Nnn #1 #2 #3 |
| 221 |
{ |
| 222 |
\group_begin: |
| 223 |
\keys_set:nn { userdoc / mymeta } { #2 } |
| 224 |
\color{ \l_userdoc_meta_color_tl } |
| 225 |
\l_userdoc_meta_font_tl |
| 226 |
#1 { #3 } % #1 is \userdoc_meta:n, \userdoc_marg:n or \userdoc_oarg:n |
| 227 |
\group_end: |
| 228 |
} |
| 229 |
\cs_new_protected:Npn \userdoc_meta:n #1 |
| 230 |
{ |
| 231 |
\userdoc_meta_angle:n { \textlangle } |
| 232 |
\userdoc_meta_meta:n { #1 } |
| 233 |
\userdoc_meta_angle:n { \textrangle } |
| 234 |
} |
| 235 |
\cs_new_protected:Npn \userdoc_marg:n #1 |
| 236 |
{ |
| 237 |
\userdoc_meta_brace:n { \textbraceleft } |
| 238 |
\userdoc_meta:n { #1 } |
| 239 |
\userdoc_meta_brace:n { \textbraceright } |
| 240 |
} |
| 241 |
\cs_new_protected:Npn \userdoc_oarg:n #1 |
| 242 |
{ |
| 243 |
\userdoc_meta_brack:n { [ } |
| 244 |
\userdoc_meta:n { #1 } |
| 245 |
\userdoc_meta_brack:n { ] } |
| 246 |
} |
| 247 |
\cs_new_protected:Npn \userdoc_parg:n #1 |
| 248 |
{ |
| 249 |
\userdoc_meta_brace:n { ( } |
| 250 |
\userdoc_meta:n { #1 } |
| 251 |
\userdoc_meta_brace:n { ) } |
| 252 |
} |
| 253 |
\cs_new_protected:Npn \userdoc_meta_meta:n #1 |
| 254 |
{ |
| 255 |
\textnormal{\textit{#1}} |
| 256 |
} |
| 257 |
\cs_new_protected:Npn \userdoc_meta_angle:n #1 |
| 258 |
{ |
| 259 |
\group_begin: |
| 260 |
\fontfamily{lmr}\selectfont |
| 261 |
\textcolor{\l_userdoc_meta_anglecolor_tl}{#1} |
| 262 |
\group_end: |
| 263 |
} |
| 264 |
\cs_new_protected:Npn \userdoc_meta_brace:n #1 |
| 265 |
{ |
| 266 |
\group_begin: |
| 267 |
\color{\l_userdoc_meta_bracecolor_tl} |
| 268 |
#1 |
| 269 |
\group_end: |
| 270 |
} |
| 271 |
\cs_new_protected:Npn \userdoc_meta_brack:n #1 |
| 272 |
{ |
| 273 |
\textcolor{\l_userdoc_meta_brackcolor_tl}{#1} |
| 274 |
} |
| 275 |
% Rewrite \textborn | textasteriskcentered |
| 276 |
\DeclareTextSymbol{\textbornstd}{TS1}{98} |
| 277 |
\UndeclareTextCommand{\textborn}{TS1} |
| 278 |
\makeatletter |
| 279 |
\DeclareTextCommandDefault{\textbornstd}{\tc@check@symbol2\textbornstd} |
| 280 |
\makeatother |
| 281 |
\DeclareRobustCommand{\textborn}{{\fontfamily{lmr}\selectfont\textbornstd}} |
| 282 |
\newcommand{\oldtextasteriskcentered}{{\fontfamily{lmr}\selectfont\textasteriskcentered}} |
| 283 |
% \envexamp{m} |
| 284 |
\newsavebox{\boxexaenv} |
| 285 |
\tl_new:N \l_tempc_tl |
| 286 |
\NewDocumentCommand \envexamp { m } |
| 287 |
{ |
| 288 |
\tl_set:Nn \l_tempc_tl { #1 } |
| 289 |
\regex_replace_once:nnN { (\*) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tempc_tl |
| 290 |
\begin{lrbox}{\boxexaenv}% |
| 291 |
\begin{minipage}[t]{3\marginparwidth}% |
| 292 |
\raggedright\ttfamily\small |
| 293 |
\textcolor{gray}{\textbackslash begin\{\textcolor{pkgcolor}{{\tl_use:N \l_tempc_tl}}\}\myoarg |
| 294 |
[type=tt,sbc=gray,ac=lightgray,cf=optcolor]{keyval~list}}\par% |
| 295 |
\hspace{0.25cm}\ics*{item}\space\mymeta[ac=lightgray,cf=gray]{item~content}\par% |
| 296 |
\hspace{0.25cm}\ics*{item}\space\myoarg[sbc=gray,ac=lightgray,cf=optcolor]{custom}\space\mymeta[ac=lightgray,cf=gray]{item~content}\par |
| 297 |
\hspace{0.25cm}\ics*{item*}\myoarg[sbc=gray,ac=lightgray,cf=optcolor]{symbol}\myoarg[sbc=gray,ac=lightgray,cf=optcolor]{offset}\space\mymeta[ac=lightgray,cf=gray]{item~content}\par |
| 298 |
\textcolor{gray}{\textbackslash end\{{\textcolor{pkgcolor}{{\tl_use:N \l_tempc_tl}}}\}}\par |
| 299 |
\end{minipage}% |
| 300 |
\end{lrbox}% |
| 301 |
\usebox{\boxexaenv} |
| 302 |
} |
| 303 |
% \cmdexamp{o m o m o} |
| 304 |
\tl_new:N \l_tempd_tl |
| 305 |
\NewDocumentCommand \cmdexamp { o m o m o } |
| 306 |
{ |
| 307 |
\group_begin: |
| 308 |
\small\ttfamily |
| 309 |
\textcolor{pkgcolor}{\textbackslash#2} |
| 310 |
\IfValueT{#1}{ \textcolor{MediumOrchid}{#1} } |
| 311 |
\IfValueT{#3} |
| 312 |
{ |
| 313 |
% \textnormal{\ttfamily } or \c{texttt}\cB\{ \cE\} |
| 314 |
\tl_set:Nn \l_tempd_tl { #3 } |
| 315 |
% \regex_replace_once:nnN { (\*) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tempd_tl |
| 316 |
\regex_replace_once:nnN { (\*) } { \c{texttt}\cB\{\c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} \cE\} } \l_tempd_tl |
| 317 |
\myoarg[type=tt,sbc=gray,ac=lightgray,cf=optcolor]{\tl_use:N \l_tempd_tl} |
| 318 |
} |
| 319 |
\IfValueTF{#5} |
| 320 |
{ |
| 321 |
\mymeta[ac=gray,type=tt,cf=MediumOrchid]{#5}% |
| 322 |
\mymeta[type=tt,ac=gray,cf=optcolor]{#4} |
| 323 |
\mymeta[ac=gray,type=tt,cf=MediumOrchid]{#5}% |
| 324 |
} |
| 325 |
{ \mymarg[type=tt,cbc=gray,ac=lightgray,cf=optcolor]{#4} } |
| 326 |
\par |
| 327 |
\group_end: |
| 328 |
} |
| 329 |
% \keyexamp{s m m m} |
| 330 |
\NewDocumentCommand \keyexamp{s m m m } |
| 331 |
{ |
| 332 |
\adjustbox{outer=-\marginparsep}{\textcolor{optcolor}{\small\ttfamily{#2}}} |
| 333 |
\IfBooleanTF{#1} |
| 334 |
{ |
| 335 |
\hphantom{\textcolor{white}{\,\bfseries\texttt{=}}\,{}} |
| 336 |
\mymeta[type=tt,cbc=gray,ac=lightgray,cf=lightgray]{\small{#3}} |
| 337 |
} |
| 338 |
{ |
| 339 |
\textcolor{gray}{\,\bfseries\texttt{=}}\,{} |
| 340 |
\mymarg[type=tt,cbc=gray,ac=lightgray,cf=optcolor]{\small{#3}} |
| 341 |
} |
| 342 |
\hfill\textcolor{gray}{\small\textsf{default}:~\emph{#4}}\par% |
| 343 |
\MYSortIndex{Keys}{Keys~for~environments~provide~by~\pkglogo :>\texttt{#2}} |
| 344 |
} |
| 345 |
% \keyexampcmd{s m m m o} |
| 346 |
\NewDocumentCommand \keyexampcmd{s m m m o} |
| 347 |
{ |
| 348 |
\adjustbox{outer=-\marginparsep}{\textcolor{optcolor}{\small\ttfamily{#2}}} |
| 349 |
\IfBooleanTF{#1} |
| 350 |
{ |
| 351 |
\hphantom{\textcolor{white}{\,\bfseries\texttt{=}}\,{}} |
| 352 |
\mymeta[type=tt,cbc=gray,ac=lightgray,cf=lightgray]{\small{#3}} |
| 353 |
} |
| 354 |
{ |
| 355 |
\textcolor{gray}{\,\bfseries\texttt{=}}\,{} |
| 356 |
\mymarg[type=tt,cbc=gray,ac=lightgray,cf=optcolor]{\small{#3}} |
| 357 |
} |
| 358 |
\hfill\textcolor{gray}{\small\textsf{default}:~\emph{#4}}\par% |
| 359 |
\IfValueTF{#5} |
| 360 |
{ |
| 361 |
\MYSortIndex{Keys}{Keys~for~\texttt{\textbackslash{}#5}~provide~by~\pkglogo :>\texttt{#2}} |
| 362 |
} |
| 363 |
{ |
| 364 |
\MYSortIndex{Keys}{Keys~for~\texttt{\textbackslash{}anskey}~provide~by~\pkglogo :>\texttt{#2}} |
| 365 |
\MYSortIndex{Keys}{Keys~for~\texttt{anskey\textcolor{MediumOrchid}{*}}~provide~by~\pkglogo :>\texttt{#2}} |
| 366 |
} |
| 367 |
} |
| 368 |
% \keyexampenv{s m m m} |
| 369 |
\NewDocumentCommand \keyexampenv{s m m m } |
| 370 |
{ |
| 371 |
\adjustbox{outer=-\marginparsep}{\textcolor{optcolor}{\small\ttfamily{#2}}} |
| 372 |
\IfBooleanTF{#1} |
| 373 |
{ |
| 374 |
\hphantom{\textcolor{white}{\,\bfseries\texttt{=}}\,{}} |
| 375 |
\mymeta[type=tt,cbc=gray,ac=lightgray,cf=lightgray]{\small{#3}} |
| 376 |
} |
| 377 |
{ |
| 378 |
\textcolor{gray}{\,\bfseries\texttt{=}}\,{} |
| 379 |
\mymarg[type=tt,cbc=gray,ac=lightgray,cf=optcolor]{\small{#3}} |
| 380 |
} |
| 381 |
\hfill\textcolor{gray}{\small\textsf{default}:~\emph{#4}}\par% |
| 382 |
\MYSortIndex{Keys}{Keys~for~\texttt{anskey\textcolor{MediumOrchid}{*}}~provide~by~\pkglogo :>\texttt{#2}} |
| 383 |
} |
| 384 |
% \mykey{m} |
| 385 |
\NewDocumentCommand \mykey{ m } |
| 386 |
{ |
| 387 |
\tl_set:Nn \l_tmpa_tl { #1 } |
| 388 |
\regex_replace_once:nnN { (\*) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl |
| 389 |
\textcolor{optcolor}{\ttfamily \tl_use:N \l_tmpa_tl } |
| 390 |
%\textcolor{optcolor}{\texttt{#1}} |
| 391 |
\MYSortIndex{Keys}{Keys~for~environments~provide~by~\pkglogo :>\texttt{\tl_use:N \l_tmpa_tl}} |
| 392 |
} |
| 393 |
% \mykeycmd{o s m} |
| 394 |
\NewDocumentCommand \mykeycmd{ o s m } |
| 395 |
{ |
| 396 |
\tl_set:Nn \l_tmpa_tl { #3 } |
| 397 |
\regex_replace_once:nnN { (\*) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl |
| 398 |
\textcolor{optcolor}{\ttfamily \tl_use:N \l_tmpa_tl } |
| 399 |
%\textcolor{optcolor}{\texttt{#1}} |
| 400 |
\IfBooleanTF{#2} |
| 401 |
{ |
| 402 |
\MYSortIndex{Keys}{Keys~for~\texttt{anskey\textcolor{MediumOrchid}{*}}~provide~by~\pkglogo :>\texttt{\tl_use:N \l_tmpa_tl}} |
| 403 |
} |
| 404 |
{ |
| 405 |
\IfValueTF{#1} |
| 406 |
{ |
| 407 |
\MYSortIndex{Keys}{Keys~for~\texttt{\textbackslash{}#1}~provide~by~\pkglogo :>\texttt{\tl_use:N \l_tmpa_tl}} |
| 408 |
} |
| 409 |
{ |
| 410 |
\MYSortIndex{Keys}{Keys~for~\texttt{\textbackslash{}anskey}~provide~by~\pkglogo :>\texttt{\tl_use:N \l_tmpa_tl}} |
| 411 |
\MYSortIndex{Keys}{Keys~for~\texttt{anskey\textcolor{MediumOrchid}{*}}~provide~by~\pkglogo :>\texttt{\tl_use:N \l_tmpa_tl}} |
| 412 |
} |
| 413 |
} |
| 414 |
} |
| 415 |
% \mypkg{sm} |
| 416 |
\NewDocumentCommand \mypkg { s m } |
| 417 |
{ |
| 418 |
\group_begin: |
| 419 |
\IfBooleanTF{#1} |
| 420 |
{ |
| 421 |
\pkglogo |
| 422 |
\MYSortIndex{packages}{Packages :>\texttt{#2}} |
| 423 |
} |
| 424 |
{ |
| 425 |
\textcolor{OrangeRed}{\texttt{#2}}% |
| 426 |
\MYSortIndex{packages}{Packages :>\texttt{#2}}% |
| 427 |
} |
| 428 |
\group_end: |
| 429 |
} |
| 430 |
% \myclass{m} |
| 431 |
\NewDocumentCommand \myclass { m } |
| 432 |
{ |
| 433 |
\mbox{\texttt{\textcolor{OrangeRed}{#1}}} |
| 434 |
\MYSortIndex{class}{Document~class :>\texttt{#1}} |
| 435 |
} |
| 436 |
% \myenv{sm} |
| 437 |
\NewDocumentCommand \myenv { s m O{}} |
| 438 |
{ |
| 439 |
\IfBooleanTF{#1} |
| 440 |
{ |
| 441 |
\tl_set:Nn \l_tmpa_tl { #2 } |
| 442 |
\regex_replace_once:nnN { (\*) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl |
| 443 |
\textcolor{pkgcolor}{\ttfamily{\tl_use:N \l_tmpa_tl}}% |
| 444 |
\MYSortIndex{environment}{Environments~provide~by ~\pkglogo :>\texttt{\tl_use:N \l_tmpa_tl}} |
| 445 |
} |
| 446 |
{ |
| 447 |
\textcolor{SlateBlue}{\ttfamily{#2}}% |
| 448 |
\MYSortIndex{environment}{Environments :>\texttt{#2}} |
| 449 |
} |
| 450 |
} |
| 451 |
% \ics{sm} |
| 452 |
\NewDocumentCommand \ics {s m} |
| 453 |
{ |
| 454 |
\IfBooleanTF{#1} |
| 455 |
{ |
| 456 |
\tl_set:Nn \l_tmpa_tl { #2 } |
| 457 |
\regex_replace_once:nnN { (\*) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl |
| 458 |
\regex_replace_once:nnN { (!) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl |
| 459 |
\textcolor{pkgcolor}{\ttfamily\textbackslash{\tl_use:N \l_tmpa_tl}} |
| 460 |
\MYSortIndex{Commands}{Commands~provide ~by~\pkglogo :>\texttt{\textbackslash#2}} |
| 461 |
} |
| 462 |
{ |
| 463 |
\textcolor{blue!75}{\ttfamily\textbackslash{#2}} |
| 464 |
\MYSortIndex{#2}{\texttt{\textbackslash#2}} |
| 465 |
} |
| 466 |
} |
| 467 |
% \icounter{m} |
| 468 |
\NewDocumentCommand \icounter { m } |
| 469 |
{ |
| 470 |
\textcolor{optcolor}{\ttfamily #1} |
| 471 |
\MYSortIndex{Counters}{Counters~defined~by~\pkglogo :>\texttt{#1}} |
| 472 |
} |
| 473 |
% \idimen{m} |
| 474 |
\NewDocumentCommand \idimen { m } |
| 475 |
{ |
| 476 |
\textcolor{pkgcolor}{\ttfamily\textbackslash #1} |
| 477 |
\MYSortIndex{#1}{\texttt{\textbackslash#1}} |
| 478 |
\MYSortIndex{Dimension}{Dimension~defined~by~\pkglogo :>\texttt{\textbackslash#1}} |
| 479 |
} |
| 480 |
% \ilabel{sm} |
| 481 |
\NewDocumentCommand \ilabel {s m } |
| 482 |
{ |
| 483 |
\tl_set:Nn \l_tmpb_tl { #2 } |
| 484 |
\tl_remove_once:Nn \l_tmpb_tl { . } |
| 485 |
\tl_remove_once:Nn \l_tmpb_tl { ) } |
| 486 |
\tl_remove_once:Nn \l_tmpb_tl { ( } |
| 487 |
\MYSortIndex{Labels}{ Labels~provide~by~\pkglogo :>\texttt{\textbackslash \tl_use:N \l_tmpb_tl }} |
| 488 |
\tl_set:Nn \l_tmpa_tl { #2 } |
| 489 |
\regex_replace_once:nnN { (\*) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl |
| 490 |
\regex_replace_once:nnN { (\.) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl |
| 491 |
\regex_replace_once:nnN { (\() } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl |
| 492 |
\regex_replace_once:nnN { (\)) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl |
| 493 |
\tl_put_left:Nn \l_tmpa_tl { \textbackslash } |
| 494 |
\IfBooleanT{#1} |
| 495 |
{ |
| 496 |
\tl_put_left:Nn \l_tmpa_tl { \textcolor{MediumOrchid}{ ( } } |
| 497 |
}% |
| 498 |
\textcolor{optcolor}{ \ttfamily \tl_use:N \l_tmpa_tl } |
| 499 |
} |
| 500 |
% \mydim{m} |
| 501 |
\NewDocumentCommand \mydim { m } |
| 502 |
{ |
| 503 |
\tl_set:Nn \l_tmpa_tl { #1 } |
| 504 |
\regex_replace_all:nnN { (\d) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl |
| 505 |
\regex_replace_all:nnN { (\.) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl |
| 506 |
\textcolor{gray}{ \ttfamily \tl_use:N \l_tmpa_tl } |
| 507 |
} |
| 508 |
% \myfile{m} |
| 509 |
\NewDocumentCommand \myfile { m } |
| 510 |
{ |
| 511 |
\group_begin: |
| 512 |
\tl_clear:N \l_tmpa_tl |
| 513 |
\tl_set:Nn \l_tmpa_tl { #1 } |
| 514 |
\regex_replace_all:nnN { (\d) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl |
| 515 |
\regex_replace_all:nnN { (\.) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl |
| 516 |
\textcolor{gray}{ \ttfamily \tl_use:N \l_tmpa_tl } |
| 517 |
\group_end: |
| 518 |
} |
| 519 |
% \myvarenv{m} |
| 520 |
\NewDocumentCommand \myvarenv { s m } |
| 521 |
{ |
| 522 |
\group_begin: |
| 523 |
\tl_set:Nn \l_tmpa_tl { #2 } |
| 524 |
\regex_replace_once:nnN { @{2} }{ enumext } \l_tmpa_tl |
| 525 |
\regex_replace_once:nnN { (\*) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl |
| 526 |
\regex_replace_once:nnN { (\:) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl |
| 527 |
\IfBooleanTF{#1} |
| 528 |
{ |
| 529 |
\textcolor{pkgcolor}{ \ttfamily \tl_use:N \l_tmpa_tl } |
| 530 |
} |
| 531 |
{ |
| 532 |
\tl_put_left:Nn \l_tmpa_tl { \textbackslash } |
| 533 |
\textcolor{gray}{ \ttfamily \tl_use:N \l_tmpa_tl } |
| 534 |
} |
| 535 |
\group_end: |
| 536 |
} |
| 537 |
% \aviso |
| 538 |
\NewDocumentCommand \aviso { } |
| 539 |
{ |
| 540 |
\par\hspace*{-0.5\marginparsep}% |
| 541 |
\makebox[0pt][r] |
| 542 |
{ |
| 543 |
\makebox[\marginparsep][r] |
| 544 |
{ |
| 545 |
\scriptsize\textcolor{pkgcolor}{\reflectbox{\faIcon{tag}}}% tagged PDF |
| 546 |
} |
| 547 |
} |
| 548 |
\hskip 0.5\marginparsep |
| 549 |
} |
| 550 |
% \bomba |
| 551 |
\NewDocumentCommand \bomba { } |
| 552 |
{ |
| 553 |
\par\hspace*{-0.5\marginparsep}% |
| 554 |
\makebox[0pt][r] |
| 555 |
{ |
| 556 |
\makebox[\marginparsep][r] |
| 557 |
{ |
| 558 |
\footnotesize\textcolor{pkgcolor}{\faIcon{bomb}} |
| 559 |
} |
| 560 |
} |
| 561 |
\hskip 0.5\marginparsep |
| 562 |
} |
| 563 |
\NewDocumentEnvironment{important}{ s } |
| 564 |
{ |
| 565 |
\small\sffamily |
| 566 |
\IfBooleanTF{#1} |
| 567 |
{ |
| 568 |
\bomba% |
| 569 |
} |
| 570 |
{ \aviso } |
| 571 |
}{} |
| 572 |
|
| 573 |
\ExplSyntaxOff |
| 574 |
% email https://tex.stackexchange.com/a/663 |
| 575 |
\catcode`\_=11\relax% |
| 576 |
\newcommand\email[1]{\_email #1\q_nil}% |
| 577 |
\def\_email#1@#2\q_nil{% |
| 578 |
\href{mailto:#1@#2}{{\emailfont #1\emailampersat #2}}% |
| 579 |
}% |
| 580 |
\newcommand\emailfont{\sffamily}% |
| 581 |
\newcommand\emailampersat{{\color{optcolor}\footnotesize @}}% |
| 582 |
\catcode`\_=8\relax% |
| 583 |
% Don't copy numbers in code example |
| 584 |
\newcommand*{\noaccsupp}[1]{\BeginAccSupp{ActualText={}}#1\EndAccSupp{}} |
| 585 |
% Create a language for documentation |
| 586 |
\lstdefinelanguage{enumext-doc}{ |
| 587 |
texcsstyle = *,% |
| 588 |
escapechar =`,% |
| 589 |
extendedchars = true,% |
| 590 |
keepspaces = true,% |
| 591 |
stringstyle = {\color{red}},% |
| 592 |
basicstyle = \ttfamily,% \small |
| 593 |
alsoletter = {-,.},% @, |
| 594 |
% comments |
| 595 |
morecomment = [l]{\%},% |
| 596 |
commentstyle = \ttfamily\small\color{lightgray},% |
| 597 |
% Important words 1 |
| 598 |
keywordstyle = [1]{\color{gray}},% |
| 599 |
keywords = [1]{begin,end,Verbatim,env,myseq,false,NewDocumentCommand,newlength, the, red, blue, gray,% |
| 600 |
settowidth, dimeval, dimexpr, IfBooleanTF,footnotehyper, DocumentMetadata, % |
| 601 |
IfDocumentMetadataTF, IfDocumentMetadataF, RenewDocumentCommand, pt, em, % |
| 602 |
SuspendTagging, ResumeTagging, NewCommandCopy, IfHyperBoolean, N, NN, J, D, Nee, % |
| 603 |
Nnn, nn, Ne, w, n, % |
| 604 |
},% |
| 605 |
% Other words 2 |
| 606 |
keywordstyle = [2]{\color{blue!75}},% |
| 607 |
keywords = [2]{usepackage, section, documentclass, input, listparindent, linewidth, emph, textbf, makesavenoteenv, makelabel,% |
| 608 |
columnseprule, footnote, footnotemark, footnotetext, raggedcolumns, hspace, parindent, removelastskip, % |
| 609 |
subsection, list, endlist, leftmargin, itemindent,bfseries,endminipage, minipage, parskip, raisebox, strut,smash, % , |
| 610 |
labelwidth, labelsep, labelindent, label, ref, topsep,parsep,includegraphics, itemize, description, % |
| 611 |
multicolsep,leftmargini,leftmarginii, hfill, small, vspace, par, parbox, value, noindent, makebox, textcolor, % |
| 612 |
itemindent, labelwidth, leftmarginiii,leftmarginiv,itemindent, itemsep, strutbox, raggedright, cs_new_eq, N, NN,% |
| 613 |
labelwidth, fbox, addvspace, Alph, alph, arabic, Roman, roman, partopsep, baselineskip, mode_leave_vertical,% |
| 614 |
textborn, textbullet, textendash, textasteriskcentered, textperiodcentered, raggedleft, peek_remove_spaces, skip_horizontal, % |
| 615 |
triangleright, diamond, circ, parleft, star, centering, ast, hyperlink, hypertarget, newtheorem, counterwithin, % |
| 616 |
aux_i, aux_ii, aux_iii, exp_args, if@noitemarg, if, if@hyper@item, hyper, noitemarg, regex_match, regex_if_match,% |
| 617 |
skip_vertical, obeyedline, tl_replace_all, mbox, tl_rescan, tl_set_rescan, tex_scantokens, setcounter, |
| 618 |
.code, .meta, marginpar, c_zero_skip, tl_retokenize, keys_define,},% |
| 619 |
% Other words 3 |
| 620 |
keywordstyle = [3]{\color{optcolor!85}},% |
| 621 |
keywords = [3]{document,article,setlength,pagestyle,definecolor, chapter,},%, |
| 622 |
% Reserved words 4 (enumext pkg) |
| 623 |
keywordstyle = [4]{\color{pkgcolor}},% |
| 624 |
keywords = [4]{enumext,keyans,keyanspic, getkeyans, anskey, anspic, item, anskey*, itemwidth, enumextmeta, % |
| 625 |
setenumext,printkeyans,miniright,labelbx, mywrap, descitemwd,theenumXi,theenumXii,theenumXiii,% |
| 626 |
setenumextmeta, foreachkeyans, theenumX, theenumXiv,theenumXv, theenumXvii, theenumXviii,% |
| 627 |
resetenumext,},% |
| 628 |
% Reserved words 5 (plain TeX or internal) |
| 629 |
keywordstyle = [5]{\color{red}},% |
| 630 |
keywords = [5]{makeatletter,makeatother,let,verb,def,prevdepth,glue, if@minipage,% if@noitemarg |
| 631 |
splittopskip,showboxdepth,topskip,showoutput,nointerlineskip, ignorespaces, unskip, unkern, lastnodetype,% |
| 632 |
rightskip, @rightskip, flushglue, @flushglue, hbadness, hss, scantokens, beginparpenalty, itempenalty, % |
| 633 |
endparpenalty, lowpenalty,},% |
| 634 |
% Reserved words 6 (optcolor) KEYS and counters |
| 635 |
keywordstyle = [6]{\color{optcolor}},% |
| 636 |
keywords = [6]{save-ans,wrap-ans,save-ref,show-pos,show-ans,columns,list-offset, eunumXi, enumX, % |
| 637 |
nosep,before,after,start, right, item-sym, item-sep, hyperfootnotes, item-star, % |
| 638 |
scale,wrap-label,font,first,widest,mini-env,list-indent, no-store, save-key, save-sep, ref,% |
| 639 |
store-env, print-env, write-out, force-eol, write-env, overwrite, unknown, base-fix,% |
| 640 |
midsep, wrapper,label-pos,label-sep, layout-sty, layout-sep, layout-top, lang, tagging, % |
| 641 |
pdfversion, pdfstandard, testphase, alt, mark-sep, wrap-ans*, mark-ans, mark-sep, beginpenalty,% |
| 642 |
midpenalty, endpenalty,reset,resume,resume*,reset, reset*,},% |
| 643 |
% Reserved words 7 (label values) |
| 644 |
keywordstyle = [7]{\color{MediumOrchid}},% |
| 645 |
keywords = [7]{m,s,M,VIII,viii,v,E,t,l,A,XXIII,true, false,test,sample,above,below,ua-2,phase-III,% |
| 646 |
en-US, math, title, table, firstaid, on,},% |
| 647 |
% literate |
| 648 |
literate =*{\{}{{{\color{gray}{\char`\{}}}}{1} |
| 649 |
{\}}{{{\color{gray}{\char`\}}}}}{1} |
| 650 |
{\|}{{{\color{gray}{\char`\|}}}}{1} |
| 651 |
{\$}{{{\color{gray}{\char`\$}}}}{1} |
| 652 |
{\#}{{{\color{optcolor}{\char`\#}}}}{1} |
| 653 |
{[}{{\textcolor{gray}{[}}}{1} |
| 654 |
{]}{{\textcolor{gray}{]}}}{1} |
| 655 |
{,}{{\textcolor{gray}{,}}}{1} |
| 656 |
{;}{{\textcolor{gray}{;}}}{1} |
| 657 |
{:}{{\textcolor{red}{:}}}{1} |
| 658 |
{`}{{\textcolor{gray}{\textasciigrave}}}{1} |
| 659 |
{\&}{{\textcolor{gray}{\&}}}{1} |
| 660 |
{>}{{\textcolor{OrangeRed}{\guillemotright}}}{1} |
| 661 |
{<}{{\textcolor{OrangeRed}{\guillemotleft}}}{1} |
| 662 |
{*}{{\textcolor{MediumOrchid}{*}}}{1} |
| 663 |
{!}{{\textcolor{MediumOrchid}{!}}}{1} |
| 664 |
{@}{{\textcolor{MediumOrchid}{@}}}{1}% |
| 665 |
{\^}{{\textcolor{optcolor}{\textasciicircum}}}{1} |
| 666 |
{0}{{\textcolor{MediumOrchid}{0}}}{1} |
| 667 |
{1}{{\textcolor{MediumOrchid}{1}}}{1} |
| 668 |
{2}{{\textcolor{MediumOrchid}{2}}}{1} |
| 669 |
{3}{{\textcolor{MediumOrchid}{3}}}{1} |
| 670 |
{4}{{\textcolor{MediumOrchid}{4}}}{1} |
| 671 |
{5}{{\textcolor{MediumOrchid}{5}}}{1} |
| 672 |
{6}{{\textcolor{MediumOrchid}{6}}}{1} |
| 673 |
{7}{{\textcolor{MediumOrchid}{7}}}{1} |
| 674 |
{8}{{\textcolor{MediumOrchid}{8}}}{1} |
| 675 |
{9}{{\textcolor{MediumOrchid}{9}}}{1} |
| 676 |
{.0}{{\textcolor{MediumOrchid}{.0}}}{2}% Following is to ensure that only periods |
| 677 |
{.1}{{\textcolor{MediumOrchid}{.1}}}{2}% followed by a digit are changed. |
| 678 |
{.2}{{\textcolor{MediumOrchid}{.2}}}{2} |
| 679 |
{.3}{{\textcolor{MediumOrchid}{.3}}}{2} |
| 680 |
{.4}{{\textcolor{MediumOrchid}{.4}}}{2} |
| 681 |
{.5}{{\textcolor{MediumOrchid}{.5}}}{2} |
| 682 |
{.6}{{\textcolor{MediumOrchid}{.6}}}{2} |
| 683 |
{.7}{{\textcolor{MediumOrchid}{.7}}}{2} |
| 684 |
{.8}{{\textcolor{MediumOrchid}{.8}}}{2} |
| 685 |
{.9}{{\textcolor{MediumOrchid}{.9}}}{2} |
| 686 |
{=}{{\textcolor{gray}{=}}}{1},% |
| 687 |
}[keywords,tex,comments,strings]% end language |
| 688 |
|
| 689 |
% \begin{examplecode}[key=val]...\end{examplecode} |
| 690 |
\lstnewenvironment{examplecode}[1][]{% |
| 691 |
\lstset{ |
| 692 |
language = enumext-doc,% |
| 693 |
stringstyle = {\color{red}},% |
| 694 |
basicstyle = \ttfamily\small,% |
| 695 |
columns = fullflexible,% |
| 696 |
fontadjust = true,% |
| 697 |
aboveskip = 8pt,% |
| 698 |
belowskip = 5pt,% |
| 699 |
rulecolor = \color{gray!50},% |
| 700 |
framesep = \fboxsep,% |
| 701 |
framerule = \fboxrule,% |
| 702 |
xleftmargin = \dimexpr\fboxsep+\fboxrule\relax,% |
| 703 |
xrightmargin= \dimexpr\fboxsep+\fboxrule\relax,% |
| 704 |
#1,% |
| 705 |
}% close lstset |
| 706 |
}{\vspace{-\parskip}}% close examplecode |
| 707 |
% \lstinline[style=inline]|...| |
| 708 |
\lstdefinestyle{inline} |
| 709 |
{ |
| 710 |
language = enumext-doc,% |
| 711 |
upquote = true,% |
| 712 |
numbersep = 1em,% |
| 713 |
escapechar =`,% |
| 714 |
basicstyle =\ttfamily,%\small |
| 715 |
numberstyle = \tiny\color{lightgray}\noaccsupp,% |
| 716 |
literate =*{\%}{{\textcolor{gray}{\%}}}{1} |
| 717 |
{i}{{\textcolor{optcolor}{i}}}{1} |
| 718 |
{ii}{{\textcolor{optcolor}{ii}}}{2} |
| 719 |
{iii}{{\textcolor{optcolor}{iii}}}{3} |
| 720 |
{iv}{{\textcolor{optcolor}{iv}}}{2} |
| 721 |
{v}{{\textcolor{optcolor}{v}}}{1} |
| 722 |
{vi}{{\textcolor{optcolor}{vi}}}{1} |
| 723 |
} |
| 724 |
% Set default \lstinline style |
| 725 |
\lstset{style=inline} |
| 726 |
% Get file info |
| 727 |
\GetFileInfo{enumext.sty} |
| 728 |
% Config hyperref |
| 729 |
\hypersetup |
| 730 |
{ |
| 731 |
allcolors = linkcolor, |
| 732 |
colorlinks = true, |
| 733 |
linktoc = all, |
| 734 |
pdftitle = {.:: The enumext package --- \fileinfo{} ::.}, |
| 735 |
pdfauthor = {Pablo González L}, |
| 736 |
pdfsubject = {Documentation for \fileversion{} [\filedate] }, |
| 737 |
pdfkeywords = {worksheets, multiple choice, expl3, l3prop, l3seq, list, enumerate, store answers, tagged}, |
| 738 |
bookmarksopenlevel = 2, |
| 739 |
} |
| 740 |
% Configuration titleps and titlesec |
| 741 |
\settitlemarks{section} |
| 742 |
\renewpagestyle{plain}[\color{optcolor}\small\sffamily]{% |
| 743 |
\setfoot{\rlap{\hskip\dimexpr-\oddsidemargin-1in\relax% |
| 744 |
\parbox{1.93\paperwidth}{\hfil\thepage\,/\,\pageref{LastPage}}}}% |
| 745 |
{}% |
| 746 |
{}% |
| 747 |
} |
| 748 |
\newpagestyle{myheader}[\color{optcolor}\small\sffamily]{% |
| 749 |
\renewcommand\makeheadrule{% |
| 750 |
\rlap{\hskip\dimexpr-\oddsidemargin-1in\relax |
| 751 |
\color{rulecolor}\rule[0.3cm]{\paperwidth}{0.7cm}}\hss |
| 752 |
} |
| 753 |
\setfoot{\rlap{\hskip\dimexpr-\oddsidemargin-1in\relax% |
| 754 |
\parbox{1.93\paperwidth}{\hfil\thepage\,/\,\pageref{LastPage}}}}% |
| 755 |
{\parbox{\textwidth}{\raggedright \textcolor{gray}{\raisebox{-1pt}{\textcopyright}{}2024--2026 by Pablo González L}}}% |
| 756 |
{}% |
| 757 |
\sethead{\llap{\raisebox{0.55cm}{\parbox{\dimexpr\oddsidemargin+1in\relax}{\makebox[0pt][l]{\hspace{15pt}\pkglogo\space\fileversion}}}}} |
| 758 |
{\raisebox{0.55cm}{\parbox{\textwidth}{\hspace*{-\oddsidemargin}\centering\small\S.\thesection\space\sectiontitle}}}% |
| 759 |
{}% |
| 760 |
} |
| 761 |
\titlecontents{section}[0mm]{}% |
| 762 |
{\bfseries\contentspush{\makebox[5mm][l]{\thecontentslabel\hfill}}}% |
| 763 |
{\hspace*{-5mm}}% numberless |
| 764 |
{\hspace{0.25em}\titlerule*[6pt]{.}\contentspage}% |
| 765 |
\titlecontents{subsection}[5mm]{}% |
| 766 |
{\contentspush{\makebox[6mm][l]{\thecontentslabel\hfill}}} |
| 767 |
{\hspace*{-11mm}}% numberless |
| 768 |
{\hspace{0.25em}\titlerule*[6pt]{.}\contentspage}% |
| 769 |
\titlecontents{subsubsection}[11mm]{}% |
| 770 |
{\contentspush{\makebox[8mm][l]{\thecontentslabel\hfill}}} |
| 771 |
{\hspace*{-19mm}}% numberless |
| 772 |
{\hspace{0.25em}\titlerule*[6pt]{.}\contentspage}% |
| 773 |
% Table of contents |
| 774 |
\makeatletter |
| 775 |
\renewcommand\tableofcontents{% |
| 776 |
\begingroup% |
| 777 |
\section*{\contentsname\quad{\color{gray}\leaders\hrule height 5pt depth -4.4pt\hfill}% |
| 778 |
\@mkboth{% |
| 779 |
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}% |
| 780 |
\vspace*{-14pt} |
| 781 |
\setlength{\columnsep}{10pt}% |
| 782 |
\begin{multicols}{2}% |
| 783 |
\@starttoc{toc}% |
| 784 |
\end{multicols}% |
| 785 |
\vspace*{-3pt}{\color{gray}\hrule height 0.6pt}% |
| 786 |
\vspace*{5pt} |
| 787 |
\endgroup |
| 788 |
} |
| 789 |
\makeatother |
| 790 |
% \thanks |
| 791 |
\makeatletter |
| 792 |
\renewcommand*{\@fnsymbol}[1]{\ensuremath{\ifcase#1\or \textcolor{pkgcolor}{*} |
| 793 |
\or \textcolor{pkgcolor}{\dagger} \or \ddagger\or \mathsection |
| 794 |
\or \mathparagraph\or \|\or **\or \dagger\dagger |
| 795 |
\or \ddagger\ddagger \else\@ctrerr\fi}} |
| 796 |
\makeatother |
| 797 |
% \usepackage{lua-visual-debug} |
| 798 |
\usepackage[font=small,skip=2pt]{caption} |
| 799 |
% For input samples |
| 800 |
\usepackage{tikzducks,siunitx,amssymb} |
| 801 |
\sisetup{output-decimal-marker={,}} |
| 802 |
\newcommand*{\myCircled}[1]{% |
| 803 |
\begin{tikzpicture}[baseline=(number.base)] |
| 804 |
\node[circle, draw=green!10!gray, inner sep=1pt, fill=blue!30!green!10] (number) {#1}; |
| 805 |
\end{tikzpicture}% |
| 806 |
} |
| 807 |
\usetikzlibrary{shapes.geometric} |
| 808 |
\newcommand*{\mySquared}[1]{% |
| 809 |
\begin{tikzpicture}[baseline=(number.base),square/.style={regular polygon,regular polygon sides=4}] |
| 810 |
\node[square, rounded corners=1pt, inner sep=1pt, draw=none, fill=gray!40] (number) {\makebox[\height]{#1}}; |
| 811 |
\end{tikzpicture}% |
| 812 |
} |
| 813 |
% For SAT sample |
| 814 |
\newsavebox{\satbox} |
| 815 |
\sbox\satbox{\small\textbf{67}}% |
| 816 |
\NewDocumentCommand \stylesat { m } |
| 817 |
{% |
| 818 |
\setlength{\fboxsep}{2pt}% |
| 819 |
\raisebox{2\fboxsep}{% |
| 820 |
\noindent\colorbox{black}{\textcolor{white}{\makebox[\dimeval{\labelwidth-2\fboxsep}][c]{\small\textbf{\vphantom{67}#1}}}}% |
| 821 |
\colorbox{lightgray}{\phantom{\rule[-\dp\satbox]{\dimeval{\linewidth-2\fboxsep}}{\dimeval{\dp\satbox+\ht\satbox}}}}}% |
| 822 |
} |
| 823 |
% For non-numbered list samples, need ´%´ at end (prevent wrong unwanted spaces) |
| 824 |
\NewDocumentCommand \labelbx { s +m } |
| 825 |
{% |
| 826 |
\IfBooleanTF{#1} |
| 827 |
{\strut\smash{\parbox[t]{\labelwidth}{\raggedright{#2}}}}% |
| 828 |
{\strut\smash{\parbox[t]{\labelwidth}{\raggedleft{#2}}}}% |
| 829 |
} |
| 830 |
% For azetina sample |
| 831 |
\newlength{\itemwd} |
| 832 |
\settowidth{\itemwd}{\bfseries 10.} % max width |
| 833 |
\NewDocumentCommand \rating { }{8.5a, KSC} |
| 834 |
\ExplSyntaxOn |
| 835 |
\bool_new:N \l_azetina_rating_bool |
| 836 |
\NewDocumentCommand \showrating { m } |
| 837 |
{ |
| 838 |
\str_case:nn {#1} |
| 839 |
{ |
| 840 |
{ true } |
| 841 |
{ |
| 842 |
\bool_set_true:N \l_azetina_rating_bool |
| 843 |
\setenumext{show-ans=true,save-sep={ ~ }} |
| 844 |
} |
| 845 |
{ false } |
| 846 |
{ |
| 847 |
\bool_set_false:N \l_azetina_rating_bool |
| 848 |
\setenumext{show-ans=false,save-sep={ ~ }} |
| 849 |
} |
| 850 |
} |
| 851 |
} |
| 852 |
\NewDocumentCommand \myans { m +m } |
| 853 |
{ |
| 854 |
\bool_if:NTF \l_azetina_rating_bool |
| 855 |
{ |
| 856 |
\item*[(#1)] \textcolor{red}{#2} |
| 857 |
} |
| 858 |
{ |
| 859 |
\item*[(#1)] \textcolor{black}{#2} |
| 860 |
} |
| 861 |
} |
| 862 |
\NewDocumentCommand \azwrapp { m } |
| 863 |
{ |
| 864 |
\bool_if:NTF \l_azetina_rating_bool |
| 865 |
{ |
| 866 |
\makebox[\dim_eval:n{\marginparwidth}][r] |
| 867 |
{ |
| 868 |
\textcolor{red}{\bfseries\footnotesize\rating} |
| 869 |
} |
| 870 |
\hspace{\marginparsep}\textbf{#1} |
| 871 |
} |
| 872 |
{ |
| 873 |
\makebox[\dim_eval:n{\marginparwidth+\marginparsep}][l]{ }\textbf{#1} |
| 874 |
} |
| 875 |
} |
| 876 |
\ExplSyntaxOff |
| 877 |
\setenumextmeta[1]{azetinasty}{label={\arabic*.},labelwidth={\marginparwidth+\marginparsep+\itemwd},list-offset={-\marginparwidth-\marginparsep},} |
| 878 |
\begin{document} |
| 879 |
\DocInput{\jobname.dtx} |
| 880 |
\end{document} |
| 881 |
%</driver> |
| 882 |
% \fi |
| 883 |
% |
| 884 |
% \title{ |
| 885 |
% \scalebox{2.67}{\pkglogo}\\[-10pt] |
| 886 |
% {\large\textcolor{gray}{\fetamontotf{enumerate exercise sheets}}}\\[0pt] |
| 887 |
% \fileversion \quad \filedate\thanks{ |
| 888 |
% This file describes a documentation for \fileversion, last revised |
| 889 |
% \filedate.}\\[25pt] |
| 890 |
% \author{ |
| 891 |
% \large |
| 892 |
% \raisebox{-1pt}{\textcopyright}{}2024--2026 by Pablo González L\thanks{ |
| 893 |
% E-mail: \textcolor{OrangeRed}{\textsf{\guillemotleft}}\email{[email protected]}\textcolor{OrangeRed}{\textsf{\guillemotright}}. |
| 894 |
% }% |
| 895 |
% } |
| 896 |
% \small |
| 897 |
% \textsc{ctan}: \url{https://www.ctan.org/pkg/enumext}\\ |
| 898 |
% \textcolor{gray}{\scriptsize\faIcon[regular]{github}}\,\,\,\url{https://github.com/pablgonz/enumext} |
| 899 |
% \vspace*{-2cm} |
| 900 |
% } |
| 901 |
% \date{} |
| 902 |
% \maketitle |
| 903 |
% |
| 904 |
% \begin{abstract} |
| 905 |
% This package provides enumerated list environments compatible |
| 906 |
% with \emph{tagging} \texttt{PDF} for creating \emph{\enquote{simple |
| 907 |
% exercise sheets}} along with \emph{\enquote{multiple choice questions}}, |
| 908 |
% storing the \emph{\enquote{answers}} to these in memory using \mypkg{multicol} |
| 909 |
% package. |
| 910 |
% \end{abstract} |
| 911 |
% |
| 912 |
% \tableofcontents |
| 913 |
% |
| 914 |
% \section*{Motivation and acknowledgments} |
| 915 |
% |
| 916 |
% Usually, it is enough to use the classic \myenv{enumerate} environment to |
| 917 |
% generate \emph{\enquote{simple exercise sheets}} or |
| 918 |
% \emph{\enquote{multiple choice questions}}, the basic idea behind |
| 919 |
% \mypkg*{enumext} is to cover three points: |
| 920 |
% |
| 921 |
% \begin{enumerate}[left=0pt, nosep,labelsep=5pt, label=\small\arabic*.,topsep=2pt] |
| 922 |
% \item To have a simple interface to be able to write \emph{\enquote{lists of |
| 923 |
% exercises}} with \emph{\enquote{answers}}. |
| 924 |
% \item To have a simple interface for writing \emph{\enquote{multiple choice |
| 925 |
% questions}}. |
| 926 |
% \item To have a simple interface for placing \emph{\enquote{columns}} |
| 927 |
% and \emph{\enquote{drawings}} or \emph{\enquote{tables}}. |
| 928 |
% \end{enumerate} |
| 929 |
% |
| 930 |
% This package would not be possible without Phelype Oleinik who has |
| 931 |
% collaborated and adapted a large part of the code and all |
| 932 |
% \hologo{LaTeX} team for their great work and to the different members |
| 933 |
% of the \href{https://tex.stackexchange.com}{TeX-SX} community who have |
| 934 |
% provided great answers and ideas. Here are notes on the main ones: |
| 935 |
% |
| 936 |
% \begin{enumerate}[left=0pt, labelsep=5pt, nosep, label=\small\arabic*.,topsep=2pt] |
| 937 |
% \item Answer given by Alan Munn in \href{https://tex.stackexchange.com/a/300418}{\textbackslash topsep, \textbackslash itemsep, \textbackslash partopsep, \textbackslash parsep - what do they each mean (and what about the bottom)?} |
| 938 |
% |
| 939 |
% \item Answer given by Enrico Gregorio in \href{https://tex.stackexchange.com/a/34172}{Understanding minipages - aligning at top} |
| 940 |
% |
| 941 |
% \item Answer given by Ulrich Diez in \href{https://tex.stackexchange.com/a/553839/7832}{Different mechanics of hyperlink vs. hyperref} |
| 942 |
% |
| 943 |
% \item Answer given by Enrico Gregorio in \href{https://tex.stackexchange.com/a/294460/7832}{Minipage and multicols, vertical alignment} |
| 944 |
% |
| 945 |
% \end{enumerate} |
| 946 |
% |
| 947 |
% \thispagestyle{plain} |
| 948 |
% |
| 949 |
% \section*{License and Requirements} |
| 950 |
% \label{sec:licence} |
| 951 |
% |
| 952 |
% Permission is granted to copy, distribute and/or modify this software under |
| 953 |
% the terms of the LaTeX Project Public License (lppl), version 1.3 or later |
| 954 |
% (\url{https://www.latex-project.org/lppl.txt}). |
| 955 |
% The software has the status \enquote{maintained}. |
| 956 |
% |
| 957 |
% The \mypkg*{enumext} package loads and requires \mypkg{multicol}\cite{multicol} |
| 958 |
% package, need to have a modern \hologo{TeX} distribution such as |
| 959 |
% \hologo{TeX} Live or \hologo{MiKTeX}. It has been tested with the standard |
| 960 |
% classes provided by \hologo{LaTeX}: \myclass{book}, \myclass{report}, |
| 961 |
% \myclass{article} and \myclass{letter} on \mydim{10pt}, \mydim{11pt} and \mydim{12pt}. |
| 962 |
% |
| 963 |
% \smallskip |
| 964 |
% |
| 965 |
% \begin{important}* |
| 966 |
% The minimum requirement is \hologo{LaTeX} release 2025-11-01. |
| 967 |
% \end{important} |
| 968 |
% |
| 969 |
% \pagestyle{myheader} |
| 970 |
% |
| 971 |
% \section{Introduction} |
| 972 |
% |
| 973 |
% In the \hologo{LaTeX} world there are many useful packages and |
| 974 |
% classes for creating \emph{\enquote{lists of exercises}}, \emph{\enquote{worksheets}} or |
| 975 |
% \emph{\enquote{multiple choice questions}}, classes like \myclass{exam}\cite{exam} |
| 976 |
% and packages like \mypkg{xsim}\cite{xsim} do the job perfectly, but |
| 977 |
% they don't always fit the basic day to day needs. |
| 978 |
% |
| 979 |
% \smallskip |
| 980 |
% |
| 981 |
% In my work (and in the work of many teachers) it is common to use |
| 982 |
% \emph{\enquote{simple exercise sheets}} also known as |
| 983 |
% \emph{\enquote{informal lists of exercises}}, for example: |
| 984 |
% |
| 985 |
% \smallskip |
| 986 |
% |
| 987 |
% \begin{enumext}[save-ans=temp2,columns=2,nosep,save-ref=true]% |
| 988 |
% \item Factor $x^{2}-2x+1$ \anskey{$\left(x-1\right)^{2}$} |
| 989 |
% \item Factor $3x+3y+3z$ \anskey{$3(x+y+z)$} |
| 990 |
% \item True False |
| 991 |
% \begin{enumext}[nosep] |
| 992 |
% \item $\alpha > \delta$ \anskey{False} |
| 993 |
% \item \LaTeX2e\ is cool? \anskey{Very True!} |
| 994 |
% \end{enumext} |
| 995 |
% \item Related to Linux |
| 996 |
% \begin{enumext}[nosep] |
| 997 |
% \item You use Linux? \anskey{Yes} |
| 998 |
% \item Usually uses the package manager? \anskey{Yes, \texttt{dnf}} |
| 999 |
% \item Rate the following package and class |
| 1000 |
% \begin{enumext}[nosep] |
| 1001 |
% \item \texttt{xsim-exam} \anskey{doesn't exist for now :(} |
| 1002 |
% \item \texttt{xsim} \anskey{very good} |
| 1003 |
% \item \texttt{exsheets} \anskey{obsolete} |
| 1004 |
% \end{enumext} |
| 1005 |
% \end{enumext} |
| 1006 |
% \end{enumext} |
| 1007 |
% |
| 1008 |
% \smallskip |
| 1009 |
% |
| 1010 |
% Sometimes we are also interested in showing the \emph{\enquote{answers}} |
| 1011 |
% along with the questions: |
| 1012 |
% |
| 1013 |
% \smallskip |
| 1014 |
% |
| 1015 |
% \begin{enumext}[save-ans=worksheet,mark-ans={\oldtextasteriskcentered},columns=2,show-ans=true,nosep,save-ref=true] |
| 1016 |
% \item Factor $x^{2}-2x+1$ \anskey{$\left(x-1\right)^{2}$} |
| 1017 |
% \item Factor $3x+3y+3z$ \anskey{$3(x+y+z)$} |
| 1018 |
% \item True False |
| 1019 |
% \begin{enumext}[nosep] |
| 1020 |
% \item $\alpha > \delta$ \anskey{False} |
| 1021 |
% \item \LaTeX2e\ is cool? \anskey{Very True!} |
| 1022 |
% \end{enumext} |
| 1023 |
% \item Related to Linux |
| 1024 |
% \begin{enumext}[nosep] |
| 1025 |
% \item You use Linux? \anskey{Yes} |
| 1026 |
% \item Usually uses the package manager? \anskey{Yes, \texttt{dnf}} |
| 1027 |
% \item Rate the following package and class |
| 1028 |
% \begin{enumext}[nosep] |
| 1029 |
% \item \texttt{xsim-exam} \anskey{doesn't exist for now :(} |
| 1030 |
% \item \texttt{xsim} \anskey{very good} |
| 1031 |
% \item \texttt{exsheets} \anskey{obsolete} |
| 1032 |
% \end{enumext} |
| 1033 |
% \end{enumext} |
| 1034 |
% \end{enumext} |
| 1035 |
% |
| 1036 |
% \smallskip |
| 1037 |
% |
| 1038 |
% Or we are interested in referring to a specific question and its |
| 1039 |
% \emph{\enquote{answer}}, for example: |
| 1040 |
% |
| 1041 |
% \smallskip |
| 1042 |
% |
| 1043 |
% The answer to \ref{worksheet:4} is \enquote{\getkeyans{worksheet:4}} |
| 1044 |
% and the answer to \ref{worksheet:8} is \enquote{\getkeyans{worksheet:8}}. |
| 1045 |
% |
| 1046 |
% \smallskip |
| 1047 |
% |
| 1048 |
% Or we are interested in printing all the \emph{\enquote{answers}}: |
| 1049 |
% |
| 1050 |
% \smallskip |
| 1051 |
% |
| 1052 |
% \printkeyans{worksheet} |
| 1053 |
% |
| 1054 |
% \smallskip |
| 1055 |
% |
| 1056 |
% Another very common thing to use in my work is \emph{\enquote{multiple choice |
| 1057 |
% questions}}, for example: |
| 1058 |
% |
| 1059 |
% \smallskip |
| 1060 |
% |
| 1061 |
% \begin{enumext}[save-ans=mytest,columns=2,nosep,save-ref=true,save-sep={\space}] |
| 1062 |
% \item First type of questions |
| 1063 |
% \begin{keyans}[columns=2,noitemsep] |
| 1064 |
% \item value |
| 1065 |
% \item*[$x=5$] correct |
| 1066 |
% \item value |
| 1067 |
% \item value |
| 1068 |
% \end{keyans} |
| 1069 |
% \item Second type of questions |
| 1070 |
% \begin{enumext}[no-store,label=\Roman*.,noitemsep] |
| 1071 |
% \item $2\alpha+2\delta=90^{\circ}$ |
| 1072 |
% \item $\alpha=\delta$ |
| 1073 |
% \item $\angle EDF=45^{\circ}$ |
| 1074 |
% \end{enumext} |
| 1075 |
% \begin{keyans}[columns=2,noitemsep] |
| 1076 |
% \item I only |
| 1077 |
% \item II only |
| 1078 |
% \item I and II only |
| 1079 |
% \item* I and III only |
| 1080 |
% \item I, II, and III |
| 1081 |
% \end{keyans} |
| 1082 |
% \item* Third type of questions |
| 1083 |
% \begin{enumext}[no-store,list-offset=0.5cm,label=(\arabic*),noitemsep] |
| 1084 |
% \item $2\alpha+2\delta=90^{\circ}$ |
| 1085 |
% \item $\angle EDF=45^{\circ}$ |
| 1086 |
% \end{enumext} |
| 1087 |
% \begin{keyans}[columns=2,noitemsep] |
| 1088 |
% \item value |
| 1089 |
% \item value |
| 1090 |
% \item*[some note] value |
| 1091 |
% \item value |
| 1092 |
% \item value |
| 1093 |
% \end{keyans} |
| 1094 |
% |
| 1095 |
% \item Question with image and label below: |
| 1096 |
% |
| 1097 |
% \begin{keyanspic}[label-pos=below, layout-sty={3,2}] |
| 1098 |
% \anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 1099 |
% \anspic{\includegraphics[scale=0.15]{example-image-b}} |
| 1100 |
% \anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 1101 |
% \anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 1102 |
% \anspic*[A duck]{\includegraphics[scale=0.30]{example-image-duck}} |
| 1103 |
% \end{keyanspic} |
| 1104 |
% |
| 1105 |
% \item Question with image on right side: |
| 1106 |
% |
| 1107 |
% \begin{keyans}[mini-env=0.5\linewidth, columns=1,noitemsep] |
| 1108 |
% \item value |
| 1109 |
% \item value |
| 1110 |
% \item value |
| 1111 |
% \item*[\enquote{other note}] correct |
| 1112 |
% \item value |
| 1113 |
% \miniright |
| 1114 |
% \includegraphics[scale=0.15]{example-image-b} |
| 1115 |
% \end{keyans} |
| 1116 |
% \end{enumext} |
| 1117 |
% |
| 1118 |
% \smallskip |
| 1119 |
% |
| 1120 |
% Where we are interested in the \mymeta{label} and a |
| 1121 |
% \emph{\enquote{short note}} that we leave as an explanation, and then |
| 1122 |
% print them: |
| 1123 |
% |
| 1124 |
% \smallskip |
| 1125 |
% |
| 1126 |
% \printkeyans{mytest} |
| 1127 |
% |
| 1128 |
% \smallskip |
| 1129 |
% |
| 1130 |
% The \mypkg*{enumext} package was created and designed to meet these |
| 1131 |
% small requirements in the creation of \emph{\enquote{simple |
| 1132 |
% worksheets}} and \emph{\enquote{multiple choice questions}}. |
| 1133 |
% |
| 1134 |
% \smallskip |
| 1135 |
% |
| 1136 |
% \begin{important}* |
| 1137 |
% These \emph{\enquote{simple worksheets}} or \emph{\enquote{multiple |
| 1138 |
% choice questions}} appear to be easy to obtain using a combination of |
| 1139 |
% the \myenv{enumerate}, \myenv{minipage} and \myenv{multicols} |
| 1140 |
% environments, but like many things, what \emph{\enquote{looks |
| 1141 |
% simple}} is not so simple. |
| 1142 |
% \end{important} |
| 1143 |
% |
| 1144 |
% \subsection{Description and usage} |
| 1145 |
% |
| 1146 |
% The \mypkg*{enumext} package defines enumerated environments using the |
| 1147 |
% \myenv{list} environment provided by \hologo{LaTeX}, but |
| 1148 |
% \emph{\enquote{does not redefine}} any internal commands associated with |
| 1149 |
% it such as |\list|, |\endlist| or |\item| outside of the |
| 1150 |
% \emph{\enquote{scope}} in which they are defined. |
| 1151 |
% |
| 1152 |
% \smallskip |
| 1153 |
% |
| 1154 |
% \begin{important}* |
| 1155 |
% This package is NOT intended to replace the \myenv{enumerate} environment |
| 1156 |
% nor replace the powerful \mypkg{enumitem}\cite{enumitem}, the approach |
| 1157 |
% is intended to work without hindering either of them. |
| 1158 |
% \end{important} |
| 1159 |
% |
| 1160 |
% \smallskip |
| 1161 |
% |
| 1162 |
% This package can be used with |xelatex|, |lualatex|, |pdflatex| and |
| 1163 |
% the classical |latex>dvips>ps2pdf| and is present in \hologo{TeX} Live and \hologo{MiKTeX}, |
| 1164 |
% use the package manager to install. For manual installation, download |
| 1165 |
% \href{http://mirrors.ctan.org/macros/latex/contrib/enumext.zip}{enumext.zip} |
| 1166 |
% and unzip it, run \lstinline[language=enumext-doc,basicstyle=\ttfamily]+luatex enumext.ins+ |
| 1167 |
% and move all files to appropriate locations, then run |mktexlsr|. To produce the documentation run |
| 1168 |
% \lstinline[language=enumext-doc,basicstyle=\ttfamily]+arara enumext.dtx+. |
| 1169 |
% |
| 1170 |
% \iffalse |
| 1171 |
%<*example> |
| 1172 |
% \fi |
| 1173 |
\begin{examplecode}[frame=single,language={}] |
| 1174 |
enumext.sty > TDS:tex/latex/enumext/ |
| 1175 |
enumext.pdf > TDS:doc/latex/enumext/ |
| 1176 |
README.md > TDS:doc/latex/enumext/ |
| 1177 |
enumext.dtx > TDS:source/latex/enumext/ |
| 1178 |
enumext.ins > TDS:source/latex/enumext/ |
| 1179 |
\end{examplecode} |
| 1180 |
% \iffalse |
| 1181 |
%</example> |
| 1182 |
% \fi |
| 1183 |
% |
| 1184 |
% The package is loaded in the usual way: |
| 1185 |
% |
| 1186 |
% \iffalse |
| 1187 |
%<*example> |
| 1188 |
% \fi |
| 1189 |
\begin{examplecode}[frame=single] |
| 1190 |
\usepackage{enumext} |
| 1191 |
\end{examplecode} |
| 1192 |
% \iffalse |
| 1193 |
%</example> |
| 1194 |
% \fi |
| 1195 |
% |
| 1196 |
% \subsection{The concept of left margin} |
| 1197 |
% |
| 1198 |
% There is a direct relationship between the parameters |\leftmargin|, |
| 1199 |
% |\itemindent|, \ics{labelwidth} and \ics{labelsep} plus an |
| 1200 |
% \emph{\enquote{extra space}}, which makes it difficult to obtain the |
| 1201 |
% desired \emph{horizontal spaces} in a \myenv{list} environment. |
| 1202 |
% Usually we don't want the \myenv{list} to go beyond the left margin of the |
| 1203 |
% page, but since these four values are related, that causes a problem. |
| 1204 |
% |
| 1205 |
% The \mypkg{enumitem}\cite{enumitem} package adds the |\labelindent| parameter to |
| 1206 |
% solve some of these problems. A simplified representation of this in |
| 1207 |
% the figure \ref{fig:one}. |
| 1208 |
% \setlength\intextsep{3pt} |
| 1209 |
% \begin{figure}[ht] |
| 1210 |
% \centering |
| 1211 |
% \begin{tikzpicture}[line cap=round,line join=round,x=0.8cm,y=0.8cm,every node/.style={font=\footnotesize}] |
| 1212 |
% \draw[<->,color=gray] (-0.5,6.175) --node[below,,text=lightgray,font=\footnotesize\ttfamily]{margin page} (2,6.175); |
| 1213 |
% \draw[line width=0.5pt,dash pattern=on 2pt off 2pt,color=gray] (2,4.85) -- (2,7.5); |
| 1214 |
% \draw[<->,color=gray] (2.0,7.0) --node[above,text=blue!75]{\texttt{\textbackslash{}labelindent}} (4.5,7.0); |
| 1215 |
% \draw[<->,color=gray] (4.5,7.0) --node[above,text=blue!75]{\texttt{\textbackslash{}labelwidth}} (7.5,7.0); |
| 1216 |
% \draw[<->,color=gray] (7.5,7.0) --node[above,text=blue!75]{\texttt{\textbackslash{}labelsep}} (9.5,7.0); |
| 1217 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (4.5,6.5) rectangle (7.5,6.85);% labelwidth |
| 1218 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.5,6.5) rectangle (9.5,6.85);% labelsep |
| 1219 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (9.5,6.5) rectangle (15,6.85);% item width |
| 1220 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (9.5,6.0) rectangle (15,6.35); |
| 1221 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (9.5,5.5) rectangle (15,5.85); |
| 1222 |
% \draw[<->,color=gray] (2.0,5.35) --node[below,text=blue!75]{\texttt{\textbackslash{}leftmargin}} (7.5,5.35); |
| 1223 |
% \draw[<->,color=gray] (7.5,5.35) --node[below,text=blue!75]{\texttt{\textbackslash{}itemindent}} (9.5,5.35); |
| 1224 |
% \end{tikzpicture} |
| 1225 |
% \caption{Representation of horizontal lengths in \mypkg{enumitem}.} |
| 1226 |
% \label{fig:one} |
| 1227 |
% \end{figure} |
| 1228 |
% |
| 1229 |
% The \mypkg*{enumext} package does NOT provide a user interface to set the values for |
| 1230 |
% |\leftmargin| and |\itemindent|, instead it provides the keys |
| 1231 |
% \mykey{list-offset} and \mykey{list-indent} which internally set the |
| 1232 |
% values for |\leftmargin| and |\itemindent|. The concepts of |\leftmargin| and |\itemindent| |
| 1233 |
% are different in \mypkg*{enumext}. The figure \ref{fig:two} shows the visual representation of idea. |
| 1234 |
% |
| 1235 |
% \begin{figure}[ht] |
| 1236 |
% \centering |
| 1237 |
% \begin{tikzpicture}[line cap=round,line join=round,x=0.8cm,y=0.8cm,every node/.style={font=\footnotesize}] |
| 1238 |
% \draw[<->,color=gray] (-0.5,6.175) --node[below,text=lightgray,font=\footnotesize\ttfamily]{margin page} (2,6.175); |
| 1239 |
% \draw[line width=0.5pt,dash pattern=on 2pt off 2pt,color=gray] (2,4.85) -- (2,7.5); |
| 1240 |
% \draw[<->,color=gray] (2.0,7.0) --node[above,text=optcolor]{\vphantom{p}\texttt{list-offset}} (4.5,7.0); |
| 1241 |
% \draw[<->,color=gray] (4.5,7.0) --node[above,text=blue!75]{\vphantom{p}\texttt{\textbackslash{}labelwidth}} (7.5,7.0); |
| 1242 |
% \draw[<->,color=gray] (7.5,7.0) --node[above,text=blue!75]{\texttt{\textbackslash{}labelsep}} (9.5,7.0); |
| 1243 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (4.5,6.5) rectangle (7.5,6.85);% labelwidth |
| 1244 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.5,6.5) rectangle (9.5,6.85);% labelsep |
| 1245 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (9.5,6.5) rectangle (15,6.85);% item width |
| 1246 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (9.5,6.0) rectangle (15,6.35); |
| 1247 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (9.5,5.5) rectangle (15,5.85); |
| 1248 |
% \draw[<->,color=gray] (4.5,5.35) --node[below,text=optcolor]{\texttt{list-indent}} (9.5,5.35); |
| 1249 |
% \end{tikzpicture} |
| 1250 |
% \caption{Representation of horizontal lengths concept in \mypkg*{enumext}.} |
| 1251 |
% \label{fig:two} |
| 1252 |
% \end{figure} |
| 1253 |
% |
| 1254 |
% In this way we reduce a \emph{little} the amount of parameters we have to |
| 1255 |
% pass. With the default values of keys \mykey{list-offset}, |
| 1256 |
% \mykey{list-indent}, \mykey{labelwidth} and \mykey{labelsep} the lists |
| 1257 |
% will have the (usually) expected output for \emph{\enquote{simple |
| 1258 |
% worksheets}}. The figure \ref{fig:three} shows the visual representation. |
| 1259 |
% |
| 1260 |
% \begin{figure}[ht] |
| 1261 |
% \centering |
| 1262 |
% \begin{tikzpicture}[line cap=round,line join=round,x=0.8cm,y=0.8cm,every node/.style={font=\footnotesize}] |
| 1263 |
% \draw[<->,color=gray] (-0.5,6.175) --node[below,text=lightgray,font=\footnotesize\ttfamily]{margin page} (2,6.175); |
| 1264 |
% \draw [line width=0.5pt,dash pattern=on 2pt off 2pt,color=gray] (2,4.85) -- (2,7.5); |
| 1265 |
% \draw[<->,color=gray] (2.0,7.0) --node[above,text=optcolor]{\vphantom{p}\texttt{labelwidth}} (5.0,7.0); |
| 1266 |
% \draw[<->,color=gray] (5.0,7.0) --node[above,text=optcolor]{\texttt{labelsep}} (7.0,7.0); |
| 1267 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (2.0,6.5) rectangle (5.0,6.85);% labelwidth |
| 1268 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (5.0,6.5) rectangle (7.0,6.85);% labelsep |
| 1269 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,6.5) rectangle (15,6.85);% item width |
| 1270 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,6.0) rectangle (15,6.35); |
| 1271 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,5.5) rectangle (15,5.85); |
| 1272 |
% \draw[<->,color=gray] (2.0,5.35) --node[below,text=optcolor]{\texttt{list-indent}} (7.0,5.35); |
| 1273 |
% \end{tikzpicture} |
| 1274 |
% \caption{Default horizontal lengths \mykey{list-offset}=\mydim{0pt}, \mykey{list-indent}=\ics{labelwidth}+\ics{labelsep} in \mypkg*{enumext}.} |
| 1275 |
% \label{fig:three} |
| 1276 |
% \end{figure} |
| 1277 |
% |
| 1278 |
% \subsection{User interface} |
| 1279 |
% \label{sec:interface} |
| 1280 |
% |
| 1281 |
% The user interface consists of two main list environments |enumext| |
| 1282 |
% (vertical) and |enumext*| (horizontal), the environment |anskey*| and |
| 1283 |
% the command |\anskey| to \emph{\enquote{store content}} and the |
| 1284 |
% environments |keyans|, |keyans*| and |keyanspic| for multiple choice. |
| 1285 |
% It also provides the commands |\getkeyans| to print individual |
| 1286 |
% \emph{stored content}, |\printkeyans| to print all \emph{stored content}, |
| 1287 |
% |\foreachkeyans| to print a range of \emph{stored content}, |\miniright| |
| 1288 |
% for \myenv{minipage}, |\setenumext| to config \myoarg{key \textnormal{\textcolor{gray}{=}} val}, |
| 1289 |
% |\setenumextmeta| to add a \emph{\enquote{meta-key}} and |\resetenumext| |
| 1290 |
% to reset counters. |
| 1291 |
% |
| 1292 |
% \subsubsection{Public counters} |
| 1293 |
% |
| 1294 |
% The package \mypkg*{enumext} uses the \icounter{enumXi}, |
| 1295 |
% \icounter{enumXii}, \icounter{enumXiii}, \icounter{enumXiv} counters |
| 1296 |
% for the \emph{four} nesting levels of the \myenv*{enumext} environment, |
| 1297 |
% the \icounter{enumXv} counter for the \myenv*{keyans} environment, the |
| 1298 |
% \icounter{enumXvi} counter for the \myenv*{keyanspic} environment, |
| 1299 |
% the counter \icounter{enumXvii} for \myenv*{enumext*} environment and |
| 1300 |
% the counter \icounter{enumXviii} for \myenv*{keyans*} environment. |
| 1301 |
% |
| 1302 |
% \begin{important}* |
| 1303 |
% If any package defines these \emph{counters} or they are user-defined |
| 1304 |
% in the document, the package will return a \emph{\enquote{fatal error}} |
| 1305 |
% and abort the load. |
| 1306 |
% \end{important} |
| 1307 |
% |
| 1308 |
% \subsubsection{Public dimension} |
| 1309 |
% |
| 1310 |
% The package \mypkg*{enumext} only provides a \emph{single public dimension} |
| 1311 |
% \idimen{itemwidth} and is intended for user convenience only and is NOT |
| 1312 |
% for internal use as such. The dimension |\itemwidth| is a \emph{rigid length} |
| 1313 |
% and contains the \emph{\enquote{width of the content}} of each |\item| |
| 1314 |
% regardless of \mykey{labelwidth} and \mykey{labelsep}. |
| 1315 |
% |
| 1316 |
% \begin{important}* |
| 1317 |
% If any package defines |\itemwidth| or the user defines |\itemwidth| |
| 1318 |
% in the document, the package will overwrite it without warning. |
| 1319 |
% \end{important} |
| 1320 |
% |
| 1321 |
% \subsubsection{Support for \pkg{multicol}} |
| 1322 |
% |
| 1323 |
% The package provides direct support for using the \mypkg{multicol}\cite{multicol} |
| 1324 |
% package. This allows for a two-column output as shown |
| 1325 |
% in the figure \ref{fig:fourth}. |
| 1326 |
% |
| 1327 |
% \begin{figure}[ht] |
| 1328 |
% \centering |
| 1329 |
% \begin{tikzpicture}[line cap=round,line join=round,x=0.8cm,y=0.8cm,every node/.style={font=\footnotesize}] |
| 1330 |
% \draw[<->,color=gray] (2.0,7.0) --node[above,text=optcolor]{\vphantom{p}\texttt{labelwidth}} (5.0,7.0); |
| 1331 |
% \draw[<->,color=gray] (5.0,7.0) --node[above,text=optcolor]{\texttt{labelsep}} (7.0,7.0); |
| 1332 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (2.0,6.5) rectangle (5.0,6.85);% labelwidth |
| 1333 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (5.0,6.5) rectangle (7.0,6.85);% labelsep |
| 1334 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,6.5) rectangle (17.5,6.85);% item width |
| 1335 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,5.5) rectangle (11.5,6.35) node[pos=.5,text=black]% |
| 1336 |
% {\begin{tabular}{c} |
| 1337 |
% \texttt{column one} \\ |
| 1338 |
% \textcolor{blue}{\emph{nested items}} |
| 1339 |
% \end{tabular}}; |
| 1340 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (13.5,5.5) rectangle (17.5,6.35) node[pos=.5,text=black]% |
| 1341 |
% {\begin{tabular}{c} |
| 1342 |
% \texttt{column two} \\ |
| 1343 |
% \textcolor{blue}{\emph{nested items}} |
| 1344 |
% \end{tabular}}; |
| 1345 |
% \draw[<->,color=gray] (2.0,5.35) --node[below,text=optcolor]{\texttt{list-indent}} (7.0,5.35); |
| 1346 |
% \draw[<->,color=gray] (11.5,5.35) --node[below,text=optcolor]% |
| 1347 |
% {\begin{tabular}{c} |
| 1348 |
% \texttt{column-sep} \\ |
| 1349 |
% \textcolor{blue}{\texttt{\textbackslash{}columnbreak}} |
| 1350 |
% \end{tabular}} |
| 1351 |
% (13.5,5.35); |
| 1352 |
% \end{tikzpicture} |
| 1353 |
% \caption{Representation of the two column output for a nested level in \myenv*{enumext} environment.} |
| 1354 |
% \label{fig:fourth} |
| 1355 |
% \end{figure} |
| 1356 |
% |
| 1357 |
% The \emph{\enquote{non starred}} version of the \myenv{multicols} |
| 1358 |
% environment is always used together with the \ics{raggedcolumns} |
| 1359 |
% command and is controlled by \mykey{columns} and \mykey{columns-sep} |
| 1360 |
% keys. It can be used in all nesting levels of the |
| 1361 |
% environment |enumext| and the environment |keyans| and can |
| 1362 |
% together with the \mykey{mini-env} key. If you need to force a |
| 1363 |
% start a new column \ics{columnbreak} must be used (see \S\ref{key:multi}). |
| 1364 |
% |
| 1365 |
% \begin{important}* |
| 1366 |
% The |\columnseprule| command is not available as a key and is set to |
| 1367 |
% \emph{\enquote{zero}} for the inner levels and the \myenv*{keyans} environment. If the value of |
| 1368 |
% this is set inside the document, it will affect \emph{\enquote{all environments}} that |
| 1369 |
% use the \mykey{columns} key. |
| 1370 |
% \end{important} |
| 1371 |
% |
| 1372 |
% \subsubsection{Support for \env{minipage}} |
| 1373 |
% |
| 1374 |
% The package provides direct support for \myenv{minipage} |
| 1375 |
% environment, this allows you to obtain an output like the |
| 1376 |
% one shown in figure \ref{fig:five}. |
| 1377 |
% |
| 1378 |
% \begin{figure}[!htbp] |
| 1379 |
% \centering |
| 1380 |
% \begin{tikzpicture}[line cap=round,line join=round,x=0.8cm,y=0.8cm,every node/.style={font=\footnotesize}] |
| 1381 |
% \draw[<->,color=gray] (2.0,7.0) --node[above,text=optcolor]{\vphantom{p}\texttt{labelwidth}} (5.0,7.0); |
| 1382 |
% \draw[<->,color=gray] (5.0,7.0) --node[above,text=optcolor]{\texttt{labelsep}} (7.0,7.0); |
| 1383 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (2.0,6.5) rectangle (5.0,6.85);% labelwidth |
| 1384 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (5.0,6.5) rectangle (7.0,6.85);% labelsep |
| 1385 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,6.5) rectangle (17.5,6.85);% item width |
| 1386 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,5.5) rectangle (12.5,6.35) node[pos=.5,text=black]% |
| 1387 |
% {\begin{tabular}{c} |
| 1388 |
% \texttt{minipage left} \\ |
| 1389 |
% \textcolor{blue}{\emph{nested list}} |
| 1390 |
% \end{tabular}}; |
| 1391 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (14.5,5.5) rectangle (17.5,6.35) node[pos=.5,text=black]% |
| 1392 |
% {\begin{tabular}{c} |
| 1393 |
% \texttt{minipage right} \\ |
| 1394 |
% \textcolor{blue}{\emph{drawing or tabular}} |
| 1395 |
% \end{tabular}}; |
| 1396 |
% \draw[<->,color=gray] (2.0,5.35) --node[below,text=optcolor]{\texttt{list-indent}} (7.0,5.35); |
| 1397 |
% \draw[<->,color=gray] (7.0,5.35) --node[below,text=optcolor]{\texttt{mini-env}} (12.5,5.35); |
| 1398 |
% \draw[<->,color=gray] (12.5,5.35) --node[below,text=optcolor]% |
| 1399 |
% {\begin{tabular}{c} |
| 1400 |
% \texttt{mini-sep} \\ |
| 1401 |
% \textcolor{pkgcolor}{\texttt{\textbackslash{}miniright}} |
| 1402 |
% \end{tabular}} (14.5,5.35); |
| 1403 |
% \end{tikzpicture} |
| 1404 |
% \caption{Representation of the \mykey{mini-env} output for a nested level \myenv*{enumext} environment.} |
| 1405 |
% \label{fig:five} |
| 1406 |
% \end{figure} |
| 1407 |
% |
| 1408 |
% The \myenv{minipage} environments on the \emph{\enquote{left side}} and |
| 1409 |
% \emph{\enquote{right side}} are always used with \emph{\enquote{aligned |
| 1410 |
% on top}} |[t]|. It can be used in all nesting levels of the |
| 1411 |
% environment |enumext| and the environment |keyans| and is controlled |
| 1412 |
% by \mykey{mini-env} and \mykey{mini-sep} keys. In order to switch from |
| 1413 |
% the \emph{\enquote{left}} side \myenv{minipage} environment to the |
| 1414 |
% \emph{\enquote{right}} side one must use the command |\miniright| |
| 1415 |
% (see~\S\ref{key:mini}). |
| 1416 |
% |
| 1417 |
% \subsubsection{The \cs[no-index]{label} and \cs[no-index]{ref} system} |
| 1418 |
% |
| 1419 |
% This package provides a user interface like the |
| 1420 |
% \mypkg{enumitem}\cite{enumitem} package to customize the references |
| 1421 |
% which is activated by the \mykey{ref} key (\S\ref{subsec:label-and-ref}), the standard \hologo{LaTeX} |
| 1422 |
% \ics{label} and \ics{ref} commands work as usual. |
| 1423 |
% It also provides an \emph{\enquote{internal reference}} system for the |
| 1424 |
% \emph{\enquote{stored content}} by means of the key \mykey{save-ref} |
| 1425 |
% (\S\ref{subsec:label-ref}) when the key \mykey{save-ans} is active (\S\ref{subsec:storage-keys}). |
| 1426 |
% |
| 1427 |
% \subsubsection{Support for \cs[no-index]{footnote}}\label{doc:footnote} |
| 1428 |
% |
| 1429 |
% The \myenv*{enumext*} and \myenv*{keyans*} environments and the |
| 1430 |
% \mykey{mini-env} key use the \myenv{minipage} environment in their |
| 1431 |
% implementation but in a transparent way for the user, it is only |
| 1432 |
% used for typesetting. The implementation supports |\footnote| and is |
| 1433 |
% compatible with \mypkg{hyperref} and works the same way as if used |
| 1434 |
% anywhere in the document. |
| 1435 |
% |
| 1436 |
% \enlargethispage{2\baselineskip} |
| 1437 |
% |
| 1438 |
% \newpage |
| 1439 |
% |
| 1440 |
% Unfortunately, if \mypkg{hyperref} is loaded and \emph{tagged} \texttt{PDF} is not |
| 1441 |
% active, it will not produce the \enquote{links}, the internal implementation |
| 1442 |
% uses |\footnotetext|\myoarg{number} and |\footnotemark|\myoarg{number}\mymarg{text} |
| 1443 |
% and \enquote{links} for this are not supported by the \mypkg{hyperref} package. |
| 1444 |
% |
| 1445 |
% \smallskip |
| 1446 |
% |
| 1447 |
% The best way to solve this if \emph{tagged} \texttt{PDF} is NOT active |
| 1448 |
% is to use Jean-François Burnol's \mypkg{footnotehyper}\cite{footnotehyper} |
| 1449 |
% package. It will support keeping the \enquote{links} if |
| 1450 |
% \mypkg{hyperref} is loaded with the |hyperfootnotes=true| option (default). |
| 1451 |
% Load it is as follows: |
| 1452 |
% |
| 1453 |
% \iffalse |
| 1454 |
%<*example> |
| 1455 |
% \fi |
| 1456 |
\begin{examplecode}[frame=single] |
| 1457 |
\IfDocumentMetadataF |
| 1458 |
{ |
| 1459 |
\usepackage{`\mypkg{footnotehyper}`} |
| 1460 |
\makesavenoteenv{enumext} |
| 1461 |
\makesavenoteenv{enumext*} |
| 1462 |
} |
| 1463 |
\end{examplecode} |
| 1464 |
% \iffalse |
| 1465 |
%</example> |
| 1466 |
% \fi |
| 1467 |
% |
| 1468 |
% \begin{important} |
| 1469 |
% At the moment the \mypkg{footnotehyper} package v1.1f (2025/11/15) is not compatible |
| 1470 |
% with \emph{tagged} \texttt{PDF}. |
| 1471 |
% \end{important} |
| 1472 |
% |
| 1473 |
% \section{The environments provided} |
| 1474 |
% |
| 1475 |
% The package \mypkg*{enumext} provides two main list environments, the |
| 1476 |
% \emph{vertical} environment \myenv*{enumext} and the \emph{horizontal} |
| 1477 |
% environment \myenv*{enumext*}. |
| 1478 |
% |
| 1479 |
% \vspace*{-\baselineskip} |
| 1480 |
% |
| 1481 |
% \begin{function}{enumext,enumext*} |
| 1482 |
% \begin{minipage}[t]{0.45\linewidth} |
| 1483 |
% \envexamp{enumext} |
| 1484 |
% \end{minipage}\hfill |
| 1485 |
% \begin{minipage}[t]{0.45\linewidth} |
| 1486 |
% \envexamp{enumext*} |
| 1487 |
% \end{minipage} |
| 1488 |
% \end{function} |
| 1489 |
% |
| 1490 |
% \medskip |
| 1491 |
% |
| 1492 |
% \subsection{The environment \texttt{enumext}}\label{sec:envenumext} |
| 1493 |
% |
| 1494 |
% The \myenv*{enumext} is an environment that works in the same way as |
| 1495 |
% the standard \myenv{enumerate} environment provided by \hologo{LaTeX}, |
| 1496 |
% \ics*{item} and \ics*{item}\myoarg{custom} commands work in |
| 1497 |
% the usual way. The environment can be nested with at most \emph{\enquote{four levels}} |
| 1498 |
% and the options can be configured globally using \ics*{setenumext} |
| 1499 |
% command and locally using \myoarg{key \textnormal{\textcolor{gray}{=}} val} |
| 1500 |
% in the environment. |
| 1501 |
% |
| 1502 |
% \subsubsection*{Example with \texttt{columns=2}} |
| 1503 |
% |
| 1504 |
% \begin{enumext}[columns=2, topsep=0pt] |
| 1505 |
% \item This text is in the first level. |
| 1506 |
% \begin{enumext} |
| 1507 |
% \item This text is in the second level. |
| 1508 |
% \begin{enumext} |
| 1509 |
% \item This text is in the third level. |
| 1510 |
% \begin{enumext} |
| 1511 |
% \item This text is in the fourth level. |
| 1512 |
% \end{enumext} |
| 1513 |
% \end{enumext} |
| 1514 |
% \end{enumext} |
| 1515 |
% \item[X] This text is in the first level. |
| 1516 |
% \item* This text is in the first level. |
| 1517 |
% \end{enumext} |
| 1518 |
% |
| 1519 |
% \subsection{The environment \texttt{enumext*}} |
| 1520 |
% |
| 1521 |
% The \myenv*{enumext*} is a \emph{horizontal list environment} |
| 1522 |
% similar to the \myenv{shortenumerate} or \myenv{tasks} environments |
| 1523 |
% provided by the \mypkg{shortlst}\cite{shortlst} and \mypkg{tasks}\cite{tasks} |
| 1524 |
% packages, \ics*{item} and \ics*{item}\myoarg{custom} work as usual. |
| 1525 |
% The options can be configured globally using \ics*{setenumext} command |
| 1526 |
% and locally using \myoarg{key \textnormal{\textcolor{gray}{=}} val} |
| 1527 |
% in the environment. |
| 1528 |
% |
| 1529 |
% \smallskip |
| 1530 |
% |
| 1531 |
% Some considerations to take into account for this environment: |
| 1532 |
% |
| 1533 |
% \begin{itemize}[nosep,parsep=1pt,topsep=2pt] |
| 1534 |
% \item The environment cannot be nested within itself or in the |
| 1535 |
% environment \myenv*{keyans*}, but it can be nested within |
| 1536 |
% \myenv*{enumext} and vice versa. |
| 1537 |
% |
| 1538 |
% \item Each \emph{\enquote{item content}} in the environment is placed |
| 1539 |
% within a \myenv{minipage} environment whose \emph{width} is stored |
| 1540 |
% in the dimension \idimen{itemwidth} does NOT include \mykey{labelwidth} and |
| 1541 |
% \mykey{labelsep}, only the \emph{width of the content}. |
| 1542 |
% |
| 1543 |
% \item You cannot have floating environments like \myenv{figure} or |
| 1544 |
% \myenv{table} or |\marginpar| but \ics{footnote} with \mypkg{hyperref} |
| 1545 |
% is supported. If you want to activate links \emph{\enquote{without}} |
| 1546 |
% \emph{tagged} \texttt{PDF} active you must load \mypkg{footnotehyper} |
| 1547 |
% and \mypkg{hyperref} packages (see \S\ref{doc:footnote}). |
| 1548 |
% |
| 1549 |
% \item You cannot have any standard list environments like \myenv{itemize}, |
| 1550 |
% \myenv{enumerate}, \myenv{description}, \myenv{quote}, \myenv{quotation}, |
| 1551 |
% \myenv{verse}, \myenv{center}, \myenv{flushleft}, \myenv{flushright}, |
| 1552 |
% \myenv{verbatim}, \myenv{tabbing}, \myenv{trivlist}, \myenv{list} |
| 1553 |
% and all environments created with |\newtheorem|. |
| 1554 |
% \end{itemize} |
| 1555 |
% |
| 1556 |
% \subsubsection*{Example with \texttt{columns=2}} |
| 1557 |
% |
| 1558 |
% \begin{enumext*}[columns=2] |
| 1559 |
% \item This text is in the first level. |
| 1560 |
% \item This text is in the first level. |
| 1561 |
% \item[X] This text is in the first level. |
| 1562 |
% \item* This text is in the first level. |
| 1563 |
% \end{enumext*} |
| 1564 |
% |
| 1565 |
% \subsection{The command \cs[no-index]{item*}} |
| 1566 |
% |
| 1567 |
% \vspace*{-\baselineskip} |
| 1568 |
% |
| 1569 |
% \begin{function}{\item*} |
| 1570 |
% \begin{syntax} |
| 1571 |
% \ics*{item*}\myoarg{symbol}\myoarg{offset} |
| 1572 |
% \end{syntax} |
| 1573 |
% The \ics*{item*}, \ics*{item*}\myoarg{symbol} and \ics*{item*}\myoarg{symbol}\myoarg{offset} |
| 1574 |
% works like the numbered |\item|, but places a \mymeta{symbol} to |
| 1575 |
% the \emph{\enquote{left}} of the \mymeta{label} separated from it by |
| 1576 |
% the \mymeta{offset} set by the the \emph{second optional argument}. |
| 1577 |
% |
| 1578 |
% \smallskip |
| 1579 |
% |
| 1580 |
% The \emph{starred argument} ‘|*|’ cannot be separated by spaces |
| 1581 |
% ‘\verb*| |’ from the command, i.e. \ics*{item*} and the |
| 1582 |
% \emph{first optional argument} does NOT support \emph{verbatim content}. |
| 1583 |
% It can be configured with the keys \mykey{item-sym*} and \mykey{item-pos*} |
| 1584 |
% locally in the environment or globally using \ics*{setenumext} command (\S\ref{sec:setenumext}). |
| 1585 |
% \end{function} |
| 1586 |
% |
| 1587 |
% \newpage |
| 1588 |
% |
| 1589 |
% \begin{important}* |
| 1590 |
% The behavior of \ics*{item*} in the \myenv*{enumext} and \myenv*{enumext*} environments is NOT |
| 1591 |
% the same as in the \myenv*{keyans} and \myenv*{keyans*} environments. |
| 1592 |
% \end{important} |
| 1593 |
% |
| 1594 |
% \subsubsection{Keys for \cs[no-index]{item*}} |
| 1595 |
% |
| 1596 |
% \keyexamp{item-sym\textcolor{MediumOrchid}{*}}{symbol}{\textbackslash{}textborn} |
| 1597 |
% Sets the \emph{symbol} to be displayed to the \emph{\enquote{left}} of the |
| 1598 |
% box containing the current \mymeta{label} set by \mykey{labelwidth} key for \ics*{item*} in |
| 1599 |
% \myenv*{enumext} and \myenv*{enumext*}. The \emph{symbol} can be in |
| 1600 |
% \emph{text} or \emph{math} mode, for example \mykey{item-sym*}|={$\star$}|. |
| 1601 |
% |
| 1602 |
% \smallskip |
| 1603 |
% |
| 1604 |
% \keyexamp{item-pos\textcolor{MediumOrchid}{*}}{rigid length}{by levels} |
| 1605 |
% Sets the \emph{offset} between the box containing the |
| 1606 |
% current \mymeta{label} defined by \mykey{labelwidth} key and the |
| 1607 |
% \mymeta{symbol} set by \mykey{item-sym*} key. The default values are |
| 1608 |
% set by \mykey{labelsep} key at each level. If positive values are |
| 1609 |
% passed, it will \emph{offset to the left}; if negative values are |
| 1610 |
% passed it will \emph{offset to the right}. |
| 1611 |
% |
| 1612 |
% \subsection{The command \cs[no-index]{item} in \texttt{enumext*}} |
| 1613 |
% |
| 1614 |
% The \ics*{item} command for the \myenv*{enumext*} environment provides |
| 1615 |
% a \emph{\enquote{first optional argument}} \ics*{item}\myparg{columns} which \emph{\enquote{joins items}} |
| 1616 |
% between columns. Let's consider the following examples adapted directly from |
| 1617 |
% the \mypkg{tasks} package: |
| 1618 |
% |
| 1619 |
% \iffalse |
| 1620 |
%<*example> |
| 1621 |
% \fi |
| 1622 |
\begin{examplecode}[frame=single] |
| 1623 |
\begin{enumext*}[widest=10,columns=4] |
| 1624 |
\item The first |
| 1625 |
\item* The second |
| 1626 |
\item The third |
| 1627 |
\item The fourth |
| 1628 |
\item(3)* The fifth item is way too long for this and needs three columns |
| 1629 |
\item The sixth |
| 1630 |
\item The seventh |
| 1631 |
\item(2)[X] The eighth item is way too long for this and needs two columns |
| 1632 |
(\the\itemwidth) |
| 1633 |
\item The ninth |
| 1634 |
\item[Z] The tenth (\the\itemwidth) |
| 1635 |
\end{enumext*} |
| 1636 |
\end{examplecode} |
| 1637 |
% \iffalse |
| 1638 |
%</example> |
| 1639 |
% \fi |
| 1640 |
% |
| 1641 |
% \begin{enumext*}[widest=10,columns=4] |
| 1642 |
% \item The first |
| 1643 |
% \item* The second |
| 1644 |
% \item The third |
| 1645 |
% \item The fourth |
| 1646 |
% \item(3)* The fifth item is way too long for this and needs three columns |
| 1647 |
% \item The sixth |
| 1648 |
% \item The seventh |
| 1649 |
% \item(2)[X] The eighth item is way too long for this and needs two columns (\the\itemwidth) |
| 1650 |
% \item The ninth |
| 1651 |
% \item[Z] The tenth (\the\itemwidth) |
| 1652 |
% \end{enumext*} |
| 1653 |
% |
| 1654 |
% \section{The command \cs{setenumext}} |
| 1655 |
% \label{sec:setenumext} |
| 1656 |
% |
| 1657 |
% \vspace*{-10pt} |
| 1658 |
% |
| 1659 |
% \begin{function}{\setenumext} |
| 1660 |
% \begin{minipage}[t]{0.45\linewidth} |
| 1661 |
% \cmdexamp{setenumext}{key \textnormal{\textcolor{gray}{=}} val} |
| 1662 |
% \cmdexamp{setenumext}[enumext\textnormal{\textcolor{gray}{,}} level]{key \textnormal{\textcolor{gray}{=}} val} |
| 1663 |
% \cmdexamp{setenumext}[enumext*]{key \textnormal{\textcolor{gray}{=}} val} |
| 1664 |
% \cmdexamp{setenumext}[keyans]{key \textnormal{\textcolor{gray}{=}} val} |
| 1665 |
% \end{minipage}\hfill |
| 1666 |
% \begin{minipage}[t]{0.45\linewidth} |
| 1667 |
% \cmdexamp{setenumext}[keyans*]{key \textnormal{\textcolor{gray}{=}} val} |
| 1668 |
% \cmdexamp{setenumext}[print\textnormal{\textcolor{gray}{,}} level]{key \textnormal{\textcolor{gray}{=}} val} |
| 1669 |
% \cmdexamp{setenumext}[print\textnormal{\textcolor{gray}{,}} \textnormal{\textcolor{red}{*}}]{key \textnormal{\textcolor{gray}{=}} val} |
| 1670 |
% \cmdexamp{setenumext}[print*]{key \textnormal{\textcolor{gray}{=}} val} |
| 1671 |
% \end{minipage} |
| 1672 |
% |
| 1673 |
% \smallskip |
| 1674 |
% |
| 1675 |
% The command \ics*{setenumext} sets the \mymeta{keys} on a global basis |
| 1676 |
% for environments \myenv*{enumext}, \myenv*{enumext*}, \myenv*{keyans}, |
| 1677 |
% \myenv*{keyans*} and the \ics*{printkeyans} command. |
| 1678 |
% It can be used both in the preamble and in the body of the document |
| 1679 |
% as many times as desired. |
| 1680 |
% \end{function} |
| 1681 |
% |
| 1682 |
% \smallskip |
| 1683 |
% |
| 1684 |
% The \mymeta{keys} set in the \emph{optional argument} of environments and |
| 1685 |
% commands have the \emph{highest precedence}, overriding both |
| 1686 |
% options passed by \ics*{setenumext}. If the \emph{optional argument} is not |
| 1687 |
% passed, the \emph{first level} of the environment \myenv*{enumext} will be |
| 1688 |
% taken by default. |
| 1689 |
% |
| 1690 |
% \smallskip |
| 1691 |
% |
| 1692 |
% \begin{important}* |
| 1693 |
% For security reasons the keys \mykey{resume} \emph{\enquote{with value}}, |
| 1694 |
% \mykey{resume*}, \mykey{reset}, \mykey{reset*}, \mykey{series} and |
| 1695 |
% \mykey{save-ans} they can NOT be set by this command and are ignored. |
| 1696 |
% The key \mykey{save-ans} that activate the \emph{\enquote{storage system}} |
| 1697 |
% must be passed directly in the \emph{optional argument} of the |
| 1698 |
% \emph{\enquote{first level}} of the environment in which they are executed. |
| 1699 |
% \end{important} |
| 1700 |
% |
| 1701 |
% \section{The command \cs[no-index]{setenumextmeta}} |
| 1702 |
% |
| 1703 |
% \vspace*{-\baselineskip} |
| 1704 |
% |
| 1705 |
% \begin{function}{\setenumextmeta} |
| 1706 |
% \begin{syntax} |
| 1707 |
% \ics*{setenumextmeta}\myoarg{\textnormal{\textcolor{MediumOrchid}{\texttt{1}}}}\mymarg{key name}\mymarg{key-one \textnormal{\textcolor{gray}{=}} val\textnormal{\textcolor{gray}{,}} key-two \textnormal{\textcolor{gray}{=}} val\textnormal{\textcolor{gray}{,}} \dots} |
| 1708 |
% \ics*{setenumextmeta}\myoarg{\textnormal{\textcolor{MediumOrchid}{\texttt{2}}}}\mymarg{key name}\mymarg{key-one \textnormal{\textcolor{gray}{=}} val\textnormal{\textcolor{gray}{,}} key-two \textnormal{\textcolor{gray}{=}} val\textnormal{\textcolor{gray}{,}} \dots} |
| 1709 |
% \ics*{setenumextmeta}\myoarg{\textnormal{\textcolor{MediumOrchid}{\texttt{3}}}}\mymarg{key name}\mymarg{key-one \textnormal{\textcolor{gray}{=}} val\textnormal{\textcolor{gray}{,}} key-two \textnormal{\textcolor{gray}{=}} val\textnormal{\textcolor{gray}{,}} \dots} |
| 1710 |
% \ics*{setenumextmeta}\myoarg{\textnormal{\textcolor{MediumOrchid}{\texttt{4}}}}\mymarg{key name}\mymarg{key-one \textnormal{\textcolor{gray}{=}} val\textnormal{\textcolor{gray}{,}} key-two \textnormal{\textcolor{gray}{=}} val\textnormal{\textcolor{gray}{,}} \dots} |
| 1711 |
% \ics*{setenumextmeta}\myoarg{\textnormal{\textcolor{MediumOrchid}{\texttt{*}}}}\mymarg{key name}\mymarg{key-one \textnormal{\textcolor{gray}{=}} val\textnormal{\textcolor{gray}{,}} key-two \textnormal{\textcolor{gray}{=}} val\textnormal{\textcolor{gray}{,}} \dots} |
| 1712 |
% \ics*{setenumextmeta}|*|\mymarg{key name}\mymarg{key-one \textnormal{\textcolor{gray}{=}} val\textnormal{\textcolor{gray}{,}} key-two \textnormal{\textcolor{gray}{=}} val\textnormal{\textcolor{gray}{,}} \dots} |
| 1713 |
% \end{syntax} |
| 1714 |
% The command \ics*{setenumextmeta} adds a new \emph{\enquote{meta-key}} |
| 1715 |
% for the environments \myenv*{enumext} and \myenv*{enumext*}, the |
| 1716 |
% \mymarg{key name} must be different from those defined by the package. |
| 1717 |
% The \emph{optional argument} of the form |[1]|, |[2]|, |[3]|, |[4]| |
| 1718 |
% adds a new \emph{\enquote{meta-key}} for levels |1|, |2|, |3| and |4| |
| 1719 |
% of the \myenv*{enumext} environment, the form |[*]| adds a new |
| 1720 |
% \emph{\enquote{meta-key}} for the \myenv*{enumext*} environment. If it is |
| 1721 |
% run \emph{without} the \emph{optional argument}, it will adds a new |
| 1722 |
% \emph{\enquote{meta-key}} for the \emph{\enquote{first level}} of |
| 1723 |
% the \myenv*{enumext} environment. |
| 1724 |
% \end{function} |
| 1725 |
% |
| 1726 |
% The \emph{starred argument} ‘|*|’ will create the new \emph{\enquote{meta-key}} |
| 1727 |
% for the environment \myenv*{enumext*} and for \emph{\enquote{all levels}} of the |
| 1728 |
% environment \myenv*{enumext}. For example: |\setenumextmeta*{midsep}{topsep=3pt, partopsep=0pt}| |
| 1729 |
% will create a new key |midsep| available for all levels of the |
| 1730 |
% \myenv*{enumext} environment and the \myenv*{enumext*} environment |
| 1731 |
% and we can use it like any other key so |\begin{enumext}[midsep]| |
| 1732 |
% and |\begin{enumext*}[midsep]| will be valid. |
| 1733 |
% |
| 1734 |
% \section{The \texttt{keyval} system} |
| 1735 |
% |
| 1736 |
% The \mymeta{key = val} system used by the \mypkg*{enumext} package is |
| 1737 |
% implemented using \mypkg{l3keys} so it must be noted that \mymeta{keys} |
| 1738 |
% marked as \emph{\enquote{value forbidden}}, that is \mymeta{key} is |
| 1739 |
% different from \mymeta{key=}. |
| 1740 |
% |
| 1741 |
% \smallskip |
| 1742 |
% |
| 1743 |
% All \mymeta{keys} described in this section are available for the |
| 1744 |
% \myenv*{enumext}, \myenv*{enumext*}, \myenv*{keyans} and \myenv*{keyans*} |
| 1745 |
% environments with the exception of the keys \mykey{series}, \mykey{resume}, |
| 1746 |
% \mykey{resume*}, \mykey{reset} and \mykey{reset*} which are only available |
| 1747 |
% for the \myenv*{enumext} and \myenv*{enumext*} environments; and the keys |
| 1748 |
% \mykey{mini-right}, \mykey{mini-right*} which are only available for |
| 1749 |
% the \myenv*{enumext*} and \myenv*{keyans*} environments. |
| 1750 |
% |
| 1751 |
% \smallskip |
| 1752 |
% |
| 1753 |
% All \mymeta{keys} related to vertical or horizontal spacing accept a |
| 1754 |
% \emph{\enquote{skip}} or \emph{\enquote{dim}} expression if passed |
| 1755 |
% between braces, i.e. you do not need to use |\dimeval| or |\dimexpr| |
| 1756 |
% to perform calculations. |
| 1757 |
% |
| 1758 |
% \smallskip |
| 1759 |
% |
| 1760 |
% \begin{important}* |
| 1761 |
% It should be kept in mind that using any \mymeta{key} that sets |
| 1762 |
% \emph{rubber lengths} or \emph{rigid lengths} for vertical or |
| 1763 |
% horizontal space on a level will influence the vertical and horizontal |
| 1764 |
% space for \emph{inners levels} and \myenv*{keyans}, \myenv*{keyans*} and |
| 1765 |
% \myenv*{keyanspic} environments. |
| 1766 |
% \end{important} |
| 1767 |
% |
| 1768 |
% \smallskip |
| 1769 |
% |
| 1770 |
% \subsection{Keys for \texttt{label} and \texttt{ref}}\label{subsec:label-and-ref} |
| 1771 |
% |
| 1772 |
% \keyexamp*{mode-box}{value forbidden}{not used} |
| 1773 |
% This is a \emph{\enquote{switch-key}} that does not receive an |
| 1774 |
% argument and is \enquote{only} available for the \emph{\enquote{first level}} |
| 1775 |
% of the \myenv*{enumext} environment and the \myenv*{enumext*} environment. |
| 1776 |
% When this is set the \mykey{label}, \mykey{font}, \mykey{wrap-label} |
| 1777 |
% and \mykey{wrap-label*} keys are executed within |\makebox| for the |
| 1778 |
% \myenv*{enumext} and \myenv*{keyans} environments. |
| 1779 |
% |
| 1780 |
% \smallskip |
| 1781 |
% |
| 1782 |
% \begin{important} |
| 1783 |
% This key is intended for compatibility with \emph{tagged} \texttt{PDF} |
| 1784 |
% and is forcibly \emph{\enquote{enabled}} when |\DocumentMetadata| is |
| 1785 |
% present. If you want to get the same document output whether |\DocumentMetadata| |
| 1786 |
% is active or not, you must enable this key. |
| 1787 |
% \end{important} |
| 1788 |
% |
| 1789 |
% \smallskip |
| 1790 |
% |
| 1791 |
% \begin{important}* |
| 1792 |
% In the \myenv*{enumext*} and \myenv*{keyans*} environments |\makelabel| |
| 1793 |
% is redefined using |\makebox| by default. If \myenv*{enumext} or |
| 1794 |
% \myenv*{keyans} is used in the \myenv*{enumext*} environment the key |
| 1795 |
% must be activated manually. |
| 1796 |
% \end{important} |
| 1797 |
% |
| 1798 |
% \smallskip |
| 1799 |
% |
| 1800 |
% \keyexamp{label} |
| 1801 |
% {\textnormal |
| 1802 |
% {\ilabel{alph*} \textcolor{lightgray}{\textbar} \ilabel{Alph*} |
| 1803 |
% \textcolor{lightgray}{\textbar} \ilabel{arabic*} |
| 1804 |
% \textcolor{lightgray}{\textbar} \ilabel{roman*} |
| 1805 |
% \textcolor{lightgray}{\textbar} \ilabel{Roman*}} |
| 1806 |
% }{by levels} |
| 1807 |
% |
| 1808 |
% \smallskip |
| 1809 |
% |
| 1810 |
% Sets the \mymeta{label} that will be printed at the \emph{current level} |
| 1811 |
% and default value for \mykey{labelwidth} key. |
| 1812 |
% The default value for the first level of the environments |
| 1813 |
% \myenv*{enumext} and \myenv*{enumext*} is \ilabel{arabic*.}, for |
| 1814 |
% second level are \ilabel*{alph*)}, for third level are \ilabel{roman*.} |
| 1815 |
% and for fourth level is \ilabel{Alph*.}. For \myenv*{keyans} |
| 1816 |
% and \myenv*{keyans*} environments the default value is \ilabel{Alph*)}. |
| 1817 |
% |
| 1818 |
% \smallskip |
| 1819 |
% |
| 1820 |
% \begin{important}* |
| 1821 |
% This key is intended to give the basic structure with which the |
| 1822 |
% \mymeta{label} will be displayed, and the form in which it is |
| 1823 |
% used by standard \emph{\enquote{label and ref}} and the |
| 1824 |
% \emph{\enquote{internal label and ref}} system with the |
| 1825 |
% \mykey{save-ref} key. You cannot use commands with \mymeta{label} as an |
| 1826 |
% argument, for example |\emph|\mymarg{\textnormal{\ilabel{alph*}}} will return an |
| 1827 |
% error. For full customization of how \mymeta{label} is displayed use |
| 1828 |
% the \mykey{font}, \mykey{wrap-label} and/or \mykey{wrap-label*} keys. |
| 1829 |
% \end{important} |
| 1830 |
% |
| 1831 |
% \smallskip |
| 1832 |
% |
| 1833 |
% \keyexamp{labelsep}{rigid length}{\mydim{0.3333}em} |
| 1834 |
% Sets the \emph{horizontal space} between the box containing the |
| 1835 |
% current \mymeta{label} defined by \mykey{label} key and the text of an |
| 1836 |
% item on the first line. Internally sets the value of \ics{labelsep} for |
| 1837 |
% the current level. |
| 1838 |
% |
| 1839 |
% \smallskip |
| 1840 |
% |
| 1841 |
% \keyexamp{labelwidth}{rigid length}{by label} |
| 1842 |
% Sets the \emph{width} of the label box containing the current \mymeta{label} |
| 1843 |
% set by the \mykey{label} key. |
| 1844 |
% Internally sets the value of \ics{labelwidth} for the current level. |
| 1845 |
% The default values are calculated by means of the \emph{width} of a box |
| 1846 |
% by setting a \emph{value} to the current counter set by \mykey{label} |
| 1847 |
% key using ‘\mydim{0}’ for \ilabel{arabic*}, ‘|M|’ for \ilabel{Alph*}, |
| 1848 |
% ‘|m|’ for \ilabel{alph*}, ‘|VIII|’ for \ilabel{Roman*} and ‘|viii|’ |
| 1849 |
% for \ilabel{roman*}. |
| 1850 |
% |
| 1851 |
% \smallskip |
| 1852 |
% |
| 1853 |
% \keyexamp{widest}{integer \textnormal{\textcolor{lightgray}{\textbar}} string}{empty} |
| 1854 |
% Sets the \mykey{labelwidth} key passing the \mymeta{integer} or converting |
| 1855 |
% the \mymeta{string} of the form |\Alph|, |\alph|, |\Roman| or |\roman| |
| 1856 |
% to a \emph{value} for the current counter defined by \mykey{label} key, |
| 1857 |
% then calculating the \emph{width} by means of a box. For example |widest={XXIII}| |
| 1858 |
% or |widest={23}| are equivalent. This key is useful when the default |
| 1859 |
% values of the \mykey{labelwidth} key are smaller than those actually used. |
| 1860 |
% |
| 1861 |
% \smallskip |
| 1862 |
% |
| 1863 |
% \keyexamp{font}{font commands}{empty} |
| 1864 |
% Sets the \emph{font style} for the current \mymeta{label} defined by \mykey{label} key. |
| 1865 |
% You cannot use commands with an argument, for example |font={\small\textbf{#1}}| will |
| 1866 |
% return an error, but |font={\bfseries\small}| it will work. For full customization |
| 1867 |
% of how \mymeta{label} is displayed use \mykey{wrap-label} and/or \mykey{wrap-label*} keys. |
| 1868 |
% |
| 1869 |
% \smallskip |
| 1870 |
% |
| 1871 |
% \keyexamp{align}{left \textnormal{\textcolor{lightgray}{\textbar}} right \textnormal{\textcolor{lightgray}{\textbar}} center}{left} |
| 1872 |
% Sets the \emph{aligned} of \mymeta{label} defined by \mykey{label} |
| 1873 |
% key on the current level in the label box of width set by \mykey{labelwidth}. |
| 1874 |
% |
| 1875 |
% \smallskip |
| 1876 |
% |
| 1877 |
% \newsavebox{\hashbox} |
| 1878 |
% \begin{lrbox}{\hashbox} |
| 1879 |
% \lstinline[language=enumext-doc,basicstyle=\ttfamily]+{#1}+ |
| 1880 |
% \end{lrbox} |
| 1881 |
% |
| 1882 |
% \keyexamp{wrap-label}{code{} \space\usebox{\hashbox} more code}{empty} |
| 1883 |
% |
| 1884 |
% \smallskip |
| 1885 |
% |
| 1886 |
% Wraps the \emph{current} \mymeta{label} defined by \mykey{label} key |
| 1887 |
% referenced by |{#1}| after executing the \mykey{align} and \mykey{font} |
| 1888 |
% keys. The \mymarg{code} must be passed between braces and it does not modify |
| 1889 |
% the value set by the \mykey{labelwidth} key and is applied \emph{only} |
| 1890 |
% on \ics*{item} and \ics*{item*}. |
| 1891 |
% When using it in the \ics*{setenumext} command it is necessary to use the |
| 1892 |
% \emph{double} ‘|{##1}|’. For example |wrap-label={\fbox{#1}}| |
| 1893 |
% or you can create a command: |
| 1894 |
% |
| 1895 |
% \iffalse |
| 1896 |
%<*example> |
| 1897 |
% \fi |
| 1898 |
\begin{examplecode}[frame=none] |
| 1899 |
\NewDocumentCommand \mywrap { s m } |
| 1900 |
{ |
| 1901 |
\IfBooleanTF{#1} |
| 1902 |
{\textcolor{red}{\textbf{Q}}\textcolor{blue}{\textbf{.}}\textcolor{gray}{#2}} |
| 1903 |
{\textcolor{blue}{\textbf{Q}}\textcolor{red}{\textbf{.}}\textcolor{gray}{#2}} |
| 1904 |
} |
| 1905 |
\end{examplecode} |
| 1906 |
% \iffalse |
| 1907 |
%</example> |
| 1908 |
% \fi |
| 1909 |
% |
| 1910 |
% and then pass it through the key |wrap-label={\mywrap{#1}}| or |wrap-label={\mywrap*{#1}}|. |
| 1911 |
% |
| 1912 |
% \smallskip |
| 1913 |
% |
| 1914 |
% \keyexamp{wrap-label\textcolor{MediumOrchid}{*}}{code{} \space\usebox{\hashbox} more code}{empty} |
| 1915 |
% |
| 1916 |
% \smallskip |
| 1917 |
% |
| 1918 |
% The same as the \mykey{wrap-label} key but also applies on \ics*{item}\myoarg{custom}. |
| 1919 |
% |
| 1920 |
% |
| 1921 |
% \smallskip |
| 1922 |
% |
| 1923 |
% \newsavebox{\refboxsample} |
| 1924 |
% \begin{lrbox}{\refboxsample} |
| 1925 |
% \small\textcolor{gray}{\ttfamily\{}\textnormal{\small\ilabel{alph*}\textcolor{lightgray}{\textbar} \ilabel{Alph*}\textcolor{lightgray}{\textbar} \ilabel{arabic*}\textcolor{lightgray}{\textbar} \ilabel{roman*}\textcolor{lightgray}{\textbar} \ilabel{Roman*}}\textcolor{gray}{\ttfamily\}} |
| 1926 |
% \end{lrbox} |
| 1927 |
% \keyexamp{ref}{code{} \space\usebox{\refboxsample} more code}{empty} |
| 1928 |
% |
| 1929 |
% Modifies the way \emph{cross references} are displayed. The |
| 1930 |
% \mykey{label} key sets the default form of the \emph{cross references}, |
| 1931 |
% by using this key you can define a different format, for example: |
| 1932 |
% \mykey{ref}|=\emph|\mymarg{\textnormal{\ilabel{alph*}}} is valid. |
| 1933 |
% |
| 1934 |
% \smallskip |
| 1935 |
% |
| 1936 |
% Internally it renews the command associated with each counter when it |
| 1937 |
% is executed, i.e., in the environment \myenv*{enumext} the command |\theenumXi| |
| 1938 |
% is modified when the key is executed at the first level, |\theenumXii| |
| 1939 |
% when it is executed at the second level and |\theenumXiii| together |
| 1940 |
% with |\theenumXiv| when it is executed at the |
| 1941 |
% third and fourth levels. |
| 1942 |
% |
| 1943 |
% \smallskip |
| 1944 |
% |
| 1945 |
% \begin{important}* |
| 1946 |
% This must be kept in mind, since the values set by the \mykey{label} and |
| 1947 |
% \mykey{ref} keys are not cumulative by levels, so if you have used the \mykey{ref} |
| 1948 |
% key in the first level and then want to associate the counter with |
| 1949 |
% \mykey{label} or \mykey{ref} in the second level you must use the direct commands, |
| 1950 |
% i.e. |\arabic{eunumXi}| to indicate the count of the first level |
| 1951 |
% instead of using |\theenumXi|. |
| 1952 |
% \end{important} |
| 1953 |
% |
| 1954 |
% \subsection{Keys for penalties}\label{subsec:penalties} |
| 1955 |
% |
| 1956 |
% Page breaks in the provided environments are controlled by the |
| 1957 |
% following three parameters, which work together to ensure they look |
| 1958 |
% good, avoiding unsightly page breaks that could distort the output. |
| 1959 |
% |
| 1960 |
% \smallskip |
| 1961 |
% |
| 1962 |
% \keyexamp{beginpenalty}{integer}{\mydim{-51}} |
| 1963 |
% Set the \emph{page breaking} penalty for breaking at the beginning of |
| 1964 |
% the \myenv*{enumext}, \myenv*{enumext*}, \myenv*{keyans} and |
| 1965 |
% \myenv*{keyans*} environments. Internally sets the value of \textcolor{red}{\texttt{\textbackslash}}|@beginparpenalty|. |
| 1966 |
% |
| 1967 |
% \smallskip |
| 1968 |
% |
| 1969 |
% \keyexamp{midpenalty}{integer}{\mydim{-51}} |
| 1970 |
% Set the \emph{page breaking} penalty for breaking between items of |
| 1971 |
% the \myenv*{enumext}, \myenv*{enumext*}, \myenv*{keyans} and |
| 1972 |
% \myenv*{keyans*} environments. Internally sets the value of \textcolor{red}{\texttt{\textbackslash}}|@itempenalty|. |
| 1973 |
% |
| 1974 |
% \smallskip |
| 1975 |
% |
| 1976 |
% \keyexamp{endpenalty}{integer}{\mydim{-51}} |
| 1977 |
% Set the \emph{page breaking} penalty for breaking at the end of |
| 1978 |
% the \myenv*{enumext}, \myenv*{enumext*}, \myenv*{keyans} and |
| 1979 |
% \myenv*{keyans*} environments. Internally sets the value of \textcolor{red}{\texttt{\textbackslash}}|@endparpenalty|. |
| 1980 |
% |
| 1981 |
% \smallskip |
| 1982 |
% |
| 1983 |
% \begin{important}* |
| 1984 |
% The values passed to these \mymeta{keys} affect the nested |
| 1985 |
% environments in which they were set and cannot be reset. |
| 1986 |
% \hologo{LaTeX} default is \textcolor{red}{\texttt{-}}\textcolor{red}{\texttt{\textbackslash}}|@lowpenalty|, |
| 1987 |
% that is, \mydim{-51}. Because it is negative, it somewhat encourages a |
| 1988 |
% page break at each spot. Change it with, e.g., \textcolor{red}{\texttt{\textbackslash}}|@beginparpenalty=|\mydim{9999}; a value |
| 1989 |
% of \mydim{10000} prohibits a page break. Please, refer to your |
| 1990 |
% \hologo{LaTeX} or \hologo{TeX} manual about how penalties control page |
| 1991 |
% breaks. |
| 1992 |
% \end{important} |
| 1993 |
% |
| 1994 |
% \subsection{Keys for spaces} |
| 1995 |
% |
| 1996 |
% \keyexamp{show-length}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false} |
| 1997 |
% Displays on the terminal the values for \emph{all list parameters} at the current level. |
| 1998 |
% For \emph{vertical spaces} show the values of |\topsep|, |\itemsep|, |\parsep| and |\partopsep|. |
| 1999 |
% For \emph{horizontal spaces} show the values of |\labelwidth|, |\labelsep|, |\itemindent|, |\listparindent| and |\leftmargin|. |
| 2000 |
% |
| 2001 |
% \subsubsection{Vertical spaces} |
| 2002 |
% |
| 2003 |
% \keyexamp{topsep}{rubber length \textnormal{\textcolor{lightgray}{\textbar}} rigid length}{by levels} |
| 2004 |
% |
| 2005 |
% \smallskip |
| 2006 |
% |
| 2007 |
% Set the \emph{vertical space} added to both the top and bottom of the list. |
| 2008 |
% Internally sets the value of \ics{topsep} for the current level. |
| 2009 |
% The default value for the first level of the environments |
| 2010 |
% \myenv*{enumext} and \myenv*{enumext*} are \mydim{8.0pt plus 2.0pt minus 4.0pt}, |
| 2011 |
% for second level are \mydim{4.0pt plus 2.0pt minus 1.0pt}, for third and |
| 2012 |
% fourth level are \mydim{2.0pt plus 1.0pt minus 1.0pt}. For \myenv*{keyans} |
| 2013 |
% and \myenv*{keyans*} environments the default value is \mydim{4.0pt plus 2.0pt minus 1.0pt}. |
| 2014 |
% |
| 2015 |
% \smallskip |
| 2016 |
% |
| 2017 |
% \keyexamp{parsep}{rubber length \textnormal{\textcolor{lightgray}{\textbar}} rigid length}{by levels} |
| 2018 |
% |
| 2019 |
% \smallskip |
| 2020 |
% |
| 2021 |
% Set the \emph{vertical space} between paragraphs within an item. |
| 2022 |
% Internally sets the value of \ics{parsep} for the current level. |
| 2023 |
% The default value for the first level of the environments \myenv*{enumext} |
| 2024 |
% and \myenv*{enumext*} are \mydim{4.0pt plus 2.0pt minus 1.0pt}, |
| 2025 |
% for second level are \mydim{2.0pt plus 1.0pt minus 1.0pt}, for third and |
| 2026 |
% fourth level are \mydim{0pt}. For \myenv*{keyans} and \myenv*{keyans*} |
| 2027 |
% environments the default value is \mydim{2.0pt plus 1.0pt minus 1.0pt}. |
| 2028 |
% |
| 2029 |
% \smallskip |
| 2030 |
% |
| 2031 |
% \begin{important}* |
| 2032 |
% In the \myenv*{enumext*} and \myenv*{keyans*} environments this value |
| 2033 |
% is passed to |\parskip| within the \myenv{minipage} environment where |
| 2034 |
% \emph{\enquote{item content}} is placed. |
| 2035 |
% \end{important} |
| 2036 |
% |
| 2037 |
% \smallskip |
| 2038 |
% |
| 2039 |
% \keyexamp{partopsep}{rubber length \textnormal{\textcolor{lightgray}{\textbar}} rigid length}{by levels} |
| 2040 |
% |
| 2041 |
% \smallskip |
| 2042 |
% |
| 2043 |
% Set the \emph{vertical space} added, beyond \mykey{topsep}, to the \enquote{top} and \enquote{bottom} |
| 2044 |
% of the entire environment if the environment instance is preceded by a \emph{\enquote{blank |
| 2045 |
% line}} or |\par| command. Internally sets the value of \ics{partopsep} for the current level. |
| 2046 |
% The default values for first and second level in environment |
| 2047 |
% \myenv*{enumext} are \mydim{2.0pt plus 1.0pt minus 1.0pt}, |
| 2048 |
% for third and fourth level are \mydim{1.0pt minus 1.0pt}. |
| 2049 |
% For the \myenv*{keyans} environment the default value is \mydim{2.0pt |
| 2050 |
% plus 1.0pt minus 1.0pt}, and for the \myenv*{keyans*} and |
| 2051 |
% \myenv*{enumext*} environments it is available but \emph{without} |
| 2052 |
% effect. |
| 2053 |
% |
| 2054 |
% \smallskip |
| 2055 |
% |
| 2056 |
% \begin{important}* |
| 2057 |
% The value of this parameter also affects the \emph{inner levels} and the |
| 2058 |
% environments \myenv*{keyans}, \myenv*{keyanspic} and \myenv*{keyans*}. |
| 2059 |
% Caution should be taken with \emph{\enquote{blank lines}} or |\par| |
| 2060 |
% command \emph{\enquote{before}} each environment or nested level when |
| 2061 |
% formatting the source code of document. \hologo{TeX} will enter \mymeta{vertical mode} |
| 2062 |
% and apply this value to the \enquote{top} and \enquote{bottom} the |
| 2063 |
% environment or nested level. |
| 2064 |
% \end{important} |
| 2065 |
% |
| 2066 |
% \smallskip |
| 2067 |
% |
| 2068 |
% \keyexamp{itemsep}{rubber length \textnormal{\textcolor{lightgray}{\textbar}} rigid length}{by levels} |
| 2069 |
% Set the \emph{vertical space} between items, beyond the \mykey{parsep}. |
| 2070 |
% Internally sets the value of \ics{itemsep} for the current level. |
| 2071 |
% The default value for the first level of the environments \myenv*{enumext} |
| 2072 |
% and \myenv*{enumext*} are \mydim{4.0pt plus 2.0pt minus 1.0pt}, |
| 2073 |
% for the rest of the levels are \mydim{2.0pt plus 1.0pt minus 1.0pt}. |
| 2074 |
% For \myenv*{keyans} and \myenv*{keyans*} environments the default |
| 2075 |
% value is \mydim{4.0pt plus 2.0pt minus 1.0pt}. |
| 2076 |
% |
| 2077 |
% \smallskip |
| 2078 |
% |
| 2079 |
% \begin{important}* |
| 2080 |
% In the \myenv*{enumext*} and \myenv*{keyans*} environments this value |
| 2081 |
% corresponds to the separation between rows. |
| 2082 |
% \end{important} |
| 2083 |
% |
| 2084 |
% \smallskip |
| 2085 |
% |
| 2086 |
% \keyexamp*{noitemsep}{value forbidden}{not used} |
| 2087 |
% This is a \emph{\enquote{meta-key}} that does not receive an argument. Set |
| 2088 |
% \mykey{itemsep} and \mykey{parsep} equal to \mydim{0pt} the entire level of environment. |
| 2089 |
% |
| 2090 |
% \smallskip |
| 2091 |
% |
| 2092 |
% \keyexamp*{nosep}{value forbidden}{not used} |
| 2093 |
% This is a \emph{\enquote{meta-key}} that does not receive an argument. Sets all keys |
| 2094 |
% for vertical spacing equal to \mydim{0pt} the entire level of environment. |
| 2095 |
% |
| 2096 |
% \smallskip |
| 2097 |
% |
| 2098 |
% \keyexamp*{base-fix}{value forbidden}{not used} |
| 2099 |
% |
| 2100 |
% \smallskip |
| 2101 |
% |
| 2102 |
% This is a \emph{\enquote{switch-key}} that does not receive an |
| 2103 |
% argument available \emph{only} for the \emph{\enquote{first level}} of environment |
| 2104 |
% \myenv*{enumext}. Fix the \emph{baseline} when an environment \myenv*{enumext} |
| 2105 |
% is nested in \myenv*{enumext*} and there is no material between the |
| 2106 |
% |\item| and the start of the environment for example |\item \begin{enumext}| |
| 2107 |
% within the environment \myenv*{enumext*}. Internally sets the keys \mykey{topsep}, |
| 2108 |
% \mykey{above} and \mykey{above}|*| at \mydim{0pt}. |
| 2109 |
% |
| 2110 |
% \smallskip |
| 2111 |
% |
| 2112 |
% \begin{important}* |
| 2113 |
% This key is provided as a way to work around this minor issue, but you |
| 2114 |
% should be aware that if for some reason you have the \mykey{itemindent} |
| 2115 |
% key set in the \myenv*{enumext*} environment it will be lost and you |
| 2116 |
% will need to adjust it using the \mykey{list-offset} key in the |
| 2117 |
% \myenv*{enumext} environment. |
| 2118 |
% \end{important} |
| 2119 |
% |
| 2120 |
% \subsubsection*{Extra vertical spaces} |
| 2121 |
% |
| 2122 |
% \begin{important}* |
| 2123 |
% The following \mymeta{keys} should be used with \emph{\enquote{caution}}, they |
| 2124 |
% are intended to be used at the \enquote{top} and \enquote{bottom} of |
| 2125 |
% the environment when the \mykey{columns} or \mykey{mini-env} keys do |
| 2126 |
% not provide adequate \emph{vertical spaces}. |
| 2127 |
% The values passed can be \emph{rubber} or \emph{rigid} lengths, the |
| 2128 |
% way they are applied is the way you differ, using the \emph{star} ‘|*|’ |
| 2129 |
% \mymeta{keys} applies |\vspace*| so that \hologo{LaTeX} does |
| 2130 |
% \emph{not discard} this space at page break. |
| 2131 |
% \end{important} |
| 2132 |
% |
| 2133 |
% \smallskip |
| 2134 |
% |
| 2135 |
% \keyexamp{above}{rubber length \textnormal{\textcolor{lightgray}{\textbar}} rigid length}{not used} |
| 2136 |
% |
| 2137 |
% \smallskip |
| 2138 |
% |
| 2139 |
% Set the \emph{extra vertical space} added, beyond \mykey{topsep}, to |
| 2140 |
% the top of the entire level of environment. This key is intended to |
| 2141 |
% give a \emph{\enquote{fine adjustment}} of the vertical space |
| 2142 |
% \emph{\enquote{above}} the environment without hindering the value of |
| 2143 |
% the \mykey{topsep} key. The space is added with |\vspace| so is |
| 2144 |
% \emph{\enquote{discardable}}. |
| 2145 |
% |
| 2146 |
% \keyexamp{above\textcolor{MediumOrchid}{*}}{rubber length \textnormal{\textcolor{lightgray}{\textbar}} rigid length}{not used} |
| 2147 |
% |
| 2148 |
% \smallskip |
| 2149 |
% |
| 2150 |
% Set the \emph{extra vertical space} added, beyond \mykey{topsep}, to |
| 2151 |
% the top of the entire level of environment. This key is intended to |
| 2152 |
% give a \emph{\enquote{fine adjustment}} of the vertical space |
| 2153 |
% \emph{\enquote{above}} the environment without hindering the value of |
| 2154 |
% the \mykey{topsep} key. The space is added with |\vspace*| so is |
| 2155 |
% \emph{\enquote{not discardable}}. |
| 2156 |
% |
| 2157 |
% \smallskip |
| 2158 |
% |
| 2159 |
% \keyexamp{below}{rubber length \textnormal{\textcolor{lightgray}{\textbar}} rigid length}{not used} |
| 2160 |
% |
| 2161 |
% \smallskip |
| 2162 |
% |
| 2163 |
% Set the \emph{extra vertical space} space added, beyond \mykey{topsep}, to |
| 2164 |
% the bottom of the entire level of environment. This key is intended to |
| 2165 |
% give a \emph{\enquote{fine adjustment}} of the vertical space on the |
| 2166 |
% \emph{\enquote{below}} the environment without hindering the value of |
| 2167 |
% the \mykey{topsep} key. The space is added with |\vspace| so is |
| 2168 |
% \emph{\enquote{discardable}}. |
| 2169 |
% |
| 2170 |
% \smallskip |
| 2171 |
% |
| 2172 |
% \keyexamp{below\textcolor{MediumOrchid}{*}}{rubber length \textnormal{\textcolor{lightgray}{\textbar}} rigid length}{not used} |
| 2173 |
% |
| 2174 |
% \smallskip |
| 2175 |
% |
| 2176 |
% Set the \emph{extra vertical space} space added, beyond \mykey{topsep}, to |
| 2177 |
% the bottom of the entire level of environment. This key is intended to |
| 2178 |
% give a \emph{\enquote{fine adjustment}} of the vertical space on the |
| 2179 |
% \emph{\enquote{below}} the environment without hindering the value of |
| 2180 |
% the \mykey{topsep} key. The space is added with |\vspace*| so is |
| 2181 |
% \emph{\enquote{not discardable}}. |
| 2182 |
% |
| 2183 |
% \subsubsection{Horizontal spaces} |
| 2184 |
% |
| 2185 |
% \keyexamp{list-offset}{rigid length}{\mydim{0}pt} |
| 2186 |
% Sets the \emph{horizontal translation} of the entire environment level from the left edge |
| 2187 |
% of the box defined by the \mykey{labelwidth} key. Internally sets the values of |
| 2188 |
% |\leftmargin| and |\itemindent| for the current level. |
| 2189 |
% |
| 2190 |
% \smallskip |
| 2191 |
% |
| 2192 |
% \keyexamp{list-indent}{rigid length}{labelwidth + labelsep} |
| 2193 |
% Sets the \emph{indentation} of the whole environment under the box defined by |
| 2194 |
% \mykey{labelwidth} and \mykey{labelsep} keys. Internally sets the value of |
| 2195 |
% |\leftmargin| and |\itemindent| for the current level. |
| 2196 |
% If |list-indent=|\mydim{0pt} is set in the environments \myenv*{enumext} |
| 2197 |
% and \myenv*{keyans} the \mymeta{label} will be part of the text, separated |
| 2198 |
% by the value of the \mykey{labelsep} key and the \emph{first word}, in |
| 2199 |
% simple terms it will look like a \emph{\enquote{common paragraph}}. |
| 2200 |
% |
| 2201 |
% \smallskip |
| 2202 |
% |
| 2203 |
% \begin{important}* |
| 2204 |
% The \myenv*{enumext*} and \myenv*{keyans*} environments are |
| 2205 |
% implemented using |\makebox| and \myenv{minipage} which causes |
| 2206 |
% \emph{\enquote{list indent}} to always be equal to the value passed to |
| 2207 |
% \mykey{labelwidth} plus \mykey{labelsep}. Passing a value to this key is |
| 2208 |
% equivalent to setting the value for the \mykey{list-offset} key. |
| 2209 |
% \end{important} |
| 2210 |
% |
| 2211 |
% \newpage |
| 2212 |
% |
| 2213 |
% \keyexamp{itemindent}{rigid length}{\mydim{0}pt} |
| 2214 |
% |
| 2215 |
% \smallskip |
| 2216 |
% |
| 2217 |
% Sets the extra \emph{horizontal indentation}, beyond \mykey{labelsep}, |
| 2218 |
% of the \emph{\enquote{first line}} of each |\item| that is not followed |
| 2219 |
% by a \emph{\enquote{blank line}} or the |\par| command . This value must |
| 2220 |
% be greater than or equal to \mydim{0pt} and is applied internally using |
| 2221 |
% |\hspace| \emph{without} modifying the value of |\itemindent|. |
| 2222 |
% |
| 2223 |
% \smallskip |
| 2224 |
% |
| 2225 |
% \begin{important}* |
| 2226 |
% This key is intended for the \myenv*{enumext*} and \myenv*{keyans*} |
| 2227 |
% environments where, by their implementation, it is not possible to |
| 2228 |
% adjust \mykey{labelwidth} and \mykey{list-indent} \emph{without} |
| 2229 |
% modifying the output. If you use \myenv*{enumext} or \myenv*{keyans} |
| 2230 |
% and want to get around the \emph{blank line} limitation or the |\par| |
| 2231 |
% command followed by |\item| you can modify \mykey{labelwidth} and |
| 2232 |
% \mykey{list-indent} and get the same effect. |
| 2233 |
% \end{important} |
| 2234 |
% |
| 2235 |
% \keyexamp{rightmargin}{rigid length}{\mydim{0}pt} |
| 2236 |
% |
| 2237 |
% \smallskip |
| 2238 |
% |
| 2239 |
% Set the \emph{horizontal space} between the right margin of the environment and the |
| 2240 |
% right margin of the enclosing environment, the value it takes must be |
| 2241 |
% greater than or equal to \mydim{0pt}. Internally sets the value of |
| 2242 |
% \ics{rightmargin} for the current level. |
| 2243 |
% |
| 2244 |
% \smallskip |
| 2245 |
% |
| 2246 |
% \keyexamp{listparindent}{rigid length}{\mydim{0}pt} |
| 2247 |
% Sets the \emph{horizontal space} indentation, beyond \mykey{list-indent}, |
| 2248 |
% for second and subsequent paragraphs within a list item. Internally |
| 2249 |
% sets the value of \ics{listparindent} for the current level. |
| 2250 |
% |
| 2251 |
% \smallskip |
| 2252 |
% |
| 2253 |
% \begin{important}* |
| 2254 |
% In the \myenv*{enumext*} and \myenv*{keyans*} environments this value |
| 2255 |
% is passed to |\parindent| within the \myenv{minipage} environment where |
| 2256 |
% \emph{\enquote{item content}} is placed. |
| 2257 |
% \end{important} |
| 2258 |
% |
| 2259 |
% \smallskip |
| 2260 |
% |
| 2261 |
% \subsection{Keys for add \texttt{code}} |
| 2262 |
% |
| 2263 |
% The following \mymeta{keys} should be used with \emph{\enquote{caution}}, |
| 2264 |
% they are intended to inject \mymarg{code} into different parts of the |
| 2265 |
% defined environments. We must keep in mind that the defined |
| 2266 |
% environments are based on the \myenv{list} base environment provided by |
| 2267 |
% \hologo{LaTeX} which is defined (simplified) as plain form |\list|\mymarg{arg one}\mymarg{arg two}. |
| 2268 |
% Using the \mykey{before*} key does not allow access to the \myenv{list} |
| 2269 |
% parameters defined by \myoarg{key |
| 2270 |
% \textnormal{\textcolor{gray}{=}} val}. |
| 2271 |
% |
| 2272 |
% \smallskip |
| 2273 |
% |
| 2274 |
% \keyexamp{before}{code}{not used} |
| 2275 |
% Execute \mymarg{code} \emph{\enquote{before}} the environment |
| 2276 |
% starts. The \mymarg{code} must be passed between braces, is executed |
| 2277 |
% \emph{\enquote{after}} all calculations related to the \emph{list |
| 2278 |
% parameters} in the environment and the \mymeta{keys} sets by |
| 2279 |
% \myoarg{key \textnormal{\textcolor{gray}{=}} val} have been performed, |
| 2280 |
% that is, in the \emph{second argument} of the list: |\begin{list}|\mymarg{arg one}|{|\mymeta{arg two}\mymarg[cbc=pkgcolor,ac=araracolor]{code}|}|. |
| 2281 |
% |
| 2282 |
% \smallskip |
| 2283 |
% |
| 2284 |
% \keyexamp{before\textcolor{MediumOrchid}{*}}{code}{not used} |
| 2285 |
% Execute \mymarg{code} \emph{\enquote{before}} the |
| 2286 |
% environment starts. The \mymarg{code} must be passed between braces, is executed |
| 2287 |
% \emph{\enquote{before}} performing all calculations related to the \emph{list |
| 2288 |
% parameters} and the \mymeta{keys} sets in \myoarg{key \textnormal{\textcolor{gray}{=}} |
| 2289 |
% val} of the environment that is, \emph{\enquote{before}} the arguments |
| 2290 |
% defining the list environment are executed: |
| 2291 |
% \mymarg[type=tt,cbc=pkgcolor,ac=araracolor]{code}|\begin{list}|\mymarg{arg |
| 2292 |
% one}\mymarg{arg two}. |
| 2293 |
% |
| 2294 |
% \smallskip |
| 2295 |
% |
| 2296 |
% \keyexamp{first}{code}{not used} |
| 2297 |
% Executes \mymarg{code} when \emph{\enquote{starting}} the |
| 2298 |
% environment. The \mymarg{code} must be passed between |
| 2299 |
% braces, is executed right \emph{\enquote{after}} all \emph{list |
| 2300 |
% parameters} are done, after the second argument of list, just before the first occurrence of \ics*{item}: |
| 2301 |
% |\begin{list}|\mymarg{arg one}\mymarg{arg two}\mymarg[cbc=pkgcolor,ac=araracolor]{code}|\item|. |
| 2302 |
% |
| 2303 |
% \smallskip |
| 2304 |
% |
| 2305 |
% \begin{important}* |
| 2306 |
% Keep in mind that the \mymarg{code} set in this \mymeta{key} will affect |
| 2307 |
% the entire \emph{\enquote{body}} of the environment and therefore the |
| 2308 |
% inner levels of the list and the \myenv*{keyans}, \myenv*{keyans*} and |
| 2309 |
% \myenv*{keyanspic} environments. It is recommended to set this \mymeta{key} |
| 2310 |
% per level. In the \myenv*{enumext*} and \myenv*{keyans*} environments |
| 2311 |
% this \mymeta{key} is executed \emph{\enquote{after}} the \mykey{listparindent}, |
| 2312 |
% \mykey{parsep} and \mykey{itemindent} \mymeta{keys} within the \myenv{minipage} |
| 2313 |
% environment in which the \emph{\enquote{item content}} is placed. |
| 2314 |
% \end{important} |
| 2315 |
% |
| 2316 |
% \smallskip |
| 2317 |
% |
| 2318 |
% \keyexamp{after}{code}{not used} |
| 2319 |
% Execute \mymarg{code} \emph{\enquote{after}} finishing the |
| 2320 |
% environment. The \mymarg{code} must be passed between braces. |
| 2321 |
% |
| 2322 |
% \subsection{Keys for \texttt{start}, \texttt{series} and \texttt{resume}} |
| 2323 |
% |
| 2324 |
% \keyexamp{start}{integer \textnormal{\textcolor{lightgray}{\textbar}} integer expression}{\mydim{1}} |
| 2325 |
% Sets the \emph{start value} of the numbering on the \emph{\enquote{current level}}. |
| 2326 |
% The \mymarg{integer expression} must be passed between braces, internally is evaluated and pass |
| 2327 |
% to the \emph{\enquote{counter}} defined by \mykey{label} key on the current level, i.e. it is equivalent to enter |
| 2328 |
% |start={\dimeval{100*\value{chapter}}| or |start={100*\value{chapter}}|. |
| 2329 |
% |
| 2330 |
% \smallskip |
| 2331 |
% |
| 2332 |
% \keyexamp{start\textcolor{MediumOrchid}{*}}{integer \textnormal{\textcolor{lightgray}{\textbar}} string}{not used} |
| 2333 |
% Sets the \emph{start value} of the numbering on the \emph{\enquote{current level}}. |
| 2334 |
% Internally \mymeta{string} is converted and passed as value to the \emph{\enquote{counter}} |
| 2335 |
% defined by \mykey{label} key on the current level, i.e. it is equivalent to enter |
| 2336 |
% |start*=5|, |start*=E| or |start*=v|. |
| 2337 |
% |
| 2338 |
% \smallskip |
| 2339 |
% |
| 2340 |
% \begin{important} |
| 2341 |
% The \emph{start value} are set in the \emph{second argument} of the \myenv{list} |
| 2342 |
% environment and \emph{\enquote{before}} the execution of the keys \mykey{before} |
| 2343 |
% and \mykey{first}: |\begin{list}|\mymarg{arg one}|{|\mymeta{arg two}|\setcounter}|. |
| 2344 |
% \end{important} |
| 2345 |
% |
| 2346 |
% \smallskip |
| 2347 |
% |
| 2348 |
% \begin{important}* |
| 2349 |
% The following \mymeta{keys} are available only for the \myenv*{enumext} |
| 2350 |
% and \myenv*{enumext*} environments. |
| 2351 |
% \end{important} |
| 2352 |
% |
| 2353 |
% \keyexamp{series}{series name}{not used} |
| 2354 |
% |
| 2355 |
% \smallskip |
| 2356 |
% |
| 2357 |
% Stores the \emph{keys} of the \emph{optional argument} of the \emph{\enquote{current level}} |
| 2358 |
% of the environment in which it is executed in \mymarg{series name} which |
| 2359 |
% is used as an \emph{argument} in the \mykey{resume} key. The \mymeta{keys} |
| 2360 |
% stored in \mymarg{series name} are NOT cumulative and are overwritten |
| 2361 |
% if the same \mymarg{series name} is used again at the \emph{\enquote{same level}} |
| 2362 |
% at which the key was executed. |
| 2363 |
% |
| 2364 |
% \begin{important}* |
| 2365 |
% For security reasons the \mykey{series} key will never save in |
| 2366 |
% \mymarg{series name} the \mymeta{keys} \mykey{series}, \mykey{resume}, |
| 2367 |
% \mykey{resume*}, \mykey{reset}, \mykey{reset*}, \mykey{save-ans}, \mykey{save-key}, |
| 2368 |
% \mykey{start*} and \mykey{start}. |
| 2369 |
% \end{important} |
| 2370 |
% |
| 2371 |
% \smallskip |
| 2372 |
% |
| 2373 |
% \keyexamp{resume}{series name}{not used} |
| 2374 |
% Sets the \emph{start value} and \emph{options} for the \emph{\enquote{current level}} |
| 2375 |
% continuing the numbering and \emph{options} of the \emph{\enquote{same level}} as |
| 2376 |
% the environment in which the \mykey{series}|=|\mymarg{series name} |
| 2377 |
% key was executed, the \emph{start value} will continue numbering according to |
| 2378 |
% the last execution of \mykey{resume}|=|\mymarg{series name}. If passed |
| 2379 |
% \emph{\enquote{without value}} this will only set \emph{start value} |
| 2380 |
% continue the numbering of the \emph{\enquote{same level}} |
| 2381 |
% from the last environment and level in which \mykey{series}|=|\mymarg{series name} |
| 2382 |
% or \mykey{resume}|=|\mymarg{series name} is NOT present and if the |
| 2383 |
% \mykey{save-ans} key is active (on the left) it will continue the numbering from the |
| 2384 |
% \enquote{last} environment in which it was executed. The \emph{start value} |
| 2385 |
% can be overwritten using \mykey{start} or \mykey{start*} keys. |
| 2386 |
% |
| 2387 |
% \smallskip |
| 2388 |
% |
| 2389 |
% \begin{important}* |
| 2390 |
% The \mykey{resume} key passed \emph{\enquote{without value}} must be |
| 2391 |
% exactly \emph{\enquote{without value}}, i.e. \mykey{resume}|=| cannot |
| 2392 |
% be used and if executed before \mykey{resume*} it will affect the |
| 2393 |
% \emph{start value}. |
| 2394 |
% \end{important} |
| 2395 |
% |
| 2396 |
% \smallskip |
| 2397 |
% |
| 2398 |
% \keyexamp*{resume\textcolor{MediumOrchid}{*}}{value forbidden}{not used} |
| 2399 |
% Sets the \emph{start value} and \emph{options} for the \emph{\enquote{current level}} |
| 2400 |
% continuing the numbering and options of the \emph{\enquote{same level}} |
| 2401 |
% as the last environment and level in which the \mykey{series}|=|\mymarg{series name} or |
| 2402 |
% \mykey{resume}|=|\mymarg{series name} keys are NOT present and if the |
| 2403 |
% \mykey{save-ans} key is active (on the left) it will continue the numbering and options |
| 2404 |
% from the \enquote{last} environment in which it was executed. The \emph{start value} |
| 2405 |
% can be overwritten using \mykey{start} or \mykey{start*} keys. |
| 2406 |
% |
| 2407 |
% \smallskip |
| 2408 |
% |
| 2409 |
% \begin{important}* |
| 2410 |
% When using the key \mykey{resume}|=|\mymarg{series name} or |
| 2411 |
% \mykey{resume*} you will have hierarchy in the \mymeta{keys} that are |
| 2412 |
% stored in \mymarg{series name} or in an internal version of |
| 2413 |
% \mymarg{series name} in the case of \mykey{resume*}. If you want to |
| 2414 |
% \emph{reset} the value of a \mymeta{key} that is already stored in |
| 2415 |
% \mymarg{series name} or in an internal version of \mymarg{series name} |
| 2416 |
% this must be placed to the \emph{right} of the key |
| 2417 |
% \mykey{resume}|=|\mymarg{series name} or \mykey{resume*}. |
| 2418 |
% \end{important} |
| 2419 |
% |
| 2420 |
% \smallskip |
| 2421 |
% |
| 2422 |
% \begin{important}* |
| 2423 |
% When the \mykey{resume}|*| key is executed consecutively, it does not |
| 2424 |
% rewrite the \mymeta{keys} stored in the internal version of |
| 2425 |
% \mymarg{series name} and if the environment that precedes it does not |
| 2426 |
% have the \emph{optional argument}, it will just continue with the |
| 2427 |
% numbering. |
| 2428 |
% \end{important} |
| 2429 |
% |
| 2430 |
% \subsection{Keys for \texttt{reset}}\label{sec:reset} |
| 2431 |
% |
| 2432 |
% \keyexamp*{reset}{value forbidden}{not used} |
| 2433 |
% Resets the \emph{start value} of the \emph{\enquote{counters}} in the |
| 2434 |
% \myenv*{enumext} and \myenv*{enumext*} environments along with the |
| 2435 |
% \emph{\enquote{internal counters}} used by the \mykey{resume} \emph{without value} |
| 2436 |
% and \mykey{resume*} keys at the \emph{\enquote{level}} at which it is |
| 2437 |
% executed. The \emph{start value} can be overwritten using the \mykey{start} |
| 2438 |
% or \mykey{start*} keys. |
| 2439 |
% |
| 2440 |
% \smallskip |
| 2441 |
% |
| 2442 |
% \keyexamp*{reset\textcolor{MediumOrchid}{*}}{value forbidden}{not used} |
| 2443 |
% Resets the \emph{start value} of the \emph{\enquote{counters}} in the |
| 2444 |
% \myenv*{enumext} and \myenv*{enumext*} environments along with the |
| 2445 |
% \emph{\enquote{internal counters}} used by the \mykey{resume} \emph{without value} |
| 2446 |
% and \mykey{resume*} keys at the \emph{\enquote{level}} at which it is |
| 2447 |
% executed and in the \emph{\enquote{levels below}} it in the case of |
| 2448 |
% the \myenv*{enumext} environment. The \emph{start value} can be overwritten |
| 2449 |
% using the \mykey{start} or \mykey{start*} keys. |
| 2450 |
% |
| 2451 |
% \smallskip |
| 2452 |
% |
| 2453 |
% \begin{important}* |
| 2454 |
% These keys are intended to be used in cases where the |\resetenumext| |
| 2455 |
% command does not work, e.g. after an unnumbered chapter. It should |
| 2456 |
% preferably be set \emph{only} on the \emph{first level}, although it is |
| 2457 |
% available for all levels. |
| 2458 |
% \end{important} |
| 2459 |
% |
| 2460 |
% \subsubsection{The command \cs{resetenumext}}\label{sec:resetenumext} |
| 2461 |
% |
| 2462 |
% \vspace*{-10pt} |
| 2463 |
% |
| 2464 |
% \begin{function}{\resetenumext} |
| 2465 |
% \begin{minipage}[t]{0.45\linewidth} |
| 2466 |
% \cmdexamp{resetenumext}[\textnormal{\textcolor{MediumOrchid}{\texttt{1}}}]{some counter} |
| 2467 |
% \cmdexamp{resetenumext}[\textnormal{\textcolor{MediumOrchid}{\texttt{2}}}]{some counter} |
| 2468 |
% \cmdexamp{resetenumext}[\textnormal{\textcolor{MediumOrchid}{\texttt{3}}}]{some counter} |
| 2469 |
% \end{minipage}\hfill |
| 2470 |
% \begin{minipage}[t]{0.45\linewidth} |
| 2471 |
% \cmdexamp{resetenumext}[\textnormal{\textcolor{MediumOrchid}{\texttt{4}}}]{some counter} |
| 2472 |
% \cmdexamp{resetenumext}[\textnormal{\textcolor{MediumOrchid}{\texttt{*}}}]{some counter} |
| 2473 |
% \cmdexamp{resetenumext\textcolor{MediumOrchid}{*}}{some counter} |
| 2474 |
% \end{minipage} |
| 2475 |
% |
| 2476 |
% \smallskip |
| 2477 |
% |
| 2478 |
% The \ics*{resetenumext} command \emph{\enquote{resets}} the \emph{start value} |
| 2479 |
% of the \emph{\enquote{counters}} for the \myenv*{enumext} and \myenv*{enumext*} |
| 2480 |
% environments along with the \emph{\enquote{internal counters}} used by |
| 2481 |
% the keys \mykey{resume} \emph{without value} and \mykey{resume*} |
| 2482 |
% according to the value of \mymarg{some counter}. For example |\resetenumext{chapter}| |
| 2483 |
% will \emph{\enquote{reset}} the numbering of \emph{\enquote{all levels}} |
| 2484 |
% of the \myenv*{enumext} environment for each execution of a \emph{\enquote{numbered}} chapter. |
| 2485 |
% \end{function} |
| 2486 |
% |
| 2487 |
% \smallskip |
| 2488 |
% |
| 2489 |
% The \emph{optional argument} of the form |[1]|, |[2]|, |[3]|, |[4]| |
| 2490 |
% \emph{\enquote{reset}} the values for levels |1|, |2|, |3| and |4| |
| 2491 |
% of the \myenv*{enumext} environment, the form |[*]| |
| 2492 |
% \emph{\enquote{reset}} the values for the \myenv*{enumext*} |
| 2493 |
% environment. If is run \emph{without} the \emph{optional argument}, it |
| 2494 |
% will \emph{\enquote{reset}} the values for \emph{\enquote{all |
| 2495 |
% levels}} of the \myenv*{enumext} environment. |
| 2496 |
% |
| 2497 |
% \smallskip |
| 2498 |
% |
| 2499 |
% The \emph{starred argument} `|*|' will \emph{\enquote{reset}} the |
| 2500 |
% values for \emph{\enquote{all levels}} of the \myenv*{enumext} and |
| 2501 |
% \myenv*{enumext*} environments. |
| 2502 |
% |
| 2503 |
% \subsection{Keys for \env{multicols}}\label{key:multi} |
| 2504 |
% |
| 2505 |
% \keyexamp{columns}{integer}{\mydim{1}} |
| 2506 |
% |
| 2507 |
% \smallskip |
| 2508 |
% |
| 2509 |
% Set the \emph{number of columns} to be used by the \myenv{multicols} |
| 2510 |
% environment within the environments \myenv*{enumext} and \myenv*{keyans}. The value must be a positive |
| 2511 |
% integer less than or equal to \mydim{10}. |
| 2512 |
% In the \myenv*{enumext*} and \myenv*{keyans*} environments they |
| 2513 |
% correspond to the default number of columns (without joining) and |
| 2514 |
% internally adjust the value of \idimen{itemwidth}. |
| 2515 |
% |
| 2516 |
% \smallskip |
| 2517 |
% |
| 2518 |
% \keyexamp{columns-sep}{rigid length}{by level} |
| 2519 |
% |
| 2520 |
% \smallskip |
| 2521 |
% |
| 2522 |
% Set the \emph{space between} columns used by the \myenv{multicols} |
| 2523 |
% environment within the environments \myenv*{enumext} and \myenv*{keyans}. Internally sets the value of |
| 2524 |
% \ics{columnsep}, by default its value is equal to the sum of the |
| 2525 |
% values set in the keys \mykey{labelwidth} and \mykey{labelsep} of the |
| 2526 |
% current level. |
| 2527 |
% In the \myenv*{enumext*} and \myenv*{keyans*} environments they |
| 2528 |
% correspond to the \emph{space between} columns (without joining) and |
| 2529 |
% internally adjust the value of \idimen{itemwidth}. |
| 2530 |
% |
| 2531 |
% \subsection{Keys for \env{minipage}}\label{key:mini} |
| 2532 |
% |
| 2533 |
% \keyexamp{mini-env}{rigid length}{not used} |
| 2534 |
% |
| 2535 |
% \smallskip |
| 2536 |
% |
| 2537 |
% Sets the \emph{width} of the \myenv{minipage} environment on |
| 2538 |
% the \emph{\enquote{right side}}. This value added to the value set by |
| 2539 |
% the \mykey{mini-sep} key to determines the \emph{width} of the |
| 2540 |
% \myenv{minipage} environment on the \emph{\enquote{left side}}, taking |
| 2541 |
% \ics{linewidth} as the maximum reference value. |
| 2542 |
% |
| 2543 |
% \smallskip |
| 2544 |
% |
| 2545 |
% \keyexamp{mini-sep}{rigid length}{\mydim{0.3333}em} |
| 2546 |
% |
| 2547 |
% \smallskip |
| 2548 |
% |
| 2549 |
% Sets the \emph{space between} the \myenv{minipage} environment on the |
| 2550 |
% \emph{\enquote{left side}} and the \myenv{minipage} environment on |
| 2551 |
% the \emph{\enquote{right side}}. This separation is applied together |
| 2552 |
% with |\hfill|. |
| 2553 |
% |
| 2554 |
% \subsubsection{The command \cs[no-index]{miniright}} |
| 2555 |
% |
| 2556 |
% \vspace*{-1.0\baselineskip} |
| 2557 |
% \begin{function}{\miniright} |
| 2558 |
% \begin{syntax} |
| 2559 |
% |\begin{enumext}[mini-env=|\mymarg{rigid length}|]| \mymeta[cf=gray]{item's before} |\item \miniright| \mymeta[cf=gray]{content} |\end{enumext}|\par |
| 2560 |
% |\begin{enumext}[mini-env=|\mymarg{rigid length}|]| \mymeta[cf=gray]{item's before} |\item \miniright*|\mymeta[cf=gray]{content} |\end{enumext}| |
| 2561 |
% \end{syntax} |
| 2562 |
% \end{function} |
| 2563 |
% |
| 2564 |
% The \ics*{miniright} command close the \myenv{minipage} environment on |
| 2565 |
% the \emph{\enquote{left side}} and opens the \myenv{minipage} environment |
| 2566 |
% on the \emph{\enquote{right side}} by starting it with the |\centering| |
| 2567 |
% command. It must be placed \emph{\enquote{after}} the last \ics*{item} |
| 2568 |
% of the current environment and \emph{\enquote{before}} starting the |
| 2569 |
% material to be placed on the \emph{\enquote{right side}}. |
| 2570 |
% |
| 2571 |
% \smallskip |
| 2572 |
% |
| 2573 |
% The \emph{starred argument} ‘|*|’ inhibits the use of |\centering| |
| 2574 |
% command i.e. the usual \hologo{LaTeX} justification is maintained in |
| 2575 |
% the \myenv{minipage} on the \emph{\enquote{right side}}. |
| 2576 |
% |
| 2577 |
% \smallskip |
| 2578 |
% |
| 2579 |
% \subsubsection{The key \texttt{mini-right}} |
| 2580 |
% |
| 2581 |
% In the \emph{horizontal list environments} \myenv*{enumext*} and \myenv*{keyans*} |
| 2582 |
% it is not possible to use the \ics*{miniright} command and the \mykey{mini-right} |
| 2583 |
% key must be used instead. |
| 2584 |
% |
| 2585 |
% \smallskip |
| 2586 |
% |
| 2587 |
% \keyexamp{mini-right}{content}{not used} |
| 2588 |
% |
| 2589 |
% \smallskip |
| 2590 |
% |
| 2591 |
% Set the \emph{content} for the drawing or tabular to be placed in the |
| 2592 |
% \myenv{minipage} environment on the \emph{\enquote{right side}} by |
| 2593 |
% starting it with |\centering|. The \mymarg{content} must be passed between braces. |
| 2594 |
% |
| 2595 |
% \smallskip |
| 2596 |
% |
| 2597 |
% \keyexamp{mini-right\textcolor{MediumOrchid}{*}}{content}{not used} |
| 2598 |
% |
| 2599 |
% \smallskip |
| 2600 |
% |
| 2601 |
% Same as above, but \emph{without} starting with |\centering|. |
| 2602 |
% |
| 2603 |
% \smallskip |
| 2604 |
% |
| 2605 |
% \section{The storage system}\label{sec:storage-system} |
| 2606 |
% |
| 2607 |
% The entire mechanism for \emph{\enquote{storing content}} it is |
| 2608 |
% activated according to \mykey{save-ans} key on the |
| 2609 |
% \emph{\enquote{first level}} of \myenv*{enumext} or \myenv*{enumext*} |
| 2610 |
% environments and it is ignored if they are established when they are |
| 2611 |
% nested inside each other. Only when this \mymeta{key} is \emph{\enquote{active}} |
| 2612 |
% the \ics*{anskey} command and the environments \myenv*{anskey*}, |
| 2613 |
% \myenv*{keyans}, \myenv*{keyans*} and \myenv*{keyanspic} are available. |
| 2614 |
% |
| 2615 |
% \iffalse |
| 2616 |
%<*example> |
| 2617 |
% \fi |
| 2618 |
\vspace*{-1\baselineskip} |
| 2619 |
\begin{minipage}[t]{0.45\linewidth} |
| 2620 |
\centering |
| 2621 |
\begin{examplecode}[frame=none,mathescape=true] |
| 2622 |
\begin{enumext}[save-ans=`\mymarg{store name}`] |
| 2623 |
\item Text \anskey{answer} |
| 2624 |
\item Text |
| 2625 |
\begin{keyans} |
| 2626 |
$\cdots$ |
| 2627 |
\end{keyans} |
| 2628 |
\end{enumext} |
| 2629 |
\end{examplecode} |
| 2630 |
\end{minipage}\hfill |
| 2631 |
\begin{minipage}[t]{0.45\linewidth} |
| 2632 |
\vspace{0pt}\centering |
| 2633 |
\begin{examplecode}[frame=none,mathescape=true] |
| 2634 |
\begin{enumext}[save-ans=`\mymarg{store name}`] |
| 2635 |
\item Text \anskey{answer} |
| 2636 |
\item Text |
| 2637 |
\begin{keyanspic} |
| 2638 |
$\cdots$ |
| 2639 |
\end{keyanspic} |
| 2640 |
\end{enumext} |
| 2641 |
\end{examplecode} |
| 2642 |
\end{minipage} |
| 2643 |
% \iffalse |
| 2644 |
%</example> |
| 2645 |
% \fi |
| 2646 |
% |
| 2647 |
% By executing the key \mykey{save-ans}|=|\mymarg{store name} the entire |
| 2648 |
% \emph{\enquote{structure}} of the environment (excluding the \emph{first level}) |
| 2649 |
% including the \emph{optional argument} passed to the inner levels or |
| 2650 |
% the environment nested in it, along with the \mymeta{content} passed |
| 2651 |
% to \ics*{anskey} or \myenv*{anskey*}, the current \mymeta{labels} for |
| 2652 |
% \ics*{item*} and \ics*{anspic}|*| in the environments \myenv*{keyans}, |
| 2653 |
% \myenv*{keyans*} and \myenv*{keyanspic} will be \emph{\enquote{stored}} |
| 2654 |
% in a \emph{sequence} \mymarg{store name} and at the same time will be |
| 2655 |
% \emph{\enquote{stored}} (without the \emph{\enquote{structure}} or |
| 2656 |
% \emph{optional argument}) in a \emph{prop list} \mymarg{store name}. |
| 2657 |
% |
| 2658 |
% \smallskip |
| 2659 |
% |
| 2660 |
% For security reasons the \emph{optional argument} of the inner levels |
| 2661 |
% or the nested environment are \emph{filtered} by excluding all \mymeta{keys} |
| 2662 |
% related to the \emph{\enquote{storage system}} (\S\ref{subsec:storage-keys}) |
| 2663 |
% along with the keys \mykey{mini-env}, \mykey{mini-sep}, \mykey{mini-right}, |
| 2664 |
% \mykey{mini-right*}, \mykey{series}, \mykey{resume} and \mykey{resume*} |
| 2665 |
% when storing in \emph{sequence} \mymarg{store name} set by \mykey{save-ans} key. |
| 2666 |
% |
| 2667 |
% \subsection{Keys for storage system}\label{subsec:storage-keys} |
| 2668 |
% |
| 2669 |
% The only \mymeta{keys} available for all levels of the \myenv*{enumext} |
| 2670 |
% environment and the \myenv*{enumext*} environment are \mykey{no-store} |
| 2671 |
% and \mykey{save-key}, the rest of the \mymeta{keys} described in this |
| 2672 |
% section must be passed directly in the \emph{optional argument} of the |
| 2673 |
% \emph{\enquote{first level}} of the environment in which the key |
| 2674 |
% \mykey{save-ans} is executed. The key \mykey{save-ans} should NOT be passed |
| 2675 |
% with the command \ics*{setenumext}. |
| 2676 |
% |
| 2677 |
% \smallskip |
| 2678 |
% |
| 2679 |
% \keyexamp{save-ans}{store name}{not set} |
| 2680 |
% Sets the \emph{name} of the \emph{sequence} and \emph{prop list} in |
| 2681 |
% which the \mymarg{contents} will be \emph{\enquote{stored}} by \ics*{anskey} |
| 2682 |
% and \myenv*{anskey*} in \myenv*{enumext} and \myenv*{enumext*} |
| 2683 |
% environments and the current \mymeta{labels} for \ics*{item*} and |
| 2684 |
% \ics*{anspic}|*| in the environments \myenv*{keyans}, \myenv*{keyans*} |
| 2685 |
% and \myenv*{keyanspic}. If the \emph{sequence} or \emph{prop list} |
| 2686 |
% \mymarg{store name} does not exist, it will be created globally and |
| 2687 |
% will not be \emph{overwritten} if the key is used again. |
| 2688 |
% |
| 2689 |
% \smallskip |
| 2690 |
% |
| 2691 |
% \keyexamp{save-key}{key list}{not set} |
| 2692 |
% This key \emph{overrides} the default \emph{\enquote{stored keys}} of |
| 2693 |
% the \emph{optional argument} of the inner levels or nested environment |
| 2694 |
% that will be passed to the \emph{sequence} \mymarg{store name} set by |
| 2695 |
% \mykey{save-ans} key. The \mymeta{key list} passed to this key ignores |
| 2696 |
% any \mymeta{keys} in the \emph{\enquote{stored structure}} and must be |
| 2697 |
% passed between braces. For example, if we execute at a second level: |
| 2698 |
% |
| 2699 |
% \newpage |
| 2700 |
% |
| 2701 |
% \iffalse |
| 2702 |
%<*example> |
| 2703 |
% \fi |
| 2704 |
\begin{examplecode}[frame=none,mathescape=true] |
| 2705 |
\begin{enumext}[save-ans=`\mymarg{store name}`] |
| 2706 |
\item Text \anskey{answer} |
| 2707 |
\item Text |
| 2708 |
\begin{enumext}[nosep, columns=2, save-key={columns=3}] |
| 2709 |
$\cdots$ |
| 2710 |
\end{enumext} |
| 2711 |
\end{enumext} |
| 2712 |
\end{examplecode} |
| 2713 |
% \iffalse |
| 2714 |
%</example> |
| 2715 |
% \fi |
| 2716 |
% |
| 2717 |
% The \emph{\enquote{stored keys}} by default in the \emph{sequence} |
| 2718 |
% \mymarg{store name} would be |nosep| and |columns=2|, but using the key |
| 2719 |
% \mykey{save-key}|={columns=3}| will overwrite and the |
| 2720 |
% \emph{\enquote{stored key}} in the \emph{sequence} \mymarg{store name} |
| 2721 |
% are only |columns=3| ignoring all the others. |
| 2722 |
% |
| 2723 |
% \smallskip |
| 2724 |
% |
| 2725 |
% \keyexamp{save-sep}{text symbol}{\{, \}} |
| 2726 |
% Sets the \emph{text symbol} that will separate the current \mymeta{label} |
| 2727 |
% to the \emph{optional argument} passed to the \ics*{item*} and \ics*{anspic}|*| |
| 2728 |
% in the environments \myenv*{keyans}, \myenv*{keyans*} and \myenv*{keyanspic} |
| 2729 |
% and storing them in the \emph{sequence} and \emph{prop list} \mymarg{store name} |
| 2730 |
% set by \mykey{save-ans} key. |
| 2731 |
% The \mymarg{text symbol} must always be passed between |
| 2732 |
% braces, whitespace ‘\verb*+ +’ is preserved within the braces and only |
| 2733 |
% affects the \emph{\enquote{stored content}} and not what is displayed |
| 2734 |
% when using the \mykey{show-ans} or \mykey{show-pos} keys. |
| 2735 |
% |
| 2736 |
% \smallskip |
| 2737 |
% |
| 2738 |
% \keyexamp*{no-store}{value forbidden}{not used} |
| 2739 |
% |
| 2740 |
% \smallskip |
| 2741 |
% |
| 2742 |
% This is a \emph{\enquote{switch-key}} that does not receive an argument |
| 2743 |
% and disables the \emph{\enquote{storing content}} in the \emph{sequence} |
| 2744 |
% and \emph{prop list} \mymarg{store name} set by \mykey{save-ans} key at |
| 2745 |
% the entire level or a nested environment in which it runs. This key |
| 2746 |
% is intended for use in internal levels or nested \myenv*{enumext} or |
| 2747 |
% \myenv*{enumext*} environments in which you want to use \myenv*{enumext} |
| 2748 |
% or \myenv*{enumext*} but \emph{\enquote{without}} using the \ics*{anskey} |
| 2749 |
% command or use \myenv*{anskey*} environment and \emph{\enquote{without}} |
| 2750 |
% interfering with the \mykey{check-ans} key. |
| 2751 |
% |
| 2752 |
% \subsubsection{Keys for \texttt{label} and \texttt{ref}}\label{subsec:label-ref} |
| 2753 |
% |
| 2754 |
% \keyexamp{save-ref}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false} |
| 2755 |
% Activates the \emph{\enquote{internal label and ref}} mechanism for |
| 2756 |
% referencing \emph{\enquote{stored content}} in \emph{prop list} |
| 2757 |
% \mymarg{store name} set by \mykey{save-ans} key. To reference the |
| 2758 |
% location of the \emph{\enquote{stored content}} within the environment |
| 2759 |
% you must use |\ref|\mymarg{store name \textnormal{\textcolor{red}{:}} position}, |
| 2760 |
% where \mymeta{position} corresponds to the position occupied by the |
| 2761 |
% \emph{\enquote{stored content}} in the \emph{prop list} \mymarg{store name} |
| 2762 |
% returned by the \mykey{show-pos} key. For example |\ref{test:4}| will |
| 2763 |
% return |3.(b)| which corresponds to the location of the \emph{\enquote{stored content}} |
| 2764 |
% at position |4| in \emph{prop list} |test| within the environment in |
| 2765 |
% which the key \mykey{save-ans}|=test| was set. |
| 2766 |
% |
| 2767 |
% \smallskip |
| 2768 |
% |
| 2769 |
% \keyexamp{mark-ref}{symbol}{\textbackslash{}textreferencemark} |
| 2770 |
% Sets the \emph{symbol} that will be displayed by the \ics*{printkeyans} |
| 2771 |
% command only if the \mypkg{hyperref} package is detected and the |
| 2772 |
% \mykey{save-ref} key are active. |
| 2773 |
% This \emph{\enquote{symbol}} is used as a \emph{\enquote{link}} between the environment |
| 2774 |
% in which the \mykey{save-ans} key was used and the place where the |
| 2775 |
% command is executed. |
| 2776 |
% |
| 2777 |
% \subsubsection{Keys for \texttt{wrap} and \texttt{marks}}\label{subsec:wrap-display} |
| 2778 |
% |
| 2779 |
% The \mypkg*{enumext} package provides a set of \mymeta{keys} to set and |
| 2780 |
% manipulate \emph{\enquote{symbol marks}} associated with |
| 2781 |
% \emph{\enquote{answers}} and how they are displayed and stored in the |
| 2782 |
% \emph{sequence} and \emph{prop list}. |
| 2783 |
% |
| 2784 |
% \smallskip |
| 2785 |
% |
| 2786 |
% The \mymeta{keys} available for the |\anskey| command and the |
| 2787 |
% \myenv*{anskey*} environment can be passed \emph{\enquote{only}} in the |
| 2788 |
% \emph{optional argument} in the \emph{\enquote{first level}} of the |
| 2789 |
% \myenv*{enumext} or \myenv*{enumext*} environment. |
| 2790 |
% |
| 2791 |
% \smallskip |
| 2792 |
% |
| 2793 |
% The \mymeta{keys} available for the \myenv*{keyans} and |
| 2794 |
% \myenv*{keyans*} environments can be passed locally in the |
| 2795 |
% \emph{optional argument}, at the \emph{\enquote{first level}} of the |
| 2796 |
% \myenv*{enumext} or \myenv*{enumext*} environment or via the |
| 2797 |
% |\setenumext| command with one minor difference, when \mymeta{keys} are passed |
| 2798 |
% through the \emph{\enquote{first level}} of the \myenv*{enumext} or |
| 2799 |
% \myenv*{enumext*} environment they are set in \emph{\enquote{both}} |
| 2800 |
% environments, but when they are passed using the |\setenumext| command |
| 2801 |
% they are set \emph{\enquote{individually}} in each environment. |
| 2802 |
% |
| 2803 |
% \smallskip |
| 2804 |
% |
| 2805 |
% \keyexamp{show-ans}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false} |
| 2806 |
% |
| 2807 |
% Display the \emph{symbol} set by the \mykey{mark-ans} key to the left of |
| 2808 |
% the \emph{mandatory argument} \mymeta{content} passed to the |\anskey| |
| 2809 |
% command and \mymeta{body} for the \myenv*{anskey*} environment using |
| 2810 |
% the \mykey{wrap-ans} key if set. |
| 2811 |
% For \ics*{item*} and \ics*{anspic}|*| the \myenv*{keyans}, |
| 2812 |
% \myenv*{keyans*} and \myenv*{keyanspic} environments it will display |
| 2813 |
% the \emph{symbol} set by the \mykey{mark-ans*} key to the left of the |
| 2814 |
% current \mymeta{label} and \emph{optional argument}. If the |
| 2815 |
% \emph{optional argument} is present in \ics*{item*} or \ics*{anspic}|*| |
| 2816 |
% it will be shown using \mykey{wrap-opt} key. |
| 2817 |
% |
| 2818 |
% \subsubsection*{Keys for \texttt{\textbackslash{}anskey} and \texttt{anskey*}} |
| 2819 |
% |
| 2820 |
% \keyexamp{mark-ans}{symbol}{\textbackslash{}textasteriskcentered} |
| 2821 |
% Sets the \emph{symbol} to be displayed in the left margin for |
| 2822 |
% \ics*{anskey} command and \myenv*{anskey*} environment when using the |
| 2823 |
% key \mykey{show-ans}. The \emph{\enquote{symbol}} is placed in a box |
| 2824 |
% of width equal to the value of \mykey{labelwidth} at the current level, |
| 2825 |
% separated by the value of the key \mykey{mark-sep} and aligned by |
| 2826 |
% the value of the key \mykey{mark-pos}. This key is not affected by the |
| 2827 |
% keys \mykey{font} or \mykey{wrap-label} so if you want to apply |
| 2828 |
% \emph{styling} you have to do it directly, for example: |mark-ans={\textcolor{red}{\textbf{\textasteriskcentered}}|. |
| 2829 |
% |
| 2830 |
% \smallskip |
| 2831 |
% |
| 2832 |
% \keyexamp{mark-pos}{left \textnormal{\textcolor{lightgray}{\textbar}} right \textnormal{\textcolor{lightgray}{\textbar}} center}{left} |
| 2833 |
% Sets the \emph{aligned} of the \emph{\enquote{symbol}} defined by |
| 2834 |
% \mykey{mark-ans} key for \ics*{anskey} command and \myenv*{anskey*} |
| 2835 |
% environment. The \emph{\enquote{symbol}} is aligned in a box with the |
| 2836 |
% same dimensions of the label box defined by \mykey{labelwidth} key |
| 2837 |
% on the current level and separated by the value of the \mykey{mark-sep} |
| 2838 |
% key. |
| 2839 |
% |
| 2840 |
% \smallskip |
| 2841 |
% |
| 2842 |
% \keyexamp{mark-sep}{rigid length}{labelsep} |
| 2843 |
% Sets the \emph{horizontal space} between the box containing the |
| 2844 |
% \emph{\enquote{symbol}} defined by \mykey{mark-ans} key and the |
| 2845 |
% \emph{mandatory argument} \mymeta{content} passed to the \ics*{anskey} |
| 2846 |
% command and the \mymeta{body} in \myenv*{anskey*} environment. |
| 2847 |
% |
| 2848 |
% \smallskip |
| 2849 |
% |
| 2850 |
% \keyexamp{wrap-ans}{code{} \space\usebox{\hashbox} more code}{\textbackslash{}fbox+\textbackslash{}parbox\{\#1\}} |
| 2851 |
% Wraps the \emph{mandatory argument} \mymeta{content} passed to the \ics*{anskey} |
| 2852 |
% and the \mymeta{body} in \myenv*{anskey*} environment referenced by |{#1}| |
| 2853 |
% when using the \mykey{show-ans} or \mykey{show-pos} keys. |
| 2854 |
% The \mymarg{code} must be passed between braces and only affects how the |
| 2855 |
% \mymeta{content} or \mymeta{body} is displayed and NOT the \emph{\enquote{stored |
| 2856 |
% content}} in the \emph{sequence} and \emph{prop list} \mymarg{store |
| 2857 |
% name} set by \mykey{save-ans} key. If this key is passed using |
| 2858 |
% \ics*{setenumext} it is necessary to use double ‘|{##1}|’. |
| 2859 |
% |
| 2860 |
% \subsubsection*{Keys for \texttt{keyans}, \texttt{keyans*} and \texttt{keyanspic}} |
| 2861 |
% |
| 2862 |
% \keyexamp{mark-ans\textcolor{MediumOrchid}{*}}{symbol}{\textbackslash{}textasteriskcentered} |
| 2863 |
% Sets the \emph{symbol} to be displayed in the left margin for |
| 2864 |
% \ics*{item*} and \ics*{anspic}|*| for the \myenv*{keyans}, \myenv*{keyans*} |
| 2865 |
% and \myenv*{keyanspic} environments when using the key \mykey{show-ans}. |
| 2866 |
% The \emph{\enquote{symbol}} is placed in a box of width equal to the value of |
| 2867 |
% \mykey{labelwidth} of the environment in which it is executed, separated by the value of the |
| 2868 |
% key \mykey{mark-sep*} and aligned by the value of the key |
| 2869 |
% \mykey{mark-pos*}. This key is not affected by the keys \mykey{font} or |
| 2870 |
% \mykey{wrap-label} so if you want to apply \emph{styling} you have to do it |
| 2871 |
% directly, for example: |mark-ans*={\textcolor{red}{\textbf{\textasteriskcentered}}|. |
| 2872 |
% |
| 2873 |
% \smallskip |
| 2874 |
% |
| 2875 |
% \keyexamp{mark-pos\textcolor{MediumOrchid}{*}}{left \textnormal{\textcolor{lightgray}{\textbar}} right \textnormal{\textcolor{lightgray}{\textbar}} center}{left} |
| 2876 |
% Sets the \emph{aligned} of the \emph{\enquote{symbol}} defined by |
| 2877 |
% \mykey{mark-ans*} key for the \myenv*{keyans}, \myenv*{keyans*} |
| 2878 |
% and \myenv*{keyanspic} environments. The \emph{\enquote{symbol}} is |
| 2879 |
% aligned in a box with the same dimensions of the label box defined by |
| 2880 |
% \mykey{labelwidth} key of the environment in which it is executed and |
| 2881 |
% separated by the value of the \mykey{mark-sep*} key. |
| 2882 |
% |
| 2883 |
% \smallskip |
| 2884 |
% |
| 2885 |
% \keyexamp{mark-sep\textcolor{MediumOrchid}{*}}{rigid length}{labelsep} |
| 2886 |
% Sets the \emph{horizontal space} between the box containing the |
| 2887 |
% \emph{\enquote{symbol}} defined by \mykey{mark-ans*} key and the current \mymeta{label} for |
| 2888 |
% \ics*{item*} and \ics*{anspic}|*| in the \myenv*{keyans}, \myenv*{keyans*} |
| 2889 |
% and \myenv*{keyanspic} environments. |
| 2890 |
% |
| 2891 |
% \smallskip |
| 2892 |
% |
| 2893 |
% \keyexamp{wrap-ans\textcolor{MediumOrchid}{*}}{code{} \space\usebox{\hashbox} more code}{not used} |
| 2894 |
% Wraps the \emph{current} \mymeta{label} when using the \mykey{show-ans} |
| 2895 |
% key for \ics*{item*} and \ics*{anspic}|*| referenced by |{#1}| in the |
| 2896 |
% \myenv*{keyans}, \myenv*{keyans*} and \myenv*{keyanspic} environments |
| 2897 |
% after executing the \mykey{align} and \mykey{font} keys. |
| 2898 |
% The \mymarg{code} must be passed between braces and \emph{only} affects |
| 2899 |
% how the \mymeta{label} is displayed and NOT the \emph{\enquote{stored label}} |
| 2900 |
% in the \emph{sequence} and \emph{prop list} \mymarg{store name} set by |
| 2901 |
% \mykey{save-ans} key. This key overwrites the key \mykey{wrap-label} |
| 2902 |
% and if is passed using \ics*{setenumext} it is necessary to use double ‘|{##1}|’. |
| 2903 |
% For example, if you want the \mymeta{label} to be displayed in red when |
| 2904 |
% using \mykey{show-ans} you just set |wrap-ans*={\textcolor{red}{#1}}|. |
| 2905 |
% |
| 2906 |
% \smallskip |
| 2907 |
% |
| 2908 |
% \keyexamp{wrap-opt}{code{} \space\usebox{\hashbox} more code}{[\{\#1\}]} |
| 2909 |
% Wraps the \emph{optional argument} passed to the |
| 2910 |
% \ics*{item*} and \ics*{anspic}|*| referenced by |{#1}| |
| 2911 |
% in the \myenv*{keyans}, \myenv*{keyans*} and \myenv*{keyanspic} |
| 2912 |
% environments when using the \mykey{show-ans} or \mykey{show-pos} keys. |
| 2913 |
% The \mymarg{code} must be passed between braces |
| 2914 |
% and only affects the current \emph{optional argument} and NOT the |
| 2915 |
% \emph{\enquote{stored content}} in the \emph{sequence} and \emph{prop list} |
| 2916 |
% \mymarg{store name} set by \mykey{save-ans} key. |
| 2917 |
% If this key is passed using \ics*{setenumext} it is necessary to use double ‘|{##1}|’. |
| 2918 |
% |
| 2919 |
% \subsubsection{Keys for debug and checking} |
| 2920 |
% |
| 2921 |
% \keyexamp{show-pos}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false} |
| 2922 |
% |
| 2923 |
% \smallskip |
| 2924 |
% |
| 2925 |
% Displays the \emph{position} occupied by the \emph{\enquote{stored content}} by |
| 2926 |
% \ics*{anskey}, \myenv*{anskey*}, \ics*{item*} and \ics*{anspic}|*| in the |
| 2927 |
% \emph{prop list} \mymarg{store name} set by \mykey{save-ans} key. |
| 2928 |
% This position is used by the \ics*{getkeyans} command and by the |\ref| |
| 2929 |
% command if the \mykey{save-ref} key is active. |
| 2930 |
% |
| 2931 |
% \smallskip |
| 2932 |
% |
| 2933 |
% \keyexamp{check-ans}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false} |
| 2934 |
% |
| 2935 |
% \smallskip |
| 2936 |
% |
| 2937 |
% Enables the \emph{checking answer} mechanism displaying an |
| 2938 |
% appropriate message on the terminal. This key works under the logic |
| 2939 |
% that each \ics*{item} or \ics*{item*} that does not open an |
| 2940 |
% inner level or nested environment contains \emph{\enquote{only one |
| 2941 |
% answer}} or \emph{\enquote{only one execution}} of the \ics*{anskey} |
| 2942 |
% or \myenv*{anskey*}. It is intended to be used in conjunction with the |
| 2943 |
% \mykey{no-store} key. |
| 2944 |
% |
| 2945 |
% \subsection{The command \cs[no-index]{anskey}} |
| 2946 |
% \label{sec:anskey} |
| 2947 |
% |
| 2948 |
% \vspace*{-\baselineskip} |
| 2949 |
% |
| 2950 |
% \begin{function}{\anskey} |
| 2951 |
% \begin{syntax} |
| 2952 |
% \cmdexamp{anskey}[keys]{content} |
| 2953 |
% \end{syntax} |
| 2954 |
% The command \ics*{anskey} takes a mandatory non empty argument \mymarg{content} |
| 2955 |
% and \emph{\enquote{stores}} it in the \emph{sequence} and \emph{prop |
| 2956 |
% list} \mymarg{store name} set by \mykey{save-ans} key. |
| 2957 |
% By design the command cannot be nested or passed \emph{verbatim material} in the |
| 2958 |
% argument and it is assumed that each \emph{numbered} |\item| or |\item*| within the |
| 2959 |
% environment in which it is active it has a \emph{\enquote{single |
| 2960 |
% execution}} of |\anskey| unless |\item| or |\item*| open a nested level |
| 2961 |
% or use the \mykey{no-store} key. |
| 2962 |
% |
| 2963 |
% \smallskip |
| 2964 |
% |
| 2965 |
% If \mykey{save-ref} key are active and the |
| 2966 |
% \mypkg{hyperref}\cite{hyperref} package is detected, |\hyperlink| and |
| 2967 |
% |\hypertarget| will be used, otherwise the usual \emph{\enquote{label |
| 2968 |
% and ref}} system provided by \hologo{LaTeX} will be used. |
| 2969 |
% \end{function} |
| 2970 |
% |
| 2971 |
% \smallskip |
| 2972 |
% |
| 2973 |
% The \ics*{anskey} command is available for all levels of the |
| 2974 |
% \myenv*{enumext} environment and the \myenv*{enumext*} environment, but |
| 2975 |
% is disabled for the \myenv*{keyans}, \myenv*{keyans*} and |
| 2976 |
% \myenv*{keyanspic} environments. |
| 2977 |
% |
| 2978 |
% \subsubsection{Keys for \cs[no-index]{anskey}} |
| 2979 |
% |
| 2980 |
% By default the \emph{mandatory argument} \mymeta{content} passed to |\anskey| |
| 2981 |
% when \emph{\enquote{storing}} in the \emph{sequence} \mymarg{store name} |
| 2982 |
% has the form |\item| \mymeta{content}, the following \mymeta{keys} allow |
| 2983 |
% modifying the way in which it is \emph{\enquote{stored}} in the \emph{sequence}. |
| 2984 |
% |
| 2985 |
% \smallskip |
| 2986 |
% |
| 2987 |
% \keyexampcmd*{break-col}{value forbidden}{not used} |
| 2988 |
% |
| 2989 |
% \smallskip |
| 2990 |
% |
| 2991 |
% Stores \mymarg{content} in the \emph{sequence} \mymarg{store name} of |
| 2992 |
% the form \ics{columnbreak} |\item| \mymeta{content}. |
| 2993 |
% |
| 2994 |
% \smallskip |
| 2995 |
% |
| 2996 |
% \keyexampcmd{item-join}{columns}{not set} |
| 2997 |
% |
| 2998 |
% \smallskip |
| 2999 |
% |
| 3000 |
% Set the \emph{number of columns} to be used for |\item|\myparg{columns} and stores \mymarg{content} in the \emph{sequence} |
| 3001 |
% \mymarg{store name} of the form |\item|\myparg{columns} \mymeta{content}. |
| 3002 |
% |
| 3003 |
% \smallskip |
| 3004 |
% |
| 3005 |
% \keyexampcmd*{item-star}{value forbidden}{not used} |
| 3006 |
% |
| 3007 |
% \smallskip |
| 3008 |
% |
| 3009 |
% Stores \mymarg{content} in the \emph{sequence} \mymarg{store name} of |
| 3010 |
% the form |\item*| \mymeta{content}. |
| 3011 |
% |
| 3012 |
% \keyexampcmd{item-sym\textcolor{MediumOrchid}{*}}{symbol}{not set} |
| 3013 |
% |
| 3014 |
% \smallskip |
| 3015 |
% |
| 3016 |
% Sets the \emph{symbol} for |\item*| when using the key |
| 3017 |
% \mykeycmd{item-star} and stores \mymarg{content} in the \emph{sequence} |
| 3018 |
% \mymarg{store name} of the form |\item*|\myoarg{symbol} \mymeta{content}. |
| 3019 |
% The \emph{symbol} can be in text or math mode, for example |
| 3020 |
% \mykeycmd{item-sym*}|={$\ast$}| stores |\item*||[$\ast$]| \mymeta{content}. |
| 3021 |
% |
| 3022 |
% \smallskip |
| 3023 |
% |
| 3024 |
% \keyexampcmd{item-pos\textcolor{MediumOrchid}{*}}{rigid length}{not set} |
| 3025 |
% Sets the \emph{offset} for |\item*| when using the keys |
| 3026 |
% \mykeycmd{item-star} and \mykeycmd{item-sym*} and stores \mymarg{content} in the \emph{sequence} |
| 3027 |
% \mymarg{store name} of the form |\item*|\myoarg{symbol}\myoarg{offset} \mymeta{content}. |
| 3028 |
% |
| 3029 |
% \subsubsection*{Example} |
| 3030 |
% |
| 3031 |
% \iffalse |
| 3032 |
%<*example> |
| 3033 |
% \fi |
| 3034 |
\begin{examplecode}[frame=single] |
| 3035 |
\begin{enumext}[save-ans=test,show-ans=true] |
| 3036 |
\item* Text containing our instructions or questions. `\ics*{anskey}\mymarg{first answer}` |
| 3037 |
\item Text containing our instructions or questions. |
| 3038 |
\begin{enumext} |
| 3039 |
\item Question.`\ics*{anskey}\mymarg{second answer}` |
| 3040 |
\end{enumext} |
| 3041 |
\item Text containing our instructions or questions. `\ics*{anskey}\mymarg{third answer}` |
| 3042 |
\item Text containing our instructions or questions. `\ics*{anskey}\mymarg{fourth answer}` |
| 3043 |
\end{enumext} |
| 3044 |
\end{examplecode} |
| 3045 |
% \iffalse |
| 3046 |
%</example> |
| 3047 |
% \fi |
| 3048 |
% |
| 3049 |
% \begin{enumext}[save-ans=test,mark-ans={\oldtextasteriskcentered},show-ans=true,columns=2,nosep] |
| 3050 |
% \item* Text containing our instructions or questions.\anskey{first answer} |
| 3051 |
% \item Text containing our instructions or questions. |
| 3052 |
% \begin{enumext} |
| 3053 |
% \item Question.\anskey{second answer} |
| 3054 |
% \end{enumext} |
| 3055 |
% \item Text containing our instructions or questions. \anskey{third answer} |
| 3056 |
% \item Text containing our instructions or questions. \anskey{fourth answer} |
| 3057 |
% \end{enumext} |
| 3058 |
% |
| 3059 |
% \subsection{The environment \env{anskey*}} |
| 3060 |
% |
| 3061 |
% \vspace*{-\baselineskip} |
| 3062 |
% |
| 3063 |
% \begin{function}{anskey*} |
| 3064 |
% \begin{syntax} |
| 3065 |
% |\begin{anskey*}|\myoarg{key \textnormal{\textcolor{gray}{=}} val} \mymeta{body content} |\end{anskey*}| |
| 3066 |
% \end{syntax} |
| 3067 |
% The environment \myenv*{anskey*} takes a mandatory \mymarg{body content} |
| 3068 |
% and \emph{\enquote{stores it}} in the \emph{sequence} and \emph{prop |
| 3069 |
% list} \mymarg{store name} set by \mykey{save-ans} key. If \mykey{save-ref} |
| 3070 |
% key are active and the \mypkg{hyperref}\cite{hyperref} package is |
| 3071 |
% detected |\hyperlink| and |\hypertarget| will be used, otherwise the |
| 3072 |
% usual \emph{\enquote{label and ref}} system provided by \hologo{LaTeX} will be used. |
| 3073 |
% \end{function} |
| 3074 |
% |
| 3075 |
% \smallskip |
| 3076 |
% |
| 3077 |
% By design the environment cannot be nested but full supports |
| 3078 |
% \emph{\enquote{verbatim material}} in the \mymeta{body} and it is assumed |
| 3079 |
% that \emph{\enquote{each numbered}} |\item| or |\item*| within the |
| 3080 |
% environment in which it is active it has a \emph{\enquote{single |
| 3081 |
% execution}} unless |\item| or |\item*| open a nested level |
| 3082 |
% or use the \mykey{no-store} key. |
| 3083 |
% |
| 3084 |
% \smallskip |
| 3085 |
% |
| 3086 |
% The \myenv*{anskey*} environment is implemented using the new |
| 3087 |
% \emph{\enquote{collect code}} \texttt{c-type} argument |
| 3088 |
% part of \hologo{LaTeX} release 2025-06-01\cite{ltnews}. |
| 3089 |
% |\begin{anskey*}| and |\end{anskey*}| must be in different lines and |
| 3090 |
% should not appear within verbatim environments or commands. All \mymeta{keys} |
| 3091 |
% must be passed separated by commas and \enquote{without separation} |
| 3092 |
% of the start of the environment. |
| 3093 |
% |
| 3094 |
% \smallskip |
| 3095 |
% |
| 3096 |
% Comments `\textcolor{gray}{\texttt{\%}}' or \emph{any character} |
| 3097 |
% after |\begin{anskey*}| or \myoarg{key \textnormal{\textcolor{gray}{=}} val} |
| 3098 |
% on the same line are NOT supported, \hologo{LaTeX} will return an |
| 3099 |
% \enquote{error} message if this happens. In a similar way comments |
| 3100 |
% `\textcolor{gray}{\texttt{\%}}' or \emph{any character} after |
| 3101 |
% |\end{anskey*}| on the same line \hologo{LaTeX} will |
| 3102 |
% return a \enquote{warning} message. |
| 3103 |
% |
| 3104 |
% \subsubsection{Keys for \texttt{anskey*}} |
| 3105 |
% |
| 3106 |
% The \myenv*{anskey*} environment uses the same \mymeta{keys} as the |
| 3107 |
% \ics*{anskey} command next to the \mymeta{keys} |write-env|, |overwrite| |
| 3108 |
% and |force-eol|. The environment is available for all levels of the |
| 3109 |
% \myenv*{enumext} environment and the \myenv*{enumext*} environment, but |
| 3110 |
% it is disabled for the \myenv*{keyans}, \myenv*{keyans*} and |
| 3111 |
% \myenv*{keyanspic} environments. |
| 3112 |
% |
| 3113 |
% \smallskip |
| 3114 |
% |
| 3115 |
% \keyexampenv{write-env}{file.ext}{not used} |
| 3116 |
% |
| 3117 |
% \smallskip |
| 3118 |
% |
| 3119 |
% Sets the \emph{name} of the \mymeta{external file} in which the \mymeta{contents} of |
| 3120 |
% the environment will be written. The \mymeta{file.ext} will be created |
| 3121 |
% in the working directory, relative or absolute paths are not supported. If \mymeta{file.ext} |
| 3122 |
% does not exist, it will be created or overwritten if the \mykey{overwrite} key is used. |
| 3123 |
% |
| 3124 |
% \newpage |
| 3125 |
% |
| 3126 |
% \keyexampenv{overwrite}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false} |
| 3127 |
% Sets whether the \mymeta{file.ext} generated by \mykey{write-env} |
| 3128 |
% from the \myenv*{anskey*} environment will be rewritten. |
| 3129 |
% |
| 3130 |
% \smallskip |
| 3131 |
% |
| 3132 |
% \keyexampenv{force-eol}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false} |
| 3133 |
% |
| 3134 |
% \smallskip |
| 3135 |
% |
| 3136 |
% Sets if the \emph{last end of line} for the \mymeta{stored content} is hidden or not. |
| 3137 |
% This key is necessary only if the last line is the closing of some |
| 3138 |
% environment defined by the \mypkg{fancyvrb} package as |\end{|\myenv{Verbatim}|}| |
| 3139 |
% or another environment that does not support a comments `\textcolor{gray}{\texttt{\%}}' |
| 3140 |
% after closing |\end{|\myenv{Verbatim}|}%|. |
| 3141 |
% |
| 3142 |
% \subsubsection*{Example} |
| 3143 |
% |
| 3144 |
% \iffalse |
| 3145 |
%<*example> |
| 3146 |
% \fi |
| 3147 |
\begin{examplecode}[frame=single] |
| 3148 |
\begin{enumext}[save-ans=test,show-pos=true,start=5] |
| 3149 |
\item* Text containing our instructions or questions. |
| 3150 |
\begin{anskey*}[item-star] |
| 3151 |
`\mymeta{first answer}` |
| 3152 |
\end{anskey*} |
| 3153 |
|
| 3154 |
\item Text containing our instructions or questions. |
| 3155 |
\begin{enumext} |
| 3156 |
\item Question. |
| 3157 |
\begin{anskey*} |
| 3158 |
`\mymeta{second answer}` |
| 3159 |
\end{anskey*} |
| 3160 |
\end{enumext} |
| 3161 |
|
| 3162 |
\item Text containing our instructions or questions. |
| 3163 |
\begin{anskey*} |
| 3164 |
`\mymeta{third answer}` |
| 3165 |
\end{anskey*} |
| 3166 |
|
| 3167 |
\item Text containing our instructions or questions. |
| 3168 |
\begin{anskey*} |
| 3169 |
`\mymeta{fourth answer}` |
| 3170 |
\end{anskey*} |
| 3171 |
\end{enumext} |
| 3172 |
\end{examplecode} |
| 3173 |
% \iffalse |
| 3174 |
%</example> |
| 3175 |
% \fi |
| 3176 |
% |
| 3177 |
% \begin{enumext}[save-ans=test,show-pos=true,columns=2,nosep,start=5] |
| 3178 |
% \item* Text containing our instructions or questions. |
| 3179 |
% \begin{anskey*} |
| 3180 |
% First answer with \verb+verbatim+ |
| 3181 |
% \end{anskey*} |
| 3182 |
% \item Text containing our instructions or questions. |
| 3183 |
% \begin{enumext} |
| 3184 |
% \item Question.\anskey{second answer} |
| 3185 |
% \end{enumext} |
| 3186 |
% \item Text containing our instructions or questions. \anskey{third answer} |
| 3187 |
% \item Text containing our instructions or questions. \anskey{fourth answer} |
| 3188 |
% \end{enumext} |
| 3189 |
% |
| 3190 |
% \subsection[The environment \texttt{keyans}]{The environments \env{keyans} and \env{keyans*}} |
| 3191 |
% |
| 3192 |
% \vspace*{-\baselineskip} |
| 3193 |
% |
| 3194 |
% \begin{function}{keyans,keyans*} |
| 3195 |
% \begin{syntax} |
| 3196 |
% |\begin{keyans}|\myoarg{key \textnormal{\textcolor{gray}{=}} val} \ics*{item} \ics*{item}\myoarg{custom} \ics*{item*} \ics*{item*}\myoarg{content} |\end{keyans}|\par |
| 3197 |
% |\begin{keyans*}|\myoarg{key \textnormal{\textcolor{gray}{=}} val} \ics*{item} \ics*{item}\myoarg{custom} \ics*{item*} \ics*{item*}\myoarg{content} |\end{keyans*}| |
| 3198 |
% \end{syntax} |
| 3199 |
% The \myenv*{keyans} and \myenv*{keyans*} environments are |
| 3200 |
% \emph{\enquote{enumerated list}} environments designed for |
| 3201 |
% \emph{\enquote{multiple choice}} questions activated by the \mykey{save-ans} key. |
| 3202 |
% |
| 3203 |
% \smallskip |
| 3204 |
% |
| 3205 |
% This environments can NOT be nested and must always be at the |
| 3206 |
% \emph{\enquote{first level}} of the \myenv*{enumext} environment, the |
| 3207 |
% commands \ics*{item} and \ics*{item}\myoarg{custom} work in the usual |
| 3208 |
% and the command |\item|\myparg{columns} is available for the \myenv*{keyans*} environment. |
| 3209 |
% |
| 3210 |
% \smallskip |
| 3211 |
% |
| 3212 |
% \begin{important}* |
| 3213 |
% The behavior of |\item*| in \myenv*{keyans} and \myenv*{keyans*} environments |
| 3214 |
% is NOT the same as in the \myenv*{enumext} or \myenv*{enumext*} environments. |
| 3215 |
% \end{important} |
| 3216 |
% \end{function} |
| 3217 |
% |
| 3218 |
% \iffalse |
| 3219 |
%<*example> |
| 3220 |
% \fi |
| 3221 |
\vspace*{-1\baselineskip} |
| 3222 |
\begin{minipage}[t]{0.45\linewidth} |
| 3223 |
\begin{examplecode}[frame=none] |
| 3224 |
\begin{enumext}[save-ans=test] |
| 3225 |
\item `\mymeta[type=tt,ac=lightgray,cf=gray]{item content}` |
| 3226 |
\begin{keyans}`\myoarg{key \textnormal{\textcolor{gray}{=}} val}` |
| 3227 |
\item `\mymeta[type=tt,ac=lightgray,cf=gray]{item content}` |
| 3228 |
\item `\myoarg{custom} \mymeta[type=tt,ac=lightgray,cf=gray]{item content}` |
| 3229 |
\item* `\mymeta[type=tt,ac=lightgray,cf=gray]{item content}` |
| 3230 |
`\ics*{item*}\myoarg{content} \mymeta[type=tt,ac=lightgray,cf=gray]{item content}` |
| 3231 |
\end{keyans} |
| 3232 |
\end{enumext} |
| 3233 |
\end{examplecode} |
| 3234 |
\end{minipage} |
| 3235 |
\hfill |
| 3236 |
\begin{minipage}[t]{0.45\linewidth} |
| 3237 |
\begin{examplecode}[frame=none] |
| 3238 |
\begin{enumext}[save-ans=test] |
| 3239 |
\item `\mymeta[type=tt,ac=lightgray,cf=gray]{item content}` |
| 3240 |
\begin{keyans*}`\myoarg{key \textnormal{\textcolor{gray}{=}} val}` |
| 3241 |
\item `\mymeta[type=tt,ac=lightgray,cf=gray]{item content}` |
| 3242 |
\item `\myoarg{custom} \mymeta[type=tt,ac=lightgray,cf=gray]{item content}` |
| 3243 |
\item* `\mymeta[type=tt,ac=lightgray,cf=gray]{item content}` |
| 3244 |
`\ics*{item*}\myoarg{content} \mymeta[type=tt,ac=lightgray,cf=gray]{item content}` |
| 3245 |
\end{keyans*} |
| 3246 |
\end{enumext} |
| 3247 |
\end{examplecode} |
| 3248 |
\end{minipage} |
| 3249 |
% \iffalse |
| 3250 |
%</example> |
| 3251 |
% \fi |
| 3252 |
% |
| 3253 |
% The \mymeta{keys} set in the \emph{optional argument} of the environment are the same |
| 3254 |
% (almost) as those of the \myenv*{enumext} and \myenv*{enumext*} |
| 3255 |
% environments and have \emph{higher precedence} than those set by |
| 3256 |
% \ics*{setenumext}\myoarg{keyans}\mymarg{key \textnormal{\textcolor{gray}{=}} val} or |
| 3257 |
% \ics*{setenumext}\myoarg{keyans\textnormal{\textcolor{MediumOrchid}{\texttt{*}}}}\mymarg{key \textnormal{\textcolor{gray}{=}} val}. |
| 3258 |
% If the \emph{optional argument} is not passed or the \mymeta{keys} |
| 3259 |
% are not set by \ics*{setenumext}, the default values will be the same |
| 3260 |
% as the \emph{\enquote{second level}} of the \myenv*{enumext} environment |
| 3261 |
% with the difference in the \mymeta{label} which will be set to \mykey{label}=\ilabel{Alph*)}. |
| 3262 |
% |
| 3263 |
% \smallskip |
| 3264 |
% |
| 3265 |
% The keys \mykey{mark-ans*}, \mykey{mark-pos*}, \mykey{mark-sep*}, \mykey{save-sep}, |
| 3266 |
% \mykey{wrap-opt}, \mykey{wrap-ans*}, \mykey{show-ans} and \mykey{show-pos} |
| 3267 |
% are available for both environments. |
| 3268 |
% |
| 3269 |
% \subsubsection[The \texttt{\textbackslash item*} in \texttt{keyans}]{The \cs[no-index]{item*} in \texttt{keyans} and \texttt{keyans*}} |
| 3270 |
% |
| 3271 |
% \vspace*{-\baselineskip} |
| 3272 |
% |
| 3273 |
% \begin{function}{\item*} |
| 3274 |
% \begin{syntax} |
| 3275 |
% \ics*{item*} |
| 3276 |
% \ics*{item*}\myoarg{content} |
| 3277 |
% \end{syntax} |
| 3278 |
% The \ics*{item*} and \ics*{item*}\myoarg{content} command \emph{\enquote{store}} |
| 3279 |
% the current \mymeta{label} set by \mykey{label} key next to the \emph{optional argument} \mymeta{content} |
| 3280 |
% in \emph{sequence} and \emph{prop list} \mymarg{store name} set by |
| 3281 |
% \mykey{save-ans} key in the \emph{\enquote{first level}} of the |
| 3282 |
% \myenv*{enumext} or \myenv*{enumext*} environments. |
| 3283 |
% \end{function} |
| 3284 |
% |
| 3285 |
% The \emph{starred argument} ‘|*|’ cannot be separated by spaces ‘\verb*| |’ |
| 3286 |
% from the command, i.e. \ics*{item*} and the \emph{optional argument} |
| 3287 |
% does \enquote{NOT} support \emph{verbatim content}. By design it is |
| 3288 |
% assumed that the |\item*| will only appear \emph{\enquote{once}} |
| 3289 |
% within the environment. |
| 3290 |
% |
| 3291 |
% \subsubsection*{Example} |
| 3292 |
% |
| 3293 |
% \iffalse |
| 3294 |
%<*example> |
| 3295 |
% \fi |
| 3296 |
\begin{examplecode}[frame=single] |
| 3297 |
\begin{enumext}[save-ans=test,columns=2,show-ans=true] |
| 3298 |
\item Text containing a question. |
| 3299 |
|
| 3300 |
\begin{keyans*}[nosep,columns=2] |
| 3301 |
\item Choice |
| 3302 |
\item* Correct choice |
| 3303 |
\item Choice |
| 3304 |
\item Choice |
| 3305 |
\item Choice |
| 3306 |
\end{keyans*} |
| 3307 |
|
| 3308 |
\item Text containing a question and image. |
| 3309 |
|
| 3310 |
\begin{keyans}[nosep,mini-env={0.4\linewidth}] |
| 3311 |
\item Choice |
| 3312 |
\item Choice |
| 3313 |
\item Choice |
| 3314 |
\item Choice |
| 3315 |
`\ics*{item*}\myoarg{note}` Correct choice |
| 3316 |
\miniright |
| 3317 |
\includegraphics[scale=0.25]{example-image-a} |
| 3318 |
Some text |
| 3319 |
\end{keyans} |
| 3320 |
\end{enumext} |
| 3321 |
\end{examplecode} |
| 3322 |
% \iffalse |
| 3323 |
%</example> |
| 3324 |
% \fi |
| 3325 |
% |
| 3326 |
% \begin{enumext}[save-ans=test,mark-ans*={\oldtextasteriskcentered},show-ans=true,columns=2,nosep] |
| 3327 |
% \item Text containing a question. |
| 3328 |
% |
| 3329 |
% \begin{keyans*}[nosep,columns=2] |
| 3330 |
% \item Choice |
| 3331 |
% \item* Correct choice |
| 3332 |
% \item Choice |
| 3333 |
% \item Choice |
| 3334 |
% \item Choice |
| 3335 |
% \end{keyans*} |
| 3336 |
% |
| 3337 |
% \item Text containing a question and image. |
| 3338 |
% |
| 3339 |
% \begin{keyans}[nosep,mini-env={0.4\linewidth}] |
| 3340 |
% \item Choice |
| 3341 |
% \item Choice |
| 3342 |
% \item Choice |
| 3343 |
% \item Choice |
| 3344 |
% \item*[note] Correct choice |
| 3345 |
% \miniright |
| 3346 |
% \includegraphics[scale=0.15]{example-image-a} |
| 3347 |
% |
| 3348 |
% Some text |
| 3349 |
% \end{keyans} |
| 3350 |
% \end{enumext} |
| 3351 |
% |
| 3352 |
% \subsection{The environment \texttt{keyanspic}} |
| 3353 |
% |
| 3354 |
% \vspace*{-\baselineskip} |
| 3355 |
% |
| 3356 |
% \begin{function}{keyanspic} |
| 3357 |
% \begin{syntax} |
| 3358 |
% |\begin{keyanspic}|\myoarg{key \textnormal{\textcolor{gray}{=}} val} \ics*{anspic}|*|\myoarg{content}\mymarg{drawing or tabular} |\end{keyanspic}| |
| 3359 |
% \end{syntax} |
| 3360 |
% The \myenv*{keyanspic} environment is an \emph{\enquote{enumerated |
| 3361 |
% list}} environment activated by the \mykey{save-ans} key that has the |
| 3362 |
% same configuration for \emph{\enquote{spacing}} and \mymeta{label} |
| 3363 |
% as the \myenv*{keyans} environment that uses the |\anspic| command |
| 3364 |
% instead of |\item|. It is intended for placing \emph{drawings or tabular} |
| 3365 |
% with \mymeta{label} centered \emph{above} or \emph{below} in a \emph{single line} |
| 3366 |
% or \emph{upper and lower} layout style. |
| 3367 |
% |
| 3368 |
% \smallskip |
| 3369 |
% |
| 3370 |
% When the \myenv*{keyanspic} environment is used \emph{without keys} |
| 3371 |
% the \mymeta{labels} are centered \emph{below} the \emph{drawings |
| 3372 |
% or tabular} in a \emph{single line} layout style. |
| 3373 |
% \end{function} |
| 3374 |
% |
| 3375 |
% A representation of the output can be seen in the figure \ref{fig:keyanspicdoc}. |
| 3376 |
% |
| 3377 |
% \begin{figure}[ht] |
| 3378 |
% \centering |
| 3379 |
% \begin{tikzpicture}[line cap=round,line join=round,x=0.8cm,y=0.8cm,every node/.style={font=\footnotesize}] |
| 3380 |
% % space above |
| 3381 |
% \draw[color=white] (7.0,6.10) rectangle (17.5,6.5) node[pos=.5,text=black]% |
| 3382 |
% { \textcolor{lightgray}{\texttt{number of drawings or tabular upper}} }; |
| 3383 |
% \draw[color=white] (7.0,4.5) rectangle (17.5,4.9) node[pos=.5,text=black]% |
| 3384 |
% { \textcolor{optcolor}{\texttt{layout-sep}} }; %%%[+itemsep] |
| 3385 |
% \draw[color=white] (7.0,2.9) rectangle (17.5,3.3) node[pos=.5,text=black]% |
| 3386 |
% { \textcolor{lightgray}{\texttt{number of drawings or tabular lower}} }; |
| 3387 |
% \draw[<->,color=gray] (2.0,7.0) --node[above,text=optcolor]{\vphantom{p}\texttt{labelwidth}} (5.0,7.0); |
| 3388 |
% \draw[<->,color=gray] (5.0,7.0) --node[above,text=optcolor]{\texttt{labelsep}} (7.0,7.0); |
| 3389 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (2.0,6.5) rectangle (5.0,6.85);% labelwidth |
| 3390 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (5.0,6.5) rectangle (7.0,6.85);% labelsep |
| 3391 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,6.5) rectangle (17.5,6.85) node[pos=.5,text=black]% |
| 3392 |
% {\begin{tabular}{c} |
| 3393 |
% \textcolor{blue}{\emph{item text above the keyanspic environment}} |
| 3394 |
% \end{tabular}};% item width |
| 3395 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,5.25) rectangle (10.5,6.10) node[pos=.5,text=black]% |
| 3396 |
% {\begin{tabular}{c} |
| 3397 |
% \texttt{above one} \\ |
| 3398 |
% \textcolor{blue}{\emph{drawing or tabular}} |
| 3399 |
% \end{tabular}}; |
| 3400 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,4.9) rectangle (10.5,5.25) node[pos=.5,text=black]% |
| 3401 |
% { \textcolor{blue}{\texttt{label}} }; |
| 3402 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (10.5,5.25) rectangle (14,6.10) node[pos=.5,text=black]% |
| 3403 |
% {\begin{tabular}{c} |
| 3404 |
% \texttt{above two} \\ |
| 3405 |
% \textcolor{blue}{\emph{drawing or tabular}} |
| 3406 |
% \end{tabular}}; |
| 3407 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (10.5,4.9) rectangle (14,5.25) node[pos=.5,text=black]% |
| 3408 |
% { \textcolor{blue}{\texttt{label}} }; |
| 3409 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (14,5.25) rectangle (17.5,6.10) node[pos=.5,text=black]% |
| 3410 |
% {\begin{tabular}{c} |
| 3411 |
% \texttt{above three} \\ |
| 3412 |
% \textcolor{blue}{\emph{drawing or tabular}} |
| 3413 |
% \end{tabular}}; |
| 3414 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (14,4.9) rectangle (17.5,5.25) node[pos=.5,text=black]% |
| 3415 |
% { \textcolor{blue}{\texttt{label}} }; |
| 3416 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,3.65) rectangle (12.25,4.5) node[pos=.5,text=black]% |
| 3417 |
% {\begin{tabular}{c} |
| 3418 |
% \texttt{below one} \\ |
| 3419 |
% \textcolor{blue}{\emph{drawing or tabular}} |
| 3420 |
% \end{tabular}}; |
| 3421 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,3.3) rectangle (12.25,3.65) node[pos=.5,text=black]% |
| 3422 |
% { \textcolor{blue}{\texttt{label}} }; |
| 3423 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (12.25,3.65) rectangle (17.5,4.5) node[pos=.5,text=black]% |
| 3424 |
% {\begin{tabular}{c} |
| 3425 |
% \texttt{below two} \\ |
| 3426 |
% \textcolor{blue}{\emph{drawing or tabular}} |
| 3427 |
% \end{tabular}}; |
| 3428 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (12.25,3.3) rectangle (17.5,3.65) node[pos=.5,text=black]% |
| 3429 |
% { \textcolor{blue}{\texttt{label}} }; |
| 3430 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (2.0,2.55) rectangle (5.0,2.9);% labelwidth |
| 3431 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (5.0,2.55) rectangle (7.0,2.9);% labelsep |
| 3432 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,2.55) rectangle (17.5,2.9) node[pos=.5,text=black]% |
| 3433 |
% {\begin{tabular}{c} |
| 3434 |
% \textcolor{blue}{\emph{item text below the keyanspic environment}} |
| 3435 |
% \end{tabular}};% item width |
| 3436 |
% \end{tikzpicture} |
| 3437 |
% \caption{Representation of the \myenv*{keyanspic} environment with \mykey{layout-sty}=\mymarg{3, 2} in \mypkg*{enumext}.} |
| 3438 |
% \label{fig:keyanspicdoc} |
| 3439 |
% \end{figure} |
| 3440 |
% |
| 3441 |
% \smallskip |
| 3442 |
% |
| 3443 |
% This environment cannot be nested and must \emph{always} be at the |
| 3444 |
% \emph{\enquote{first level}} of the \myenv*{enumext} environment, the |
| 3445 |
% \ics*{item} command is disabled and \mymeta{keys} cannot be set using |
| 3446 |
% |\setenumext|. |
| 3447 |
% |
| 3448 |
% \subsubsection{Keys for \texttt{keyanspic}} |
| 3449 |
% |
| 3450 |
% \keyexamp{label-pos}{above \textnormal{\textcolor{lightgray}{\textbar}} below}{below} |
| 3451 |
% |
| 3452 |
% \smallskip |
| 3453 |
% |
| 3454 |
% Set the \emph{position} of \mymeta{label} to be centered |
| 3455 |
% \enquote{above} or \enquote{below} \emph{drawings} or \emph{tabular} |
| 3456 |
% when the |\anspic| command is executed. |
| 3457 |
% |
| 3458 |
% \smallskip |
| 3459 |
% |
| 3460 |
% \keyexamp{label-sep}{rubber length \textnormal{\textcolor{lightgray}{\textbar}} rigid length}{internal adjustment} |
| 3461 |
% |
| 3462 |
% \smallskip |
| 3463 |
% |
| 3464 |
% Set the \emph{vertical spacing} between the \mymeta{label} centered |
| 3465 |
% \enquote{above} or \enquote{below} and \emph{drawings} or \emph{tabular} |
| 3466 |
% when running the |\anspic| command. |
| 3467 |
% |
| 3468 |
% \keyexamp{layout-sty}{n° upper \textnormal{\textcolor{gray}{,}} n° lower}{not set} |
| 3469 |
% |
| 3470 |
% \smallskip |
| 3471 |
% |
| 3472 |
% Set the \emph{number} of \emph{drawings} or \emph{tabular} that will be |
| 3473 |
% distributed \enquote{upper} and \enquote{lower} within the environment |
| 3474 |
% when executing the |\anspic| command. The value must be passed in braces |
| 3475 |
% and if not set or the \mymeta{nº lower} is omitted the \emph{drawings} |
| 3476 |
% or \emph{tabular} will be put on a \emph{single line}. |
| 3477 |
% |
| 3478 |
% \smallskip |
| 3479 |
% |
| 3480 |
% \keyexamp{layout-sep}{rubber length \textnormal{\textcolor{lightgray}{\textbar}} rigid length}{adjusted parsep from keyans} |
| 3481 |
% |
| 3482 |
% \smallskip |
| 3483 |
% |
| 3484 |
% Set the \emph{vertical separation} between the number of |
| 3485 |
% \emph{drawings} or \emph{tabular} placed at the \enquote{upper} and |
| 3486 |
% \enquote{lower} within the environment when executing the |\anspic| |
| 3487 |
% command. Internally adjusts the \mykey{parsep} value taken from the |
| 3488 |
% \myenv*{keyans} environment. |
| 3489 |
% |
| 3490 |
% \smallskip |
| 3491 |
% |
| 3492 |
% \keyexamp{layout-top}{rubber length \textnormal{\textcolor{lightgray}{\textbar}} rigid length}{adjusted topsep from keyans} |
| 3493 |
% |
| 3494 |
% \smallskip |
| 3495 |
% |
| 3496 |
% Set the \emph{vertical space} added to both the top and bottom of the environment. |
| 3497 |
% Internally adjust the value of \mykey{topsep} taken from \myenv*{keyans} environment. |
| 3498 |
% |
| 3499 |
% \smallskip |
| 3500 |
% |
| 3501 |
% The keys \mykey{mark-ans*}, \mykey{mark-pos*}, \mykey{mark-sep*}, \mykey{save-sep}, |
| 3502 |
% \mykey{wrap-opt}, \mykey{wrap-ans*}, \mykey{show-ans} and \mykey{show-pos} |
| 3503 |
% are available for this environment. |
| 3504 |
% |
| 3505 |
% \subsubsection{The command \cs[no-index]{anspic}} |
| 3506 |
% |
| 3507 |
% \vspace*{-\baselineskip} |
| 3508 |
% |
| 3509 |
% \begin{function}{\anspic} |
| 3510 |
% \begin{syntax} |
| 3511 |
% \cmdexamp{anspic}{drawing or tabular} |
| 3512 |
% \cmdexamp[*]{anspic}[content]{drawing or tabular} |
| 3513 |
% \end{syntax} |
| 3514 |
% The \ics*{anspic} command take three arguments, the \emph{starred |
| 3515 |
% argument} ‘|*|’ store the current \mymeta{label} next to the |
| 3516 |
% \emph{optional argument} \mymeta{content} in \emph{sequence} and |
| 3517 |
% \emph{prop list} \mymarg{store name} set by \mykey{save-ans} key. |
| 3518 |
% \end{function} |
| 3519 |
% |
| 3520 |
% \smallskip |
| 3521 |
% |
| 3522 |
% The \emph{starred argument} ‘|*|’ cannot be separated by spaces ‘\verb*| |’ |
| 3523 |
% from the command, i.e. \ics*{anspic}|*| and the \emph{optional argument} |
| 3524 |
% does \enquote{NOT} support \emph{verbatim content}. By design it |
| 3525 |
% is assumed that the \emph{starred argument} ‘|*|’ will only |
| 3526 |
% appear \emph{\enquote{once}} within the environment. |
| 3527 |
% |
| 3528 |
% \subsubsection*{Example} |
| 3529 |
% |
| 3530 |
% \iffalse |
| 3531 |
%<*example> |
| 3532 |
% \fi |
| 3533 |
\begin{examplecode}[frame=single] |
| 3534 |
\begin{enumext}[save-ans=test,show-ans=true,nosep] |
| 3535 |
\item Question with images and labels below. |
| 3536 |
|
| 3537 |
\begin{keyanspic}[layout-sty={3,2}] |
| 3538 |
\anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3539 |
\anspic{\includegraphics[scale=0.15]{example-image-b}} |
| 3540 |
\anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3541 |
\anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3542 |
\anspic*[note]{\includegraphics[scale=0.15]{example-image-a}} |
| 3543 |
\end{keyanspic} |
| 3544 |
|
| 3545 |
\item Question with images and labels above. |
| 3546 |
|
| 3547 |
\begin{keyanspic}[label-pos=above, layout-sty={3,2},layout-sep=0.25cm] |
| 3548 |
\anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3549 |
\anspic{\includegraphics[scale=0.15]{example-image-b}} |
| 3550 |
\anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3551 |
\anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3552 |
\anspic*[note]{\includegraphics[scale=0.15]{example-image-a}} |
| 3553 |
\end{keyanspic} |
| 3554 |
|
| 3555 |
\item Question with images and labels below on a single line. |
| 3556 |
|
| 3557 |
\begin{keyanspic} |
| 3558 |
\anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3559 |
\anspic{\includegraphics[scale=0.15]{example-image-b}} |
| 3560 |
\anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3561 |
\anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3562 |
\anspic*[note]{\includegraphics[scale=0.15]{example-image-a}} |
| 3563 |
\end{keyanspic} |
| 3564 |
|
| 3565 |
\end{enumext} |
| 3566 |
\end{examplecode} |
| 3567 |
% \iffalse |
| 3568 |
%</example> |
| 3569 |
% \fi |
| 3570 |
% |
| 3571 |
% \newpage |
| 3572 |
% |
| 3573 |
% \begin{enumext}[save-ans=test, mark-ans*={\oldtextasteriskcentered},show-ans=true,nosep, before={\setenumext[keyans]{nosep,parsep=5mm}}] |
| 3574 |
% \item Question with images and labels below. |
| 3575 |
% \begin{keyanspic}[layout-sty={3,2}] |
| 3576 |
% \anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3577 |
% \anspic{\includegraphics[scale=0.15]{example-image-b}} |
| 3578 |
% \anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3579 |
% \anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3580 |
% \anspic*[note]{\includegraphics[scale=0.15]{example-image-a}} |
| 3581 |
% \end{keyanspic} |
| 3582 |
% \item Question with images and labels above. |
| 3583 |
% \begin{keyanspic}[label-pos=above, layout-sty={3,2},layout-sep=0.25cm,layout-top=10pt] |
| 3584 |
% \anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3585 |
% \anspic{\includegraphics[scale=0.15]{example-image-b}} |
| 3586 |
% \anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3587 |
% \anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3588 |
% \anspic*[note]{\includegraphics[scale=0.15]{example-image-a}} |
| 3589 |
% \end{keyanspic} |
| 3590 |
% \item Question with images and labels below on a single line. |
| 3591 |
% \begin{keyanspic}[layout-top=10pt] |
| 3592 |
% \anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3593 |
% \anspic{\includegraphics[scale=0.15]{example-image-b}} |
| 3594 |
% \anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3595 |
% \anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 3596 |
% \anspic*[note]{\includegraphics[scale=0.15]{example-image-a}} |
| 3597 |
% \end{keyanspic} |
| 3598 |
% \end{enumext} |
| 3599 |
% |
| 3600 |
% \smallskip |
| 3601 |
% |
| 3602 |
% \begin{important} |
| 3603 |
% Remember to pass the |alt=|\mymarg{description} key to the |\includegraphics| |
| 3604 |
% command when creating a \emph{tagged} PDF. |
| 3605 |
% \end{important} |
| 3606 |
% |
| 3607 |
% \subsection{Printing stored content} |
| 3608 |
% |
| 3609 |
% \subsubsection{The command \cs[no-index]{getkeyans}} |
| 3610 |
% \label{sec:getkeyans} |
| 3611 |
% |
| 3612 |
% \vspace*{-10pt} |
| 3613 |
% |
| 3614 |
% \begin{function}{\getkeyans} |
| 3615 |
% \begin{syntax} |
| 3616 |
% \cmdexamp{getkeyans}{store name \textnormal{\textcolor{red}{:}} position} |
| 3617 |
% \end{syntax} |
| 3618 |
% The command \ics*{getkeyans} prints the \emph{\enquote{stored content}} |
| 3619 |
% in \emph{prop list} \mymarg{store name} defined by |
| 3620 |
% \mykey{save-ans} key in the \mymeta{position} returned by the |
| 3621 |
% \mykey{show-pos} key. |
| 3622 |
% |
| 3623 |
% \smallskip |
| 3624 |
% |
| 3625 |
% The \emph{\enquote{stored content}} can only be accessed \emph{after} |
| 3626 |
% it is stored, if \mymarg{store name} does not exist the command |
| 3627 |
% will return an error. |
| 3628 |
% \end{function} |
| 3629 |
% |
| 3630 |
% \smallskip |
| 3631 |
% |
| 3632 |
% The form taken by the argument \mymarg{store name \textnormal{\textcolor{red}{:}} position} |
| 3633 |
% is the same as that used to generate the \emph{\enquote{internal |
| 3634 |
% label and ref}} system when \mykey{save-ref} key are active, so to |
| 3635 |
% refer to a \emph{\enquote{stored content}}. For example |
| 3636 |
% |\getkeyans{test:4}| will return the \emph{\enquote{stored content}} |
| 3637 |
% at position |4| of the environment in which the key |save-ans=test| |
| 3638 |
% was set. |
| 3639 |
% |
| 3640 |
% \subsubsection{The command \cs{foreachkeyans}}\label{sec:foreachkeyans} |
| 3641 |
% |
| 3642 |
% \vspace*{-10pt} |
| 3643 |
% |
| 3644 |
% \begin{function}{\foreachkeyans} |
| 3645 |
% \begin{syntax} |
| 3646 |
% \cmdexamp{foreachkeyans}[key \textnormal{\textcolor{gray}{=}} val]{store name} |
| 3647 |
% \end{syntax} |
| 3648 |
% \end{function} |
| 3649 |
% |
| 3650 |
% The command \ics*{foreachkeyans} goes through and executes the command |\getkeyans| |
| 3651 |
% on the contents in \emph{prop list} \mymarg{store name}. If you pass without options run |
| 3652 |
% |\getkeyans| on all contents in \emph{prop list} \mymarg{store name}. |
| 3653 |
% |
| 3654 |
% \subsubsection*{Options for command} |
| 3655 |
% \label{sec:optcmdforeach} |
| 3656 |
% |
| 3657 |
% \keyexampcmd{sep}{code}{\{; \}}[foreachkeyans] |
| 3658 |
% |
| 3659 |
% \smallskip |
| 3660 |
% |
| 3661 |
% Establishes the \emph{separation} between \emph{\enquote{each}} \mymarg{content} stored in \emph{prop list} \mymarg{store name}. |
| 3662 |
% For example, you can use \mykeycmd[foreachkeyans]{sep}|={\\[10pt]}| for vertical separation of stored |
| 3663 |
% contents. |
| 3664 |
% |
| 3665 |
% \smallskip |
| 3666 |
% |
| 3667 |
% \keyexampcmd{step}{integer}{\mydim{1}}[foreachkeyans] |
| 3668 |
% |
| 3669 |
% \smallskip |
| 3670 |
% |
| 3671 |
% Sets the \emph{step} (increment) applied to the value set by key \mykeycmd[foreachkeyans]{start} |
| 3672 |
% for \emph{\enquote{each}} \mymarg{content} stored in \emph{prop list} \mymarg{store name}. The value must be a |
| 3673 |
% \mymeta{positive integer}. |
| 3674 |
% |
| 3675 |
% \smallskip |
| 3676 |
% |
| 3677 |
% \keyexampcmd{start}{integer}{\mydim{1}}[foreachkeyans] |
| 3678 |
% |
| 3679 |
% \smallskip |
| 3680 |
% |
| 3681 |
% Sets the \emph{position} of the \emph{prop list} \mymarg{store name} from which execution |
| 3682 |
% will start. The value must be a \mymeta{positive integer}. |
| 3683 |
% |
| 3684 |
% \keyexampcmd{stop}{integer}{\mydim{0}}[foreachkeyans] |
| 3685 |
% |
| 3686 |
% \smallskip |
| 3687 |
% |
| 3688 |
% Sets the \emph{position} of the \emph{prop list} \mymarg{store name} from which execution |
| 3689 |
% will finish. The value must be a \mymeta{positive integer}. |
| 3690 |
% |
| 3691 |
% \smallskip |
| 3692 |
% |
| 3693 |
% \keyexampcmd{before}{code}{empty}[foreachkeyans] |
| 3694 |
% |
| 3695 |
% \smallskip |
| 3696 |
% |
| 3697 |
% Sets the \mymarg{code} that will be executed \mymeta{before} each \mymarg{content} stored |
| 3698 |
% in \emph{prop list} \mymarg{store name}. The \mymarg[type=tt]{code} must be passed between braces. |
| 3699 |
% |
| 3700 |
% \keyexampcmd{after}{code}{empty}[foreachkeyans] |
| 3701 |
% |
| 3702 |
% \smallskip |
| 3703 |
% |
| 3704 |
% Sets the \mymarg{code} that will be executed \mymeta{after} each \mymarg{content} stored |
| 3705 |
% in \emph{prop list} \mymarg{store name}. The \mymarg{code} must be passed between braces. |
| 3706 |
% |
| 3707 |
% \keyexampcmd{wrapper}{code{} \space\usebox{\hashbox} more code}{empty}[foreachkeyans] |
| 3708 |
% |
| 3709 |
% \smallskip |
| 3710 |
% |
| 3711 |
% Wraps the \mymarg{content} stored in \emph{prop list} \mymarg{store name} referenced by |{#1}|. |
| 3712 |
% The \mymarg{code} must be passed between braces. For example |
| 3713 |
% |\foreachkeyans[wrapper={\makebox[1em][l]{#1}}]|\mymarg{store name}. |
| 3714 |
% |
| 3715 |
% \subsubsection{The command \cs[no-index]{printkeyans}}\label{sec:printkeyans} |
| 3716 |
% |
| 3717 |
% \vspace*{-10pt} |
| 3718 |
% |
| 3719 |
% \begin{function}{\printkeyans} |
| 3720 |
% \begin{syntax} |
| 3721 |
% \cmdexamp{printkeyans}{store name} |
| 3722 |
% \cmdexamp{printkeyans}[keys]{store name} |
| 3723 |
% \cmdexamp[*]{printkeyans}[keys]{store name} |
| 3724 |
% \end{syntax} |
| 3725 |
% The command \ics*{printkeyans} prints \emph{\enquote{all stored content}} |
| 3726 |
% in \emph{sequence} \mymarg{store name} defined by \mykey{save-ans} |
| 3727 |
% key placing this inside the \myenv*{enumext} or \myenv*{enumext*} |
| 3728 |
% environment if the \emph{starred argument} ‘|*|’ is used. |
| 3729 |
% |
| 3730 |
% \smallskip |
| 3731 |
% |
| 3732 |
% The \emph{\enquote{stored content}} can only be accessed \emph{after} it is |
| 3733 |
% stored in the \emph{sequence}, if \mymarg{store name} does not exist the |
| 3734 |
% command will return an error. |
| 3735 |
% \end{function} |
| 3736 |
% |
| 3737 |
% \smallskip |
| 3738 |
% |
| 3739 |
% The \emph{optional argument} allows managing the \mymeta{keys} in the |
| 3740 |
% \emph{\enquote{first level}} of the environment in which the |
| 3741 |
% \emph{\enquote{stored content}} of the \emph{sequence} \mymarg{store |
| 3742 |
% name} will be printed, if the \emph{starred argument} ‘|*|’ is used it will be |
| 3743 |
% \myenv*{enumext*} otherwise \myenv*{enumext}. |
| 3744 |
% |
| 3745 |
% \smallskip |
| 3746 |
% |
| 3747 |
% The default values for the \emph{\enquote{first level}} are the |
| 3748 |
% same as the default values for the \myenv*{enumext} and \myenv*{enumext*} |
| 3749 |
% environments along with the keys |nosep,first=\small,font=\small| and |columns=2|. |
| 3750 |
% For the inner levels of the environment \myenv*{enumext} saved in the |
| 3751 |
% \emph{sequence} \mymarg{store name} the default values are the same |
| 3752 |
% as those established for the second, third and fourth levels plus the |
| 3753 |
% keys |nosep,first=\small,font=\small|. If the environment \myenv*{enumext*} |
| 3754 |
% is saved within the \emph{sequence} \mymarg{store name} it will have |
| 3755 |
% the same default values plus the keys |nosep,first=\small, font=\small|. |
| 3756 |
% |
| 3757 |
% \smallskip |
| 3758 |
% |
| 3759 |
% Since the command encapsulates by default the \myenv*{enumext} |
| 3760 |
% environment or the \myenv*{enumext*} environment, we must take some |
| 3761 |
% considerations: |
| 3762 |
% |
| 3763 |
%\begin{itemize}[topsep=0pt] |
| 3764 |
% \item If we execute |\printkeyans*|\mymarg{store name} and the \emph{sequence} |
| 3765 |
% \mymarg{store name} already contains any \myenv*{enumext*} environment |
| 3766 |
% an error will be returned as we cannot nest. |
| 3767 |
% |
| 3768 |
% \item If we execute |\printkeyans*|\mymarg{store name} and the \emph{sequence} |
| 3769 |
% \mymarg{store name} contains any \myenv*{enumext} environments, they |
| 3770 |
% will start with the \mymeta{keys} set for the first level unless they |
| 3771 |
% are set in the \emph{optional argument} or \mykey{save-key} is used to modify it. |
| 3772 |
% |
| 3773 |
% \item If we execute |\printkeyans|\mymarg{store name} and the \emph{sequence} |
| 3774 |
% \mymarg{store name} contains any environment \myenv*{enumext*}, they |
| 3775 |
% will start with the \mymeta{keys} set by default unless they are set |
| 3776 |
% in the \emph{optional argument} or \mykey{save-key} is used to modify it. |
| 3777 |
%\end{itemize} |
| 3778 |
% |
| 3779 |
% The default values for the \emph{\enquote{first level}} of |\printkeyans| commands and |
| 3780 |
% |\printkeyans*| are established using \ics*{setenumext}\myoarg{print \textnormal{\textcolor{gray}{,}} \textcolor{MediumOrchid}{1}}\mymarg{keys} and |
| 3781 |
% \ics*{setenumext}\myoarg{print\textnormal{\textcolor{MediumOrchid}{\texttt{*}}}}\mymarg{keys}. |
| 3782 |
% |
| 3783 |
% \smallskip |
| 3784 |
% |
| 3785 |
% If we need to set the \mymeta{keys} for the environment |
| 3786 |
% \myenv*{enumext} \enquote{saved} in the \emph{sequence} \mymarg{store |
| 3787 |
% name} we will use \ics*{setenumext}\myoarg{print |
| 3788 |
% \textnormal{\textcolor{gray}{,}} level}\mymarg{keys} and if we need to |
| 3789 |
% set the \mymeta{keys} for the environment \myenv*{enumext*} |
| 3790 |
% \enquote{saved} in the \emph{sequence} \mymarg{store name} we will use |
| 3791 |
% \ics*{setenumext}\myoarg{print \textnormal{\textcolor{gray}{,}} |
| 3792 |
% \textnormal{\textcolor{MediumOrchid}{\texttt{*}}}}\mymarg{keys}. |
| 3793 |
% |
| 3794 |
% \subsubsection*{Example} |
| 3795 |
% |
| 3796 |
% \iffalse |
| 3797 |
%<*example> |
| 3798 |
% \fi |
| 3799 |
\begin{examplecode}[frame=single] |
| 3800 |
\begin{enumext}[save-ans=sample,columns=1,show-pos=true,nosep,save-ref=true] |
| 3801 |
\item Factor $3x+3y+3z$. \anskey{$3(x+y+z)$} |
| 3802 |
\item True False |
| 3803 |
|
| 3804 |
\begin{enumext}[nosep] |
| 3805 |
\item \LaTeX2e\ is cool? \anskey{Very True!} |
| 3806 |
\end{enumext} |
| 3807 |
|
| 3808 |
\item Related to Linux |
| 3809 |
|
| 3810 |
\begin{enumext}[nosep] |
| 3811 |
\item You use Linux? \anskey{Yes} |
| 3812 |
\item Rate the following package and class |
| 3813 |
\begin{enumext}[nosep] |
| 3814 |
\item \texttt{xsim} \anskey{very good} |
| 3815 |
\item \texttt{exsheets} \anskey{obsolete} |
| 3816 |
\end{enumext} |
| 3817 |
\end{enumext} |
| 3818 |
\end{enumext} |
| 3819 |
|
| 3820 |
The answer to \ref{sample:4} is \getkeyans{sample:4} and the answers to |
| 3821 |
all the worksheets are as follows: |
| 3822 |
|
| 3823 |
\printkeyans{sample} |
| 3824 |
\end{examplecode} |
| 3825 |
% \iffalse |
| 3826 |
%</example> |
| 3827 |
% \fi |
| 3828 |
% |
| 3829 |
% \begin{enumext}[save-ans=sampleXX,columns=1,show-pos=true,save-ref=true] |
| 3830 |
% \item Factor $3x+3y+3z$. \anskey{$3(x+y+z)$} |
| 3831 |
% \item True False |
| 3832 |
% \begin{enumext}[nosep] |
| 3833 |
% \item \LaTeX2e\ is cool? \anskey{Very True!} |
| 3834 |
% \end{enumext} |
| 3835 |
% \item Related to Linux |
| 3836 |
% \begin{enumext}[nosep] |
| 3837 |
% \item You use Linux? \anskey{Yes} |
| 3838 |
% \item Rate the following package and class |
| 3839 |
% \begin{enumext}[nosep] |
| 3840 |
% \item \texttt{xsim} \anskey{very good} |
| 3841 |
% \item \texttt{exsheets} \anskey{obsolete} |
| 3842 |
% \end{enumext} |
| 3843 |
% \end{enumext} |
| 3844 |
% \end{enumext} |
| 3845 |
% |
| 3846 |
% \medskip |
| 3847 |
% |
| 3848 |
% The answer to \ref{sampleXX:4} is \getkeyans{sampleXX:4} and the answers to |
| 3849 |
% all the worksheets are as follows: |
| 3850 |
% |
| 3851 |
% \medskip |
| 3852 |
% |
| 3853 |
% \printkeyans[columns=1]{sampleXX} |
| 3854 |
% |
| 3855 |
% \section{Full examples} |
| 3856 |
% |
| 3857 |
% Here I will leave as an example some adaptations questions taken from \href{https://tex.stackexchange.com}{TeX-SX}. |
| 3858 |
% The examples are attached to this documentation and can be extracted |
| 3859 |
% from your PDF viewer or from the command line by running: |
| 3860 |
% \iffalse |
| 3861 |
%<*example> |
| 3862 |
% \fi |
| 3863 |
\begin{examplecode}[frame=single] |
| 3864 |
$ pdfdetach -saveall enumext.pdf |
| 3865 |
\end{examplecode} |
| 3866 |
% \iffalse |
| 3867 |
%</example> |
| 3868 |
% \fi |
| 3869 |
% and then you can use the excellent \arara\footnote{The cool \TeX\ automation tool: |
| 3870 |
% \url{https://www.ctan.org/pkg/arara}} tool to compile them. |
| 3871 |
% |
| 3872 |
% \subsubsection*{Example 1} |
| 3873 |
% |
| 3874 |
% \iffalse |
| 3875 |
%<*example> |
| 3876 |
% \fi |
| 3877 |
\begin{filecontents*}[overwrite]{enumext-exa-1.tex} |
| 3878 |
% arara: lualatex: { branch: developer } |
| 3879 |
% arara: clean: { extensions: [ aux, log] } |
| 3880 |
\documentclass{article} |
| 3881 |
\usepackage{siunitx,amssymb,enumext} |
| 3882 |
\sisetup{output-decimal-marker={,}} |
| 3883 |
\DeclareSIUnit{\angstrom}{\textup{\AA}} |
| 3884 |
\pagestyle{empty} |
| 3885 |
\begin{document} |
| 3886 |
\setenumext[keyans]{label=\Alph*,labelsep=10pt,font=\small,nosep,itemsep=2pt,wrap-label={\fbox{\makebox[\height]{##1}}}} |
| 3887 |
\begin{enumext}[mode-box,columns=2,columns-sep=1cm,save-ans=sabastiano] |
| 3888 |
\item La velocità di \qty{1,00e2}{m/s} espressa in \unit{km/h} è: |
| 3889 |
\begin{keyans} |
| 3890 |
\item \qty{36}{km/h}. |
| 3891 |
\item* \qty{360}{km/h}. |
| 3892 |
\item \qty{27,8}{km/h}. |
| 3893 |
\item \qty{3,60e8}{km/h}. |
| 3894 |
\end{keyans} |
| 3895 |
|
| 3896 |
\item In fisica nucleare si usa l'angstrom (simbolo: |
| 3897 |
$\qty{1}{\angstrom} = \qty{1e-10}{m}$) e il fermi o femtometro |
| 3898 |
($\qty{1}{fm} = \qty{1e-15}{m}$). Qual è la relazione tra queste due |
| 3899 |
unità di misura? |
| 3900 |
\begin{keyans} |
| 3901 |
\item* $\qty{1}{\angstrom}=\qty{1e5}{fm}$. |
| 3902 |
\item $\qty{1}{\angstrom}=\qty{1e-5}{fm}$. |
| 3903 |
\item $\qty{1}{\angstrom}=\qty{1e-15}{fm}$. |
| 3904 |
\item $\qty{1}{\angstrom}=\qty{1e3}{fm}$. |
| 3905 |
\end{keyans} |
| 3906 |
|
| 3907 |
\item La velocità di \qty{1,00e2}{m/s} espressa in \unit{km/h} è: |
| 3908 |
\begin{keyans} |
| 3909 |
\item \qty{36}{km/h}. |
| 3910 |
\item* \qty{360}{km/h}. |
| 3911 |
\item \qty{27,8}{km/h}. |
| 3912 |
\item \qty{3,60e8}{km/h}. |
| 3913 |
\end{keyans} |
| 3914 |
|
| 3915 |
\item In fisica nucleare si usa l'angstrom (simbolo: |
| 3916 |
$\qty{1}{\angstrom} = \qty{1e-10}{m}$) e il fermi o femtometro |
| 3917 |
($\qty{1}{fm} = \qty{1e-15}{m}$). Qual è la relazione tra queste due |
| 3918 |
unità di misura? |
| 3919 |
\begin{keyans} |
| 3920 |
\item* $\qty{1}{\angstrom}=\qty{1e5}{fm}$. |
| 3921 |
\item $\qty{1}{\angstrom}=\qty{1e-5}{fm}$. |
| 3922 |
\item $\qty{1}{\angstrom}=\qty{1e-15}{fm}$. |
| 3923 |
\item $\qty{1}{\angstrom}=\qty{1e3}{fm}$. |
| 3924 |
\end{keyans} |
| 3925 |
\end{enumext} |
| 3926 |
|
| 3927 |
\printkeyans[columns=4]{sabastiano} |
| 3928 |
\end{document} |
| 3929 |
\end{filecontents*} |
| 3930 |
% \iffalse |
| 3931 |
%</example> |
| 3932 |
% \fi |
| 3933 |
% |
| 3934 |
% Adapted from the response given by Enrico Gregorio in \href{https://tex.stackexchange.com/q/461730/7832}{Squares for answer choice options and perfect alignment to mathematical answers} |
| 3935 |
% \textattachfile[color=red,print=false]{enumext-exa-1.tex}{\faFile*[regular]}. |
| 3936 |
% |
| 3937 |
% \setenumext[keyans]{label=\Alph*,font=\small,nosep,wrap-label={\fbox{\makebox[\height]{##1}}}} |
| 3938 |
% \begin{enumext}[columns=2,save-ans=sabastiano,itemsep=2pt, topsep=5pt,below*={8pt}] |
| 3939 |
% \item La velocità di \SI{1,00e2}{m/s} espressa in \si{km/h} è: |
| 3940 |
% |
| 3941 |
% \begin{keyans} |
| 3942 |
% \item \SI{36}{km/h}. |
| 3943 |
% \item* \SI{360}{km/h}. |
| 3944 |
% \item \SI{27,8}{km/h}. |
| 3945 |
% \item \SI{3,60e8}{km/h}. |
| 3946 |
% \end{keyans} |
| 3947 |
% |
| 3948 |
% \item In fisica nucleare si usa l'angstrom (simbolo: |
| 3949 |
% $\SI{1}{\angstrom} = \SI{1e-10}{m}$) e il fermi o femtometro |
| 3950 |
% ($\SI{1}{fm} = \SI{1e-15}{m}$). Qual è la relazione tra queste due |
| 3951 |
% unità di misura? |
| 3952 |
% \begin{keyans} |
| 3953 |
% \item* $\SI{1}{\angstrom}=\SI{1e5}{fm}$. |
| 3954 |
% \item $\SI{1}{\angstrom}=\SI{1e-5}{fm}$. |
| 3955 |
% \item $\SI{1}{\angstrom}=\SI{1e-15}{fm}$. |
| 3956 |
% \item $\SI{1}{\angstrom}=\SI{1e3}{fm}$. |
| 3957 |
% \end{keyans} |
| 3958 |
% |
| 3959 |
% \item La velocità di \SI{1,00e2}{m/s} espressa in \si{km/h} è: |
| 3960 |
% |
| 3961 |
% \begin{keyans} |
| 3962 |
% \item \SI{36}{km/h}. |
| 3963 |
% \item* \SI{360}{km/h}. |
| 3964 |
% \item \SI{27,8}{km/h}. |
| 3965 |
% \item \SI{3,60e8}{km/h}. |
| 3966 |
% \end{keyans} |
| 3967 |
% |
| 3968 |
% \item In fisica nucleare si usa l'angstrom (simbolo: |
| 3969 |
% $\SI{1}{\angstrom} = \SI{1e-10}{m}$) e il fermi o femtometro |
| 3970 |
% ($\SI{1}{fm} = \SI{1e-15}{m}$). Qual è la relazione tra queste due |
| 3971 |
% unità di misura? |
| 3972 |
% \begin{keyans} |
| 3973 |
% \item* $\SI{1}{\angstrom}=\SI{1e5}{fm}$. |
| 3974 |
% \item $\SI{1}{\angstrom}=\SI{1e-5}{fm}$. |
| 3975 |
% \item $\SI{1}{\angstrom}=\SI{1e-15}{fm}$. |
| 3976 |
% \item $\SI{1}{\angstrom}=\SI{1e3}{fm}$. |
| 3977 |
% \end{keyans} |
| 3978 |
% \end{enumext} |
| 3979 |
% |
| 3980 |
% \printkeyans[columns=1]{sabastiano} |
| 3981 |
% |
| 3982 |
% \subsubsection*{Example 2} |
| 3983 |
% |
| 3984 |
% \iffalse |
| 3985 |
%<*example> |
| 3986 |
% \fi |
| 3987 |
\begin{filecontents*}[overwrite]{enumext-exa-2.tex} |
| 3988 |
% arara: lualatex: { branch: developer } |
| 3989 |
% arara: lualatex: { branch: developer } |
| 3990 |
% arara: clean: { extensions: [ aux, log, out] } |
| 3991 |
\documentclass{article} |
| 3992 |
\usepackage[colorlinks]{hyperref} |
| 3993 |
\usepackage{siunitx,amssymb,tikz,enumext,libertinus} |
| 3994 |
\usetikzlibrary{shapes.geometric} |
| 3995 |
\sisetup{output-decimal-marker={,}} |
| 3996 |
\DeclareSIUnit{\angstrom}{\textup{\AA}} |
| 3997 |
\newcommand*{\mySquared}[1]{% |
| 3998 |
\begin{tikzpicture}[baseline=(number.base),square/.style={regular polygon,regular polygon sides=4}] |
| 3999 |
\node[square, rounded corners=1pt, inner sep=1pt, draw=none, fill=gray!40] (number) {\makebox[\height]{#1}}; |
| 4000 |
\end{tikzpicture}% |
| 4001 |
} |
| 4002 |
\pagestyle{empty} |
| 4003 |
\begin{document} |
| 4004 |
\setenumext[keyans]{label=\Alph*,font=\small,nosep,wrap-label={\mySquared{##1}}} |
| 4005 |
\begin{enumext}[columns=1,save-ans=sabastiano2,mark-sep*=2pt,mark-ans*={\textcolor{gray}{✔}},save-ref=true,show-ans=true,itemsep=0pt] |
| 4006 |
\item La velocità di \qty{1,00e2}{m/s} espressa in \unit{km/h} è: |
| 4007 |
\begin{keyans} |
| 4008 |
\item \qty{36}{km/h}. |
| 4009 |
\item* \qty{360}{km/h}. |
| 4010 |
\item \qty{27,8}{km/h}. |
| 4011 |
\item \qty{3,60e8}{km/h}. |
| 4012 |
\end{keyans} |
| 4013 |
|
| 4014 |
\item In fisica nucleare si usa l'angstrom (simbolo: |
| 4015 |
$\qty{1}{\angstrom} = \qty{1e-10}{m}$) e il fermi o femtometro |
| 4016 |
($\qty{1}{fm} = \qty{1e-15}{m}$). Qual è la relazione tra queste due |
| 4017 |
unità di misura? |
| 4018 |
\begin{keyans} |
| 4019 |
\item* $\qty{1}{\angstrom}=\qty{1e5}{fm}$. |
| 4020 |
\item $\qty{1}{\angstrom}=\qty{1e-5}{fm}$. |
| 4021 |
\item $\qty{1}{\angstrom}=\qty{1e-15}{fm}$. |
| 4022 |
\item $\qty{1}{\angstrom}=\qty{1e3}{fm}$. |
| 4023 |
\end{keyans} |
| 4024 |
|
| 4025 |
\item La velocità di \qty{1,00e2}{m/s} espressa in \unit{km/h} è: |
| 4026 |
\begin{keyans} |
| 4027 |
\item \qty{36}{km/h}. |
| 4028 |
\item* \qty{360}{km/h}. |
| 4029 |
\item \qty{27,8}{km/h}. |
| 4030 |
\item \qty{3,60e8}{km/h}. |
| 4031 |
\end{keyans} |
| 4032 |
|
| 4033 |
\item In fisica nucleare si usa l'angstrom (simbolo: |
| 4034 |
$\qty{1}{\angstrom} = \qty{1e-10}{m}$) e il fermi o femtometro |
| 4035 |
($\qty{1}{fm} = \qty{1e-15}{m}$). Qual è la relazione tra queste due |
| 4036 |
unità di misura? |
| 4037 |
\begin{keyans} |
| 4038 |
\item* $\qty{1}{\angstrom}=\qty{1e5}{fm}$. |
| 4039 |
\item $\qty{1}{\angstrom}=\qty{1e-5}{fm}$. |
| 4040 |
\item $\qty{1}{\angstrom}=\qty{1e-15}{fm}$. |
| 4041 |
\item $\qty{1}{\angstrom}=\qty{1e3}{fm}$. |
| 4042 |
\end{keyans} |
| 4043 |
\end{enumext} |
| 4044 |
|
| 4045 |
\printkeyans[columns=4]{sabastiano2} |
| 4046 |
\end{document} |
| 4047 |
\end{filecontents*} |
| 4048 |
% \iffalse |
| 4049 |
%</example> |
| 4050 |
% \fi |
| 4051 |
% |
| 4052 |
% Adapted from the response given by Florent Rougon in \href{https://tex.stackexchange.com/q/529034/7832}{Multiple choice questions with proposed answers in random order — addition of automatic correction (cross mark)} |
| 4053 |
% \textattachfile[color=red,print=false]{enumext-exa-2.tex}{\faFile*[regular]}. |
| 4054 |
% \setenumext[keyans]{label=\Alph*,font=\small,nosep,wrap-label={\mySquared{##1}}} |
| 4055 |
% \begin{enumext}[columns=2,save-ans=sabastiano2,mark-sep*=2pt,mark-ans*={\textcolor{gray}{✔}},save-ref=true,show-ans=true,itemsep=0pt] |
| 4056 |
% \item La velocità di \SI{1,00e2}{m/s} espressa in \si{km/h} è: |
| 4057 |
% \begin{keyans} |
| 4058 |
% \item \SI{36}{km/h}. |
| 4059 |
% \item* \SI{360}{km/h}. |
| 4060 |
% \item \SI{27,8}{km/h}. |
| 4061 |
% \item \SI{3,60e8}{km/h}. |
| 4062 |
% \end{keyans} |
| 4063 |
% |
| 4064 |
% \item In fisica nucleare si usa l'angstrom (simbolo: |
| 4065 |
% $\SI{1}{\angstrom} = \SI{1e-10}{m}$) e il fermi o femtometro |
| 4066 |
% ($\SI{1}{fm} = \SI{1e-15}{m}$). Qual è la relazione tra queste due |
| 4067 |
% unità di misura? |
| 4068 |
% \begin{keyans} |
| 4069 |
% \item* $\SI{1}{\angstrom}=\SI{1e5}{fm}$. |
| 4070 |
% \item $\SI{1}{\angstrom}=\SI{1e-5}{fm}$. |
| 4071 |
% \item $\SI{1}{\angstrom}=\SI{1e-15}{fm}$. |
| 4072 |
% \item $\SI{1}{\angstrom}=\SI{1e3}{fm}$. |
| 4073 |
% \end{keyans} |
| 4074 |
% |
| 4075 |
% \item La velocità di \SI{1,00e2}{m/s} espressa in \si{km/h} è: |
| 4076 |
% \begin{keyans} |
| 4077 |
% \item \SI{36}{km/h}. |
| 4078 |
% \item* \SI{360}{km/h}. |
| 4079 |
% \item \SI{27,8}{km/h}. |
| 4080 |
% \item \SI{3,60e8}{km/h}. |
| 4081 |
% \end{keyans} |
| 4082 |
% |
| 4083 |
% \item In fisica nucleare si usa l'angstrom (simbolo: |
| 4084 |
% $\SI{1}{\angstrom} = \SI{1e-10}{m}$) e il fermi o femtometro |
| 4085 |
% ($\SI{1}{fm} = \SI{1e-15}{m}$). Qual è la relazione tra queste due |
| 4086 |
% unità di misura? |
| 4087 |
% \begin{keyans} |
| 4088 |
% \item* $\SI{1}{\angstrom}=\SI{1e5}{fm}$. |
| 4089 |
% \item $\SI{1}{\angstrom}=\SI{1e-5}{fm}$. |
| 4090 |
% \item $\SI{1}{\angstrom}=\SI{1e-15}{fm}$. |
| 4091 |
% \item $\SI{1}{\angstrom}=\SI{1e3}{fm}$. |
| 4092 |
% \end{keyans} |
| 4093 |
% \end{enumext} |
| 4094 |
% |
| 4095 |
% \printkeyans*[columns=2]{sabastiano2} |
| 4096 |
% |
| 4097 |
% \subsubsection*{Example 3} |
| 4098 |
% |
| 4099 |
% \iffalse |
| 4100 |
%<*example> |
| 4101 |
% \fi |
| 4102 |
\begin{filecontents*}[overwrite]{enumext-exa-3.tex} |
| 4103 |
% arara: lualatex: { branch: developer } |
| 4104 |
% arara: lualatex: { branch: developer } |
| 4105 |
% arara: clean: { extensions: [ aux, log, out] } |
| 4106 |
\documentclass{article} |
| 4107 |
\usepackage[margin=2cm]{geometry} |
| 4108 |
\usepackage{tikz} |
| 4109 |
\newcommand*{\myCircled}[1]{% |
| 4110 |
\begin{tikzpicture}[baseline=(number.base)] |
| 4111 |
\node[circle, draw=green!10!gray, inner sep=1pt, fill=blue!30!green!10] (number) {#1}; |
| 4112 |
\end{tikzpicture}% |
| 4113 |
} |
| 4114 |
\usepackage[colorlinks]{hyperref} |
| 4115 |
\usepackage{enumext} |
| 4116 |
\pagestyle{empty} |
| 4117 |
\begin{document} |
| 4118 |
\setenumext[keyans]{labelsep=8pt,label=\Alph*,font=\small,nosep,wrap-label={\myCircled{##1}}} |
| 4119 |
\setenumext[keyans*]{labelsep=8pt,label=\Alph*,font=\small,nosep,wrap-label={\myCircled{##1}}} |
| 4120 |
\setenumextmeta[2]{myroman}{no-store, label=\Roman*., noitemsep} |
| 4121 |
\setenumextmeta[2]{myarabic}{no-store,list-offset=0.5cm,label=(\arabic*),noitemsep} |
| 4122 |
\begin{enumext}[mode-box,save-ans=simplemc,columns=1,nosep,save-ref=true] |
| 4123 |
\item First type of questions |
| 4124 |
\begin{keyans*}[columns=2,noitemsep] |
| 4125 |
\item value |
| 4126 |
\item*[$x=5$] correct |
| 4127 |
\item value |
| 4128 |
\item value |
| 4129 |
\end{keyans*} |
| 4130 |
\item Second type of questions |
| 4131 |
\begin{enumext}[myroman] |
| 4132 |
\item $2\alpha+2\delta=90^{\circ}$ |
| 4133 |
\item $\alpha=\delta$ |
| 4134 |
\item $\angle EDF=45^{\circ}$ |
| 4135 |
\end{enumext} |
| 4136 |
\begin{keyans}[columns=2,noitemsep] |
| 4137 |
\item I only |
| 4138 |
\item II only |
| 4139 |
\item I and II only |
| 4140 |
\item* I and III only |
| 4141 |
\item I, II, and III |
| 4142 |
\end{keyans} |
| 4143 |
\item Third type of questions |
| 4144 |
\begin{enumext}[myarabic] |
| 4145 |
\item $2\alpha+2\delta=90^{\circ}$ |
| 4146 |
\item $\angle EDF=45^{\circ}$ |
| 4147 |
\end{enumext} |
| 4148 |
\begin{keyans}[columns=2,noitemsep] |
| 4149 |
\item value |
| 4150 |
\item value |
| 4151 |
\item*[some note] value |
| 4152 |
\item value |
| 4153 |
\item value |
| 4154 |
\end{keyans} |
| 4155 |
|
| 4156 |
\item Question with image and label below: |
| 4157 |
\begin{keyanspic}[layout-sty={3,2},label-sep=3pt] |
| 4158 |
\anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 4159 |
\anspic{\includegraphics[scale=0.15]{example-image-b}} |
| 4160 |
\anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 4161 |
\anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 4162 |
\anspic*[A duck]{\includegraphics[scale=0.32]{example-image-duck}} |
| 4163 |
\end{keyanspic} |
| 4164 |
|
| 4165 |
\item Question with image on right side: |
| 4166 |
\begin{keyans}[mini-env=0.5\linewidth, columns=1,noitemsep] |
| 4167 |
\item value |
| 4168 |
\item value |
| 4169 |
\item value |
| 4170 |
\item*[other note] correct |
| 4171 |
\item value |
| 4172 |
\miniright |
| 4173 |
\includegraphics[scale=0.15]{example-image-b} |
| 4174 |
\end{keyans} |
| 4175 |
\end{enumext} |
| 4176 |
|
| 4177 |
\medskip |
| 4178 |
|
| 4179 |
Test keys |
| 4180 |
|
| 4181 |
\printkeyans{simplemc} |
| 4182 |
\end{document} |
| 4183 |
\end{filecontents*} |
| 4184 |
% \iffalse |
| 4185 |
%</example> |
| 4186 |
% \fi |
| 4187 |
% |
| 4188 |
% A \emph{\enquote{simple multiple choice}} test \textattachfile[color=red,print=false]{enumext-exa-3.tex}{\faFile*[regular]}. |
| 4189 |
% \setenumext[keyans]{labelsep=8pt,label=\Alph*,font=\small,nosep,wrap-label={\myCircled{##1}}} |
| 4190 |
% \begin{enumext}[mode-box,save-ans=simplemc,columns=1,nosep,save-ref=true] |
| 4191 |
% \item First type of questions |
| 4192 |
% \begin{keyans*}[labelsep=8pt,label=\Alph*,font=\small,nosep,wrap-label={\myCircled{#1}},columns=2] |
| 4193 |
% \item value |
| 4194 |
% \item*[$x=5$] correct |
| 4195 |
% \item value |
| 4196 |
% \item value |
| 4197 |
% \end{keyans*} |
| 4198 |
% \item Second type of questions |
| 4199 |
% \begin{enumext}[no-store,label=\Roman*.,nosep] |
| 4200 |
% \item $2\alpha+2\delta=90^{\circ}$ |
| 4201 |
% \item $\alpha=\delta$ |
| 4202 |
% \item $\angle EDF=45^{\circ}$ |
| 4203 |
% \end{enumext} |
| 4204 |
% \begin{keyans}[columns=2,noitemsep] |
| 4205 |
% \item I only |
| 4206 |
% \item II only |
| 4207 |
% \item I and II only |
| 4208 |
% \item* I and III only |
| 4209 |
% \item I, II, and III |
| 4210 |
% \end{keyans} |
| 4211 |
% \item Third type of questions |
| 4212 |
% \begin{enumext}[no-store,list-offset=0.5cm,label=(\arabic*),nosep] |
| 4213 |
% \item $2\alpha+2\delta=90^{\circ}$ |
| 4214 |
% \item $\angle EDF=45^{\circ}$ |
| 4215 |
% \end{enumext} |
| 4216 |
% \begin{keyans}[columns=2,noitemsep] |
| 4217 |
% \item value |
| 4218 |
% \item value |
| 4219 |
% \item*[some note] value |
| 4220 |
% \item value |
| 4221 |
% \item value |
| 4222 |
% \end{keyans} |
| 4223 |
% |
| 4224 |
% \item Question with image and label below: |
| 4225 |
% \begin{keyanspic}[label-sep=3pt] |
| 4226 |
% \anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 4227 |
% \anspic{\includegraphics[scale=0.15]{example-image-b}} |
| 4228 |
% \anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 4229 |
% \anspic{\includegraphics[scale=0.15]{example-image-a}} |
| 4230 |
% \anspic*[A duck]{\includegraphics[scale=0.32]{example-image-duck}} |
| 4231 |
% \end{keyanspic} |
| 4232 |
% |
| 4233 |
% \item Question with image on right side: |
| 4234 |
% \begin{keyans}[mini-env=0.5\linewidth, columns=1,noitemsep] |
| 4235 |
% \item value |
| 4236 |
% \item value |
| 4237 |
% \item value |
| 4238 |
% \item*[other note] correct |
| 4239 |
% \item value |
| 4240 |
% \miniright |
| 4241 |
% \includegraphics[scale=0.15]{example-image-b} |
| 4242 |
% \end{keyans} |
| 4243 |
% \end{enumext} |
| 4244 |
% |
| 4245 |
% \smallskip |
| 4246 |
% |
| 4247 |
% Test keys |
| 4248 |
% |
| 4249 |
% \printkeyans[columns=2]{simplemc} |
| 4250 |
% |
| 4251 |
% \subsubsection*{Example 4} |
| 4252 |
% |
| 4253 |
% \iffalse |
| 4254 |
%<*example> |
| 4255 |
% \fi |
| 4256 |
\begin{filecontents*}[overwrite]{enumext-exa-4.tex} |
| 4257 |
% arara: lualatex: { branch: developer, draft: true } |
| 4258 |
% arara: lualatex: { branch: developer, draft: true } |
| 4259 |
% arara: lualatex: { branch: developer } |
| 4260 |
% arara: clean: { extensions: [ aux, log, out] } |
| 4261 |
\documentclass{article} |
| 4262 |
\usepackage[top=2cm,bottom=2cm,left=2cm,right=2cm]{geometry}% |
| 4263 |
\usepackage[osf]{libertinus} |
| 4264 |
\usepackage{unicode-math,tikzducks,graphicx,hyperref,enumext} |
| 4265 |
\begin{document} |
| 4266 |
\begin{enumext}[mode-box,save-ans=simplews,labelsep=10pt,columns=2,check-ans=true,show-ans=true,nosep,save-ref=true,wrap-label={\tikz[scale=0.25]\duck[signpost=\scalebox{0.6}{#1}];}] |
| 4267 |
\item Factor $x^{2}-2x+1$ \anskey{$\left(x-1\right)^{2}$} |
| 4268 |
\item Factor $3x+3y+3z$ \anskey{$3(x+y+z)$} |
| 4269 |
\item True False |
| 4270 |
\begin{enumext}[nosep] |
| 4271 |
\item $\alpha > \delta$ \anskey{False} |
| 4272 |
\item \LaTeX2e\ is cool? \anskey{Very True!} |
| 4273 |
\end{enumext} |
| 4274 |
\item Related to Linux |
| 4275 |
\begin{enumext}[nosep] |
| 4276 |
\item You use Linux? \anskey{Yes} |
| 4277 |
\item Usually uses the package manager? \anskey{Yes, \texttt{dnf}} |
| 4278 |
\item Rate the following package and class |
| 4279 |
\begin{enumext}[nosep] |
| 4280 |
\item \texttt{xsim-exam} \anskey{doesn't exist for now :(} |
| 4281 |
\item \texttt{xsim} \anskey{very good} |
| 4282 |
\item \texttt{exsheets} \anskey{obsolete} |
| 4283 |
\end{enumext} |
| 4284 |
\end{enumext} |
| 4285 |
\end{enumext} |
| 4286 |
|
| 4287 |
The answer to \ref{simplews:1} is \getkeyans{simplews:1} and the answer |
| 4288 |
to \ref{simplews:3} is \getkeyans{simplews:3}. |
| 4289 |
|
| 4290 |
\printkeyans[columns=2]{simplews} |
| 4291 |
\end{document} |
| 4292 |
\end{filecontents*} |
| 4293 |
% \iffalse |
| 4294 |
%</example> |
| 4295 |
% \fi |
| 4296 |
% |
| 4297 |
% A \emph{\enquote{simple worksheet}} using ducks :) \textattachfile[color=red,print=false]{enumext-exa-4.tex}{\faFile*[regular]}. |
| 4298 |
% |
| 4299 |
% \begin{enumext}[save-ans=simplews,columns=1,check-ans=true,nosep,save-ref=true,wrap-label={\tikz[scale=0.25]\duck[signpost=\scalebox{0.6}{#1}];}] |
| 4300 |
% \item Factor $x^{2}-2x+1$ \anskey{$\left(x-1\right)^{2}$} |
| 4301 |
% \item Factor $3x+3y+3z$ \anskey{$3(x+y+z)$} |
| 4302 |
% \item[] The following questions need to be cuaqtified :) |
| 4303 |
% \item True False |
| 4304 |
% \begin{enumext}[nosep] |
| 4305 |
% \item $\alpha > \delta$ \anskey{False} |
| 4306 |
% \item \LaTeX2e\ is cool? \anskey{Very True!} |
| 4307 |
% \end{enumext} |
| 4308 |
% \item Related to Linux |
| 4309 |
% \begin{enumext}[nosep] |
| 4310 |
% \item You use Linux? \anskey{Yes} |
| 4311 |
% \item Usually uses the package manager? \anskey{Yes, \texttt{dnf}} |
| 4312 |
% \item Rate the following package and class |
| 4313 |
% \begin{enumext}[nosep] |
| 4314 |
% \item \texttt{xsim-exam} \anskey{doesn't exist for now :(} |
| 4315 |
% \item \texttt{xsim} \anskey{very good} |
| 4316 |
% \item \texttt{exsheets} \anskey{obsolete} |
| 4317 |
% \end{enumext} |
| 4318 |
% \end{enumext} |
| 4319 |
% \end{enumext} |
| 4320 |
% |
| 4321 |
% The answer to \ref{simplews:1} is \getkeyans{simplews:1} and the answer |
| 4322 |
% to \ref{simplews:3} is \getkeyans{simplews:3}. |
| 4323 |
% |
| 4324 |
% \printkeyans[columns=2]{simplews} |
| 4325 |
% |
| 4326 |
% \subsubsection*{Example 5} |
| 4327 |
% |
| 4328 |
% \iffalse |
| 4329 |
%<*example> |
| 4330 |
% \fi |
| 4331 |
\begin{filecontents*}[overwrite]{enumext-exa-5.tex} |
| 4332 |
% arara: lualatex: { branch: developer, draft: true } |
| 4333 |
% arara: lualatex: { branch: developer, draft: true } |
| 4334 |
% arara: lualatex: { branch: developer } |
| 4335 |
% arara: clean: { extensions: [ aux, log, out] } |
| 4336 |
% arara: move: { files: [ enumext-exa-5-luamml-mathml.html ], target: 'enumext-exa-5-mathml.html' } |
| 4337 |
\DocumentMetadata{ |
| 4338 |
lang=en-US, |
| 4339 |
pdfversion=2.0, |
| 4340 |
pdfstandard=ua-2, |
| 4341 |
tagging=on, |
| 4342 |
} |
| 4343 |
\documentclass{article} |
| 4344 |
\usepackage[top=2cm,bottom=2cm,left=2cm,right=2cm]{geometry}% |
| 4345 |
\usepackage[osf]{libertinus} |
| 4346 |
\usepackage{unicode-math,xcolor,graphicx,hyperref,enumext} |
| 4347 |
\hypersetup |
| 4348 |
{ |
| 4349 |
colorlinks = true, |
| 4350 |
pdftitle = {Test tagged PDF for SAT style enumext package}, |
| 4351 |
} |
| 4352 |
\newsavebox{\satbox} |
| 4353 |
\sbox\satbox{\small\textbf{67}}% |
| 4354 |
\NewDocumentCommand \stylesat { m } |
| 4355 |
{% |
| 4356 |
\setlength{\fboxsep}{2pt}% |
| 4357 |
\raisebox{7\fboxsep}{% |
| 4358 |
\noindent\colorbox{black}{\textcolor{white}{\makebox[\dimeval{\labelwidth-2\fboxsep}][c]{\small\textbf{\vphantom{67}#1}}}}% |
| 4359 |
\colorbox{lightgray}{\phantom{\rule[-\dp\satbox]{\dimeval{\linewidth-2\fboxsep}}{\dimeval{\dp\satbox+\ht\satbox}}}}}% |
| 4360 |
} |
| 4361 |
\begin{document} |
| 4362 |
\setenumext[keyans]{label=\Alph*),nosep,below*={0.3cm}} |
| 4363 |
\begin{enumext}[mode-box,label=\arabic*,labelwidth=20pt,labelsep=0pt,columns=2,columns-sep=30pt,save-ans=stylesat, wrap-label={\stylesat{#1}}] |
| 4364 |
\item Which choice best describes what happens in the passage? |
| 4365 |
\begin{keyans} |
| 4366 |
\item* One character argues with another character who intrudes on her home. |
| 4367 |
\item One character receives a surprising request from another character. |
| 4368 |
\item One character reminisces about choices she has made over the years. |
| 4369 |
\item One character criticizes another character for pursuing an unexpected course of action. |
| 4370 |
\end{keyans} |
| 4371 |
|
| 4372 |
\item Which choice best describes what happens in the passage? |
| 4373 |
\begin{keyans} |
| 4374 |
\item One character argues with another character who intrudes on her home. |
| 4375 |
\item One character receives a surprising request from another character. |
| 4376 |
\item* One character reminisces about choices she has made over the years. |
| 4377 |
\item One character criticizes another character for pursuing an unexpected course of action. |
| 4378 |
\end{keyans} |
| 4379 |
|
| 4380 |
\item Which choice best describes what happens in the passage? |
| 4381 |
\begin{keyans} |
| 4382 |
\item One character argues with another character who intrudes on her home. |
| 4383 |
\item* One character receives a surprising request from another character. |
| 4384 |
\item One character reminisces about choices she has made over the years. |
| 4385 |
\item One character criticizes another character for pursuing an unexpected course of action. |
| 4386 |
\end{keyans} |
| 4387 |
|
| 4388 |
\item Which choice best describes what happens in the passage? |
| 4389 |
\begin{keyans} |
| 4390 |
\item One character argues with another character who intrudes on her home. |
| 4391 |
\item One character receives a surprising request from another character. |
| 4392 |
\item One character reminisces about choices she has made over the years. |
| 4393 |
\item* One character criticizes another character for pursuing an unexpected course of action. |
| 4394 |
\end{keyans} |
| 4395 |
\end{enumext} |
| 4396 |
|
| 4397 |
\printkeyans[columns=4]{stylesat} |
| 4398 |
\end{document} |
| 4399 |
\end{filecontents*} |
| 4400 |
% \iffalse |
| 4401 |
%</example> |
| 4402 |
% \fi |
| 4403 |
% |
| 4404 |
% Adapted from the response given by Stephen in \href{https://tex.stackexchange.com/a/691544}{SAT like question format} |
| 4405 |
% \textattachfile[color=red,print=false]{enumext-exa-5.tex}{\faFile*[regular]}. |
| 4406 |
% \setenumext[keyans]{label=\Alph*),font=\small,nosep,wrap-label={##1}} |
| 4407 |
% \begin{enumext}[label=\arabic*,labelwidth=20pt,labelsep=0pt,columns=2,save-ans=stylesat, wrap-label={\stylesat{#1}}] |
| 4408 |
% \item Which choice best describes what happens in the passage? |
| 4409 |
% \begin{keyans} |
| 4410 |
% \item* One character argues with another character who intrudes on her home. |
| 4411 |
% \item One character receives a surprising request from another character. |
| 4412 |
% \item One character reminisces about choices she has made over the years. |
| 4413 |
% \item One character criticizes another character for pursuing an unexpected course of action. |
| 4414 |
% \end{keyans} |
| 4415 |
% |
| 4416 |
% \item Which choice best describes what happens in the passage? |
| 4417 |
% \begin{keyans} |
| 4418 |
% \item One character argues with another character who intrudes on her home. |
| 4419 |
% \item One character receives a surprising request from another character. |
| 4420 |
% \item* One character reminisces about choices she has made over the years. |
| 4421 |
% \item One character criticizes another character for pursuing an unexpected course of action. |
| 4422 |
% \end{keyans} |
| 4423 |
% |
| 4424 |
% \item Which choice best describes what happens in the passage? |
| 4425 |
% \begin{keyans} |
| 4426 |
% \item One character argues with another character who intrudes on her home. |
| 4427 |
% \item* One character receives a surprising request from another character. |
| 4428 |
% \item One character reminisces about choices she has made over the years. |
| 4429 |
% \item One character criticizes another character for pursuing an unexpected course of action. |
| 4430 |
% \end{keyans} |
| 4431 |
% |
| 4432 |
% \item Which choice best describes what happens in the passage? |
| 4433 |
% \begin{keyans} |
| 4434 |
% \item One character argues with another character who intrudes on her home. |
| 4435 |
% \item One character receives a surprising request from another character. |
| 4436 |
% \item One character reminisces about choices she has made over the years. |
| 4437 |
% \item* One character criticizes another character for pursuing an unexpected course of action. |
| 4438 |
% \end{keyans} |
| 4439 |
% \end{enumext} |
| 4440 |
% |
| 4441 |
% \printkeyans[columns=4]{stylesat} |
| 4442 |
% |
| 4443 |
% \subsubsection*{Example 6} |
| 4444 |
% |
| 4445 |
% \iffalse |
| 4446 |
%<*example> |
| 4447 |
% \fi |
| 4448 |
\begin{filecontents*}[overwrite]{enumext-exa-6.tex} |
| 4449 |
% arara: lualatex: { branch: developer } |
| 4450 |
% arara: clean: { extensions: [ aux, log] } |
| 4451 |
\documentclass[letterpaper,twoside]{article} |
| 4452 |
\usepackage{xcolor,enumext,libertinus} |
| 4453 |
\newlength{\itemwd} |
| 4454 |
\settowidth{\itemwd}{\bfseries 10.} % max width |
| 4455 |
\NewDocumentCommand \rating { }{8.5a, KSC} |
| 4456 |
\ExplSyntaxOn |
| 4457 |
\bool_new:N \l_azetina_rating_bool |
| 4458 |
\NewDocumentCommand \showrating { m } |
| 4459 |
{ |
| 4460 |
\str_case:nn {#1} |
| 4461 |
{ |
| 4462 |
{ true } |
| 4463 |
{ |
| 4464 |
\bool_set_true:N \l_azetina_rating_bool |
| 4465 |
\setenumext{show-ans=true,save-sep={ ~ }} |
| 4466 |
} |
| 4467 |
{ false } |
| 4468 |
{ |
| 4469 |
\bool_set_false:N \l_azetina_rating_bool |
| 4470 |
\setenumext{show-ans=false,save-sep={ ~ }} |
| 4471 |
} |
| 4472 |
} |
| 4473 |
} |
| 4474 |
\NewDocumentCommand \myans { m +m } |
| 4475 |
{ |
| 4476 |
\bool_if:NTF \l_azetina_rating_bool |
| 4477 |
{ |
| 4478 |
\item*[(#1)] \textcolor{red}{#2} |
| 4479 |
} |
| 4480 |
{ |
| 4481 |
\item*[(#1)] \textcolor{black}{#2} |
| 4482 |
} |
| 4483 |
} |
| 4484 |
\NewDocumentCommand \azwrapp { m } |
| 4485 |
{ |
| 4486 |
\bool_if:NTF \l_azetina_rating_bool |
| 4487 |
{ |
| 4488 |
\makebox[\dim_eval:n{\marginparwidth}][r] |
| 4489 |
{ |
| 4490 |
\textcolor{red}{\bfseries\footnotesize\rating} |
| 4491 |
} |
| 4492 |
\hspace{\marginparsep}\textbf{#1} |
| 4493 |
} |
| 4494 |
{ |
| 4495 |
\makebox[\dim_eval:n{\marginparwidth+\marginparsep}][l]{ }\textbf{#1} |
| 4496 |
} |
| 4497 |
} |
| 4498 |
\ExplSyntaxOff |
| 4499 |
\setenumextmeta[1]{azetinasty}{label={\arabic*.},labelwidth={\marginparwidth+\marginparsep+\itemwd},list-offset={-\marginparwidth-\marginparsep},} |
| 4500 |
\setenumext[keyans]{ |
| 4501 |
label={\Alph*}, |
| 4502 |
font={\bfseries}, |
| 4503 |
wrap-ans*={\textcolor{red}{\bfseries##1}}, |
| 4504 |
mark-ans*={\textcolor{red}{✔}}, |
| 4505 |
wrap-opt={ }, |
| 4506 |
} |
| 4507 |
\begin{document} |
| 4508 |
|
| 4509 |
\showrating{true} |
| 4510 |
\begin{enumext}[azetinasty,start=10,wrap-label={\azwrapp{#1}},save-ans=test2024] |
| 4511 |
\item sample |
| 4512 |
\begin{keyans} |
| 4513 |
\item sample |
| 4514 |
%\item*[(8.5a, KSC)] answer |
| 4515 |
\myans{8.5a, KSC}{answer} |
| 4516 |
\item sample |
| 4517 |
\item sample |
| 4518 |
\end{keyans} |
| 4519 |
% Renew \rating here |
| 4520 |
\RenewDocumentCommand \rating { }{9.5a, KSC} |
| 4521 |
\item sample |
| 4522 |
\begin{keyans} |
| 4523 |
\item sample |
| 4524 |
\item sample |
| 4525 |
\item sample |
| 4526 |
%\item*[(9.5a, KSC)] answer |
| 4527 |
\myans{9.5a, KSC}{answer} |
| 4528 |
\end{keyans} |
| 4529 |
\end{enumext} |
| 4530 |
\showrating{false} |
| 4531 |
\RenewDocumentCommand \rating { }{10.5a, KSC} |
| 4532 |
\begin{enumext}[save-ans=test2024,resume*] |
| 4533 |
\item sample |
| 4534 |
\begin{keyans} |
| 4535 |
\item sample |
| 4536 |
%\item*[(10.5a, KSC)] answer |
| 4537 |
\myans{10.5a, KSC}{answer} |
| 4538 |
\item sample |
| 4539 |
\item sample |
| 4540 |
\end{keyans} |
| 4541 |
% Renew \rating here |
| 4542 |
\RenewDocumentCommand \rating { }{11.5a, KSC} |
| 4543 |
\item sample |
| 4544 |
\begin{keyans} |
| 4545 |
\item sample |
| 4546 |
\item sample |
| 4547 |
\item sample |
| 4548 |
%\item*[(11.5a, KSC)] answer |
| 4549 |
\myans{11.5a, KSC}{answer} |
| 4550 |
\end{keyans} |
| 4551 |
\end{enumext} |
| 4552 |
\printkeyans[start=10]{test2024} |
| 4553 |
\end{document} |
| 4554 |
\end{filecontents*} |
| 4555 |
% \iffalse |
| 4556 |
%</example> |
| 4557 |
% \fi |
| 4558 |
% |
| 4559 |
% Adapted from the response to \href{https://tex.stackexchange.com/q/728584}{Environment for enumerate environment} |
| 4560 |
% \textattachfile[color=red,print=false]{enumext-exa-6.tex}{\faFile*[regular]}. |
| 4561 |
% \setenumext[keyans]{label={\Alph*},font={\bfseries},wrap-ans*={\textcolor{red}{\bfseries##1}},mark-ans*={\textcolor{red}{✔}},wrap-opt={ },save-sep={ }} |
| 4562 |
% \showrating{true} |
| 4563 |
% \begin{enumext}[azetinasty,start=10,wrap-label={\azwrapp{#1}},save-ans=test2024] |
| 4564 |
% \item sample |
| 4565 |
% \begin{keyans} |
| 4566 |
% \item sample |
| 4567 |
% \item*[(8.5a, KSC)] answer |
| 4568 |
% \item sample |
| 4569 |
% \item sample |
| 4570 |
% \end{keyans} |
| 4571 |
% \RenewDocumentCommand \rating { }{9.5a, KSC} |
| 4572 |
% \item sample |
| 4573 |
% \begin{keyans} |
| 4574 |
% \item sample |
| 4575 |
% \item sample |
| 4576 |
% \item sample |
| 4577 |
% \item*[(9.5a, KSC)] answer |
| 4578 |
% \end{keyans} |
| 4579 |
% \end{enumext} |
| 4580 |
% \showrating{false} |
| 4581 |
% \RenewDocumentCommand \rating { }{10.5a, KSC} |
| 4582 |
% \begin{enumext}[save-ans=test2024,resume*] |
| 4583 |
% \item sample |
| 4584 |
% \begin{keyans} |
| 4585 |
% \item sample |
| 4586 |
% \item*[(10.5a, KSC)] answer |
| 4587 |
% \item sample |
| 4588 |
% \item sample |
| 4589 |
% \end{keyans} |
| 4590 |
% \RenewDocumentCommand \rating { }{11.5a, KSC} |
| 4591 |
% \item sample |
| 4592 |
% \begin{keyans} |
| 4593 |
% \item sample |
| 4594 |
% \item sample |
| 4595 |
% \item sample |
| 4596 |
% \item*[(11.5a, KSC)] answer |
| 4597 |
% \end{keyans} |
| 4598 |
% \end{enumext} |
| 4599 |
% \printkeyans[start=10]{test2024} |
| 4600 |
% |
| 4601 |
% \section{Tagged PDF examples} |
| 4602 |
% |
| 4603 |
% This section is just to show the compatibility of \mypkg*{enumext} with |
| 4604 |
% \emph{tagged} \texttt{PDF} using |lualatex|. The attached files here |
| 4605 |
% are just for testing and are intended as examples and, in a way, to |
| 4606 |
% simplify the time of Matthew Bertucci (\texttt{@mbertucci}) when he sees this |
| 4607 |
% excellent package and adds it to \href{https://github.com/latex3/tagging-project}{The LaTeX Tagged PDF repository}. |
| 4608 |
% |
| 4609 |
% \smallskip |
| 4610 |
% |
| 4611 |
% To compile the tests with |lualatex-dev| the packages \mypkg{multicol}, |
| 4612 |
% \mypkg{unicode-math}, \mypkg{geometry}, \mypkg{graphicx}, \mypkg{luamml} |
| 4613 |
% and \mypkg{hyperref} are required along with the line: |
| 4614 |
% |
| 4615 |
% \smallskip |
| 4616 |
% |
| 4617 |
% \iffalse |
| 4618 |
%<*example> |
| 4619 |
% \fi |
| 4620 |
\begin{examplecode}[frame=single] |
| 4621 |
\DocumentMetadata{lang = en-US, pdfversion = 2.0, pdfstandard = `\mydim{ua-2}`, tagging=on,} |
| 4622 |
\end{examplecode} |
| 4623 |
% \iffalse |
| 4624 |
%</example> |
| 4625 |
% \fi |
| 4626 |
% |
| 4627 |
% \smallskip |
| 4628 |
% |
| 4629 |
% \begin{important} |
| 4630 |
% All examples have been checked using \href{https://dev.verapdf-rest.duallab.com}{\texttt{veraPDF}} |
| 4631 |
% together with \href{https://ngpdf.com}{\texttt{ngpdf}}. |
| 4632 |
% \end{important} |
| 4633 |
% |
| 4634 |
% \iffalse |
| 4635 |
%<*example> |
| 4636 |
% \fi |
| 4637 |
\begin{filecontents*}[overwrite]{enumext-01.tex} |
| 4638 |
% arara: lualatex: { branch: developer, draft: true } |
| 4639 |
% arara: lualatex: { branch: developer, draft: true } |
| 4640 |
% arara: lualatex: { branch: developer } |
| 4641 |
% arara: clean: { extensions: [ aux, log, out] } |
| 4642 |
% arara: move: { files: [ enumext-01-luamml-mathml.html ], target: 'enumext-01-mathml.html' } |
| 4643 |
\DocumentMetadata |
| 4644 |
{ |
| 4645 |
lang=en-US, |
| 4646 |
pdfversion=2.0, |
| 4647 |
pdfstandard=ua-2, |
| 4648 |
tagging=on, |
| 4649 |
} |
| 4650 |
\documentclass{article} |
| 4651 |
\usepackage[top=2cm,bottom=2cm,left=1cm,right=1cm]{geometry} |
| 4652 |
\usepackage{unicode-math,hyperref,enumext} |
| 4653 |
\hypersetup |
| 4654 |
{ |
| 4655 |
colorlinks = true, |
| 4656 |
pdftitle = {Test tagged PDF for enumext package}, |
| 4657 |
} |
| 4658 |
\begin{document} |
| 4659 |
\section{only enumext} |
| 4660 |
Some text here |
| 4661 |
|
| 4662 |
\begin{enumext}[labelwidth=1cm,labelsep=0.25cm,align=left, wrap-label=\textbf{(#1}, label=\arabic*.)] |
| 4663 |
\item This text is in the first level.\label{A} |
| 4664 |
\begin{enumext} |
| 4665 |
\item This text is in the second level.\footnote{foot note in enumext} |
| 4666 |
\begin{enumext} |
| 4667 |
\item This text is in the third level. |
| 4668 |
\begin{enumext} |
| 4669 |
\item This text is in the fourth level.\footnotemark[20] |
| 4670 |
\end{enumext} |
| 4671 |
\end{enumext} |
| 4672 |
\end{enumext} |
| 4673 |
\item[X] This text is in the first level. |
| 4674 |
\item* This text is in the first level. |
| 4675 |
\end{enumext} |
| 4676 |
|
| 4677 |
Some ref here \ref{A}\footnotetext[20]{foot note in enumext [20]} |
| 4678 |
|
| 4679 |
\section{only enumext*} |
| 4680 |
|
| 4681 |
Some text here |
| 4682 |
|
| 4683 |
\begin{enumext*}[columns=2,labelwidth=1cm,labelsep=0.25cm,align=left, wrap-label=\textbf{#1)}, label=(\arabic*.] |
| 4684 |
\item This text is in the first level.\label{B} |
| 4685 |
\item[X] This text is in the first level.\footnotemark[30] |
| 4686 |
\item* This text is in the first level.\footnote{foot note in enumext*} |
| 4687 |
\item This text is in the first level. |
| 4688 |
\end{enumext*} |
| 4689 |
|
| 4690 |
Some ref here \ref{B}\footnotetext[30]{foot note in enumext* [30]} |
| 4691 |
|
| 4692 |
\section{enumext nested in enumext*} |
| 4693 |
|
| 4694 |
Some text here |
| 4695 |
|
| 4696 |
\begin{enumext*} |
| 4697 |
\item This text is in the first level.\label{C} |
| 4698 |
\item \begin{enumext}[base-fix] |
| 4699 |
\item This text is in nested enumext.\label{D}\footnote{foot note in neseted enumext} |
| 4700 |
\item This text is in nested enumext.\footnotemark[40] |
| 4701 |
\end{enumext} |
| 4702 |
\item This text is in the first level. |
| 4703 |
\end{enumext*} |
| 4704 |
|
| 4705 |
Some refs here \ref{C} and \ref{D} \footnotetext[40]{foot note in neseted enumext [40]} |
| 4706 |
|
| 4707 |
\section{enumext* nested in enumext} |
| 4708 |
|
| 4709 |
\begin{enumext} |
| 4710 |
\item This text is in the first level. \label{E} |
| 4711 |
\item \begin{enumext*}[label=\roman*.] |
| 4712 |
\item This text is in nested enumext*.\label{F}\footnotemark[50] |
| 4713 |
\item This text is in nested enumext*.\footnote{foot note in neseted enumext*} |
| 4714 |
\end{enumext*} |
| 4715 |
\item This text is in the first level. |
| 4716 |
\end{enumext} |
| 4717 |
|
| 4718 |
Some refs here \ref{E} and \ref{F} \footnotetext[50]{foot note in neseted enumext* [50]} |
| 4719 |
|
| 4720 |
\section{Custom ref} |
| 4721 |
|
| 4722 |
\begin{enumext}[ref={enumext-level-\arabic*}] |
| 4723 |
\item This text is in the first level. \label{G} |
| 4724 |
\item \begin{enumext*}[label=\roman*., ref={nested-\arabic{enumXi}.\roman*}] |
| 4725 |
\item This text is in nested enumext*.\label{H} |
| 4726 |
\item This text is in nested enumext*. |
| 4727 |
\end{enumext*} |
| 4728 |
\item This text is in the first level. |
| 4729 |
\end{enumext} |
| 4730 |
|
| 4731 |
Some refs here \ref{G} and \ref{H} |
| 4732 |
\end{document} |
| 4733 |
\end{filecontents*} |
| 4734 |
\IfFileExists{enumext-01.pdf}{}{\ShellEscape{arara enumext-01.tex}} |
| 4735 |
% \iffalse |
| 4736 |
%</example> |
| 4737 |
% \fi |
| 4738 |
% |
| 4739 |
% \iffalse |
| 4740 |
%<*example> |
| 4741 |
% \fi |
| 4742 |
\begin{filecontents*}[overwrite]{enumext-02.tex} |
| 4743 |
% arara: lualatex: { branch: developer, draft: true } |
| 4744 |
% arara: lualatex: { branch: developer } |
| 4745 |
% arara: clean: { extensions: [ aux, log, out] } |
| 4746 |
% arara: move: { files: [ enumext-02-luamml-mathml.html ], target: 'enumext-02-mathml.html' } |
| 4747 |
\DocumentMetadata |
| 4748 |
{ |
| 4749 |
lang=en-US, |
| 4750 |
pdfversion=2.0, |
| 4751 |
pdfstandard=ua-2, |
| 4752 |
tagging=on, |
| 4753 |
} |
| 4754 |
\documentclass{article} |
| 4755 |
\usepackage[top=2cm,bottom=2cm,left=1cm,right=1cm]{geometry} |
| 4756 |
\usepackage{unicode-math,hyperref,enumext} |
| 4757 |
\hypersetup |
| 4758 |
{ |
| 4759 |
colorlinks = true, |
| 4760 |
pdftitle = {Test tagged PDF for enumext package}, |
| 4761 |
} |
| 4762 |
\begin{document} |
| 4763 |
\section{enumext + multicols} |
| 4764 |
Some text here |
| 4765 |
|
| 4766 |
\begin{enumext}[columns=2, labelwidth=1cm,labelsep=0.25cm,align=left, wrap-label=\textbf{(#1}, label=\arabic*.),partopsep=0.5cm] |
| 4767 |
\item This text is in the first level. |
| 4768 |
\item This text is in the first level. |
| 4769 |
\item This text is in the first level. |
| 4770 |
\item This text is in the first level. |
| 4771 |
\item[X] This text is in the first level. |
| 4772 |
\item* This text is in the first level. |
| 4773 |
\end{enumext} |
| 4774 |
|
| 4775 |
Some text here |
| 4776 |
|
| 4777 |
\section{enumext + minipage} |
| 4778 |
|
| 4779 |
Some text here |
| 4780 |
|
| 4781 |
\begin{enumext}[labelwidth=1cm,labelsep=0.25cm,align=left,partopsep=0.5cm,mini-env=0.4\linewidth] |
| 4782 |
\item This text is in the first level. |
| 4783 |
\item This text is in the first level. |
| 4784 |
\item This text is in the first level. |
| 4785 |
\item This text is in the first level. |
| 4786 |
\miniright |
| 4787 |
This text is in minipage. |
| 4788 |
\end{enumext} |
| 4789 |
|
| 4790 |
\section{enumext + minipage + multicols} |
| 4791 |
|
| 4792 |
Some text here |
| 4793 |
|
| 4794 |
\begin{enumext}[columns=2,labelwidth=1cm,labelsep=0.25cm,align=left,partopsep=0.5cm,mini-env=0.4\linewidth] |
| 4795 |
\item This text is in the first level. |
| 4796 |
\item This text is in the first level. |
| 4797 |
\item This text is in the first level. |
| 4798 |
\item This text is in the first level. |
| 4799 |
\miniright |
| 4800 |
This text is in minipage. |
| 4801 |
\end{enumext} |
| 4802 |
|
| 4803 |
Some text here |
| 4804 |
|
| 4805 |
\section{enumext* + minipage} |
| 4806 |
|
| 4807 |
Some text here |
| 4808 |
|
| 4809 |
\begin{enumext*}[columns=2,labelwidth=1cm,labelsep=0.25cm,align=left,partopsep=0.5cm,mini-env=0.4\linewidth, mini-right = {This text is in minipage.}] |
| 4810 |
\item This text is in the first level. |
| 4811 |
\item This text is in the first level. |
| 4812 |
\item This text is in the first level. |
| 4813 |
\item This text is in the first level. |
| 4814 |
\end{enumext*} |
| 4815 |
\end{document} |
| 4816 |
\end{filecontents*} |
| 4817 |
\IfFileExists{enumext-02.pdf}{}{\ShellEscape{arara enumext-02.tex}} |
| 4818 |
% \iffalse |
| 4819 |
%</example> |
| 4820 |
% \fi |
| 4821 |
% |
| 4822 |
% \iffalse |
| 4823 |
%<*example> |
| 4824 |
% \fi |
| 4825 |
\begin{filecontents*}[overwrite]{enumext-03.tex} |
| 4826 |
% arara: lualatex: { branch: developer, draft: true } |
| 4827 |
% arara: lualatex: { branch: developer, draft: true } |
| 4828 |
% arara: lualatex: { branch: developer } |
| 4829 |
% arara: clean: { extensions: [ aux, log, out] } |
| 4830 |
% arara: move: { files: [ enumext-03-luamml-mathml.html ], target: 'enumext-03-mathml.html' } |
| 4831 |
\DocumentMetadata |
| 4832 |
{ |
| 4833 |
lang=en-US, |
| 4834 |
pdfversion=2.0, |
| 4835 |
pdfstandard=ua-2, |
| 4836 |
tagging=on, |
| 4837 |
} |
| 4838 |
\documentclass{article} |
| 4839 |
\usepackage[top=2cm,bottom=2cm,left=1cm,right=1cm]{geometry} |
| 4840 |
\usepackage{unicode-math,graphicx,hyperref,enumext} |
| 4841 |
\hypersetup |
| 4842 |
{ |
| 4843 |
colorlinks = true, |
| 4844 |
pdftitle = {Test tagged PDF for enumext package}, |
| 4845 |
} |
| 4846 |
\begin{document} |
| 4847 |
\section{enumext+keyanspic} |
| 4848 |
|
| 4849 |
Some text here |
| 4850 |
|
| 4851 |
\begin{enumext}[save-ans=test,save-sep={ },save-ref = true] |
| 4852 |
\item Question with images. |
| 4853 |
\begin{keyanspic}[layout-sty={3,2}] |
| 4854 |
\anspic{\includegraphics[scale=0.30, alt={Un pato de color amarillo}]{example-image-duck}} |
| 4855 |
\anspic{\includegraphics[scale=0.15, alt={Una letra mayuscula A}]{example-image-a}} |
| 4856 |
\anspic*{\includegraphics[scale=0.15, alt={Una letra mayuscula B}]{example-image-b}} |
| 4857 |
\anspic{\includegraphics[scale=0.15, alt={Una letra mayuscula C}]{example-image-c}} |
| 4858 |
\anspic{\includegraphics[scale=0.15, alt={La palabra Image}]{example-image}} |
| 4859 |
\end{keyanspic} |
| 4860 |
\item Question with images.\label{dos} |
| 4861 |
\begin{keyanspic}[label-pos=above, layout-sty={3,2}] |
| 4862 |
\anspic{\includegraphics[scale=0.15, alt={Una letra mayuscula A}]{example-image-a}} |
| 4863 |
\anspic{\includegraphics[scale=0.15, alt={Una letra mayuscula B}]{example-image-b}} |
| 4864 |
\anspic{\includegraphics[scale=0.15, alt={Una letra mayuscula C}]{example-image-c}} |
| 4865 |
\anspic{\includegraphics[scale=0.15, alt={La palabra Image}]{example-image}} |
| 4866 |
\anspic*[A duck]{\includegraphics[scale=0.30, alt={Un pato de color amarillo}]{example-image-duck}} |
| 4867 |
\end{keyanspic} |
| 4868 |
\item Question with images. |
| 4869 |
\begin{keyanspic} |
| 4870 |
\anspic*[La letra A]{\includegraphics[scale=0.15, alt={Una letra mayuscula A}]{example-image-a}} |
| 4871 |
\anspic{\includegraphics[scale=0.15, alt={Una letra mayuscula B}]{example-image-b}} |
| 4872 |
\anspic{\includegraphics[scale=0.30, alt={Un pato de color amarillo}]{example-image-duck}} |
| 4873 |
\anspic{\includegraphics[scale=0.15, alt={Una letra mayuscula C}]{example-image-c}} |
| 4874 |
\anspic{\includegraphics[scale=0.15, alt={La palabra Image}]{example-image}} |
| 4875 |
\end{keyanspic} |
| 4876 |
\item Question with images. |
| 4877 |
\begin{keyanspic}[label-pos=above] |
| 4878 |
\anspic{\includegraphics[scale=0.30, alt={Un pato de color amarillo}]{example-image-duck}} |
| 4879 |
\anspic{\includegraphics[scale=0.15, alt={Una letra mayuscula A}]{example-image-a}} |
| 4880 |
\anspic*{\includegraphics[scale=0.15, alt={Una letra mayuscula B}]{example-image-b}} |
| 4881 |
\anspic{\includegraphics[scale=0.15, alt={Una letra mayuscula C}]{example-image-c}} |
| 4882 |
\anspic{\includegraphics[scale=0.15, alt={La palabra Image}]{example-image}} |
| 4883 |
\end{keyanspic} |
| 4884 |
\end{enumext} |
| 4885 |
|
| 4886 |
The answer to question \ref{dos} is \getkeyans{test:2} |
| 4887 |
|
| 4888 |
\printkeyans*{test} |
| 4889 |
\end{document} |
| 4890 |
\end{filecontents*} |
| 4891 |
\IfFileExists{enumext-03.pdf}{}{\ShellEscape{arara enumext-03.tex}} |
| 4892 |
% \iffalse |
| 4893 |
%</example> |
| 4894 |
% \fi |
| 4895 |
% |
| 4896 |
% \iffalse |
| 4897 |
%<*example> |
| 4898 |
% \fi |
| 4899 |
\begin{filecontents*}[overwrite]{enumext-04.tex} |
| 4900 |
% arara: lualatex: { branch: developer, draft: true } |
| 4901 |
% arara: lualatex: { branch: developer, draft: true } |
| 4902 |
% arara: lualatex: { branch: developer } |
| 4903 |
% arara: clean: { extensions: [ aux, log, out] } |
| 4904 |
% arara: move: { files: [ enumext-04-luamml-mathml.html ], target: 'enumext-04-mathml.html' } |
| 4905 |
\listfiles |
| 4906 |
\DocumentMetadata |
| 4907 |
{ |
| 4908 |
lang=en-US, |
| 4909 |
pdfversion=2.0, |
| 4910 |
pdfstandard=ua-2, |
| 4911 |
tagging=on, |
| 4912 |
} |
| 4913 |
\documentclass{article} |
| 4914 |
\usepackage[top=2cm,bottom=2cm,left=1cm,right=1cm]{geometry} |
| 4915 |
\usepackage{unicode-math,graphicx,hyperref,enumext} |
| 4916 |
\hypersetup |
| 4917 |
{ |
| 4918 |
colorlinks = true, |
| 4919 |
pdftitle = {Test tagged PDF for enumext package}, |
| 4920 |
} |
| 4921 |
\begin{document} |
| 4922 |
\section{enumext + anskey + anskey*} |
| 4923 |
|
| 4924 |
Some text here |
| 4925 |
|
| 4926 |
\begin{enumext}[save-ans=test,save-sep={ },save-ref = true] |
| 4927 |
\item Question A. \anskey{Answer A} |
| 4928 |
\item Question B. \anskey{Answer B} |
| 4929 |
\item Question C. |
| 4930 |
\begin{anskey*} |
| 4931 |
Answer with \verb+code+ and more |
| 4932 |
\begin{verbatim} |
| 4933 |
Some code here |
| 4934 |
\end{verbatim} |
| 4935 |
And text |
| 4936 |
\end{anskey*} |
| 4937 |
\end{enumext} |
| 4938 |
|
| 4939 |
The answer to question \ref{test:2} is \getkeyans{test:2} |
| 4940 |
|
| 4941 |
\printkeyans*{test} |
| 4942 |
|
| 4943 |
\section{enumext* + anskey + anskey*} |
| 4944 |
|
| 4945 |
Some text here |
| 4946 |
|
| 4947 |
\begin{enumext*}[save-ans=test-2,save-sep={ },save-ref = true] |
| 4948 |
\item Question A. \anskey{Answer A} |
| 4949 |
\item Question B. \anskey{Answer B} |
| 4950 |
\item Question C. |
| 4951 |
\begin{anskey*} |
| 4952 |
Answer with \verb+code+ and more |
| 4953 |
\begin{verbatim} |
| 4954 |
Some code here |
| 4955 |
\end{verbatim} |
| 4956 |
And text |
| 4957 |
\end{anskey*} |
| 4958 |
\end{enumext*} |
| 4959 |
|
| 4960 |
\printkeyans{test-2} |
| 4961 |
\end{document} |
| 4962 |
\end{filecontents*} |
| 4963 |
\IfFileExists{enumext-04.pdf}{}{\ShellEscape{arara enumext-04.tex}} |
| 4964 |
% \iffalse |
| 4965 |
%</example> |
| 4966 |
% \fi |
| 4967 |
% |
| 4968 |
% \iffalse |
| 4969 |
%<*example> |
| 4970 |
% \fi |
| 4971 |
\begin{filecontents*}[overwrite]{enumext-05.tex} |
| 4972 |
% arara: lualatex: { branch: developer, draft: true } |
| 4973 |
% arara: lualatex: { branch: developer, draft: true } |
| 4974 |
% arara: lualatex: { branch: developer } |
| 4975 |
% arara: clean: { extensions: [ aux, log, out] } |
| 4976 |
% arara: move: { files: [ enumext-05-luamml-mathml.html ], target: 'enumext-05-mathml.html' } |
| 4977 |
\DocumentMetadata{ |
| 4978 |
lang=en-US, |
| 4979 |
pdfversion=2.0, |
| 4980 |
pdfstandard=ua-2, |
| 4981 |
tagging=on, |
| 4982 |
} |
| 4983 |
\documentclass{article} |
| 4984 |
\usepackage[top=2cm,bottom=2cm,left=1cm,right=1cm]{geometry} |
| 4985 |
\usepackage{unicode-math,graphicx,hyperref,enumext} |
| 4986 |
\hypersetup |
| 4987 |
{ |
| 4988 |
colorlinks = true, |
| 4989 |
pdftitle = {Test tagged PDF for enumext package}, |
| 4990 |
} |
| 4991 |
\setenumext[print,1]{columns=2, columns-sep=1cm, font=\bfseries} |
| 4992 |
\setenumext[print*]{columns=2, columns-sep=1cm,first=\bfseries} |
| 4993 |
\setenumext[enumext,1]{columns=2,nosep,save-ref=true,save-sep={ },wrap-opt=\fbox{##1}, show-ans=true} |
| 4994 |
\setenumext[keyans]{columns=2,noitemsep} |
| 4995 |
\setenumext[keyans*]{columns=2,noitemsep} |
| 4996 |
\setenumextmeta[2]{myroman}{no-store, label=\Roman*., noitemsep} |
| 4997 |
\setenumextmeta[2]{myarabic}{no-store,list-offset=0.5cm,label=(\arabic*),noitemsep} |
| 4998 |
\begin{document} |
| 4999 |
\section{The enumext package in action} |
| 5000 |
|
| 5001 |
\begin{enumext}[save-ans=mytest] |
| 5002 |
\item First type of questions |
| 5003 |
\begin{keyans*} |
| 5004 |
\item value |
| 5005 |
\item*[$x=5$] correct |
| 5006 |
\item value |
| 5007 |
\item value |
| 5008 |
\end{keyans*} |
| 5009 |
\item Second type of questions |
| 5010 |
\begin{enumext}[myroman] |
| 5011 |
\item $2\alpha+2\delta=90^{\circ}$ |
| 5012 |
\item $\alpha=\delta$ |
| 5013 |
\item $\angle EDF=45^{\circ}$ |
| 5014 |
\end{enumext} |
| 5015 |
\begin{keyans} |
| 5016 |
\item I only |
| 5017 |
\item II only |
| 5018 |
\item I and II only |
| 5019 |
\item* I and III only |
| 5020 |
\item I, II, and III |
| 5021 |
\end{keyans} |
| 5022 |
\item* Third type of questions |
| 5023 |
\begin{enumext}[myarabic] |
| 5024 |
\item $2\alpha+2\delta=90^{\circ}$ |
| 5025 |
\item $\angle EDF=45^{\circ}$ |
| 5026 |
\end{enumext} |
| 5027 |
\begin{keyans} |
| 5028 |
\item value |
| 5029 |
\item value |
| 5030 |
\item*[some note $y$] value |
| 5031 |
\item value |
| 5032 |
\item value |
| 5033 |
\end{keyans} |
| 5034 |
\item Question with image and label above: |
| 5035 |
\begin{keyanspic}[label-pos=above, layout-sty={3,2}] |
| 5036 |
\anspic*[La letra A]{\includegraphics[scale=0.15, alt={Una letra mayuscula A}]{example-image-a}} |
| 5037 |
\anspic{\includegraphics[scale=0.15, alt={Una letra mayuscula B}]{example-image-b}} |
| 5038 |
\anspic{\includegraphics[scale=0.30, alt={Un pato de color amarillo}]{example-image-duck}} |
| 5039 |
\anspic{\includegraphics[scale=0.15, alt={Una letra mayuscula C}]{example-image-c}} |
| 5040 |
\anspic{\includegraphics[scale=0.15, alt={La palabra Image}]{example-image}} |
| 5041 |
\end{keyanspic} |
| 5042 |
\item A question |
| 5043 |
\begin{keyans}[mini-env=0.5\linewidth, columns=1] |
| 5044 |
\item value |
| 5045 |
\item value |
| 5046 |
\item value |
| 5047 |
\item*[other note] correct |
| 5048 |
\item value |
| 5049 |
\miniright |
| 5050 |
\includegraphics[scale=0.15,alt={Una letra mayuscula B}]{example-image-b} |
| 5051 |
\end{keyans} |
| 5052 |
\item Question with image on left side: \anskey[item-star]{Mucak} |
| 5053 |
\end{enumext} |
| 5054 |
|
| 5055 |
Some text here |
| 5056 |
\section{printkeyans} |
| 5057 |
Some text here |
| 5058 |
|
| 5059 |
\printkeyans{mytest} |
| 5060 |
|
| 5061 |
\section{printkeyans*} |
| 5062 |
Some text here |
| 5063 |
|
| 5064 |
\printkeyans*{mytest} |
| 5065 |
|
| 5066 |
\section{foreachkeyans} |
| 5067 |
Some text here |
| 5068 |
|
| 5069 |
\foreachkeyans[sep={\par}]{mytest} |
| 5070 |
|
| 5071 |
Some text here |
| 5072 |
\end{document} |
| 5073 |
\end{filecontents*} |
| 5074 |
\IfFileExists{enumext-05.pdf}{}{\ShellEscape{arara enumext-05.tex}} |
| 5075 |
% \iffalse |
| 5076 |
%</example> |
| 5077 |
% \fi |
| 5078 |
% |
| 5079 |
% |
| 5080 |
% \iffalse |
| 5081 |
%<*example> |
| 5082 |
% \fi |
| 5083 |
\begin{filecontents*}[overwrite]{enumext-06.tex} |
| 5084 |
% arara: lualatex: { branch: developer, draft: true } |
| 5085 |
% arara: lualatex: { branch: developer, draft: true } |
| 5086 |
% arara: lualatex: { branch: developer } |
| 5087 |
% arara: clean: { extensions: [ aux, log, out] } |
| 5088 |
% arara: move: { files: [ enumext-06-luamml-mathml.html ], target: 'enumext-06-mathml.html' } |
| 5089 |
\DocumentMetadata |
| 5090 |
{ |
| 5091 |
lang=en-US, |
| 5092 |
pdfversion=2.0, |
| 5093 |
pdfstandard=ua-2, |
| 5094 |
tagging=on, |
| 5095 |
} |
| 5096 |
\documentclass{article} |
| 5097 |
\usepackage[top=2cm,bottom=2cm,left=3cm,right=3cm]{geometry} |
| 5098 |
\usepackage{unicode-math,graphicx,hyperref,enumext} |
| 5099 |
\hypersetup |
| 5100 |
{ |
| 5101 |
colorlinks = true, |
| 5102 |
pdftitle = {Test tagged PDF for enumext package}, |
| 5103 |
} |
| 5104 |
\newlength{\descitemwd} |
| 5105 |
\NewDocumentCommand \labelbx { s +m } |
| 5106 |
{% |
| 5107 |
\SuspendTagging{\parbox}% |
| 5108 |
\IfBooleanTF{#1}% |
| 5109 |
{\strut\smash{\parbox[t]{\labelwidth}{\raggedright{#2}}}}% |
| 5110 |
{\strut\smash{\parbox[t]{\labelwidth}{\raggedleft{#2}}}}% |
| 5111 |
\ResumeTagging{\parbox} |
| 5112 |
} |
| 5113 |
\begin{document} |
| 5114 |
|
| 5115 |
\section{Fake \texttt{itemize} environment} |
| 5116 |
|
| 5117 |
\noindent\begin{minipage}[t]{0.45\linewidth} |
| 5118 |
\begin{enumext}[nosep, label=\textbullet] |
| 5119 |
\item First level item |
| 5120 |
\begin{enumext}[nosep,label=\normalfont\bfseries\textendash] |
| 5121 |
\item Second level item |
| 5122 |
\begin{enumext}[nosep,label=\textasteriskcentered] |
| 5123 |
\item Third level item |
| 5124 |
\begin{enumext}[nosep,label=\textperiodcentered] |
| 5125 |
\item Fourth level item |
| 5126 |
\end{enumext} |
| 5127 |
\end{enumext} |
| 5128 |
\end{enumext} |
| 5129 |
\item First level item |
| 5130 |
\end{enumext} |
| 5131 |
\end{minipage}\hfill |
| 5132 |
\begin{minipage}[t]{0.45\linewidth} |
| 5133 |
\begin{enumext}[nosep, label=$\ast$] |
| 5134 |
\item First level item |
| 5135 |
\begin{enumext}[nosep,label=$\diamond$] |
| 5136 |
\item Second level item |
| 5137 |
\begin{enumext}[nosep,label=$\circ$] |
| 5138 |
\item Third level item |
| 5139 |
\begin{enumext}[nosep,label=$\star$] |
| 5140 |
\item Fourth level item |
| 5141 |
\end{enumext} |
| 5142 |
\end{enumext} |
| 5143 |
\end{enumext} |
| 5144 |
\item First level item |
| 5145 |
\end{enumext} |
| 5146 |
\end{minipage} |
| 5147 |
|
| 5148 |
\section{Fake \texttt{description} environment} |
| 5149 |
|
| 5150 |
\settowidth{\descitemwd}{\textbf{Something long}} |
| 5151 |
\begin{enumext}[label={},labelwidth=\descitemwd,font=\bfseries,noitemsep,topsep=3pt] |
| 5152 |
\item[SomeThing] A short one-line description. |
| 5153 |
\item[] This is an entry \emph{without} a label. |
| 5154 |
\item[Something] A short \emph{one-line} description text. |
| 5155 |
\item[Something long] A much \emph{longer} description text may take |
| 5156 |
more than one line or more than one paragraph. |
| 5157 |
|
| 5158 |
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod |
| 5159 |
tempor incididunt ut labore et dolore magna aliqua. |
| 5160 |
\end{enumext} |
| 5161 |
|
| 5162 |
\begin{enumext*}[label={},labelwidth=\descitemwd,font=\bfseries,noitemsep,topsep=3pt] |
| 5163 |
\item[SomeThing] A short one-line description. |
| 5164 |
\item[] This is an entry \emph{without} a label. |
| 5165 |
\item[Something] A short \emph{one-line} description text. |
| 5166 |
\item[Something long] A much \emph{longer} description text may take |
| 5167 |
more than one line or more than one paragraph. |
| 5168 |
|
| 5169 |
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod |
| 5170 |
tempor incididunt ut labore et dolore magna aliqua. |
| 5171 |
\end{enumext*} |
| 5172 |
|
| 5173 |
\begin{enumext}[label={},labelwidth=\descitemwd,list-indent=0pt,font=\bfseries,noitemsep,topsep=3pt] |
| 5174 |
\item[SomeThing] A short one-line description. |
| 5175 |
\item[] This is an entry \emph{without} a label. |
| 5176 |
\item[Something] A short \emph{one-line} description text. |
| 5177 |
\item[Something long] A much \emph{longer} description text may take |
| 5178 |
more than one line or more than one paragraph. |
| 5179 |
|
| 5180 |
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod |
| 5181 |
tempor incididunt ut labore et dolore magna aliqua. |
| 5182 |
\end{enumext} |
| 5183 |
|
| 5184 |
\begin{enumext*}[label={},labelwidth=\descitemwd,list-indent=0pt,font=\bfseries,noitemsep,topsep=3pt] |
| 5185 |
\item[SomeThing] A short one-line description. |
| 5186 |
\item[] This is an entry \emph{without} a label. |
| 5187 |
\item[Something] A short \emph{one-line} description text. |
| 5188 |
\item[Something long] A much \emph{longer} description text may take |
| 5189 |
more than one line or more than one paragraph. |
| 5190 |
|
| 5191 |
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod |
| 5192 |
tempor incididunt ut labore et dolore magna aliqua. |
| 5193 |
\end{enumext*} |
| 5194 |
|
| 5195 |
\section{Fake \texttt{description} environment in margin} |
| 5196 |
|
| 5197 |
\begin{enumext}[align=right, label={},labelsep=4pt,labelwidth=\descitemwd,list-offset={-\descitemwd-4pt}, font=\bfseries,noitemsep,topsep=3pt] |
| 5198 |
\item[SomeThing] A short one-line description. |
| 5199 |
\item This is an entry \textit{without} a label. |
| 5200 |
\item[Something] A short one-line description. |
| 5201 |
\item[Something long] A much longer description. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
| 5202 |
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. |
| 5203 |
Curabitur dictum gravida mauris. |
| 5204 |
\end{enumext} |
| 5205 |
|
| 5206 |
\begin{enumext*}[align=right, label={},labelsep=4pt,labelwidth=\descitemwd,list-offset={-\descitemwd-4pt}, font=\bfseries,noitemsep,topsep=3pt] |
| 5207 |
\item[SomeThing] A short one-line description. |
| 5208 |
\item This is an entry \textit{without} a label. |
| 5209 |
\item[Something] A short one-line description. |
| 5210 |
\item[Something long] A much longer description. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
| 5211 |
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. |
| 5212 |
Curabitur dictum gravida mauris. |
| 5213 |
\end{enumext*} |
| 5214 |
|
| 5215 |
\section{Fake \texttt{description} with multi-line labels} |
| 5216 |
|
| 5217 |
\begin{enumext}[label={},labelsep=4pt,labelwidth=\descitemwd,list-offset=-\dimeval{\descitemwd+4pt}, wrap-label*={\labelbx{#1}}, font=\bfseries,noitemsep,topsep=3pt] |
| 5218 |
\item[SomeThing] A short one-line description. |
| 5219 |
\item This is an entry \textit{without} a label. |
| 5220 |
\item[Something] A short one-line description. |
| 5221 |
\item[Something \\ long] A much longer description. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
| 5222 |
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. |
| 5223 |
Curabitur dictum gravida mauris. |
| 5224 |
|
| 5225 |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
| 5226 |
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. |
| 5227 |
Curabitur dictum gravida mauris. |
| 5228 |
|
| 5229 |
\item[SoMeThInG \\ LoNg] A much longer description. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
| 5230 |
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. |
| 5231 |
Curabitur dictum gravida mauris. |
| 5232 |
|
| 5233 |
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
| 5234 |
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. |
| 5235 |
Curabitur dictum gravida mauris. |
| 5236 |
\end{enumext} |
| 5237 |
\end{document} |
| 5238 |
\end{filecontents*} |
| 5239 |
\IfFileExists{enumext-06.pdf}{}{\ShellEscape{arara enumext-06.tex}} |
| 5240 |
\begin{filecontents*}[overwrite]{enumext-07.tex} |
| 5241 |
% arara: lualatex: { branch: developer, draft: true } |
| 5242 |
% arara: lualatex: { branch: developer, draft: true } |
| 5243 |
% arara: lualatex: { branch: developer } |
| 5244 |
% arara: clean: { extensions: [ aux, log, out] } |
| 5245 |
% arara: move: { files: [ enumext-07-luamml-mathml.html ], target: 'enumext-07-mathml.html' } |
| 5246 |
\DocumentMetadata |
| 5247 |
{ |
| 5248 |
lang=en-US, |
| 5249 |
pdfversion=2.0, |
| 5250 |
pdfstandard=ua-2, |
| 5251 |
tagging=on, |
| 5252 |
} |
| 5253 |
\documentclass{article} |
| 5254 |
\usepackage[top=2cm,bottom=2cm,left=1cm,right=1cm]{geometry} |
| 5255 |
\usepackage{unicode-math,hyperref,enumext} |
| 5256 |
\hypersetup |
| 5257 |
{ |
| 5258 |
colorlinks = true, |
| 5259 |
pdftitle = {Test tagged PDF for enumext package}, |
| 5260 |
} |
| 5261 |
\resetenumext{section} |
| 5262 |
\setenumext{resume,label=(\arabic*.),widest=99} |
| 5263 |
\begin{document} |
| 5264 |
\section{Started with \texttt{resume} key set by \texttt{\textbackslash setenumext}} |
| 5265 |
\begin{enumext}[columns=2] |
| 5266 |
\item Salida 1 |
| 5267 |
\item Salida 2 |
| 5268 |
\item Salida 3 |
| 5269 |
\end{enumext} |
| 5270 |
|
| 5271 |
\begin{enumext}[label=\arabic*.,start=80]% |
| 5272 |
\item Salida 80 |
| 5273 |
\item Salida 81 |
| 5274 |
\end{enumext} |
| 5275 |
|
| 5276 |
\begin{enumext} |
| 5277 |
\item Salida (82) |
| 5278 |
\end{enumext} |
| 5279 |
|
| 5280 |
\section{Reset by \texttt{\textbackslash resetenumext}} |
| 5281 |
|
| 5282 |
\begin{enumext} |
| 5283 |
\item Salida 1 |
| 5284 |
\item Salida 2 |
| 5285 |
\end{enumext} |
| 5286 |
|
| 5287 |
\section*{Unnumbered, reset by \texttt{reset} key} |
| 5288 |
|
| 5289 |
\begin{enumext}[reset] |
| 5290 |
\item Salida 1 |
| 5291 |
\item Salida 2 |
| 5292 |
\end{enumext} |
| 5293 |
|
| 5294 |
\section{Using \texttt{series} and \texttt{resume} keys in inner levels} |
| 5295 |
|
| 5296 |
\begin{enumext}[columns=2] |
| 5297 |
\item first level |
| 5298 |
\begin{enumext}[series=foo] |
| 5299 |
\item second level |
| 5300 |
\item second level |
| 5301 |
\end{enumext} |
| 5302 |
Some text on first level |
| 5303 |
\begin{enumext}[resume=foo] |
| 5304 |
\item second level |
| 5305 |
\item second level |
| 5306 |
\end{enumext} |
| 5307 |
\item first level |
| 5308 |
\begin{enumext*}[series=baz] |
| 5309 |
\item second level starred |
| 5310 |
\item second level starred |
| 5311 |
\end{enumext*} |
| 5312 |
Some text on first level |
| 5313 |
\begin{enumext*}[resume=baz] |
| 5314 |
\item second level starred |
| 5315 |
\item second level starred |
| 5316 |
\end{enumext*} |
| 5317 |
\item first level |
| 5318 |
\item first level |
| 5319 |
\end{enumext} |
| 5320 |
|
| 5321 |
\section*{Using \texttt{resume*} key} |
| 5322 |
|
| 5323 |
\begin{enumext}[resume*] |
| 5324 |
\item Salida 5 (two-columns) |
| 5325 |
\item Salida 6 (two-columns) |
| 5326 |
\end{enumext} |
| 5327 |
\end{document} |
| 5328 |
\end{filecontents*} |
| 5329 |
\IfFileExists{enumext-07.pdf}{}{\ShellEscape{arara enumext-07.tex}} |
| 5330 |
% \iffalse |
| 5331 |
%</example> |
| 5332 |
% \fi |
| 5333 |
% |
| 5334 |
% \begin{itemize}[topsep=1pt,partopsep=0pt,parsep=1pt,itemsep=1pt] |
| 5335 |
% \item The file \myfile{enumext-01.tex} contains the basic tests for the |
| 5336 |
% \myenv*{enumext} and \myenv*{enumext*} environments and the nesting |
| 5337 |
% between them plus the use of the \mykey{label}, \mykey{labelwidth}, |
| 5338 |
% \mykey{labelsep}, \mykey{ref}, \mykey{align} and \mykey{wrap-label} keys. |
| 5339 |
% \IfFileExists{enumext-01.pdf}{Source file \textattachfile[color=red,print=false]{enumext-01.tex}{\faFile*[regular]} |
| 5340 |
% and \emph{tagged} \texttt{PDF} \textattachfile[color=red,print=false]{enumext-01.pdf}{\faFilePdf[regular]}}{}.% |
| 5341 |
% |
| 5342 |
% \item The file \myfile{enumext-02.tex} contains the tests for the \myenv*{enumext} |
| 5343 |
% and \myenv*{enumext*} environments and the support for \myenv{minipage} |
| 5344 |
% and \myenv{multicols} environments using the keys \mykey{columns}, |
| 5345 |
% \mykey{columns-sep}, \mykey{mini-env}, \mykey{mini-right} and |
| 5346 |
% |\miniright| command. \IfFileExists{enumext-02.pdf}{Source file \textattachfile[color=red,print=false]{enumext-02.tex}{\faFile*[regular]} |
| 5347 |
% and \emph{tagged} \texttt{PDF} \textattachfile[color=red,print=false]{enumext-02.pdf}{\faFilePdf[regular]}}{}.% |
| 5348 |
% |
| 5349 |
% \item The file \myfile{enumext-03.tex} contains the tests for the \myenv*{enumext} |
| 5350 |
% and \myenv*{keyanspic} environments activated by the \mykey{save-ans} |
| 5351 |
% key together with the \mykey{save-sep} and \mykey{save-ref} keys and |
| 5352 |
% the |\printkeyans| command. |
| 5353 |
% \IfFileExists{enumext-03.pdf}{Source file \textattachfile[color=red,print=false]{enumext-03.tex}{\faFile*[regular]} |
| 5354 |
% and \emph{tagged} \texttt{PDF} \textattachfile[color=red,print=false]{enumext-03.pdf}{\faFilePdf[regular]}}{}.% |
| 5355 |
% |
| 5356 |
% \item The file \myfile{enumext-04.tex} contains the tests for the |\anskey| |
| 5357 |
% command and the \myenv*{anskey*} environment activated by the |
| 5358 |
% \mykey{save-ans} key along with the |\getkeyans| and |\printkeyans| commands. |
| 5359 |
% \IfFileExists{enumext-04.pdf}{Source file \textattachfile[color=red,print=false]{enumext-04.tex}{\faFile*[regular]} |
| 5360 |
% and \emph{tagged} \texttt{PDF} \textattachfile[color=red,print=false]{enumext-04.pdf}{\faFilePdf[regular]}}{}.% |
| 5361 |
% |
| 5362 |
% \item The file \myfile{enumext-05.tex} contains the tests for the environments |
| 5363 |
% \myenv*{keyans}, \myenv*{keyans*} and \myenv*{keyanspic} activated by the key |
| 5364 |
% \mykey{save-ans} together with the keys \mykey{no-store} and \mykey{show-ans} |
| 5365 |
% and the commands |\setenumext|, |\setenumextmeta|, |\printkeyans| and |\foreachkeyans|. |
| 5366 |
% \IfFileExists{enumext-05.pdf}{Source file \textattachfile[color=red,print=false]{enumext-05.tex}{\faFile*[regular]} |
| 5367 |
% and \emph{tagged} \texttt{PDF} \textattachfile[color=red,print=false]{enumext-05.pdf}{\faFilePdf[regular]}}{}.% |
| 5368 |
% |
| 5369 |
% \item The file \myfile{enumext-06.tex} contains the tests for the environments |
| 5370 |
% \myenv*{enumext} and \myenv*{enumext*} for \emph{fake} \myenv{itemize} and \myenv{description}. |
| 5371 |
% \IfFileExists{enumext-06.pdf}{Source file \textattachfile[color=red,print=false]{enumext-06.tex}{\faFile*[regular]} |
| 5372 |
% and \emph{tagged} \texttt{PDF} \textattachfile[color=red,print=false]{enumext-06.pdf}{\faFilePdf[regular]}}{}.% |
| 5373 |
% |
| 5374 |
% \item The file \myfile{enumext-07.tex} contains the tests for starting the |
| 5375 |
% environments with |\setenumext{resume}|, the |\resetenumext| command |
| 5376 |
% and the \mykey{series}, \mykey{resume}, \mykey{resume*} and \mykey{reset} keys. |
| 5377 |
% \IfFileExists{enumext-06.pdf}{Source file \textattachfile[color=red,print=false]{enumext-07.tex}{\faFile*[regular]} |
| 5378 |
% and \emph{tagged} \texttt{PDF} \textattachfile[color=red,print=false]{enumext-07.pdf}{\faFilePdf[regular]}}{}.% |
| 5379 |
% \end{itemize} |
| 5380 |
% |
| 5381 |
% \section{The way of non-enumerated lists} |
| 5382 |
% |
| 5383 |
% It is possible to use (or abuse) the \myenv*{enumext} and \myenv*{enumext*} environments to |
| 5384 |
% mimic \emph{non-enumerated} list environments such as \myenv{itemize} and |
| 5385 |
% \myenv{description}, clearly the \mymeta{keys} to \emph{\enquote{store answers}}, |
| 5386 |
% the \myenv*{keyans}, \myenv*{keyans*} and \myenv*{keyanspic} environments lose their |
| 5387 |
% sense and it is not the focus of \mypkg*{enumext} package, but, why not |
| 5388 |
% to do it?. |
| 5389 |
% |
| 5390 |
% \smallskip |
| 5391 |
% |
| 5392 |
% Here I leave as an example other uses of the \myenv*{enumext} |
| 5393 |
% environment that can be helpful for specific purposes. The \emph{trick} |
| 5394 |
% to generate these \emph{\enquote{fake environments}} is set \mykey{label}|={}| |
| 5395 |
% or \mykey{label}|=|\mymarg{some} and play with the |list-indent|, |list-offset|, |
| 5396 |
% |font| and |wrap-label| keys. |
| 5397 |
% |
| 5398 |
% \subsection*{Fake \texttt{itemize} environment} |
| 5399 |
% |
| 5400 |
% Here we set the \mykey{label} key using the default settings in |
| 5401 |
% \hologo{LaTeX} for the four levels |\textbullet|, |\textendash|, |\textasteriskcentered| |
| 5402 |
% and |\textperiodcentered| together with the |
| 5403 |
% \mykey{nosep} key to reduce the vertical spaces in the left side example and set the |
| 5404 |
% \mykey{label} key in \emph{mathematical mode} for the right side as |
| 5405 |
% |\ast|, |\diamond|, |\circ| and |\star| for the four levels |
| 5406 |
% together with the \mykey{nosep} key |
| 5407 |
% |
| 5408 |
% \noindent\begin{minipage}[t]{0.45\linewidth} |
| 5409 |
% \begin{enumext}[nosep, label=\textbullet] |
| 5410 |
% \item First level item |
| 5411 |
% \begin{enumext}[nosep,label=\normalfont\bfseries\textendash] |
| 5412 |
% \item Second level item |
| 5413 |
% \begin{enumext}[nosep,label=\textasteriskcentered] |
| 5414 |
% \item Third level item |
| 5415 |
% \begin{enumext}[nosep,label=\textperiodcentered] |
| 5416 |
% \item Fourth level item |
| 5417 |
% \end{enumext} |
| 5418 |
% \end{enumext} |
| 5419 |
% \end{enumext} |
| 5420 |
% \item First level item |
| 5421 |
% \end{enumext} |
| 5422 |
% \end{minipage}\hfill |
| 5423 |
% \begin{minipage}[t]{0.45\linewidth} |
| 5424 |
% \begin{enumext}[nosep, label=$\ast$] |
| 5425 |
% \item First level item |
| 5426 |
% \begin{enumext}[nosep,label=$\diamond$] |
| 5427 |
% \item Second level item |
| 5428 |
% \begin{enumext}[nosep,label=$\circ$] |
| 5429 |
% \item Third level item |
| 5430 |
% \begin{enumext}[nosep,label=$\star$] |
| 5431 |
% \item Fourth level item |
| 5432 |
% \end{enumext} |
| 5433 |
% \end{enumext} |
| 5434 |
% \end{enumext} |
| 5435 |
% \item First level item |
| 5436 |
% \end{enumext} |
| 5437 |
% \end{minipage} |
| 5438 |
% |
| 5439 |
% \subsection*{Fake \texttt{description} environment} |
| 5440 |
% |
| 5441 |
% Here we set \mykey{label}|={}| and |list-indent=2.5em,font=\bfseries|. |
| 5442 |
% |
| 5443 |
% \begin{enumext}[label={},list-indent=2.5em,font=\bfseries,noitemsep,topsep=3pt] |
| 5444 |
% \item[SomeThing] A short one-line description. |
| 5445 |
% \item[] This is an entry \emph{without} a label. |
| 5446 |
% \item[Something] A short \emph{one-line} description text. |
| 5447 |
% \item[Something long] A much \emph{longer} description text may take |
| 5448 |
% more than one line or more than one paragraph. |
| 5449 |
% |
| 5450 |
% Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod |
| 5451 |
% tempor incididunt ut labore et dolore magna aliqua. |
| 5452 |
% \end{enumext} |
| 5453 |
% |
| 5454 |
% If we add |list-indent=0pt| you get \emph{widest style}: |
| 5455 |
% |
| 5456 |
% \begin{enumext}[label={},list-indent=0pt,font=\bfseries,noitemsep,topsep=3pt] |
| 5457 |
% \item[SomeThing] A short one-line description. |
| 5458 |
% \item[] This is an entry \emph{without} a label. |
| 5459 |
% \item[Something] A short \emph{one-line} description text. |
| 5460 |
% \item[Something long] A much \emph{longer} description text may take |
| 5461 |
% more than one line or more than one paragraph. |
| 5462 |
% |
| 5463 |
% Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod |
| 5464 |
% tempor incididunt ut labore et dolore magna aliqua. |
| 5465 |
% \end{enumext} |
| 5466 |
% |
| 5467 |
% \begin{important}* |
| 5468 |
% The small space at the beginning of the \emph{\enquote{unlabeled entry}} corresponds to |
| 5469 |
% |\labelsep| and can be removed using |\hspace{-\labelsep}| at the |
| 5470 |
% beginning of the line. |
| 5471 |
% \end{important} |
| 5472 |
% |
| 5473 |
% \smallskip |
| 5474 |
% |
| 5475 |
% \begin{important} |
| 5476 |
% When \emph{tagged} PDF is active the default \myenv{description} style |
| 5477 |
% is NOT available due to the redefinition of |\makelabel| for the |
| 5478 |
% \mykey{align} key which uses |\makebox| in this case, meaning that |
| 5479 |
% |\item|\myoarg{content} will not extend beyond |\labelwidth| which |
| 5480 |
% causes overlaps, |
| 5481 |
% \end{important} |
| 5482 |
% |
| 5483 |
% \subsection*{Description indented by label} |
| 5484 |
% |
| 5485 |
% Here we set \mykey{label}|={}| and we will give a convenient value to |
| 5486 |
% \mykey{labelsep} and \mykey{labelwidth}, for example we can take as reference our |
| 5487 |
% \emph{longest label} and pass it as value using: |
| 5488 |
% |
| 5489 |
% \iffalse |
| 5490 |
%<*example> |
| 5491 |
% \fi |
| 5492 |
\begin{examplecode}[frame=none] |
| 5493 |
\newlength{\descitemwd} |
| 5494 |
\settowidth{\descitemwd}{\textbf{Something long}} |
| 5495 |
\end{examplecode} |
| 5496 |
% \iffalse |
| 5497 |
%</example> |
| 5498 |
% \fi |
| 5499 |
% |
| 5500 |
% and then use \mykey{labelsep}|=4pt,|\mykey{labelwidth}|=\descitemwd,font=\bfseries|. |
| 5501 |
% |
| 5502 |
% \newlength{\descitemwd} |
| 5503 |
% \settowidth{\descitemwd}{\textbf{Something long}} |
| 5504 |
% \begin{enumext}[label={},labelsep=4pt,labelwidth=\descitemwd,font=\bfseries,noitemsep,topsep=3pt] |
| 5505 |
% \item[SomeThing] A short one-line description. |
| 5506 |
% \item[] This is an entry \textit{without} a label. |
| 5507 |
% \item[Something] A short one-line description. |
| 5508 |
% \item[Something long] A much longer description. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
| 5509 |
% Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. |
| 5510 |
% Curabitur dictum gravida mauris. |
| 5511 |
% \end{enumext} |
| 5512 |
% |
| 5513 |
% The environment can be translated so that the \mymeta{labels} are on |
| 5514 |
% the left margin calculating the value passed to the \mykey{list-offset} |
| 5515 |
% key, in this case it will be equal to the sum of the values set by the |
| 5516 |
% \mykey{labelwidth} and \mykey{labelsep} keys finally resulting as |
| 5517 |
% \mykey{list-offset}|={-\descitemwd - 4pt}|. |
| 5518 |
% |
| 5519 |
% \begin{enumext}[label={},labelsep=4pt,labelwidth=\descitemwd,list-offset={-\descitemwd-4pt}, font=\bfseries,noitemsep,topsep=3pt] |
| 5520 |
% \item[SomeThing] A short one-line description. |
| 5521 |
% \item This is an entry \textit{without} a label. |
| 5522 |
% \item[Something] A short one-line description. |
| 5523 |
% \item[Something long] A much longer description. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
| 5524 |
% Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. |
| 5525 |
% Curabitur dictum gravida mauris. |
| 5526 |
% \end{enumext} |
| 5527 |
% |
| 5528 |
% If we add \mykey{align}|=right| it will look like this: |
| 5529 |
% |
| 5530 |
% \begin{enumext}[label={},align=right,labelsep=4pt,labelwidth=\descitemwd,list-offset={-\descitemwd - 4pt}, font=\bfseries,noitemsep,topsep=3pt] |
| 5531 |
% \item[SomeThing] A short one-line description. |
| 5532 |
% \item This is an entry \textit{without} a label. |
| 5533 |
% \item[Something] A short one-line description. |
| 5534 |
% \item[Something long] A much longer description. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
| 5535 |
% Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. |
| 5536 |
% Curabitur dictum gravida mauris. |
| 5537 |
% \end{enumext} |
| 5538 |
% |
| 5539 |
% \begin{important}* |
| 5540 |
% At this point we have used \mykey{list-offset}|={-\descitemwd - 4pt}| instead of |
| 5541 |
% |list-offset={-\labelwidth - \labelsep}|, |
| 5542 |
% this is because the parameters |\labelwidth| and |\labelsep| take the |
| 5543 |
% default values, as if we had not set \mykey{label}. |
| 5544 |
% \end{important} |
| 5545 |
% |
| 5546 |
% \subsection*{Description with multi-line labels} |
| 5547 |
% |
| 5548 |
% The \mykey{label} key does not accept \emph{multiline material}, this |
| 5549 |
% is where the \mykey{wrap-label} and \mykey{wrap-label*} keys comes into |
| 5550 |
% play. Unlike the \mypkg{enumitem} package, the \mykey{align} key only |
| 5551 |
% supports three options, so what we will do is create a command in the |
| 5552 |
% style |\parleft| of \mypkg{enumitem} that allows us to place \emph{multiline labels} |
| 5553 |
% using |\parbox|. |
| 5554 |
% |
| 5555 |
% \iffalse |
| 5556 |
%<*example> |
| 5557 |
% \fi |
| 5558 |
\begin{examplecode}[frame=none] |
| 5559 |
\NewDocumentCommand \labelbx { s +m } |
| 5560 |
{% |
| 5561 |
\SuspendTagging{\parbox}% |
| 5562 |
\IfBooleanTF{#1} |
| 5563 |
{\strut\smash{\parbox[t]{\labelwidth}{\raggedright{#2}}}}% |
| 5564 |
{\strut\smash{\parbox[t]{\labelwidth}{\raggedleft{#2}}}}% |
| 5565 |
\ResumeTagging{\parbox}% |
| 5566 |
} |
| 5567 |
\end{examplecode} |
| 5568 |
% \iffalse |
| 5569 |
%</example> |
| 5570 |
% \fi |
| 5571 |
% |
| 5572 |
% Now we just need to set |wrap-label*={\labelbx{#1}}|. |
| 5573 |
% |
| 5574 |
% \begin{enumext}[mode-box,label={},labelsep=4pt,labelwidth=\descitemwd,list-offset=-\dimeval{\descitemwd+4pt}, wrap-label*={\labelbx{#1}}, font=\bfseries,noitemsep,topsep=3pt] |
| 5575 |
% \item[SomeThing] A short one-line description. |
| 5576 |
% \item This is an entry \textit{without} a label. |
| 5577 |
% \item[Something] A short one-line description. |
| 5578 |
% \item[Something \\ long] A much longer description. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
| 5579 |
% Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. |
| 5580 |
% Curabitur dictum gravida mauris. |
| 5581 |
% |
| 5582 |
% Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
| 5583 |
% Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. |
| 5584 |
% Curabitur dictum gravida mauris. |
| 5585 |
% |
| 5586 |
% \item[SoMeThInG \\ LoNg] A much longer description. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. |
| 5587 |
% Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. |
| 5588 |
% Curabitur dictum gravida mauris. |
| 5589 |
% \end{enumext} |
| 5590 |
% |
| 5591 |
% \section*{Final notes} |
| 5592 |
% |
| 5593 |
% The original implementation (if you can call it that) of the ideas that |
| 5594 |
% led to the creation of \mypkg*{enumext} were some macros using the \mypkg{enumerate}\cite{enumerate} |
| 5595 |
% package for personal use created in early 2003, the code was quite |
| 5596 |
% questionable, but functional for these simple requirements. |
| 5597 |
% |
| 5598 |
% \medskip |
| 5599 |
% |
| 5600 |
% With the great answers given by Christian Hupfer in |
| 5601 |
% \href{https://tex.stackexchange.com/a/364763/7832}{Create a fake label ref |
| 5602 |
% using list} and the answer given by David Carlisle in |
| 5603 |
% \href{https://tex.stackexchange.com/a/363963/7832}{Change the use of label |
| 5604 |
% ref by data save in an array (list)} I managed to create a more solid |
| 5605 |
% code than the original version, now using the \mypkg{l3prop}\cite{inter3} and \mypkg{l3seq}\cite{inter3} |
| 5606 |
% modules together with the \mypkg{hyperref}\cite{hyperref} and \mypkg{enumitem}\cite{enumitem} packages, which did |
| 5607 |
% the job, but with some limitations. |
| 5608 |
% |
| 5609 |
% \smallskip |
| 5610 |
% |
| 5611 |
% As time went by I took these limitations as a personal challenge which |
| 5612 |
% I called \emph{\enquote{reinventing the wheel}}, since there were packages and classes |
| 5613 |
% that did more or less what I was looking for, but did not fit my simple |
| 5614 |
% requirements. This \emph{\enquote{reinventing the wheel}} finally ended up becoming |
| 5615 |
% \mypkg*{enumext}. |
| 5616 |
% |
| 5617 |
% \subsubsection*{Why list environments?} |
| 5618 |
% |
| 5619 |
% The answer is simple, first I love the beauty of its syntax and many of |
| 5620 |
% what I had already written used the \myenv{enumerate} environment or |
| 5621 |
% lists created using the \mypkg{enumitem} package. In my mind I thought: |
| 5622 |
% how complicated could it be to write a package that looked like |
| 5623 |
% \mypkg{enumitem}? It seemed simple enough, of course I didn't have in |
| 5624 |
% mind the mess I was getting into working with \myenv{list} |
| 5625 |
% environments, \myenv{minipage} and adding support for the |
| 5626 |
% \mypkg{multicol} and \mypkg{hyperref} packages. |
| 5627 |
% |
| 5628 |
% Of course, seeing the final result of the experiment |
| 5629 |
% \emph{\enquote{reinventing the wheel}} I am quite satisfied. |
| 5630 |
% |
| 5631 |
% \subsubsection*{Why not random questions and other utilities} |
| 5632 |
% |
| 5633 |
% The \emph{\enquote{random}} type questions I love and hate them at the |
| 5634 |
% same time, although they simplify a lot the work when creating a |
| 5635 |
% multiple choice test, but you lose the beauty of typessetting a |
| 5636 |
% document with \hologo{LaTeX}, that is to say the output does not always |
| 5637 |
% look as nice as it should, even if they are only alternatives these |
| 5638 |
% must follow a certain order when presented either numerical or |
| 5639 |
% presentation, that said handling that using \emph{nested lists} is quite |
| 5640 |
% complicated so I do not classify to be implemented. |
| 5641 |
% |
| 5642 |
% \subsubsection*{Why has it taken so long?} |
| 5643 |
% |
| 5644 |
% One of the setbacks, beyond my laziness, was including compatibility |
| 5645 |
% with \emph{tagged} \texttt{PDF}. To be honest, it's something I never |
| 5646 |
% considered at any point, but I firmly believe that being able to create |
| 5647 |
% \emph{accessible documents} provides a great opportunity in the world of |
| 5648 |
% mathematics education. From my perspective as a \emph{high school} teacher, |
| 5649 |
% beyond theorems and deep mathematics, the use of exercise lists is one |
| 5650 |
% of the most common things. Being able to open the way to work in |
| 5651 |
% parallel with those who have different abilities is really important |
| 5652 |
% and I regret not having looked into this in the past. I hope that |
| 5653 |
% \mypkg*{enumext} serves this purpose and inspires more users and |
| 5654 |
% authors to follow this path. |
| 5655 |
% |
| 5656 |
% \let\stdsection\section |
| 5657 |
% \def\section*#1{\stdsection{#1}} |
| 5658 |
% |
| 5659 |
% \begin{thebibliography}{10} |
| 5660 |
% |
| 5661 |
% \bibitem{exam} \textsc{Hirschhorn, Philip}. \enquote{Using the |
| 5662 |
% \textsf{exam} document class}. Available from |
| 5663 |
% \textsc{ctan}, \url{https://www.ctan.org/pkg/exam}, 2023. |
| 5664 |
% |
| 5665 |
% \bibitem{xsim} \textsc{Niederberger, Clemens}. \enquote{\textsf{xsim} – eXercise |
| 5666 |
% Sheets IMproved}. Available from |
| 5667 |
% \textsc{ctan}, \url{https://www.ctan.org/pkg/xsim}, 2023. |
| 5668 |
% |
| 5669 |
% \bibitem{multicol} \textsc{Mittelbach, Frank}. \enquote{An |
| 5670 |
% environment for \textsf{multicolumn} output}. Available from |
| 5671 |
% \textsc{ctan}, \url{https://www.ctan.org/pkg/multicol}, 2025. |
| 5672 |
% |
| 5673 |
% \bibitem{scontents} \textsc{González, Pablo}. \enquote{\textsf{scontents} - Stores |
| 5674 |
% \hologo{LaTeX} contents in memory or files}. Available from |
| 5675 |
% \textsc{ctan}, \url{https://www.ctan.org/pkg/scontents}, 2025. |
| 5676 |
% |
| 5677 |
% \bibitem{enumerate} The \hologo{LaTeX} Project. \enquote{\textsf{enumerate} – Enumerate |
| 5678 |
% with redefinable labels}. Available from |
| 5679 |
% \textsc{ctan}, \url{https://www.ctan.org/pkg/enumerate}, 2025. |
| 5680 |
% |
| 5681 |
% \bibitem{enumitem} \textsc{Bezos, Javier}. \enquote{Customizing lists |
| 5682 |
% with the \textsf{enumitem} package}. Available from |
| 5683 |
% \textsc{ctan}, \url{https://www.ctan.org/pkg/enumitem}, 2025. |
| 5684 |
% |
| 5685 |
% \bibitem{latexref} \textsc{Berry, Karl}. \enquote{\hologo{LaTeX2e}: An |
| 5686 |
% Unofficial Reference Manual}. Available from \textsc{ctan}, |
| 5687 |
% \url{https://ctan.org/pkg/latex2e-help-texinfo}, 2025. |
| 5688 |
% |
| 5689 |
% \bibitem{hyperref} The \hologo{LaTeX} Project. \enquote{Extensive support |
| 5690 |
% for hypertext in \hologo{LaTeX}}. Available from |
| 5691 |
% \textsc{ctan}, \url{https://www.ctan.org/pkg/hyperref}, 2025. |
| 5692 |
% |
| 5693 |
% \bibitem{footnotehyper} \textsc{Burnol, Jean-François}. \enquote{The \textsf{footnotehyper} |
| 5694 |
% package}. Available from |
| 5695 |
% \textsc{ctan}, \url{https://www.ctan.org/pkg/footnotehyper}, 2025. |
| 5696 |
% |
| 5697 |
% \bibitem{expl3} The \hologo{LaTeX} Project. \enquote{The \textsf{expl3} |
| 5698 |
% package}. Available from |
| 5699 |
% \textsc{ctan}, \url{https://www.ctan.org/pkg/l3kernel}, 2025. |
| 5700 |
% |
| 5701 |
% \bibitem{inter3} The \hologo{LaTeX} Project. \enquote{The \hologo{LaTeX}3 |
| 5702 |
% Interfaces}. Available from |
| 5703 |
% \textsc{ctan}, \url{https://www.ctan.org/pkg/l3kernel}, 2025. |
| 5704 |
% |
| 5705 |
% \bibitem{latex2e} The \hologo{LaTeX} Project. \enquote{The \hologo{LaTeX2e} |
| 5706 |
% sources}. Available from |
| 5707 |
% \textsc{ctan}, \url{https://ctan.org/tex-archive/macros/latex/base}, 2025. |
| 5708 |
% |
| 5709 |
% \bibitem{ltnews} The \hologo{LaTeX} Project. \enquote{\hologo{LaTeX} News, |
| 5710 |
% Issue 41, June 2025}. Available from |
| 5711 |
% \textsc{ctan}, \url{https://ctan.org/tex-archive/macros/latex/base}, 2025. |
| 5712 |
% |
| 5713 |
% \bibitem{userguide} The \hologo{LaTeX} Project. \enquote{\hologo{LaTeX} for authors |
| 5714 |
% current version}. Available from |
| 5715 |
% \textsc{ctan}, \url{https://ctan.org/pkg/latex-base}, 2025. |
| 5716 |
% |
| 5717 |
% \bibitem{luavisual} \textsc{Gundlach, Patrick}. \enquote{The \textsf{lua-visual-debug} |
| 5718 |
% package}. Available from |
| 5719 |
% \textsc{ctan}, \url{https://www.ctan.org/pkg/lua-visual-debug}, 2023. |
| 5720 |
% |
| 5721 |
% \bibitem{shortlst} \textsc{Lemvig, Mogens}. \enquote{The \textsf{shortlst} |
| 5722 |
% package}. Available from |
| 5723 |
% \textsc{ctan}, \url{https://www.ctan.org/pkg/shortlst}, 1998. |
| 5724 |
% |
| 5725 |
% \bibitem{tasks} \textsc{Niederberger, Clemens}. \enquote{\textsf{tasks} – Horizontally |
| 5726 |
% columned lists}. Available from |
| 5727 |
% \textsc{ctan}, \url{https://www.ctan.org/pkg/tasks}, 2022. |
| 5728 |
% |
| 5729 |
% \bibitem{tagpdf} \textsc{Fischer, Ulrike}. \enquote{\textsf{tagpdf} – \hologo{LaTeX} |
| 5730 |
% kernel code for PDF tagging}. Available from |
| 5731 |
% \textsc{ctan}, \url{https://www.ctan.org/pkg/tagpdf}, 2025. |
| 5732 |
% |
| 5733 |
% \bibitem{latexlab} The \hologo{LaTeX} Project. \enquote{\textsf{latex-lab} – \hologo{LaTeX} |
| 5734 |
% laboratory}. Available from |
| 5735 |
% \textsc{ctan}, \url{https://www.ctan.org/pkg/latex-lab}, 2025. |
| 5736 |
% |
| 5737 |
% \bibitem{ltsockets} \textsc{Mittelbach, Frank}. \enquote{\hologo{LaTeX}’s |
| 5738 |
% socket management}. Available from |
| 5739 |
% \textsc{ctan}, \url{https://ctan.org/tex-archive/macros/latex/base}, 2025. |
| 5740 |
% |
| 5741 |
% \end{thebibliography} |
| 5742 |
% |
| 5743 |
% \let\section\stdsection |
| 5744 |
% |
| 5745 |
% \section{Change history} |
| 5746 |
% \label{sec:changes} |
| 5747 |
% |
| 5748 |
% \setlist[itemize,1]{label=\textendash,wide=0.5em,nosep,noitemsep,leftmargin=10pt} |
| 5749 |
% \newlength\descrwidth |
| 5750 |
% \settowidth{\descrwidth}{\textsf{v1.0, (ctan), 2024-11-01} } |
| 5751 |
% \begin{description}[font=\small\sffamily,wide=0pt,style=multiline,leftmargin=1.1\descrwidth,nosep,noitemsep] |
| 5752 |
% \item [\fileversion{} (ctan), \filedate] |
| 5753 |
% \begin{itemize} |
| 5754 |
% \item Fixed bad interaction between |\setenumext| and the \texttt{\textcolor{optcolor}{ref}} key. |
| 5755 |
% \end{itemize} |
| 5756 |
% \item [v2.0 (ctan), 2025-12-02] |
| 5757 |
% \begin{itemize} |
| 5758 |
% \item Update requirement to \mypkg{multicol} release 2025-10-21. |
| 5759 |
% \item Adjustments in the documentation. |
| 5760 |
% \end{itemize} |
| 5761 |
% \item [v1.9 (ctan), 2025-11-01] |
| 5762 |
% \begin{itemize} |
| 5763 |
% \item Update requirement to \hologo{LaTeX} release 2025-11-01. |
| 5764 |
% \item Move |\setcounter| to |\begin{list}|\mymarg{arg one}|{|\mymeta{arg two}|\setcounter}|. |
| 5765 |
% \item Update code for \emph{tagged} \texttt{PDF}. |
| 5766 |
% \end{itemize} |
| 5767 |
% \item [v1.8 (ctan), 2025-10-04] |
| 5768 |
% \begin{itemize} |
| 5769 |
% \item Replacing |\scantokens| (primitive) with |\tl_retokenize:n|. |
| 5770 |
% \item Cleanup warnings and details returned by |expltools|. |
| 5771 |
% \end{itemize} |
| 5772 |
% \item [v1.7 (ctan), 2025-07-10] |
| 5773 |
% \begin{itemize} |
| 5774 |
% \item Fixed |\setenumext{enumext*}{|\texttt{\textcolor{optcolor}{resume}}|}|. |
| 5775 |
% \item Fixed bad interaction between |\setenumext| and the \texttt{\textcolor{optcolor}{resume}} key. |
| 5776 |
% \item The behavior of the key \texttt{\textcolor{optcolor}{resume}}|*| has been updated and documented. |
| 5777 |
% \end{itemize} |
| 5778 |
% \item [v1.6 (ctan), 2025-07-04] |
| 5779 |
% \begin{itemize} |
| 5780 |
% \item Syntax simplification for |\setenumextmeta|. |
| 5781 |
% \item Environments can be started with the key \texttt{\textcolor{optcolor}{resume}} \emph{without value}. |
| 5782 |
% \item Add |\resetenumext|, \texttt{\textcolor{optcolor}{reset}} and \texttt{\textcolor{optcolor}{reset}}|*| keys. |
| 5783 |
% \item The \texttt{\textcolor{optcolor}{resume}}, \texttt{\textcolor{optcolor}{resume}}|*| and \texttt{\textcolor{optcolor}{series}} |
| 5784 |
% keys can now be set per level. |
| 5785 |
% \item Fixed bad interaction between |\printkeyans| and the \texttt{\textcolor{optcolor}{resume}}, \texttt{\textcolor{optcolor}{resume}}|*| keys. |
| 5786 |
% \end{itemize} |
| 5787 |
% \item [v1.5 (ctan), 2025-06-11] |
| 5788 |
% \begin{itemize} |
| 5789 |
% \item Replacing |\regex_match:| (deprecated) with |\regex_if_match:|. |
| 5790 |
% \item Add keys |beginpenalty|, |midpenalty| and |endpenalty|. |
| 5791 |
% \end{itemize} |
| 5792 |
% \item [v1.4 (ctan), 2025-06-09] |
| 5793 |
% \begin{itemize} |
| 5794 |
% \item Improved implementation of the \texttt{\textcolor{optcolor}{start}} key for \emph{tagged} \texttt{PDF}. |
| 5795 |
% \item Improved implementation of the \texttt{\textcolor{optcolor}{ref}} key. |
| 5796 |
% \item Fixed the behavior of the |save-sep| key. |
| 5797 |
% \item Fixed the behavior of the \texttt{\textcolor{optcolor}{resume}}|*| key. |
| 5798 |
% \end{itemize} |
| 5799 |
% \item [v1.3 (ctan), 2025-06-01] |
| 5800 |
% \begin{itemize} |
| 5801 |
% \item Removed dependency on the \mypkg{scontents} package. |
| 5802 |
% \item The |anskey*| environment has been rewritten using the new |
| 5803 |
% \texttt{c-type} argument. |
| 5804 |
% \end{itemize} |
| 5805 |
% \item [v1.2 (ctan), 2025-03-28] |
| 5806 |
% \begin{itemize} |
| 5807 |
% \item Replace signature (prevent expansion for optional argument). |
| 5808 |
% \item Solve Inconsistent local/global assignment. |
| 5809 |
% \end{itemize} |
| 5810 |
% \item [v1.1 (ctan), 2024-11-14] |
| 5811 |
% \begin{itemize} |
| 5812 |
% \item Fixed implementation for |font| and |base-fix| keys. |
| 5813 |
% \item Added new keys for symbol marks. |
| 5814 |
% \item Update and improvements in the internal code. |
| 5815 |
% \item Adjustments in the documentation. |
| 5816 |
% \end{itemize} |
| 5817 |
% \item [v1.0 (ctan), 2024-11-01] |
| 5818 |
% \begin{itemize} |
| 5819 |
% \item First public release. |
| 5820 |
% \end{itemize} |
| 5821 |
% \end{description} |
| 5822 |
% |
| 5823 |
% \newpage |
| 5824 |
% |
| 5825 |
% \indexprologue{ |
| 5826 |
% The italic numbers denote the pages where the corresponding entry is |
| 5827 |
% described.} |
| 5828 |
% |
| 5829 |
% \printindex[userdoc] |
| 5830 |
% |
| 5831 |
% \newpage |
| 5832 |
% |
| 5833 |
% \StartImplementation |
| 5834 |
% |
| 5835 |
% \StopEventually{^^A |
| 5836 |
% \newgeometry{top=0.5in,bottom=0.3in,left=1.0in,right=0.5in,footskip=0.2in,headheight=1cm,headsep=0.27cm} |
| 5837 |
% \addtocontents{toc}{\protect\setcounter{tocdepth}{2}} |
| 5838 |
% \cleardoublepage |
| 5839 |
% \phantomsection |
| 5840 |
% \indexprologue{ |
| 5841 |
% The italic numbers denote the pages where the corresponding entry is |
| 5842 |
% described, the numbers underlined and all others indicate the line on |
| 5843 |
% which they are implemented in the package code. |
| 5844 |
% } |
| 5845 |
% \printindex |
| 5846 |
% } |
| 5847 |
% |
| 5848 |
% \newgeometry{top=0.5in,bottom=0.3in,left=1.95in,right=0.5in,footskip=0.2in,headheight=1cm,headsep=0.27cm} |
| 5849 |
% |
| 5850 |
% \section{Implementation} |
| 5851 |
% \label{sec:Implementation} |
| 5852 |
% \addtocontents{toc}{\protect\setcounter{tocdepth}{0}} |
| 5853 |
% |
| 5854 |
% The most recent publicly released version of \mypkg*{enumext} is |
| 5855 |
% available at \textsc{ctan}: \url{https://www.ctan.org/pkg/enumext}. |
| 5856 |
% While general feedback via email is welcomed, specific bugs or |
| 5857 |
% feature requests should be reported through the issue |
| 5858 |
% tracker: \textcolor{gray}{\scriptsize\faIcon[regular]{github}} \url{https://github.com/pablgonz/enumext/issues}. |
| 5859 |
% |
| 5860 |
% \smallskip |
| 5861 |
% |
| 5862 |
% \begin{important}* |
| 5863 |
% The documentation presented here is far from professional, it contains |
| 5864 |
% a lot of obvious information that to the eye of a \hologo{TeX}pert are |
| 5865 |
% superfluous, but, after so many years developing this project is the |
| 5866 |
% only way to remember what does what. |
| 5867 |
% \end{important} |
| 5868 |
% |
| 5869 |
% \subsection{General conventions} |
| 5870 |
% |
| 5871 |
% Variables containing \lstinline+i+, \lstinline+ii+, \lstinline+iii+ and |
| 5872 |
% \lstinline+iv+ are associated by level with the \myenv*{enumext} |
| 5873 |
% environment, variables containing \lstinline+v+ are associated with the |
| 5874 |
% \myenv*{keyans} environment, variables containing \lstinline+vi+ are |
| 5875 |
% associated with the \myenv*{keyanspic} environment, variables |
| 5876 |
% containing \lstinline+vii+ are associated with the \myenv*{enumext*} |
| 5877 |
% environment and variables containing \lstinline+viii+ are associated |
| 5878 |
% with the \myenv*{keyans*} environment. |
| 5879 |
% |
| 5880 |
% \medskip |
| 5881 |
% |
| 5882 |
% To simplify writing and documentation some variables and functions that |
| 5883 |
% are common to the different levels of the environments are described |
| 5884 |
% using a capital \enquote{\texttt{\textcolor{optcolor}{X}}}. |
| 5885 |
% |
| 5886 |
% \medskip |
| 5887 |
% |
| 5888 |
% The temporary function \myvarenv{__@@_tmp:n} is used in |
| 5889 |
% different parts of the package code for variable creation or execution |
| 5890 |
% of other functions that are grouped into this one. |
| 5891 |
% |
| 5892 |
% \medskip |
| 5893 |
% |
| 5894 |
% All variables and functions defined in this package are private and |
| 5895 |
% are NOT intended to work or be used by another package or module. |
| 5896 |
% |
| 5897 |
% |
| 5898 |
% \subsection{Initial set up} |
| 5899 |
% |
| 5900 |
% Start the \pkg{DocStrip} guards. |
| 5901 |
% \begin{macrocode} |
| 5902 |
%<*package> |
| 5903 |
% \end{macrocode} |
| 5904 |
% Identify the internal prefix (\LaTeX3 \pkg{DocStrip} convention) for |
| 5905 |
% \pkg{l3doc} class. |
| 5906 |
% \begin{macrocode} |
| 5907 |
%<@@=enumext> |
| 5908 |
% \end{macrocode} |
| 5909 |
% |
| 5910 |
% \subsection{Declaration of the package} |
| 5911 |
% |
| 5912 |
% First we will make sure we have a minimum (super updated) version of |
| 5913 |
% \hologo{LaTeX} to work correctly. |
| 5914 |
% \begin{macrocode} |
| 5915 |
\NeedsTeXFormat{LaTeX2e}[2025-11-01] |
| 5916 |
% \end{macrocode} |
| 5917 |
% Now declare the \mypkg*{enumext} package. |
| 5918 |
% \begin{macrocode} |
| 5919 |
\ProvidesExplPackage {enumext} {2026-01-15} {2.1} {Enumerate exercise sheets} |
| 5920 |
% \end{macrocode} |
| 5921 |
% Finally check if the \mypkg{multicol} package are loaded, if not we load it. |
| 5922 |
% \begin{macrocode} |
| 5923 |
\hook_gput_code:nnn {begindocument} {enumext} |
| 5924 |
{ |
| 5925 |
\IfPackageLoadedTF { multicol } |
| 5926 |
{ |
| 5927 |
\msg_info:nnn { enumext } { package-load } { multicol } |
| 5928 |
} |
| 5929 |
{ |
| 5930 |
\msg_info:nnn { enumext } { package-not-load } { multicol } |
| 5931 |
\RequirePackage{multicol}[2025-10-21] |
| 5932 |
} |
| 5933 |
} |
| 5934 |
% \end{macrocode} |
| 5935 |
% |
| 5936 |
% \subsection{Definition of variables} |
| 5937 |
% |
| 5938 |
% Variables that do not appear in this section are created by means of |
| 5939 |
% |\keys_define:nn| or some function described below. |
| 5940 |
% |
| 5941 |
% \begin{variable}[int]{\l_@@_level_int, \l_@@_level_h_int, \l_@@_anskey_level_int, |
| 5942 |
% \l_@@_keyans_level_int, \l_@@_keyans_level_h_int, \l_@@_keyans_pic_level_int,} |
| 5943 |
% Integer variables will control the nesting levels of the environments, |
| 5944 |
% \myenv*{anskey*} environment and |\anskey| command. |
| 5945 |
% \iffalse |
| 5946 |
%% Variable for levels and nesting off all environments and |\anskey|, |anskey*|. |
| 5947 |
% \fi |
| 5948 |
% \begin{macrocode} |
| 5949 |
\int_new:N \l_@@_level_int |
| 5950 |
\int_new:N \l_@@_level_h_int |
| 5951 |
\int_new:N \l_@@_anskey_level_int |
| 5952 |
\int_new:N \l_@@_keyans_level_int |
| 5953 |
\int_new:N \l_@@_keyans_level_h_int |
| 5954 |
\int_new:N \l_@@_keyans_pic_level_int |
| 5955 |
% \end{macrocode} |
| 5956 |
% \end{variable} |
| 5957 |
% |
| 5958 |
% \begin{variable}[int]{\l_@@_starred_bool, \g_@@_starred_bool, \l_@@_starred_first_bool, |
| 5959 |
% \l_@@_standar_bool, \g_@@_standar_bool, \l_@@_standar_first_bool, |
| 5960 |
% \l_@@_keyans_env_bool,\g_@@_start_line_tl, \g_@@_envir_name_tl, |
| 5961 |
% \l_@@_envir_name_tl} |
| 5962 |
% Internal variables used by functions \cs{@@_is_not_nested:}, |
| 5963 |
% \cs{@@_is_on_first_level:} and \cs{@@_keyans_name_and_start:} (\S\ref{fun:utilities}). |
| 5964 |
% \iffalse |
| 5965 |
%% Internal vars for levels and nesting off all environments. |
| 5966 |
% \fi |
| 5967 |
% \begin{macrocode} |
| 5968 |
\bool_new:N \l_@@_starred_bool |
| 5969 |
\bool_new:N \g_@@_starred_bool |
| 5970 |
\bool_new:N \l_@@_starred_first_bool |
| 5971 |
\bool_new:N \l_@@_standar_bool |
| 5972 |
\bool_new:N \g_@@_standar_bool |
| 5973 |
\bool_new:N \l_@@_standar_first_bool |
| 5974 |
\bool_new:N \l_@@_keyans_env_bool |
| 5975 |
\tl_new:N \g_@@_start_line_tl |
| 5976 |
\tl_new:N \g_@@_envir_name_tl |
| 5977 |
\tl_new:N \l_@@_envir_name_tl |
| 5978 |
% \end{macrocode} |
| 5979 |
% \end{variable} |
| 5980 |
% |
| 5981 |
% \begin{variable}[int]{\l_@@_counter_i_tl, \l_@@_counter_ii_tl, |
| 5982 |
% \l_@@_counter_iii_tl, \l_@@_counter_iv_tl, |
| 5983 |
% \l_@@_counter_v_tl,\l_@@_counter_vi_tl, |
| 5984 |
% \l_@@_counter_vii_tl,\l_@@_counter_viii_tl} |
| 5985 |
% |
| 5986 |
% Variables to store the \emph{\enquote{name of the counters}} |
| 5987 |
% \icounter{enumXi}, \icounter{enumXii}, \icounter{enumXiii} and |
| 5988 |
% \icounter{enumXiv} for \myenv*{enumext} environment, |
| 5989 |
% \icounter{enumXv} for \myenv*{keyans} environment and |
| 5990 |
% \icounter{enumXvi} for the \myenv*{keyanspic} environment. |
| 5991 |
% The counters \icounter{enumXvii} and \icounter{enumXviii} are used |
| 5992 |
% by \myenv*{enumext*} and \myenv*{keyans*} environments. |
| 5993 |
% |
| 5994 |
% \smallskip |
| 5995 |
% |
| 5996 |
% The initial values of these variables are set by the function |
| 5997 |
% \cs{@@_define_counter:Nn} (\S\ref{int:counters}) and then modified by the function |
| 5998 |
% \cs{@@_label_style:Nnn} used by \mykey{label} key (\S\ref{key:label-ref}). |
| 5999 |
% \iffalse |
| 6000 |
%% Variable for counters |
| 6001 |
% \fi |
| 6002 |
% \begin{macrocode} |
| 6003 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 6004 |
{ |
| 6005 |
\tl_new:c { l_@@_counter_#1_tl } |
| 6006 |
} |
| 6007 |
\clist_map_inline:nn { i, ii, iii, iv, v, vi, vii, viii } { \@@_tmp:n {#1} } |
| 6008 |
% \end{macrocode} |
| 6009 |
% \end{variable} |
| 6010 |
% |
| 6011 |
% \begin{variable}[int]{\l_@@_ref_key_arg_tl, \l_@@_ref_the_count_tl, |
| 6012 |
% \l_@@_renew_counter_X_tl, \l_@@_the_counter_X_tl,} |
| 6013 |
% Internal variables used by \mykey{ref} key (\S\ref{key:label-ref}). |
| 6014 |
% \iffalse |
| 6015 |
%% Variables used by |ref| key. |
| 6016 |
% \fi |
| 6017 |
% \begin{macrocode} |
| 6018 |
\tl_new:N \l_@@_ref_key_arg_tl |
| 6019 |
\tl_new:N \l_@@_ref_the_count_tl |
| 6020 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 6021 |
{ |
| 6022 |
\tl_new:c { l_@@_renew_counter_#1_tl } |
| 6023 |
\tl_new:c { l_@@_the_counter_#1_tl } |
| 6024 |
\tl_set:ce { l_@@_the_counter_#1_tl } { \exp_not:c { theenumX#1 } } |
| 6025 |
} |
| 6026 |
\clist_map_inline:nn { i, ii, iii, iv, v, vi, vii, viii } { \@@_tmp:n {#1} } |
| 6027 |
% \end{macrocode} |
| 6028 |
% \end{variable} |
| 6029 |
% |
| 6030 |
% \begin{variable}[int]{\l_@@_series_name_tl, \l_@@_resume_count_bool, |
| 6031 |
% \l_@@_resume_count_X_bool, \l_@@_resume_series_X_bool, |
| 6032 |
% \l_@@_resume_star_key_X_bool, \g_@@_resume_last_keys_X_tl,} |
| 6033 |
% Internal variables used by \mykey{resume}, \mykey{resume*} and |
| 6034 |
% \mykey{series} keys (\S\ref{key:series}). |
| 6035 |
% \iffalse |
| 6036 |
%% Variables used by |series|, |resume| and |resume*| keys. |
| 6037 |
% \fi |
| 6038 |
% \begin{macrocode} |
| 6039 |
\tl_new:N \l_@@_series_name_tl |
| 6040 |
\bool_new:N \l_@@_resume_count_bool |
| 6041 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 6042 |
{ |
| 6043 |
\bool_new:c { l_@@_resume_count_#1_bool } |
| 6044 |
\bool_new:c { l_@@_resume_series_#1_bool } |
| 6045 |
\bool_new:c { l_@@_resume_star_key_#1_bool } |
| 6046 |
\tl_new:c { g_@@_resume_last_keys_#1_tl } |
| 6047 |
} |
| 6048 |
\clist_map_inline:nn { i, ii, iii, iv, vii } { \@@_tmp:n {#1} } |
| 6049 |
% \end{macrocode} |
| 6050 |
% \end{variable} |
| 6051 |
% |
| 6052 |
% \begin{variable}[int]{\l_@@_current_widest_dim, \g_@@_counter_styles_tl, |
| 6053 |
% \g_@@_widest_label_tl, \l_@@_label_width_by_box} |
| 6054 |
% The variable \cs{l_@@_current_widest_dim} stores the current |
| 6055 |
% label width, the variable \cs{g_@@_counter_styles_tl} stores |
| 6056 |
% the default \mymeta{label style} and the variable |
| 6057 |
% \cs{g_@@_widest_label_tl} the label width. These variables are |
| 6058 |
% used by \mykey{widest} (\S\ref{key:start-widest}) and \mykey{label} (\S\ref{key:label}) keys. |
| 6059 |
% \iffalse |
| 6060 |
%% Variables used by |label|, |ref| and |widest| keys. |
| 6061 |
% \fi |
| 6062 |
% \begin{macrocode} |
| 6063 |
\dim_new:N \l_@@_current_widest_dim |
| 6064 |
\tl_new:N \g_@@_counter_styles_tl |
| 6065 |
\tl_new:N \g_@@_widest_label_tl |
| 6066 |
\box_new:N \l_@@_label_width_by_box |
| 6067 |
% \end{macrocode} |
| 6068 |
% \end{variable} |
| 6069 |
% |
| 6070 |
% \begin{variable}[int]{\l_@@_leftmargin_tmp_X_bool, \l_@@_leftmargin_tmp_X_dim, |
| 6071 |
% \l_@@_leftmargin_X_dim, \l_@@_itemindent_X_dim,} |
| 6072 |
% The boolean variable \myvarenv{l__@@_leftmargin_tmp_X_bool} and the |
| 6073 |
% dimensional variable \myvarenv{l__@@_leftmargin_tmp_X_dim} |
| 6074 |
% are used by the \mykey{list-indent} key (\S\ref{key:list-indent}). |
| 6075 |
% The variables \myvarenv{l__@@_leftmargin_X_dim} and |
| 6076 |
% \myvarenv{l__@@_itemindent_X_dim} are used and set by the function |
| 6077 |
% \myvarenv{__@@_calc_hspace:NNNNNNNNNNNN} (\S\ref{int:leftmargin}). |
| 6078 |
% \iffalse |
| 6079 |
%% Add \l__enumext_leftmargin_tmp_X_bool, \l__enumext_leftmargin_tmp_X_dim, |
| 6080 |
%% \l__enumext_leftmargin_X_dim, \l__enumext_itemindent_X_dim used by the |
| 6081 |
%% function \enumext_calc_hspace:NNNNNNNNNNNN and |list-indent| key. |
| 6082 |
% \fi |
| 6083 |
% \begin{macrocode} |
| 6084 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 6085 |
{ |
| 6086 |
\bool_new:c { l_@@_leftmargin_tmp_#1_bool } |
| 6087 |
\dim_new:c { l_@@_leftmargin_tmp_#1_dim } |
| 6088 |
\dim_new:c { l_@@_leftmargin_#1_dim } |
| 6089 |
\dim_new:c { l_@@_itemindent_#1_dim } |
| 6090 |
} |
| 6091 |
\clist_map_inline:nn { i, ii, iii, iv, v, vi, vii, viii } { \@@_tmp:n {#1} } |
| 6092 |
% \end{macrocode} |
| 6093 |
% \end{variable} |
| 6094 |
% |
| 6095 |
% \begin{variable}[int]{ \l_@@_multicols_above_X_skip, \l_@@_multicols_below_X_skip, |
| 6096 |
% \g_@@_multicols_right_X_skip, \l_@@_align_label_pos_X_str,} |
| 6097 |
% Internal variables used by \mykey{columns} key (\S\ref{vspace:multi}) |
| 6098 |
% and \mykey{align} key (\S\ref{key:label}). |
| 6099 |
% \iffalse |
| 6100 |
%% Variables used by |columns| and |align| keys in |enumext| and |keyans| environments. |
| 6101 |
% \fi |
| 6102 |
% \begin{macrocode} |
| 6103 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 6104 |
{ |
| 6105 |
\skip_new:c { l_@@_multicols_above_#1_skip } |
| 6106 |
\skip_new:c { l_@@_multicols_below_#1_skip } |
| 6107 |
\skip_new:c { g_@@_multicols_right_#1_skip } |
| 6108 |
\str_new:c { l_@@_align_label_pos_#1_str } |
| 6109 |
} |
| 6110 |
\clist_map_inline:nn { i, ii, iii, iv, v } { \@@_tmp:n {#1} } |
| 6111 |
% \end{macrocode} |
| 6112 |
% \end{variable} |
| 6113 |
% |
| 6114 |
% \begin{variable}[int]{\g_@@_minipage_stat_int, \l_@@_minipage_temp_skip, |
| 6115 |
% \l_@@_minipage_left_skip, \l_@@_minipage_right_skip, |
| 6116 |
% \l_@@_minipage_after_skip, \g_@@_minipage_right_skip, |
| 6117 |
% \g_@@_minipage_after_skip, \l_@@_minipage_left_X_dim, |
| 6118 |
% \l_@@_minipage_active_X_bool,} |
| 6119 |
% Internal variables used by \ics*{miniright} command (\S\ref{cmd:miniright}) |
| 6120 |
% and the keys \mykey{mini-right}, \mykey{mini-right*}, \mykey{mini-env} |
| 6121 |
% and \mykey{mini-sep} (\S\ref{key:mini-multi}, \S\ref{vspace:minipage}). |
| 6122 |
% \iffalse |
| 6123 |
%% Variables used by |miniright|, |mini-env|, |mini-sep| and |\miniright|. |
| 6124 |
% \fi |
| 6125 |
% \begin{macrocode} |
| 6126 |
\int_new:N \g_@@_minipage_stat_int |
| 6127 |
\skip_new:N \l_@@_minipage_temp_skip |
| 6128 |
\skip_new:N \l_@@_minipage_left_skip |
| 6129 |
\skip_new:N \l_@@_minipage_right_skip |
| 6130 |
\skip_new:N \l_@@_minipage_after_skip |
| 6131 |
\skip_new:N \g_@@_minipage_right_skip |
| 6132 |
\skip_new:N \g_@@_minipage_after_skip |
| 6133 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 6134 |
{ |
| 6135 |
\dim_new:c { l_@@_minipage_left_#1_dim } |
| 6136 |
\bool_new:c { l_@@_minipage_active_#1_bool } |
| 6137 |
} |
| 6138 |
\clist_map_inline:nn { i, ii, iii, iv, v, vii, viii } { \@@_tmp:n {#1} } |
| 6139 |
% \end{macrocode} |
| 6140 |
% \end{variable} |
| 6141 |
% |
| 6142 |
% \begin{variable}[int]{\l_@@_wrap_label_X_bool, \l_@@_wrap_label_opt_X_bool, |
| 6143 |
% \l_@@_start_X_int, \l_@@_fake_item_indent_X_tl, \l_@@_label_fill_left_X_tl, |
| 6144 |
% \l_@@_label_fill_right_X_tl, \l_@@_vspace_a_star_X_bool, |
| 6145 |
% \l_@@_vspace_b_star_X_bool,} |
| 6146 |
% The bool vars \myvarenv{l__@@_wrap_label_X_bool} and |
| 6147 |
% \myvarenv{l__@@_wrap_label_opt_X_bool} are used by \mykey{wrap-label} |
| 6148 |
% and \mykey{wrap-label*} keys (\S\ref{key:label}), the integer |
| 6149 |
% \myvarenv{l__@@_start_X_int} are used by the \mykey{start} and \mykey{start*} keys (\S\ref{key:start-widest}), |
| 6150 |
% the token list \myvarenv{l__@@_fake_item_indent_X_tl } is used by \mykey{itemindent} key (\S\ref{key:fake-indent}), |
| 6151 |
% the variables \myvarenv{l__@@_label_fill_left_X_tl} and \myvarenv{l__@@_label_fill_left_X_tl} are used by the |
| 6152 |
% \mykey{align} key (\S\ref{key:label}). The boolean vars \myvarenv{l__@@_vspace_a_star_X_bool}, |
| 6153 |
% \myvarenv{l__@@_vspace_b_star_X_bool} are used by \mykey{above}, |
| 6154 |
% \mykey{above*}, \mykey{below} and \mykey{below*} keys (\S\ref{key:before}). |
| 6155 |
% \iffalse |
| 6156 |
%% Internal variables used by |wrap-label|, |start*|, |start|, |align|, |above| and |below| keys. |
| 6157 |
% \fi |
| 6158 |
% \begin{macrocode} |
| 6159 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 6160 |
{ |
| 6161 |
\bool_new:c { l_@@_wrap_label_#1_bool } |
| 6162 |
\bool_new:c { l_@@_wrap_label_opt_#1_bool } |
| 6163 |
\int_new:c { l_@@_start_#1_int } |
| 6164 |
\tl_new:c { l_@@_fake_item_indent_#1_tl } |
| 6165 |
\tl_new:c { l_@@_label_fill_left_#1_tl } |
| 6166 |
\tl_new:c { l_@@_label_fill_right_#1_tl } |
| 6167 |
\bool_new:c { l_@@_vspace_a_star_#1_bool } |
| 6168 |
\bool_new:c { l_@@_vspace_b_star_#1_bool } |
| 6169 |
} |
| 6170 |
\clist_map_inline:nn { i, ii, iii, iv, v, vii, viii } { \@@_tmp:n {#1} } |
| 6171 |
% \end{macrocode} |
| 6172 |
% \end{variable} |
| 6173 |
% |
| 6174 |
% \begin{variable}[int]{\l_@@_store_active_bool, \l_@@_store_name_tl, |
| 6175 |
% \g_@@_store_name_tl, \l_@@_store_current_label_tl, |
| 6176 |
% \l_@@_store_current_opt_arg_tl,} |
| 6177 |
% |
| 6178 |
% The variable \cs{l_@@_store_active_bool} setting by |
| 6179 |
% \mykey{save-ans} key (\S\ref{key:save-ans}) activates all the |
| 6180 |
% mechanism related to \ics*{anskey}, \myenv*{anskey*}, \myenv*{keyans}, |
| 6181 |
% \myenv*{keyans*} and \myenv*{keyanspic} environments. |
| 6182 |
% |
| 6183 |
% \smallskip |
| 6184 |
% |
| 6185 |
% The variable \cs{l_@@_store_name_tl} saves the \mymarg{store name} |
| 6186 |
% set by the \mykey{save-ans} key of the \emph{sequence} and \emph{prop |
| 6187 |
% list} in which we will store, the variable \cs{g_@@_store_name_tl} |
| 6188 |
% it's just a global copy of \mymarg{store name} used by different functions. |
| 6189 |
% |
| 6190 |
% The variables \cs{l_@@_store_current_label_tl} and |
| 6191 |
% \cs{l_@@_store_current_opt_arg_tl} save the \emph{current label} and |
| 6192 |
% \emph{optional argument} of \ics*{item*} (\S\ref{cmd:item-starred}) and \ics*{anspic*} |
| 6193 |
% (\S\ref{cmd:anspic}) for the \myenv*{keyans}, \myenv*{keyans*} and |
| 6194 |
% \myenv*{keyanspic} environments. |
| 6195 |
% \iffalse |
| 6196 |
%% Variables used by |save-ans| key. |
| 6197 |
% \fi |
| 6198 |
% \begin{macrocode} |
| 6199 |
\bool_new:N \l_@@_store_active_bool |
| 6200 |
\tl_new:N \l_@@_store_name_tl |
| 6201 |
\tl_new:N \g_@@_store_name_tl |
| 6202 |
\tl_new:N \l_@@_store_current_label_tl |
| 6203 |
\tl_new:N \l_@@_store_current_opt_arg_tl |
| 6204 |
% \end{macrocode} |
| 6205 |
% \end{variable} |
| 6206 |
% |
| 6207 |
% \begin{variable}[int]{\l_@@_store_anskey_arg_tl, \l_@@_store_anskey_env_tl, |
| 6208 |
% \l_@@_write_anskey_env_bool, \l_@@_write_anskey_env_file_name_tl, |
| 6209 |
% \l_@@_write_anskey_env_file_iow,} |
| 6210 |
% The variable \cs{l_@@_store_anskey_arg_tl} save the \emph{argument} |
| 6211 |
% of \ics*{anskey} (\S\ref{cmd:anskey}) and the variables |
| 6212 |
% \cs{l_@@_store_anskey_env_tl} save the \mymeta{body} |
| 6213 |
% of the environment \myenv*{anskey*} (\S\ref{env:anskey}). |
| 6214 |
% |
| 6215 |
% \smallskip |
| 6216 |
% |
| 6217 |
% The variables \cs{l_@@_write_anskey_env_bool}, \cs{l_@@_write_anskey_env_file_name_tl} |
| 6218 |
% and \cs{l_@@_write_anskey_env_file_iow} they are used by the \mykey{write-env} |
| 6219 |
% and \mykey{overwrite} keys in the \myenv*{anskey*} environment implementation. |
| 6220 |
% \iffalse |
| 6221 |
%% Variables used by |\anskey| and |anskey*|. |
| 6222 |
% \fi |
| 6223 |
% \begin{macrocode} |
| 6224 |
\tl_new:N \l_@@_store_anskey_arg_tl |
| 6225 |
\tl_new:N \l_@@_store_anskey_env_tl |
| 6226 |
\bool_new:N \l_@@_write_anskey_env_bool |
| 6227 |
\tl_new:N \l_@@_write_anskey_env_file_name_tl |
| 6228 |
\iow_new:N \l_@@_write_anskey_env_file_iow |
| 6229 |
% \end{macrocode} |
| 6230 |
% \end{variable} |
| 6231 |
% |
| 6232 |
% \begin{variable}[int]{\c_@@_anskey_env_hidden_space_str,} |
| 6233 |
% The \cs{c_@@_anskey_env_hidden_space_str} is a constant \emph{string} |
| 6234 |
% to used to hide the \mymeta{forced space} added by \hologo{TeX} when |
| 6235 |
% recording content in a macro. This \emph{string} contains the \emph{reserved phrase} |
| 6236 |
% `|%^^Aenumextheol%|' which is added to the end of the argument stored |
| 6237 |
% in \emph{sequence} and \emph{prop list} when the key |force-eol| is false. |
| 6238 |
% \begin{macrocode} |
| 6239 |
\str_const:Ne \c_@@_anskey_env_hidden_space_str |
| 6240 |
{ \c_percent_str \c_circumflex_str \c_circumflex_str A enumextheol \c_percent_str } |
| 6241 |
% \end{macrocode} |
| 6242 |
% \end{variable} |
| 6243 |
% |
| 6244 |
% \begin{variable}[int]{\l_@@_setkey_tmpa_tl, \l_@@_setkey_tmpb_tl, |
| 6245 |
% \l_@@_setkey_tmpa_int, \l_@@_setkey_tmpa_seq, |
| 6246 |
% \l_@@_setkey_tmpb_seq,} |
| 6247 |
% Internal variables used by the command \ics*{setenumext} (\S\ref{cmd:setenumext}). |
| 6248 |
% \iffalse |
| 6249 |
%% Variables used by |\setenumext|. |
| 6250 |
% \fi |
| 6251 |
% \begin{macrocode} |
| 6252 |
\tl_new:N \l_@@_setkey_tmpa_tl |
| 6253 |
\tl_new:N \l_@@_setkey_tmpb_tl |
| 6254 |
\int_new:N \l_@@_setkey_tmpa_int |
| 6255 |
\seq_new:N \l_@@_setkey_tmpa_seq |
| 6256 |
\seq_new:N \l_@@_setkey_tmpb_seq |
| 6257 |
% \end{macrocode} |
| 6258 |
% \end{variable} |
| 6259 |
% |
| 6260 |
% \begin{variable}[int]{\l_@@_meta_path_str, \l_@@_foreach_print_seq, |
| 6261 |
% \l_@@_foreach_name_prop_tl, \l_@@_foreach_default_keys_tl,} |
| 6262 |
% Internal variables used by the |\setenumextmeta| command (\S\ref{cmd:setenumextmeta}) |
| 6263 |
% and |\foreachkeyans| command (\S\ref{cmd:foreachkeyans}). |
| 6264 |
% \begin{macrocode} |
| 6265 |
\str_new:N \l_@@_meta_path_str |
| 6266 |
\seq_new:N \l_@@_foreach_print_seq |
| 6267 |
\tl_new:N \l_@@_foreach_name_prop_tl |
| 6268 |
\tl_new:N \l_@@_foreach_default_keys_tl |
| 6269 |
% \end{macrocode} |
| 6270 |
% \end{variable} |
| 6271 |
% |
| 6272 |
% |
| 6273 |
% \begin{variable}[int]{\l_@@_print_keyans_starred_tl, \l_@@_print_keyans_star_bool, |
| 6274 |
% \l_@@_print_keyans_cmd_bool, \l_@@_mark_position_str, |
| 6275 |
% \l_@@_mark_position_v_str, |
| 6276 |
% \l_@@_mark_position_viii_str, \l_@@_mark_sep_tmpa_dim, |
| 6277 |
% \l_@@_mark_sep_tmpb_dim, \l_@@_show_pos_tmp_int, |
| 6278 |
% \g_@@_item_symbol_aux_tl, \l_@@_print_keyans_X_tl, |
| 6279 |
% \l_@@_store_save_key_X_tl, \l_@@_store_save_key_X_bool, |
| 6280 |
% \l_@@_store_upper_level_X_bool,} |
| 6281 |
% Internal variables used by command \ics*{printkeyans} |
| 6282 |
% (\S\ref{cmd:printkeyans}), \mykey{show-pos}, \mykey{show-ans}, \mykey{mark-pos}, \mykey{mark-sep} keys (\S\ref{int:storage-system}), |
| 6283 |
% \mykey{item-sym*} key (\S\ref{key:item-starred}), \mykey{save-key} key |
| 6284 |
% (\S\ref{key:save-key}) and \emph{\enquote{storing structure}}. |
| 6285 |
% \iffalse |
| 6286 |
%% Variables used by |\printkeyans|, |mark-pos|, |item-sym*|, |save-key| and storing structure in |enumext| and |enumext*|. |
| 6287 |
% \fi |
| 6288 |
% \begin{macrocode} |
| 6289 |
\tl_new:N \l_@@_print_keyans_starred_tl |
| 6290 |
\bool_new:N \l_@@_print_keyans_star_bool |
| 6291 |
\bool_new:N \l_@@_print_keyans_cmd_bool |
| 6292 |
\str_new:N \l_@@_mark_position_str |
| 6293 |
\str_new:N \l_@@_mark_position_v_str |
| 6294 |
\str_new:N \l_@@_mark_position_viii_str |
| 6295 |
\dim_new:N \l_@@_mark_sep_tmpa_dim |
| 6296 |
\dim_new:N \l_@@_mark_sep_tmpb_dim |
| 6297 |
\int_new:N \l_@@_show_pos_tmp_int |
| 6298 |
\tl_new:N \g_@@_item_symbol_aux_tl |
| 6299 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 6300 |
{ |
| 6301 |
\tl_new:c { l_@@_print_keyans_#1_tl } |
| 6302 |
\tl_new:c { l_@@_store_save_key_#1_tl } |
| 6303 |
\bool_new:c { l_@@_store_save_key_#1_bool } |
| 6304 |
\bool_new:c { l_@@_store_upper_level_#1_bool } |
| 6305 |
} |
| 6306 |
\clist_map_inline:nn { i, ii, iii, iv, vii } { \@@_tmp:n {#1} } |
| 6307 |
% \end{macrocode} |
| 6308 |
% \end{variable} |
| 6309 |
% |
| 6310 |
% \begin{variable}{\l_@@_anspic_args_seq, \l_@@_anspic_mini_width_dim, |
| 6311 |
% \l_@@_anspic_above_int,\l_@@_anspic_below_int, |
| 6312 |
% \l_@@_anspic_label_above_bool, \l_@@_anspic_mini_pos_str, |
| 6313 |
% \l_@@_anspic_label_box, \l_@@_anspic_body_box, |
| 6314 |
% \l_@@_anspic_label_htdp_dim, \l_@@_anspic_body_htdp_dim,} |
| 6315 |
% Internal variables used by \myenv*{keyanspic} environment and |
| 6316 |
% \ics*{anspic} command (\S\ref{env:keyanspic}). |
| 6317 |
% \iffalse |
| 6318 |
%% Variables used by |\anspic| and |keyanspic|. |
| 6319 |
% \fi |
| 6320 |
% \begin{macrocode} |
| 6321 |
\seq_new:N \l_@@_anspic_args_seq |
| 6322 |
\dim_new:N \l_@@_anspic_mini_width_dim |
| 6323 |
\int_new:N \l_@@_anspic_above_int |
| 6324 |
\int_new:N \l_@@_anspic_below_int |
| 6325 |
\bool_new:N \l_@@_anspic_label_above_bool |
| 6326 |
\str_new:N \l_@@_anspic_mini_pos_str |
| 6327 |
\box_new:N \l_@@_anspic_label_box |
| 6328 |
\box_new:N \l_@@_anspic_body_box |
| 6329 |
\dim_new:N \l_@@_anspic_label_htdp_dim |
| 6330 |
\dim_new:N \l_@@_anspic_body_htdp_dim |
| 6331 |
% \end{macrocode} |
| 6332 |
% \end{variable} |
| 6333 |
% |
| 6334 |
% \begin{variable}{\l_@@_check_answers_bool,\g_@@_check_ans_key_bool, |
| 6335 |
% \l_@@_check_start_line_env_tl, \l_@@_item_wrap_key_bool, |
| 6336 |
% \g_@@_check_starred_cmd_int, \g_@@_item_anskey_int, |
| 6337 |
% \g_@@_item_number_int, \g_@@_item_number_bool, |
| 6338 |
% \g_@@_item_answer_diff_int,} |
| 6339 |
% Internal variables used by \emph{\enquote{internal check answer}} mechanism |
| 6340 |
% (\S\ref{int:check-answer}) used by the \mykey{check-ans}, \mykey{no-store}, \mykey{wrap-ans*} |
| 6341 |
% keys and check for starred commands \ics*{item*} in \myenv*{keyans} and |
| 6342 |
% \myenv*{keyans*} environments and \ics*{anspic*} |
| 6343 |
% in \myenv*{keyanspic} environment. |
| 6344 |
% \iffalse |
| 6345 |
%% Variables used by check-answer mechanism, |check-ans|, |wrap-ans*| and |no-store| keys. |
| 6346 |
% \fi |
| 6347 |
% \begin{macrocode} |
| 6348 |
\bool_new:N \l_@@_check_answers_bool |
| 6349 |
\bool_new:N \g_@@_check_ans_key_bool |
| 6350 |
\tl_new:N \l_@@_check_start_line_env_tl |
| 6351 |
\bool_new:N \l_@@_item_wrap_key_bool |
| 6352 |
\int_new:N \g_@@_check_starred_cmd_int |
| 6353 |
\int_new:N \g_@@_item_anskey_int |
| 6354 |
\int_new:N \g_@@_item_number_int |
| 6355 |
\bool_new:N \l_@@_item_number_bool |
| 6356 |
\int_new:N \g_@@_item_answer_diff_int |
| 6357 |
% \end{macrocode} |
| 6358 |
% \end{variable} |
| 6359 |
% |
| 6360 |
% \begin{variable}[int]{\l_@@_hyperref_bool, \l_@@_footnotes_key_bool,} |
| 6361 |
% The boolean variable \cs{l_@@_hyperref_bool} will determine if the |
| 6362 |
% \mypkg{hyperref} package is present or load in memory |
| 6363 |
% (\S\ref{pkg:hyperref}). The boolean variable \cs{l_@@_footnotes_key_bool} |
| 6364 |
% determine if \mypkg{hyperref} is load with key |hyperfootnotes=true|. |
| 6365 |
% \iffalse |
| 6366 |
%% Variables used for hyperref detection. |
| 6367 |
% \fi |
| 6368 |
% \begin{macrocode} |
| 6369 |
\bool_new:N \l_@@_hyperref_bool |
| 6370 |
\bool_new:N \l_@@_footnotes_key_bool |
| 6371 |
% \end{macrocode} |
| 6372 |
% \end{variable} |
| 6373 |
% |
| 6374 |
% \begin{variable}[int]{ \l_@@_newlabel_arg_one_tl, \l_@@_newlabel_arg_two_tl, |
| 6375 |
% \l_@@_write_aux_file_tl, \l_@@_label_copy_X_tl, } |
| 6376 |
% Internal variables used by \mykey{save-ref} key (\S\ref{int:storage-system}). |
| 6377 |
% The variables \myvarenv{l__@@_label_copy_X_tl} correspond to temporary |
| 6378 |
% copies of the \mymeta{labels} defined by level on which operations will be performed. |
| 6379 |
% |
| 6380 |
% \smallskip |
| 6381 |
% |
| 6382 |
% The variables \cs{l_@@_newlabel_arg_one_tl} and \cs{l_@@_newlabel_arg_two_tl} |
| 6383 |
% will be used to form the arguments passed to the function |
| 6384 |
% \cs{@@_newlabel:nn} (\S\ref{fun:newlabel}) and the variable \cs{l_@@_write_aux_file_tl} |
| 6385 |
% will be in charge of executing the writing code in the |.aux| file. |
| 6386 |
% \iffalse |
| 6387 |
%% Variables used by |save-ref| key (internal label and ref). |
| 6388 |
% \fi |
| 6389 |
% \begin{macrocode} |
| 6390 |
\tl_new:N \l_@@_newlabel_arg_one_tl |
| 6391 |
\tl_new:N \l_@@_newlabel_arg_two_tl |
| 6392 |
\tl_new:N \l_@@_write_aux_file_tl |
| 6393 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 6394 |
{ |
| 6395 |
\tl_new:c { l_@@_label_copy_#1_tl } |
| 6396 |
} |
| 6397 |
\clist_map_inline:nn { i, ii, iii, iv, v, vi, vii, viii } { \@@_tmp:n {#1} } |
| 6398 |
% \end{macrocode} |
| 6399 |
% \end{variable} |
| 6400 |
% |
| 6401 |
% \begin{variable}{ \g_@@_footnote_standar_int, \g_@@_footnote_starred_int, |
| 6402 |
% \g_@@_footnote_standar_arg_seq, \g_@@_footnote_starred_arg_seq, |
| 6403 |
% \g_@@_footnote_standar_int_seq, \g_@@_footnote_starred_int_seq} |
| 6404 |
% Internal variables used for redefinition of |\footnote| (\S\ref{ltx:footnote}). |
| 6405 |
% \iffalse |
| 6406 |
%% Variables used by |footnote| redefinition. |
| 6407 |
% \fi |
| 6408 |
% \begin{macrocode} |
| 6409 |
\int_new:N \g_@@_footnote_standar_int |
| 6410 |
\int_new:N \g_@@_footnote_starred_int |
| 6411 |
\seq_new:N \g_@@_footnote_standar_arg_seq |
| 6412 |
\seq_new:N \g_@@_footnote_starred_arg_seq |
| 6413 |
\seq_new:N \g_@@_footnote_standar_int_seq |
| 6414 |
\seq_new:N \g_@@_footnote_starred_int_seq |
| 6415 |
% \end{macrocode} |
| 6416 |
% \end{variable} |
| 6417 |
% |
| 6418 |
% \begin{variable}[int]{\l_@@_item_starred_X_bool, l_@@_item_column_pos_X_int, |
| 6419 |
% \g_@@_item_count_all_X_int, \l_@@_joined_item_X_int, |
| 6420 |
% \l_@@_joined_item_aux_X_int, \l_@@_tmpa_X_int, \l_@@_tmpa_X_dim, |
| 6421 |
% \l_@@_item_text_X_box, \l_@@_joined_width_X_dim, |
| 6422 |
% \l_@@_item_width_X_dim, \g_@@_item_symbol_aux_X_tl, |
| 6423 |
% \l_@@_align_label_X_str, \g_@@_minipage_active_X_bool, |
| 6424 |
% \l_@@_miniright_code_X_box , \g_@@_minipage_center_X_bool, |
| 6425 |
% \g_@@_minipage_right_X_dim, \g_@@_minipage_right_X_skip,} |
| 6426 |
% Internal variables used by \myenv*{enumext*} and \myenv*{keyans*} environments. |
| 6427 |
% \iffalse |
| 6428 |
%% Variables used by |enumext*| and |keyans*| environments. |
| 6429 |
% \fi |
| 6430 |
% \begin{macrocode} |
| 6431 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 6432 |
{ |
| 6433 |
\bool_new:c { l_@@_item_starred_#1_bool } |
| 6434 |
\int_new:c { l_@@_item_column_pos_#1_int } |
| 6435 |
\int_new:c { g_@@_item_count_all_#1_int } |
| 6436 |
\int_new:c { l_@@_joined_item_#1_int } |
| 6437 |
\int_new:c { l_@@_joined_item_aux_#1_int } |
| 6438 |
\int_new:c { l_@@_tmpa_#1_int } |
| 6439 |
\dim_new:c { l_@@_tmpa_#1_dim } |
| 6440 |
\box_new:c { l_@@_item_text_#1_box } |
| 6441 |
\dim_new:c { l_@@_joined_width_#1_dim } |
| 6442 |
\dim_new:c { l_@@_item_width_#1_dim } |
| 6443 |
\tl_new:c { g_@@_item_symbol_aux_#1_tl } |
| 6444 |
\str_new:c { l_@@_align_label_#1_str } |
| 6445 |
\bool_new:c { g_@@_minipage_active_#1_bool } |
| 6446 |
\box_new:c { l_@@_miniright_code_#1_box } |
| 6447 |
\bool_new:c { g_@@_minipage_center_#1_bool } |
| 6448 |
\dim_new:c { g_@@_minipage_right_#1_dim } |
| 6449 |
\skip_new:c { g_@@_minipage_right_#1_skip } |
| 6450 |
} |
| 6451 |
\clist_map_inline:nn { vii, viii } { \@@_tmp:n {#1} } |
| 6452 |
% \end{macrocode} |
| 6453 |
% \end{variable} |
| 6454 |
% |
| 6455 |
% \begin{variable}{\c_@@_all_envs_clist,} |
| 6456 |
% An internal |clist-var| variable to run with \myvarenv{__@@_tmp:n}. |
| 6457 |
% \begin{macrocode} |
| 6458 |
\clist_const:Nn \c_@@_all_envs_clist |
| 6459 |
{ |
| 6460 |
{level-1}{i}, {level-2}{ii}, {level-3}{iii}, {level-4}{iv}, |
| 6461 |
{keyans}{v}, {enumext*}{vii}, {keyans*}{viii} |
| 6462 |
} |
| 6463 |
% \end{macrocode} |
| 6464 |
% \end{variable} |
| 6465 |
% |
| 6466 |
% \subsection{Some utility functions} |
| 6467 |
% |
| 6468 |
% \begin{macro}[int]{\keys_precompile:neN, \seq_use:NV,} |
| 6469 |
% Non-standard kernel variants used by the |\printkeyans| command |
| 6470 |
% (\S\ref{cmd:printkeyans}) and |\foreachkeyans| command (\S\ref{cmd:foreachkeyans}). |
| 6471 |
% \begin{macrocode} |
| 6472 |
\cs_generate_variant:Nn \keys_precompile:nnN { neN } |
| 6473 |
\cs_generate_variant:Nn \seq_use:Nn { NV } |
| 6474 |
% \end{macrocode} |
| 6475 |
% \end{macro} |
| 6476 |
% |
| 6477 |
% \begin{macro}{\@@_at_begin_document:n} |
| 6478 |
% A internal \emph{\enquote{hook}} function used for copying plain |
| 6479 |
% \myenv{list} and \myenv{minipage} environments definition and |
| 6480 |
% \mypkg{hyperref} detection. |
| 6481 |
% \iffalse |
| 6482 |
%% A internal "hooks" functions used for copying and execute code. |
| 6483 |
% \fi |
| 6484 |
% \begin{macrocode} |
| 6485 |
\cs_new_protected:Npn \@@_at_begin_document:n #1 |
| 6486 |
{ |
| 6487 |
\hook_gput_code:nnn {begindocument} {enumext} { #1 } |
| 6488 |
} |
| 6489 |
% \end{macrocode} |
| 6490 |
% \end{macro} |
| 6491 |
% |
| 6492 |
% \begin{macro}{\@@_after_env:nn, \@@_before_env:nn} |
| 6493 |
% A internal \emph{\enquote{hook}} functions for execute code \mykey{mini-right} |
| 6494 |
% and \mykey{mini-right*} keys outside the \myenv*{enumext*} and |
| 6495 |
% \myenv*{keyans*} environments and print \mykey{check-ans} outside the |
| 6496 |
% \myenv*{enumext} and \myenv*{enumext*} environments. |
| 6497 |
% \begin{macrocode} |
| 6498 |
\cs_new_protected:Npn \@@_after_env:nn #1 #2 |
| 6499 |
{ |
| 6500 |
\hook_gput_code:nnn {env/#1/after} {enumext} {#2} |
| 6501 |
} |
| 6502 |
\cs_new_protected:Npn \@@_before_env:nn #1 #2 |
| 6503 |
{ |
| 6504 |
\hook_gput_code:nnn {env/#1/before} {enumext} {#2} |
| 6505 |
} |
| 6506 |
% \end{macrocode} |
| 6507 |
% \end{macro} |
| 6508 |
% |
| 6509 |
% \begin{macro}{\@@_level:} |
| 6510 |
% Function for check current level in \myenv*{enumext}. |
| 6511 |
% \iffalse |
| 6512 |
%% Function to check current level. |
| 6513 |
% \fi |
| 6514 |
% \begin{macrocode} |
| 6515 |
\cs_new:Nn \@@_level: |
| 6516 |
{ |
| 6517 |
\int_to_roman:n { \l_@@_level_int } |
| 6518 |
} |
| 6519 |
% \end{macrocode} |
| 6520 |
% \end{macro} |
| 6521 |
% |
| 6522 |
% \begin{macro}[int]{\@@_if_is_int:nT, \@@_if_is_int:nF, \@@_if_is_int:nTF} |
| 6523 |
% A conditional function to determine whether the variable we are passing is |
| 6524 |
% an integer used by \mykey{start} and \mykey{widest} keys. |
| 6525 |
% This function is taken directly from the answer given by Henri Menke |
| 6526 |
% in \href{https://tex.stackexchange.com/a/427559}{How to test if an expl3 function argument is an integer expression?}. |
| 6527 |
% \iffalse |
| 6528 |
%% Function to check integer variables used by |start| and |widest| keys. |
| 6529 |
% \fi |
| 6530 |
% \begin{macrocode} |
| 6531 |
\prg_new_protected_conditional:Npnn \@@_if_is_int:n #1 { T, F, TF } |
| 6532 |
{ |
| 6533 |
\regex_if_match:nnTF { ^[\+\-]?[\d]+$ } {#1} % $ |
| 6534 |
{ \prg_return_true: } |
| 6535 |
{ \prg_return_false: } |
| 6536 |
} |
| 6537 |
% \end{macrocode} |
| 6538 |
% \end{macro} |
| 6539 |
% |
| 6540 |
% \begin{macro}{\@@_show_length:nnn} |
| 6541 |
% Internal function used by \mykey{show-length} key to show |
| 6542 |
% \emph{\enquote{all lengths}} calculated and used in |
| 6543 |
% \myenv*{enumext}, \myenv*{enumext*}, \myenv*{keyans} and |
| 6544 |
% \myenv*{keyans*} environments. |
| 6545 |
% \iffalse |
| 6546 |
%% Function to show list lengths used by |show-length| key. |
| 6547 |
% \fi |
| 6548 |
% \begin{macrocode} |
| 6549 |
\cs_new:Npn \@@_show_length:nnn #1 #2 #3 |
| 6550 |
{ |
| 6551 |
*~#2 |
| 6552 |
\prg_replicate:nn { 14 - \str_count:n {#2} } {~} |
| 6553 |
=~\use:c { #1_use:c } { l_@@_#2_#3_#1 } \\ |
| 6554 |
} |
| 6555 |
% \end{macrocode} |
| 6556 |
% \end{macro} |
| 6557 |
% |
| 6558 |
% \begin{macro}{\@@_unskip_unkern:} |
| 6559 |
% The function \cs{@@_unskip_unkern:} will remove the last \mymeta{skip} |
| 6560 |
% or \mymeta{kern} at execution time using the values \mydim{11} and |
| 6561 |
% \mydim{12} of |\lastnodetype| to apply |\unskip| or |\unkern| depending |
| 6562 |
% on the case. |
| 6563 |
% \iffalse |
| 6564 |
%% Remove last skip or kern. |
| 6565 |
% \fi |
| 6566 |
% \begin{macrocode} |
| 6567 |
\cs_new_protected:Nn \@@_unskip_unkern: |
| 6568 |
{ |
| 6569 |
\int_case:nnT { \lastnodetype } |
| 6570 |
{ |
| 6571 |
{ 11 }{ \unskip } |
| 6572 |
{ 12 }{ \unkern } |
| 6573 |
} |
| 6574 |
} |
| 6575 |
% \end{macrocode} |
| 6576 |
% \end{macro} |
| 6577 |
% |
| 6578 |
% \subsubsection{Utilities for environments and levels}\label{fun:utilities} |
| 6579 |
% |
| 6580 |
% \begin{macro}{\@@_is_not_nested:, \@@_is_on_first_level:} |
| 6581 |
% The function \cs{@@_is_not_nested:} sets the variables \cs{g_@@_standar_bool} |
| 6582 |
% and \cs{g_@@_starred_bool} to \emph{\enquote{true}} only if the |
| 6583 |
% environments \myenv*{enumext} and \myenv*{enumext*} are NOT nested |
| 6584 |
% in each other and saves the environment name in \cs{l_@@_envir_name_tl}. |
| 6585 |
% \iffalse |
| 6586 |
%% Function to check/set current environment for |enumext| and |enumext*|. |
| 6587 |
% \fi |
| 6588 |
% \begin{macrocode} |
| 6589 |
\cs_new_protected:Nn \@@_is_not_nested: |
| 6590 |
{ |
| 6591 |
\str_case:en { \@currenvir } |
| 6592 |
{ |
| 6593 |
{enumext} |
| 6594 |
{ |
| 6595 |
\tl_set:Nn \l_@@_envir_name_tl { enumext } |
| 6596 |
\bool_lazy_and:nnT |
| 6597 |
{ \bool_not_p:n { \g_@@_standar_bool } } |
| 6598 |
{ \int_compare_p:nNn { \l_@@_level_h_int } = { 0 } } |
| 6599 |
{ |
| 6600 |
\bool_gset_true:N \g_@@_standar_bool |
| 6601 |
} |
| 6602 |
} |
| 6603 |
{enumext*} |
| 6604 |
{ |
| 6605 |
\tl_set:Nn \l_@@_envir_name_tl { enumext* } |
| 6606 |
\bool_lazy_and:nnT |
| 6607 |
{ \bool_not_p:n { \g_@@_starred_bool } } |
| 6608 |
{ \int_compare_p:nNn { \l_@@_level_int } = { 0 } } |
| 6609 |
{ |
| 6610 |
\bool_gset_true:N \g_@@_starred_bool |
| 6611 |
} |
| 6612 |
} |
| 6613 |
} |
| 6614 |
} |
| 6615 |
% \end{macrocode} |
| 6616 |
% The function \cs{@@_is_on_first_level:} will sets the variables |
| 6617 |
% \cs{l_@@_standar_first_bool} (\S\ref{key:save-ans}), |
| 6618 |
% \cs{l_@@_starred_first_bool} (\S\ref{key:save-ans}) to \emph{\enquote{true}} |
| 6619 |
% only if the environment is not nested and we are in the \emph{\enquote{first level}} |
| 6620 |
% of it . We will also save the \emph{start line number} of each environment |
| 6621 |
% in the variable \cs{g_@@_start_line_tl} and the \emph{name} of each |
| 6622 |
% environment in the variable \cs{g_@@_envir_name_tl} to use in messages |
| 6623 |
% related to the \mykey{check-ans} key and |.log| file. |
| 6624 |
% \iffalse |
| 6625 |
%% Function to check/set first level vars for |enumext| and |enumext*|. |
| 6626 |
% \fi |
| 6627 |
% \begin{macrocode} |
| 6628 |
\cs_new_protected:Nn \@@_is_on_first_level: |
| 6629 |
{ |
| 6630 |
\bool_lazy_all:nT |
| 6631 |
{ |
| 6632 |
{ \bool_if_p:N \g_@@_standar_bool } |
| 6633 |
{ \int_compare_p:nNn { \l_@@_level_int } = { 1 } } |
| 6634 |
{ \int_compare_p:nNn { \l_@@_level_h_int } = { 0 } } |
| 6635 |
} |
| 6636 |
{ |
| 6637 |
\bool_set_true:N \l_@@_standar_first_bool |
| 6638 |
\tl_gset:Nn \g_@@_envir_name_tl { enumext } |
| 6639 |
\tl_gset:Ne \g_@@_start_line_tl |
| 6640 |
{ |
| 6641 |
on~line~\exp_not:V \inputlineno |
| 6642 |
} |
| 6643 |
} |
| 6644 |
\bool_lazy_all:nT |
| 6645 |
{ |
| 6646 |
{ \bool_if_p:N \g_@@_starred_bool } |
| 6647 |
{ \int_compare_p:nNn { \l_@@_level_h_int } = { 1 } } |
| 6648 |
{ \int_compare_p:nNn { \l_@@_level_int } = { 0 } } |
| 6649 |
} |
| 6650 |
{ |
| 6651 |
\bool_set_true:N \l_@@_starred_first_bool |
| 6652 |
\tl_gset:Nn \g_@@_envir_name_tl { enumext* } |
| 6653 |
\tl_gset:Ne \g_@@_start_line_tl |
| 6654 |
{ |
| 6655 |
on~line~\exp_not:V \inputlineno |
| 6656 |
} |
| 6657 |
} |
| 6658 |
} |
| 6659 |
% \end{macrocode} |
| 6660 |
% \end{macro} |
| 6661 |
% |
| 6662 |
% \begin{macro}{\@@_keyans_name_and_start:} |
| 6663 |
% The function \cs{@@_keyans_name_and_start:} will save the start line |
| 6664 |
% number and name of the environments \myenv*{keyans}, \myenv*{keyans*} and |
| 6665 |
% \myenv*{keyanspic} in the variables \cs{l_@@_check_start_line_env_tl} |
| 6666 |
% and \cs{l_@@_envir_name_tl} to use in the \cs{@@_check_starred_cmd:n} function. |
| 6667 |
% \iffalse |
| 6668 |
%% Function to save the current name and start line for |keyans|, |keyans*| and |keyanspic|. |
| 6669 |
% \fi |
| 6670 |
% \begin{macrocode} |
| 6671 |
\cs_new_protected:Nn \@@_keyans_name_and_start: |
| 6672 |
{ |
| 6673 |
\str_case:en { \@currenvir } |
| 6674 |
{ |
| 6675 |
{keyans} |
| 6676 |
{ |
| 6677 |
\tl_set:Nn \l_@@_envir_name_tl { keyans } |
| 6678 |
\tl_set:Ne \l_@@_check_start_line_env_tl |
| 6679 |
{ |
| 6680 |
in~'keyans'~start~on~line~\exp_not:V \inputlineno |
| 6681 |
} |
| 6682 |
} |
| 6683 |
{keyans*} |
| 6684 |
{ |
| 6685 |
\tl_set:Nn \l_@@_envir_name_tl { keyans* } |
| 6686 |
\tl_set:Ne \l_@@_check_start_line_env_tl |
| 6687 |
{ |
| 6688 |
in~'keyans*'~start~on~line~\exp_not:V \inputlineno |
| 6689 |
} |
| 6690 |
} |
| 6691 |
{keyanspic} |
| 6692 |
{ |
| 6693 |
\tl_set:Nn \l_@@_envir_name_tl { keyanspic } |
| 6694 |
\tl_set:Ne \l_@@_check_start_line_env_tl |
| 6695 |
{ |
| 6696 |
in~'keyanspic'~start~on~line~\exp_not:V \inputlineno |
| 6697 |
} |
| 6698 |
} |
| 6699 |
} |
| 6700 |
} |
| 6701 |
% \end{macrocode} |
| 6702 |
% \end{macro} |
| 6703 |
% |
| 6704 |
% \subsubsection{Utilities for log and terminal} |
| 6705 |
% |
| 6706 |
% \begin{macro}{\@@_reset_global_vars:, \@@_reset_global_int:, |
| 6707 |
% \@@_reset_global_bool:, \@@_reset_global_tl:,} |
| 6708 |
% The function \cs{@@_reset_global_vars:} will be passed to the function |
| 6709 |
% \cs{@@_execute_after_env:} and will return the global variables to |
| 6710 |
% their default values after being used. |
| 6711 |
% \iffalse |
| 6712 |
%% Reset all global vars after use in hook function. |
| 6713 |
% \fi |
| 6714 |
% \begin{macrocode} |
| 6715 |
\cs_new_protected:Nn \@@_reset_global_vars: |
| 6716 |
{ |
| 6717 |
\@@_reset_global_int: |
| 6718 |
\@@_reset_global_bool: |
| 6719 |
\@@_reset_global_tl: |
| 6720 |
} |
| 6721 |
\cs_new_protected:Nn \@@_reset_global_int: |
| 6722 |
{ |
| 6723 |
\int_gzero:N \g_@@_item_number_int |
| 6724 |
\int_gzero:N \g_@@_item_anskey_int |
| 6725 |
\int_gzero:N \g_@@_item_answer_diff_int |
| 6726 |
} |
| 6727 |
\cs_new_protected:Nn \@@_reset_global_bool: |
| 6728 |
{ |
| 6729 |
\bool_gset_false:N \g_@@_check_ans_key_bool |
| 6730 |
\bool_gset_false:N \g_@@_standar_bool |
| 6731 |
\bool_gset_false:N \g_@@_starred_bool |
| 6732 |
} |
| 6733 |
\cs_new_protected:Nn \@@_reset_global_tl: |
| 6734 |
{ |
| 6735 |
\tl_gclear:N \g_@@_store_name_tl |
| 6736 |
\tl_gclear:N \g_@@_start_line_tl |
| 6737 |
\tl_gclear:N \g_@@_envir_name_tl |
| 6738 |
} |
| 6739 |
% \end{macrocode} |
| 6740 |
% \end{macro} |
| 6741 |
% |
| 6742 |
% \begin{macro}{\@@_log_global_vars:, \@@_log_answer_vars:} |
| 6743 |
% The function \cs{@@_log_global_vars:} will be passed to the function |
| 6744 |
% \cs{@@_execute_after_env:} and write to the |.log| file the number of |
| 6745 |
% elements saved in the \emph{prop list} and \emph{sequence} created by the |
| 6746 |
% \mykey{save-ans} key along with the value of the integer variable |
| 6747 |
% created for the \mykey{resume} key. |
| 6748 |
% \iffalse |
| 6749 |
%% Write all global vars after use in hook function. |
| 6750 |
% \fi |
| 6751 |
% \begin{macrocode} |
| 6752 |
\cs_new_protected:Nn \@@_log_global_vars: |
| 6753 |
{ |
| 6754 |
\msg_log:nneeee { enumext } { prop-seq-int-hook } |
| 6755 |
{ \g_@@_store_name_tl } |
| 6756 |
{ \prop_count:c { g_@@_ \g_@@_store_name_tl _prop } } |
| 6757 |
{ \seq_count:c { g_@@_ \g_@@_store_name_tl _seq } } |
| 6758 |
{ \int_use:c { g_@@_resume_ \g_@@_store_name_tl _int } } |
| 6759 |
} |
| 6760 |
% \end{macrocode} |
| 6761 |
% The function \cs{@@_log_answer_vars:} will be passed to the function |
| 6762 |
% \cs{@@_execute_after_env:} and write to the |.log| file the number |
| 6763 |
% of items and answers along with the difference between them. |
| 6764 |
% \iffalse |
| 6765 |
%% Write all global vars for check-answer after use in hook function. |
| 6766 |
% \fi |
| 6767 |
% \begin{macrocode} |
| 6768 |
\cs_new_protected:Nn \@@_log_answer_vars: |
| 6769 |
{ |
| 6770 |
\msg_log:nneee { enumext } { item-answer-hook } |
| 6771 |
{ \int_use:N \g_@@_item_number_int } |
| 6772 |
{ \int_use:N \g_@@_item_anskey_int } |
| 6773 |
{ \int_eval:n { \g_@@_item_number_int - \g_@@_item_anskey_int} } |
| 6774 |
} |
| 6775 |
% \end{macrocode} |
| 6776 |
% \end{macro} |
| 6777 |
% |
| 6778 |
% \subsection{Copying \env{list} and \env{minipage} environments} |
| 6779 |
% |
| 6780 |
% The \myenv{list} environment provided by \hologo{LaTeX} has the |
| 6781 |
% following plain form: |
| 6782 |
% |
| 6783 |
% \iffalse |
| 6784 |
%<*example> |
| 6785 |
% \fi |
| 6786 |
\begin{examplecode}[frame=none] |
| 6787 |
\list`\mymarg{arg one}\mymarg{arg two}` |
| 6788 |
\item`\myoarg{opt}` |
| 6789 |
\endlist |
| 6790 |
\end{examplecode} |
| 6791 |
% \iffalse |
| 6792 |
%</example> |
| 6793 |
% \fi |
| 6794 |
% |
| 6795 |
% And \myenv{minipage} environment provided by \hologo{LaTeX} has the |
| 6796 |
% following (simplified) plain form: |
| 6797 |
% |
| 6798 |
% \iffalse |
| 6799 |
%<*example> |
| 6800 |
% \fi |
| 6801 |
\begin{examplecode}[frame=none] |
| 6802 |
\minipage`\myoarg{pos}\myoarg{height}\myoarg{inner-pos}\mymarg{width}` |
| 6803 |
`\mymeta{internal implement}` |
| 6804 |
\endminipage |
| 6805 |
\end{examplecode} |
| 6806 |
% \iffalse |
| 6807 |
%</example> |
| 6808 |
% \fi |
| 6809 |
% |
| 6810 |
% As a precaution we copy them using \cs{@@_at_begin_document:n} in |
| 6811 |
% case any package redefines the \myenv{list} environment or a related |
| 6812 |
% command. |
| 6813 |
% |
| 6814 |
% \smallskip |
| 6815 |
% |
| 6816 |
% \begin{important} |
| 6817 |
% For compatibility with \emph{tagged} \texttt{PDF} we should use |
| 6818 |
% |\NewCommandCopy| and not |\cs_new_eq:NN| for |\item|. When |
| 6819 |
% \emph{tagged} \texttt{PDF} is active |\item| is redefined using |
| 6820 |
% \mypkg{ltcmd} (see \mypkg{latex-lab-block}\cite{latexlab}). |
| 6821 |
% \end{important} |
| 6822 |
% |
| 6823 |
% \smallskip |
| 6824 |
% |
| 6825 |
% \begin{macro}{\@@_start_list:nn, \@@_stop_list:, \@@_item_std:w, |
| 6826 |
% \@@_minipage:w, \@@_endminipage:,} |
| 6827 |
% The functions \cs{@@_start_list:nn} and \cs{@@_stop_list:} correspond |
| 6828 |
% to copies of |\list| and |\endlist| from plain definition of \myenv{list} |
| 6829 |
% environment, the function \cs{@@_item_std:w} is a copy of the |\item| command. |
| 6830 |
% \iffalse |
| 6831 |
%% Copy |list| environment and |\item| command. |
| 6832 |
% \fi |
| 6833 |
% \begin{macrocode} |
| 6834 |
\@@_at_begin_document:n |
| 6835 |
{ |
| 6836 |
\cs_new_eq:NN \@@_start_list:nn \list |
| 6837 |
\cs_new_eq:NN \@@_stop_list: \endlist |
| 6838 |
\NewCommandCopy \@@_item_std:w \item |
| 6839 |
} |
| 6840 |
% \end{macrocode} |
| 6841 |
% The functions \cs{@@_minipage:w} and \cs{@@_endminipage:} correspond |
| 6842 |
% to copies of |\minipage| and |\endminipage| from plain definition of |
| 6843 |
% \myenv{minipage} environment. |
| 6844 |
% \iffalse |
| 6845 |
%% Copy |minipage| environment. |
| 6846 |
% \fi |
| 6847 |
% \begin{macrocode} |
| 6848 |
\@@_at_begin_document:n |
| 6849 |
{ |
| 6850 |
\cs_new_eq:NN \@@_minipage:w \minipage |
| 6851 |
\cs_new_eq:NN \@@_endminipage: \endminipage |
| 6852 |
} |
| 6853 |
% \end{macrocode} |
| 6854 |
% \end{macro} |
| 6855 |
% |
| 6856 |
% \subsection{Compatibility with hyperref and footnotehyper}\label{pkg:hyperref} |
| 6857 |
% |
| 6858 |
% \begin{macro}{\@@_after_hyperref:, \@@_hypertarget:nn, \@@_phantomsection:} |
| 6859 |
% First we define the necessary rules using \emph{\enquote{hooks}} to |
| 6860 |
% determine if the \mypkg{hyperref} package is loaded. |
| 6861 |
% \iffalse |
| 6862 |
%% Detection off |hyperref| package with |hyperfootnotes=true|. |
| 6863 |
% \fi |
| 6864 |
% \begin{macrocode} |
| 6865 |
\hook_gput_code:nnn { begindocument } { enumext } { \@@_after_hyperref: } |
| 6866 |
\hook_gset_rule:nnnn { begindocument } { enumext } { after } { hyperref } |
| 6867 |
% \end{macrocode} |
| 6868 |
% The function \cs{@@_after_hyperref:} sets the state of the boolean |
| 6869 |
% variable \cs{l_@@_hyperref_bool} to \enquote{true} if the package is |
| 6870 |
% loaded. At this point we will use the public macro |\IfHyperBoolean| |
| 6871 |
% to determine if the |hyperfootnotes=true| key is present, if so, we |
| 6872 |
% set the state of the boolean variable \cs{@@_footnotes_key_bool} to |
| 6873 |
% \enquote{true}. |
| 6874 |
% \begin{macrocode} |
| 6875 |
\cs_new_protected:Nn \@@_after_hyperref: |
| 6876 |
{ |
| 6877 |
\IfPackageLoadedT { hyperref } |
| 6878 |
{ |
| 6879 |
\msg_info:nnn { enumext } { package-load } { hyperref } |
| 6880 |
\bool_set_true:N \l_@@_hyperref_bool |
| 6881 |
\IfHyperBoolean{hyperfootnotes} |
| 6882 |
{ |
| 6883 |
\bool_set_true:N \l_@@_footnotes_key_bool |
| 6884 |
} |
| 6885 |
{ } |
| 6886 |
} |
| 6887 |
% \end{macrocode} |
| 6888 |
% If the state of the variable \cs{l_@@_footnotes_key_bool} is true we |
| 6889 |
% will check if the package \mypkg{footnotehyper} is loaded, in case it |
| 6890 |
% is not present, we will set the value of \cs{l_@@_footnotes_key_bool} |
| 6891 |
% to false and we will redefine |\footnote|. |
| 6892 |
% \iffalse |
| 6893 |
%% Detection off |footnotehyper| package. |
| 6894 |
% \fi |
| 6895 |
% \begin{macrocode} |
| 6896 |
\bool_if:NT \l_@@_footnotes_key_bool |
| 6897 |
{ |
| 6898 |
\IfPackageLoadedTF { footnotehyper } |
| 6899 |
{ |
| 6900 |
\msg_info:nnn { enumext } { package-load } { footnotehyper } |
| 6901 |
} |
| 6902 |
{ |
| 6903 |
\bool_set_false:N \l_@@_footnotes_key_bool |
| 6904 |
} |
| 6905 |
} |
| 6906 |
% \end{macrocode} |
| 6907 |
% The functions \cs{@@_hypertarget:nn} and \cs{@@_phantomsection:} |
| 6908 |
% correspond to the internal copies of \ics{hypertarget} and |
| 6909 |
% \ics{phantomsection}. If the boolean variable \cs{l_@@_hyperref_bool} |
| 6910 |
% is false the functions \cs{@@_hypertarget:nn} and \cs{@@_phantomsection:} |
| 6911 |
% will be disabled. |
| 6912 |
% \begin{macrocode} |
| 6913 |
\bool_if:NTF \l_@@_hyperref_bool |
| 6914 |
{ |
| 6915 |
\cs_new_eq:NN \@@_hypertarget:nn \hypertarget |
| 6916 |
\cs_new_eq:NN \@@_phantomsection: \phantomsection |
| 6917 |
} |
| 6918 |
{ |
| 6919 |
\cs_new_eq:NN \@@_hypertarget:nn \use_none:nn |
| 6920 |
\cs_new_eq:NN \@@_phantomsection: \prg_do_nothing: |
| 6921 |
} |
| 6922 |
} |
| 6923 |
% \end{macrocode} |
| 6924 |
% \end{macro} |
| 6925 |
% |
| 6926 |
% \begin{macro}{\@@_newlabel:nn,}\label{fun:newlabel} |
| 6927 |
% The function \cs{@@_newlabel:nn} write the information to the |.aux| |
| 6928 |
% file when using the \mykey{save-ref} key. The arguments taken by the |
| 6929 |
% function are: |
| 6930 |
% |
| 6931 |
% \begin{arguments} |
| 6932 |
% \item \cs{l_@@_newlabel_arg_one_tl} |
| 6933 |
% \item \cs{l_@@_newlabel_arg_two_tl} |
| 6934 |
% \end{arguments} |
| 6935 |
% |
| 6936 |
% \smallskip |
| 6937 |
% |
| 6938 |
% \begin{important}* |
| 6939 |
% The trick here is to manage the number of arguments passed to |
| 6940 |
% \ics{newlabel}|{#1}{#2}| according to the presence of the \mypkg{hyperref} |
| 6941 |
% package. |
| 6942 |
% \end{important} |
| 6943 |
% |
| 6944 |
% \smallskip |
| 6945 |
% |
| 6946 |
% \iffalse |
| 6947 |
%% Write internal |label| in |.aux| file for |save-ref| key. |
| 6948 |
% \fi |
| 6949 |
% \begin{macrocode} |
| 6950 |
\cs_new_protected:Npn \@@_newlabel:nn #1 #2 |
| 6951 |
{ |
| 6952 |
\protected@write \@auxout { } |
| 6953 |
{ |
| 6954 |
\token_to_str:N \newlabel {#1} |
| 6955 |
{ |
| 6956 |
{#2} |
| 6957 |
\bool_if:NT \l_@@_hyperref_bool |
| 6958 |
{ { \thepage } {#2} {#1} } |
| 6959 |
{ } |
| 6960 |
} |
| 6961 |
} |
| 6962 |
\@@_hypertarget:nn {#1} { } |
| 6963 |
\@@_phantomsection: |
| 6964 |
} |
| 6965 |
% \end{macrocode} |
| 6966 |
% \end{macro} |
| 6967 |
% |
| 6968 |
% \subsection{Internal redefining \cs{footnote} command}\label{ltx:footnote} |
| 6969 |
% |
| 6970 |
% To keep the correct numbering of \ics{footnote} and to make it work |
| 6971 |
% correctly in the \myenv*{enumext*} and \myenv*{keyans*} environments |
| 6972 |
% and \mykey{mini-env} key it is necessary to redefine the |\footnote| command. |
| 6973 |
% This implementation is adapted from the answer given by Clea F. Rees (\texttt{@cfr}) |
| 6974 |
% in \href{https://tex.stackexchange.com/a/700092}{footnotes in boxes compatible with hyperref}. |
| 6975 |
% |
| 6976 |
% \begin{macro}[int]{\@@_footnotetext:nn, \@@_renew_footnote:, |
| 6977 |
% \@@_print_footnote:, \@@_renew_footnote_mini:, |
| 6978 |
% \@@_print_footnote_mini:,} |
| 6979 |
% Redefinition of the |\footnote| command using |\footnotetext| and |
| 6980 |
% |\footnotemark| for the \mykey{mini-env} key in the \myenv*{enumext} and |
| 6981 |
% \myenv*{keyans} environments. |
| 6982 |
% \iffalse |
| 6983 |
%% Redefining |\footnote| for key |mini-env| in |enumext| and |keyans| environments. |
| 6984 |
% \fi |
| 6985 |
% \begin{macrocode} |
| 6986 |
\cs_new_protected:Nn \@@_footnotetext:nn |
| 6987 |
{ |
| 6988 |
\footnotetext[#1]{#2} |
| 6989 |
} |
| 6990 |
\cs_new_protected:Nn \@@_renew_footnote: |
| 6991 |
{ |
| 6992 |
\RenewDocumentCommand \footnote { o +m } |
| 6993 |
{ |
| 6994 |
\tl_if_novalue:nTF {##1} |
| 6995 |
{ |
| 6996 |
\stepcounter{footnote} |
| 6997 |
\int_gset_eq:Nc \g_@@_footnote_standar_int { c@footnote } |
| 6998 |
} |
| 6999 |
{ |
| 7000 |
\int_gset:Nn \g_@@_footnote_standar_int { ##1 } |
| 7001 |
} |
| 7002 |
\footnotemark [ \g_@@_footnote_standar_int ] |
| 7003 |
\seq_gput_right:Nn \g_@@_footnote_standar_arg_seq { ##2 } |
| 7004 |
\seq_gput_right:NV |
| 7005 |
\g_@@_footnote_standar_int_seq \g_@@_footnote_standar_int |
| 7006 |
} |
| 7007 |
} |
| 7008 |
\cs_new_protected:Nn \@@_print_footnote: |
| 7009 |
{ |
| 7010 |
\seq_if_empty:NF \g_@@_footnote_standar_int_seq |
| 7011 |
{ |
| 7012 |
\seq_map_pairwise_function:NNN |
| 7013 |
\g_@@_footnote_standar_int_seq |
| 7014 |
\g_@@_footnote_standar_arg_seq |
| 7015 |
\@@_footnotetext:nn |
| 7016 |
} |
| 7017 |
\seq_gclear:N \g_@@_footnote_standar_arg_seq |
| 7018 |
\seq_gclear:N \g_@@_footnote_standar_int_seq |
| 7019 |
} |
| 7020 |
% \end{macrocode} |
| 7021 |
% The \myenv*{enumext*} and \myenv*{keyans*} environments are implemented |
| 7022 |
% using \myenv{minipage} so we must also redefine |\footnote| to keep |
| 7023 |
% these numbering as if it were part of the document. |
| 7024 |
% \iffalse |
| 7025 |
%% Redefining |\footnote| for |enumext*| and |keyans*| environments. |
| 7026 |
% \fi |
| 7027 |
% \begin{macrocode} |
| 7028 |
\cs_new_protected:Nn \@@_renew_footnote_mini: |
| 7029 |
{ |
| 7030 |
\RenewDocumentCommand \footnote { o +m } |
| 7031 |
{ |
| 7032 |
\tl_if_novalue:nTF {##1} |
| 7033 |
{ |
| 7034 |
\stepcounter{footnote} |
| 7035 |
\int_gset_eq:Nc \g_@@_footnote_starred_int { c@footnote } |
| 7036 |
} |
| 7037 |
{ |
| 7038 |
\int_gset:Nn \g_@@_footnote_starred_int { ##1 } |
| 7039 |
} |
| 7040 |
\footnotemark [ \g_@@_footnote_starred_int ] |
| 7041 |
\seq_gput_right:Nn \g_@@_footnote_starred_arg_seq { ##2 } |
| 7042 |
\seq_gput_right:NV |
| 7043 |
\g_@@_footnote_starred_int_seq \g_@@_footnote_starred_int |
| 7044 |
} |
| 7045 |
} |
| 7046 |
\cs_new_protected:Nn \@@_print_footnote_mini: |
| 7047 |
{ |
| 7048 |
\seq_if_empty:NF \g_@@_footnote_starred_int_seq |
| 7049 |
{ |
| 7050 |
\seq_map_pairwise_function:NNN |
| 7051 |
\g_@@_footnote_starred_int_seq |
| 7052 |
\g_@@_footnote_starred_arg_seq |
| 7053 |
\@@_footnotetext:nn |
| 7054 |
} |
| 7055 |
\seq_gclear:N \g_@@_footnote_starred_arg_seq |
| 7056 |
\seq_gclear:N \g_@@_footnote_starred_int_seq |
| 7057 |
} |
| 7058 |
% \end{macrocode} |
| 7059 |
% \end{macro} |
| 7060 |
% |
| 7061 |
% \begin{macro}[int]{\@@_renew_footnote_standar:,\@@_print_footnote_standar:, |
| 7062 |
% \@@_renew_footnote_starred:,\@@_print_footnote_starred:,} |
| 7063 |
% We encapsulate the redefinition of |\footnote| to pass it to internal |
| 7064 |
% \myvarenv*{__@@_mini_page} environment used by the \mykey{mini-env} |
| 7065 |
% key in the \myenv*{enumext} and \myenv*{keyans} environments. We will |
| 7066 |
% run the redefinition when \emph{tagged} \texttt{PDF} is active or when |
| 7067 |
% the \mypkg{footnotehyper} package is not loaded. |
| 7068 |
% \begin{macrocode} |
| 7069 |
\cs_new_protected:Nn \@@_renew_footnote_standar: |
| 7070 |
{ |
| 7071 |
\bool_if:NT \g_@@_standar_bool |
| 7072 |
{ |
| 7073 |
\IfDocumentMetadataTF |
| 7074 |
{ |
| 7075 |
\@@_renew_footnote: |
| 7076 |
} |
| 7077 |
{ |
| 7078 |
\bool_if:NF \l_@@_footnotes_key_bool |
| 7079 |
{ |
| 7080 |
\@@_renew_footnote: |
| 7081 |
} |
| 7082 |
} |
| 7083 |
} |
| 7084 |
} |
| 7085 |
\cs_new_protected:Nn \@@_print_footnote_standar: |
| 7086 |
{ |
| 7087 |
\bool_if:NT \g_@@_standar_bool |
| 7088 |
{ |
| 7089 |
\IfDocumentMetadataTF |
| 7090 |
{ |
| 7091 |
\@@_print_footnote: |
| 7092 |
} |
| 7093 |
{ |
| 7094 |
\bool_if:NF \l_@@_footnotes_key_bool |
| 7095 |
{ |
| 7096 |
\@@_print_footnote: |
| 7097 |
} |
| 7098 |
} |
| 7099 |
} |
| 7100 |
} |
| 7101 |
% \end{macrocode} |
| 7102 |
% We encapsulate the redefinition of |\footnote| to pass it to the |
| 7103 |
% \myenv*{enumext*} and \myenv*{keyans*} environments. We will run the |
| 7104 |
% redefinition when \emph{tagged} \texttt{PDF} is active or when the |
| 7105 |
% \mypkg{footnotehyper} package is not loaded. |
| 7106 |
% \begin{macrocode} |
| 7107 |
\cs_new_protected:Nn \@@_renew_footnote_starred: |
| 7108 |
{ |
| 7109 |
\IfDocumentMetadataTF |
| 7110 |
{ |
| 7111 |
\@@_renew_footnote_mini: |
| 7112 |
} |
| 7113 |
{ |
| 7114 |
\bool_if:NF \l_@@_footnotes_key_bool |
| 7115 |
{ |
| 7116 |
\@@_renew_footnote_mini: |
| 7117 |
} |
| 7118 |
} |
| 7119 |
} |
| 7120 |
\cs_new_protected:Nn \@@_print_footnote_starred: |
| 7121 |
{ |
| 7122 |
\IfDocumentMetadataTF |
| 7123 |
{ |
| 7124 |
\@@_print_footnote_mini: |
| 7125 |
} |
| 7126 |
{ |
| 7127 |
\bool_if:NF \l_@@_footnotes_key_bool |
| 7128 |
{ |
| 7129 |
\@@_print_footnote_mini: |
| 7130 |
} |
| 7131 |
} |
| 7132 |
} |
| 7133 |
% \end{macrocode} |
| 7134 |
% In \myenv*{enumext*} and \myenv*{keyans*} environments we need to use |
| 7135 |
% \emph{\enquote{hooks}} to print |\footnote| with support for |
| 7136 |
% \emph{tagged} \texttt{PDF}. |
| 7137 |
% \begin{macrocode} |
| 7138 |
\@@_after_env:nn { enumext* } |
| 7139 |
{ |
| 7140 |
\@@_print_footnote_starred: |
| 7141 |
} |
| 7142 |
\@@_after_env:nn { keyans* } |
| 7143 |
{ |
| 7144 |
\@@_print_footnote_starred: |
| 7145 |
} |
| 7146 |
% \end{macrocode} |
| 7147 |
% \end{macro} |
| 7148 |
% |
| 7149 |
% \subsection{The internal \env{minipage} environment} |
| 7150 |
% |
| 7151 |
% \begin{macro}[int]{\@@_internal_mini_page:, @@_mini_env*} |
| 7152 |
% The function \cs{@@_internal_mini_page:} creates a internal |
| 7153 |
% \myvarenv*{__@@_mini_page} environment (\emph{custom version} of |
| 7154 |
% \myenv{minipage}) setting the |\if@minipage| switch to \emph{\enquote{false}} |
| 7155 |
% to allow spaces at the \emph{\enquote{above}} of the environment, |
| 7156 |
% plus we will add |\skip_vertical:N \c_zero_skip| to maintain alignment |
| 7157 |
% on \emph{\enquote{top}} in the first part and |\skip_vertical:N \c_zero_skip| |
| 7158 |
% in the second part to allow spaces \emph{\enquote{below}}. This environment |
| 7159 |
% will be used internally by the \mykey{mini-env} key, it is NOT documented |
| 7160 |
% in the user interface and is for internal use only. Within this environment |
| 7161 |
% we redefine |\footnote| to make them look the same as if they were |
| 7162 |
% elsewhere in the document. This implementation is adapted from the answer |
| 7163 |
% given by Max Chernoff \texttt{(@MaxChernoff)} in \href{https://tex.stackexchange.com/a/720966/7832}{Customize \texttt{minipage} to support spaces below it}. |
| 7164 |
% |
| 7165 |
% \smallskip |
| 7166 |
% |
| 7167 |
% \begin{important}* |
| 7168 |
% This function is passed to the function \cs{@@_safe_exec:} in the |
| 7169 |
% \myenv*{enumext} environment definition (\S\ref{env:enumext}) |
| 7170 |
% and \cs{@@_safe_exec_vii:} in the \myenv*{enumext*} environment |
| 7171 |
% definition (\S\ref{env:starred}). |
| 7172 |
% \end{important} |
| 7173 |
% \iffalse |
| 7174 |
%% Function for define a internal |minipage| environment with |\footnote| support. |
| 7175 |
% \fi |
| 7176 |
% \begin{macrocode} |
| 7177 |
\cs_new_protected:Nn \@@_internal_mini_page: |
| 7178 |
{ |
| 7179 |
\int_compare:nNnT { \l_@@_level_int } = { 0 } |
| 7180 |
{ |
| 7181 |
\DeclareDocumentEnvironment{@@_mini_page}{ m } |
| 7182 |
{ |
| 7183 |
\@@_renew_footnote_standar: |
| 7184 |
\@@_minipage:w [ t ] { ##1 } |
| 7185 |
\legacy_if_gset_false:n { @minipage } |
| 7186 |
\skip_vertical:N \c_zero_skip |
| 7187 |
} |
| 7188 |
{ |
| 7189 |
\skip_vertical:N \c_zero_skip |
| 7190 |
\@@_endminipage: |
| 7191 |
\@@_print_footnote_standar: |
| 7192 |
} |
| 7193 |
} |
| 7194 |
} |
| 7195 |
% \end{macrocode} |
| 7196 |
% \end{macro} |
| 7197 |
% |
| 7198 |
% \subsection{Definition of public dimension}\label{dim:public} |
| 7199 |
% |
| 7200 |
% The package \mypkg*{enumext} only provides a single public dimension |
| 7201 |
% |\itemwidth| and is intended for user convenience only and is not |
| 7202 |
% for internal use as such. This dimension is set in all environments |
| 7203 |
% and is only used by the \mykey{wrap-ans} key at its default value. |
| 7204 |
% \iffalse |
| 7205 |
%% Public dimension |\itemwidth| |
| 7206 |
% \fi |
| 7207 |
% \begin{macrocode} |
| 7208 |
\dim_zero_new:N \itemwidth |
| 7209 |
% \end{macrocode} |
| 7210 |
% |
| 7211 |
% \subsection{Definition of counters}\label{int:counters} |
| 7212 |
% |
| 7213 |
% \begin{macro}[int]{\@@_define_counter:Nn,enumXi, enumXii, enumXiii, |
| 7214 |
% enumXiv, enumXv, enumXvi, enumXvii, enumXviii} |
| 7215 |
% To create the necessary \emph{\enquote{counters}} we must first |
| 7216 |
% make sure that they are not already defined by the user or a |
| 7217 |
% package such as \mypkg{enumitem}, otherwise a error will be |
| 7218 |
% returned and the package loading will be aborted. The arguments |
| 7219 |
% taken by the function are: |
| 7220 |
% |
| 7221 |
% \begin{arguments} |
| 7222 |
% \item A token list \myvarenv{l__@@_counter_X_tl} for \emph{\enquote{store}} the counter's name. |
| 7223 |
% \item The counter's name. |
| 7224 |
% \end{arguments} |
| 7225 |
% |
| 7226 |
% \iffalse |
| 7227 |
%% Definition of counters for all environments. |
| 7228 |
% \fi |
| 7229 |
% \begin{macrocode} |
| 7230 |
\cs_new_protected:Npn \@@_define_counter:Nn #1 #2 |
| 7231 |
{ |
| 7232 |
\cs_if_exist:cTF { c@ #2 } |
| 7233 |
{ \msg_fatal:nnn { enumext } { counters }{ #2 } } |
| 7234 |
{ |
| 7235 |
\tl_set:Nn #1 { #2 } |
| 7236 |
\newcounter { #2 } |
| 7237 |
} |
| 7238 |
} |
| 7239 |
% \end{macrocode} |
| 7240 |
% The counters created here are \icounter{enumXi}, \icounter{enumXii}, |
| 7241 |
% \icounter{enumXiii} and \icounter{enumXiv} for \myenv*{enumext} |
| 7242 |
% environment, \icounter{enumXv} for \myenv*{keyans} environment, |
| 7243 |
% \icounter{enumXvi} for \myenv*{keyanspic} environment, \icounter{enumXvii} for |
| 7244 |
% \myenv*{enumext*} and \icounter{enumXviii} for the \myenv*{keyans*} |
| 7245 |
% environments. |
| 7246 |
% \begin{macrocode} |
| 7247 |
\@@_define_counter:Nn \l_@@_counter_i_tl { enumXi } |
| 7248 |
\@@_define_counter:Nn \l_@@_counter_ii_tl { enumXii } |
| 7249 |
\@@_define_counter:Nn \l_@@_counter_iii_tl { enumXiii } |
| 7250 |
\@@_define_counter:Nn \l_@@_counter_iv_tl { enumXiv } |
| 7251 |
\@@_define_counter:Nn \l_@@_counter_v_tl { enumXv } |
| 7252 |
\@@_define_counter:Nn \l_@@_counter_vi_tl { enumXvi } |
| 7253 |
\@@_define_counter:Nn \l_@@_counter_vii_tl { enumXvii } |
| 7254 |
\@@_define_counter:Nn \l_@@_counter_viii_tl { enumXviii } |
| 7255 |
% \end{macrocode} |
| 7256 |
% \end{macro} |
| 7257 |
% |
| 7258 |
% \begin{macro}[int]{\c@__enumext_resume_i_int, \c@__enumext_resume_ii_int, |
| 7259 |
% \c@__enumext_resume_iii_int, \c@__enumext_resume_iv_int, |
| 7260 |
% \c@__enumext_resume_vii_int,} |
| 7261 |
% In version 1.6 the command |\resetenumext| (\S\ref{cmd:resetenumext}) |
| 7262 |
% was added which internally uses |\counterwithin*| so for its correct |
| 7263 |
% operation, we will create \emph{\enquote{real counters}} instead of |
| 7264 |
% the \emph{\enquote{integer variables}} for the keys \mykey{resume} |
| 7265 |
% and \mykey{resume*}. |
| 7266 |
% \iffalse |
| 7267 |
%% Definition of internal counters for |resume| and |resume*| keys. |
| 7268 |
% \fi |
| 7269 |
% \begin{macrocode} |
| 7270 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 7271 |
{ |
| 7272 |
\cs_if_exist:cTF { c@ @@_resume_#1_int } |
| 7273 |
{ \msg_fatal:nne { enumext } { counters }{ @@_resume_#1_int } } |
| 7274 |
{ |
| 7275 |
\newcounter { @@_resume_#1_int } |
| 7276 |
} |
| 7277 |
} |
| 7278 |
\clist_map_inline:nn {i,ii,iii,iv,vii} { \@@_tmp:n {#1} } |
| 7279 |
% \end{macrocode} |
| 7280 |
% \end{macro} |
| 7281 |
% |
| 7282 |
% \subsection{Definition of labels} |
| 7283 |
% |
| 7284 |
% This part of the code is inspired by the \mypkg{enumitem} package. The |
| 7285 |
% idea is to be able to access the counters using \ilabel{arabic*}, |
| 7286 |
% \ilabel{Alph*}, \ilabel{alph*}, \ilabel{Roman*} and \ilabel{roman*} |
| 7287 |
% to use them in the \mykey{label} key. |
| 7288 |
% |
| 7289 |
% \smallskip |
| 7290 |
% |
| 7291 |
% \begin{important}* |
| 7292 |
% Direct support for this is provided since \hologo{LaTeX} release |
| 7293 |
% 2025-06-01\cite{ltnews}, but we will keep the original implementation |
| 7294 |
% so as not to hinder the internal \emph{\enquote{label and ref}} system. |
| 7295 |
% \end{important} |
| 7296 |
% |
| 7297 |
% |
| 7298 |
% \begin{macro}{\@@_register_default_label_wd:Nn} |
| 7299 |
% These \mymeta{counters} will be used as default \mymeta{labels} if |
| 7300 |
% the \mykey{label} key is not used for the different levels of the |
| 7301 |
% \myenv*{enumext}, \myenv*{enumext*}, \myenv*{keyans} and \myenv*{keyans*} |
| 7302 |
% environments, so it is necessary to get a default value for \mykey{labelwidth} |
| 7303 |
% from these \mymeta{labels} at the same time. |
| 7304 |
% \iffalse |
| 7305 |
%% Register of counters style. |
| 7306 |
% \fi |
| 7307 |
% \begin{macrocode} |
| 7308 |
\cs_new_protected:Npn \@@_register_default_label_wd:Nn #1 #2 |
| 7309 |
{ |
| 7310 |
\tl_const:cn { c_@@_widest_ \cs_to_str:N #1 _tl } {#2} |
| 7311 |
\tl_gput_right:Nn \g_@@_counter_styles_tl {#1} |
| 7312 |
} |
| 7313 |
\@@_register_default_label_wd:Nn \arabic { 0 } |
| 7314 |
\@@_register_default_label_wd:Nn \Alph { M } |
| 7315 |
\@@_register_default_label_wd:Nn \alph { m } |
| 7316 |
\@@_register_default_label_wd:Nn \Roman { VIII } |
| 7317 |
\@@_register_default_label_wd:Nn \roman { viii } |
| 7318 |
% \end{macrocode} |
| 7319 |
% \end{macro} |
| 7320 |
% |
| 7321 |
% \begin{macro}{\@@_label_width_by_box:Nn, \@@_label_width_by_box:cv} |
| 7322 |
% The function \cs{@@_label_width_by_box:Nn} set the default \ics{labelwidth} |
| 7323 |
% using a box width if no \mykey{labelwidth} key is passed. |
| 7324 |
% \iffalse |
| 7325 |
%% Set default label width using a box width. |
| 7326 |
% \fi |
| 7327 |
% \begin{macrocode} |
| 7328 |
\cs_new_protected:Npn \@@_label_width_by_box:Nn #1 #2 |
| 7329 |
{ |
| 7330 |
\hbox_set:Nn \l_@@_label_width_by_box {#2} |
| 7331 |
\dim_set:Nn #1 { \box_wd:N \l_@@_label_width_by_box } |
| 7332 |
} |
| 7333 |
\cs_generate_variant:Nn \@@_label_width_by_box:Nn { cv } |
| 7334 |
% \end{macrocode} |
| 7335 |
% \end{macro} |
| 7336 |
% |
| 7337 |
% \begin{macro}{\@@_label_style:Nnn, \@@_label_style:cvn} |
| 7338 |
% The function \cs{@@_label_style:Nnn} is used by the \mykey{label} |
| 7339 |
% key to creates the variables containing the \mymeta{label style} |
| 7340 |
% and will allow to use \ilabel{arabic*}, \ilabel{Alph*}, \ilabel{alph*}, |
| 7341 |
% \ilabel{Roman*} and \ilabel{roman*} as arguments. |
| 7342 |
% |
| 7343 |
% It loops through the defined counter styles in \cs{g_@@_counter_styles_tl} |
| 7344 |
% (\ics{arabic}, \ics{alph}, \ics{Alph}, \ics{roman} and \ics{Roman}) for example, |
| 7345 |
% looking for \ilabel{roman*} and replacing that by \ics{roman}\mymarg{counter}, |
| 7346 |
% and doing the same for the \cs{g_@@_widest_label_tl} to keep both in sync. |
| 7347 |
% \iffalse |
| 7348 |
%% Function to support |*| in |label| key. |
| 7349 |
% \fi |
| 7350 |
% \begin{macrocode} |
| 7351 |
\cs_new_protected:Npn \@@_label_style:Nnn #1 #2 #3 |
| 7352 |
{ |
| 7353 |
\tl_clear_new:N #1 |
| 7354 |
\tl_put_right:Ne #1 { \tl_trim_spaces:n {#3} } |
| 7355 |
\tl_gset_eq:NN \g_@@_widest_label_tl #1 |
| 7356 |
\tl_map_inline:Nn \g_@@_counter_styles_tl |
| 7357 |
{ |
| 7358 |
\tl_replace_all:Nne #1 { ##1* } { \exp_not:N ##1 {#2} } |
| 7359 |
\tl_greplace_all:Nne \g_@@_widest_label_tl { ##1* } |
| 7360 |
{ \tl_use:c { c_@@_widest_ \cs_to_str:N ##1 _tl } } |
| 7361 |
} |
| 7362 |
\@@_label_width_by_box:Nn \l_@@_current_widest_dim |
| 7363 |
{ \tl_use:N \g_@@_widest_label_tl } |
| 7364 |
\tl_set_eq:cN { the #2 } #1 |
| 7365 |
} |
| 7366 |
\cs_generate_variant:Nn \@@_label_style:Nnn { cvn } |
| 7367 |
% \end{macrocode} |
| 7368 |
% \end{macro} |
| 7369 |
% |
| 7370 |
% \subsection{Setting keys associated with label}\label{key:label} |
| 7371 |
% |
| 7372 |
% When \emph{tagged} \texttt{PDF} is active |\makelabel| is redefined using |
| 7373 |
% |\makebox| to work correctly (\S\ref{env:item-starred-enumext}). From |
| 7374 |
% the user side it is convenient to have a key that allows using this |
| 7375 |
% redefinition with |\makebox| without having |\IfDocumentMetadataTF| active. |
| 7376 |
% |
| 7377 |
% \begin{macro}[int]{mode-box} |
| 7378 |
% We define the key \mykey{mode-box} only for the \emph{\enquote{first level}} |
| 7379 |
% of \myenv*{enumext} and \myenv*{enumext*} environments. |
| 7380 |
% \iffalse |
| 7381 |
%% Add |mode-box| key only on first level off |enumext| and |enumext*| environments. |
| 7382 |
% \fi |
| 7383 |
% \begin{macrocode} |
| 7384 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 7385 |
{ |
| 7386 |
\keys_define:nn { enumext / #1 } |
| 7387 |
{ |
| 7388 |
mode-box .bool_set:N = \l_@@_mode_box_bool, |
| 7389 |
mode-box .initial:n = false, |
| 7390 |
mode-box .value_forbidden:n = true, |
| 7391 |
} |
| 7392 |
} |
| 7393 |
\clist_map_inline:nn { level-1, enumext* } { \@@_tmp:n {#1} } |
| 7394 |
% \end{macrocode} |
| 7395 |
% \end{macro} |
| 7396 |
% |
| 7397 |
% \begin{macro}[int]{font, labelsep, labelwidth, wrap-label,wrap-label*} |
| 7398 |
% Definition of keys \mykey{font}, \mykey{labelsep}, \mykey{labelwidth}, |
| 7399 |
% \mykey{wrap-label} and \mykey{wrap-label*} keys for \myenv*{enumext} |
| 7400 |
% and \myenv*{keyans} environments. |
| 7401 |
% \iffalse |
| 7402 |
%% Add |font|, |labelsep|, |labelwidth|, |wrap-label| and |wrap-label*| keys. |
| 7403 |
% \fi |
| 7404 |
% \begin{macrocode} |
| 7405 |
\cs_set_protected:Npn \@@_tmp:nn #1 #2 |
| 7406 |
{ |
| 7407 |
\keys_define:nn { enumext / #1 } |
| 7408 |
{ |
| 7409 |
font .tl_set:c = { l_@@_label_font_style_#2_tl }, |
| 7410 |
font .value_required:n = true, |
| 7411 |
labelsep .dim_set:c = { l_@@_labelsep_#2_dim }, |
| 7412 |
labelsep .initial:n = {0.3333em}, |
| 7413 |
labelsep .value_required:n = true, |
| 7414 |
labelwidth .dim_set:c = { l_@@_labelwidth_#2_dim }, |
| 7415 |
labelwidth .value_required:n = true, |
| 7416 |
wrap-label .cs_set_protected:cp = { @@_wrapper_label_#2:n } ##1, |
| 7417 |
wrap-label .initial:n = {##1}, |
| 7418 |
wrap-label .value_required:n = true, |
| 7419 |
wrap-label* .code:n = { |
| 7420 |
\bool_set_true:c { l_@@_wrap_label_opt_#2_bool } |
| 7421 |
\keys_set:nn { enumext / #1 } { wrap-label = {##1} } |
| 7422 |
}, |
| 7423 |
wrap-label* .value_required:n = true, |
| 7424 |
} |
| 7425 |
} |
| 7426 |
\clist_map_inline:Nn \c_@@_all_envs_clist { \@@_tmp:nn #1 } |
| 7427 |
% \end{macrocode} |
| 7428 |
% \end{macro} |
| 7429 |
% |
| 7430 |
% \begin{macro}[int]{align} |
| 7431 |
% The \mykey{align} key is implemented differently for \emph{\enquote{starred}} |
| 7432 |
% and \emph{\enquote{non starred}} environments. For compatibility with |
| 7433 |
% \emph{tagged} \texttt{PDF} we must set \myvarenv{l__@@_align_label_pos_X_str}. |
| 7434 |
% \iffalse |
| 7435 |
%% Add |align| key for |enumext| and |keyans| environments. |
| 7436 |
% \fi |
| 7437 |
% \begin{macrocode} |
| 7438 |
\cs_set_protected:Npn \@@_tmp:nn #1 #2 |
| 7439 |
{ |
| 7440 |
\keys_define:nn { enumext / #1 } |
| 7441 |
{ |
| 7442 |
align .choice:, |
| 7443 |
align / left .code:n = |
| 7444 |
{ |
| 7445 |
\tl_clear:c { l_@@_label_fill_left_#2_tl } |
| 7446 |
\tl_set:cn { l_@@_label_fill_right_#2_tl } { \hfill } |
| 7447 |
\str_set:cn { l_@@_align_label_pos_#2_str } { l } |
| 7448 |
}, |
| 7449 |
align / right .code:n = |
| 7450 |
{ |
| 7451 |
\tl_set:cn { l_@@_label_fill_left_#2_tl } { \hfill } |
| 7452 |
\tl_clear:c { l_@@_label_fill_right_#2_tl } |
| 7453 |
\str_set:cn { l_@@_align_label_pos_#2_str } { r } |
| 7454 |
}, |
| 7455 |
align / center .code:n = |
| 7456 |
{ |
| 7457 |
\tl_set:cn { l_@@_label_fill_left_#2_tl } { \hfill } |
| 7458 |
\tl_set:cn { l_@@_label_fill_right_#2_tl } { \hfill } |
| 7459 |
\str_set:cn { l_@@_align_label_pos_#2_str } { c } |
| 7460 |
}, |
| 7461 |
align / unknown .code:n = |
| 7462 |
\msg_error:nneee { enumext } { unknown-choice } |
| 7463 |
{ align } { left,~right,~ center } { \exp_not:n {##1} }, |
| 7464 |
align .initial:n = left, |
| 7465 |
align .value_required:n = true, |
| 7466 |
} |
| 7467 |
} |
| 7468 |
\clist_map_inline:nn |
| 7469 |
{ |
| 7470 |
{level-1}{i}, {level-2}{ii}, {level-3}{iii}, {level-4}{iv}, {keyans}{v} |
| 7471 |
} |
| 7472 |
{ \@@_tmp:nn #1 } |
| 7473 |
% \end{macrocode} |
| 7474 |
% \iffalse |
| 7475 |
%% Add |align| key for |enummext*| and |keyans*| environments. |
| 7476 |
% \fi |
| 7477 |
% \begin{macrocode} |
| 7478 |
\cs_set_protected:Npn \@@_tmp:nn #1 #2 |
| 7479 |
{ |
| 7480 |
\keys_define:nn { enumext / #1 } |
| 7481 |
{ |
| 7482 |
align .choice:, |
| 7483 |
align / left .code:n = \str_set:cn { l_@@_align_label_#2_str } { l }, |
| 7484 |
align / right .code:n = \str_set:cn { l_@@_align_label_#2_str } { r }, |
| 7485 |
align / center .code:n = \str_set:cn { l_@@_align_label_#2_str } { c }, |
| 7486 |
align / unknown .code:n = |
| 7487 |
\msg_error:nneee { enumext } { unknown-choice } |
| 7488 |
{ align } { left,~right,~ center } { \exp_not:n {##1} }, |
| 7489 |
align .initial:n = left, |
| 7490 |
align .value_required:n = true, |
| 7491 |
} |
| 7492 |
} |
| 7493 |
\clist_map_inline:nn { {enumext*}{vii}, {keyans*}{viii} } { \@@_tmp:nn #1 } |
| 7494 |
% \end{macrocode} |
| 7495 |
% \end{macro} |
| 7496 |
% |
| 7497 |
% \subsection{Setting \texttt{label} and \texttt{ref} keys}\label{key:label-ref} |
| 7498 |
% |
| 7499 |
% The implementation of the keys \mykey{label} and \mykey{ref} are part |
| 7500 |
% of the core of the package \mypkg*{enumext}, here the default values |
| 7501 |
% for \mymeta{label}, the value of the variables \myvarenv{l__@@_label_X_tl}, |
| 7502 |
% the default values for |\labelwidth| and the \emph{\enquote{label and ref}} system. |
| 7503 |
% |
| 7504 |
% \subsubsection{Define and set \texttt{label} and \texttt{ref} keys for \env{enumext} environment} |
| 7505 |
% |
| 7506 |
% \begin{macro}[int]{label,ref,\l_@@_label_i_tl,\l_@@_label_ii_tl, \l_@@_label_iii_tl, \l_@@_label_iv_tl} |
| 7507 |
% Here we set the default \mymeta{labels} of the \emph{four levels} of |
| 7508 |
% \myenv*{enumext} environment, along with the default values for |
| 7509 |
% \mykey{labelwidth}, \mykey{widest} and \mykey{ref} keys. |
| 7510 |
% \iffalse |
| 7511 |
%% Define and set |label| and |ref| keys for |enumext|. |
| 7512 |
% \fi |
| 7513 |
% \begin{macrocode} |
| 7514 |
\cs_set_protected:Npn \@@_tmp:nnn #1 #2 #3 |
| 7515 |
{ |
| 7516 |
\keys_define:nn { enumext / #1 } |
| 7517 |
{ |
| 7518 |
label .code:n = { |
| 7519 |
\@@_label_style:cvn { l_@@_label_#2_tl } |
| 7520 |
{ l_@@_counter_#2_tl } {##1} |
| 7521 |
\dim_set_eq:cN { l_@@_labelwidth_#2_dim } |
| 7522 |
\l_@@_current_widest_dim |
| 7523 |
}, |
| 7524 |
label .initial:n = #3, |
| 7525 |
label .value_required:n = true, |
| 7526 |
ref .code:n = \@@_standar_ref:nn {#2} {##1}, |
| 7527 |
ref .value_required:n = true, |
| 7528 |
} |
| 7529 |
} |
| 7530 |
\@@_tmp:nnn { level-1 } { i } { \arabic*.} |
| 7531 |
\@@_tmp:nnn { level-2 } { ii } { (\alph*) } |
| 7532 |
\@@_tmp:nnn { level-3 } { iii } { \roman*. } |
| 7533 |
\@@_tmp:nnn { level-4 } { iv } { \Alph*. } |
| 7534 |
% \end{macrocode} |
| 7535 |
% \end{macro} |
| 7536 |
% |
| 7537 |
% \begin{macro}[int]{\@@_standar_ref:nn, \@@_standar_ref:,} |
| 7538 |
% The \cs{@@_standard_ref:nn} function will first pass the key |
| 7539 |
% \emph{argument} \texttt{\textcolor{optcolor}{ref}} to the variable |
| 7540 |
% \cs{l_@@_ref_key_arg_t}l and analyze its state, if it is not \emph{empty} |
| 7541 |
% it will set a copy of of the \emph{current counter style} save in |
| 7542 |
% \myvarenv{l__@@_the_counter_X_tl} to \cs{l_@@_ref_the_count_tl} and |
| 7543 |
% then set the variable \myvarenv{l__@@_renew_counter_X_tl} which will |
| 7544 |
% modify |\theenumX|. |
| 7545 |
% \iffalse |
| 7546 |
%% Internal function used by |ref| key in enumext environment. |
| 7547 |
% \fi |
| 7548 |
% \begin{macrocode} |
| 7549 |
\cs_new_protected:Npn \@@_standar_ref:nn #1 #2 |
| 7550 |
{ |
| 7551 |
\tl_set:Nn \l_@@_ref_key_arg_tl {#2} |
| 7552 |
\tl_if_empty:NTF \l_@@_ref_key_arg_tl |
| 7553 |
{ |
| 7554 |
\msg_error:nnn { enumext } { key-ref-empty } { enumext } |
| 7555 |
} |
| 7556 |
{ |
| 7557 |
\tl_set_eq:Nc \l_@@_ref_the_count_tl { l_@@_the_counter_#1_tl } |
| 7558 |
\tl_set:ce { l_@@_renew_counter_#1_tl } |
| 7559 |
{ |
| 7560 |
\exp_not:N \renewcommand { \exp_not:V \l_@@_ref_the_count_tl } |
| 7561 |
{ \exp_not:V \l_@@_ref_key_arg_tl } |
| 7562 |
} |
| 7563 |
} |
| 7564 |
} |
| 7565 |
% \end{macrocode} |
| 7566 |
% Finally the function \cs{@@_standar_ref:} will execute the |
| 7567 |
% modification for the reference system in the second argument of the |
| 7568 |
% environment definition \myenv*{enumext}. |
| 7569 |
% \iffalse |
| 7570 |
%% Activate |ref| key in second arg of list for |enumext| environment. |
| 7571 |
% \fi |
| 7572 |
% \begin{macrocode} |
| 7573 |
\cs_new_protected:Nn \@@_standar_ref: |
| 7574 |
{ |
| 7575 |
\tl_if_empty:cF { l_@@_renew_counter_ \@@_level: _tl } |
| 7576 |
{ |
| 7577 |
\tl_use:c { l_@@_renew_counter_ \@@_level: _tl } |
| 7578 |
} |
| 7579 |
} |
| 7580 |
% \end{macrocode} |
| 7581 |
% \end{macro} |
| 7582 |
% |
| 7583 |
% \subsubsection{Define and set \texttt{label} and \texttt{ref} keys for \env{enumext*} and \env{keyans*} environments} |
| 7584 |
% |
| 7585 |
% \begin{macro}[int]{label,ref, \l_@@_label_vii_tl, \l_@@_label_viii_tl} |
| 7586 |
% Here we set the default \mymeta{labels} for \myenv*{enumext*} and |
| 7587 |
% \myenv*{keyans*} environments, along with the default value for |
| 7588 |
% \mykey{labelwidth} key and \mykey{ref} key. |
| 7589 |
% \iffalse |
| 7590 |
%% Define and set |label| and |ref| keys for starred environments. |
| 7591 |
% \fi |
| 7592 |
% \begin{macrocode} |
| 7593 |
\cs_set_protected:Npn \@@_tmp:nnn #1 #2 #3 |
| 7594 |
{ |
| 7595 |
\keys_define:nn { enumext / #1 } |
| 7596 |
{ |
| 7597 |
label .code:n = { |
| 7598 |
\@@_label_style:cvn { l_@@_label_#2_tl } |
| 7599 |
{ l_@@_counter_#2_tl } {##1} |
| 7600 |
\dim_set_eq:cN { l_@@_labelwidth_#2_dim } |
| 7601 |
\l_@@_current_widest_dim |
| 7602 |
}, |
| 7603 |
label .initial:n = #3, |
| 7604 |
label .value_required:n = true, |
| 7605 |
ref .code:n = \@@_starred_ref:n {##1}, |
| 7606 |
ref .value_required:n = true, |
| 7607 |
} |
| 7608 |
} |
| 7609 |
\@@_tmp:nnn { enumext* } { vii } { \arabic*.} |
| 7610 |
\@@_tmp:nnn { keyans* } { viii } { \Alph*) } |
| 7611 |
% \end{macrocode} |
| 7612 |
% \end{macro} |
| 7613 |
% |
| 7614 |
% \begin{macro}[int]{\@@_starred_ref:n, \@@_starred_ref:} |
| 7615 |
% The implementation of \cs{@@_starred_ref:n} is the same as that |
| 7616 |
% used for the environment \myenv*{enumext}. |
| 7617 |
% \iffalse |
| 7618 |
%% Internal function used by |ref| key in |enumext*| and |keyans*| environments. |
| 7619 |
% \fi |
| 7620 |
% \begin{macrocode} |
| 7621 |
\cs_new_protected:Npn \@@_starred_ref:n #1 |
| 7622 |
{ |
| 7623 |
\tl_set:Nn \l_@@_ref_key_arg_tl {#1} |
| 7624 |
\int_compare:nNnT { \l_@@_level_h_int } = { 1 } |
| 7625 |
{ |
| 7626 |
\tl_if_empty:NTF \l_@@_ref_key_arg_tl |
| 7627 |
{ |
| 7628 |
\msg_error:nnn { enumext } { key-ref-empty } { enumext* } |
| 7629 |
} |
| 7630 |
{ |
| 7631 |
\tl_set_eq:NN \l_@@_ref_the_count_tl \l_@@_the_counter_vii_tl |
| 7632 |
\tl_set:Ne \l_@@_renew_counter_vii_tl |
| 7633 |
{ |
| 7634 |
\exp_not:N \renewcommand { \exp_not:V \l_@@_ref_the_count_tl } { \exp_not:V \l_@@_ref_key_arg_tl } |
| 7635 |
} |
| 7636 |
} |
| 7637 |
} |
| 7638 |
\int_compare:nNnT { \l_@@_keyans_level_h_int } = { 1 } |
| 7639 |
{ |
| 7640 |
\tl_if_empty:NTF \l_@@_ref_key_arg_tl |
| 7641 |
{ |
| 7642 |
\msg_error:nnn { enumext } { key-ref-empty } { keyans* } |
| 7643 |
} |
| 7644 |
{ |
| 7645 |
\tl_set_eq:NN \l_@@_ref_the_count_tl \l_@@_the_counter_viii_tl |
| 7646 |
\tl_set:Ne \l_@@_renew_counter_viii_tl |
| 7647 |
{ |
| 7648 |
\exp_not:N \renewcommand { \exp_not:V \l_@@_ref_the_count_tl } { \exp_not:V \l_@@_ref_key_arg_tl } |
| 7649 |
} |
| 7650 |
} |
| 7651 |
} |
| 7652 |
} |
| 7653 |
% \end{macrocode} |
| 7654 |
% Finally the function \cs{@@_starred_ref:} will execute the |
| 7655 |
% modification for the reference system in the second argument of the |
| 7656 |
% \myenv*{enumext*} and \myenv*{keyans*} environment definition. |
| 7657 |
% \iffalse |
| 7658 |
%% Activate |ref| key in second arg of list for |enumext*| and |keyans*| environments. |
| 7659 |
% \fi |
| 7660 |
% \begin{macrocode} |
| 7661 |
\cs_new_protected:Nn \@@_starred_ref: |
| 7662 |
{ |
| 7663 |
\int_compare:nNnT { \l_@@_level_h_int } = { 1 } |
| 7664 |
{ |
| 7665 |
\tl_if_empty:NF \l_@@_renew_counter_vii_tl |
| 7666 |
{ |
| 7667 |
\tl_use:N \l_@@_renew_counter_vii_tl |
| 7668 |
} |
| 7669 |
} |
| 7670 |
\int_compare:nNnT { \l_@@_keyans_level_h_int } = { 1 } |
| 7671 |
{ |
| 7672 |
\tl_if_empty:NF \l_@@_renew_counter_viii_tl |
| 7673 |
{ |
| 7674 |
\tl_use:N \l_@@_renew_counter_viii_tl |
| 7675 |
} |
| 7676 |
} |
| 7677 |
} |
| 7678 |
% \end{macrocode} |
| 7679 |
% \end{macro} |
| 7680 |
% |
| 7681 |
% \subsubsection{Define and set \texttt{label} and \texttt{ref} keys for \env{keyans} and \env{keyanspic} environments} |
| 7682 |
% |
| 7683 |
% \begin{macro}[int]{label, ref} |
| 7684 |
% \begin{macro}{\l_@@_label_v_tl,\l_@@_label_vi_tl,} |
| 7685 |
% Here we set the default \mymeta{label} for \myenv*{keyans} |
| 7686 |
% and \myenv*{keyanspic} environment, along with the default value for |
| 7687 |
% \mykey{labelwidth} if it has not been established and \mykey{ref} key. |
| 7688 |
% The \myenv*{keyanspic} environment use the same \mymeta{label} as |
| 7689 |
% the \myenv*{keyans} environment. |
| 7690 |
% \iffalse |
| 7691 |
%% Define and set |label| and |ref| keys for |keyans| and |keyanspic|. |
| 7692 |
% \fi |
| 7693 |
% \begin{macrocode} |
| 7694 |
\keys_define:nn { enumext / keyans } |
| 7695 |
{ |
| 7696 |
label .code:n = { |
| 7697 |
\@@_label_style:cvn { l_@@_label_v_tl } |
| 7698 |
{ l_@@_counter_v_tl } {#1} |
| 7699 |
\@@_label_style:cvn { l_@@_label_vi_tl } |
| 7700 |
{ l_@@_counter_vi_tl } {#1} |
| 7701 |
\dim_set_eq:NN |
| 7702 |
\l_@@_labelwidth_v_dim \l_@@_current_widest_dim |
| 7703 |
}, |
| 7704 |
label .initial:n = \Alph*), |
| 7705 |
label .value_required:n = true, |
| 7706 |
ref .code:n = \@@_keyans_ref:n {#1}, |
| 7707 |
ref .value_required:n = true, |
| 7708 |
} |
| 7709 |
% \end{macrocode} |
| 7710 |
% \end{macro} |
| 7711 |
% \end{macro} |
| 7712 |
% |
| 7713 |
% \begin{macro}[int]{\@@_keyans_ref:n, \@@_keyans_ref:} |
| 7714 |
% The implementation of \cs{@@_keyans_ref:n} is the same as that |
| 7715 |
% used for the environment \myenv*{enumext}. |
| 7716 |
% \iffalse |
| 7717 |
%% Internal function used by |ref| key in |keyans| environment. |
| 7718 |
% \fi |
| 7719 |
% \begin{macrocode} |
| 7720 |
\cs_new_protected:Npn \@@_keyans_ref:n #1 |
| 7721 |
{ |
| 7722 |
\tl_set:Nn \l_@@_ref_key_arg_tl {#1} |
| 7723 |
\tl_if_empty:NTF \l_@@_ref_key_arg_tl |
| 7724 |
{ |
| 7725 |
\msg_error:nnn { enumext } { key-ref-empty } { keyans } |
| 7726 |
} |
| 7727 |
{ |
| 7728 |
\tl_set_eq:NN \l_@@_ref_the_count_tl \l_@@_the_counter_v_tl |
| 7729 |
\tl_put_right:Ne \l_@@_renew_counter_v_tl |
| 7730 |
{ |
| 7731 |
\exp_not:N \renewcommand { \exp_not:V \l_@@_ref_the_count_tl } { \exp_not:V \l_@@_ref_key_arg_tl } |
| 7732 |
} |
| 7733 |
} |
| 7734 |
} |
| 7735 |
% \end{macrocode} |
| 7736 |
% Finally the function \cs{@@_keyans_ref:} will execute the |
| 7737 |
% modification for the reference system in the second argument of the |
| 7738 |
% \myenv*{keyans*} environment definition. |
| 7739 |
% \iffalse |
| 7740 |
%% Activate |ref| key in second arg of list for |keyans| environments. |
| 7741 |
% \fi |
| 7742 |
% \begin{macrocode} |
| 7743 |
\cs_new_protected:Nn \@@_keyans_ref: |
| 7744 |
{ |
| 7745 |
\tl_if_empty:NF \l_@@_renew_counter_v_tl |
| 7746 |
{ |
| 7747 |
\tl_use:N \l_@@_renew_counter_v_tl |
| 7748 |
} |
| 7749 |
} |
| 7750 |
% \end{macrocode} |
| 7751 |
% \end{macro} |
| 7752 |
% |
| 7753 |
% \subsection{Setting \texttt{start}, \texttt{start*} and \texttt{widest} keys}\label{key:start-widest} |
| 7754 |
% |
| 7755 |
% \begin{macro}{\@@_start_from:NNn, \@@_start_from:ccn, \@@_start_from:cce,} |
| 7756 |
% The function \cs{@@_start_from:NNn} used by \mykey{start} and \mykey{start*} |
| 7757 |
% keys take three arguments: |
| 7758 |
% |
| 7759 |
% \begin{arguments} |
| 7760 |
% \item \myvarenv{l__@@_label_X_tl} |
| 7761 |
% \item \myvarenv{l__@@_start_X_int} |
| 7762 |
% \item \meta{integer or string} |
| 7763 |
% \end{arguments} |
| 7764 |
% The first argument of this function are the \emph{\enquote{counter style}} set by |
| 7765 |
% \mykey{label} key, the second argument is returned by the function, |
| 7766 |
% the third argument can be an \mymeta{integer} or \mymeta{string} of the |
| 7767 |
% form \ics{Alph}, \ics{alph}, \ics{Roman} or \ics{roman}. This effectively |
| 7768 |
% allows \mykey{start*}|=A| or \mykey{start}|=1| to be used. |
| 7769 |
% |
| 7770 |
% \begin{important}* |
| 7771 |
% In version 1.6 it is allowed to pass the \mykey{resume} key \emph{without |
| 7772 |
% value} by means of the command |\setenumext|, for the correct operation |
| 7773 |
% of this we must set the boolean variable \myvarenv{l__@@_resume_count_bool} |
| 7774 |
% set by the \mykey{resume} key \emph{without value} to \emph{\enquote{false}} (\S\ref{key:series}). |
| 7775 |
% This is necessary to be able to \enquote{reset} the \emph{start value} |
| 7776 |
% by means of the \mykey{start} or \mykey{start*} keys. |
| 7777 |
% \end{important} |
| 7778 |
% |
| 7779 |
% \iffalse |
| 7780 |
%% Internal function for |start| and |start*| keys. |
| 7781 |
%% #1 \l_enumext_label_X_tl |
| 7782 |
%% #2 \l_enumext_start_X_int |
| 7783 |
%% #3 integer or string |
| 7784 |
% \fi |
| 7785 |
% \begin{macrocode} |
| 7786 |
\cs_new_protected:Npn \@@_start_from:NNn #1 #2 #3 |
| 7787 |
{ |
| 7788 |
\bool_set_false:N \l_@@_resume_count_bool |
| 7789 |
\@@_if_is_int:nTF { #3 } |
| 7790 |
{ |
| 7791 |
\int_set:Nn #2 {#3} |
| 7792 |
} |
| 7793 |
{ |
| 7794 |
\regex_if_match:nVT { \c{Alph} | \c{alph} } #1 |
| 7795 |
{ \int_set:Nn #2 { \int_from_alph:n {#3} } } |
| 7796 |
\regex_if_match:nVT { \c{Roman} | \c{roman} } #1 |
| 7797 |
{ \int_set:Nn #2 { \int_from_roman:n {#3} } } |
| 7798 |
} |
| 7799 |
} |
| 7800 |
\cs_generate_variant:Nn \@@_start_from:NNn { ccn, cce } |
| 7801 |
% \end{macrocode} |
| 7802 |
% \end{macro} |
| 7803 |
% |
| 7804 |
% \begin{macro}{\@@_widest_from:nNNn, \@@_widest_from:nccn} |
| 7805 |
% The function \cs{@@_widest_from:nNNn} used by the \mykey{widest} |
| 7806 |
% key take four arguments: |
| 7807 |
% |
| 7808 |
% \begin{arguments} |
| 7809 |
% \item The counter associated with the environment level |
| 7810 |
% \item \myvarenv{l__@@_label_X_tl} |
| 7811 |
% \item \myvarenv{l__@@_labelwidth_X_dim} |
| 7812 |
% \item \meta{integer or string} |
| 7813 |
% \end{arguments} |
| 7814 |
% |
| 7815 |
% The second and third arguments of this function are the values set by |
| 7816 |
% \mykey{label} and \mykey{labelwidth} keys, the four argument can |
| 7817 |
% be an \mymeta{integer} or \mymeta{string} of the |
| 7818 |
% form \ics{Alph}, \ics{alph}, \ics{Roman} or \ics{roman}. |
| 7819 |
% The value of the four argument is set temporarily for the |
| 7820 |
% identified counter in this point (level), then the value is expanded |
| 7821 |
% into a \emph{\enquote{box}} and the \emph{\enquote{width}} of the |
| 7822 |
% \emph{\enquote{box}} is returned. |
| 7823 |
% \iffalse |
| 7824 |
%% Internal function for |widest| key. |
| 7825 |
%% #1 The counter associated with the environment level |
| 7826 |
%% #2 \l_enumext_label_X_tl |
| 7827 |
%% #3 \l_enumext_labelwidth_X_tl |
| 7828 |
%% #4 integer or string |
| 7829 |
% \fi |
| 7830 |
% \begin{macrocode} |
| 7831 |
\cs_new_protected:Npn \@@_widest_from:nNNn #1 #2 #3 #4 |
| 7832 |
{ |
| 7833 |
\@@_if_is_int:nTF {#4} |
| 7834 |
{ |
| 7835 |
\setcounter{enumX#1} { #4 } |
| 7836 |
} |
| 7837 |
{ |
| 7838 |
\regex_if_match:nVT { \c{Alph} | \c{alph} } #2 |
| 7839 |
{ \setcounter{enumX#1} { \int_from_alph:n {#4} } } |
| 7840 |
\regex_if_match:nVT { \c{Alph} | \c{alph} } #2 |
| 7841 |
{ \setcounter{enumX#1} { \int_from_roman:n {#4} } } |
| 7842 |
} |
| 7843 |
\@@_label_width_by_box:cv |
| 7844 |
{ l_@@_labelwidth_#1_dim } { l_@@_label_#1_tl } |
| 7845 |
} |
| 7846 |
\cs_generate_variant:Nn \@@_widest_from:nNNn { nccn } |
| 7847 |
% \end{macrocode} |
| 7848 |
% \end{macro} |
| 7849 |
% |
| 7850 |
% \begin{macro}[int]{start, start*, widest,} |
| 7851 |
% Now define and set \mykey{start*}, \mykey{start} and \mykey{widest} |
| 7852 |
% keys for \myenv*{enumext}, \myenv*{enumext*}, \myenv*{keyans} and |
| 7853 |
% \myenv*{keyans*} environments. |
| 7854 |
% |
| 7855 |
% \iffalse |
| 7856 |
%% Add |start*|, |start| and |widest| keys. |
| 7857 |
% \fi |
| 7858 |
% \begin{macrocode} |
| 7859 |
\cs_set_protected:Npn \@@_tmp:nn #1 #2 |
| 7860 |
{ |
| 7861 |
\keys_define:nn { enumext / #1 } |
| 7862 |
{ |
| 7863 |
start* .code:n = { |
| 7864 |
\@@_start_from:ccn |
| 7865 |
{ l_@@_label_#2_tl } |
| 7866 |
{ l_@@_start_#2_int } {##1} |
| 7867 |
}, |
| 7868 |
start* .value_required:n = true, |
| 7869 |
start .code:n = { |
| 7870 |
\@@_start_from:cce |
| 7871 |
{ l_@@_label_#2_tl } |
| 7872 |
{ l_@@_start_#2_int } { \int_eval:n {##1} } |
| 7873 |
}, |
| 7874 |
start .initial:n = 1, |
| 7875 |
start .value_required:n = true, |
| 7876 |
widest .code:n = { |
| 7877 |
\@@_widest_from:nccn {#2} |
| 7878 |
{ l_@@_label_#2_tl } |
| 7879 |
{ l_@@_labelwidth_#2_dim } {##1} |
| 7880 |
}, |
| 7881 |
widest .value_required:n = true, |
| 7882 |
} |
| 7883 |
} |
| 7884 |
\clist_map_inline:Nn \c_@@_all_envs_clist { \@@_tmp:nn #1 } |
| 7885 |
% \end{macrocode} |
| 7886 |
% \end{macro} |
| 7887 |
% |
| 7888 |
% \subsection{Setting keys for penaltys} |
| 7889 |
% |
| 7890 |
% \begin{macro}[int]{beginpenalty, midpenalty, endpenalty} |
| 7891 |
% The three parameters \textcolor{red}{\texttt{\textbackslash}}|@beginparpenalty|, |
| 7892 |
% \textcolor{red}{\texttt{\textbackslash}}|@itempenalty| and |
| 7893 |
% \textcolor{red}{\texttt{\textbackslash}}|@endparpenalty| work together |
| 7894 |
% to ensure that list environments look good, avoiding unsightly page |
| 7895 |
% breaks that can break the flow of the \myenv{list}, so it's a good |
| 7896 |
% idea to have a \mymeta{keys} to access these. |
| 7897 |
% \iffalse |
| 7898 |
%% Add |beginpenalty|, |midpenalty| and |endpenalty| keys. |
| 7899 |
% \fi |
| 7900 |
% \begin{macrocode} |
| 7901 |
\cs_set_protected:Npn \@@_tmp:nn #1 #2 |
| 7902 |
{ |
| 7903 |
\keys_define:nn { enumext / #1 } |
| 7904 |
{ |
| 7905 |
beginpenalty .int_set:c = { l_@@_beginparpenalty_#2_int }, |
| 7906 |
beginpenalty .initial:n = -51, |
| 7907 |
beginpenalty .value_required:n = true, |
| 7908 |
midpenalty .int_set:c = { l_@@_itempenalty_#2_int }, |
| 7909 |
midpenalty .initial:n = -51, |
| 7910 |
midpenalty .value_required:n = true, |
| 7911 |
endpenalty .int_set:c = { l_@@_endparpenalty_#2_int }, |
| 7912 |
endpenalty .initial:n = -51, |
| 7913 |
endpenalty .value_required:n = true, |
| 7914 |
} |
| 7915 |
} |
| 7916 |
\clist_map_inline:Nn \c_@@_all_envs_clist { \@@_tmp:nn #1 } |
| 7917 |
% \end{macrocode} |
| 7918 |
% \end{macro} |
| 7919 |
% |
| 7920 |
% \subsection{Setting keys for vertical spaces} |
| 7921 |
% |
| 7922 |
% \begin{macro}[int]{topsep, partopsep, parsep, noitemsep, nosep} |
| 7923 |
% Define and set \mykey{topsep}, \mykey{partopsep}, \mykey{parsep}, |
| 7924 |
% \mykey{itemsep}, \mykey{noitemsep} and \mykey{nosep} keys for |
| 7925 |
% \myenv*{enumext}, \myenv*{enumext*}, \myenv*{keyans} and |
| 7926 |
% \myenv*{keyans*} environments. |
| 7927 |
% |
| 7928 |
% \iffalse |
| 7929 |
%% Add |topsep|, |partopsep|, |parsep|, |noitemsep| and |nosep| keys. |
| 7930 |
% \fi |
| 7931 |
% \begin{macrocode} |
| 7932 |
\cs_set_protected:Npn \@@_tmp:nnnnnn #1 #2 #3 #4 #5 #6 |
| 7933 |
{ |
| 7934 |
\keys_define:nn { enumext / #1 } |
| 7935 |
{ |
| 7936 |
topsep .skip_set:c = { l_@@_topsep_#2_skip }, |
| 7937 |
topsep .initial:n = {#3}, |
| 7938 |
topsep .value_required:n = true, |
| 7939 |
partopsep .skip_set:c = { l_@@_partopsep_#2_skip }, |
| 7940 |
partopsep .initial:n = {#4}, |
| 7941 |
partopsep .value_required:n = true, |
| 7942 |
parsep .skip_set:c = { l_@@_parsep_#2_skip }, |
| 7943 |
parsep .initial:n = {#5}, |
| 7944 |
parsep .value_required:n = true, |
| 7945 |
itemsep .skip_set:c = { l_@@_itemsep_#2_skip }, |
| 7946 |
itemsep .initial:n = {#6}, |
| 7947 |
itemsep .value_required:n = true, |
| 7948 |
noitemsep .meta:n = { itemsep = 0pt, parsep = 0pt }, |
| 7949 |
noitemsep .value_forbidden:n = true, |
| 7950 |
nosep .meta:n = { |
| 7951 |
itemsep = 0pt, parsep= 0pt, |
| 7952 |
topsep = 0pt, partopsep = 0pt, |
| 7953 |
}, |
| 7954 |
nosep .value_forbidden:n = true, |
| 7955 |
} |
| 7956 |
} |
| 7957 |
% \end{macrocode} |
| 7958 |
% Now we set the values based on standard \myclass{article} class in |
| 7959 |
% \mydim{10pt}. |
| 7960 |
% \begin{macrocode} |
| 7961 |
\@@_tmp:nnnnnn { level-1 } { i } { 8.0pt plus 2.0pt minus 4.0pt } |
| 7962 |
{ 2.0pt plus 1.0pt minus 1.0pt } { 4.0pt plus 2.0pt minus 1.0pt } |
| 7963 |
{ 4.0pt plus 2.0pt minus 1.0pt } |
| 7964 |
\@@_tmp:nnnnnn { level-2 } { ii } { 4.0pt plus 2.0pt minus 1.0pt } |
| 7965 |
{ 2.0pt plus 1.0pt minus 1.0pt } { 2.0pt plus 1.0pt minus 1.0pt } |
| 7966 |
{ 2.0pt plus 1.0pt minus 1.0pt } |
| 7967 |
\@@_tmp:nnnnnn { level-3 } { iii } { 2.0pt plus 1.0pt minus 1.0pt } |
| 7968 |
{ 1.0pt minus 1.0pt }{ 0pt }{ 2.0pt plus 1.0pt minus 1.0pt } |
| 7969 |
\@@_tmp:nnnnnn { level-4 } { iv } { 2.0pt plus 1.0pt minus 1.0pt } |
| 7970 |
{ 1.0pt minus 1.0pt }{ 0pt }{ 2.0pt plus 1.0pt minus 1.0pt } |
| 7971 |
\@@_tmp:nnnnnn { keyans } { v }{ 4.0pt plus 2.0pt minus 1.0pt } |
| 7972 |
{ 2.0pt plus 1.0pt minus 1.0pt }{ 2.0pt plus 1.0pt minus 1.0pt } |
| 7973 |
{ 2.0pt plus 1.0pt minus 1.0pt } |
| 7974 |
\@@_tmp:nnnnnn { enumext* } { vii } { 8.0pt plus 2.0pt minus 4.0pt } |
| 7975 |
{ 2.0pt plus 1.0pt minus 1.0pt } { 4.0pt plus 2.0pt minus 1.0pt } |
| 7976 |
{ 4.0pt plus 2.0pt minus 1.0pt } |
| 7977 |
\@@_tmp:nnnnnn { keyans* } { viii } { 4.0pt plus 2.0pt minus 1.0pt } |
| 7978 |
{ 2.0pt plus 1.0pt minus 1.0pt } { 2.0pt plus 1.0pt minus 1.0pt } |
| 7979 |
{ 2.0pt plus 1.0pt minus 1.0pt } |
| 7980 |
% \end{macrocode} |
| 7981 |
% \end{macro} |
| 7982 |
% |
| 7983 |
% \subsection{Setting \texttt{base-fix} key}\label{key:base-fix} |
| 7984 |
% |
| 7985 |
% When nesting starting right after |\item| (without material between them) there |
| 7986 |
% is a problem with the alignment of the \emph{baseline} between the two environments. |
| 7987 |
% One way to get around this problem is to place |\mode_leave_vertical:| |
| 7988 |
% apply |\vspace{-\baselineskip}| and set |\topsep=|\mydim{0pt} for |
| 7989 |
% the \emph{\enquote{first level}} of the nested \myenv*{enumext} environment. |
| 7990 |
% |
| 7991 |
% \begin{macro}[int]{base-fix, \@@_nested_base_line_fix:} |
| 7992 |
% We define the key \mykey{base-fix} only for the \emph{\enquote{first level}} |
| 7993 |
% of \myenv*{enumext} environment. |
| 7994 |
% \iffalse |
| 7995 |
%% Add |base-fix| key only on first level off |enumext| environment. |
| 7996 |
% \fi |
| 7997 |
% \begin{macrocode} |
| 7998 |
\keys_define:nn { enumext / level-1 } |
| 7999 |
{ |
| 8000 |
base-fix .bool_set:N = \l_@@_base_line_fix_bool, |
| 8001 |
base-fix .initial:n = false, |
| 8002 |
base-fix .value_forbidden:n = true, |
| 8003 |
} |
| 8004 |
% \end{macrocode} |
| 8005 |
% The function \cs{@@_nested_base_line_fix:} passed to the \cs{@@_parse_keys:n} |
| 8006 |
% function in the definition of the \myenv*{enumext} environment (\S\ref{env:enumext}) |
| 8007 |
% will be responsible for applying the \emph{baseline correction} and |
| 8008 |
% adjusting the \mymeta{keys} for the \myenv*{enumext} environment and |
| 8009 |
% the |\printkeyans| with \emph{starred argument} ‘|*|’ (\S\ref{cmd:printkeyans}). |
| 8010 |
% |
| 8011 |
% We will first implement the function code from the user side of the |
| 8012 |
% \mykey{base-fix} key, that is, only the user knows when it is necessary |
| 8013 |
% to apply it within the document in which case the variable |
| 8014 |
% \cs{l_@@_print_keyans_star_bool} set by the |\printkeyans| command is |
| 8015 |
% false and the variable \cs{l_@@_base_line_fix_bool} is true. |
| 8016 |
% |
| 8017 |
% \smallskip |
| 8018 |
% |
| 8019 |
% We set the values of the keys \mykey{topsep}, \mykey{above} |
| 8020 |
% and \mykey{above*} for the \emph{\enquote{first level}} of \myenv*{enumext} |
| 8021 |
% environment equal to \mydim{0pt} and finally set the variable \cs{l_@@_base_line_fix_bool} |
| 8022 |
% to false. |
| 8023 |
% \iffalse |
| 8024 |
%% Internal function for |base-fix| key in |enumext| environment. |
| 8025 |
% \fi |
| 8026 |
% \begin{macrocode} |
| 8027 |
\cs_new_protected:Nn \@@_nested_base_line_fix: |
| 8028 |
{ |
| 8029 |
\bool_lazy_all:nT |
| 8030 |
{ |
| 8031 |
{ \bool_if_p:N \l_@@_starred_first_bool } |
| 8032 |
{ \bool_if_p:N \l_@@_base_line_fix_bool } |
| 8033 |
{ \bool_not_p:n { \l_@@_print_keyans_star_bool } } |
| 8034 |
} |
| 8035 |
{ |
| 8036 |
\mode_leave_vertical: |
| 8037 |
\vspace { -\dim_eval:n { \baselineskip + \parsep } } |
| 8038 |
\keys_set:nn { enumext / level-1 } |
| 8039 |
{ |
| 8040 |
topsep = 0pt, above = 0pt, above* = 0pt, |
| 8041 |
} |
| 8042 |
} |
| 8043 |
% \end{macrocode} |
| 8044 |
% When we are running the |\printkeyans| command with the \emph{starred |
| 8045 |
% argument} ‘|*|’ the variable \cs{l_@@_print_keyans_star_bool} is true |
| 8046 |
% and we can run a simplified version of |\vspace| using |\skip_vertical:n|. |
| 8047 |
% \begin{macrocode} |
| 8048 |
\bool_lazy_and:nnT |
| 8049 |
{ \bool_if_p:N \l_@@_starred_first_bool } |
| 8050 |
{ \bool_if_p:N \l_@@_print_keyans_star_bool } |
| 8051 |
{ |
| 8052 |
\mode_leave_vertical: |
| 8053 |
\skip_vertical:n { -\baselineskip } |
| 8054 |
\skip_vertical:N \c_zero_skip |
| 8055 |
\keys_set:nn { enumext / level-1 } |
| 8056 |
{ |
| 8057 |
topsep = 0pt, above = 0pt, above* = 0pt, |
| 8058 |
} |
| 8059 |
} |
| 8060 |
\bool_set_false:N \l_@@_base_line_fix_bool |
| 8061 |
} |
| 8062 |
% \end{macrocode} |
| 8063 |
% \end{macro} |
| 8064 |
% |
| 8065 |
% \subsection{Setting keys for horizontal spaces}\label{key:list-indent} |
| 8066 |
% |
| 8067 |
% \begin{macro}[int]{itemindent, rightmargin, listparindent, list-offset, list-indent} |
| 8068 |
% Define and set \mykey{itemindent}, \mykey{rightmargin}, \mykey{listparindent}, \mykey{list-offset} |
| 8069 |
% and \mykey{list-indent} keys for \myenv*{enumext}, \myenv*{enumext*}, \myenv*{keyans} and |
| 8070 |
% \myenv*{keyans*} environments. |
| 8071 |
% \iffalse |
| 8072 |
%% Add |itemindent|, |rightmargin|, |listparindent|, |list-offset| and |list-indent| keys. |
| 8073 |
% \fi |
| 8074 |
% \begin{macrocode} |
| 8075 |
\cs_set_protected:Npn \@@_tmp:nn #1 #2 |
| 8076 |
{ |
| 8077 |
\keys_define:nn { enumext / #1 } |
| 8078 |
{ |
| 8079 |
itemindent .dim_set:c = { l_@@_fake_item_indent_#2_dim }, |
| 8080 |
itemindent .value_required:n = true, |
| 8081 |
rightmargin .dim_set:c = { l_@@_rightmargin_#2_dim }, |
| 8082 |
rightmargin .value_required:n = true, |
| 8083 |
listparindent .dim_set:c = { l_@@_listparindent_#2_dim }, |
| 8084 |
listparindent .value_required:n = true, |
| 8085 |
list-offset .dim_set:c = { l_@@_listoffset_#2_dim }, |
| 8086 |
list-offset .value_required:n = true, |
| 8087 |
list-indent .code:n = |
| 8088 |
\bool_set_true:c { l_@@_leftmargin_tmp_#2_bool } |
| 8089 |
\dim_set:cn { l_@@_leftmargin_tmp_#2_dim } {##1}, |
| 8090 |
list-indent .value_required:n = true, |
| 8091 |
} |
| 8092 |
} |
| 8093 |
\clist_map_inline:nn |
| 8094 |
{ |
| 8095 |
{level-1}{i}, {level-2}{ii}, {level-3}{iii}, {level-4}{iv}, {keyans}{v} |
| 8096 |
} |
| 8097 |
{ \@@_tmp:nn #1 } |
| 8098 |
% \end{macrocode} |
| 8099 |
% \end{macro} |
| 8100 |
% |
| 8101 |
% For \myenv*{enumext*} and \myenv*{keyans*} environments the situation |
| 8102 |
% is a bit different, the \mykey{list-indent} key behaves like the \mykey{list-offset} key. |
| 8103 |
% \iffalse |
| 8104 |
%% Set |list-offset| and |list-indent| keys for |enumext*| and |keyans*| environments. |
| 8105 |
% \fi |
| 8106 |
% \begin{macrocode} |
| 8107 |
\cs_set_protected:Npn \@@_tmp:nn #1 #2 |
| 8108 |
{ |
| 8109 |
\keys_define:nn { enumext / #1 } |
| 8110 |
{ |
| 8111 |
itemindent .dim_set:c = { l_@@_fake_item_indent_#2_dim }, |
| 8112 |
itemindent .value_required:n = true, |
| 8113 |
rightmargin .dim_set:c = { l_@@_rightmargin_#2_dim }, |
| 8114 |
rightmargin .value_required:n = true, |
| 8115 |
listparindent .dim_set:c = { l_@@_listparindent_#2_dim }, |
| 8116 |
listparindent .value_required:n = true, |
| 8117 |
list-offset .dim_set:c = { l_@@_listoffset_#2_dim }, |
| 8118 |
list-offset .value_required:n = true, |
| 8119 |
list-indent .meta:n = { list-offset = ##1 }, |
| 8120 |
list-indent .value_required:n = true, |
| 8121 |
} |
| 8122 |
} |
| 8123 |
\clist_map_inline:nn |
| 8124 |
{ |
| 8125 |
{enumext*}{vii}, {keyans*}{viii} |
| 8126 |
} |
| 8127 |
{ \@@_tmp:nn #1 } |
| 8128 |
% \end{macrocode} |
| 8129 |
% |
| 8130 |
% \subsubsection{Functions for setting the fake \texttt{itemindent}}\label{key:fake-indent} |
| 8131 |
% |
| 8132 |
% \begin{macro}[int]{\@@_fake_item_indent:,\@@_keyans_fake_item_indent:, |
| 8133 |
% \@@_fake_item_indent_vii:, \@@_fake_item_indent_viii:,} |
| 8134 |
% |
| 8135 |
% The \mykey{itemindent} key does not set the value of |\itemindent|, it only |
| 8136 |
% sets the value of the \emph{horizontal space} applied using |\skip_horizontal:N|. We will |
| 8137 |
% store this value in the variable and only apply it when it is greater |
| 8138 |
% than \mydim{0pt}. Here I will need to place |
| 8139 |
% |\mode_leave_vertical:| and the plain \hologo{TeX} macro |
| 8140 |
% |\ignorespaces| to avoid unwanted extra space when using the |
| 8141 |
% \mykey{itemindent} key. |
| 8142 |
% \iffalse |
| 8143 |
%% Internal functions for |itemindent| key. |\mode_leave_vertical:| nor |
| 8144 |
% \fi |
| 8145 |
% \begin{macrocode} |
| 8146 |
\cs_set_protected:Nn \@@_fake_item_indent: |
| 8147 |
{ |
| 8148 |
\dim_compare:nNnT |
| 8149 |
{ \dim_use:c { l_@@_fake_item_indent_ \@@_level: _dim } } |
| 8150 |
> |
| 8151 |
{ \c_zero_dim } |
| 8152 |
{ |
| 8153 |
\tl_set:ce { l_@@_fake_item_indent_ \@@_level: _tl } |
| 8154 |
{ |
| 8155 |
\exp_not:N \mode_leave_vertical: |
| 8156 |
\exp_not:n { \skip_horizontal:n } |
| 8157 |
{ \dim_use:c { l_@@_fake_item_indent_ \@@_level: _dim } } |
| 8158 |
\exp_not:N \ignorespaces |
| 8159 |
} |
| 8160 |
} |
| 8161 |
} |
| 8162 |
\cs_set_protected:Nn \@@_keyans_fake_item_indent: |
| 8163 |
{ |
| 8164 |
\dim_compare:nNnT |
| 8165 |
{ \l_@@_fake_item_indent_v_dim } > { \c_zero_dim } |
| 8166 |
{ |
| 8167 |
\tl_set:Ne \l_@@_fake_item_indent_v_tl |
| 8168 |
{ |
| 8169 |
\exp_not:N \mode_leave_vertical: |
| 8170 |
\exp_not:N \skip_horizontal:N \l_@@_fake_item_indent_v_dim |
| 8171 |
\exp_not:N \ignorespaces |
| 8172 |
} |
| 8173 |
} |
| 8174 |
} |
| 8175 |
\cs_set_protected:Nn \@@_fake_item_indent_vii: |
| 8176 |
{ |
| 8177 |
\dim_compare:nNnT |
| 8178 |
{ \l_@@_fake_item_indent_vii_dim } > { \c_zero_dim } |
| 8179 |
{ |
| 8180 |
\tl_set:Ne \l_@@_fake_item_indent_vii_tl |
| 8181 |
{ |
| 8182 |
\exp_not:N \skip_horizontal:N \l_@@_fake_item_indent_vii_dim |
| 8183 |
\exp_not:N \ignorespaces |
| 8184 |
} |
| 8185 |
} |
| 8186 |
} |
| 8187 |
\cs_set_protected:Nn \@@_fake_item_indent_viii: |
| 8188 |
{ |
| 8189 |
\dim_compare:nNnT |
| 8190 |
{ \l_@@_fake_item_indent_viii_dim } > { \c_zero_dim } |
| 8191 |
{ |
| 8192 |
\tl_set:Ne \l_@@_fake_item_indent_viii_tl |
| 8193 |
{ |
| 8194 |
\exp_not:N \skip_horizontal:N \l_@@_fake_item_indent_viii_dim |
| 8195 |
\exp_not:N \ignorespaces |
| 8196 |
} |
| 8197 |
} |
| 8198 |
} |
| 8199 |
% \end{macrocode} |
| 8200 |
% \end{macro} |
| 8201 |
% |
| 8202 |
% \subsection{Setting \texttt{show-length} key} |
| 8203 |
% |
| 8204 |
% \begin{macro}[int]{show-length} |
| 8205 |
% Define and set \mykey{show-length} key for \myenv*{enumext}, |
| 8206 |
% \myenv*{enumext*}, \myenv*{keyans} and \myenv*{keyans*} environments. |
| 8207 |
% The function sets the boolean variable \myvarenv{l__@@_show_length_X_bool} |
| 8208 |
% used in the definition of all environments to \emph{\enquote{true}} |
| 8209 |
% and calls the function \cs{@@_show_length:nnn} which prints all the |
| 8210 |
% values of the \emph{\enquote{vertical}} and \emph{\enquote{horizontal}} |
| 8211 |
% parameters calculated and used. |
| 8212 |
% \iffalse |
| 8213 |
%% Add |show-length| key for all environments.. |
| 8214 |
% \fi |
| 8215 |
% \begin{macrocode} |
| 8216 |
\cs_set_protected:Npn \@@_tmp:nn #1 #2 |
| 8217 |
{ |
| 8218 |
\keys_define:nn { enumext / #1 } |
| 8219 |
{ |
| 8220 |
show-length .bool_set:c = { l_@@_show_length_#2_bool }, |
| 8221 |
show-length .initial:n = false, |
| 8222 |
} |
| 8223 |
} |
| 8224 |
\clist_map_inline:Nn \c_@@_all_envs_clist { \@@_tmp:nn #1 } |
| 8225 |
% \end{macrocode} |
| 8226 |
% \end{macro} |
| 8227 |
% |
| 8228 |
% \subsection{Setting \texttt{before}, \texttt{after} and \texttt{first} keys}\label{key:before} |
| 8229 |
% |
| 8230 |
% \begin{macro}[int]{before, before*, after, first} |
| 8231 |
% Define and set \mykey{before}, \mykey{before*}, \mykey{after} and \mykey{first} keys |
| 8232 |
% for \myenv*{enumext}, \myenv*{enumext*}, \myenv*{keyans} and \myenv*{keyans*} environments. |
| 8233 |
% \iffalse |
| 8234 |
%% Add |before|, |before*|, |after| and |first| keys. |
| 8235 |
% \fi |
| 8236 |
% \begin{macrocode} |
| 8237 |
\cs_set_protected:Npn \@@_tmp:nn #1 #2 |
| 8238 |
{ |
| 8239 |
\keys_define:nn { enumext / #1 } |
| 8240 |
{ |
| 8241 |
before .tl_set:c = { l_@@_before_no_starred_key_#2_tl }, |
| 8242 |
before .value_required:n = true, |
| 8243 |
before* .tl_set:c = { l_@@_before_starred_key_#2_tl }, |
| 8244 |
before* .value_required:n = true, |
| 8245 |
after .tl_set:c = { l_@@_after_stop_list_#2_tl }, |
| 8246 |
after .value_required:n = true, |
| 8247 |
first .tl_set:c = { l_@@_after_list_args_#2_tl }, |
| 8248 |
first .value_required:n = true, |
| 8249 |
} |
| 8250 |
} |
| 8251 |
\clist_map_inline:Nn \c_@@_all_envs_clist { \@@_tmp:nn #1 } |
| 8252 |
% \end{macrocode} |
| 8253 |
% \end{macro} |
| 8254 |
% |
| 8255 |
% \subsubsection{Functions for \texttt{before}, \texttt{after} and \texttt{first} keys in \env{enumext}} |
| 8256 |
% |
| 8257 |
% \begin{macro}{\@@_before_args_exec:,\@@_before_keys_exec:, |
| 8258 |
% \@@_after_stop_list:,\@@_after_args_exec:,} |
| 8259 |
% The function \cs{@@_before_args_exec:} executes the \mymarg{code} set by the |
| 8260 |
% \mykey{before*} key \emph{\enquote{before}} the \myenv*{enumext} |
| 8261 |
% environment is started. The \mymarg{code} is executed \emph{\enquote{without}} |
| 8262 |
% knowing any definition of the \mymarg{arg two} of the list: |
| 8263 |
% \mymarg[cbc=pkgcolor,ac=araracolor]{code}|\list|\mymarg{arg one}\mymarg{arg two}. |
| 8264 |
% \iffalse |
| 8265 |
%% Function for |before|, |before*|, |after| and |first| keys in |enumext|. |
| 8266 |
% \fi |
| 8267 |
% \begin{macrocode} |
| 8268 |
\cs_new_protected:Nn \@@_before_args_exec: |
| 8269 |
{ |
| 8270 |
\tl_use:c { l_@@_before_starred_key_ \@@_level: _tl } |
| 8271 |
} |
| 8272 |
% \end{macrocode} |
| 8273 |
% The function \cs{@@_before_keys_exec:} executes the \mymarg{code} set by the |
| 8274 |
% \mykey{before} key \emph{\enquote{before}} the \myenv*{enumext} |
| 8275 |
% environment is started in \emph{second argument} of the list. The |
| 8276 |
% \mymarg{code} is executed \emph{\enquote{knowing}} |
| 8277 |
% all definition and values provides by \mymeta{keys}: |
| 8278 |
% |\list|\mymarg{arg one}|{|\mymeta{arg two}\mymarg[cbc=pkgcolor,ac=araracolor]{code}|}| |
| 8279 |
% \begin{macrocode} |
| 8280 |
\cs_new_protected:Nn \@@_before_keys_exec: |
| 8281 |
{ |
| 8282 |
\tl_use:c { l_@@_before_no_starred_key_ \@@_level: _tl } |
| 8283 |
} |
| 8284 |
% \end{macrocode} |
| 8285 |
% The function \cs{@@_after_stop_list:} executes the \mymarg{code} set by the |
| 8286 |
% \mykey{after} key \emph{\enquote{after}} the \myenv*{enumext} |
| 8287 |
% environment has finished: |\endlist|\mymarg[cbc=pkgcolor,ac=araracolor]{code}. |
| 8288 |
% \begin{macrocode} |
| 8289 |
\cs_new_protected:Nn \@@_after_stop_list: |
| 8290 |
{ |
| 8291 |
\tl_use:c { l_@@_after_stop_list_ \@@_level: _tl } |
| 8292 |
} |
| 8293 |
% \end{macrocode} |
| 8294 |
% The function \cs{@@_after_args_exec:} executes the \mymarg{code} set by the |
| 8295 |
% \mykey{first} key after the end of the second argument of the list |
| 8296 |
% defining the \myenv*{enumext} environment, just before the first |
| 8297 |
% occurrence of |\item|: |\list|\mymarg{arg one}\mymarg{arg two}\mymarg[cbc=pkgcolor,ac=araracolor]{code}|\item|. |
| 8298 |
% \begin{macrocode} |
| 8299 |
\cs_new_protected:Nn \@@_after_args_exec: |
| 8300 |
{ |
| 8301 |
\tl_use:c { l_@@_after_list_args_ \@@_level: _tl } |
| 8302 |
} |
| 8303 |
% \end{macrocode} |
| 8304 |
% \end{macro} |
| 8305 |
% |
| 8306 |
% \subsubsection{Functions for \texttt{before}, \texttt{after} and \texttt{first} keys in \env{keyans}} |
| 8307 |
% |
| 8308 |
% \begin{macro}{\@@_before_args_exec_v:,\@@_before_keys_exec_v:, |
| 8309 |
% \@@_after_stop_list_v:, \@@_after_args_exec_v:} |
| 8310 |
% Same implementation as the one used in the \myenv*{enumext} environment. |
| 8311 |
% \iffalse |
| 8312 |
%% Function for |before|, |before*|, |after| and |first| keys in |keyans|. |
| 8313 |
% \fi |
| 8314 |
% \begin{macrocode} |
| 8315 |
\cs_new_protected:Nn \@@_before_args_exec_v: |
| 8316 |
{ |
| 8317 |
\tl_use:N \l_@@_before_starred_key_v_tl |
| 8318 |
} |
| 8319 |
\cs_new_protected:Nn \@@_before_keys_exec_v: |
| 8320 |
{ |
| 8321 |
\tl_use:N \l_@@_before_no_starred_key_v_tl |
| 8322 |
} |
| 8323 |
\cs_new_protected:Nn \@@_after_stop_list_v: |
| 8324 |
{ |
| 8325 |
\tl_use:N \l_@@_after_stop_list_v_tl |
| 8326 |
} |
| 8327 |
\cs_new_protected:Nn \@@_after_args_exec_v: |
| 8328 |
{ |
| 8329 |
\tl_use:N \l_@@_after_list_args_v_tl |
| 8330 |
} |
| 8331 |
% \end{macrocode} |
| 8332 |
% \end{macro} |
| 8333 |
% |
| 8334 |
% \subsubsection{Functions for \texttt{before}, \texttt{after} and \texttt{first} keys in \env{enumext*} and \env{keyans*}} |
| 8335 |
% |
| 8336 |
% \begin{macro}{\@@_before_args_exec_vii:,\@@_before_keys_exec_vii, |
| 8337 |
% \@@_after_stop_list_vii:, \@@_after_args_exec_vii:,} |
| 8338 |
% Same implementation as the one used in the \myenv*{enumext} environment. |
| 8339 |
% \iffalse |
| 8340 |
%% Function for |before|, |before*|, |after| and |first| keys in |enumext*| and |keyans*|. |
| 8341 |
% \fi |
| 8342 |
% \begin{macrocode} |
| 8343 |
\cs_new_protected:Nn \@@_before_args_exec_vii: |
| 8344 |
{ |
| 8345 |
\tl_use:N \l_@@_before_starred_key_vii_tl |
| 8346 |
} |
| 8347 |
\cs_new_protected:Nn \@@_before_args_exec_viii: |
| 8348 |
{ |
| 8349 |
\tl_use:N \l_@@_before_starred_key_viii_tl |
| 8350 |
} |
| 8351 |
\cs_new_protected:Nn \@@_before_keys_exec_vii: |
| 8352 |
{ |
| 8353 |
\tl_use:N \l_@@_before_no_starred_key_vii_tl |
| 8354 |
} |
| 8355 |
\cs_new_protected:Nn \@@_before_keys_exec_viii: |
| 8356 |
{ |
| 8357 |
\tl_use:N \l_@@_before_no_starred_key_viii_tl |
| 8358 |
} |
| 8359 |
\cs_new_protected:Nn \@@_after_stop_list_vii: |
| 8360 |
{ |
| 8361 |
\tl_use:N \l_@@_after_stop_list_vii_tl |
| 8362 |
} |
| 8363 |
\cs_new_protected:Nn \@@_after_stop_list_viii: |
| 8364 |
{ |
| 8365 |
\tl_use:N \l_@@_after_stop_list_viii_tl |
| 8366 |
} |
| 8367 |
\cs_new_protected:Nn \@@_after_args_exec_vii: |
| 8368 |
{ |
| 8369 |
\tl_use:N \l_@@_after_list_args_vii_tl |
| 8370 |
} |
| 8371 |
\cs_new_protected:Nn \@@_after_args_exec_viii: |
| 8372 |
{ |
| 8373 |
\tl_use:N \l_@@_after_list_args_viii_tl |
| 8374 |
} |
| 8375 |
% \end{macrocode} |
| 8376 |
% \end{macro} |
| 8377 |
% |
| 8378 |
% \subsection{Setting keys for \env{multicols} and \env{minipage}}\label{key:mini-multi} |
| 8379 |
% |
| 8380 |
% \begin{macro}[int]{mini-env, mini-sep, columns-sep, columns} |
| 8381 |
% The default value of the \mykey{columns-sep} key is handled by |
| 8382 |
% the state of the boolean variable \myvarenv{l__@@_columns_sep_X_bool} |
| 8383 |
% which is handled in the internal definition of the \myenv*{enumext} |
| 8384 |
% and \myenv*{keyans} environments. |
| 8385 |
% Define and set \mykey{mini-env}, \mykey{mini-sep}, \mykey{columns-sep} |
| 8386 |
% and \mykey{columns} keys for \myenv*{enumext}, \myenv*{enumext*}, \myenv*{keyans} and |
| 8387 |
% \myenv*{keyans*} environments. |
| 8388 |
% \iffalse |
| 8389 |
%% Add |mini-env|, |mini-sep|, |columns-sep| and |columns| keys. |
| 8390 |
% \fi |
| 8391 |
% \begin{macrocode} |
| 8392 |
\cs_set_protected:Npn \@@_tmp:nn #1 #2 |
| 8393 |
{ |
| 8394 |
\keys_define:nn { enumext / #1 } |
| 8395 |
{ |
| 8396 |
mini-env .dim_set:c = { l_@@_minipage_right_#2_dim }, |
| 8397 |
mini-env .value_required:n = true, |
| 8398 |
mini-sep .dim_set:c = { l_@@_minipage_hsep_#2_dim }, |
| 8399 |
mini-sep .initial:n = 0.3333em, |
| 8400 |
mini-sep .value_required:n = true, |
| 8401 |
columns-sep .dim_set:c = { l_@@_columns_sep_#2_dim }, |
| 8402 |
columns-sep .value_required:n = true, |
| 8403 |
columns .int_set:c = { l_@@_columns_#2_int }, |
| 8404 |
columns .initial:n = 1, |
| 8405 |
columns .value_required:n = true, |
| 8406 |
} |
| 8407 |
} |
| 8408 |
\clist_map_inline:Nn \c_@@_all_envs_clist { \@@_tmp:nn #1 } |
| 8409 |
% \end{macrocode} |
| 8410 |
% |
| 8411 |
% For \myenv*{enumext*} and \myenv*{keyans*} environments the situation |
| 8412 |
% is a bit different, the command \ics*{miniright} is not available, so we will add |
| 8413 |
% the keys \mykey{mini-right} and \mykey{mini-right*} to implement support for |
| 8414 |
% \myenv{minipage} environment. |
| 8415 |
% \iffalse |
| 8416 |
%% Add |mini-right| and |mini-right*| keys for starred environments. |
| 8417 |
% \fi |
| 8418 |
% \begin{macrocode} |
| 8419 |
\cs_set_protected:Npn \@@_tmp:nn #1 #2 |
| 8420 |
{ |
| 8421 |
\keys_define:nn { enumext / #1 } |
| 8422 |
{ |
| 8423 |
mini-right .tl_gset:c = { g_@@_miniright_code_#2_tl }, |
| 8424 |
mini-right .value_required:n = true, |
| 8425 |
mini-right* .code:n = { |
| 8426 |
\bool_gset_true:c { g_@@_minipage_center_#2_bool } |
| 8427 |
\keys_set:nn { enumext / #1 } { mini-right = {##1} } |
| 8428 |
}, |
| 8429 |
mini-right* .value_required:n = true, |
| 8430 |
} |
| 8431 |
} |
| 8432 |
\clist_map_inline:nn { {enumext*}{vii}, {keyans*}{viii} } { \@@_tmp:nn #1 } |
| 8433 |
% \end{macrocode} |
| 8434 |
% \end{macro} |
| 8435 |
% |
| 8436 |
% \subsection{Adjustment of vertical spaces for \env{multicols}} \label{vspace:multi} |
| 8437 |
% |
| 8438 |
% When nesting a \emph{\enquote{list environment}} inside the \myenv{multicols} environment, |
| 8439 |
% the values of the \emph{\enquote{vertical spaces}} are lost, basically the |
| 8440 |
% \myenv{multicols} environment takes control over them. Graphically, this can be seen in figure \ref{fig:six}. |
| 8441 |
% |
| 8442 |
% \begin{figure}[!htbp] |
| 8443 |
% \centering |
| 8444 |
% \begin{tikzpicture}[line cap=round,line join=round,x=0.8cm,y=0.8cm,every node/.style={font=\footnotesize}] |
| 8445 |
% \draw[color=white] (7.0,6.10) rectangle (17.5,6.50) node[pos=.5,text=black] { \textcolor{blue}{\texttt{\textbackslash{}multicolsep [±\textbackslash{}topskip]}} };% space above |
| 8446 |
% \draw[color=white] (7.0,4.85) rectangle (17.5,5.25) node[pos=.5,text=black] { \textcolor{blue}{\texttt{\textbackslash{}multicolsep [±\textbackslash{}prevdepth?]}} };% space below |
| 8447 |
% \draw[color=white] (2.0,6.10) rectangle (5,6.50) node[pos=.5,text=optcolor,font=\footnotesize\ttfamily] { topsep };% topsep above |
| 8448 |
% \draw[color=white] (2.0,4.85) rectangle (5,5.25) node[pos=.5,text=optcolor,font=\footnotesize\ttfamily] { topsep };% topsep below |
| 8449 |
% \draw[<->,color=gray] (2.0,7.0) --node[above,text=optcolor]{\vphantom{p}\texttt{labelwidth}} (5.0,7.0); |
| 8450 |
% \draw[<->,color=gray] (5.0,7.0) --node[above,text=optcolor]{\texttt{labelsep}} (7.0,7.0); |
| 8451 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (2.0,6.5) rectangle (5.0,6.85);% labelwidth |
| 8452 |
% \draw[->,color=lightgray,shorten >=3pt] (4.5,6.3) -- (7.0,6.3); % glue space = topsep (above) |
| 8453 |
% \draw[->,color=lightgray,shorten >=3pt] (4.5,5.05) -- (7.0,5.05); % glue space = topsep (above) |
| 8454 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (5.0,6.5) rectangle (7.0,6.85);% labelsep |
| 8455 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,6.5) rectangle (17.5,6.85);% item width |
| 8456 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,5.25) rectangle (11.5,6.10) node[pos=.5,text=black] |
| 8457 |
% {\begin{tabular}{c} |
| 8458 |
% \texttt{column one} \\ |
| 8459 |
% \textcolor{blue}{\emph{nested list or items}} |
| 8460 |
% \end{tabular}}; |
| 8461 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (13.5,5.25) rectangle (17.5,6.10) node[pos=.5,text=black] |
| 8462 |
% {\begin{tabular}{c} |
| 8463 |
% \texttt{column two} \\ |
| 8464 |
% \textcolor{blue}{\emph{nested list or items}} |
| 8465 |
% \end{tabular}}; |
| 8466 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (2.0,4.5) rectangle (5.0,4.85);% labelwidth |
| 8467 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (5.0,4.5) rectangle (7.0,4.85);% labelsep |
| 8468 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,4.5) rectangle (17.5,4.85);% item width |
| 8469 |
% \end{tikzpicture} |
| 8470 |
% \caption{Representation of the vertical space in \myenv{multicols} for a nested level.} |
| 8471 |
% \label{fig:six} |
| 8472 |
% \end{figure} |
| 8473 |
% |
| 8474 |
% To keep the desired spaces \emph{above} and \emph{below} in the \emph{\enquote{list environment}} |
| 8475 |
% (|\topsep + [\partopsep]|) it is necessary to \emph{\enquote{adjust}} the spaces added |
| 8476 |
% by the \myenv{multicols} environment. |
| 8477 |
% The most appropriate option in this case is to use a \emph{\enquote{context sensitive}} |
| 8478 |
% vertical space with |\addvspace|. |
| 8479 |
% |
| 8480 |
% \smallskip |
| 8481 |
% |
| 8482 |
% \begin{important}* |
| 8483 |
% I should make it clear that the implementation here is a \emph{\enquote{bit |
| 8484 |
% questionable}}. At first glance doing |\multicolsep=\topsep| seemed right, but the results |
| 8485 |
% were not always as expected. An almost \emph{imperceptible} detail is that in some cases the |
| 8486 |
% |\itemsep| values of are \emph{\enquote{stretched}}, possibly due to |
| 8487 |
% the use of |\raggedcolumns| and this affects the lower space when |
| 8488 |
% closing the environment, which is \emph{\enquote{smaller}} than |
| 8489 |
% expected. My attempts to find the correct values using |\showoutput| and |
| 8490 |
% |\showboxdepth| absolutely failed. |
| 8491 |
% \end{important} |
| 8492 |
% |
| 8493 |
% \subsubsection{Adjustment of vertical spaces for \env{multicols} in \env{enumext}} |
| 8494 |
% |
| 8495 |
% |
| 8496 |
% \begin{macro}{\@@_multi_set_vskip:} |
| 8497 |
% The function \cs{@@_multi_set_vskip:} will take care of determining the |
| 8498 |
% \emph{\enquote{adjusted spaces}} that we will apply \emph{\enquote{above}} and |
| 8499 |
% \emph{\enquote{below}} the \myenv{multicols} environment in |
| 8500 |
% \myenv*{enumext}. |
| 8501 |
% |
| 8502 |
% \smallskip |
| 8503 |
% |
| 8504 |
% We will set the default values taking into account that \hologo{TeX} is |
| 8505 |
% in \mymeta{horizontal mode}, then we will make the settings for the |
| 8506 |
% \mymeta{vertical mode} in which |\partopsep| comes into play. |
| 8507 |
% |
| 8508 |
% \smallskip |
| 8509 |
% |
| 8510 |
% Set the values of \myvarenv{l__@@_multicols_above_X_skip} and \myvarenv{l__@@_multicols_below_X_skip} |
| 8511 |
% equal to the value of |\topsep| in the \emph{current level}. |
| 8512 |
% \iffalse |
| 8513 |
%% Adjustment of vertical spacing for |multicols| in |enumext|. |
| 8514 |
% \fi |
| 8515 |
% \begin{macrocode} |
| 8516 |
\cs_new_protected:Nn \@@_multi_set_vskip: |
| 8517 |
{ |
| 8518 |
\skip_set:cn { l_@@_multicols_above_ \@@_level: _skip } |
| 8519 |
{ |
| 8520 |
\skip_use:c { l_@@_topsep_ \@@_level: _skip } |
| 8521 |
} |
| 8522 |
\skip_set:cn { l_@@_multicols_below_ \@@_level: _skip } |
| 8523 |
{ |
| 8524 |
\skip_use:c { l_@@_topsep_ \@@_level: _skip } |
| 8525 |
} |
| 8526 |
\@@_add_pre_parsep: |
| 8527 |
} |
| 8528 |
% \end{macrocode} |
| 8529 |
% \end{macro} |
| 8530 |
% |
| 8531 |
% \begin{macro}{\@@_add_pre_parsep:} |
| 8532 |
% The function \cs{@@_add_pre_parsep:} \emph{\enquote{adjusted}} the value |
| 8533 |
% of \myvarenv{l__@@_multicols_above_X_skip} detecting the value of |
| 8534 |
% \ics{parsep} from the previous level. This is necessary since |
| 8535 |
% \ics{parsep} from the previous level affects the \emph{vertical spaces}. |
| 8536 |
% \iffalse |
| 8537 |
%% Detect |\parsep| from previous level and adjust |\l_@@_multicols_above_X_skip| for |multicols| in |enumext|. |
| 8538 |
% \fi |
| 8539 |
% \begin{macrocode} |
| 8540 |
\cs_new_protected:Nn \@@_add_pre_parsep: |
| 8541 |
{ |
| 8542 |
\int_case:nn { \l_@@_level_int } |
| 8543 |
{ |
| 8544 |
{ 2 }{ |
| 8545 |
\skip_if_eq:nnF { \l_@@_parsep_i_skip } { \c_zero_skip } |
| 8546 |
{ |
| 8547 |
\skip_add:Nn \l_@@_multicols_above_ii_skip |
| 8548 |
{ |
| 8549 |
\l_@@_parsep_i_skip |
| 8550 |
} |
| 8551 |
} |
| 8552 |
} |
| 8553 |
{ 3 }{ |
| 8554 |
\skip_if_eq:nnF { \l_@@_parsep_ii_skip } { \c_zero_skip } |
| 8555 |
{ |
| 8556 |
\skip_add:Nn \l_@@_multicols_above_iii_skip |
| 8557 |
{ |
| 8558 |
\l_@@_parsep_ii_skip |
| 8559 |
} |
| 8560 |
} |
| 8561 |
} |
| 8562 |
{ 4 }{ |
| 8563 |
\skip_if_eq:nnF { \l_@@_parsep_iii_skip } { \c_zero_skip } |
| 8564 |
{ |
| 8565 |
\skip_add:Nn \l_@@_multicols_above_iv_skip |
| 8566 |
{ |
| 8567 |
\l_@@_parsep_iii_skip |
| 8568 |
} |
| 8569 |
} |
| 8570 |
} |
| 8571 |
} |
| 8572 |
} |
| 8573 |
% \end{macrocode} |
| 8574 |
% \end{macro} |
| 8575 |
% |
| 8576 |
% \begin{macro}{\@@_multi_addvspace:} |
| 8577 |
% The function \cs{@@_multi_addvspace:} will apply the spaces set using |
| 8578 |
% |\addvspace| \emph{\enquote{above}} the \myenv{multicols} environment |
| 8579 |
% in \myenv*{enumext}, taking into account whether \hologo{TeX} is in |
| 8580 |
% \mymeta{horizontal mode} or \mymeta{vertical mode}. |
| 8581 |
% \iffalse |
| 8582 |
%% Add vertical spacing for |multicols| in |enumext| environment. |
| 8583 |
% \fi |
| 8584 |
% \begin{macrocode} |
| 8585 |
\cs_new_protected:Nn \@@_multi_addvspace: |
| 8586 |
{ |
| 8587 |
\@@_multi_set_vskip: |
| 8588 |
\mode_if_vertical:T |
| 8589 |
{ |
| 8590 |
\skip_add:cn { l_@@_multicols_above_ \@@_level: _skip } |
| 8591 |
{ |
| 8592 |
\skip_use:c { l_@@_partopsep_ \@@_level: _skip } |
| 8593 |
} |
| 8594 |
\skip_add:cn { l_@@_multicols_below_ \@@_level: _skip } |
| 8595 |
{ |
| 8596 |
\skip_use:c { l_@@_partopsep_ \@@_level: _skip } |
| 8597 |
} |
| 8598 |
} |
| 8599 |
\par\nopagebreak |
| 8600 |
\addvspace{ \skip_use:c { l_@@_multicols_above_ \@@_level: _skip } } |
| 8601 |
} |
| 8602 |
% \end{macrocode} |
| 8603 |
% \end{macro} |
| 8604 |
% |
| 8605 |
% \subsubsection{Adjustment of vertical spaces for \env{multicols} in \env{keyans}} |
| 8606 |
% |
| 8607 |
% \begin{macro}{\@@_keyans_multi_set_vskip:, \@@_keyans_multi_addvspace:} |
| 8608 |
% The function \cs{@@_keyans_multi_set_vskip:} will take care of determining the |
| 8609 |
% \emph{\enquote{adjusted spaces}} that we will apply \emph{\enquote{above}} and |
| 8610 |
% \emph{\enquote{below}} the \myenv{multicols} environment in |
| 8611 |
% \myenv*{keyans}. The implementation of this function is the same |
| 8612 |
% as the one used in \myenv*{enumext}. |
| 8613 |
% \iffalse |
| 8614 |
%% Adjustment of vertical spacing for |multicols| in |keyans| environments. |
| 8615 |
% \fi |
| 8616 |
% \begin{macrocode} |
| 8617 |
\cs_new_protected:Nn \@@_keyans_multi_set_vskip: |
| 8618 |
{ |
| 8619 |
\skip_set:Nn \l_@@_multicols_above_v_skip |
| 8620 |
{ |
| 8621 |
\l_@@_topsep_v_skip |
| 8622 |
} |
| 8623 |
\skip_set:Nn \l_@@_multicols_below_v_skip |
| 8624 |
{ |
| 8625 |
\l_@@_topsep_v_skip |
| 8626 |
} |
| 8627 |
} |
| 8628 |
\cs_new_protected:Nn \@@_keyans_multi_addvspace: |
| 8629 |
{ |
| 8630 |
\@@_keyans_multi_set_vskip: |
| 8631 |
\mode_if_vertical:T |
| 8632 |
{ |
| 8633 |
\skip_add:Nn \l_@@_multicols_above_v_skip |
| 8634 |
{ |
| 8635 |
\skip_use:N \l_@@_partopsep_v_skip |
| 8636 |
} |
| 8637 |
\skip_add:Nn \l_@@_multicols_below_v_skip |
| 8638 |
{ |
| 8639 |
\skip_use:N \l_@@_partopsep_v_skip |
| 8640 |
} |
| 8641 |
} |
| 8642 |
\par\nopagebreak |
| 8643 |
\addvspace{ \l_@@_multicols_above_v_skip } |
| 8644 |
} |
| 8645 |
% \end{macrocode} |
| 8646 |
% \end{macro} |
| 8647 |
% |
| 8648 |
% \subsection{Adjustment of vertical spaces for \env{minipage}}\label{vspace:minipage} |
| 8649 |
% |
| 8650 |
% When nesting a \emph{\enquote{list environment}} within the \myenv{minipage} environment, |
| 8651 |
% the values of the \emph{\enquote{vertical spaces}} are lost. Graphically it can |
| 8652 |
% be seen like in the figure \ref{fig:seven}. |
| 8653 |
% |
| 8654 |
% \begin{figure}[!htbp] |
| 8655 |
% \centering |
| 8656 |
% \begin{tikzpicture}[line cap=round,line join=round,x=0.8cm,y=0.8cm,every node/.style={font=\footnotesize}] |
| 8657 |
% \draw[color=white] (7.0,6.10) rectangle (12.5,6.5) node[pos=.5,text=black]% |
| 8658 |
% { \textcolor{blue}{\texttt{space above left}} };% space above left |
| 8659 |
% \draw[color=white] (13.5,6.10) rectangle (17.5,6.5) node[pos=.5,text=black]% |
| 8660 |
% { \textcolor{blue}{\texttt{space above right}} };% space above right |
| 8661 |
% \draw[color=white] (7.0,4.85) rectangle (17.5,5.25) node[pos=.5,text=black]% |
| 8662 |
% { \textcolor{blue}{\texttt{space below minipage's}} };% space below after second |
| 8663 |
% \draw[color=white] (2.0,6.10) rectangle (5,6.50) node[pos=.5,text=optcolor,font=\footnotesize\ttfamily] { topsep };% topsep above |
| 8664 |
% \draw[color=white] (2.0,4.85) rectangle (5,5.25) node[pos=.5,text=optcolor,font=\footnotesize\ttfamily] { topsep };% topsep below |
| 8665 |
% \draw[->,color=lightgray,shorten >=3pt] (4.5,6.3) -- (7.0,6.3); % glue space = topsep (above) |
| 8666 |
% \draw[->,color=lightgray,shorten >=3pt] (4.5,5.05) -- (7.0,5.05); % glue space = topsep (above) |
| 8667 |
% \draw[<->,color=gray] (2.0,7.0) --node[above,text=optcolor]{\vphantom{p}\texttt{labelwidth}} (5.0,7.0); |
| 8668 |
% \draw[<->,color=gray] (5.0,7.0) --node[above,text=optcolor]{\texttt{labelsep}} (7.0,7.0); |
| 8669 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (2.0,6.5) rectangle (5.0,6.85);% labelwidth |
| 8670 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (5.0,6.5) rectangle (7.0,6.85);% labelsep |
| 8671 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,6.5) rectangle (17.5,6.85);% item width |
| 8672 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,5.25) rectangle (12.5,6.10) node[pos=.5,text=black]% |
| 8673 |
% {\begin{tabular}{c} |
| 8674 |
% \texttt{minipage left [t]} \\ |
| 8675 |
% \textcolor{blue}{\emph{nested list}} |
| 8676 |
% \end{tabular}}; |
| 8677 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (13.5,5.25) rectangle (17.5,6.10) node[pos=.5,text=black]% |
| 8678 |
% {\begin{tabular}{c} |
| 8679 |
% \texttt{minipage right [t]} \\ |
| 8680 |
% \textcolor{blue}{\emph{drawing or tabular}} |
| 8681 |
% \end{tabular}}; |
| 8682 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (2.0,4.5) rectangle (5.0,4.85);% labelwidth |
| 8683 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (5.0,4.5) rectangle (7.0,4.85);% labelsep |
| 8684 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,4.5) rectangle (17.5,4.85);% item width |
| 8685 |
% \end{tikzpicture} |
| 8686 |
% \caption{Representation of the \myenv{minipage} spacing adjustment for a nested level.} |
| 8687 |
% \label{fig:seven} |
| 8688 |
% \end{figure} |
| 8689 |
% |
| 8690 |
% Since we want to keep the \emph{\enquote{left}} and \emph{\enquote{right}} |
| 8691 |
% environments \emph{\enquote{aligned on top}}, preserving the \ics{baselineskip} |
| 8692 |
% and keep the desired \emph{\enquote{spaces}} (|\topsep + [\partopsep]|) it is necessary |
| 8693 |
% to \emph{\enquote{adjust}} the \emph{\enquote{vertical spaces}} |
| 8694 |
% for \myenv{minipage} environments. |
| 8695 |
% |
| 8696 |
% \smallskip |
| 8697 |
% |
| 8698 |
% Here there are several complications that we must circumvent, the |
| 8699 |
% \myenv{minipage} environment eliminates the \enquote{top} spaces, the \myenv{multicols} |
| 8700 |
% environment can be nested in the \myenv{minipage} environment, the \enquote{top} and |
| 8701 |
% \enquote{bottom} spaces are affected when |topsep=|\mydim{0pt} and to this is added the |
| 8702 |
% |\partopsep| parameter that comes into action according to whether \hologo{TeX} |
| 8703 |
% is in \mymeta{horizontal mode} or \mymeta{vertical mode}. Depending on these cases, small |
| 8704 |
% adjustments must be made using |\vspace| and |\addvspace| to |
| 8705 |
% obtain the \emph{\enquote{desired vertical spacing}}. |
| 8706 |
% |
| 8707 |
% \smallskip |
| 8708 |
% |
| 8709 |
% \begin{important}* |
| 8710 |
% Again I must make clear that the implementation here is a \emph{\enquote{bit |
| 8711 |
% questionable}}, but hunting the spaces (|glue|) produced by the \myenv{minipage} |
| 8712 |
% environment is quite complicated, even more if \myenv{multicols} it is nested. |
| 8713 |
% The setting of the values was more \emph{\enquote{trial and error}} |
| 8714 |
% (approx to |\strutbox|), using the help of the \mypkg{lua-visual-debug}\cite{luavisual} |
| 8715 |
% package, again my attempts to find the correct values using |\showoutput| and |
| 8716 |
% |\showboxdepth| absolutely failed. |
| 8717 |
% \end{important} |
| 8718 |
% |
| 8719 |
% \subsubsection{Adjustment of vertical spaces for \env{minipage} in \env{enumext}} |
| 8720 |
% |
| 8721 |
% \begin{macro}{\@@_minipage_set_skip:, \@@_minipage_add_space:} |
| 8722 |
% The function \cs{@@_minipage_set_skip:} will take care of determining the |
| 8723 |
% \emph{\enquote{adjust}} spaces that we will apply \emph{\enquote{above}} and |
| 8724 |
% \emph{\enquote{below}} the \myvarenv*{__@@_mini_page} environment in |
| 8725 |
% \myenv*{enumext}. |
| 8726 |
% |
| 8727 |
% \smallskip |
| 8728 |
% |
| 8729 |
% First we will set the value of \cs{l_@@_minipage_right_skip} equal to |
| 8730 |
% |\topsep|, then we will see if \hologo{TeX} is in \mymeta{vertical mode} and we |
| 8731 |
% will add |\partopsep|, followed by that we set the value of \cs{l_@@_minipage_after_skip}. |
| 8732 |
% \iffalse |
| 8733 |
%% Adjustment of vertical spacing for |minipage| in |enumext| environment. |
| 8734 |
% \fi |
| 8735 |
% \begin{macrocode} |
| 8736 |
\cs_new_protected:Nn \@@_minipage_set_skip: |
| 8737 |
{ |
| 8738 |
\skip_set:Nn \l_@@_minipage_right_skip |
| 8739 |
{ |
| 8740 |
\skip_use:c { l_@@_topsep_ \@@_level: _skip } |
| 8741 |
} |
| 8742 |
\mode_if_vertical:T |
| 8743 |
{ |
| 8744 |
\skip_add:Nn \l_@@_minipage_right_skip |
| 8745 |
{ |
| 8746 |
\skip_use:c { l_@@_partopsep_ \@@_level: _skip } |
| 8747 |
} |
| 8748 |
} |
| 8749 |
\skip_set_eq:NN \l_@@_minipage_after_skip \l_@@_minipage_right_skip |
| 8750 |
% \end{macrocode} |
| 8751 |
% We will adjust the values \cs[no-index]{l_@@_multicols_above_X_skip} |
| 8752 |
% and \cs[no-index]{l_@@_multicols_below_X_skip} and call the function |
| 8753 |
% \cs{@@_pre_itemsep_skip:}. |
| 8754 |
% \begin{macrocode} |
| 8755 |
\skip_set_eq:cN |
| 8756 |
{ l_@@_multicols_above_ \@@_level: _skip } \l_@@_minipage_right_skip |
| 8757 |
\skip_set_eq:cN |
| 8758 |
{ l_@@_multicols_below_ \@@_level: _skip } \l_@@_minipage_right_skip |
| 8759 |
\@@_pre_itemsep_skip: |
| 8760 |
% \end{macrocode} |
| 8761 |
% If the environment \myenv{multicols} is active, we set |\topskip=|\mydim{0pt} |
| 8762 |
% and then we make |\multicolsep| have the same value as \cs[no-index]{l_@@_multicols_above_X_skip}. |
| 8763 |
% \begin{macrocode} |
| 8764 |
\int_compare:nNnT |
| 8765 |
{ \int_use:c { l_@@_columns_ \@@_level: _int } } > { 1 } |
| 8766 |
{ |
| 8767 |
\skip_zero:N \topskip |
| 8768 |
\skip_set_eq:Nc \multicolsep { l_@@_multicols_above_ \@@_level: _skip } |
| 8769 |
} |
| 8770 |
} |
| 8771 |
% \end{macrocode} |
| 8772 |
% The function \cs{@@_minipage_add_space:} will apply the spaces on the \emph{\enquote{left side}} using |
| 8773 |
% |\addvspace| \emph{\enquote{above}} the \myvarenv*{__@@_mini_page} |
| 8774 |
% environment, taking into account whether \hologo{TeX} is in |
| 8775 |
% \mymeta{horizontal mode} or \mymeta{vertical mode}. Here we use the plain \hologo{TeX} macro |
| 8776 |
% |\nointerlineskip| to prevent baseline \emph{\enquote{glue}} being |
| 8777 |
% added between the next pair of boxes in a \emph{vertical list}. For the latter we |
| 8778 |
% will make some adjustments since the |\partopsep| parameter comes into |
| 8779 |
% play and this affects the \emph{vertical spacing}. |
| 8780 |
% \begin{macrocode} |
| 8781 |
\cs_new_protected:Nn \@@_minipage_add_space: |
| 8782 |
{ |
| 8783 |
\@@_minipage_set_skip: |
| 8784 |
\@@_unskip_unkern: |
| 8785 |
\mode_if_vertical:TF |
| 8786 |
{ |
| 8787 |
\nopagebreak\nointerlineskip |
| 8788 |
} |
| 8789 |
{ |
| 8790 |
\par\nopagebreak\nointerlineskip |
| 8791 |
\skip_zero:c { l_@@_partopsep_ \@@_level: _skip } |
| 8792 |
} |
| 8793 |
\int_compare:nNnTF |
| 8794 |
{ \int_use:c { l_@@_columns_ \@@_level: _int } } > { 1 } |
| 8795 |
{ |
| 8796 |
\addvspace{ 0.445\box_ht:N \strutbox } |
| 8797 |
} |
| 8798 |
{ |
| 8799 |
\addvspace{ 0.250\box_ht:N \strutbox } |
| 8800 |
} |
| 8801 |
} |
| 8802 |
% \end{macrocode} |
| 8803 |
% \end{macro} |
| 8804 |
% |
| 8805 |
% \begin{macro}{\@@_pre_itemsep_skip:} |
| 8806 |
% The function \cs{@@_pre_itemsep_skip:} will adjust the spaces below the |
| 8807 |
% environment \myenv{minipage} and the environment \myenv{multicols} if |
| 8808 |
% it is nested in it, taking into account the value of |\itemsep| from |
| 8809 |
% the previous level. |
| 8810 |
% \begin{macrocode} |
| 8811 |
\cs_new_protected:Nn \@@_pre_itemsep_skip: |
| 8812 |
{ |
| 8813 |
\int_case:nn { \l_@@_level_int } |
| 8814 |
{ |
| 8815 |
{ 2 }{ |
| 8816 |
\skip_if_eq:nnTF |
| 8817 |
{ \l_@@_itemsep_i_skip } { \l_@@_minipage_after_skip } |
| 8818 |
{ |
| 8819 |
\skip_set:Nn \l_@@_minipage_after_skip { 0.150\box_ht:N \strutbox } |
| 8820 |
\skip_set:Nn \l_@@_multicols_below_ii_skip { 0.350\box_ht:N \strutbox } |
| 8821 |
} |
| 8822 |
{ |
| 8823 |
\dim_compare:nNnT |
| 8824 |
{ \l_@@_itemsep_i_skip } < { \l_@@_minipage_after_skip } |
| 8825 |
{ |
| 8826 |
\skip_sub:Nn |
| 8827 |
\l_@@_minipage_after_skip { \l_@@_itemsep_i_skip } |
| 8828 |
\skip_sub:Nn |
| 8829 |
\l_@@_multicols_below_ii_skip { \l_@@_itemsep_i_skip } |
| 8830 |
\skip_add:Nn |
| 8831 |
\l_@@_minipage_after_skip { 0.150\box_ht:N \strutbox } |
| 8832 |
\skip_add:Nn |
| 8833 |
\l_@@_multicols_below_ii_skip { 0.350\box_ht:N \strutbox } |
| 8834 |
} |
| 8835 |
\dim_compare:nNnT |
| 8836 |
{ \l_@@_itemsep_i_skip } > { \l_@@_minipage_after_skip } |
| 8837 |
{ |
| 8838 |
\skip_set:Nn \l_@@_minipage_temp_skip |
| 8839 |
{ |
| 8840 |
\l_@@_itemsep_i_skip - \l_@@_minipage_after_skip |
| 8841 |
} |
| 8842 |
\skip_sub:Nn |
| 8843 |
\l_@@_minipage_after_skip { \l_@@_itemsep_i_skip } |
| 8844 |
\skip_sub:Nn |
| 8845 |
\l_@@_multicols_below_ii_skip { \l_@@_itemsep_i_skip } |
| 8846 |
\skip_add:Nn |
| 8847 |
\l_@@_minipage_after_skip |
| 8848 |
{ 0.150\box_ht:N \strutbox + \l_@@_minipage_temp_skip } |
| 8849 |
\skip_add:Nn |
| 8850 |
\l_@@_multicols_below_ii_skip |
| 8851 |
{ 0.350\box_ht:N \strutbox + \l_@@_minipage_temp_skip } |
| 8852 |
} |
| 8853 |
} |
| 8854 |
} |
| 8855 |
{ 3 }{ |
| 8856 |
\skip_if_eq:nnTF |
| 8857 |
{ \l_@@_itemsep_ii_skip } { \c_zero_skip } |
| 8858 |
{ |
| 8859 |
\skip_set:Nn \l_@@_minipage_after_skip { 0.150\box_ht:N \strutbox } |
| 8860 |
\skip_set:Nn \l_@@_multicols_below_iii_skip { 0.350\box_ht:N \strutbox } |
| 8861 |
} |
| 8862 |
{ |
| 8863 |
\dim_compare:nNnT |
| 8864 |
{ \l_@@_itemsep_ii_skip } < { \l_@@_minipage_after_skip } |
| 8865 |
{ |
| 8866 |
\skip_sub:Nn |
| 8867 |
\l_@@_minipage_after_skip { \l_@@_itemsep_ii_skip } |
| 8868 |
\skip_sub:Nn |
| 8869 |
\l_@@_multicols_below_iii_skip { \l_@@_itemsep_ii_skip } |
| 8870 |
\skip_add:Nn |
| 8871 |
\l_@@_minipage_after_skip { 0.150\box_ht:N \strutbox } |
| 8872 |
\skip_add:Nn |
| 8873 |
\l_@@_multicols_below_iii_skip { 0.350\box_ht:N \strutbox } |
| 8874 |
} |
| 8875 |
\dim_compare:nNnT |
| 8876 |
{ \l_@@_itemsep_ii_skip } > { \l_@@_minipage_after_skip } |
| 8877 |
{ |
| 8878 |
\skip_set:Nn \l_@@_minipage_temp_skip |
| 8879 |
{ |
| 8880 |
\l_@@_itemsep_ii_skip - \l_@@_minipage_after_skip |
| 8881 |
} |
| 8882 |
\skip_sub:Nn |
| 8883 |
\l_@@_minipage_after_skip { \l_@@_itemsep_ii_skip } |
| 8884 |
\skip_sub:Nn |
| 8885 |
\l_@@_multicols_below_iii_skip { \l_@@_itemsep_ii_skip } |
| 8886 |
\skip_add:Nn |
| 8887 |
\l_@@_minipage_after_skip |
| 8888 |
{ 0.150\box_ht:N \strutbox + \l_@@_minipage_temp_skip } |
| 8889 |
\skip_add:Nn |
| 8890 |
\l_@@_multicols_below_iii_skip |
| 8891 |
{ 0.350\box_ht:N \strutbox + \l_@@_minipage_temp_skip } |
| 8892 |
} |
| 8893 |
} |
| 8894 |
} |
| 8895 |
{ 4 }{ |
| 8896 |
\skip_if_eq:nnTF { \l_@@_itemsep_iii_skip } { \c_zero_skip } |
| 8897 |
{ |
| 8898 |
\skip_set:Nn \l_@@_minipage_after_skip { 0.150\box_ht:N \strutbox } |
| 8899 |
\skip_set:Nn \l_@@_multicols_below_iv_skip { 0.350\box_ht:N \strutbox } |
| 8900 |
} |
| 8901 |
{ |
| 8902 |
\dim_compare:nNnT |
| 8903 |
{ \l_@@_itemsep_iii_skip } < { \l_@@_minipage_after_skip } |
| 8904 |
{ |
| 8905 |
\skip_sub:Nn |
| 8906 |
\l_@@_minipage_after_skip { \l_@@_itemsep_iii_skip } |
| 8907 |
\skip_sub:Nn |
| 8908 |
\l_@@_multicols_below_iv_skip { \l_@@_itemsep_iii_skip } |
| 8909 |
\skip_add:Nn |
| 8910 |
\l_@@_minipage_after_skip { 0.150\box_ht:N \strutbox } |
| 8911 |
\skip_add:Nn |
| 8912 |
\l_@@_multicols_below_iv_skip { 0.350\box_ht:N \strutbox } |
| 8913 |
} |
| 8914 |
\dim_compare:nNnT |
| 8915 |
{ \l_@@_itemsep_iii_skip } > { \l_@@_minipage_after_skip } |
| 8916 |
{ |
| 8917 |
\skip_set:Nn \l_@@_minipage_temp_skip |
| 8918 |
{ |
| 8919 |
\l_@@_itemsep_iii_skip - \l_@@_minipage_after_skip |
| 8920 |
} |
| 8921 |
\skip_sub:Nn |
| 8922 |
\l_@@_minipage_after_skip { \l_@@_itemsep_iii_skip } |
| 8923 |
\skip_sub:Nn |
| 8924 |
\l_@@_multicols_below_iv_skip { \l_@@_itemsep_iii_skip } |
| 8925 |
\skip_add:Nn |
| 8926 |
\l_@@_minipage_after_skip |
| 8927 |
{ 0.150\box_ht:N \strutbox + \l_@@_minipage_temp_skip } |
| 8928 |
\skip_add:Nn |
| 8929 |
\l_@@_multicols_below_iv_skip |
| 8930 |
{ 0.350\box_ht:N \strutbox + \l_@@_minipage_temp_skip } |
| 8931 |
} |
| 8932 |
} |
| 8933 |
} |
| 8934 |
} |
| 8935 |
} |
| 8936 |
% \end{macrocode} |
| 8937 |
% \end{macro} |
| 8938 |
% |
| 8939 |
% \subsubsection{Adjustment of vertical spaces for \env{minipage} in \env{keyans}} |
| 8940 |
% |
| 8941 |
% \begin{macro}{\@@_keyans_minipage_set_skip:, \@@_keyans_minipage_add_space:, \@@_keyans_pre_itemsep_skip:} |
| 8942 |
% The function \cs{@@_keyans_mini_set_vskip:} will take care of determining the |
| 8943 |
% \enquote{adjusted} spaces that we will apply \emph{\enquote{above}} and |
| 8944 |
% \emph{\enquote{below}} the \myvarenv*{__@@_mini_page} environment in |
| 8945 |
% \myenv*{keyans}. The implementation of this function is the same |
| 8946 |
% as the one used in \myenv*{enumext}. |
| 8947 |
% \iffalse |
| 8948 |
%% Adjustment of vertical spacing for |minipage| in |keyans| environments. |
| 8949 |
% \fi |
| 8950 |
% \begin{macrocode} |
| 8951 |
\cs_new_protected:Nn \@@_keyans_minipage_set_skip: |
| 8952 |
{ |
| 8953 |
\skip_zero:N \l_@@_minipage_after_skip |
| 8954 |
\skip_zero:N \l_@@_minipage_left_skip |
| 8955 |
\skip_zero:N \l_@@_minipage_right_skip |
| 8956 |
\skip_set:Nn \l_@@_minipage_right_skip |
| 8957 |
{ |
| 8958 |
\l_@@_topsep_v_skip |
| 8959 |
} |
| 8960 |
\mode_if_vertical:T |
| 8961 |
{ |
| 8962 |
\skip_add:Nn \l_@@_minipage_right_skip |
| 8963 |
{ |
| 8964 |
\l_@@_partopsep_v_skip |
| 8965 |
} |
| 8966 |
} |
| 8967 |
\skip_set_eq:NN \l_@@_minipage_after_skip \l_@@_minipage_right_skip |
| 8968 |
\skip_set_eq:NN \l_@@_multicols_above_v_skip \l_@@_minipage_right_skip |
| 8969 |
\skip_set_eq:NN \l_@@_multicols_below_v_skip \l_@@_minipage_right_skip |
| 8970 |
\@@_keyans_pre_itemsep_skip: |
| 8971 |
\int_compare:nNnT { \l_@@_columns_v_int } > { 1 } |
| 8972 |
{ |
| 8973 |
\skip_zero:N \topskip |
| 8974 |
\skip_set_eq:NN \multicolsep \l_@@_minipage_right_skip |
| 8975 |
} |
| 8976 |
} |
| 8977 |
\cs_new_protected:Nn \@@_keyans_minipage_add_space: |
| 8978 |
{ |
| 8979 |
\@@_keyans_minipage_set_skip: |
| 8980 |
\@@_unskip_unkern: |
| 8981 |
\mode_if_vertical:TF |
| 8982 |
{ |
| 8983 |
\nopagebreak\nointerlineskip |
| 8984 |
} |
| 8985 |
{ |
| 8986 |
\par\nopagebreak\nointerlineskip |
| 8987 |
\skip_zero:N \l_@@_partopsep_v_skip |
| 8988 |
} |
| 8989 |
\int_compare:nNnTF { \l_@@_columns_v_int } > { 1 } |
| 8990 |
{ |
| 8991 |
\addvspace{ 0.445\box_ht:N \strutbox } |
| 8992 |
} |
| 8993 |
{ |
| 8994 |
\addvspace{ 0.250\box_ht:N \strutbox } |
| 8995 |
} |
| 8996 |
} |
| 8997 |
\cs_new_protected:Nn \@@_keyans_pre_itemsep_skip: |
| 8998 |
{ |
| 8999 |
\skip_if_eq:nnTF |
| 9000 |
{ \l_@@_itemsep_i_skip } { \l_@@_minipage_after_skip } |
| 9001 |
{ |
| 9002 |
\skip_set:Nn \l_@@_minipage_after_skip { 0.150\box_ht:N \strutbox } |
| 9003 |
\skip_set:Nn \l_@@_multicols_below_v_skip { 0.350\box_ht:N \strutbox } |
| 9004 |
} |
| 9005 |
{ |
| 9006 |
\dim_compare:nNnT |
| 9007 |
{ \l_@@_itemsep_i_skip } < { \l_@@_minipage_after_skip } |
| 9008 |
{ |
| 9009 |
\skip_sub:Nn \l_@@_minipage_after_skip { \l_@@_itemsep_i_skip } |
| 9010 |
\skip_sub:Nn \l_@@_multicols_below_v_skip { \l_@@_itemsep_i_skip } |
| 9011 |
\skip_add:Nn \l_@@_minipage_after_skip { 0.150\box_ht:N \strutbox } |
| 9012 |
\skip_add:Nn \l_@@_multicols_below_v_skip { 0.350\box_ht:N \strutbox } |
| 9013 |
} |
| 9014 |
\dim_compare:nNnT |
| 9015 |
{ \l_@@_itemsep_i_skip } > { \l_@@_minipage_after_skip } |
| 9016 |
{ |
| 9017 |
\skip_set:Nn \l_@@_minipage_temp_skip |
| 9018 |
{ |
| 9019 |
\l_@@_itemsep_i_skip - \l_@@_minipage_after_skip |
| 9020 |
} |
| 9021 |
\skip_sub:Nn \l_@@_minipage_after_skip { \l_@@_itemsep_i_skip } |
| 9022 |
\skip_sub:Nn \l_@@_multicols_below_v_skip { \l_@@_itemsep_i_skip } |
| 9023 |
\skip_add:Nn \l_@@_minipage_after_skip |
| 9024 |
{ 0.150\box_ht:N \strutbox + \l_@@_minipage_temp_skip } |
| 9025 |
\skip_add:Nn \l_@@_multicols_below_v_skip |
| 9026 |
{ 0.350\box_ht:N \strutbox + \l_@@_minipage_temp_skip } |
| 9027 |
} |
| 9028 |
} |
| 9029 |
} |
| 9030 |
% \end{macrocode} |
| 9031 |
% \end{macro} |
| 9032 |
% |
| 9033 |
% \subsubsection{Adjustment of vertical spaces for \env{minipage} in \env{enumext*} and \env{keyans*}} |
| 9034 |
% |
| 9035 |
% \begin{macro}{\@@_mini_set_vskip_vii:,\@@_mini_set_vskip_viii:} |
| 9036 |
% The functions \cs{@@_mini_set_vskip_vii:} and \cs{@@_mini_set_vskip_viii:} will take care of determining the |
| 9037 |
% \enquote{adjusted} spaces that we will apply \emph{\enquote{above}} and |
| 9038 |
% \emph{\enquote{below}} the \myvarenv*{__@@_mini_page} environment in |
| 9039 |
% \myenv*{enumext*} and \myenv*{keyans*}. |
| 9040 |
% \iffalse |
| 9041 |
%% Adjustment of vertical spacing for |minipage| in |enumext*| and |keyans*|. |
| 9042 |
% \fi |
| 9043 |
% \begin{macrocode} |
| 9044 |
\cs_new_protected:Nn \@@_mini_set_vskip_vii: |
| 9045 |
{ |
| 9046 |
\skip_zero_new:N \l_@@_minipage_left_skip |
| 9047 |
\skip_gzero_new:N \g_@@_minipage_right_skip |
| 9048 |
\skip_gzero_new:N \g_@@_minipage_after_skip |
| 9049 |
\skip_if_eq:nnTF { \l_@@_topsep_vii_skip } { \c_zero_skip } |
| 9050 |
{ |
| 9051 |
\skip_set:Nn \l_@@_minipage_left_skip { 0.5\box_dp:N \strutbox } |
| 9052 |
\skip_gset:Nn \g_@@_minipage_right_skip { 0.325\box_dp:N \strutbox } |
| 9053 |
} |
| 9054 |
{ |
| 9055 |
\skip_set:Nn \l_@@_minipage_left_skip { 0.5875\box_dp:N \strutbox } |
| 9056 |
\skip_gset:Nn \g_@@_minipage_right_skip |
| 9057 |
{ |
| 9058 |
\l_@@_topsep_vii_skip |
| 9059 |
} |
| 9060 |
\skip_gset:Nn \g_@@_minipage_after_skip |
| 9061 |
{ |
| 9062 |
0.325\box_dp:N \strutbox + \l_@@_topsep_vii_skip |
| 9063 |
} |
| 9064 |
} |
| 9065 |
} |
| 9066 |
\cs_new_protected:Nn \@@_mini_set_vskip_viii: |
| 9067 |
{ |
| 9068 |
\skip_zero_new:N \l_@@_minipage_after_skip |
| 9069 |
\skip_zero_new:N \l_@@_minipage_left_skip |
| 9070 |
\skip_zero_new:N \l_@@_minipage_right_skip |
| 9071 |
\skip_if_eq:nnTF { \l_@@_topsep_viii_skip } { \c_zero_skip } |
| 9072 |
{ |
| 9073 |
\skip_set:Nn \l_@@_minipage_left_skip |
| 9074 |
{ |
| 9075 |
0.5\box_dp:N \strutbox |
| 9076 |
} |
| 9077 |
\skip_set:Nn \l_@@_minipage_right_skip |
| 9078 |
{ |
| 9079 |
\l_@@_partopsep_viii_skip |
| 9080 |
} |
| 9081 |
\skip_set:Nn \l_@@_minipage_after_skip |
| 9082 |
{ |
| 9083 |
1.6\box_dp:N \strutbox |
| 9084 |
} |
| 9085 |
} |
| 9086 |
{ |
| 9087 |
\skip_set:Nn \l_@@_minipage_left_skip |
| 9088 |
{ |
| 9089 |
0.5875\box_dp:N \strutbox |
| 9090 |
} |
| 9091 |
\skip_set:Nn \l_@@_minipage_right_skip |
| 9092 |
{ |
| 9093 |
\l_@@_topsep_viii_skip |
| 9094 |
} |
| 9095 |
\skip_set:Nn \l_@@_minipage_after_skip |
| 9096 |
{ |
| 9097 |
0.325\box_dp:N \strutbox + \l_@@_topsep_viii_skip |
| 9098 |
} |
| 9099 |
} |
| 9100 |
} |
| 9101 |
% \end{macrocode} |
| 9102 |
% \end{macro} |
| 9103 |
% |
| 9104 |
% \begin{macro}{\@@_mini_addvspace_vii:,\@@_mini_addvspace_viii:} |
| 9105 |
% The functions \cs{@@_mini_addvspace_vii:} and |
| 9106 |
% \cs{@@_mini_addvspace_viii:} will apply the vertical space |
| 9107 |
% \emph{\enquote{only above}} the \myvarenv*{__@@_mini_page} environment on |
| 9108 |
% the \emph{left side} when the \mykey{mini-right} key is active in the |
| 9109 |
% \myenv*{enumext*} and \myenv*{keyans*} environments. |
| 9110 |
% |
| 9111 |
% Here we will NOT take into account whether \hologo{TeX} is in |
| 9112 |
% \mymeta{horizontal mode} or \mymeta{vertical mode}, since |\partopsep| |
| 9113 |
% is equal to \mydim{0pt} in both environments. |
| 9114 |
% \iffalse |
| 9115 |
%% Apply \addvspace above minipage for |enumext*| and |keyans*| environments. |
| 9116 |
% \fi |
| 9117 |
% \begin{macrocode} |
| 9118 |
\cs_new_protected:Nn \@@_mini_addvspace_vii: |
| 9119 |
{ |
| 9120 |
\@@_mini_set_vskip_vii: |
| 9121 |
\par\nopagebreak |
| 9122 |
\addvspace { \l_@@_minipage_left_skip } |
| 9123 |
} |
| 9124 |
\cs_new_protected:Nn \@@_mini_addvspace_viii: |
| 9125 |
{ |
| 9126 |
\@@_mini_set_vskip_viii: |
| 9127 |
\par\nopagebreak |
| 9128 |
\addvspace { \l_@@_minipage_left_skip } |
| 9129 |
} |
| 9130 |
% \end{macrocode} |
| 9131 |
% \end{macro} |
| 9132 |
% |
| 9133 |
% \subsubsection{The command \cs{miniright}}\label{cmd:miniright} |
| 9134 |
% |
| 9135 |
% The command \ics*{miniright} will close the \myvarenv*{__@@_mini_page} |
| 9136 |
% environment on the \emph{\enquote{left side}}, open the \myvarenv*{__@@_mini_page} |
| 9137 |
% environment on the \emph{\enquote{right side}} adding the \emph{adjusted vertical space}. |
| 9138 |
% By default we will add |\centering| when starting the \emph{\enquote{right side}} |
| 9139 |
% environment. The \emph{starred argument} ‘|*|’ inhibits the use of |\centering| |
| 9140 |
% command i.e. the usual \hologo{LaTeX} justification is maintained in |
| 9141 |
% the \myvarenv*{__@@_mini_page} on the \emph{\enquote{right side}}. |
| 9142 |
% |
| 9143 |
% \begin{macro}{\miniright} |
| 9144 |
% First we will perform some checks to prevent the command from being |
| 9145 |
% executed outside the \myenv*{enumext} environment or somewhere |
| 9146 |
% inappropriate then we will call the internal functions to execute it in |
| 9147 |
% the \myenv*{enumext} and \myenv*{keyans} environments. |
| 9148 |
% \iffalse |
| 9149 |
%% Definition of |\miniright| command. |
| 9150 |
% \fi |
| 9151 |
% \begin{macrocode} |
| 9152 |
\NewDocumentCommand \miniright { s } |
| 9153 |
{ |
| 9154 |
\int_compare:nNnT { \l_@@_keyans_pic_level_int } = { 1 } |
| 9155 |
{ |
| 9156 |
\msg_error:nnn { enumext } { wrong-miniright-place } |
| 9157 |
} |
| 9158 |
% outside |
| 9159 |
\bool_lazy_and:nnT |
| 9160 |
{ \int_compare_p:nNn { \l_@@_level_int } = { 0 } } |
| 9161 |
{ \int_compare_p:nNn { \l_@@_level_h_int } = { 0 } } |
| 9162 |
{ |
| 9163 |
\msg_error:nnn { enumext } { wrong-miniright-place } |
| 9164 |
} |
| 9165 |
% starred env |
| 9166 |
\bool_lazy_and:nnT |
| 9167 |
{ \bool_if_p:N \g_@@_starred_bool } |
| 9168 |
{ \bool_not_p:n { \l_@@_standar_bool } } |
| 9169 |
{ |
| 9170 |
\msg_error:nnn { enumext } { wrong-miniright-starred } |
| 9171 |
} |
| 9172 |
% exec |
| 9173 |
\int_compare:nNnTF { \l_@@_keyans_level_int } = { 1 } |
| 9174 |
{ |
| 9175 |
\@@_keyans_mini_right_cmd:n {#1} |
| 9176 |
} |
| 9177 |
{ \@@_mini_right_cmd:n {#1} } |
| 9178 |
} |
| 9179 |
% \end{macrocode} |
| 9180 |
% \end{macro} |
| 9181 |
% |
| 9182 |
% \begin{macro}{\@@_mini_right_cmd:n} |
| 9183 |
% The function \cs{@@_mini_right_cmd:n} takes as argument the \emph{starred} ‘|*|’ |
| 9184 |
% of the \ics*{miniright} command in the \myenv*{enumext} environment. |
| 9185 |
% We check if the \mykey{mini-env} key is active via the variable |
| 9186 |
% \myvarenv{l__@@_minipage_right_X_dim}, if so we close the |
| 9187 |
% \myenv{multicols} environment with the \myvarenv*{__@@_mini_page} |
| 9188 |
% environment on the \emph{\enquote{left side}}, then we open the |
| 9189 |
% \myvarenv*{__@@_mini_page} environment on the \emph{\enquote{right |
| 9190 |
% side}}, apply our adjusted \emph{\enquote{vertical spaces}}, followed by |
| 9191 |
% adding the |\centering| command when the \emph{starred argument} ‘|*|’ is not |
| 9192 |
% present and set zero \myvarenv{g__@@_minipage_stat_int}, otherwise we return an error. |
| 9193 |
% \iffalse |
| 9194 |
%% Internal function for |\miniright| command in enumext. |
| 9195 |
% \fi |
| 9196 |
% \begin{macrocode} |
| 9197 |
\cs_new_protected:Npn \@@_mini_right_cmd:n #1 |
| 9198 |
{ |
| 9199 |
\dim_compare:nNnTF |
| 9200 |
{ \dim_use:c { l_@@_minipage_right_ \@@_level: _dim } } > { \c_zero_dim } |
| 9201 |
{ |
| 9202 |
\@@_multicols_stop: |
| 9203 |
\int_compare:nNnT |
| 9204 |
{ \int_use:c { l_@@_columns_ \@@_level: _int } } = { 1 } |
| 9205 |
{ |
| 9206 |
\par\addvspace{ \l_@@_minipage_after_skip } |
| 9207 |
} |
| 9208 |
\end@@_mini_page |
| 9209 |
\hfill |
| 9210 |
\@@_mini_page{ \dim_use:c { l_@@_minipage_right_ \@@_level: _dim } } |
| 9211 |
\par\nointerlineskip |
| 9212 |
\addvspace { \l_@@_minipage_right_skip } |
| 9213 |
\bool_if:nF {#1} |
| 9214 |
{ |
| 9215 |
\centering |
| 9216 |
} |
| 9217 |
\int_gzero:N \g_@@_minipage_stat_int |
| 9218 |
} |
| 9219 |
{ \msg_error:nnn { enumext } { wrong-miniright-use } } |
| 9220 |
% paranoia |
| 9221 |
\RenewDocumentCommand \miniright { s } |
| 9222 |
{ |
| 9223 |
\msg_error:nn { enumext } { many-miniright-used } |
| 9224 |
} |
| 9225 |
} |
| 9226 |
% \end{macrocode} |
| 9227 |
% \end{macro} |
| 9228 |
% |
| 9229 |
% \begin{macro}{\@@_keyans_mini_right_cmd:n} |
| 9230 |
% The function \cs{@@_keyans_mini_right_cmd:n} takes as argument the \emph{starred} ‘|*|’ |
| 9231 |
% of the \ics*{miniright} command in the \myenv*{keyans} |
| 9232 |
% environment. The implementation of this function is the same as that of |
| 9233 |
% the \cs{@@_mini_right_cmd:n} function of the \myenv*{enumext} |
| 9234 |
% environment. |
| 9235 |
% \iffalse |
| 9236 |
%% Internal function for |\miniright| command in keyans. |
| 9237 |
% \fi |
| 9238 |
% \begin{macrocode} |
| 9239 |
\cs_new_protected:Npn \@@_keyans_mini_right_cmd:n #1 |
| 9240 |
{ |
| 9241 |
\dim_compare:nNnTF { \l_@@_minipage_right_v_dim } > { \c_zero_dim } |
| 9242 |
{ |
| 9243 |
\@@_keyans_multicols_stop: |
| 9244 |
\int_compare:nNnT { \l_@@_columns_v_int } = { 1 } |
| 9245 |
{ |
| 9246 |
\par\addvspace{ \l_@@_minipage_after_skip } |
| 9247 |
} |
| 9248 |
\end@@_mini_page |
| 9249 |
\hfill |
| 9250 |
\@@_mini_page{ \l_@@_minipage_right_v_dim } |
| 9251 |
\par\nointerlineskip |
| 9252 |
\addvspace { \l_@@_minipage_right_skip } |
| 9253 |
\bool_if:nF {#1} |
| 9254 |
{ |
| 9255 |
\centering |
| 9256 |
} |
| 9257 |
\int_gzero:N \g_@@_minipage_stat_int |
| 9258 |
} |
| 9259 |
{ \msg_error:nnn { enumext } { wrong-miniright-use } } |
| 9260 |
% paranoia |
| 9261 |
\RenewDocumentCommand \miniright { s } |
| 9262 |
{ |
| 9263 |
\msg_error:nn { enumext } { many-miniright-used } |
| 9264 |
} |
| 9265 |
} |
| 9266 |
% \end{macrocode} |
| 9267 |
% \end{macro} |
| 9268 |
% |
| 9269 |
% \subsection{Setting \texttt{above} and \texttt{below} keys} |
| 9270 |
% |
| 9271 |
% While having controlled the \emph{vertical spaces} within |
| 9272 |
% the \myenv*{enumext} and \myenv*{keyans} environments when using the |
| 9273 |
% \mykey{columns} or \mykey{mini-env} keys, sometimes the |
| 9274 |
% \emph{\enquote{vertical spaces above}} or \emph{\enquote{vertical spaces below}} the environments are |
| 9275 |
% not as expected and it is necessary to be able to apply a |
| 9276 |
% \emph{\enquote{fine correction}} to these. As I have not been able to |
| 9277 |
% correct these \emph{glitches}, the best option is to leave a couple of |
| 9278 |
% \mymeta{keys} dedicated to this purpose, in this case it is best to use |
| 9279 |
% |\vspace| or |\vspace*| when convenient. |
| 9280 |
% |
| 9281 |
% \begin{macro}[int]{above, above*, below, below*} |
| 9282 |
% Define \mykey{above}, \mykey{above*}, \mykey{below} and \mykey{below*} keys for |
| 9283 |
% \myenv*{enumext} and \myenv*{keyans} environments. |
| 9284 |
% \iffalse |
| 9285 |
%% Add |above| and |below| keys. |
| 9286 |
% \fi |
| 9287 |
% \begin{macrocode} |
| 9288 |
\cs_set_protected:Npn \@@_tmp:nn #1 #2 |
| 9289 |
{ |
| 9290 |
\keys_define:nn { enumext / #1 } |
| 9291 |
{ |
| 9292 |
above .skip_set:c = { l_@@_vspace_above_#2_skip }, |
| 9293 |
above .value_required:n = true, |
| 9294 |
above* .code:n = \bool_set_true:c { l_@@_vspace_a_star_#2_bool } |
| 9295 |
\keys_set:nn { enumext / #1 } { above = {##1} }, |
| 9296 |
above* .value_required:n = true, |
| 9297 |
below .skip_set:c = { l_@@_vspace_below_#2_skip }, |
| 9298 |
below .value_required:n = true, |
| 9299 |
below* .code:n = \bool_set_true:c { l_@@_vspace_b_star_#2_bool } |
| 9300 |
\keys_set:nn { enumext / #1 } { below = {##1} }, |
| 9301 |
below* .value_required:n = true, |
| 9302 |
} |
| 9303 |
} |
| 9304 |
\clist_map_inline:Nn \c_@@_all_envs_clist { \@@_tmp:nn #1 } |
| 9305 |
% \end{macrocode} |
| 9306 |
% \end{macro} |
| 9307 |
% |
| 9308 |
% \subsubsection{Functions for \texttt{above} and \texttt{below} keys in \env{enumext}} |
| 9309 |
% |
| 9310 |
% \iffalse |
| 9311 |
%% Function for |above|, |above*|, |below| and |below*| keys in |enumext|. |
| 9312 |
% \fi |
| 9313 |
% \begin{macro}{\@@_vspace_above:,} |
| 9314 |
% The function \cs{@@_vspace_above:} apply the \emph{vertical space above} |
| 9315 |
% the \myenv*{enumext} environment set by the \mykey{above*} and \mykey{above} keys. |
| 9316 |
% \begin{macrocode} |
| 9317 |
\cs_new_protected:Nn \@@_vspace_above: |
| 9318 |
{ |
| 9319 |
\skip_if_eq:nnF |
| 9320 |
{ \skip_use:c { l_@@_vspace_above_ \@@_level: _skip } } { \c_zero_skip } |
| 9321 |
{ |
| 9322 |
\bool_if:cTF { l_@@_vspace_a_star_ \@@_level: _bool } |
| 9323 |
{ |
| 9324 |
\vspace*{ \skip_use:c { l_@@_vspace_above_ \@@_level: _skip } } |
| 9325 |
} |
| 9326 |
{ |
| 9327 |
\vspace { \skip_use:c { l_@@_vspace_above_ \@@_level: _skip } } |
| 9328 |
} |
| 9329 |
} |
| 9330 |
} |
| 9331 |
% \end{macrocode} |
| 9332 |
% \end{macro} |
| 9333 |
% |
| 9334 |
% \begin{macro}{\@@_vspace_below:} |
| 9335 |
% The function \cs{@@_vspace_below:} apply the \emph{vertical space below} |
| 9336 |
% the \myenv*{enumext} environment set by the \mykey{below*} and \mykey{below} keys. |
| 9337 |
% \begin{macrocode} |
| 9338 |
\cs_new_protected:Nn \@@_vspace_below: |
| 9339 |
{ |
| 9340 |
\skip_if_eq:nnF |
| 9341 |
{ \skip_use:c { l_@@_vspace_below_ \@@_level: _skip } } { \c_zero_skip } |
| 9342 |
{ |
| 9343 |
\bool_if:cTF { l_@@_vspace_b_star_ \@@_level: _bool } |
| 9344 |
{ |
| 9345 |
\vspace*{ \skip_use:c { l_@@_vspace_below_ \@@_level: _skip } } |
| 9346 |
} |
| 9347 |
{ |
| 9348 |
\vspace { \skip_use:c { l_@@_vspace_below_ \@@_level: _skip } } |
| 9349 |
} |
| 9350 |
} |
| 9351 |
} |
| 9352 |
% \end{macrocode} |
| 9353 |
% \end{macro} |
| 9354 |
% |
| 9355 |
% \subsubsection{Functions for \texttt{above} and \texttt{below} keys in \env{keyans}} |
| 9356 |
% |
| 9357 |
% \begin{macro}{\@@_vspace_above_v:,} |
| 9358 |
% The function \cs{@@_vspace_above_v:} apply the \emph{vertical space above} |
| 9359 |
% the \myenv*{keyans} environment set by the \mykey{above} and \mykey{above*} keys. |
| 9360 |
% \iffalse |
| 9361 |
%% Function for |above|, |above*|, |below| and |below*| keys in |keyans|. |
| 9362 |
% \fi |
| 9363 |
% \begin{macrocode} |
| 9364 |
\cs_new_protected:Nn \@@_vspace_above_v: |
| 9365 |
{ |
| 9366 |
\skip_if_eq:nnF { \l_@@_vspace_above_v_skip } { \c_zero_skip } |
| 9367 |
{ |
| 9368 |
\bool_if:NTF \l_@@_vspace_a_star_v_bool |
| 9369 |
{ |
| 9370 |
\vspace*{ \l_@@_vspace_above_v_skip } |
| 9371 |
} |
| 9372 |
{ \vspace { \l_@@_vspace_above_v_skip } } |
| 9373 |
} |
| 9374 |
} |
| 9375 |
% \end{macrocode} |
| 9376 |
% \end{macro} |
| 9377 |
% |
| 9378 |
% \begin{macro}{\@@_vspace_below_v:} |
| 9379 |
% The function \cs{@@_vspace_below_v:} apply the \emph{vertical space below} |
| 9380 |
% the \myenv*{keyans} environment set by the \mykey{below*} and \mykey{below} keys. |
| 9381 |
% \begin{macrocode} |
| 9382 |
\cs_new_protected:Nn \@@_vspace_below_v: |
| 9383 |
{ |
| 9384 |
\skip_if_eq:nnF { \l_@@_vspace_below_v_skip } { \c_zero_skip } |
| 9385 |
{ |
| 9386 |
\bool_if:NTF \l_@@_vspace_b_star_v_bool |
| 9387 |
{ |
| 9388 |
\vspace*{ \l_@@_vspace_below_v_skip } |
| 9389 |
} |
| 9390 |
{ \vspace { \l_@@_vspace_below_v_skip } } |
| 9391 |
} |
| 9392 |
} |
| 9393 |
% \end{macrocode} |
| 9394 |
% \end{macro} |
| 9395 |
% |
| 9396 |
% \subsubsection{Functions for \texttt{above} and \texttt{below} keys in \env{enumext*} \env{keyans*}} |
| 9397 |
% |
| 9398 |
% \begin{macro}{\@@_vspace_above_vii:,\@@_vspace_above_viii:} |
| 9399 |
% The functions \cs{@@_vspace_above_vii:} and \cs{@@_vspace_above_viii:} apply the \emph{vertical space above} |
| 9400 |
% the \myenv*{enumext*} and \myenv*{keyans*} environments set by the \mykey{above} and \mykey{above*} keys. |
| 9401 |
% \iffalse |
| 9402 |
%% Function for |above|, |above*|, |below| and |below*| keys in |enumext*| and |keyans*|. |
| 9403 |
% \fi |
| 9404 |
% \begin{macrocode} |
| 9405 |
\cs_new_protected:Nn \@@_vspace_above_vii: |
| 9406 |
{ |
| 9407 |
\skip_if_eq:nnF { \l_@@_vspace_above_vii_skip } { \c_zero_skip } |
| 9408 |
{ |
| 9409 |
\bool_if:NTF \l_@@_vspace_a_star_vii_bool |
| 9410 |
{ |
| 9411 |
\vspace*{ \l_@@_vspace_above_vii_skip } |
| 9412 |
} |
| 9413 |
{ \vspace { \l_@@_vspace_above_vii_skip } } |
| 9414 |
} |
| 9415 |
} |
| 9416 |
\cs_new_protected:Nn \@@_vspace_above_viii: |
| 9417 |
{ |
| 9418 |
\skip_if_eq:nnF { \l_@@_vspace_above_viii_skip } { \c_zero_skip } |
| 9419 |
{ |
| 9420 |
\bool_if:NTF \l_@@_vspace_a_star_viii_bool |
| 9421 |
{ |
| 9422 |
\vspace*{ \l_@@_vspace_above_viii_skip } |
| 9423 |
} |
| 9424 |
{ \vspace { \l_@@_vspace_above_viii_skip } } |
| 9425 |
} |
| 9426 |
} |
| 9427 |
% \end{macrocode} |
| 9428 |
% \end{macro} |
| 9429 |
% |
| 9430 |
% \begin{macro}{\@@_vspace_below_vii:, \@@_vspace_below_viii:} |
| 9431 |
% The functions \cs{@@_vspace_below_vii:} and \cs{@@_vspace_below_viii:} |
| 9432 |
% apply the \emph{vertical space below} the \myenv*{enumext*} and |
| 9433 |
% \myenv*{keyans*} environments set by the \mykey{below*} and \mykey{below} keys. |
| 9434 |
% \begin{macrocode} |
| 9435 |
\cs_new_protected:Nn \@@_vspace_below_vii: |
| 9436 |
{ |
| 9437 |
\skip_if_eq:nnF { \l_@@_vspace_below_vii_skip } { \c_zero_skip } |
| 9438 |
{ |
| 9439 |
\bool_if:NTF \l_@@_vspace_b_star_vii_bool |
| 9440 |
{ |
| 9441 |
\vspace*{ \l_@@_vspace_below_vii_skip } |
| 9442 |
} |
| 9443 |
{ \vspace { \l_@@_vspace_below_vii_skip } } |
| 9444 |
} |
| 9445 |
} |
| 9446 |
\cs_new_protected:Nn \@@_vspace_below_viii: |
| 9447 |
{ |
| 9448 |
\skip_if_eq:nnF { \l_@@_vspace_below_viii_skip } { \c_zero_skip } |
| 9449 |
{ |
| 9450 |
\bool_if:NTF \l_@@_vspace_b_star_viii_bool |
| 9451 |
{ |
| 9452 |
\vspace*{ \l_@@_vspace_below_viii_skip } |
| 9453 |
} |
| 9454 |
{ \vspace { \l_@@_vspace_below_viii_skip } } |
| 9455 |
} |
| 9456 |
} |
| 9457 |
% \end{macrocode} |
| 9458 |
% \end{macro} |
| 9459 |
% |
| 9460 |
% \subsection{Setting \texttt{series}, \texttt{resume} and \texttt{resume*} keys}\label{key:series} |
| 9461 |
% |
| 9462 |
% The \mykey{series} key is responsible for the whole process of the |
| 9463 |
% \mykey{resume} and \mykey{resume*} keys. The idea behind this is to be |
| 9464 |
% able to absorb the \mymeta{keys} passed to the \emph{optional argument} |
| 9465 |
% of the environments \myenv*{enumext} and \myenv*{enumext*}, but, discarding |
| 9466 |
% some specific \mymeta{keys}. |
| 9467 |
% |
| 9468 |
% \begin{macro}[int]{series, resume, resume*, } |
| 9469 |
% We define the keys \mykey{series}, \mykey{resume} |
| 9470 |
% and \mykey{resume*} for the \emph{\enquote{all levels}} |
| 9471 |
% of \myenv*{enumext} and \myenv*{enumext*}. |
| 9472 |
% Here we do not need to make sure that |\printkeyans| is not running |
| 9473 |
% otherwise the \emph{start value} of the environments would be increased when |
| 9474 |
% using \mykey{resume} or \mykey{resume}|*| keys. |
| 9475 |
% |
| 9476 |
% In version 1.6 it is allowed to pass the key \mykey{resume} \emph{without |
| 9477 |
% value} by means of the command |\setenumext|, for the correct operation |
| 9478 |
% of this we must set the boolean variable \myvarenv{l__@@_resume_count_bool} |
| 9479 |
% set by the key \mykey{resume} \emph{without value} to \enquote{true} to |
| 9480 |
% be later processed by the function \cs{@@_parse_series:n} in the definition |
| 9481 |
% of the environments \myenv*{enumext} and \myenv*{enumext*}. |
| 9482 |
% \iffalse |
| 9483 |
%% Add |series|, |resume| and |resume*| keys for |enumext| and |enumext*|. |
| 9484 |
% \fi |
| 9485 |
% \begin{macrocode} |
| 9486 |
\cs_set_protected:Npn \@@_tmp:nn #1 #2 |
| 9487 |
{ |
| 9488 |
\keys_define:nn { enumext / #1 } |
| 9489 |
{ |
| 9490 |
series .str_set:N = \l_@@_series_name_str, |
| 9491 |
series .value_required:n = true, |
| 9492 |
resume .code:n = { |
| 9493 |
\bool_if:NF \l_@@_print_keyans_cmd_bool |
| 9494 |
{ |
| 9495 |
\tl_set:Nn \l_@@_series_name_tl {##1} |
| 9496 |
\tl_if_empty:NTF \l_@@_series_name_tl |
| 9497 |
{ |
| 9498 |
\bool_set_true:c { l_@@_resume_count_#2_bool } |
| 9499 |
\bool_set_eq:Nc |
| 9500 |
\l_@@_resume_count_bool |
| 9501 |
{ l_@@_resume_count_#2_bool } |
| 9502 |
} |
| 9503 |
{ |
| 9504 |
\@@_resume:n {##1} |
| 9505 |
} |
| 9506 |
} |
| 9507 |
}, |
| 9508 |
resume* .code:n = { |
| 9509 |
\bool_if:NF \l_@@_print_keyans_cmd_bool |
| 9510 |
{ |
| 9511 |
\bool_set_true:c { l_@@_resume_count_#2_bool } |
| 9512 |
\bool_set_eq:Nc |
| 9513 |
\l_@@_resume_count_bool { l_@@_resume_count_#2_bool } |
| 9514 |
\bool_set_true:c { l_@@_resume_star_key_#2_bool } |
| 9515 |
\@@_resume_star: |
| 9516 |
} |
| 9517 |
}, |
| 9518 |
resume* .value_forbidden:n = true, |
| 9519 |
} |
| 9520 |
} |
| 9521 |
\clist_map_inline:nn |
| 9522 |
{ |
| 9523 |
{level-1}{i}, {level-2}{ii}, {level-3}{iii}, {level-4}{iv},{enumext*}{vii}, |
| 9524 |
} |
| 9525 |
{ \@@_tmp:nn #1 } |
| 9526 |
% \end{macrocode} |
| 9527 |
% \end{macro} |
| 9528 |
% |
| 9529 |
% \subsubsection{Internal function to save counter and integer values} |
| 9530 |
% |
| 9531 |
% \begin{macro}{\@@_standar_save_counter:, \@@_standar_save_counter_aux:, |
| 9532 |
% \@@_starred_save_counter:, \@@_starred_save_counter_aux:} |
| 9533 |
% The \cs{@@_standar_save_counter:} and \cs{@@_starred_save_counter:} |
| 9534 |
% functions will save the last counter value to \myvarenv{g__@@_series_\mymeta[cf=gray]{series name}_int} |
| 9535 |
% if the \mykey{series}|=|\mymarg{series name} key has been passed, to |
| 9536 |
% \myvarenv{c@__@@_resume_X_int} if it has passed the key \mykey{resume} |
| 9537 |
% \emph{without value} and the key \mykey{series} is not active, in |
| 9538 |
% \myvarenv{g__@@_series_\mymeta[cf=gray]{series name}_X_int} if the key |
| 9539 |
% \mykey{resume}|=|\mymarg{series name} has been passed and in |
| 9540 |
% \myvarenv{g__@@_series_\mymeta[cf=gray]{store name}_X_int} if the key has |
| 9541 |
% been passed \mykey{save-ans}|=|\mymarg{store name}. |
| 9542 |
% |
| 9543 |
% \smallskip |
| 9544 |
% |
| 9545 |
% \begin{important}* |
| 9546 |
% The variables \cs{l_@@_series_name_str} and \cs{l_@@_series_name_tl} |
| 9547 |
% contain the same \mymarg{series name} but are executed at different |
| 9548 |
% moments, the integer variable with \cs{l_@@_series_name_str} sets the value |
| 9549 |
% when execute \mykey{series}|=|\mymarg{series name} and the |
| 9550 |
% integer variable with \cs{l_@@_series_name_tl} sets the subsequent |
| 9551 |
% values when use \mykey{resume}|=|\mymarg{series name}. |
| 9552 |
% This function is passed to the \myenv*{enumext} environment definition (\S\ref{env:enumext}) |
| 9553 |
% and the \myenv*{enumext*} environment definition (\S\ref{env:starred}). |
| 9554 |
% \end{important} |
| 9555 |
% \iffalse |
| 9556 |
%% Internal function to save counter value and set int vars for |series|, |resume| and |resume*| keys. |
| 9557 |
% \fi |
| 9558 |
% \begin{macrocode} |
| 9559 |
\cs_new_protected:Nn \@@_standar_save_counter: |
| 9560 |
{ |
| 9561 |
\bool_if:NTF \g_@@_standar_bool |
| 9562 |
{ |
| 9563 |
\@@_standar_save_counter_aux: |
| 9564 |
\int_compare:nNnT { \l_@@_level_int } = { 1 } |
| 9565 |
{ |
| 9566 |
\int_if_exist:cT { g_@@_resume_ \l_@@_store_name_tl _int } |
| 9567 |
{ |
| 9568 |
\int_gset_eq:cN |
| 9569 |
{ g_@@_resume_ \l_@@_store_name_tl _int } \value{enumXi} |
| 9570 |
} |
| 9571 |
} |
| 9572 |
} |
| 9573 |
{ |
| 9574 |
\@@_standar_save_counter_aux: |
| 9575 |
} |
| 9576 |
} |
| 9577 |
\cs_new_protected:Nn \@@_standar_save_counter_aux: |
| 9578 |
{ |
| 9579 |
\str_if_empty:NF \l_@@_series_name_str |
| 9580 |
{ |
| 9581 |
\int_gset_eq:cc |
| 9582 |
{ g_@@_series_ \l_@@_series_name_str _ \@@_level: _int } |
| 9583 |
{ c@enumX \@@_level: } |
| 9584 |
} |
| 9585 |
\tl_if_empty:NTF \l_@@_series_name_tl |
| 9586 |
{ |
| 9587 |
\str_if_empty:NT \l_@@_series_name_str |
| 9588 |
{ |
| 9589 |
\tl_if_empty:NT \l_@@_store_name_tl |
| 9590 |
{ |
| 9591 |
\int_gset_eq:cc |
| 9592 |
{ c@ @@_resume_ \@@_level: _int } { c@enumX \@@_level: } |
| 9593 |
} |
| 9594 |
} |
| 9595 |
} |
| 9596 |
{ |
| 9597 |
\int_if_exist:cT |
| 9598 |
{ g_@@_series_ \l_@@_series_name_tl _ \@@_level: _int } |
| 9599 |
{ |
| 9600 |
\int_gset_eq:cc |
| 9601 |
{ g_@@_series_ \l_@@_series_name_tl _ \@@_level: _int } |
| 9602 |
{ c@enumX \@@_level: } |
| 9603 |
} |
| 9604 |
} |
| 9605 |
} |
| 9606 |
\cs_new_protected:Nn \@@_starred_save_counter: |
| 9607 |
{ |
| 9608 |
\bool_if:NTF \g_@@_starred_bool |
| 9609 |
{ |
| 9610 |
\@@_starred_save_counter_aux: |
| 9611 |
\int_if_exist:cT { g_@@_resume_ \l_@@_store_name_tl _int } |
| 9612 |
{ |
| 9613 |
\int_gset_eq:cN |
| 9614 |
{ g_@@_resume_ \l_@@_store_name_tl _int } \value{enumXvii} |
| 9615 |
} |
| 9616 |
} |
| 9617 |
{ |
| 9618 |
\@@_starred_save_counter_aux: |
| 9619 |
} |
| 9620 |
} |
| 9621 |
\cs_new_protected:Nn \@@_starred_save_counter_aux: |
| 9622 |
{ |
| 9623 |
\str_if_empty:NF \l_@@_series_name_str |
| 9624 |
{ |
| 9625 |
\int_gset_eq:cN |
| 9626 |
{ g_@@_series_ \l_@@_series_name_str _vii_int } \value{enumXvii} |
| 9627 |
} |
| 9628 |
\tl_if_empty:NTF \l_@@_series_name_tl |
| 9629 |
{ |
| 9630 |
\str_if_empty:NT \l_@@_series_name_str |
| 9631 |
{ |
| 9632 |
\tl_if_empty:NT \l_@@_store_name_tl |
| 9633 |
{ |
| 9634 |
\int_gset_eq:cc { c@ @@_resume_vii_int } { c@enumXvii } |
| 9635 |
} |
| 9636 |
} |
| 9637 |
} |
| 9638 |
{ |
| 9639 |
\int_if_exist:cT { g_@@_series_ \l_@@_series_name_tl _vii_int } |
| 9640 |
{ |
| 9641 |
\int_gset_eq:cN |
| 9642 |
{ g_@@_series_ \l_@@_series_name_tl _vii_int } \value{enumXvii} |
| 9643 |
} |
| 9644 |
} |
| 9645 |
} |
| 9646 |
% \end{macrocode} |
| 9647 |
% \end{macro} |
| 9648 |
% |
| 9649 |
% \subsubsection{Internal function for resume counters} |
| 9650 |
% |
| 9651 |
% \begin{macro}{\@@_resume_counter:} |
| 9652 |
% The \cs{@@_resume_counter:} function is executed by the \mykey{resume*} |
| 9653 |
% key and \mykey{resume} key \emph{without value}, only the |
| 9654 |
% \emph{\enquote{counters}} for the \emph{\enquote{levels}} of the |
| 9655 |
% environments in which it is executed will be set. If the |
| 9656 |
% \mykey{save-ans} key is active it will set the \emph{\enquote{counter}} |
| 9657 |
% according to the value of the integer variable created by that key. |
| 9658 |
% \iffalse |
| 9659 |
%% Internal function to resume counter value for |resume| and |resume*| keys. |
| 9660 |
% \fi |
| 9661 |
% \begin{macrocode} |
| 9662 |
\cs_new_protected:Nn \@@_resume_counter: |
| 9663 |
{ |
| 9664 |
\cs_set:Npn \@@_tmp:n ##1 |
| 9665 |
{ |
| 9666 |
\bool_if:cT { l_@@_resume_count_ \int_to_roman:n {##1} _bool } |
| 9667 |
{ |
| 9668 |
\exp_args:Ne \int_set:cn { l_@@_start_ \int_to_roman:n {##1} _int } |
| 9669 |
{ |
| 9670 |
\int_use:c { c@ @@_resume_ \int_to_roman:n {##1} _int } + 1 |
| 9671 |
} |
| 9672 |
} |
| 9673 |
} |
| 9674 |
\int_compare:nNnT { \l_@@_level_int } > { 0 } |
| 9675 |
{ |
| 9676 |
\bool_lazy_and:nnTF |
| 9677 |
{ \bool_if_p:N \l_@@_standar_first_bool } |
| 9678 |
{ \bool_if_p:N \l_@@_store_active_bool } |
| 9679 |
{ |
| 9680 |
\int_set:Nn \l_@@_start_i_int |
| 9681 |
{ |
| 9682 |
\int_use:c { g_@@_resume_ \l_@@_store_name_tl _int } + 1 |
| 9683 |
} |
| 9684 |
} |
| 9685 |
{ |
| 9686 |
\int_step_function:nN { \l_@@_level_int } \@@_tmp:n |
| 9687 |
} |
| 9688 |
} |
| 9689 |
\int_compare:nNnT { \l_@@_level_h_int } = { 1 } |
| 9690 |
{ |
| 9691 |
\bool_lazy_and:nnTF |
| 9692 |
{ \bool_if_p:N \l_@@_starred_first_bool } |
| 9693 |
{ \bool_if_p:N \l_@@_store_active_bool } |
| 9694 |
{ |
| 9695 |
\int_set:Nn \l_@@_start_vii_int |
| 9696 |
{ |
| 9697 |
\int_use:c { g_@@_resume_ \l_@@_store_name_tl _int } + 1 |
| 9698 |
} |
| 9699 |
} |
| 9700 |
{ |
| 9701 |
\bool_if:NT \l_@@_resume_count_vii_bool |
| 9702 |
{ |
| 9703 |
\int_set:Nn \l_@@_start_vii_int |
| 9704 |
{ |
| 9705 |
\int_use:c { c@ @@_resume_vii_int } + 1 |
| 9706 |
} |
| 9707 |
} |
| 9708 |
} |
| 9709 |
} |
| 9710 |
} |
| 9711 |
% \end{macrocode} |
| 9712 |
% \end{macro} |
| 9713 |
% |
| 9714 |
% \subsubsection{Internal functions for \texttt{series} key} |
| 9715 |
% |
| 9716 |
% \begin{macro}{\@@_filter_series:n, \@@_filter_series_key:n, \@@_filter_series_pair:nn} |
| 9717 |
% The function \cs{@@_filter_series:n} will be in charge of filtering the |
| 9718 |
% \mymeta{keys} we want to store where |#1| represents the \emph{optional argument} |
| 9719 |
% passed to the environment. This implementation is adapted directly from |
| 9720 |
% the code provided by Jonathan P. Spratte \texttt(@Skillmon) in \href{https://chat.stackexchange.com/transcript/41?m=65647962#65647962}{chat-TeX-SX} |
| 9721 |
% \iffalse |
| 9722 |
%% Internal function for filter keys. |
| 9723 |
% \fi |
| 9724 |
% \begin{macrocode} |
| 9725 |
\cs_new:Npn \@@_filter_series:n #1 |
| 9726 |
{ |
| 9727 |
\use:e |
| 9728 |
{ |
| 9729 |
\keyval_parse:NNn |
| 9730 |
\@@_filter_series_key:n |
| 9731 |
\@@_filter_series_pair:nn {#1} |
| 9732 |
} |
| 9733 |
} |
| 9734 |
% \end{macrocode} |
| 9735 |
% The function \cs{@@_filter_series_key:n} will be responsible for |
| 9736 |
% filtering the \mymeta{keys} that are passed \emph{\enquote{without value}} by |
| 9737 |
% excluding the \mykey{resume}, \mykey{resume*}, \mykey{reset}, \mykey{reset*} |
| 9738 |
% and \mykey{base-fix} keys. |
| 9739 |
% \begin{macrocode} |
| 9740 |
\cs_new:Npn \@@_filter_series_key:n #1 |
| 9741 |
{ |
| 9742 |
\str_case:nnF {#1} |
| 9743 |
{ |
| 9744 |
{ resume } {} { resume* } {} { reset } {} { reset* } {} { base-fix } {} |
| 9745 |
} |
| 9746 |
{ , { \exp_not:n {#1} } } |
| 9747 |
} |
| 9748 |
% \end{macrocode} |
| 9749 |
% The function \cs{@@_filter_series_pair:nn} will be responsible for |
| 9750 |
% filtering the \mymeta{keys} that are passed \emph{\enquote{with value}} by |
| 9751 |
% excluding the \mykey{series}, \mykey{resume}, \mykey{start}, \mykey{start*}, \mykey{save-ans} and |
| 9752 |
% \mykey{save-key} keys. |
| 9753 |
% \begin{macrocode} |
| 9754 |
\cs_new:Npn \@@_filter_series_pair:nn #1#2 |
| 9755 |
{ |
| 9756 |
\str_case:nnF {#1} |
| 9757 |
{ |
| 9758 |
{ series } {} { resume } {} { start } {} |
| 9759 |
{ start* } {} { save-ans } {} { save-key } {} |
| 9760 |
} |
| 9761 |
{ , { \exp_not:n {#1} } = { \exp_not:n {#2} } } |
| 9762 |
} |
| 9763 |
% \end{macrocode} |
| 9764 |
% \end{macro} |
| 9765 |
% |
| 9766 |
% \begin{macro}{\@@_save_last_keys:n, \@@_resume_last_counter:,} |
| 9767 |
% The function \cs{@@_save_last_keys:n} will be in charge of saving the |
| 9768 |
% filtering \mymeta{keys} when the keys \mykey{series}|=|\mymarg{series name} |
| 9769 |
% or \mykey{resume}|=|\mymarg{series name} or \mykey{resume}|*| are NOT |
| 9770 |
% active and will save them in the variable \myvarenv{g__@@_resume_last_keys_X_tl} for the |
| 9771 |
% \myenv*{enumext} environment and in the variable \myvarenv{g__@@_resume_last_keys_vii_tl} |
| 9772 |
% for the \myenv*{enumext*} environment. |
| 9773 |
% |
| 9774 |
% \smallskip |
| 9775 |
% |
| 9776 |
% \begin{important}* |
| 9777 |
% The boolean variable \myvarenv{l__@@_resume_series_X_bool} |
| 9778 |
% is set to \enquote{true} by the key \mykey{resume}|=|\mymarg{series name}, |
| 9779 |
% the boolean variable \myvarenv{l__@@_resume_star_key_X_bool} |
| 9780 |
% is set to \enquote{true} by the key \mykey{resume}|*|, in this case |
| 9781 |
% we need to make sure both variables are set to “\enquote{false} so that |
| 9782 |
% they don’t override the default filtered \mymeta{keys}. |
| 9783 |
% \end{important} |
| 9784 |
% \iffalse |
| 9785 |
%% Save keys for last environment "without" |series| and |resume=name| keys active. |
| 9786 |
% \fi |
| 9787 |
% \begin{macrocode} |
| 9788 |
\cs_new_protected:Npn \@@_save_last_keys:n #1 |
| 9789 |
{ |
| 9790 |
\int_compare:nNnT { \l_@@_level_int } > { 0 } |
| 9791 |
{ |
| 9792 |
\bool_if:cF { l_@@_resume_series_ \@@_level: _bool } |
| 9793 |
{ |
| 9794 |
\bool_if:cF { l_@@_resume_star_key_ \@@_level: _bool } |
| 9795 |
{ |
| 9796 |
\tl_gclear:c { g_@@_resume_last_keys_ \@@_level: _tl } |
| 9797 |
\tl_gset:ce |
| 9798 |
{ g_@@_resume_last_keys_ \@@_level: _tl } |
| 9799 |
{ \@@_filter_series:n {#1} } |
| 9800 |
} |
| 9801 |
} |
| 9802 |
} |
| 9803 |
\int_compare:nNnT { \l_@@_level_h_int } = { 1 } |
| 9804 |
{ |
| 9805 |
\bool_if:NF \l_@@_resume_series_vii_bool |
| 9806 |
{ |
| 9807 |
\tl_gclear:N \g_@@_resume_last_keys_vii_tl |
| 9808 |
\tl_gset:Ne \g_@@_resume_last_keys_vii_tl { \@@_filter_series:n {#1} } |
| 9809 |
} |
| 9810 |
} |
| 9811 |
} |
| 9812 |
% \end{macrocode} |
| 9813 |
% The \cs{@@_resume_last_counter:} function will be in charge of setting |
| 9814 |
% the \emph{\enquote{counters}} when the keys \mykey{series}|=|\mymarg{series name} |
| 9815 |
% or \mykey{resume}|=|\mymarg{series name} are NOT active and the |
| 9816 |
% \mykey{resume} key is being used \emph{without value} either in the |
| 9817 |
% \emph{optional argument} of the environments or through the |
| 9818 |
% |\setenumext| command. |
| 9819 |
% |
| 9820 |
% \smallskip |
| 9821 |
% |
| 9822 |
% \begin{important}* |
| 9823 |
% The boolean variable \cs[no-index]{l_@@_resume_count_bool} |
| 9824 |
% is set to \enquote{true} by the keys \mykey{resume} \emph{without value} |
| 9825 |
% and \mykey{resume}|*|; and set to \enquote{false} by the keys |
| 9826 |
% \mykey{start} and \mykey{start*} (\S\ref{key:start-widest}). |
| 9827 |
% \end{important} |
| 9828 |
% \iffalse |
| 9829 |
%% Resume the counters for last environment "without" |series| and |resume=name| keys active. |
| 9830 |
% \fi |
| 9831 |
% \begin{macrocode} |
| 9832 |
\cs_new_protected:Nn \@@_resume_last_counter: |
| 9833 |
{ |
| 9834 |
\bool_lazy_and:nnT |
| 9835 |
{ \bool_if_p:N \l_@@_resume_count_bool } |
| 9836 |
{ \tl_if_empty_p:N \l_@@_series_name_tl } |
| 9837 |
{ |
| 9838 |
\@@_resume_counter: |
| 9839 |
} |
| 9840 |
} |
| 9841 |
% \end{macrocode} |
| 9842 |
% \end{macro} |
| 9843 |
% |
| 9844 |
% \begin{macro}{\@@_parse_series:n,} |
| 9845 |
% The \cs{@@_parse_series:n} function handled by the \mykey{series} key |
| 9846 |
% will be responsible for \emph{storing} the \emph{filtered} |
| 9847 |
% \mymeta{keys} from the \emph{optional arguments} of the |
| 9848 |
% \myenv*{enumext} and \myenv*{enumext*} environments for the |
| 9849 |
% \mykey{resume} and \mykey{resume}|*| keys. |
| 9850 |
% If the \mykey{series} key is NOT active it will call the |
| 9851 |
% \cs{@@_save_last_keys:n} function to \emph{store} the \emph{filtered} |
| 9852 |
% \mymeta{keys} that will be used by the \mykey{resume*} key and then the |
| 9853 |
% \cs{@@_resume_last_counter:} function used by the \mykey{resume} key |
| 9854 |
% \emph{without value} if it is active, otherwise \emph{store} the |
| 9855 |
% \emph{filtered} \mymeta{keys} in the global variable \myvarenv{g__@@_series_\mymeta[cf=gray]{series name}_X_tl} |
| 9856 |
% along with the creation of the integer variable \myvarenv{g__@@_series_\mymeta[cf=gray]{series name}_X_int} |
| 9857 |
% used by the \mykey{resume} key \emph{with value}. |
| 9858 |
% |
| 9859 |
% \smallskip |
| 9860 |
% |
| 9861 |
% \begin{important}* |
| 9862 |
% This function is passed to the function \cs{@@_parse_keys:n} |
| 9863 |
% in the \myenv*{enumext} environment definition (\S\ref{env:enumext}) |
| 9864 |
% and to the function \cs{@@_parse_keys_vii:n} in the \myenv*{enumext*} |
| 9865 |
% environment definition (\S\ref{env:starred}). |
| 9866 |
% \end{important} |
| 9867 |
% \iffalse |
| 9868 |
%% Internal function for parse filter keys used by |series|, |resume| and |resume*| keys. |
| 9869 |
% \fi |
| 9870 |
% \begin{macrocode} |
| 9871 |
\cs_new_protected:Npn \@@_parse_series:n #1 |
| 9872 |
{ |
| 9873 |
\str_if_empty:NTF \l_@@_series_name_str |
| 9874 |
{ |
| 9875 |
\int_compare:nNnT { \l_@@_level_int } > { 0 } |
| 9876 |
{ |
| 9877 |
\@@_save_last_keys:n {#1} |
| 9878 |
\@@_resume_last_counter: |
| 9879 |
} |
| 9880 |
\int_compare:nNnT { \l_@@_level_h_int } = { 1 } |
| 9881 |
{ |
| 9882 |
\@@_save_last_keys:n {#1} |
| 9883 |
\@@_resume_last_counter: |
| 9884 |
} |
| 9885 |
} |
| 9886 |
{ |
| 9887 |
\int_compare:nNnT { \l_@@_level_int } > { 0 } |
| 9888 |
{ |
| 9889 |
\tl_gclear_new:c |
| 9890 |
{ g_@@_series_ \l_@@_series_name_str _ \@@_level: _tl } |
| 9891 |
\tl_gset:ce |
| 9892 |
{ g_@@_series_ \l_@@_series_name_str _ \@@_level: _tl } |
| 9893 |
{ \@@_filter_series:n {#1} } |
| 9894 |
\int_if_exist:cF |
| 9895 |
{ g_@@_series_ \l_@@_series_name_str _ \@@_level: _int } |
| 9896 |
{ |
| 9897 |
\int_new:c |
| 9898 |
{ g_@@_series_ \l_@@_series_name_str _ \@@_level: _int } |
| 9899 |
} |
| 9900 |
} |
| 9901 |
\int_compare:nNnT { \l_@@_level_h_int } = { 1 } |
| 9902 |
{ |
| 9903 |
\tl_gclear_new:c { g_@@_series_ \l_@@_series_name_str _vii_tl } |
| 9904 |
\tl_gset:ce |
| 9905 |
{ g_@@_series_ \l_@@_series_name_str _vii_tl } |
| 9906 |
{ \@@_filter_series:n {#1} } |
| 9907 |
\int_if_exist:cF { g_@@_series_ \l_@@_series_name_str _vii_int } |
| 9908 |
{ |
| 9909 |
\int_new:c { g_@@_series_ \l_@@_series_name_str _vii_int } |
| 9910 |
} |
| 9911 |
} |
| 9912 |
} |
| 9913 |
} |
| 9914 |
% \end{macrocode} |
| 9915 |
% \end{macro} |
| 9916 |
% |
| 9917 |
% \subsubsection{Internal functions for \texttt{resume} key with value} |
| 9918 |
% |
| 9919 |
% \begin{macro}{\@@_resume:n} |
| 9920 |
% The function \cs{@@_resume:n} will handle the \emph{argument} \mymarg{series name} |
| 9921 |
% passed to the \mykey{resume} key in \myenv*{enumext} and \myenv*{enumext*} environments. |
| 9922 |
% First we will check if the global variable \myvarenv{g__@@_series_\mymeta[cf=gray]{series name}_X_tl} |
| 9923 |
% exists, if so we will call the function \cs{@@_resume_series:n} and pass the \mymeta{keys} |
| 9924 |
% stored in \myvarenv{g__@@_series_\mymeta[cf=gray]{series name}_X_tl} to the environments, |
| 9925 |
% otherwise we will return an error. |
| 9926 |
% \iffalse |
| 9927 |
%% Internal function for |resume=series| key. |
| 9928 |
% \fi |
| 9929 |
% \begin{macrocode} |
| 9930 |
\cs_new_protected:Npn \@@_resume:n #1 |
| 9931 |
{ |
| 9932 |
\int_compare:nNnT { \l_@@_level_int } > { 0 } |
| 9933 |
{ |
| 9934 |
\tl_if_exist:cTF { g_@@_series_ \tl_to_str:n {#1} _ \@@_level: _tl } |
| 9935 |
{ |
| 9936 |
\@@_resume_series:n {#1} |
| 9937 |
\exp_args:Ne \keys_set:nv { enumext / level-\int_use:N \l_@@_level_int } |
| 9938 |
{ g_@@_series_ \tl_to_str:n {#1} _ \@@_level: _tl } |
| 9939 |
} |
| 9940 |
{ |
| 9941 |
\msg_error:nnn { enumext } { unknown-series-standar } {#1} |
| 9942 |
} |
| 9943 |
} |
| 9944 |
\int_compare:nNnT { \l_@@_level_h_int } = { 1 } |
| 9945 |
{ |
| 9946 |
\tl_if_exist:cTF { g_@@_series_ \tl_to_str:n {#1} _vii_tl } |
| 9947 |
{ |
| 9948 |
\@@_resume_series:n {#1} |
| 9949 |
\keys_set:nv { enumext / enumext* } |
| 9950 |
{ g_@@_series_ \tl_to_str:n {#1} _vii_tl } |
| 9951 |
} |
| 9952 |
{ |
| 9953 |
\msg_error:nnn { enumext } { unknown-series-starred } {#1} |
| 9954 |
} |
| 9955 |
} |
| 9956 |
} |
| 9957 |
% \end{macrocode} |
| 9958 |
% \end{macro} |
| 9959 |
% |
| 9960 |
% \begin{macro}{\@@_resume_series:n, \@@_resume_integer_series:,} |
| 9961 |
% The function \cs{@@_resume_series:n} will set the variable |
| 9962 |
% \cs[no-index]{l_@@_resume_series_X_bool} to \enquote{true} and pass the \mymarg{argument} |
| 9963 |
% to the variable \cs{l_@@_series_name_tl} then call the function |
| 9964 |
% \cs{@@_resume_integer_series:}. |
| 9965 |
% \begin{macrocode} |
| 9966 |
\cs_new_protected:Npn \@@_resume_series:n #1 |
| 9967 |
{ |
| 9968 |
\int_compare:nNnT { \l_@@_level_int } > { 0 } |
| 9969 |
{ |
| 9970 |
\bool_set_true:c { l_@@_resume_series_ \@@_level: _bool } |
| 9971 |
\tl_clear:N \l_@@_series_name_tl |
| 9972 |
\tl_set:Nn \l_@@_series_name_tl {#1} |
| 9973 |
\@@_resume_integer_series: |
| 9974 |
} |
| 9975 |
\int_compare:nNnT { \l_@@_level_h_int } = { 1 } |
| 9976 |
{ |
| 9977 |
\bool_set_true:N \l_@@_resume_series_vii_bool |
| 9978 |
\tl_clear:N \l_@@_series_name_tl |
| 9979 |
\tl_set:Nn \l_@@_series_name_tl {#1} |
| 9980 |
\@@_resume_integer_series: |
| 9981 |
} |
| 9982 |
} |
| 9983 |
% \end{macrocode} |
| 9984 |
% The function \cs{@@_resume_integer_series:} will be executed when the |
| 9985 |
% \mykey{resume}|=|\mymarg{series name} key is active, setting the \emph{start value} |
| 9986 |
% for the \emph{\enquote{counter}} of the \emph{\enquote{current level}} of the environments |
| 9987 |
% in which it is run according to the value of the \emph{\enquote{integer variables}} created by the |
| 9988 |
% \mykey{series} key. If the \mykey{save-ans} key is active it will |
| 9989 |
% set the \emph{start value} for the \emph{\enquote{counter}} according |
| 9990 |
% to the value of the integer variable created by that key. |
| 9991 |
% \begin{macrocode} |
| 9992 |
\cs_new_protected:Nn \@@_resume_integer_series: |
| 9993 |
{ |
| 9994 |
\cs_set:Npn \@@_tmp:n ##1 |
| 9995 |
{ |
| 9996 |
\int_if_exist:cT { g_@@_series_ \l_@@_series_name_tl _ \int_to_roman:n {##1} _int } |
| 9997 |
{ |
| 9998 |
\exp_args:Ne \int_set:cn { l_@@_start_ \int_to_roman:n {##1} _int } |
| 9999 |
{ |
| 10000 |
\int_use:c { g_@@_series_ \l_@@_series_name_tl _ \int_to_roman:n {##1} _int } + 1 |
| 10001 |
} |
| 10002 |
} |
| 10003 |
} |
| 10004 |
\int_compare:nNnT { \l_@@_level_int } > { 0 } |
| 10005 |
{ |
| 10006 |
\bool_lazy_and:nnTF |
| 10007 |
{ \bool_if_p:N \l_@@_standar_first_bool } |
| 10008 |
{ \bool_if_p:N \l_@@_store_active_bool } |
| 10009 |
{ |
| 10010 |
\int_set:Nn \l_@@_start_i_int |
| 10011 |
{ |
| 10012 |
\int_use:c { g_@@_resume_ \l_@@_store_name_tl _int } + 1 |
| 10013 |
} |
| 10014 |
} |
| 10015 |
{ |
| 10016 |
\int_step_function:nN { \l_@@_level_int } \@@_tmp:n |
| 10017 |
} |
| 10018 |
} |
| 10019 |
\int_compare:nNnT { \l_@@_level_h_int } = { 1 } |
| 10020 |
{ |
| 10021 |
\bool_lazy_and:nnTF |
| 10022 |
{ \bool_if_p:N \l_@@_starred_first_bool } |
| 10023 |
{ \bool_if_p:N \l_@@_store_active_bool } |
| 10024 |
{ |
| 10025 |
\int_set:Nn \l_@@_start_vii_int |
| 10026 |
{ |
| 10027 |
\int_use:c { g_@@_resume_ \l_@@_store_name_tl _int } + 1 |
| 10028 |
} |
| 10029 |
} |
| 10030 |
{ |
| 10031 |
\int_set:Nn \l_@@_start_vii_int |
| 10032 |
{ |
| 10033 |
\int_use:c { g_@@_series_ \l_@@_series_name_tl _vii_int } + 1 |
| 10034 |
} |
| 10035 |
} |
| 10036 |
} |
| 10037 |
} |
| 10038 |
% \end{macrocode} |
| 10039 |
% \end{macro} |
| 10040 |
% |
| 10041 |
% \subsubsection{Internal function for \texttt{resume*} key} |
| 10042 |
% |
| 10043 |
% \begin{macro}{\@@_resume_star:} |
| 10044 |
% The function \cs{@@_resume_star:} will handle the \mykey{resume*} |
| 10045 |
% key in the \myenv*{enumext} and \myenv*{enumext*} environments. This |
| 10046 |
% function will execute the filtered \mymeta{keys} in the last one and |
| 10047 |
% will continue with the numbering and \mymeta{keys} according to the |
| 10048 |
% last execution of the environment \myenv*{enumext} or \myenv*{enumext*} |
| 10049 |
% in which the keys \mykey{resume}|=|\mymarg{series name} or \mykey{series}|=|\mymarg{series name} |
| 10050 |
% were NOT active. |
| 10051 |
% \iffalse |
| 10052 |
%% Internal function for |resume*| key. |
| 10053 |
% \fi |
| 10054 |
% \begin{macrocode} |
| 10055 |
\cs_new_protected:Nn \@@_resume_star: |
| 10056 |
{ |
| 10057 |
\cs_set:Npn \@@_tmp:n ##1 |
| 10058 |
{ |
| 10059 |
\tl_if_empty:cTF { g_@@_resume_last_keys_ \int_to_roman:n {##1} _tl } |
| 10060 |
{ |
| 10061 |
\@@_resume_counter: |
| 10062 |
} |
| 10063 |
{ |
| 10064 |
\@@_resume_counter: |
| 10065 |
\exp_args:Ne \keys_set:nv |
| 10066 |
{ enumext / level-\int_use:N \l_@@_level_int } |
| 10067 |
{ g_@@_resume_last_keys_ \int_to_roman:n {##1} _tl } |
| 10068 |
} |
| 10069 |
} |
| 10070 |
\int_compare:nNnT { \l_@@_level_int } > { 0 } |
| 10071 |
{ |
| 10072 |
\int_step_function:nN { \l_@@_level_int } \@@_tmp:n |
| 10073 |
} |
| 10074 |
\int_compare:nNnT { \l_@@_level_h_int } = { 1 } |
| 10075 |
{ |
| 10076 |
\tl_if_empty:NTF \g_@@_resume_last_keys_vii_tl |
| 10077 |
{ |
| 10078 |
\@@_resume_counter: |
| 10079 |
} |
| 10080 |
{ |
| 10081 |
\@@_resume_counter: |
| 10082 |
\keys_set:nV { enumext / enumext* } \g_@@_resume_last_keys_vii_tl |
| 10083 |
} |
| 10084 |
} |
| 10085 |
} |
| 10086 |
% \end{macrocode} |
| 10087 |
% \end{macro} |
| 10088 |
% |
| 10089 |
% \subsection{The \cs{resetenumext} command}\label{cmd:resetenumext} |
| 10090 |
% |
| 10091 |
% Sometimes it is necessary to be able to reset the \emph{\enquote{counters}} |
| 10092 |
% of the environments according to some value, for example |\chapter|. Since we |
| 10093 |
% use \emph{\enquote{internal counters}} for the \mykey{resume} and \mykey{resume*} |
| 10094 |
% keys which set the \emph{start value}, but are not accessible by the user, |
| 10095 |
% it is to provide a public command for this. This implementation is an |
| 10096 |
% adaptation of the answers given by Clea F. Rees \texttt{(@cfr)} and |
| 10097 |
% Jonathan P. Spratte \texttt{(@Skillmon)} in \href{https://tex.stackexchange.com/q/746644}{Correct |
| 10098 |
% implementation of optional argument (comma-separated) in expl3}. |
| 10099 |
% |
| 10100 |
% \begin{macro}{\resetenumext} |
| 10101 |
% \begin{macro}[int]{\@@_standard_reset:nn, \@@_starred_reset:n, |
| 10102 |
% \@@_reset_count_resume:nn, \@@_reset_count_resume:en, |
| 10103 |
% \@@_reset_count_resume_all:n, \@@_reset_count_resume_levels:n, |
| 10104 |
% } |
| 10105 |
% The \ics*{resetenumext} command \emph{\enquote{resets}} the \emph{start value} |
| 10106 |
% of the \emph{\enquote{counters}} for the \myenv*{enumext} and \myenv*{enumext*} |
| 10107 |
% environments along with the \emph{\enquote{internal counters}} used by |
| 10108 |
% the keys \mykey{resume} \emph{without value} and \mykey{resume*} |
| 10109 |
% according to the value of \mymarg{some counter}. |
| 10110 |
% \iffalse |
| 10111 |
%% Definition of |\resetenumext| and internal function for this. |
| 10112 |
% \fi |
| 10113 |
% \begin{macrocode} |
| 10114 |
\NewDocumentCommand \resetenumext { s o m } |
| 10115 |
{ |
| 10116 |
\bool_if:nTF {#1} |
| 10117 |
{ |
| 10118 |
\@@_reset_count_resume_all:n {#3} |
| 10119 |
} |
| 10120 |
{ |
| 10121 |
\tl_if_novalue:nTF {#2} |
| 10122 |
{ |
| 10123 |
\@@_reset_count_resume_levels:n {#3} |
| 10124 |
} |
| 10125 |
{ |
| 10126 |
\str_if_eq:nnTF {#2} { * } |
| 10127 |
{ \@@_starred_reset:n {#3} } |
| 10128 |
{ |
| 10129 |
\bool_lazy_and:nnTF |
| 10130 |
{ \int_compare_p:nNn {#2} > 0 } |
| 10131 |
{ \int_compare_p:nNn {#2} < 5 } |
| 10132 |
{ \@@_standard_reset:nn {#2} {#3} } |
| 10133 |
{ |
| 10134 |
\msg_error:nne { enumext } { out-of-range } { \int_eval:n {#2} } |
| 10135 |
} |
| 10136 |
} |
| 10137 |
} |
| 10138 |
} |
| 10139 |
} |
| 10140 |
\cs_new_protected:Npn \@@_standard_reset:nn #1 %#2 |
| 10141 |
{ |
| 10142 |
\@@_reset_count_resume:en { \int_to_roman:n {#1} } %{#2} |
| 10143 |
} |
| 10144 |
\cs_new_protected:Npn \@@_starred_reset:n #1 |
| 10145 |
{ |
| 10146 |
\@@_reset_count_resume:nn { vii } {#1} |
| 10147 |
} |
| 10148 |
\cs_new_protected:Npn \@@_reset_count_resume:nn #1 #2 |
| 10149 |
{ |
| 10150 |
\counterwithin*{enumX#1}{#2} |
| 10151 |
\counterwithin*{@@_resume_#1_int}{#2} |
| 10152 |
} |
| 10153 |
\cs_generate_variant:Nn \@@_reset_count_resume:nn { e } |
| 10154 |
\cs_new_protected:Npn \@@_reset_count_resume_all:n #1 |
| 10155 |
{ |
| 10156 |
\clist_map_inline:nn { i,ii,iii,iv,vii } |
| 10157 |
{ |
| 10158 |
\@@_reset_count_resume:nn { ##1 } { #1 } |
| 10159 |
} |
| 10160 |
} |
| 10161 |
\cs_new_protected:Npn \@@_reset_count_resume_levels:n #1 |
| 10162 |
{ |
| 10163 |
\clist_map_inline:nn { i,ii,iii,iv } |
| 10164 |
{ |
| 10165 |
\@@_reset_count_resume:nn { ##1 } { #1 } |
| 10166 |
} |
| 10167 |
} |
| 10168 |
% \end{macrocode} |
| 10169 |
% \end{macro} |
| 10170 |
% \end{macro} |
| 10171 |
% |
| 10172 |
% \subsection{The \texttt{reset} and \texttt{reset*} keys}\label{key:reset} |
| 10173 |
% |
| 10174 |
% The |\resetenumext| command does not work, for example, after an |
| 10175 |
% unnumbered chapter, so it is preferable to provide a pair of \mymeta{keys} that |
| 10176 |
% adjust the internal variables if necessary. |
| 10177 |
% |
| 10178 |
% \begin{macro}[int]{reset, reset*, } |
| 10179 |
% We define the keys \mykey{reset} and \mykey{reset*} for the \emph{\enquote{all levels}} |
| 10180 |
% of \myenv*{enumext} and \myenv*{enumext*}. |
| 10181 |
% \iffalse |
| 10182 |
%% Add |reset| and |reset*| keys for |enumext| and |enumext*|. |
| 10183 |
% \fi |
| 10184 |
% \begin{macrocode} |
| 10185 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 10186 |
{ |
| 10187 |
\keys_define:nn { enumext / #1 } |
| 10188 |
{ |
| 10189 |
reset .code:n = \@@_standard_reset_key:, |
| 10190 |
reset .value_forbidden:n = true, |
| 10191 |
reset* .code:n = \@@_standard_reset_key_star:, |
| 10192 |
reset* .value_forbidden:n = true, |
| 10193 |
} |
| 10194 |
} |
| 10195 |
\clist_map_inline:nn {level-1, level-2, level-3, level-4} { \@@_tmp:n {#1} } |
| 10196 |
\keys_define:nn { enumext / enumext* } |
| 10197 |
{ |
| 10198 |
reset .code:n = \@@_starred_reset_key:, |
| 10199 |
reset .value_forbidden:n = true, |
| 10200 |
reset* .code:n = \@@_starred_reset_key:, |
| 10201 |
reset* .value_forbidden:n = true, |
| 10202 |
} |
| 10203 |
% \end{macrocode} |
| 10204 |
% \end{macro} |
| 10205 |
% |
| 10206 |
% \subsubsection{Internal functions for \texttt{reset} and \texttt{reset*} keys} |
| 10207 |
% |
| 10208 |
% \begin{macro}[int]{\@@_standard_reset_key:, \@@_standard_reset_key_star:, \@@_starred_reset_key: } |
| 10209 |
% The function \cs{@@_standard_reset_key:} will be handled by the |
| 10210 |
% \mykey{reset} key and will \emph{\enquote{reset}} the counter \myvarenv{c@__@@_resume_X_int} |
| 10211 |
% to \emph{\enquote{zero}} according to the \emph{level} at |
| 10212 |
% which it is executed within the \myenv*{enumext} environment. |
| 10213 |
% \iffalse |
| 10214 |
%% Internal functions for |reset| and |reset*| keys |
| 10215 |
% \fi |
| 10216 |
% \begin{macrocode} |
| 10217 |
\cs_new_protected:Nn \@@_standard_reset_key: |
| 10218 |
{ |
| 10219 |
\int_compare:nNnT { \l_@@_level_int } > { 0 } |
| 10220 |
{ |
| 10221 |
\int_if_exist:cT { c@ @@_resume_ \int_to_roman:n { \l_@@_level_int } _int } |
| 10222 |
{ |
| 10223 |
\int_gzero:c { c@ @@_resume_ \int_to_roman:n { \l_@@_level_int } _int } |
| 10224 |
} |
| 10225 |
} |
| 10226 |
} |
| 10227 |
% \end{macrocode} |
| 10228 |
% The function \cs{@@_standard_reset_key_star:} will be handled by the |
| 10229 |
% \mykey{reset*} key and will \emph{\enquote{reset}} the counters \myvarenv{c@__@@_resume_X_int} |
| 10230 |
% to \emph{\enquote{zero}} from the \emph{level} at which it |
| 10231 |
% is executed within the \myenv*{enumext} environment to the \emph{lower levels}. |
| 10232 |
% \begin{macrocode} |
| 10233 |
\cs_new_protected:Nn \@@_standard_reset_key_star: |
| 10234 |
{ |
| 10235 |
\cs_set:Npn \@@_tmp:n ##1 |
| 10236 |
{ |
| 10237 |
\int_if_exist:cT { c@ @@_resume_ \int_to_roman:n {##1} _int } |
| 10238 |
{ |
| 10239 |
\int_gzero:c { c@ @@_resume_ \int_to_roman:n {##1} _int } |
| 10240 |
} |
| 10241 |
} |
| 10242 |
\int_compare:nNnT { \l_@@_level_int } > { 0 } |
| 10243 |
{ |
| 10244 |
\int_step_function:nnN { \l_@@_level_int } { 4 } \@@_tmp:n |
| 10245 |
} |
| 10246 |
} |
| 10247 |
% \end{macrocode} |
| 10248 |
% The function \cs{@@_starred_reset_key:} will be handled by |
| 10249 |
% \mykey{reset} keys and \mykey{reset*} will \emph{\enquote{reset}} the |
| 10250 |
% counter \myvarenv{c@__@@_resume_vii_int} to \emph{\enquote{zero}} when |
| 10251 |
% executed in the \myenv*{enumext*} environment. |
| 10252 |
% \begin{macrocode} |
| 10253 |
\cs_new_protected:Nn \@@_starred_reset_key: |
| 10254 |
{ |
| 10255 |
\int_gzero:c { c@ @@_resume_vii_int } |
| 10256 |
} |
| 10257 |
% \end{macrocode} |
| 10258 |
% \end{macro} |
| 10259 |
% |
| 10260 |
% \subsection{Setting \texttt{save-ans}, \texttt{check-ans} and \texttt{no-store} keys} |
| 10261 |
% |
| 10262 |
% The key \mykey{save-ans} is directly associated with the keys |
| 10263 |
% \mykey{check-ans}, \mykey{no-store}, \mykey{resume} and |
| 10264 |
% \mykey{resume*}, this will activate the entire \emph{\enquote{storage |
| 10265 |
% system}} in the \mypkg*{enumext} package. |
| 10266 |
% |
| 10267 |
% \subsubsection{Setting \texttt{save-ans} key}\label{key:save-ans} |
| 10268 |
% |
| 10269 |
% \begin{macro}[int]{save-ans} |
| 10270 |
% We define the keys \mykey{save-ans} only for the \emph{\enquote{first level}} |
| 10271 |
% of \myenv*{enumext} and \myenv*{enumext*}. |
| 10272 |
% \iffalse |
| 10273 |
%% Add |save-ans| key only on first level off |enumext| and |enumext*|. |
| 10274 |
% \fi |
| 10275 |
% \begin{macrocode} |
| 10276 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 10277 |
{ |
| 10278 |
\keys_define:nn { enumext / #1 } |
| 10279 |
{ |
| 10280 |
save-ans .code:n = \@@_storing_set:n {##1}, |
| 10281 |
save-ans .value_required:n = true, |
| 10282 |
} |
| 10283 |
} |
| 10284 |
\clist_map_inline:nn { level-1, enumext* } { \@@_tmp:n {#1} } |
| 10285 |
% \end{macrocode} |
| 10286 |
% \end{macro} |
| 10287 |
% |
| 10288 |
% \subsubsection{Internal functions for \texttt{save-ans} key} |
| 10289 |
% |
| 10290 |
% \begin{macro}{\@@_start_save_ans_msg:, \@@_stop_save_ans_msg:,} |
| 10291 |
% The functions \cs{@@_start_save_ans_msg:} and \cs{@@_stop_save_ans_msg:} |
| 10292 |
% will display in the terminal and |.log| file the environment in which |
| 10293 |
% the \mykey{save-ans} key was executed along with the line at the |
| 10294 |
% beginning and end of it. The function \cs{@@_start_save_ans_msg:} will |
| 10295 |
% be passed to \cs{@@_storing_set:n} and the function |
| 10296 |
% \cs{@@_stop_save_ans_msg:} will be passed to the function |
| 10297 |
% \cs{@@_execute_after_env:}. |
| 10298 |
% \iffalse |
| 10299 |
%% Print/write start and stop environment with |save-ans| key active. |
| 10300 |
% \fi |
| 10301 |
% \begin{macrocode} |
| 10302 |
\cs_new_protected:Nn \@@_start_save_ans_msg: |
| 10303 |
{ |
| 10304 |
\msg_term:nnVV { enumext } { save-ans-log } |
| 10305 |
\g_@@_envir_name_tl \l_@@_store_name_tl |
| 10306 |
} |
| 10307 |
\cs_new_protected:Nn \@@_stop_save_ans_msg: |
| 10308 |
{ |
| 10309 |
\msg_term:nnVV { enumext } { save-ans-log-hook } |
| 10310 |
\g_@@_envir_name_tl \g_@@_store_name_tl |
| 10311 |
} |
| 10312 |
% \end{macrocode} |
| 10313 |
% \end{macro} |
| 10314 |
% |
| 10315 |
% \begin{macro}{\@@_storing_set:n, \@@_storing_exec:,} |
| 10316 |
% The function \cs{@@_storing_set:n} first pass the value of the |
| 10317 |
% \mykey{save-ans} key to the variable \cs{l_@@_store_name_tl} |
| 10318 |
% which will contain the \mymarg{store name} of the \emph{sequence} |
| 10319 |
% and \emph{prop list} we will use. If \cs{l_@@_store_name_tl} is |
| 10320 |
% \emph{empty} we return an error message, otherwise will return the |
| 10321 |
% appropriate message \cs{@@_start_save_ans_msg:} and proceed to execute |
| 10322 |
% the function \cs{@@_storing_exec:} for \myenv*{enumext} and |
| 10323 |
% \myenv*{enumext*} environments. |
| 10324 |
% \iffalse |
| 10325 |
%% Function to activate ALL "storing" (and |check-ans|, |no-store|, |resume|, |anskey*|) used by |save-ans| key. |
| 10326 |
% \fi |
| 10327 |
% \begin{macrocode} |
| 10328 |
\cs_new_protected:Npn \@@_storing_set:n #1 |
| 10329 |
{ |
| 10330 |
\tl_set:Ne \l_@@_store_name_tl {#1} |
| 10331 |
\tl_if_empty:NTF \l_@@_store_name_tl |
| 10332 |
{ |
| 10333 |
\bool_lazy_or:nnT |
| 10334 |
{ \l_@@_standar_first_bool } { \l_@@_starred_first_bool } |
| 10335 |
{ |
| 10336 |
\msg_error:nnV { enumext } { save-ans-empty } \g_@@_envir_name_tl |
| 10337 |
} |
| 10338 |
} |
| 10339 |
{ |
| 10340 |
\bool_lazy_or:nnT |
| 10341 |
{ \l_@@_standar_first_bool } { \l_@@_starred_first_bool } |
| 10342 |
{ |
| 10343 |
\@@_start_save_ans_msg: |
| 10344 |
\@@_storing_exec: |
| 10345 |
} |
| 10346 |
} |
| 10347 |
} |
| 10348 |
% \end{macrocode} |
| 10349 |
% The function \cs{@@_storing_exec:} will set to true the variable |
| 10350 |
% \cs{l_@@_store_active_bool} which activates the use of the |
| 10351 |
% \ics*{anskey} command and the \myenv*{anskey*}, \myenv*{keyans}, |
| 10352 |
% \myenv*{keyans*} and \myenv*{keyanspic} environments and will set |
| 10353 |
% to \enquote{true} the variable \cs{l_@@_check_answers_bool} used for |
| 10354 |
% internal checking answers mechanism set by the \mykey{check-ans} and \mykey{no-store} |
| 10355 |
% keys, copy \mymarg{store name} into the variable \cs{g_@@_store_name_tl}. |
| 10356 |
% \begin{macrocode} |
| 10357 |
\cs_new_protected:Nn \@@_storing_exec: |
| 10358 |
{ |
| 10359 |
\bool_set_true:N \l_@@_store_active_bool |
| 10360 |
\bool_set_true:N \l_@@_check_answers_bool |
| 10361 |
\tl_gset:NV \g_@@_store_name_tl \l_@@_store_name_tl |
| 10362 |
% \end{macrocode} |
| 10363 |
% The \emph{prop list} \myvarenv{g__@@_series_\mymeta[cf=gray]{store |
| 10364 |
% name}_prop} and the \emph{sequence} \myvarenv{g__@@_series_\mymeta[cf=gray]{store name}_seq} |
| 10365 |
% will be created globally to \emph{\enquote{store content}} in case |
| 10366 |
% they do not exist together with the integer variable |
| 10367 |
% \myvarenv{g__@@_series_\mymeta[cf=gray]{store name}_int} used by the keys |
| 10368 |
% \mykey{resume} and \mykey{resume*}. |
| 10369 |
% \begin{macrocode} |
| 10370 |
\prop_if_exist:cF { g_@@_ \l_@@_store_name_tl _prop } |
| 10371 |
{ |
| 10372 |
\msg_log:nnV { enumext } { store-prop } \l_@@_store_name_tl |
| 10373 |
\prop_new:c { g_@@_ \l_@@_store_name_tl _prop } |
| 10374 |
} |
| 10375 |
\seq_if_exist:cF { g_@@_ \l_@@_store_name_tl _seq } |
| 10376 |
{ |
| 10377 |
\msg_log:nnV { enumext } { store-seq } \l_@@_store_name_tl |
| 10378 |
\seq_new:c { g_@@_ \l_@@_store_name_tl _seq } |
| 10379 |
} |
| 10380 |
\int_if_exist:cF { g_@@_resume_ \l_@@_store_name_tl _int } |
| 10381 |
{ |
| 10382 |
\msg_log:nnV { enumext } { store-int } \l_@@_store_name_tl |
| 10383 |
\int_new:c { g_@@_resume_ \l_@@_store_name_tl _int } |
| 10384 |
} |
| 10385 |
} |
| 10386 |
% \end{macrocode} |
| 10387 |
% \end{macro} |
| 10388 |
% |
| 10389 |
% \subsubsection{The check answer mechanism}\label{int:check-answer} |
| 10390 |
% |
| 10391 |
% The internal mechanism for \emph{\enquote{checking answers}} follows this |
| 10392 |
% logic: |
| 10393 |
% |
| 10394 |
% \begin{quote} |
| 10395 |
% If the line begins with |\item| or |\item*| and does NOT |
| 10396 |
% \emph{open a nested environment}, each |\item| or |\item*| must contain a |
| 10397 |
% \emph{single} execution of the |\anskey| command, i.e. the counter of the |
| 10398 |
% executions of the |\anskey| command must be equal to the counter |
| 10399 |
% associated with the sum of executions of |\item| and |\item*|. |
| 10400 |
% |
| 10401 |
% If the line begins with |\item| or |\item*| and \emph{opens a nested |
| 10402 |
% environment} each |\item| or |\item*| in the nested environment must |
| 10403 |
% have a \emph{single} execution of the |\anskey| command and the counter |
| 10404 |
% associated to the sum of |\item| and |\item*| executions must decrementing |
| 10405 |
% by \emph{\enquote{one}} to maintain equality. |
| 10406 |
% |
| 10407 |
% \end{quote} |
| 10408 |
% |
| 10409 |
% In order for the mechanism for the check-answer to work (not counting |
| 10410 |
% \myenv*{keyans}, \myenv*{keyans*} and \myenv*{keyanspic}) we need: |
| 10411 |
% |
| 10412 |
% \begin{enumerate}[left=0pt,noitemsep, partopsep=0pt, topsep=5pt] |
| 10413 |
% \item We must keep track of the total number of |\item| and |\item*| (enumerated) that appear within |
| 10414 |
% the environment including the nested levels. |
| 10415 |
% \item We must keep track of the total number of |\item| and |\item*| (enumerated) that appear per |
| 10416 |
% level of nesting. |
| 10417 |
% \item Keeping track of the number of times the environment nests. |
| 10418 |
% \end{enumerate} |
| 10419 |
% |
| 10420 |
% |
| 10421 |
% The integer variable associated to the sum of each |\item| and |\item*| |
| 10422 |
% in the environment \myvarenv{g__@@_item_number_int} must match the |
| 10423 |
% integer variable \myvarenv{g__@@_item_anskey_int} associated |
| 10424 |
% to the execution of the command |\anskey|. We analyze the cases: |
| 10425 |
% |
| 10426 |
% \begin{enumerate}[label=\alph*),left=0pt,noitemsep, partopsep=0pt, topsep=5pt] |
| 10427 |
% \item If the list only has one level the number of |\item + \item*| = \ics*{anskey} |
| 10428 |
% |
| 10429 |
% \item If the list has \emph{nested levels}, for each level of nesting we need to |
| 10430 |
% decrementing by one (for the |\item| or |\item*| that opens the nest) so that the account |
| 10431 |
% remains the same. |
| 10432 |
% \end{enumerate} |
| 10433 |
% |
| 10434 |
% With \myenv*{keyans}, \myenv*{keyans*} and \myenv*{keyanspic} it is |
| 10435 |
% enough to increase in one the integer of \ics*{anskey}. The integers |
| 10436 |
% created must be global if they are not lost in the interior levels of |
| 10437 |
% nesting and to execute the test we will use a \emph{\enquote{hook}} |
| 10438 |
% function after closing the \emph{first level} of the environment. |
| 10439 |
% |
| 10440 |
% \subsubsection{Setting \texttt{check-ans} and \texttt{no-store} keys}\label{key:check-ans} |
| 10441 |
% |
| 10442 |
% \begin{macro}[int]{check-ans, no-store} |
| 10443 |
% Now we define the keys \mykey{check-ans} and \mykey{no-store} for all |
| 10444 |
% levels of \myenv*{enumext} and \myenv*{enumext*} environments. |
| 10445 |
% \iffalse |
| 10446 |
%% Add |check-ans| and |no-store| keys. |
| 10447 |
% \fi |
| 10448 |
% \begin{macrocode} |
| 10449 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 10450 |
{ |
| 10451 |
\keys_define:nn { enumext / #1 } |
| 10452 |
{ |
| 10453 |
check-ans .bool_set:N = \l_@@_check_ans_key_bool, |
| 10454 |
check-ans .initial:n = false, |
| 10455 |
check-ans .value_required:n = true, |
| 10456 |
no-store .code:n = { |
| 10457 |
\bool_set_false:N \l_@@_check_answers_bool |
| 10458 |
\bool_set_false:N \l_@@_check_ans_key_bool |
| 10459 |
}, |
| 10460 |
no-store .value_forbidden:n = true, |
| 10461 |
} |
| 10462 |
} |
| 10463 |
\clist_map_inline:nn |
| 10464 |
{ |
| 10465 |
level-1, level-2, level-3, level-4, enumext* |
| 10466 |
} |
| 10467 |
{ \@@_tmp:n {#1} } |
| 10468 |
% \end{macrocode} |
| 10469 |
% \end{macro} |
| 10470 |
% |
| 10471 |
% \subsubsection{Set-up check answer mechanism}\label{int:set-check-answer} |
| 10472 |
% |
| 10473 |
% \begin{macro}{\@@_check_ans_active:, \@@_check_ans_level:,} |
| 10474 |
% The function \cs{@@_check_ans_active:} will first check the state of |
| 10475 |
% the variable \cs{l_@@_store_name_tl}, that is, the \mykey{save-ans} key |
| 10476 |
% is active, if so it will check the state of the variable |
| 10477 |
% \cs{l_@@_check_answers_bool} handled by the key \mykey{no-store} and |
| 10478 |
% will execute the function \cs{@@_check_ans_level:} only if |
| 10479 |
% \emph{\enquote{true}}, i.e. the key \mykey{no-store} is not active. |
| 10480 |
% \iffalse |
| 10481 |
%% Internal function for checking answer mechanism in |enumext| and |enumext*| environments. |
| 10482 |
% \fi |
| 10483 |
% \begin{macrocode} |
| 10484 |
\cs_new_protected:Nn \@@_check_ans_active: |
| 10485 |
{ |
| 10486 |
\tl_if_empty:NF \l_@@_store_name_tl |
| 10487 |
{ |
| 10488 |
\bool_if:NT \l_@@_check_answers_bool |
| 10489 |
{ |
| 10490 |
\@@_check_ans_level: |
| 10491 |
} |
| 10492 |
} |
| 10493 |
} |
| 10494 |
% \end{macrocode} |
| 10495 |
% The function \cs{@@_check_ans_level:} will decrement by \emph{\enquote{one}} |
| 10496 |
% the value of the variable \cs{g_@@_item_number_int} which keeps track |
| 10497 |
% of the executions of |\item| and |\item*| for each level of nesting |
| 10498 |
% of the environment \myenv*{enumext}, taking into account whether it |
| 10499 |
% is nested within \myenv*{enumext*} or the opposite and set \cs{l_@@_item_number_bool} |
| 10500 |
% to \emph{\enquote{false}} . |
| 10501 |
% \iffalse |
| 10502 |
%% Decrementing \g_@@_item_number_int for nested level. |
| 10503 |
% \fi |
| 10504 |
% \begin{macrocode} |
| 10505 |
\cs_new_protected:Nn \@@_check_ans_level: |
| 10506 |
{ |
| 10507 |
\int_case:nn { \l_@@_level_int } |
| 10508 |
{ |
| 10509 |
{ 1 }{ |
| 10510 |
\bool_lazy_all:nT |
| 10511 |
{ |
| 10512 |
{ \bool_if_p:N \g_@@_starred_bool } |
| 10513 |
{ \int_compare_p:nNn { \l_@@_level_h_int } = { 1 } } |
| 10514 |
} |
| 10515 |
{ |
| 10516 |
\int_gdecr:N \g_@@_item_number_int |
| 10517 |
\bool_set_false:N \l_@@_item_number_bool |
| 10518 |
} |
| 10519 |
} |
| 10520 |
{ 2 }{ |
| 10521 |
\int_gdecr:N \g_@@_item_number_int |
| 10522 |
\bool_set_false:N \l_@@_item_number_bool |
| 10523 |
} |
| 10524 |
{ 3 }{ |
| 10525 |
\int_gdecr:N \g_@@_item_number_int |
| 10526 |
\bool_set_false:N \l_@@_item_number_bool |
| 10527 |
} |
| 10528 |
{ 4 }{ |
| 10529 |
\int_gdecr:N \g_@@_item_number_int |
| 10530 |
\bool_set_false:N \l_@@_item_number_bool |
| 10531 |
} |
| 10532 |
} |
| 10533 |
% \end{macrocode} |
| 10534 |
% We should only execute this if \myenv*{enumext*} is nested in the |
| 10535 |
% \emph{\enquote{first level}} of \myenv*{enumext}, for the rest of the |
| 10536 |
% cases the value of \cs{g_@@_item_number_int} is already decreased. |
| 10537 |
% \begin{macrocode} |
| 10538 |
\int_case:nn { \l_@@_level_h_int } |
| 10539 |
{ |
| 10540 |
{ 1 }{ |
| 10541 |
\bool_lazy_all:nT |
| 10542 |
{ |
| 10543 |
{ \bool_if_p:N \g_@@_standar_bool } |
| 10544 |
{ \int_compare_p:nNn { \l_@@_level_int } = { 1 } } |
| 10545 |
} |
| 10546 |
{ |
| 10547 |
\int_gdecr:N \g_@@_item_number_int |
| 10548 |
\bool_set_false:N \l_@@_item_number_bool |
| 10549 |
} |
| 10550 |
} |
| 10551 |
} |
| 10552 |
} |
| 10553 |
% \end{macrocode} |
| 10554 |
% \end{macro} |
| 10555 |
% |
| 10556 |
% \begin{macro}{\@@_check_ans_key_hook:} |
| 10557 |
% The function \cs{@@_check_ans_key_hook:} will \emph{export} the status |
| 10558 |
% of the local variable \cs{l_@@_check_ans_key_bool} to the global variable |
| 10559 |
% \cs{g_@@_check_ans_key_bool} only if the key \mykey{check-ans} is active. |
| 10560 |
% \iffalse |
| 10561 |
%% Function to export \l_@@_check_ans_key_bool for |check-ans| key. |
| 10562 |
% \fi |
| 10563 |
% \begin{macrocode} |
| 10564 |
\cs_new_protected:Nn \@@_check_ans_key_hook: |
| 10565 |
{ |
| 10566 |
\bool_lazy_and:nnT |
| 10567 |
{ \bool_if_p:N \l_@@_check_ans_key_bool } |
| 10568 |
{ \bool_if_p:N \g_@@_standar_bool } |
| 10569 |
{ |
| 10570 |
\bool_gset_true:N \g_@@_check_ans_key_bool |
| 10571 |
} |
| 10572 |
\bool_lazy_and:nnT |
| 10573 |
{ \bool_if_p:N \l_@@_check_ans_key_bool } |
| 10574 |
{ \bool_if_p:N \g_@@_starred_bool } |
| 10575 |
{ |
| 10576 |
\bool_gset_true:N \g_@@_check_ans_key_bool |
| 10577 |
} |
| 10578 |
} |
| 10579 |
% \end{macrocode} |
| 10580 |
% \end{macro} |
| 10581 |
% |
| 10582 |
% \begin{macro}{\@@_item_answer_diff:} |
| 10583 |
% The function \cs{@@_item_answer_diff:} will set the value of the |
| 10584 |
% variable \cs{g_@@_item_answer_diff_int} which is used by the functions |
| 10585 |
% \cs{@@_check_ans_show:} for the key \mykey{save-ans} and by the |
| 10586 |
% function \cs{@@_check_ans_log:} by the internal \emph{\enquote{check answer}} |
| 10587 |
% mechanism. This function will be passed to the function |
| 10588 |
% \cs{@@_execute_after_env:}. |
| 10589 |
% \iffalse |
| 10590 |
%% Set \g_@@_item_answer_diff_int for |check-ans| key and internal. |
| 10591 |
% \fi |
| 10592 |
% \begin{macrocode} |
| 10593 |
\cs_new_protected:Nn \@@_item_answer_diff: |
| 10594 |
{ |
| 10595 |
\int_gset:Nn \g_@@_item_answer_diff_int |
| 10596 |
{ |
| 10597 |
\int_sign:n { \g_@@_item_number_int - \g_@@_item_anskey_int } |
| 10598 |
} |
| 10599 |
} |
| 10600 |
% \end{macrocode} |
| 10601 |
% \end{macro} |
| 10602 |
% |
| 10603 |
% \begin{macro}{\@@_check_ans_show:, \@@_check_ans_msg_less:, |
| 10604 |
% \@@_check_ans_msg_same_ok:, \@@_check_ans_msg_greater:} |
| 10605 |
% The function \cs{@@_check_ans_show:} will be executed within the |
| 10606 |
% function \cs{@@_execute_after_env:} when the key \mykey{check-ans} is |
| 10607 |
% active, that is, when \cs{g_@@_check_ans_key_bool} is \emph{\enquote{true}} |
| 10608 |
% and will return the appropriate message according to the value of |
| 10609 |
% \cs{g_@@_item_answer_diff_int} set by the function \cs{@@_item_answer_diff:}. |
| 10610 |
% \iffalse |
| 10611 |
%% Function to print |check-ans| key. |
| 10612 |
% \fi |
| 10613 |
% \begin{macrocode} |
| 10614 |
\cs_new_protected:Nn \@@_check_ans_show: |
| 10615 |
{ |
| 10616 |
\int_case:nn { \g_@@_item_answer_diff_int } |
| 10617 |
{ |
| 10618 |
{ -1 }{ \@@_check_ans_msg_less: } |
| 10619 |
{ 0 }{ \@@_check_ans_msg_same_ok: } |
| 10620 |
{ 1 }{ \@@_check_ans_msg_greater: } |
| 10621 |
} |
| 10622 |
} |
| 10623 |
\cs_new_protected:Nn \@@_check_ans_msg_less: |
| 10624 |
{ |
| 10625 |
\msg_warning:nneee { enumext } { item-less-answer } { \g_@@_store_name_tl } |
| 10626 |
{ \g_@@_envir_name_tl } { \g_@@_start_line_tl } |
| 10627 |
} |
| 10628 |
\cs_new_protected:Nn \@@_check_ans_msg_same_ok: |
| 10629 |
{ |
| 10630 |
\msg_term:nneee { enumext } { items-same-answer } { \g_@@_store_name_tl } |
| 10631 |
{ \g_@@_envir_name_tl } { \g_@@_start_line_tl } |
| 10632 |
} |
| 10633 |
\cs_new_protected:Nn \@@_check_ans_msg_greater: |
| 10634 |
{ |
| 10635 |
\msg_warning:nneee { enumext } { item-greater-answer } { \g_@@_store_name_tl } |
| 10636 |
{ \g_@@_envir_name_tl } { \g_@@_start_line_tl } |
| 10637 |
} |
| 10638 |
% \end{macrocode} |
| 10639 |
% \end{macro} |
| 10640 |
% \begin{macro}{\@@_check_ans_log:, \@@_check_ans_log_msg_less:, |
| 10641 |
% \@@_check_ans_log_msg_same_ok:, \@@_check_ans_log_msg_greater:} |
| 10642 |
% The function \cs{@@_check_ans_log:} will be executed within the |
| 10643 |
% function \cs{@@_execute_after_env:} when the key \mykey{check-ans} is |
| 10644 |
% not active, that is, when \cs{g_@@_check_ans_key_bool} is \emph{\enquote{false}} |
| 10645 |
% and write in the log the appropriate message according to the value of |
| 10646 |
% \cs{g_@@_item_answer_diff_int} set by the function |
| 10647 |
% \cs{@@_item_answer_diff:}. |
| 10648 |
% \iffalse |
| 10649 |
%% Function to log check-answer mechanisms. |
| 10650 |
% \fi |
| 10651 |
% \begin{macrocode} |
| 10652 |
\cs_new_protected:Nn \@@_check_ans_log: |
| 10653 |
{ |
| 10654 |
\int_case:nn { \g_@@_item_answer_diff_int } |
| 10655 |
{ |
| 10656 |
{ -1 }{ \@@_check_ans_log_msg_less: } |
| 10657 |
{ 0 }{ \@@_check_ans_log_msg_same_ok: } |
| 10658 |
{ 1 }{ \@@_check_ans_log_msg_greater: } |
| 10659 |
} |
| 10660 |
} |
| 10661 |
\cs_new_protected:Nn \@@_check_ans_log_msg_less: |
| 10662 |
{ |
| 10663 |
\msg_log:nneee { enumext } { item-less-answer } { \g_@@_store_name_tl } |
| 10664 |
{ \g_@@_envir_name_tl } { \g_@@_start_line_tl } |
| 10665 |
} |
| 10666 |
\cs_new_protected:Nn \@@_check_ans_log_msg_same_ok: |
| 10667 |
{ |
| 10668 |
\msg_log:nneee { enumext } { items-same-answer } { \g_@@_store_name_tl } |
| 10669 |
{ \g_@@_envir_name_tl } { \g_@@_start_line_tl } |
| 10670 |
} |
| 10671 |
\cs_new_protected:Nn \@@_check_ans_log_msg_greater: |
| 10672 |
{ |
| 10673 |
\msg_log:nneee { enumext } { item-greater-answer } { \g_@@_store_name_tl } |
| 10674 |
{ \g_@@_envir_name_tl } { \g_@@_start_line_tl } |
| 10675 |
} |
| 10676 |
% \end{macrocode} |
| 10677 |
% \end{macro} |
| 10678 |
% |
| 10679 |
% \subsubsection{Check for \cs{item*} and \cs{anspic*} commands} |
| 10680 |
% |
| 10681 |
% \begin{macro}{\@@_check_starred_cmd:n,} |
| 10682 |
% The function \cs{@@_check_starred_cmd:n} performs an \emph{extra check} |
| 10683 |
% for the \myenv*{keyans}, \myenv*{keyans*} and \myenv*{keyanspic} environments. |
| 10684 |
% Unlike the \emph{check} executed by \mykey{check-ans} key this one |
| 10685 |
% is not controlled by any key, it is intended to prevent the forgetting |
| 10686 |
% of \ics*{item*} or \ics*{anspic*} in these environments. |
| 10687 |
% \iffalse |
| 10688 |
%% Function for check |\item*| and |\anspic*| commands. |
| 10689 |
% \fi |
| 10690 |
% \begin{macrocode} |
| 10691 |
\cs_new_protected:Npn \@@_check_starred_cmd:n #1 |
| 10692 |
{ |
| 10693 |
\int_compare:nNnT |
| 10694 |
{ \g_@@_check_starred_cmd_int } = { 0 } |
| 10695 |
{ |
| 10696 |
\msg_warning:nnnV |
| 10697 |
{ enumext } { missing-starred }{ #1 } \l_@@_check_start_line_env_tl |
| 10698 |
} |
| 10699 |
\int_compare:nNnT |
| 10700 |
{ \g_@@_check_starred_cmd_int } > { 1 } |
| 10701 |
{ |
| 10702 |
\msg_warning:nnnV |
| 10703 |
{ enumext } { many-starred }{ #1 } \l_@@_check_start_line_env_tl |
| 10704 |
} |
| 10705 |
\int_gzero:N \g_@@_check_starred_cmd_int |
| 10706 |
\tl_clear:N \l_@@_check_start_line_env_tl |
| 10707 |
} |
| 10708 |
% \end{macrocode} |
| 10709 |
% \end{macro} |
| 10710 |
% |
| 10711 |
% \subsection{Keys and functions associated with storage}\label{int:storage-system} |
| 10712 |
% |
| 10713 |
% \subsubsection{Keys for \texttt{marks}, \texttt{wrap} and \texttt{show}} |
| 10714 |
% |
| 10715 |
% The \mypkg*{enumext} package provides a set of \mymeta{keys} for |
| 10716 |
% manipulating \emph{\enquote{symbol marks}} associated with \emph{\enquote{answers}} |
| 10717 |
% and how they are displayed and stored in the \emph{sequence} and \emph{prop list} |
| 10718 |
% as well as an internal \emph{\enquote{label and ref}} system. |
| 10719 |
% |
| 10720 |
% \begin{macro}[int]{mark-ans*, mark-pos*, mark-sep*, wrap-ans*, wrap-opt, |
| 10721 |
% save-sep, show-ans, show-pos} |
| 10722 |
% For the \myenv*{keyans} and \myenv*{keyans*} environments we will |
| 10723 |
% only add the keys \mykey{mark-ans*}, \mykey{mark-pos*}, \mykey{mark-sep*}, |
| 10724 |
% \mykey{wrap-ans*}, \mykey{wrap-opt}, \mykey{save-sep}, \mykey{show-ans} |
| 10725 |
% and \mykey{show-pos}. |
| 10726 |
% \iffalse |
| 10727 |
%% Add the keys for marks style and show for |keyans| and |keyans*| environments. |
| 10728 |
% \fi |
| 10729 |
% \begin{macrocode} |
| 10730 |
\cs_set_protected:Npn \@@_tmp:nn #1 #2 |
| 10731 |
{ |
| 10732 |
\keys_define:nn { enumext / #1 } |
| 10733 |
{ |
| 10734 |
mark-ans* .tl_set:c = { l_@@_mark_answer_sym_#2_tl }, |
| 10735 |
mark-ans* .initial:n = \textasteriskcentered, |
| 10736 |
mark-ans* .value_required:n = true, |
| 10737 |
mark-pos* .choice:, |
| 10738 |
mark-pos* / left .code:n = \str_set:cn { l_@@_mark_position_#2_str } { l }, |
| 10739 |
mark-pos* / right .code:n = \str_set:cn { l_@@_mark_position_#2_str } { r }, |
| 10740 |
mark-pos* / center .code:n = \str_set:cn { l_@@_mark_position_#2_str } { c }, |
| 10741 |
mark-pos* / unknown .code:n = |
| 10742 |
\msg_error:nneee { enumext } { unknown-choice } |
| 10743 |
{ mark-pos } { left,~right,~center } { \exp_not:n {##1} }, |
| 10744 |
mark-pos* .initial:n = right, |
| 10745 |
mark-pos* .value_required:n = true, |
| 10746 |
mark-sep* .dim_set:c = { l_@@_mark_sym_sep_#2_dim }, |
| 10747 |
mark-sep* .value_required:n = true, |
| 10748 |
wrap-ans* .cs_set_protected:cp = { @@_keyans_wrapper_item_#2:n } ##1, |
| 10749 |
wrap-ans* .value_required:n = true, |
| 10750 |
wrap-opt .cs_set_protected:cp = { @@_keyans_wrapper_opt_#2:n } ##1, |
| 10751 |
wrap-opt .initial:n = [{##1}], |
| 10752 |
wrap-opt .value_required:n = true, |
| 10753 |
save-sep .tl_set:c = { l_@@_store_keyans_item_opt_sep_#2_tl }, |
| 10754 |
save-sep .initial:n = {,~}, |
| 10755 |
save-sep .value_required:n = true, |
| 10756 |
show-ans .bool_set:N = \l_@@_show_answer_bool, |
| 10757 |
show-ans .initial:n = false, |
| 10758 |
show-ans .value_required:n = true, |
| 10759 |
show-pos .bool_set:N = \l_@@_show_position_bool, |
| 10760 |
show-pos .initial:n = false, |
| 10761 |
show-pos .value_required:n = true, |
| 10762 |
} |
| 10763 |
} |
| 10764 |
\clist_map_inline:nn { {keyans}{v}, {keyans*}{viii} } { \@@_tmp:nn #1 } |
| 10765 |
% \end{macrocode} |
| 10766 |
% \end{macro} |
| 10767 |
% |
| 10768 |
% \begin{macro}[int]{mark-ref, save-ref, show-ans, show-pos, mark-ans, |
| 10769 |
% mark-pos, mark-sep, wrap-ans, mark-ans*, mark-pos*, |
| 10770 |
% mark-sep*, wrap-ans*, wrap-opt, save-sep,} |
| 10771 |
% We add the \mymeta{keys} \mykey{mark-ref} and \mykey{save-ref} related to the |
| 10772 |
% \emph{\enquote{storage system}} and internal mechanism of |
| 10773 |
% \emph{\enquote{label and ref}} along with the \mymeta{keys} \mykey{show-ans}, |
| 10774 |
% \mykey{show-pos} and the\mymeta{keys} \mykey{mark-ans}, \mykey{mark-pos}, |
| 10775 |
% \mykey{mark-sep} and \mykey{wrap-ans} for the command |\anskey|, |
| 10776 |
% the environment \myenv*{anskey*} and the the \mymeta{keys} for environments |
| 10777 |
% \myenv*{keyans} and \myenv*{keyans*} only at the \emph{first level} |
| 10778 |
% of \myenv*{enumext} and \myenv*{enumext*}. |
| 10779 |
% \iffalse |
| 10780 |
%% Add keys associated with mark and internal label/ref on first level of |enumext| and |enumext*| environments. |
| 10781 |
% \fi |
| 10782 |
% \begin{macrocode} |
| 10783 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 10784 |
{ |
| 10785 |
\keys_define:nn { enumext / #1 } |
| 10786 |
{ |
| 10787 |
mark-ref .tl_set:N = \l_@@_mark_ref_sym_tl, |
| 10788 |
mark-ref .initial:n = \textreferencemark, |
| 10789 |
mark-ref .value_required:n = true, |
| 10790 |
save-ref .bool_set:N = \l_@@_store_ref_key_bool, |
| 10791 |
save-ref .initial:n = false, |
| 10792 |
save-ref .value_required:n = true, |
| 10793 |
show-ans .bool_set:N = \l_@@_show_answer_bool, |
| 10794 |
show-ans .initial:n = false, |
| 10795 |
show-ans .value_required:n = true, |
| 10796 |
show-pos .bool_set:N = \l_@@_show_position_bool, |
| 10797 |
show-pos .initial:n = false, |
| 10798 |
show-pos .value_required:n = true, |
| 10799 |
mark-ans .tl_set:N = \l_@@_mark_answer_sym_tl, |
| 10800 |
mark-ans .initial:n = \textasteriskcentered, |
| 10801 |
mark-ans .value_required:n = true, |
| 10802 |
mark-sep .dim_set:N = \l_@@_mark_sym_sep_dim, |
| 10803 |
mark-sep .value_required:n = true, |
| 10804 |
mark-pos .choice:, |
| 10805 |
mark-pos / left .code:n = \str_set:Nn \l_@@_mark_position_str { l }, |
| 10806 |
mark-pos / right .code:n = \str_set:Nn \l_@@_mark_position_str { r }, |
| 10807 |
mark-pos / center .code:n = \str_set:Nn \l_@@_mark_position_str { c }, |
| 10808 |
mark-pos / unknown .code:n = |
| 10809 |
\msg_error:nneee { enumext } { unknown-choice } |
| 10810 |
{ mark-pos } { left,~right,~center } { \exp_not:n {##1} }, |
| 10811 |
mark-pos .initial:n = right, |
| 10812 |
mark-pos .value_required:n = true, |
| 10813 |
|
| 10814 |
wrap-ans .cs_set_protected:Np = \@@_anskey_wrapper:n ##1, |
| 10815 |
wrap-ans .initial:n = |
| 10816 |
{ |
| 10817 |
\fbox{\parbox[t]{\dimeval{\itemwidth -2\fboxsep -2\fboxrule}}{##1}} |
| 10818 |
}, |
| 10819 |
wrap-ans .value_required:n = true, |
| 10820 |
mark-ans* .code:n = { |
| 10821 |
\keys_set:nn { enumext / keyans } { mark-ans* = {##1} } |
| 10822 |
\keys_set:nn { enumext / keyans* } { mark-ans* = {##1} } |
| 10823 |
}, |
| 10824 |
mark-ans* .value_required:n = true, |
| 10825 |
mark-pos* .code:n = { |
| 10826 |
\keys_set:nn { enumext / keyans } { mark-pos* = {##1} } |
| 10827 |
\keys_set:nn { enumext / keyans* } { mark-pos* = {##1} } |
| 10828 |
}, |
| 10829 |
mark-pos* .value_required:n = true, |
| 10830 |
mark-sep* .code:n = { |
| 10831 |
\keys_set:nn { enumext / keyans } { mark-sep* = {##1} } |
| 10832 |
\keys_set:nn { enumext / keyans* } { mark-sep* = {##1} } |
| 10833 |
}, |
| 10834 |
mark-sep* .value_required:n = true, |
| 10835 |
wrap-ans* .code:n = { |
| 10836 |
\keys_set:nn { enumext / keyans } { wrap-ans* = {##1} } |
| 10837 |
\keys_set:nn { enumext / keyans* } { wrap-ans* = {##1} } |
| 10838 |
}, |
| 10839 |
wrap-ans* .value_required:n = true, |
| 10840 |
wrap-opt .code:n = { |
| 10841 |
\keys_set:nn { enumext / keyans } { wrap-opt = {##1} } |
| 10842 |
\keys_set:nn { enumext / keyans* } { wrap-opt = {##1} } |
| 10843 |
}, |
| 10844 |
wrap-opt .value_required:n = true, |
| 10845 |
save-sep .code:n = { |
| 10846 |
\keys_set:nn { enumext / keyans } { save-sep = {##1} } |
| 10847 |
\keys_set:nn { enumext / keyans* } { save-sep = {##1} } |
| 10848 |
}, |
| 10849 |
save-sep .value_required:n = true, |
| 10850 |
} |
| 10851 |
} |
| 10852 |
\clist_map_inline:nn { level-1, enumext* } { \@@_tmp:n {#1} } |
| 10853 |
% \end{macrocode} |
| 10854 |
% \end{macro} |
| 10855 |
% |
| 10856 |
% \subsubsection{Storing structure of the environments} |
| 10857 |
% |
| 10858 |
% The idea behind \emph{\enquote{storing structure}} in the \emph{sequence} is |
| 10859 |
% to have a copy of the \emph{structure of the environment} in which the key |
| 10860 |
% \mykey{save-ans} is being executed so we must capture the \emph{optional |
| 10861 |
% argument} passed to the levels of the environment in which it is |
| 10862 |
% executed and \emph{\enquote{storing}} this in the \emph{sequence}. |
| 10863 |
% |
| 10864 |
% \begin{macro}{\@@_store_active_keys:n, \@@_store_active_keys_vii:n,} |
| 10865 |
% The functions \cs{@@_store_active_keys:n} and \cs{@@_store_active_keys_vii:n} |
| 10866 |
% will be responsible for the \emph{\enquote{storing keys}} filtered |
| 10867 |
% from the \emph{optional argument} of the environment in which the |
| 10868 |
% key \mykey{save-ans} is executed and the levels within this for the \myenv*{enumext} and |
| 10869 |
% \myenv*{enumext*} environments. We will execute this function only if |
| 10870 |
% the variable \cs{l_@@_store_save_key_X_bool} is false, that is, the key |
| 10871 |
% \mykey{store-key} is not active, establishing the variable |
| 10872 |
% \cs{l_@@_store_save_key_X_tl} with the filtered \mymeta{keys}. |
| 10873 |
% \iffalse |
| 10874 |
%% Internal function for store optional arguments of the environments in seq. |
| 10875 |
% \fi |
| 10876 |
% \begin{macrocode} |
| 10877 |
\cs_new_protected:Npn \@@_store_active_keys:n #1 |
| 10878 |
{ |
| 10879 |
\bool_if:cF { l_@@_store_save_key_ \@@_level: _bool } |
| 10880 |
{ |
| 10881 |
\tl_clear:c { l_@@_store_save_key_ \@@_level: _tl } |
| 10882 |
\tl_set:ce |
| 10883 |
{ l_@@_store_save_key_ \@@_level: _tl } |
| 10884 |
{ \@@_filter_save_key:n {#1} } |
| 10885 |
} |
| 10886 |
} |
| 10887 |
\cs_new_protected:Npn \@@_store_active_keys_vii:n #1 |
| 10888 |
{ |
| 10889 |
\bool_if:NF \l_@@_store_save_key_vii_bool |
| 10890 |
{ |
| 10891 |
\tl_clear:N \l_@@_store_save_key_vii_tl |
| 10892 |
\tl_set:Ne \l_@@_store_save_key_vii_tl { \@@_filter_save_key:n {#1} } |
| 10893 |
} |
| 10894 |
} |
| 10895 |
% \end{macrocode} |
| 10896 |
% \end{macro} |
| 10897 |
% |
| 10898 |
% \subsubsection{Setting \texttt{save-key} key}\label{key:save-key} |
| 10899 |
% |
| 10900 |
% Since this \emph{\enquote{storing structure}} in the \emph{sequence} |
| 10901 |
% established by the \mykey{save-ans} key when executing \ics*{anskey} or \myenv*{anskey*}, |
| 10902 |
% we will not be able to modify it. The best thing here is to have a key |
| 10903 |
% that allows you to modify the \emph{optional argument} of the \emph{\enquote{storing structure}} in |
| 10904 |
% the \emph{sequence}. |
| 10905 |
% |
| 10906 |
% \begin{macro}[int]{save-key} |
| 10907 |
% The values set by this key passed in the \emph{optional argument} of the |
| 10908 |
% \myenv*{enumext} and \myenv*{enumext*} environments will override the |
| 10909 |
% values of the \cs{l_@@_store_save_key_X_tl} variable set by the |
| 10910 |
% functions \cs{@@_store_active_keys:n} and \cs{@@_store_active_keys_vii:n}. |
| 10911 |
% Now define the key \mykey{save-key} for all levels of |
| 10912 |
% \myenv*{enumext} and \myenv*{enumext*} environments. |
| 10913 |
% \iffalse |
| 10914 |
%% Add |save-key| key for |enumext| and |enumext*| environments. |
| 10915 |
% \fi |
| 10916 |
% \begin{macrocode} |
| 10917 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 10918 |
{ |
| 10919 |
\keys_define:nn { enumext / enumext* } |
| 10920 |
{ |
| 10921 |
save-key .code:n = \@@_parse_save_key_vii:n {##1}, |
| 10922 |
save-key .value_required:n = true, |
| 10923 |
} |
| 10924 |
\keys_define:nn { enumext / #1 } |
| 10925 |
{ |
| 10926 |
save-key .code:n = \@@_parse_save_key:n {##1}, |
| 10927 |
save-key .value_required:n = true, |
| 10928 |
} |
| 10929 |
} |
| 10930 |
\clist_map_inline:nn { level-1, level-2, level-3, level-4 } { \@@_tmp:n {#1} } |
| 10931 |
% \end{macrocode} |
| 10932 |
% \end{macro} |
| 10933 |
% |
| 10934 |
% \begin{macro}{\@@_parse_save_key:n, \@@_parse_save_key_vii:n,} |
| 10935 |
% The functions \cs{@@_parse_save_key:n} and \cs{@@_parse_save_key_vii:n} |
| 10936 |
% will be responsible for \emph{\enquote{storing keys}} in the variable |
| 10937 |
% \myvarenv{l__@@_store_save_key_X_tl} for \myenv*{enumext} and \myenv*{enumext*}. |
| 10938 |
% \iffalse |
| 10939 |
%% Internal function for |save-key| key. |
| 10940 |
% \fi |
| 10941 |
% \begin{macrocode} |
| 10942 |
\cs_new_protected:Npn \@@_parse_save_key:n #1 |
| 10943 |
{ |
| 10944 |
\bool_set_true:c { l_@@_store_save_key_ \@@_level: _bool } |
| 10945 |
\tl_clear:c { l_@@_save_key_ \@@_level: _tl } |
| 10946 |
\tl_set:ce |
| 10947 |
{ l_@@_store_save_key_ \@@_level: _tl } |
| 10948 |
{ \@@_filter_save_key:n {#1} } |
| 10949 |
} |
| 10950 |
\cs_new_protected:Npn \@@_parse_save_key_vii:n #1 |
| 10951 |
{ |
| 10952 |
\bool_set_true:N \l_@@_store_save_key_vii_bool |
| 10953 |
\tl_clear:N \l_@@_store_save_key_vii_tl |
| 10954 |
\tl_set:Ne \l_@@_store_save_key_vii_tl { \@@_filter_save_key:n {#1} } |
| 10955 |
} |
| 10956 |
% \end{macrocode} |
| 10957 |
% \end{macro} |
| 10958 |
% |
| 10959 |
% \subsubsection{Internal functions to store optional arguments} |
| 10960 |
% |
| 10961 |
% \begin{macro}{\@@_filter_save_key:n, \@@_filter_save_key_key:n, |
| 10962 |
% \@@_filter_save_key_pair:nn} |
| 10963 |
% The function \cs{@@_filter_save_key:n} will be in charge of |
| 10964 |
% \emph{\enquote{filtering keys}} we want to \emph{stored} in |
| 10965 |
% \emph{sequence} where |{#1}| represents the \emph{optional argument} |
| 10966 |
% passed to the environment. |
| 10967 |
% \iffalse |
| 10968 |
%% Internal function for "filter keys" for |save-key| key. |
| 10969 |
% \fi |
| 10970 |
% \begin{macrocode} |
| 10971 |
\cs_new:Npn \@@_filter_save_key:n #1 |
| 10972 |
{ |
| 10973 |
\use:e |
| 10974 |
{ |
| 10975 |
\keyval_parse:NNn |
| 10976 |
\@@_filter_save_key_key:n |
| 10977 |
\@@_filter_save_key_pair:nn {#1} |
| 10978 |
} |
| 10979 |
} |
| 10980 |
% \end{macrocode} |
| 10981 |
% The function \cs{@@_filter_save_key_key:n} will be responsible for |
| 10982 |
% \emph{\enquote{filtering keys}} that are passed \emph{\enquote{without value}} |
| 10983 |
% by excluding the \mykey{resume}, \mykey{resume*}, \mykey{reset}, \mykey{reset*}, |
| 10984 |
% \mykey{no-store} and \mykey{base-fix} keys. |
| 10985 |
% \begin{macrocode} |
| 10986 |
\cs_new:Npn \@@_filter_save_key_key:n #1 |
| 10987 |
{ |
| 10988 |
\str_case:nnF {#1} |
| 10989 |
{ |
| 10990 |
{ resume } {} { resume* } {} { reset } {} { reset* } {} { no-store } {} { base-fix } {} |
| 10991 |
} |
| 10992 |
{ , { \exp_not:n {#1} } } |
| 10993 |
} |
| 10994 |
% \end{macrocode} |
| 10995 |
% The function \cs{@@_filter_save_key_pair:nn} will be responsible for |
| 10996 |
% \emph{\enquote{filtering keys}} that are passed \emph{\enquote{with value}} by |
| 10997 |
% excluding the \mykey{series}, \mykey{resume}, \mykey{save-ans}, \mykey{save-ref}, |
| 10998 |
% \mykey{save-key}, \mykey{check-ans}, \mykey{show-ans}, \mykey{save-pos}, |
| 10999 |
% \mykey{mark-ans}, \mykey{mark-pos}, \mykey{mark-sep}, \mykey{wrap-ans}, |
| 11000 |
% \mykey{mark-ans*}, \mykey{mark-pos*}, \mykey{mark-sep*}, \mykey{wrap-ans*}, |
| 11001 |
% \mykey{wrap-opt}, \mykey{save-sep}, \mykey{mark-ref}, \mykey{mini-env}, |
| 11002 |
% \mykey{mini-sep}, \mykey{mini-right} and \mykey{mini-right*} keys. |
| 11003 |
% \begin{macrocode} |
| 11004 |
\cs_new:Npn \@@_filter_save_key_pair:nn #1#2 |
| 11005 |
{ |
| 11006 |
\str_case:nnF {#1} |
| 11007 |
{ |
| 11008 |
{ series } {} { resume } {} { save-ans } {} { save-ref } {} |
| 11009 |
{ save-key } {} { check-ans } {} { show-ans } {} { show-pos } {} |
| 11010 |
{ mark-ans } {} { mark-pos } {} { mark-sep } {} { wrap-ans } {} |
| 11011 |
{ mark-ans* } {} { mark-pos* } {} { mark-sep* } {} { wrap-ans* } {} |
| 11012 |
{ wrap-opt } {} { save-sep } {} { mark-ref } {} { mini-env } {} |
| 11013 |
{ mini-sep } {} { mini-right } {} { mini-right* } {} |
| 11014 |
} |
| 11015 |
{ , { \exp_not:n {#1} } = { \exp_not:n {#2} } } |
| 11016 |
} |
| 11017 |
% \end{macrocode} |
| 11018 |
% \end{macro} |
| 11019 |
% |
| 11020 |
% \subsubsection{Function for storing content in prop list} |
| 11021 |
% |
| 11022 |
% \begin{macro}{\@@_store_addto_prop:n, \@@_store_addto_prop:V} |
| 11023 |
% The function \cs{@@_store_addto_prop:n} stores the \mymarg{content} in |
| 11024 |
% \emph{prop list} defined by \mykey{save-ans} key. The \emph{\enquote{stored |
| 11025 |
% content}} is retrieved by means of the \ics*{getkeyans} command. |
| 11026 |
% |
| 11027 |
% \smallskip |
| 11028 |
% |
| 11029 |
% The form in which the \mymarg{content} is \emph{\enquote{stored}} in the |
| 11030 |
% \emph{prop list} is \mymarg{position}\mymarg{content}. This |
| 11031 |
% function is used by \ics*{anskey} in \myenv*{enumext} and \myenv*{enumext*} |
| 11032 |
% environments, \ics*{item*} in \myenv*{keyans} and \myenv*{keyans*} |
| 11033 |
% environments and \ics*{anspic*} in \myenv*{keyanspic} environment. |
| 11034 |
% \iffalse |
| 11035 |
%% Function for store content to prop list. |
| 11036 |
% \fi |
| 11037 |
% \begin{macrocode} |
| 11038 |
\cs_new_protected:Npn \@@_store_addto_prop:n #1 |
| 11039 |
{ |
| 11040 |
\prop_gput_if_not_in:cen { g_@@_ \l_@@_store_name_tl _prop } |
| 11041 |
{ |
| 11042 |
\int_eval:n { \prop_count:c { g_@@_ \l_@@_store_name_tl _prop } + 1 } |
| 11043 |
} |
| 11044 |
{ #1 } |
| 11045 |
} |
| 11046 |
\cs_generate_variant:Nn \@@_store_addto_prop:n { V } |
| 11047 |
% \end{macrocode} |
| 11048 |
% \end{macro} |
| 11049 |
% |
| 11050 |
% \subsubsection{Function for storing content in sequence} |
| 11051 |
% |
| 11052 |
% \begin{macro}{\@@_store_addto_seq:n, \@@_store_addto_seq:v, \@@_store_addto_seq:V} |
| 11053 |
% The function \cs{@@_store_addto_seq:n} stores the \mymarg{content} in |
| 11054 |
% \emph{sequence} defined by \mykey{save-ans} key. This function |
| 11055 |
% is used by \ics*{anskey} in \myenv*{enumext}, \ics*{item*} in |
| 11056 |
% \myenv*{keyans} and \ics*{anspic} in \myenv*{keyanspic}. |
| 11057 |
% |
| 11058 |
% \smallskip |
| 11059 |
% |
| 11060 |
% The form in which the \mymarg{content} is stored in \emph{sequence} is in |
| 11061 |
% a internal \myenv*{enumext} or \myenv*{enumext*} environments with |
| 11062 |
% the \emph{\enquote{same structure}} in which the command was executed. |
| 11063 |
% |
| 11064 |
% The \emph{\enquote{stored content}} is retrieved by means of the |
| 11065 |
% \ics*{printkeyans} command. |
| 11066 |
% \iffalse |
| 11067 |
%% Function for store content to sequence. |
| 11068 |
% \fi |
| 11069 |
% \begin{macrocode} |
| 11070 |
\cs_new_protected:Npn \@@_store_addto_seq:n #1 |
| 11071 |
{ |
| 11072 |
\seq_gput_right:cn { g_@@_ \l_@@_store_name_tl _seq } { #1 } |
| 11073 |
} |
| 11074 |
\cs_generate_variant:Nn \@@_store_addto_seq:n { v, V } |
| 11075 |
% \end{macrocode} |
| 11076 |
% \end{macro} |
| 11077 |
% |
| 11078 |
% \subsubsection{Functions for storing structure in the sequence} |
| 11079 |
% |
| 11080 |
% \begin{macro}{\@@_store_level_open:, \@@_store_level_close:,} |
| 11081 |
% The \emph{\enquote{storing structure}} is handled by the functions |
| 11082 |
% \cs{@@_store_level_open:} and \cs{@@_store_level_close:} which are |
| 11083 |
% executed per level within the \myenv*{enumext} environment. |
| 11084 |
% \iffalse |
| 11085 |
%% Function for storing structure level execution of |\anskey| on |enumext| environment. |
| 11086 |
% \fi |
| 11087 |
% \begin{macrocode} |
| 11088 |
\cs_new_protected:Nn \@@_store_level_open: |
| 11089 |
{ |
| 11090 |
\bool_if:NT \l_@@_check_answers_bool |
| 11091 |
{ |
| 11092 |
\tl_if_empty:cTF { l_@@_store_save_key_ \@@_level: _tl } |
| 11093 |
{ |
| 11094 |
\@@_store_addto_seq:n |
| 11095 |
{ |
| 11096 |
\item \begin{enumext} |
| 11097 |
} |
| 11098 |
} |
| 11099 |
{ |
| 11100 |
\tl_put_left:cn { l_@@_store_save_key_ \@@_level: _tl } |
| 11101 |
{ |
| 11102 |
\item \begin{enumext} [ |
| 11103 |
} |
| 11104 |
\tl_put_right:cn { l_@@_store_save_key_ \@@_level: _tl } |
| 11105 |
{ |
| 11106 |
] |
| 11107 |
} |
| 11108 |
\@@_store_addto_seq:v { l_@@_store_save_key_ \@@_level: _tl } |
| 11109 |
} |
| 11110 |
} |
| 11111 |
} |
| 11112 |
\cs_new_protected:Nn \@@_store_level_close: |
| 11113 |
{ |
| 11114 |
\bool_if:NT \l_@@_check_answers_bool |
| 11115 |
{ |
| 11116 |
\@@_store_addto_seq:n { \end{enumext} } |
| 11117 |
} |
| 11118 |
} |
| 11119 |
% \end{macrocode} |
| 11120 |
% \end{macro} |
| 11121 |
% |
| 11122 |
% \begin{macro}{\@@_store_level_open_vii:, \@@_store_level_close_vii:,} |
| 11123 |
% The \emph{\enquote{storing structure}} is handled by the functions |
| 11124 |
% \cs{@@_store_level_open_vii:} and \cs{@@_store_level_close_vii:} |
| 11125 |
% which are executed in the \myenv*{enumext*} environment. |
| 11126 |
% |
| 11127 |
% \iffalse |
| 11128 |
%% Function storing structure level execution of |\anskey| and |anskey*| on |enumext*| environment. |
| 11129 |
% \fi |
| 11130 |
% \begin{macrocode} |
| 11131 |
\cs_new_protected:Nn \@@_store_level_open_vii: |
| 11132 |
{ |
| 11133 |
\bool_if:NT \l_@@_check_answers_bool |
| 11134 |
{ |
| 11135 |
\tl_if_empty:NTF \l_@@_store_save_key_vii_tl |
| 11136 |
{ |
| 11137 |
\@@_store_addto_seq:n |
| 11138 |
{ |
| 11139 |
\item \begin{enumext*} |
| 11140 |
} |
| 11141 |
} |
| 11142 |
{ |
| 11143 |
\tl_put_left:Nn \l_@@_store_save_key_vii_tl |
| 11144 |
{ |
| 11145 |
\item \begin{enumext*}[ |
| 11146 |
} |
| 11147 |
\tl_put_right:Nn \l_@@_store_save_key_vii_tl |
| 11148 |
{ |
| 11149 |
] |
| 11150 |
} |
| 11151 |
\@@_store_addto_seq:V \l_@@_store_save_key_vii_tl |
| 11152 |
} |
| 11153 |
} |
| 11154 |
} |
| 11155 |
\cs_new_protected:Nn \@@_store_level_close_vii: |
| 11156 |
{ |
| 11157 |
\bool_if:NT \l_@@_check_answers_bool |
| 11158 |
{ |
| 11159 |
\@@_store_addto_seq:n { \end{enumext*} } |
| 11160 |
} |
| 11161 |
} |
| 11162 |
% \end{macrocode} |
| 11163 |
% \end{macro} |
| 11164 |
% |
| 11165 |
% \subsubsection{Function for show marks and position} |
| 11166 |
% |
| 11167 |
% \begin{macro}{\@@_print_keyans_box:NN, \@@_print_keyans_box:cc } |
| 11168 |
% The function \cs{@@_print_keyans_box:NN} print a box in the left |
| 11169 |
% margin with \cs{l_@@_mark_answer_sym_tl} used by the \mykey{wrap-ans}, |
| 11170 |
% \mykey{show-ans} and \mykey{show-pos} keys. The function takes two |
| 11171 |
% arguments: |
| 11172 |
% |
| 11173 |
% \smallskip |
| 11174 |
% |
| 11175 |
% \begin{arguments} |
| 11176 |
% \item \myvarenv{l__@@_labelwidth_X_dim} |
| 11177 |
% \item \myvarenv{l__@@_labelsep_X_dim} |
| 11178 |
% \end{arguments} |
| 11179 |
% |
| 11180 |
% \iffalse |
| 11181 |
%% Function for put content in box on left margin. |
| 11182 |
% \fi |
| 11183 |
% \begin{macrocode} |
| 11184 |
\cs_new_protected:Nn \@@_print_keyans_box:NN |
| 11185 |
{ |
| 11186 |
\mode_leave_vertical: |
| 11187 |
\skip_horizontal:n { -\dim_use:N #2 } |
| 11188 |
\hbox_overlap_left:n |
| 11189 |
{ |
| 11190 |
\makebox[ \dim_use:N #1 ][ \l_@@_mark_position_str ] |
| 11191 |
{ |
| 11192 |
\tl_use:N \l_@@_mark_answer_sym_tl |
| 11193 |
} |
| 11194 |
} |
| 11195 |
\skip_horizontal:n { \dim_use:N #2 } |
| 11196 |
} |
| 11197 |
\cs_generate_variant:Nn \@@_print_keyans_box:NN { cc } |
| 11198 |
% \end{macrocode} |
| 11199 |
% \end{macro} |
| 11200 |
% |
| 11201 |
% \subsection{The internal label and ref}\label{fun:internal-label-ref} |
| 11202 |
% |
| 11203 |
% The function \cs{@@_store_internal_ref:} handles the |
| 11204 |
% \emph{\enquote{internal label and ref}} system used by the \mykey{save-ref} |
| 11205 |
% and \mykey{mark-ref} keys for \ics*{anskey} will allow to execute |
| 11206 |
% \ics{ref}\mymarg{store name \textnormal{\textcolor{red}{:}} position} and |
| 11207 |
% will return |1||.(a)||.i||.A|. |
| 11208 |
% |
| 11209 |
% \begin{macro}{\@@_store_internal_ref:} |
| 11210 |
% First we will remove the dots \enquote{\textcolor{red}{.}} from |
| 11211 |
% the current \mymeta{labels}, we do not want to get double dots in |
| 11212 |
% our references, then we will place this in the variable |
| 11213 |
% \cs{l_@@_newlabel_arg_two_tl}. |
| 11214 |
% \iffalse |
| 11215 |
%% Internal label and ref function for |\anskey| and |anskey*|. |
| 11216 |
% \fi |
| 11217 |
% \begin{macrocode} |
| 11218 |
\cs_new_protected:Nn \@@_store_internal_ref: |
| 11219 |
{ |
| 11220 |
\cs_set_protected:Npn \@@_tmp:n ##1 |
| 11221 |
{ |
| 11222 |
\tl_set_eq:cc { l_@@_label_copy_##1_tl } { l_@@_label_##1_tl } |
| 11223 |
\tl_reverse:c { l_@@_label_copy_##1_tl } |
| 11224 |
\tl_remove_once:cn { l_@@_label_copy_##1_tl } { . } |
| 11225 |
\tl_reverse:c { l_@@_label_copy_##1_tl } |
| 11226 |
} |
| 11227 |
\clist_map_inline:nn { i, ii, iii, iv, vii } { \@@_tmp:n {##1} } |
| 11228 |
\cs_set:Npn \@@_tmp:n ##1 |
| 11229 |
{ . \tl_use:c { l_@@_label_copy_ \int_to_roman:n {##1} _tl } } |
| 11230 |
% \end{macrocode} |
| 11231 |
% Here we need to analyse the cases where the environment is started with |
| 11232 |
% \myenv*{enumext*} and if \ics*{anskey} or \myenv*{anskey*} is running |
| 11233 |
% alone in it or if it is running in a nested \myenv*{enumext} environment |
| 11234 |
% within the starting environment. |
| 11235 |
% \begin{macrocode} |
| 11236 |
\bool_lazy_all:nT |
| 11237 |
{ |
| 11238 |
{ \bool_if_p:N \g_@@_starred_bool } |
| 11239 |
{ \int_compare_p:nNn { \l_@@_level_int } = { 0 } } |
| 11240 |
} |
| 11241 |
{ |
| 11242 |
\tl_put_right:Ne \l_@@_newlabel_arg_two_tl |
| 11243 |
{ \tl_use:N \l_@@_label_copy_vii_tl } |
| 11244 |
} |
| 11245 |
\bool_lazy_all:nT |
| 11246 |
{ |
| 11247 |
{ \bool_not_p:n { \g_@@_standar_bool } } |
| 11248 |
{ \bool_if_p:N \l_@@_standar_bool } |
| 11249 |
{ \int_compare_p:nNn { \l_@@_level_int } > { 0 } } |
| 11250 |
} |
| 11251 |
{ |
| 11252 |
\tl_put_right:Ne \l_@@_newlabel_arg_two_tl |
| 11253 |
{ |
| 11254 |
\tl_use:N \l_@@_label_copy_vii_tl |
| 11255 |
\int_step_function:nnN { 1 } { \l_@@_level_int } \@@_tmp:n |
| 11256 |
} |
| 11257 |
} |
| 11258 |
% \end{macrocode} |
| 11259 |
% If started with \myenv*{enumext} and if \ics*{anskey} or \myenv*{anskey*} |
| 11260 |
% is running alone in it or if it is running in a nested \myenv*{enumext*} |
| 11261 |
% environment within the starting environment. |
| 11262 |
% \begin{macrocode} |
| 11263 |
\bool_lazy_all:nT |
| 11264 |
{ |
| 11265 |
{ \bool_if_p:N \g_@@_standar_bool } |
| 11266 |
{ \int_compare_p:nNn { \l_@@_level_int } > { 0 } } |
| 11267 |
{ \int_compare_p:nNn { \l_@@_level_h_int } = { 0 } } |
| 11268 |
} |
| 11269 |
{ |
| 11270 |
\tl_put_right:Ne \l_@@_newlabel_arg_two_tl |
| 11271 |
{ |
| 11272 |
\tl_use:N \l_@@_label_copy_i_tl |
| 11273 |
\int_step_function:nnN { 2 } { \l_@@_level_int } \@@_tmp:n |
| 11274 |
} |
| 11275 |
} |
| 11276 |
\cs_set:Npn \@@_tmp:n ##1 |
| 11277 |
{ \tl_use:c { l_@@_label_copy_ \int_to_roman:n {##1} _tl } . } |
| 11278 |
\bool_lazy_all:nT |
| 11279 |
{ |
| 11280 |
{ \bool_if_p:N \g_@@_standar_bool } |
| 11281 |
{ \bool_if_p:N \l_@@_starred_bool } |
| 11282 |
{ \int_compare_p:nNn { \l_@@_level_int } > { 0 } } |
| 11283 |
} |
| 11284 |
{ |
| 11285 |
\tl_put_right:Ne \l_@@_newlabel_arg_two_tl |
| 11286 |
{ |
| 11287 |
\int_step_function:nnN { 1 } { \l_@@_level_int } \@@_tmp:n |
| 11288 |
\tl_use:N \l_@@_label_copy_vii_tl |
| 11289 |
} |
| 11290 |
} |
| 11291 |
% \end{macrocode} |
| 11292 |
% Now we set the variable \cs{l_@@_newlabel_arg_one_tl} which will |
| 11293 |
% contain \mymarg{store name \textnormal{\textcolor{red}{:}} position}. |
| 11294 |
% \begin{macrocode} |
| 11295 |
\tl_put_right:Ne \l_@@_newlabel_arg_one_tl |
| 11296 |
{ |
| 11297 |
\l_@@_store_name_tl \c_colon_str |
| 11298 |
\int_eval:n { \prop_count:c { g_@@_ \l_@@_store_name_tl _prop } } |
| 11299 |
} |
| 11300 |
% \end{macrocode} |
| 11301 |
% Now execute the function \cs{@@_newlabel:nn} and save the result in |
| 11302 |
% the variable \cs{l_@@_write_aux_file_tl} and finally we write in the |
| 11303 |
% |.aux| file. |
| 11304 |
% \begin{macrocode} |
| 11305 |
\tl_put_right:Ne \l_@@_write_aux_file_tl |
| 11306 |
{ |
| 11307 |
\@@_newlabel:nn |
| 11308 |
{ \exp_not:V \l_@@_newlabel_arg_one_tl } |
| 11309 |
{ \l_@@_newlabel_arg_two_tl } |
| 11310 |
} |
| 11311 |
\l_@@_write_aux_file_tl |
| 11312 |
} |
| 11313 |
% \end{macrocode} |
| 11314 |
% \end{macro} |
| 11315 |
% |
| 11316 |
% \subsection{Common functions for \cs{anskey} and \texttt{anskey*} environment} |
| 11317 |
% |
| 11318 |
% \begin{macro}{\@@_store_anskey_arg:n} |
| 11319 |
% The internal function \cs{@@_store_anskey_arg:n} first we pass the |
| 11320 |
% \mymarg{argument} to the \emph{prop list}, then checks the |
| 11321 |
% state of the variable \cs{l_@@_store_ref_key_bool} handled by the |
| 11322 |
% \mykey{save-ref} key and will call the function \cs{@@_store_internal_ref:} |
| 11323 |
% for the \emph{\enquote{internal label and ref}} system. Followed by |
| 11324 |
% this if the \mykey{show-ans} or \mykey{show-pos} keys are active we |
| 11325 |
% will show the \emph{\enquote{wrapped}} \mymarg{argument}. |
| 11326 |
% \iffalse |
| 11327 |
%% Internal function for |\anskey| and |anskey*| for store content. |
| 11328 |
% \fi |
| 11329 |
% \begin{macrocode} |
| 11330 |
\cs_new_protected:Npn \@@_store_anskey_arg:n #1 |
| 11331 |
{ |
| 11332 |
\int_gincr:N \g_@@_item_anskey_int |
| 11333 |
\@@_store_addto_prop:n {#1} |
| 11334 |
\bool_if:NT \l_@@_store_ref_key_bool |
| 11335 |
{ |
| 11336 |
\@@_store_internal_ref: |
| 11337 |
} |
| 11338 |
\@@_anskey_show_wrap_left:n { #1 } |
| 11339 |
% \end{macrocode} |
| 11340 |
% Now we start processing the \myoarg{key \textnormal{\textcolor{gray}{=}} val} |
| 11341 |
% passed to the command to build our |\item| in the variable \cs{l_@@_store_anskey_arg_tl} |
| 11342 |
% which we will \emph{\enquote{store}} in the \emph{sequence}. |
| 11343 |
% First we clear the variable \cs{l_@@_store_anskey_arg_tl} and process |
| 11344 |
% the \mymeta{keys}, if the \mykeycmd{break-col} key is present and |
| 11345 |
% the command is running under \myenv*{enumext} (not in \myenv*{enumext*}) |
| 11346 |
% we will add \ics{columnbreak} and then |\item|. |
| 11347 |
% \begin{macrocode} |
| 11348 |
\tl_clear:N \l_@@_store_anskey_arg_tl |
| 11349 |
\bool_lazy_and:nnT |
| 11350 |
{ \bool_if_p:N \l_@@_store_columns_break_bool } |
| 11351 |
{ \bool_not_p:n { \l_@@_starred_bool } } |
| 11352 |
{ |
| 11353 |
\tl_put_left:Nn \l_@@_store_anskey_arg_tl { \columnbreak } |
| 11354 |
} |
| 11355 |
\tl_put_right:Nn \l_@@_store_anskey_arg_tl { \item } |
| 11356 |
% \end{macrocode} |
| 11357 |
% If the \mykeycmd{item-join} key is present and the command is running under |
| 11358 |
% \myenv*{enumext*} we will add \myparg{number} to \cs{l_@@_store_anskey_arg_tl}. |
| 11359 |
% \begin{macrocode} |
| 11360 |
\bool_lazy_and:nnT |
| 11361 |
{ \bool_not_p:n { \l_@@_starred_bool } } |
| 11362 |
{ \int_compare_p:nNn { \l_@@_store_item_join_int } > { 1 } } |
| 11363 |
{ |
| 11364 |
\tl_put_right:Ne \l_@@_store_anskey_arg_tl |
| 11365 |
{ |
| 11366 |
( \exp_not:V \l_@@_store_item_join_int ) |
| 11367 |
} |
| 11368 |
} |
| 11369 |
% \end{macrocode} |
| 11370 |
% And now we will review the keys \mykeycmd{item-star}, \mykeycmd{item-sym*} and |
| 11371 |
% \mykeycmd{item-pos*} and pass them to \cs{l_@@_store_anskey_arg_tl} |
| 11372 |
% along with the \mymarg{argument} for |\anskey| or \mymeta{body} for |anskey*|. |
| 11373 |
% \begin{macrocode} |
| 11374 |
\bool_if:NTF \l_@@_store_item_star_bool |
| 11375 |
{ |
| 11376 |
\tl_put_right:Nn \l_@@_store_anskey_arg_tl { * } |
| 11377 |
\tl_if_empty:NF \l_@@_store_item_symbol_tl |
| 11378 |
{ |
| 11379 |
\tl_put_right:Ne \l_@@_store_anskey_arg_tl |
| 11380 |
{ |
| 11381 |
[ \exp_not:V \l_@@_store_item_symbol_tl ] |
| 11382 |
} |
| 11383 |
} |
| 11384 |
\dim_compare:nT |
| 11385 |
{ |
| 11386 |
\l_@@_store_item_symbol_sep_dim != \c_zero_dim |
| 11387 |
} |
| 11388 |
{ |
| 11389 |
\tl_put_right:Ne \l_@@_store_anskey_arg_tl |
| 11390 |
{ |
| 11391 |
[ \exp_not:V \l_@@_store_item_symbol_sep_dim ] |
| 11392 |
} |
| 11393 |
} |
| 11394 |
\tl_put_right:Nn \l_@@_store_anskey_arg_tl {#1} |
| 11395 |
} |
| 11396 |
{ |
| 11397 |
\tl_put_right:Nn \l_@@_store_anskey_arg_tl {#1} |
| 11398 |
} |
| 11399 |
% \end{macrocode} |
| 11400 |
% Finally we check if the \mykey{save-ref} key are active along with the |
| 11401 |
% \mypkg{hyperref} package load, if both conditions are met, it will |
| 11402 |
% create the \ics{hyperlink} with \emph{\enquote{symbol}} set by \mykey{mark-ref} |
| 11403 |
% key and then store in \emph{sequence}. |
| 11404 |
% \begin{macrocode} |
| 11405 |
\bool_lazy_and:nnT |
| 11406 |
{ \bool_if_p:N \l_@@_store_ref_key_bool } |
| 11407 |
{ \bool_if_p:N \l_@@_hyperref_bool } |
| 11408 |
{ |
| 11409 |
\tl_put_right:Ne \l_@@_store_anskey_arg_tl |
| 11410 |
{ |
| 11411 |
\hfill \exp_not:N \hyperlink { \exp_not:V \l_@@_newlabel_arg_one_tl } |
| 11412 |
{ \exp_not:V \l_@@_mark_ref_sym_tl } |
| 11413 |
} |
| 11414 |
} |
| 11415 |
\@@_store_addto_seq:V \l_@@_store_anskey_arg_tl |
| 11416 |
} |
| 11417 |
% \end{macrocode} |
| 11418 |
% \end{macro} |
| 11419 |
% |
| 11420 |
% \begin{macro}{\@@_anskey_show_wrap_arg:n,} |
| 11421 |
% The function \cs{@@_anskey_show_wrap_arg:n} \emph{\enquote{wraps}} |
| 11422 |
% the \mymarg{argument} passed to \ics*{anskey} and the \mymeta{body} |
| 11423 |
% for \myenv*{anskey*} when using the \mykey{wrap-ans} and \mykey{wrap-sep} keys. |
| 11424 |
% \iffalse |
| 11425 |
%% Internal |wrap-ans| implementation for |\anskey| and |anskey*|. |
| 11426 |
% \fi |
| 11427 |
% \begin{macrocode} |
| 11428 |
\cs_new_protected:Npn \@@_anskey_show_wrap_arg:n #1 |
| 11429 |
{ |
| 11430 |
\par |
| 11431 |
\bool_if:NTF \l_@@_starred_bool |
| 11432 |
{ |
| 11433 |
\dim_compare:nNnT { \l_@@_mark_sym_sep_dim } = { \c_zero_dim } |
| 11434 |
{ |
| 11435 |
\dim_set:Nn \l_@@_mark_sym_sep_dim { \l_@@_labelsep_vii_dim } |
| 11436 |
} |
| 11437 |
\@@_print_keyans_box:NN |
| 11438 |
\l_@@_labelwidth_vii_dim \l_@@_mark_sym_sep_dim |
| 11439 |
} |
| 11440 |
{ |
| 11441 |
\dim_compare:nNnT { \l_@@_mark_sym_sep_dim } = { \c_zero_dim } |
| 11442 |
{ |
| 11443 |
\dim_set:Nn \l_@@_mark_sym_sep_dim |
| 11444 |
{ |
| 11445 |
\dim_use:c {l_@@_labelsep_ \@@_level: _dim } |
| 11446 |
} |
| 11447 |
} |
| 11448 |
\@@_print_keyans_box:cc |
| 11449 |
{ l_@@_labelwidth_ \@@_level: _dim } { l_@@_mark_sym_sep_dim } |
| 11450 |
} |
| 11451 |
\@@_anskey_wrapper:n { #1 } |
| 11452 |
} |
| 11453 |
% \end{macrocode} |
| 11454 |
% \end{macro} |
| 11455 |
% |
| 11456 |
% \begin{macro}{ \@@_anskey_show_wrap_left:n } |
| 11457 |
% The function \cs{@@_anskey_show_wrap_left:n} will show the |
| 11458 |
% \emph{\enquote{mark}} defined by the \mykey{mark-ans} key or the |
| 11459 |
% \emph{\enquote{position}} of the \mymarg{content} stored in the \emph{prop list} |
| 11460 |
% when using the \mykey{show-pos} key on the left margin next to the |
| 11461 |
% \emph{\enquote{wraps}} \mymarg{argument} passed to \ics*{anskey} and |
| 11462 |
% the \mymeta{body} in \myenv*{anskey*} on the right side when using |
| 11463 |
% the \mykey{show-ans} key. |
| 11464 |
% \iffalse |
| 11465 |
%% Internal |show-ans| and |show-pos| implementation for |\anskey| and |anskey*|. |
| 11466 |
% \fi |
| 11467 |
% \begin{macrocode} |
| 11468 |
\cs_new_protected:Npn \@@_anskey_show_wrap_left:n #1 |
| 11469 |
{ |
| 11470 |
\bool_if:NT \l_@@_show_answer_bool |
| 11471 |
{ |
| 11472 |
\@@_anskey_show_wrap_arg:n { #1 } |
| 11473 |
} |
| 11474 |
\bool_if:NT \l_@@_show_position_bool |
| 11475 |
{ |
| 11476 |
\tl_set:Ne \l_@@_mark_answer_sym_tl |
| 11477 |
{ |
| 11478 |
\group_begin: |
| 11479 |
\exp_not:N \normalfont |
| 11480 |
\exp_not:N \footnotesize [ \int_eval:n |
| 11481 |
{ |
| 11482 |
\prop_count:c { g_@@_ \l_@@_store_name_tl _prop } |
| 11483 |
} |
| 11484 |
] |
| 11485 |
\group_end: |
| 11486 |
} |
| 11487 |
\@@_anskey_show_wrap_arg:n { #1 } |
| 11488 |
} |
| 11489 |
} |
| 11490 |
% \end{macrocode} |
| 11491 |
% \end{macro} |
| 11492 |
% |
| 11493 |
% \subsection{The command \cs{anskey}}\label{cmd:anskey} |
| 11494 |
% |
| 11495 |
% Since we will be \emph{\enquote{storing content}} in a \myenv{list} environment |
| 11496 |
% within \emph{sequences} and can (more or less) manage the options |
| 11497 |
% passed to each level, it is necessary that we have a little more |
| 11498 |
% control over |\item| when storing. |
| 11499 |
% |
| 11500 |
% \smallskip |
| 11501 |
% |
| 11502 |
% The \ics*{anskey} command will cover this point and give it similar |
| 11503 |
% behaviour to that of |\item| in the \myenv*{enumext} and \myenv*{enumext*} |
| 11504 |
% environments executed as follows \ics*{anskey}\myoarg{key \textnormal{\textcolor{gray}{=}} val}\mymarg{content}. |
| 11505 |
% |
| 11506 |
% \begin{macro}[int]{break-col, item-join, item-star, item-sym*, item-pos*, |
| 11507 |
% unknown, \@@_anskey_unknown:n, \@@_anskey_unknown:nn} |
| 11508 |
% First we'll add the keys \mykeycmd{break-col}, \mykeycmd{item-join}, |
| 11509 |
% \mykeycmd{item-star}, \mykeycmd{item-sym*} and \mykeycmd{item-pos*}. |
| 11510 |
% \iffalse |
| 11511 |
%% Add |key=val| for |\anskey|. |
| 11512 |
% \fi |
| 11513 |
% \begin{macrocode} |
| 11514 |
\keys_define:nn { enumext / anskey } |
| 11515 |
{ |
| 11516 |
break-col .bool_set:N = \l_@@_store_columns_break_bool, |
| 11517 |
break-col .default:n = true, |
| 11518 |
break-col .value_forbidden:n = true, |
| 11519 |
item-join .int_set:N = \l_@@_store_item_join_int, |
| 11520 |
item-join .value_required:n = true, |
| 11521 |
item-star .bool_set:N = \l_@@_store_item_star_bool, |
| 11522 |
item-star .default:n = true, |
| 11523 |
item-star .value_forbidden:n = true, |
| 11524 |
item-sym* .tl_set:N = \l_@@_store_item_symbol_tl, |
| 11525 |
item-sym* .value_required:n = true, |
| 11526 |
item-pos* .dim_set:N = \l_@@_store_item_symbol_sep_dim, |
| 11527 |
item-pos* .value_required:n = true, |
| 11528 |
unknown .code:n = { \@@_anskey_unknown:n {#1} }, |
| 11529 |
} |
| 11530 |
% \end{macrocode} |
| 11531 |
% The \mymeta{keys} are stored in \cs{l_keys_key_str} and the value |
| 11532 |
% (if any) is passed as an argument to the function \cs{@@_anskey_unknown:n}. |
| 11533 |
% \begin{macrocode} |
| 11534 |
\cs_new_protected:Npn \@@_anskey_unknown:n #1 |
| 11535 |
{ |
| 11536 |
\exp_args:NV \@@_anskey_unknown:nn \l_keys_key_str {#1} |
| 11537 |
} |
| 11538 |
\cs_new_protected:Npn \@@_anskey_unknown:nn #1 #2 |
| 11539 |
{ |
| 11540 |
\tl_if_blank:nTF {#2} |
| 11541 |
{ |
| 11542 |
\msg_error:nnn { enumext } { anskey-cmd-key-unknown } {#1} |
| 11543 |
} |
| 11544 |
{ |
| 11545 |
\msg_error:nnnn { enumext } { anskey-cmd-key-value-unknown } {#1} {#2} |
| 11546 |
} |
| 11547 |
} |
| 11548 |
% \end{macrocode} |
| 11549 |
% \end{macro} |
| 11550 |
% |
| 11551 |
% \begin{important}* |
| 11552 |
% The \ics*{anskey} command will only be present when using the |
| 11553 |
% \mykey{save-ans} key in \myenv*{enumext} and \myenv*{enumext*} |
| 11554 |
% environments, otherwise it will return an error. |
| 11555 |
% \end{important} |
| 11556 |
% |
| 11557 |
% \begin{macro}{\anskey} |
| 11558 |
% We will first call the function \cs{@@_anskey_safe_outer:} to be |
| 11559 |
% sure where we execute the command, then we will check the state of the |
| 11560 |
% variable \cs{l_@@_check_answers_bool} set by the key \mykey{no-store}, |
| 11561 |
% if is true we will increment \cs{g_@@_item_anskey_int} for the internal |
| 11562 |
% \emph{\enquote{check answer}} system and execute the function |
| 11563 |
% \cs{@@_anskey_safe_inner:n} to ensure that the command is not |
| 11564 |
% nested and that the argument is not empty, finally search the |
| 11565 |
% \myoarg{key \textnormal{\textcolor{gray}{=}} val} and call the |
| 11566 |
% function \cs{@@_store_anskey_arg:n}. |
| 11567 |
% \iffalse |
| 11568 |
%% Define the user command |\anskey|. |
| 11569 |
% \fi |
| 11570 |
% \begin{macrocode} |
| 11571 |
\NewDocumentCommand \anskey { o +m } |
| 11572 |
{ |
| 11573 |
\@@_anskey_safe_outer: |
| 11574 |
\group_begin: |
| 11575 |
\bool_if:NT \l_@@_check_answers_bool |
| 11576 |
{ |
| 11577 |
\tl_if_novalue:nF {#1} |
| 11578 |
{ |
| 11579 |
\keys_set:nn { enumext / anskey } {#1} |
| 11580 |
} |
| 11581 |
\tl_if_blank:nTF {#2} |
| 11582 |
{ |
| 11583 |
\msg_error:nn { enumext } { anskey-empty-arg } |
| 11584 |
} |
| 11585 |
{ |
| 11586 |
\@@_anskey_safe_inner: |
| 11587 |
\@@_store_anskey_arg:n {#2} |
| 11588 |
} |
| 11589 |
} |
| 11590 |
\group_end: |
| 11591 |
} |
| 11592 |
% \end{macrocode} |
| 11593 |
% \end{macro} |
| 11594 |
% |
| 11595 |
% \subsubsection{Internal functions for the command} |
| 11596 |
% |
| 11597 |
% \begin{macro}{\@@_anskey_safe_outer:, \@@_anskey_safe_inner:} |
| 11598 |
% The \cs{@@_store_anskey_safe_outer:} function will return the |
| 11599 |
% appropriate messages when the command is executed outside the |
| 11600 |
% environment in which the \mykey{save-ans} key was activated. |
| 11601 |
% \iffalse |
| 11602 |
%% Internal function for msg when |\anskey| is outer. |
| 11603 |
% \fi |
| 11604 |
% \begin{macrocode} |
| 11605 |
\cs_new_protected:Nn \@@_anskey_safe_outer: |
| 11606 |
{ |
| 11607 |
\bool_if:NF \l_@@_store_active_bool |
| 11608 |
{ |
| 11609 |
\msg_error:nnnn { enumext } { anskey-wrong-place }{ anskey }{ enumext } |
| 11610 |
} |
| 11611 |
\int_compare:nNnT { \l_@@_keyans_level_int } = { 1 } |
| 11612 |
{ |
| 11613 |
\msg_error:nnnn { enumext } { command-wrong-place }{ anskey }{ keyans } |
| 11614 |
} |
| 11615 |
\int_compare:nNnT { \l_@@_keyans_level_h_int } = { 1 } |
| 11616 |
{ |
| 11617 |
\msg_error:nnnn { enumext } { command-wrong-place }{ anskey }{ keyans* } |
| 11618 |
} |
| 11619 |
\int_compare:nNnT { \l_@@_keyans_pic_level_int } = { 1 } |
| 11620 |
{ |
| 11621 |
\msg_error:nnnn { enumext } { command-wrong-place }{ anskey }{ keyanspic } |
| 11622 |
} |
| 11623 |
} |
| 11624 |
% \end{macrocode} |
| 11625 |
% The \cs{@@_anskey_safe_inner:} function will first check if the |
| 11626 |
% command is nested, if preceded by a not numbered |\item| or if it is |
| 11627 |
% in \emph{math mode} returning the appropriate messages. |
| 11628 |
% \iffalse |
| 11629 |
%% Internal function for msg when |\anskey| is inner, math-mode or arg is empty. |
| 11630 |
% \fi |
| 11631 |
% \begin{macrocode} |
| 11632 |
\cs_new_protected:Nn \@@_anskey_safe_inner: |
| 11633 |
{ |
| 11634 |
\int_incr:N \l_@@_anskey_level_int |
| 11635 |
\int_compare:nNnT { \l_@@_anskey_level_int } > { 1 } |
| 11636 |
{ |
| 11637 |
\msg_error:nn { enumext } { anskey-nested } |
| 11638 |
} |
| 11639 |
\bool_if:NF \l_@@_item_number_bool |
| 11640 |
{ |
| 11641 |
\msg_error:nn { enumext } { anskey-unnumber-item } |
| 11642 |
} |
| 11643 |
\mode_if_math:T |
| 11644 |
{ |
| 11645 |
\msg_error:nne { enumext } { anskey-math-mode } { \c_backslash_str anskey } |
| 11646 |
} |
| 11647 |
} |
| 11648 |
% \end{macrocode} |
| 11649 |
% \end{macro} |
| 11650 |
% |
| 11651 |
% \subsection{The environment \env{anskey*}}\label{env:anskey} |
| 11652 |
% |
| 11653 |
% The original implementation of the |anskey*| environment used |
| 11654 |
% non-public functions from the \mypkg{scontents}\cite{scontents} package, |
| 11655 |
% which was not the best approach. Fortunately \hologo{LaTeX} release 2025-06-01 |
| 11656 |
% implemented the new \texttt{c-type} argument in the \mypkg{ltcmd}\cite{ltnews}, |
| 11657 |
% with which we can record the \mymeta{body} of the environment in |
| 11658 |
% \emph{verbatim mode} and |\tl_retokenize:n| (wrapper around the |\scantokens|) |
| 11659 |
% provide by \hologo{LaTeX}3 release 2025-07-08 do the work as the |
| 11660 |
% original implementation. |
| 11661 |
% |
| 11662 |
% \begin{macro}[int]{break-col, item-join, item-star, item-sym*, item-pos*, |
| 11663 |
% force-eol, write-env, overwrite, unknown,} |
| 11664 |
% First we add the same keys from the |\anskey| command along with the |
| 11665 |
% \mykeycmd{force-eol}, \mykeycmd{write-env} and \mykeycmd{overwrite} |
| 11666 |
% keys that were in the original implementation that used the |
| 11667 |
% \mypkg{scontents} support package for these. |
| 11668 |
% \iffalse |
| 11669 |
%% Define keys for |anskey*| environment. |
| 11670 |
% \fi |
| 11671 |
% \begin{macrocode} |
| 11672 |
\keys_define:nn { enumext / anskey* } |
| 11673 |
{ |
| 11674 |
break-col .bool_set:N = \l_@@_store_columns_break_bool, |
| 11675 |
break-col .default:n = true, |
| 11676 |
break-col .value_forbidden:n = true, |
| 11677 |
item-join .int_set:N = \l_@@_store_item_join_int, |
| 11678 |
item-join .value_required:n = true, |
| 11679 |
item-star .bool_set:N = \l_@@_store_item_star_bool, |
| 11680 |
item-star .default:n = true, |
| 11681 |
item-star .value_forbidden:n = true, |
| 11682 |
item-sym* .tl_set:N = \l_@@_store_item_symbol_tl, |
| 11683 |
item-sym* .value_required:n = true, |
| 11684 |
item-pos* .dim_set:N = \l_@@_store_item_symbol_sep_dim, |
| 11685 |
item-pos* .value_required:n = true, |
| 11686 |
force-eol .bool_set:N = \l_@@_anskey_env_force_eol_bool, |
| 11687 |
force-eol .initial:n = false, |
| 11688 |
force-eol .default:n = true, |
| 11689 |
write-env .code:n = { |
| 11690 |
\bool_set_true:N \l_@@_write_anskey_env_bool |
| 11691 |
\tl_set:Nn \l_@@_write_anskey_env_file_name_tl {#1} |
| 11692 |
}, |
| 11693 |
write-env .value_required:n = true, |
| 11694 |
overwrite .bool_set:N = \l_@@_anskey_env_overwrite_bool, |
| 11695 |
overwrite .initial:n = false, |
| 11696 |
overwrite .default:n = true, |
| 11697 |
unknown .code:n = { \@@_anskey_env_unknown:n {#1} }, |
| 11698 |
} |
| 11699 |
% \end{macrocode} |
| 11700 |
% \end{macro} |
| 11701 |
% |
| 11702 |
% \begin{macro}[int]{ \@@_anskey_env_unknown:n, \@@_anskey_env_unknown:nn} |
| 11703 |
% The \mymeta{keys} are stored in \cs{l_keys_key_str} and the value |
| 11704 |
% (if any) is passed as an argument to the function \cs{@@_anskey_env_unknown:n}. |
| 11705 |
% \begin{macrocode} |
| 11706 |
\cs_new_protected:Npn \@@_anskey_env_unknown:n #1 |
| 11707 |
{ |
| 11708 |
\exp_args:NV \@@_anskey_env_unknown:nn \l_keys_key_str {#1} |
| 11709 |
} |
| 11710 |
\cs_new_protected:Npn \@@_anskey_env_unknown:nn #1#2 |
| 11711 |
{ |
| 11712 |
\tl_if_blank:nTF {#2} |
| 11713 |
{ |
| 11714 |
\msg_error:nnn { enumext } { anskey-env-key-unknown } {#1} |
| 11715 |
} |
| 11716 |
{ |
| 11717 |
\msg_error:nnnn { enumext } { anskey-env-key-value-unknown } {#1} {#2} |
| 11718 |
} |
| 11719 |
} |
| 11720 |
% \end{macrocode} |
| 11721 |
% \end{macro} |
| 11722 |
% |
| 11723 |
% \begin{macro}[int]{\@@_anskey_env_file_if_writable:n, \@@_anskey_env_file_if_writable:nT, |
| 11724 |
% \@@_anskey_env_file_if_writable:nF, \@@_anskey_env_file_if_writable:nTF,} |
| 11725 |
% The conditional function \cs{@@_anskey_env_file_if_writable:n} used by |
| 11726 |
% the \mykey{write-env} and \mykey{overwrite} keys in the \myenv*{anskey*} |
| 11727 |
% environment to determine whether the output file is written or overwritten. |
| 11728 |
% \iffalse |
| 11729 |
%% Conditional functions used by |write-env| and |overwrite| keys. |
| 11730 |
% \fi |
| 11731 |
% \begin{macrocode} |
| 11732 |
\prg_new_protected_conditional:Npnn \@@_anskey_env_file_if_writable:n #1 { T, F, TF } |
| 11733 |
{ |
| 11734 |
\bool_if:NTF \l_@@_write_anskey_env_bool |
| 11735 |
{ |
| 11736 |
\file_if_exist:nTF {#1} |
| 11737 |
{ |
| 11738 |
\bool_if:NTF \l_@@_anskey_env_overwrite_bool |
| 11739 |
{ |
| 11740 |
\msg_warning:nne { enumext } { overwrite-file } {#1} |
| 11741 |
\prg_return_true: |
| 11742 |
} |
| 11743 |
{ |
| 11744 |
\msg_warning:nne { enumext } { not-writing } {#1} |
| 11745 |
\prg_return_false: |
| 11746 |
} |
| 11747 |
} |
| 11748 |
{ |
| 11749 |
\msg_warning:nne { enumext } { writing-file } {#1} |
| 11750 |
\prg_return_true: |
| 11751 |
} |
| 11752 |
} |
| 11753 |
{ \prg_return_false: } |
| 11754 |
} |
| 11755 |
% \end{macrocode} |
| 11756 |
% The \cs{@@_anskey_env_file_write:nn} function is used by the |
| 11757 |
% \mykey{write-env} key in the \myenv*{anskey*} environment to write the |
| 11758 |
% output file with the \mymeta{body} of the environment. |
| 11759 |
% \begin{macrocode} |
| 11760 |
\cs_new_protected:Npn \@@_anskey_env_file_write:nn #1#2 |
| 11761 |
{ |
| 11762 |
\@@_anskey_env_file_if_writable:nT {#1} |
| 11763 |
{ |
| 11764 |
\iow_open:Nn \l_@@_write_anskey_env_file_iow {#1} |
| 11765 |
\iow_now:Nn \l_@@_write_anskey_env_file_iow {#2} |
| 11766 |
\iow_close:N \l_@@_write_anskey_env_file_iow |
| 11767 |
} |
| 11768 |
} |
| 11769 |
\cs_generate_variant:Nn \@@_anskey_env_file_write:nn { VV } |
| 11770 |
% \end{macrocode} |
| 11771 |
% \end{macro} |
| 11772 |
% |
| 11773 |
% \begin{macro}{anskey*,} |
| 11774 |
% First, we'll call the function \cs{@@_anskey_env_safe_outer:} to make |
| 11775 |
% sure where we're running the environment, then, we'll check the state |
| 11776 |
% of the variable \cs{l_@@_check_answers_bool} set by the key |
| 11777 |
% \mykey{no-store}. If it's true, we'll look for \myoarg{key \textnormal{\textcolor{gray}{=}} val} |
| 11778 |
% and verify that the \emph{argument} \texttt{c-type} \mymeta{body} is not empty. |
| 11779 |
% Finally, we'll run the internal check function \cs{@@_anskey_env_safe_inner:n} |
| 11780 |
% and call the function \cs{@@_store_anskey_arg:n}. |
| 11781 |
% \iffalse |
| 11782 |
%% Define the user environment |anskey*|. |
| 11783 |
% \fi |
| 11784 |
% \begin{macrocode} |
| 11785 |
\NewDocumentEnvironment{anskey*}{ o c } |
| 11786 |
{ |
| 11787 |
\@@_anskey_env_safe_outer: |
| 11788 |
\bool_if:NT \l_@@_check_answers_bool |
| 11789 |
{ |
| 11790 |
\tl_if_novalue:nF {#1} |
| 11791 |
{ |
| 11792 |
\keys_set:nn { enumext / anskey* } {#1} |
| 11793 |
} |
| 11794 |
\tl_if_blank:nTF {#2} |
| 11795 |
{ |
| 11796 |
\msg_error:nn { enumext } { anskey-empty-arg } |
| 11797 |
} |
| 11798 |
{ |
| 11799 |
\@@_anskey_env_safe_inner: |
| 11800 |
\@@_store_anskey_env:n {#2} |
| 11801 |
} |
| 11802 |
} |
| 11803 |
} { } |
| 11804 |
% \end{macrocode} |
| 11805 |
% \end{macro} |
| 11806 |
% |
| 11807 |
% \subsubsection{Internal functions for the environment} |
| 11808 |
% |
| 11809 |
% \begin{macro}{\@@_anskey_env_safe_outer:, \@@_anskey_env_safe_inner:, |
| 11810 |
% \@@_store_anskey_env:n} |
| 11811 |
% The function \cs{@@_store_anskey_safe_outer:} will return the |
| 11812 |
% appropriate messages when |anskey*| is executed outside the |
| 11813 |
% environment in which the \mykey{save-ans} key was activated |
| 11814 |
% or within the \myenv*{keyans}, \myenv*{keyans*} or \myenv*{keyanspic} |
| 11815 |
% environments. |
| 11816 |
% \iffalse |
| 11817 |
%% Internal function for msg when |anskey*| is outer or wrong. |
| 11818 |
% \fi |
| 11819 |
% \begin{macrocode} |
| 11820 |
\cs_new_protected:Nn \@@_anskey_env_safe_outer: |
| 11821 |
{ |
| 11822 |
\bool_if:NF \l_@@_store_active_bool |
| 11823 |
{ |
| 11824 |
\msg_error:nnn { enumext } { anskey-env-error } { anskey* } |
| 11825 |
} |
| 11826 |
\int_compare:nNnT { \l_@@_keyans_level_int } = { 1 } |
| 11827 |
{ |
| 11828 |
\msg_error:nnn { enumext } { anskey-env-wrong }{ keyans } |
| 11829 |
} |
| 11830 |
\int_compare:nNnT { \l_@@_keyans_level_h_int } = { 1 } |
| 11831 |
{ |
| 11832 |
\msg_error:nnn { enumext } { anskey-env-wrong } { keyans* } |
| 11833 |
} |
| 11834 |
\int_compare:nNnT { \l_@@_keyans_pic_level_int } = { 1 } |
| 11835 |
{ |
| 11836 |
\msg_error:nnn { enumext } { anskey-env-wrong } { keyanspic } |
| 11837 |
} |
| 11838 |
} |
| 11839 |
% \end{macrocode} |
| 11840 |
% The function \cs{@@_anskey_env_safe_inner:} will first check if |
| 11841 |
% preceded by a not numbered |\item| or if it is in \emph{math mode} |
| 11842 |
% returning the appropriate messages. |
| 11843 |
% \iffalse |
| 11844 |
%% Internal function for msg when |anskey*| is inner or math-mode |
| 11845 |
% \fi |
| 11846 |
% \begin{macrocode} |
| 11847 |
\cs_new_protected:Nn \@@_anskey_env_safe_inner: |
| 11848 |
{ |
| 11849 |
\bool_if:NF \l_@@_item_number_bool |
| 11850 |
{ |
| 11851 |
\msg_error:nn { enumext } { anskey-unnumber-item } |
| 11852 |
} |
| 11853 |
\mode_if_math:T |
| 11854 |
{ |
| 11855 |
\msg_error:nnn { enumext } { anskey-math-mode } { anskey* } |
| 11856 |
} |
| 11857 |
} |
| 11858 |
% \end{macrocode} |
| 11859 |
% The \cs{@@_store_anskey_env:n} function will first pass the |
| 11860 |
% \texttt{c-type} argument \mymeta{body} to the variable \cs{l_@@_store_anskey_env_tl} and |
| 11861 |
% replace the macro |\obeyedline| with |^^J| and then execute the |
| 11862 |
% |write-env| and |overwrite| keys, check the state of the |
| 11863 |
% variable \cs{l_@@_anskey_env_force_eol_bool} managed by the |force-eol| |
| 11864 |
% key and we will add \cs{c_@@_anskey_env_hidden_space_str} if |
| 11865 |
% necessary. Finally we will use |\exp_args:Ne| on the |
| 11866 |
% \cs{@@_store_anskey_arg:n} to expand the |\tl_retokenize:n| |
| 11867 |
% function which rescans the \cs{l_@@_store_anskey_env_tl} variable |
| 11868 |
% before processing it. |
| 11869 |
% \begin{macrocode} |
| 11870 |
\cs_new_protected:Npn \@@_store_anskey_env:n #1 |
| 11871 |
{ |
| 11872 |
\tl_set:Nn \l_@@_store_anskey_env_tl {#1} |
| 11873 |
\RenewDocumentCommand \obeyedline { } { \iow_char:N \^^J } |
| 11874 |
\tl_replace_all:Nee \l_@@_store_anskey_env_tl { \obeyedline } { \iow_char:N \^^J } |
| 11875 |
\@@_anskey_env_file_write:VV |
| 11876 |
\l_@@_write_anskey_env_file_name_tl \l_@@_store_anskey_env_tl |
| 11877 |
\bool_if:NF \l_@@_anskey_env_force_eol_bool |
| 11878 |
{ |
| 11879 |
\tl_put_right:Ne \l_@@_store_anskey_env_tl |
| 11880 |
{ |
| 11881 |
\c_@@_anskey_env_hidden_space_str |
| 11882 |
} |
| 11883 |
} |
| 11884 |
\exp_args:Ne |
| 11885 |
\@@_store_anskey_arg:n |
| 11886 |
{ |
| 11887 |
\tl_retokenize:n { \l_@@_store_anskey_env_tl } |
| 11888 |
} |
| 11889 |
} |
| 11890 |
% \end{macrocode} |
| 11891 |
% |
| 11892 |
% \smallskip |
| 11893 |
% |
| 11894 |
% \begin{important}* |
| 11895 |
% Since |\obeyedline| can be redefined by the user, for example to |
| 11896 |
% |\mbox{}\par|, it is necessary to redefine it to |^^J| in order to use |
| 11897 |
% |\tl_replace_all:Nee| otherwise it returns an error. |
| 11898 |
% \end{important} |
| 11899 |
% \end{macro} |
| 11900 |
% |
| 11901 |
% \subsection{Executing \texttt{check-ans} system and write \texttt{.log}}\label{fun:exec-after-env} |
| 11902 |
% |
| 11903 |
% \begin{macro}{\@@_execute_after_env:} |
| 11904 |
% The \cs{@@_execute_after_env:} function will first return the |
| 11905 |
% appropriate message for the end of the environment in which the |
| 11906 |
% \mykey{save-ans} key is being executed, then call the |
| 11907 |
% \cs{@@_item_answer_diff:} function and then will write the values of |
| 11908 |
% the global variables used to the |.log| file. If the key |
| 11909 |
% \mykey{check-ans} is active it will execute the function |
| 11910 |
% \cs{@@_check_ans_show:} and show the result in the terminal, otherwise |
| 11911 |
% it will execute the function \cs{@@_check_ans_log:} and write the |
| 11912 |
% results in the |.log| file and finally we execute the function |
| 11913 |
% \cs{@@_reset_global_vars:} returning the used variables to their |
| 11914 |
% original state. |
| 11915 |
% \iffalse |
| 11916 |
%% Function internal checking answer mechanism, clean vars and undefine |anskey*| environment. |
| 11917 |
% \fi |
| 11918 |
% \begin{macrocode} |
| 11919 |
\cs_new_protected:Nn \@@_execute_after_env: |
| 11920 |
{ |
| 11921 |
\int_compare:nNnT { \l_@@_level_int } = { 0 } |
| 11922 |
{ |
| 11923 |
\tl_if_empty:NF \g_@@_store_name_tl |
| 11924 |
{ |
| 11925 |
\@@_stop_save_ans_msg: |
| 11926 |
\@@_item_answer_diff: |
| 11927 |
\@@_log_global_vars: |
| 11928 |
\@@_log_answer_vars: |
| 11929 |
\bool_if:NTF \g_@@_check_ans_key_bool |
| 11930 |
{ |
| 11931 |
\@@_check_ans_show: |
| 11932 |
} |
| 11933 |
{ \@@_check_ans_log: } |
| 11934 |
} |
| 11935 |
\@@_reset_global_vars: |
| 11936 |
} |
| 11937 |
} |
| 11938 |
% \end{macrocode} |
| 11939 |
% |
| 11940 |
% \smallskip |
| 11941 |
% |
| 11942 |
% \begin{important}* |
| 11943 |
% This function is passed to the function \cs{@@_after_env:nn} for the |
| 11944 |
% environments \myenv*{enumext} (\S\ref{env:enumext}) and \myenv*{enumext*} (\S\ref{env:starred}) |
| 11945 |
% and it is executed only when the environments are not nested or at some level of these.. |
| 11946 |
% \end{important} |
| 11947 |
% \end{macro} |
| 11948 |
% |
| 11949 |
% \subsection{Common functions for \env{keyans}, \env{keyans*} and \env{keyanspic}} |
| 11950 |
% |
| 11951 |
% \subsubsection{Storing content in prop list} |
| 11952 |
% |
| 11953 |
% \begin{macro}{\@@_keyans_addto_prop:n} |
| 11954 |
% The function \cs{@@_keyans_addto_prop:n} will pass the the current \mymeta{label} for |\item*| |
| 11955 |
% in \myenv*{keyans} environment and the current \mymeta{label} for |
| 11956 |
% |\anspic*| in \myenv*{keyanspic} environment followed by the |
| 11957 |
% \mymeta{contents} of the \emph{optional argument} of both commands |
| 11958 |
% to the \cs{l_@@_store_current_label_tl} variable, which will be stored |
| 11959 |
% to the \emph{prop list} defined by the \mykey{save-ans} key using the |
| 11960 |
% function \cs{@@_store_addto_prop:V}. |
| 11961 |
% \iffalse |
| 11962 |
%% Function for storing in prop list for |keyans| and |keyanspic| environments. |
| 11963 |
% \fi |
| 11964 |
% \begin{macrocode} |
| 11965 |
\cs_new_protected:Npn \@@_keyans_addto_prop:n #1 |
| 11966 |
{ |
| 11967 |
\tl_clear:N \l_@@_store_current_label_tl |
| 11968 |
\int_compare:nNnTF { \l_@@_keyans_pic_level_int } = { 1 } |
| 11969 |
{ |
| 11970 |
\tl_put_right:Ne \l_@@_store_current_label_tl { \l_@@_label_vi_tl } |
| 11971 |
} |
| 11972 |
{ |
| 11973 |
\tl_put_right:Ne \l_@@_store_current_label_tl { \l_@@_label_v_tl } |
| 11974 |
} |
| 11975 |
% \end{macrocode} |
| 11976 |
% If the \emph{optional argument} is present and the \mykey{save-sep} |
| 11977 |
% key is not empty, we save it. |
| 11978 |
% \begin{macrocode} |
| 11979 |
\tl_if_novalue:nF { #1 } |
| 11980 |
{ |
| 11981 |
\tl_if_empty:NF \l_@@_store_keyans_item_opt_sep_v_tl |
| 11982 |
{ |
| 11983 |
\tl_put_right:NV \l_@@_store_current_label_tl \l_@@_store_keyans_item_opt_sep_v_tl |
| 11984 |
} |
| 11985 |
\tl_put_right:Nn \l_@@_store_current_label_tl { #1 } |
| 11986 |
} |
| 11987 |
\@@_store_addto_prop:V \l_@@_store_current_label_tl |
| 11988 |
} |
| 11989 |
% \end{macrocode} |
| 11990 |
% \end{macro} |
| 11991 |
% |
| 11992 |
% \subsubsection{The \texttt{save-ref} key for \env{keyans}, \env{keyans*} and \env{keyanspic}}\label{fun:save-ref-keyans} |
| 11993 |
% |
| 11994 |
% The \emph{\enquote{internal label and ref}} system for the \myenv*{keyans}, |
| 11995 |
% \myenv*{keyans*} and \myenv*{keyanspic} environments has \emph{slight differences} |
| 11996 |
% with the one implemented for \ics*{anskey} basically because in this |
| 11997 |
% environments the interest is in the current \mymeta{label} for |\item*| |
| 11998 |
% and |\anspic*| with the \mymeta{contents} of the \emph{optional argument}. The mechanism |
| 11999 |
% defined here will allow to execute \ics{ref}\mymarg{store name \textcolor{red}{:} position} and |
| 12000 |
% will return |1.(A)|. |
| 12001 |
% |
| 12002 |
% \begin{macro}{\@@_keyans_store_ref:, \@@_keyans_store_ref_aux_i:, |
| 12003 |
% \@@_keyans_store_ref_aux_ii:,} |
| 12004 |
% The function \cs{@@_keyans_store_ref:} handles the |
| 12005 |
% \emph{\enquote{internal label and ref}} system used by the |
| 12006 |
% \mykey{save-ref} key for \ics*{item*} and \ics*{anspic*} commands. |
| 12007 |
% First we will create copies of the current \mymeta{labels} and remove |
| 12008 |
% the dots \enquote{\textcolor{red}{\texttt{.}}} from them, we do not |
| 12009 |
% want to get double dots in references. |
| 12010 |
% \iffalse |
| 12011 |
%% Internal label and ref function for |keyans|, |keyans*| and |keyanspic| environments. |
| 12012 |
% \fi |
| 12013 |
% \begin{macrocode} |
| 12014 |
\cs_new_protected:Nn \@@_keyans_store_ref: |
| 12015 |
{ |
| 12016 |
\bool_if:NT \l_@@_store_ref_key_bool |
| 12017 |
{ |
| 12018 |
\cs_set_protected:Npn \@@_tmp:n ##1 |
| 12019 |
{ |
| 12020 |
\tl_set_eq:cc { l_@@_label_copy_##1_tl } { l_@@_label_##1_tl } |
| 12021 |
\tl_reverse:c { l_@@_label_copy_##1_tl } |
| 12022 |
\tl_remove_once:cn { l_@@_label_copy_##1_tl } { . } |
| 12023 |
\tl_reverse:c { l_@@_label_copy_##1_tl } |
| 12024 |
} |
| 12025 |
\clist_map_inline:nn { i, v, vi, vii, viii } { \@@_tmp:n {##1} } |
| 12026 |
\@@_keyans_store_ref_aux_i: |
| 12027 |
} |
| 12028 |
} |
| 12029 |
% \end{macrocode} |
| 12030 |
% The auxiliary function \cs{@@_keyans_store_ref_aux_i:} set the |
| 12031 |
% variable \cs{l_@@_newlabel_arg_one_tl} which will contain |
| 12032 |
% \mymarg{store name \textcolor{red}{:} position} analyzing whether |
| 12033 |
% the environment in which they are executed is \myenv*{enumext*} or |
| 12034 |
% \myenv*{enumext}. |
| 12035 |
% \begin{macrocode} |
| 12036 |
\cs_new_protected:Nn \@@_keyans_store_ref_aux_i: |
| 12037 |
{ |
| 12038 |
\bool_if:NT \g_@@_starred_bool |
| 12039 |
{ |
| 12040 |
\tl_set_eq:NN \l_@@_label_copy_i_tl \l_@@_label_copy_vii_tl |
| 12041 |
} |
| 12042 |
\int_compare:nNnT { \l_@@_keyans_pic_level_int } = { 1 } |
| 12043 |
{ |
| 12044 |
\tl_put_right:Ne \l_@@_newlabel_arg_two_tl |
| 12045 |
{ \l_@@_label_copy_i_tl . \l_@@_label_copy_vi_tl } |
| 12046 |
} |
| 12047 |
\int_compare:nNnT { \l_@@_keyans_level_int } = { 1 } |
| 12048 |
{ |
| 12049 |
\tl_put_right:Ne \l_@@_newlabel_arg_two_tl |
| 12050 |
{ \l_@@_label_copy_i_tl . \l_@@_label_copy_v_tl } |
| 12051 |
} |
| 12052 |
\int_compare:nNnT { \l_@@_keyans_level_h_int } = { 1 } |
| 12053 |
{ |
| 12054 |
\tl_put_right:Ne \l_@@_newlabel_arg_two_tl |
| 12055 |
{ \l_@@_label_copy_i_tl . \l_@@_label_copy_viii_tl } |
| 12056 |
} |
| 12057 |
\tl_put_right:Ne \l_@@_newlabel_arg_one_tl |
| 12058 |
{ |
| 12059 |
\l_@@_store_name_tl \c_colon_str |
| 12060 |
\int_eval:n { \prop_count:c { g_@@_ \l_@@_store_name_tl _prop } } |
| 12061 |
} |
| 12062 |
\@@_keyans_store_ref_aux_ii: |
| 12063 |
} |
| 12064 |
% \end{macrocode} |
| 12065 |
% Now auxiliary function \cs{@@_keyans_store_ref_aux_ii:} save the |
| 12066 |
% result in the variable \cs{l_@@_write_aux_file_tl} and finally we |
| 12067 |
% write in the |.aux| file. |
| 12068 |
% \begin{macrocode} |
| 12069 |
\cs_new_protected:Nn \@@_keyans_store_ref_aux_ii: |
| 12070 |
{ |
| 12071 |
\tl_put_right:Ne \l_@@_write_aux_file_tl |
| 12072 |
{ |
| 12073 |
\@@_newlabel:nn |
| 12074 |
{ \exp_not:V \l_@@_newlabel_arg_one_tl } |
| 12075 |
{ \l_@@_newlabel_arg_two_tl } |
| 12076 |
} |
| 12077 |
\l_@@_write_aux_file_tl |
| 12078 |
} |
| 12079 |
% \end{macrocode} |
| 12080 |
% \end{macro} |
| 12081 |
% |
| 12082 |
% \subsubsection{Storing content in sequence} |
| 12083 |
% |
| 12084 |
% \begin{macro}{\@@_keyans_addto_seq:n, \@@_keyans_addto_seq_link:} |
| 12085 |
% The function \cs{@@_keyans_addto_seq:n} will pass the |
| 12086 |
% contents of the current \mymeta{label} \cs{l_@@_label_v_tl} for the |
| 12087 |
% \myenv*{keyans} environment and the \cs{l_@@_label_vi_tl} for the \myenv*{keyanspic} environment when using |
| 12088 |
% \ics*{item*} and \ics*{anspic*}, followed by the \mymeta{contents} of the |
| 12089 |
% \emph{optional argument} of both commands to the \cs{l_@@_store_current_label_tl} |
| 12090 |
% variable to the sequence defined by the \mykey{save-ans} key. |
| 12091 |
% \iffalse |
| 12092 |
%% Function for storing in sequence for |keyans| and |keyanspic| environments. |
| 12093 |
% \fi |
| 12094 |
% \begin{macrocode} |
| 12095 |
\cs_new_protected:Npn \@@_keyans_addto_seq:n #1 |
| 12096 |
{ |
| 12097 |
\tl_clear:N \l_@@_store_current_label_tl |
| 12098 |
\int_compare:nNnTF { \l_@@_keyans_pic_level_int } = { 1 } |
| 12099 |
{ |
| 12100 |
\tl_put_right:Ne \l_@@_store_current_label_tl { \item \l_@@_label_vi_tl } |
| 12101 |
} |
| 12102 |
{ |
| 12103 |
\tl_put_right:Ne \l_@@_store_current_label_tl { \item \l_@@_label_v_tl } |
| 12104 |
} |
| 12105 |
\tl_if_novalue:nF { #1 } |
| 12106 |
{ |
| 12107 |
\tl_if_empty:NF \l_@@_store_keyans_item_opt_sep_v_tl |
| 12108 |
{ |
| 12109 |
\tl_put_right:NV \l_@@_store_current_label_tl \l_@@_store_keyans_item_opt_sep_v_tl |
| 12110 |
} |
| 12111 |
\tl_put_right:Nn \l_@@_store_current_label_tl { #1 } |
| 12112 |
} |
| 12113 |
\@@_keyans_addto_seq_link: |
| 12114 |
} |
| 12115 |
% \end{macrocode} |
| 12116 |
% Checks if the \mykey{save-ref} key is active along with the |
| 12117 |
% \mypkg{hyperref} package load, if both conditions are met, it will |
| 12118 |
% create the \ics{hyperlink} and then store using the |
| 12119 |
% \cs{@@_store_addto_seq:V} function. |
| 12120 |
% Finally, copy the contents of the variable \cs{l_@@_store_current_label_tl} |
| 12121 |
% into the global variable \cs{g_@@_check_ans_item_tl} to be used |
| 12122 |
% by the function \cs{@@_check_starred_cmd:n} and increment |
| 12123 |
% the value of the integer variable \cs{g_@@_item_anskey_int} handled |
| 12124 |
% by the \mykey{check-ans} key. |
| 12125 |
% \begin{macrocode} |
| 12126 |
\cs_new_protected:Nn \@@_keyans_addto_seq_link: |
| 12127 |
{ |
| 12128 |
\bool_lazy_and:nnT |
| 12129 |
{ \bool_if_p:N \l_@@_store_ref_key_bool } |
| 12130 |
{ \bool_if_p:N \l_@@_hyperref_bool } |
| 12131 |
{ |
| 12132 |
\tl_put_right:Ne \l_@@_store_current_label_tl |
| 12133 |
{ |
| 12134 |
\hfill \exp_not:N \hyperlink |
| 12135 |
{ |
| 12136 |
\exp_not:V \l_@@_newlabel_arg_one_tl |
| 12137 |
} |
| 12138 |
{ \exp_not:V \l_@@_mark_ref_sym_tl } |
| 12139 |
} |
| 12140 |
} |
| 12141 |
\@@_store_addto_seq:V \l_@@_store_current_label_tl |
| 12142 |
\bool_if:NT \l_@@_check_answers_bool |
| 12143 |
{ |
| 12144 |
\int_gincr:N \g_@@_item_anskey_int |
| 12145 |
} |
| 12146 |
} |
| 12147 |
% \end{macrocode} |
| 12148 |
% \end{macro} |
| 12149 |
% |
| 12150 |
% \subsubsection{The \texttt{show-ans} and \texttt{show-pos} keys for \env{keyans} and \env{keyanspic}} |
| 12151 |
% |
| 12152 |
% \begin{macro}{\@@_keyans_save_item_opt:n,\@@_keyans_show_item_opt:, |
| 12153 |
% \@@_keyans_show_item_opt_viii:, } |
| 12154 |
% The function \cs{@@_keyans_save_item_opt:n} will save the optional |
| 12155 |
% argument of |\item*| and |\anspic*| in the variable |
| 12156 |
% \cs{l_@@_store_current_opt_arg_tl}. |
| 12157 |
% \iffalse |
| 12158 |
%% Function for |wrap-opt| key for |keyans|, |keyanspic| and |keyans*| environments. |
| 12159 |
% \fi |
| 12160 |
% \begin{macrocode} |
| 12161 |
\cs_new_protected:Npn \@@_keyans_save_item_opt:n #1 |
| 12162 |
{ |
| 12163 |
\tl_if_novalue:nF { #1 } |
| 12164 |
{ |
| 12165 |
\tl_set:Nn \l_@@_store_current_opt_arg_tl { #1 } |
| 12166 |
} |
| 12167 |
} |
| 12168 |
% \end{macrocode} |
| 12169 |
% The function \cs{@@_keyans_show_item_opt:} will print the optional |
| 12170 |
% arguments of |\item*| and |\anspic*| when the \mykey{show-ans} or |
| 12171 |
% \mykey{show-pos} keys are set next to the key \mykey{wrap-opt} in |
| 12172 |
% \myenv*{keyans} and \myenv*{keyanspic} environments. |
| 12173 |
% \begin{macrocode} |
| 12174 |
\cs_new_protected:Nn \@@_keyans_show_item_opt: |
| 12175 |
{ |
| 12176 |
\tl_if_empty:NF \l_@@_store_current_opt_arg_tl |
| 12177 |
{ |
| 12178 |
\bool_lazy_or:nnT |
| 12179 |
{ \bool_if_p:N \l_@@_show_answer_bool } |
| 12180 |
{ \bool_if_p:N \l_@@_show_position_bool } |
| 12181 |
{ |
| 12182 |
\@@_keyans_wrapper_opt_v:n |
| 12183 |
{ \l_@@_store_current_opt_arg_tl } \c_space_tl |
| 12184 |
} |
| 12185 |
} |
| 12186 |
} |
| 12187 |
% \end{macrocode} |
| 12188 |
% The function \cs{@@_keyans_show_item_opt_viii:} will print the optional |
| 12189 |
% argument of |\item*| when the \mykey{show-ans} or \mykey{show-pos} |
| 12190 |
% keys are set next to the key \mykey{wrap-opt} in \myenv*{keyans*} |
| 12191 |
% environment. |
| 12192 |
% \begin{macrocode} |
| 12193 |
\cs_new_protected:Nn \@@_keyans_show_item_opt_viii: |
| 12194 |
{ |
| 12195 |
\tl_if_empty:NF \l_@@_store_current_opt_arg_tl |
| 12196 |
{ |
| 12197 |
\bool_lazy_or:nnT |
| 12198 |
{ \bool_if_p:N \l_@@_show_answer_bool } |
| 12199 |
{ \bool_if_p:N \l_@@_show_position_bool } |
| 12200 |
{ |
| 12201 |
\@@_keyans_wrapper_opt_viii:n |
| 12202 |
{ \l_@@_store_current_opt_arg_tl } \c_space_tl |
| 12203 |
} |
| 12204 |
} |
| 12205 |
} |
| 12206 |
% \end{macrocode} |
| 12207 |
% \end{macro} |
| 12208 |
% |
| 12209 |
% \begin{macro}{\@@_keyans_pos_mark_set:, \@@_keyans_show_ans:, \@@_keyans_show_pos:} |
| 12210 |
% The function \cs{@@_keyans_pos_mark_set:} adjusts the horizontal |
| 12211 |
% spaces for the \mykey{mark-sep*} key taking into account the value of |
| 12212 |
% the \mykey{align} key and the width of \mymeta{label}. |
| 12213 |
% \iffalse |
| 12214 |
%% Function for |mark-sep*|, |show-ans| and |show-pos| keys for |keyans| and |keyanspic| environments. |
| 12215 |
% \fi |
| 12216 |
% \begin{macrocode} |
| 12217 |
\cs_new_protected:Nn \@@_keyans_pos_mark_set: |
| 12218 |
{ |
| 12219 |
\@@_label_width_by_box:Nn |
| 12220 |
\l_@@_mark_sep_tmpa_dim { \l_@@_label_v_tl } |
| 12221 |
\str_case:Vn \l_@@_align_label_pos_v_str |
| 12222 |
{ |
| 12223 |
{ l } |
| 12224 |
{ |
| 12225 |
\dim_set:Nn \l_@@_mark_sep_tmpb_dim { \c_zero_dim } |
| 12226 |
} |
| 12227 |
{ r } |
| 12228 |
{ |
| 12229 |
\dim_set:Nn \l_@@_mark_sep_tmpb_dim |
| 12230 |
{ \l_@@_labelwidth_v_dim - \l_@@_mark_sep_tmpa_dim } |
| 12231 |
} |
| 12232 |
{ c } |
| 12233 |
{ |
| 12234 |
\dim_set:Nn \l_@@_mark_sep_tmpb_dim |
| 12235 |
{ 0.5\l_@@_labelwidth_v_dim - 0.5\l_@@_mark_sep_tmpa_dim } |
| 12236 |
} |
| 12237 |
} |
| 12238 |
% \end{macrocode} |
| 12239 |
% Here we set the default values for the key \mykey{mark-ans*}, \mykey{mark-sep*} and \mykey{mark-pos*}. |
| 12240 |
% \begin{macrocode} |
| 12241 |
\dim_compare:nNnT { \l_@@_mark_sym_sep_v_dim } = { \c_zero_dim } |
| 12242 |
{ |
| 12243 |
\dim_set:Nn \l_@@_mark_sym_sep_v_dim { \l_@@_labelsep_v_dim } |
| 12244 |
} |
| 12245 |
\tl_set_eq:NN \l_@@_mark_answer_sym_tl \l_@@_mark_answer_sym_v_tl |
| 12246 |
\dim_add:Nn \l_@@_mark_sym_sep_v_dim { \l_@@_mark_sep_tmpb_dim } |
| 12247 |
\str_set_eq:NN \l_@@_mark_position_str \l_@@_mark_position_v_str |
| 12248 |
} |
| 12249 |
% \end{macrocode} |
| 12250 |
% The function \cs{@@_keyans_show_ans:} will print the \mymeta{symbol} |
| 12251 |
% set by the \mykey{mark-ans*} key when the \mykey{show-ans} key is active. |
| 12252 |
% \begin{macrocode} |
| 12253 |
\cs_new_protected:Nn \@@_keyans_show_ans: |
| 12254 |
{ |
| 12255 |
\bool_lazy_all:nT |
| 12256 |
{ |
| 12257 |
{ \bool_if_p:N \l_@@_show_answer_bool } |
| 12258 |
{ \bool_if_p:N \l_@@_item_wrap_key_bool } |
| 12259 |
} |
| 12260 |
{ |
| 12261 |
\@@_keyans_pos_mark_set: |
| 12262 |
\@@_print_keyans_box:NN |
| 12263 |
\l_@@_labelwidth_v_dim \l_@@_mark_sym_sep_v_dim |
| 12264 |
} |
| 12265 |
} |
| 12266 |
% \end{macrocode} |
| 12267 |
% The function \cs{@@_keyans_show_pos:} will print the \mymeta{position} |
| 12268 |
% of the stored content in \emph{prop list}. Need add |1| to |
| 12269 |
% \myvarenv{g__@@_\mymeta[cf=gray]{store name}_prop} for \myenv*{keyans} |
| 12270 |
% environment. |
| 12271 |
% \begin{macrocode} |
| 12272 |
\cs_new_protected:Nn \@@_keyans_show_pos: |
| 12273 |
{ |
| 12274 |
\int_compare:nNnTF { \l_@@_keyans_level_int } = { 1 } |
| 12275 |
{ |
| 12276 |
\int_incr:N \l_@@_show_pos_tmp_int |
| 12277 |
} |
| 12278 |
{ |
| 12279 |
\int_zero:N \l_@@_show_pos_tmp_int |
| 12280 |
} |
| 12281 |
\bool_lazy_all:nT |
| 12282 |
{ |
| 12283 |
{ \bool_if_p:N \l_@@_show_position_bool } |
| 12284 |
{ \bool_if_p:N \l_@@_item_wrap_key_bool } |
| 12285 |
} |
| 12286 |
{ |
| 12287 |
\tl_set:Ne \l_@@_mark_answer_sym_v_tl |
| 12288 |
{ |
| 12289 |
\group_begin: |
| 12290 |
\exp_not:N \normalfont |
| 12291 |
\exp_not:N \footnotesize [ \int_eval:n |
| 12292 |
{ |
| 12293 |
\prop_count:c { g_@@_ \l_@@_store_name_tl _prop } |
| 12294 |
+ \l_@@_show_pos_tmp_int |
| 12295 |
} |
| 12296 |
] |
| 12297 |
\group_end: |
| 12298 |
} |
| 12299 |
\@@_keyans_pos_mark_set: |
| 12300 |
\@@_print_keyans_box:NN |
| 12301 |
\l_@@_labelwidth_v_dim \l_@@_mark_sym_sep_v_dim |
| 12302 |
} |
| 12303 |
} |
| 12304 |
% \end{macrocode} |
| 12305 |
% \end{macro} |
| 12306 |
% |
| 12307 |
% \subsection{Redefining \cs{item} and \cs{makelabel} in \env{enumext}}\label{env:item-starred-enumext} |
| 12308 |
% |
| 12309 |
% Redefining the |\item| command is not as simple as I thought. This |
| 12310 |
% command works in conjunction with the \ics{makelabel} command so I have |
| 12311 |
% to redefine both of them, in addition to this, we will have to use a |
| 12312 |
% couple of \emph{global} variables to pass the values from one command |
| 12313 |
% to the other. |
| 12314 |
% |
| 12315 |
% \smallskip |
| 12316 |
% |
| 12317 |
% When \emph{labeling} \texttt{PDF} is active |\makelabel| is redefined |
| 12318 |
% as |\hss #1| and the only way to get the \mykey{align} key to work |
| 12319 |
% correctly is to redefine |\makelabel| using |\makebox|. The best way to |
| 12320 |
% implement this is to use the conditional command |\IfDocumentMetadataTF| |
| 12321 |
% to force this redefinition and the dedicated \mykey{mode-box} key to |
| 12322 |
% manually activate it by the user. |
| 12323 |
% |
| 12324 |
% \smallskip |
| 12325 |
% |
| 12326 |
% The \ics*{item} and \ics*{item}\myoarg{custom} commands work in the |
| 12327 |
% usual way on \myenv*{enumext} and we will add \ics*{item*}, \ics*{item*}\myoarg{symbol} and |
| 12328 |
% \ics*{item*}\myoarg{symbol}\myoarg{offset}. |
| 12329 |
% |
| 12330 |
% \begin{macro}[int]{\@@_default_item:n} |
| 12331 |
% First we will see if the \emph{optional argument} is present, if it is NOT |
| 12332 |
% present we will check the state of the variable \cs{l_@@_check_answers_bool} |
| 12333 |
% set by the key \mykey{no-store}, set the boolean variable |
| 12334 |
% \myvarenv{l__@@_wrap_label_X_bool} to \enquote{true} for the key \mykey{wrap-label} |
| 12335 |
% and execute \cs{@@_item_std:w} and the key \mykey{itemindent}, otherwise we will check the state |
| 12336 |
% of the boolean variable \myvarenv{l__@@_wrap_label_opt_X_bool} set |
| 12337 |
% by the key \mykey{wrap-label*} and execute \cs{@@_item_std:w} with |
| 12338 |
% the \emph{optional argument} and the key \mykey{itemindent}. |
| 12339 |
% \iffalse |
| 12340 |
%% Internal function for |\item| with check-answer mechanism in |enumext| environment. |
| 12341 |
% \fi |
| 12342 |
% \begin{macrocode} |
| 12343 |
\cs_new_protected:Npn \@@_default_item:n #1 |
| 12344 |
{ |
| 12345 |
\tl_if_novalue:nTF {#1} |
| 12346 |
{ |
| 12347 |
\bool_if:NT \l_@@_check_answers_bool |
| 12348 |
{ |
| 12349 |
\int_gincr:N \g_@@_item_number_int |
| 12350 |
\bool_set_true:N \l_@@_item_number_bool |
| 12351 |
} |
| 12352 |
\bool_set_true:c { l_@@_wrap_label_ \@@_level: _bool } |
| 12353 |
\@@_item_std:w \tl_use:c { l_@@_fake_item_indent_ \@@_level: _tl } |
| 12354 |
} |
| 12355 |
{ |
| 12356 |
\bool_set_eq:cc |
| 12357 |
{ l_@@_wrap_label_ \@@_level: _bool } |
| 12358 |
{ l_@@_wrap_label_opt_ \@@_level: _bool } |
| 12359 |
\@@_item_std:w [#1] \tl_use:c { l_@@_fake_item_indent_ \@@_level: _tl } |
| 12360 |
} |
| 12361 |
} |
| 12362 |
% \end{macrocode} |
| 12363 |
% \end{macro} |
| 12364 |
% |
| 12365 |
% \begin{macro}[int]{\@@_item_starred_exec:nn, \@@_item_starred_exec:,} |
| 12366 |
% The \ics*{item*}, \ics*{item*}\myoarg{symbol} and \ics*{item*}\myoarg{symbol}\myoarg{offset} |
| 12367 |
% works like the \emph{numbered} |\item|, but placing a \mymeta{symbol} |
| 12368 |
% to the \emph{\enquote{left}} of the \mymeta{label} separated from |
| 12369 |
% it by the value the second \emph{optional argument} \mymeta{offset}. |
| 12370 |
% |
| 12371 |
% \begin{arguments} |
| 12372 |
% \item \myvarenv{l__@@_item_symbol_X_tl} |
| 12373 |
% \item \myvarenv{l__@@_item_symbol_sep_X_dim} |
| 12374 |
% \end{arguments} |
| 12375 |
% |
| 12376 |
% First we will make a copy of \myvarenv{l__@@_item_symbol_X_tl} which is |
| 12377 |
% set by the key \mykey{item-sym*} or passed as \emph{\enquote{first}} \emph{optional argument} in |
| 12378 |
% the global variable \cs{g_@@_item_symbol_aux_tl}, followed by setting the |
| 12379 |
% variable \myvarenv{l__@@_item_symbol_sep_X_dim} set by the key |
| 12380 |
% \mykey{item-pos*} or by the \emph{\enquote{second}} \emph{optional argument}, |
| 12381 |
% then we will see the state of the variable \cs{l_@@_check_answers_bool} |
| 12382 |
% set by the key \mykey{no-store}, set the boolean variable |
| 12383 |
% \myvarenv{l__@@_wrap_label_X_bool} to \enquote{true} for the key \mykey{wrap-label} |
| 12384 |
% and execute \cs{@@_item_std:w} and the key \mykey{itemindent}. |
| 12385 |
% \iffalse |
| 12386 |
%% Internal function for |\item*[symb][sep]| with check-answer mechanism in |enumext| environment. |
| 12387 |
% \fi |
| 12388 |
% \begin{macrocode} |
| 12389 |
\cs_new_protected:Npn \@@_item_starred_exec:nn #1 #2 |
| 12390 |
{ |
| 12391 |
\tl_if_novalue:nTF {#1} |
| 12392 |
{ |
| 12393 |
\tl_gset_eq:Nc |
| 12394 |
\g_@@_item_symbol_aux_tl { l_@@_item_symbol_ \@@_level: _tl } |
| 12395 |
} |
| 12396 |
{ |
| 12397 |
\tl_gset:Nn \g_@@_item_symbol_aux_tl {#1} |
| 12398 |
} |
| 12399 |
\tl_if_novalue:nTF {#2} |
| 12400 |
{ |
| 12401 |
\dim_set_eq:cc |
| 12402 |
{ l_@@_item_symbol_sep_ \@@_level: _dim } |
| 12403 |
{ l_@@_labelsep_ \@@_level: _dim } |
| 12404 |
} |
| 12405 |
{ |
| 12406 |
\dim_set:cn { l_@@_item_symbol_sep_ \@@_level: _dim } {#2} |
| 12407 |
} |
| 12408 |
\bool_if:NT \l_@@_check_answers_bool |
| 12409 |
{ |
| 12410 |
\int_gincr:N \g_@@_item_number_int |
| 12411 |
\bool_set_true:N \l_@@_item_number_bool |
| 12412 |
} |
| 12413 |
\bool_set_true:c { l_@@_wrap_label_ \@@_level: _bool } |
| 12414 |
\@@_item_std:w \tl_use:c { l_@@_fake_item_indent_ \@@_level: _tl } |
| 12415 |
} |
| 12416 |
% \end{macrocode} |
| 12417 |
% The function \cs{@@_item_starred_exec:} will be responsible for |
| 12418 |
% executing |\item*| for the \myenv*{enumext} environment. |
| 12419 |
% \iffalse |
| 12420 |
%% Function for |\item*[sym][sep]| in |\makelabel| for |enumext| environment. |
| 12421 |
% \fi |
| 12422 |
% \begin{macrocode} |
| 12423 |
\cs_new_protected:Nn \@@_item_starred_exec: |
| 12424 |
{ |
| 12425 |
\tl_if_empty:cF { l_@@_item_symbol_ \@@_level: _tl } |
| 12426 |
{ |
| 12427 |
\mode_leave_vertical: |
| 12428 |
\skip_horizontal:n { -\dim_use:c { l_@@_item_symbol_sep_ \@@_level: _dim } } |
| 12429 |
\hbox_overlap_left:n { \g_@@_item_symbol_aux_tl } |
| 12430 |
\skip_horizontal:n { \dim_use:c { l_@@_item_symbol_sep_ \@@_level: _dim } } |
| 12431 |
} |
| 12432 |
} |
| 12433 |
% \end{macrocode} |
| 12434 |
% \end{macro} |
| 12435 |
% |
| 12436 |
% \begin{macro}{\@@_redefine_item:} |
| 12437 |
% The function \cs{@@_redefine_item:} will redefine the |\item| |
| 12438 |
% command in the \myenv*{enumext} environment adding |\item*|. |
| 12439 |
% This function are passed to \myvarenv{__@@_list_arg_two_X:} used |
| 12440 |
% in the definition of the \myenv*{enumext} environment (\S\ref{env:enumext}). |
| 12441 |
% \iffalse |
| 12442 |
%% Redefinition of |\item| for |\item*[sym][sep]| in |enumext| environment. |
| 12443 |
% \fi |
| 12444 |
% \begin{macrocode} |
| 12445 |
\cs_new_protected:Nn \@@_redefine_item: |
| 12446 |
{ |
| 12447 |
\RenewDocumentCommand \item { s o o } |
| 12448 |
{ |
| 12449 |
\bool_if:nTF {##1} |
| 12450 |
{ |
| 12451 |
\@@_item_starred_exec:nn {##2} {##3} |
| 12452 |
} |
| 12453 |
{ \@@_default_item:n {##2} } |
| 12454 |
} |
| 12455 |
} |
| 12456 |
% \end{macrocode} |
| 12457 |
% \end{macro} |
| 12458 |
% |
| 12459 |
% \medskip |
| 12460 |
% |
| 12461 |
% \begin{macro}{\@@_make_label:,\@@_make_label_std:,\@@_make_label_box:} |
| 12462 |
% The function \cs{@@_make_label:} redefine \ics{makelabel} for the keys |
| 12463 |
% \mykey{mode-box}, \mykey{align}, \mykey{font}, \mykey{wrap-label}, |
| 12464 |
% \mykey{wrap-label*} and |\item*| for \myenv*{enumext} environment. |
| 12465 |
% This function are passed to \myvarenv{__@@_list_arg_two_X:} used |
| 12466 |
% in the definition of the \myenv*{enumext} environment (\S\ref{env:enumext}). |
| 12467 |
% \iffalse |
| 12468 |
%% Redefinition of |\makelabel| for |\item| and |\item*[sym][sep]| in |enumext| environment. |
| 12469 |
% \fi |
| 12470 |
% \begin{macrocode} |
| 12471 |
\cs_new_protected:Nn \@@_make_label: |
| 12472 |
{ |
| 12473 |
\IfDocumentMetadataTF |
| 12474 |
{ |
| 12475 |
\@@_make_label_box: |
| 12476 |
} |
| 12477 |
{ |
| 12478 |
\bool_if:NTF \l_@@_mode_box_bool |
| 12479 |
{ |
| 12480 |
\@@_make_label_box: |
| 12481 |
} |
| 12482 |
{ |
| 12483 |
\@@_make_label_std: |
| 12484 |
} |
| 12485 |
} |
| 12486 |
} |
| 12487 |
% \end{macrocode} |
| 12488 |
% Standard definition when |\DocumentMetadata| is not active. |
| 12489 |
% \begin{macrocode} |
| 12490 |
\cs_new_protected:Nn \@@_make_label_std: |
| 12491 |
{ |
| 12492 |
\RenewDocumentCommand \makelabel { m } |
| 12493 |
{ |
| 12494 |
\tl_use:c { l_@@_label_fill_left_ \@@_level: _tl } |
| 12495 |
\@@_item_starred_exec: |
| 12496 |
\tl_use:c { l_@@_label_font_style_ \@@_level: _tl } |
| 12497 |
\bool_if:cTF { l_@@_wrap_label_ \@@_level: _bool } |
| 12498 |
{ |
| 12499 |
\use:c { @@_wrapper_label_ \@@_level: :n } { ##1 } |
| 12500 |
} |
| 12501 |
{ ##1 } |
| 12502 |
\tl_use:c { l_@@_label_fill_right_ \@@_level: _tl } |
| 12503 |
\tl_gclear:N \g_@@_item_symbol_aux_tl |
| 12504 |
} |
| 12505 |
} |
| 12506 |
% \end{macrocode} |
| 12507 |
% Definition using |\makebox| when |\DocumentMetadata| is active or |
| 12508 |
% \mykey{mode-box} is active. |
| 12509 |
% |
| 12510 |
% \begin{important} |
| 12511 |
% Here it is necessary to use |\strut\smash| to maintain text \emph{alignment} |
| 12512 |
% in case the user wants to use |\labelbx| for example. In my experiments |
| 12513 |
% with \emph{mimicking} the \myenv{description} environment it was the only way |
| 12514 |
% out and it seems to have no adverse effects and may serve in the future |
| 12515 |
% as a basis for a more generic \myenv{list} environment package than |
| 12516 |
% \mypkg*{enumext}. |
| 12517 |
% \end{important} |
| 12518 |
% |
| 12519 |
% \begin{macrocode} |
| 12520 |
\cs_new_protected:Nn \@@_make_label_box: |
| 12521 |
{ |
| 12522 |
\RenewDocumentCommand \makelabel { m } |
| 12523 |
{ |
| 12524 |
\strut\smash |
| 12525 |
{ |
| 12526 |
\makebox |
| 12527 |
[ \dim_use:c { l_@@_labelwidth_ \@@_level: _dim } ] |
| 12528 |
[ \str_use:c { l_@@_align_label_pos_ \@@_level: _str } ] |
| 12529 |
{ |
| 12530 |
\@@_item_starred_exec: |
| 12531 |
\tl_use:c { l_@@_label_font_style_ \@@_level: _tl } |
| 12532 |
\bool_if:cTF { l_@@_wrap_label_ \@@_level: _bool } |
| 12533 |
{ |
| 12534 |
\use:c { @@_wrapper_label_ \@@_level: :n } { ##1 } |
| 12535 |
} |
| 12536 |
{ ##1 } |
| 12537 |
\tl_gclear:N \g_@@_item_symbol_aux_tl |
| 12538 |
} |
| 12539 |
} % close smash |
| 12540 |
} |
| 12541 |
} |
| 12542 |
% \end{macrocode} |
| 12543 |
% \end{macro} |
| 12544 |
% |
| 12545 |
% \subsection{Setting \texttt{item-sym*} and \texttt{item-pos*} keys}\label{key:item-starred} |
| 12546 |
% |
| 12547 |
% In order to have a cleaner implementation of |\item*| for the |
| 12548 |
% \myenv*{enumext} and \myenv*{enumext*} environments it is best to |
| 12549 |
% define a couple of keys that allow us to control and set by default the |
| 12550 |
% \mymeta{symbol} and its \mymeta{offset}. |
| 12551 |
% |
| 12552 |
% \begin{macro}[int]{item-sym*, item-pos*} |
| 12553 |
% Define and set \mykey{item-sym*} and \mykey{item-pos*} keys for |
| 12554 |
% \myenv*{enumext} and \myenv*{enumext*}. |
| 12555 |
% \iffalse |
| 12556 |
%% Add |item-sym*| and |item-sep*| keys. |
| 12557 |
% \fi |
| 12558 |
% \begin{macrocode} |
| 12559 |
\cs_set_protected:Npn \@@_tmp:nn #1 #2 |
| 12560 |
{ |
| 12561 |
\keys_define:nn { enumext / #1 } |
| 12562 |
{ |
| 12563 |
item-sym* .tl_set:c = { l_@@_item_symbol_#2_tl }, |
| 12564 |
item-sym* .value_required:n = true, |
| 12565 |
item-sym* .initial:n = {\textborn}, |
| 12566 |
item-pos* .dim_set:c = { l_@@_item_symbol_sep_#2_dim }, |
| 12567 |
item-pos* .value_required:n = true, |
| 12568 |
} |
| 12569 |
} |
| 12570 |
\clist_map_inline:nn |
| 12571 |
{ |
| 12572 |
{level-1}{i}, {level-2}{ii}, {level-3}{iii}, {level-4}{iv}, {enumext*}{vii} |
| 12573 |
} |
| 12574 |
{ \@@_tmp:nn #1 } |
| 12575 |
% \end{macrocode} |
| 12576 |
% \end{macro} |
| 12577 |
% |
| 12578 |
% \subsection{Handling unknown keys}\label{key:unknown-keys} |
| 12579 |
% |
| 12580 |
% At this point in the code I already know that I will NOT add more |
| 12581 |
% \mymeta{keys} for and since I have already been quite \emph{paranoid and |
| 12582 |
% restrictive} with the definitions of environments and commands, the |
| 12583 |
% only thing left to do is do it with the \mymeta{keys} (you have to be |
| 12584 |
% consistent in life). |
| 12585 |
% |
| 12586 |
% \smallskip |
| 12587 |
% |
| 12588 |
% \begin{important}* |
| 12589 |
% Well, the paragraph above is not so real, after all I had to add more |
| 12590 |
% \mymeta{keys} than I had planned, not everything turns out the way one thinks in |
| 12591 |
% life. |
| 12592 |
% \end{important} |
| 12593 |
% |
| 12594 |
% \subsubsection{Handling unknown keys for \env{keyans}, \env{keyans*} and \env{keyanspic}}\label{key:unknown-keys-keyans} |
| 12595 |
% |
| 12596 |
% \begin{macro}[int]{unknown, \@@_keyans_unknown_keys:n, \@@_keyans_unknown_keys:nn} |
| 12597 |
% Define and set |unknown| key for \myenv*{keyans}, \myenv*{keyans*} |
| 12598 |
% and \myenv*{keyanspic} environments. Here it is necessary to set |
| 12599 |
% \cs{l_@@_envir_name_tl} in case an |unknown| key is passed using |\setenumext|. |
| 12600 |
% \iffalse |
| 12601 |
%% Add keys |unknown| for |keyans|, |keyans*| and |keyanspic| environments. |
| 12602 |
% \fi |
| 12603 |
% \begin{macrocode} |
| 12604 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 12605 |
{ |
| 12606 |
\keys_define:nn { enumext / #1 } |
| 12607 |
{ |
| 12608 |
unknown .code:n = { |
| 12609 |
\tl_set:Nn \l_@@_envir_name_tl {#1} |
| 12610 |
\@@_keyans_unknown_keys:n {##1} |
| 12611 |
}, |
| 12612 |
} |
| 12613 |
} |
| 12614 |
\clist_map_inline:nn { keyans, keyans*, keyanspic } { \@@_tmp:n {#1} } |
| 12615 |
% \end{macrocode} |
| 12616 |
% Internal functions for handling |unknown| key. |
| 12617 |
% \begin{macrocode} |
| 12618 |
\cs_new_protected:Npn \@@_keyans_unknown_keys:n #1 |
| 12619 |
{ |
| 12620 |
\exp_args:NV \@@_keyans_unknown_keys:nn \l_keys_key_str {#1} |
| 12621 |
} |
| 12622 |
\cs_new_protected:Npn \@@_keyans_unknown_keys:nn #1#2 |
| 12623 |
{ |
| 12624 |
\tl_if_blank:nTF {#2} |
| 12625 |
{ |
| 12626 |
\msg_error:nne { enumext } { keyans-unknown-key } {#1} |
| 12627 |
} |
| 12628 |
{ |
| 12629 |
\msg_error:nnee { enumext } { keyans-unknown-key-value } {#1} {#2} |
| 12630 |
} |
| 12631 |
} |
| 12632 |
% \end{macrocode} |
| 12633 |
% \end{macro} |
| 12634 |
% |
| 12635 |
% \subsubsection{Handling unknown keys for \env{enumext*}}\label{key:unknown-keys-starred} |
| 12636 |
% |
| 12637 |
% \begin{macro}[int]{unknown, \@@_starred_unknown_keys:n, \@@_starred_unknown_keys:nn} |
| 12638 |
% Define and set |unknown| key for \myenv*{enumext*} environment. |
| 12639 |
% \iffalse |
| 12640 |
%% Add keys |unknown| for |enumext*| environment. |
| 12641 |
% \fi |
| 12642 |
% \begin{macrocode} |
| 12643 |
\keys_define:nn { enumext / enumext* } |
| 12644 |
{ |
| 12645 |
unknown .code:n = { |
| 12646 |
\tl_set:Nn \l_@@_envir_name_tl { enumext* } |
| 12647 |
\@@_starred_unknown_keys:n {#1} |
| 12648 |
}, |
| 12649 |
} |
| 12650 |
% \end{macrocode} |
| 12651 |
% Internal functions for handling |unknown| key. |
| 12652 |
% \begin{macrocode} |
| 12653 |
\cs_new_protected:Npn \@@_starred_unknown_keys:n #1 |
| 12654 |
{ |
| 12655 |
\exp_args:NV \@@_starred_unknown_keys:nn \l_keys_key_str {#1} |
| 12656 |
} |
| 12657 |
\cs_new_protected:Npn \@@_starred_unknown_keys:nn #1#2 |
| 12658 |
{ |
| 12659 |
\tl_if_blank:nTF {#2} |
| 12660 |
{ |
| 12661 |
\msg_error:nne { enumext } { starred-unknown-key } {#1} |
| 12662 |
} |
| 12663 |
{ |
| 12664 |
\msg_error:nnee { enumext } { starred-unknown-key-value } {#1} {#2} |
| 12665 |
} |
| 12666 |
} |
| 12667 |
% \end{macrocode} |
| 12668 |
% \end{macro} |
| 12669 |
% |
| 12670 |
% \subsubsection{Handling unknown keys for \env{enumext}}\label{key:unknown-keys-standar} |
| 12671 |
% |
| 12672 |
% \begin{macro}[int]{unknown, \@@_standar_unknown_keys:n, \@@_standar_unknown_keys:nn} |
| 12673 |
% Defines and set the key |unknown| for \myenv*{enumext} environment. |
| 12674 |
% \iffalse |
| 12675 |
%% Add keys |unknown| for |enumext| environment. |
| 12676 |
% \fi |
| 12677 |
% \begin{macrocode} |
| 12678 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 12679 |
{ |
| 12680 |
\keys_define:nn { enumext / level-#1 } |
| 12681 |
{ |
| 12682 |
unknown .code:n = { |
| 12683 |
\int_set:Nn \l_@@_level_int { #1 } |
| 12684 |
\tl_set:Nn \l_@@_envir_name_tl { enumext } |
| 12685 |
\@@_standar_unknown_keys:n {##1} |
| 12686 |
}, |
| 12687 |
} |
| 12688 |
} |
| 12689 |
\clist_map_inline:nn {1, 2, 3, 4} { \@@_tmp:n {#1} } |
| 12690 |
% \end{macrocode} |
| 12691 |
% Internal functions for handling |unknown| key. |
| 12692 |
% \begin{macrocode} |
| 12693 |
\cs_new_protected:Npn \@@_standar_unknown_keys:n #1 |
| 12694 |
{ |
| 12695 |
\exp_args:NV \@@_standar_unknown_keys:nn \l_keys_key_str {#1} |
| 12696 |
} |
| 12697 |
\cs_new_protected:Npn \@@_standar_unknown_keys:nn #1#2 |
| 12698 |
{ |
| 12699 |
\tl_if_blank:nTF {#2} |
| 12700 |
{ |
| 12701 |
\msg_error:nne { enumext } { standar-unknown-key } {#1} |
| 12702 |
} |
| 12703 |
{ |
| 12704 |
\msg_error:nnee { enumext } { standar-unknown-key-value } {#1} {#2} |
| 12705 |
} |
| 12706 |
} |
| 12707 |
% \end{macrocode} |
| 12708 |
% \end{macro} |
| 12709 |
% |
| 12710 |
% \subsection{Redefining \cs{item} and \cs{makelabel} in \env{keyans}}\label{cmd:item-starred} |
| 12711 |
% |
| 12712 |
% The \ics*{item} and \ics*{item}\myoarg{custom} commands work in the |
| 12713 |
% usual way in \myenv*{keyans}, but the \ics*{item*} and \ics*{item*}\myoarg{content} |
| 12714 |
% commands \emph{store} the current \mymeta{label} next to the \mymeta{content} |
| 12715 |
% if it is present in the \emph{sequence} and \emph{prop list} defined by |
| 12716 |
% \mykey{save-ans} key. |
| 12717 |
% |
| 12718 |
% \begin{macro}{\@@_keyans_default_item:n,} |
| 12719 |
% The function \cs{@@_keyans_default_item:n} executes the original |
| 12720 |
% behavior of the \ics*{item} along with the keys \mykey{wrap-label}, |
| 12721 |
% \mykey{wrap-label*} and \mykey{itemindent}. |
| 12722 |
% \begin{macrocode} |
| 12723 |
\cs_new_protected:Npn \@@_keyans_default_item:n #1 |
| 12724 |
{ |
| 12725 |
\tl_if_novalue:nTF { #1 } |
| 12726 |
{ |
| 12727 |
\bool_set_true:N \l_@@_wrap_label_v_bool |
| 12728 |
\@@_item_std:w \tl_use:N \l_@@_fake_item_indent_v_tl |
| 12729 |
} |
| 12730 |
{ |
| 12731 |
\bool_set_eq:NN \l_@@_wrap_label_v_bool \l_@@_wrap_label_opt_v_bool |
| 12732 |
\@@_item_std:w [#1] \tl_use:N \l_@@_fake_item_indent_v_tl |
| 12733 |
} |
| 12734 |
} |
| 12735 |
% \end{macrocode} |
| 12736 |
% \end{macro} |
| 12737 |
% |
| 12738 |
% \begin{macro}{\@@_keyans_starred_item:n} |
| 12739 |
% The function \cs{@@_keyans_starred_item:n} will take as argument |#1| |
| 12740 |
% the \emph{optional argument} \myoarg{content} passed to |\item*| and |
| 12741 |
% save it via the \cs{@@_keyans_save_item_opt:n} function, then activate |
| 12742 |
% the \mykey{wrap-label} key, execute |\item| using \cs{@@_item_std:w}, |
| 12743 |
% the \mykey{itemindent} key and print the \emph{optional argument} using |
| 12744 |
% the \cs{@@_keyans_show_item_opt:} function handled by the |
| 12745 |
% \mykey{wrap-opt} key. |
| 12746 |
% \begin{macrocode} |
| 12747 |
\cs_new_protected:Npn \@@_keyans_starred_item:n #1 |
| 12748 |
{ |
| 12749 |
\@@_keyans_save_item_opt:n { #1 } |
| 12750 |
\bool_set_true:N \l_@@_wrap_label_v_bool |
| 12751 |
\@@_item_std:w \tl_use:N \l_@@_fake_item_indent_v_tl |
| 12752 |
\@@_keyans_show_item_opt: |
| 12753 |
% \end{macrocode} |
| 12754 |
% Now \emph{store} the current \mymeta{label} first in the \emph{prop list} |
| 12755 |
% (including the \emph{optional argument}), run the internal \emph{\enquote{label and ref}} |
| 12756 |
% system if the \mykey{save-ref} key is active, then \emph{store} in the \emph{sequence} |
| 12757 |
% and finally increments \cs{g_@@_check_starred_cmd_int} for internal |
| 12758 |
% check system. |
| 12759 |
% \begin{macrocode} |
| 12760 |
\@@_keyans_addto_prop:n { #1 } |
| 12761 |
\@@_keyans_store_ref: |
| 12762 |
\@@_keyans_addto_seq:n { #1 } |
| 12763 |
\int_gincr:N \g_@@_check_starred_cmd_int |
| 12764 |
} |
| 12765 |
% \end{macrocode} |
| 12766 |
% \end{macro} |
| 12767 |
% |
| 12768 |
% \begin{macro}{\item*,\@@_keyans_redefine_item:} |
| 12769 |
% The function \cs{@@_keyans_redefine_item:} is responsible for adding |
| 12770 |
% the \emph{starred argument} and \emph{optional argument} by the |
| 12771 |
% \cs{@@_list_arg_two_v:} function in the definition of the |
| 12772 |
% \myenv*{keyans} environment. Here we will set to true the variable |
| 12773 |
% \cs{l_@@_item_wrap_key_bool} used by the \mykey{wrap-ans*} key |
| 12774 |
% only when |\item*| is executed and additionally we need to use |
| 12775 |
% |\peek_remove_spaces:n| to avoid an unwanted space when using |
| 12776 |
% |\item*| together with the \mykey{itemindent} key. |
| 12777 |
% This function are passed to \myvarenv{__@@_list_arg_two_v:} used |
| 12778 |
% in the definition of the \myenv*{keyans} environment (\S\ref{ltx:second-arg}). |
| 12779 |
% \iffalse |
| 12780 |
%% Redefine |\item| for |keyans| environment. |
| 12781 |
% \fi |
| 12782 |
% \begin{macrocode} |
| 12783 |
\cs_new_protected:Nn \@@_keyans_redefine_item: |
| 12784 |
{ |
| 12785 |
\RenewDocumentCommand \item { s o } |
| 12786 |
{ |
| 12787 |
\bool_if:nTF {##1} |
| 12788 |
{ |
| 12789 |
\bool_set_true:N \l_@@_item_wrap_key_bool % wrap-ans* |
| 12790 |
\peek_remove_spaces:n |
| 12791 |
{ |
| 12792 |
\@@_keyans_starred_item:n {##2} |
| 12793 |
} |
| 12794 |
} |
| 12795 |
{ |
| 12796 |
\bool_set_false:N \l_@@_item_wrap_key_bool |
| 12797 |
\@@_keyans_default_item:n {##2} |
| 12798 |
} |
| 12799 |
} |
| 12800 |
} |
| 12801 |
% \end{macrocode} |
| 12802 |
% \end{macro} |
| 12803 |
% |
| 12804 |
% \begin{macro}{\@@_keyans_make_label:,\@@_keyans_wrapper_label:n, |
| 12805 |
% \@@_keyans_make_label_std:,\@@_keyans_make_label_box:} |
| 12806 |
% The function \cs{@@_keyans_make_label:} redefine \ics{makelabel} |
| 12807 |
% for the keys \mykey{mode-box}, \mykey{align}, \mykey{font}, |
| 12808 |
% \mykey{wrap-label}, \mykey{wrap-label*}, \mykey{wrap-ans*} and |\item*| |
| 12809 |
% for \myenv*{keyans} environment. |
| 12810 |
% This function are passed to \myvarenv{__@@_list_arg_two_v:} used |
| 12811 |
% in the definition of the \myenv*{keyans} environment (\S\ref{ltx:second-arg}). |
| 12812 |
% \iffalse |
| 12813 |
%% Redefine |\makelabel| for |keyans| environment. |
| 12814 |
% \fi |
| 12815 |
% \begin{macrocode} |
| 12816 |
\cs_new_protected:Nn \@@_keyans_make_label: |
| 12817 |
{ |
| 12818 |
\IfDocumentMetadataTF |
| 12819 |
{ |
| 12820 |
\@@_keyans_make_label_box: |
| 12821 |
} |
| 12822 |
{ |
| 12823 |
\bool_if:NTF \l_@@_mode_box_bool |
| 12824 |
{ |
| 12825 |
\@@_keyans_make_label_box: |
| 12826 |
} |
| 12827 |
{ |
| 12828 |
\@@_keyans_make_label_std: |
| 12829 |
} |
| 12830 |
} |
| 12831 |
} |
| 12832 |
% \end{macrocode} |
| 12833 |
% We added conditionals to the \cs{@@_keyans_wraper_label:n} function |
| 12834 |
% to handle the keys \mykey{wrap-ans*}, \mykey{wrap-label} and \mykey{wrap-label*}. |
| 12835 |
% \begin{macrocode} |
| 12836 |
\cs_new_protected:Npn \@@_keyans_wrapper_label:n #1 |
| 12837 |
{ |
| 12838 |
\bool_lazy_all:nT |
| 12839 |
{ |
| 12840 |
{ \bool_if_p:N \l_@@_wrap_label_v_bool } |
| 12841 |
{ \bool_if_p:N \l_@@_show_answer_bool } |
| 12842 |
{ \bool_if_p:N \l_@@_item_wrap_key_bool } |
| 12843 |
{ \cs_if_exist_p:N \@@_keyans_wrapper_item_v:n } |
| 12844 |
} |
| 12845 |
{ |
| 12846 |
\cs_set_eq:NN \@@_wrapper_label_v:n \@@_keyans_wrapper_item_v:n |
| 12847 |
} |
| 12848 |
\bool_if:NTF \l_@@_wrap_label_v_bool |
| 12849 |
{ |
| 12850 |
\@@_wrapper_label_v:n { #1 } |
| 12851 |
} |
| 12852 |
{ #1 } |
| 12853 |
} |
| 12854 |
% \end{macrocode} |
| 12855 |
% Standard definition when |\DocumentMetadata| is not active. |
| 12856 |
% \begin{macrocode} |
| 12857 |
\cs_new_protected:Nn \@@_keyans_make_label_std: |
| 12858 |
{ |
| 12859 |
\RenewDocumentCommand \makelabel { m } |
| 12860 |
{ |
| 12861 |
\tl_use:N \l_@@_label_fill_left_v_tl |
| 12862 |
\@@_keyans_show_ans: |
| 12863 |
\@@_keyans_show_pos: |
| 12864 |
\tl_use:N \l_@@_label_font_style_v_tl |
| 12865 |
\@@_keyans_wrapper_label:n { ##1 } |
| 12866 |
\tl_use:N \l_@@_label_fill_right_v_tl |
| 12867 |
} |
| 12868 |
} |
| 12869 |
% \end{macrocode} |
| 12870 |
% Definition using |\makebox| when |\DocumentMetadata| is active or |
| 12871 |
% \mykey{mode-box} is active. |
| 12872 |
% \begin{macrocode} |
| 12873 |
\cs_new_protected:Nn \@@_keyans_make_label_box: |
| 12874 |
{ |
| 12875 |
\RenewDocumentCommand \makelabel { m } |
| 12876 |
{ |
| 12877 |
\strut\smash |
| 12878 |
{ |
| 12879 |
\makebox[ \l_@@_labelwidth_v_dim ][ \l_@@_align_label_pos_v_str ] |
| 12880 |
{ |
| 12881 |
\@@_keyans_show_ans: |
| 12882 |
\@@_keyans_show_pos: |
| 12883 |
\tl_use:N \l_@@_label_font_style_v_tl |
| 12884 |
\@@_keyans_wrapper_label:n { ##1 } |
| 12885 |
} |
| 12886 |
} |
| 12887 |
} |
| 12888 |
} |
| 12889 |
% \end{macrocode} |
| 12890 |
% \end{macro} |
| 12891 |
% |
| 12892 |
% \subsection{Second argument of the lists}\label{ltx:second-arg} |
| 12893 |
% |
| 12894 |
% At this point in the code we have already programmed most of the tools |
| 12895 |
% needed to create a \emph{custom} \myenv{list} environment, remember that the |
| 12896 |
% \cs{@@_start_list:nn} function takes two arguments, we have the \enquote{first} |
| 12897 |
% one ready, the \enquote{second} one we will define for all levels of the |
| 12898 |
% \myenv*{enumext} environment, the \myenv*{keyans} environment and the |
| 12899 |
% \myenv*{enumext*} and \myenv*{keyans*} environments. |
| 12900 |
% |
| 12901 |
% \smallskip |
| 12902 |
% |
| 12903 |
% Here we will implement the \myvarenv{__@@_list_arg_two_X:} function, |
| 12904 |
% which will be responsible for setting all the list parameters, the |
| 12905 |
% counter, the redefinition of |\item|, |\makelabel| along with the keys |
| 12906 |
% \mykey{ref}, \mykey{itemindent} and \mykey{show-length}. |
| 12907 |
% |
| 12908 |
% \subsubsection{Calculation of \cs{leftmargin} and \cs{itemindent}}\label{int:leftmargin} |
| 12909 |
% |
| 12910 |
% Consider the figure \ref{fig:eight} where the default margins (on the |
| 12911 |
% left) of a list are represented. |
| 12912 |
% |
| 12913 |
% \begin{figure}[!htbp] |
| 12914 |
% \centering |
| 12915 |
% \begin{tikzpicture}[line cap=round,line join=round,x=0.8cm,y=0.8cm,every node/.style={font=\footnotesize}] |
| 12916 |
% \draw[<->,color=gray] (-0.5,6.175) --node[below,text=lightgray,font=\footnotesize\ttfamily]{margin page} (2,6.175); |
| 12917 |
% \draw[line width=0.5pt,dash pattern=on 2pt off 2pt,color=gray] (2,4.85) -- (2,7.5); |
| 12918 |
% \draw[<->,color=gray] (2.0,7.0) --node[above,text=optcolor]{\vphantom{p}\texttt{list-offset}} (4.5,7.0); |
| 12919 |
% \draw[<->,color=gray] (4.5,7.0) --node[above,text=blue!75]{\vphantom{p}\texttt{\textbackslash{}labelwidth}} (7.5,7.0); |
| 12920 |
% \draw[<->,color=gray] (7.5,7.0) --node[above,text=blue!75]{\texttt{\textbackslash{}labelsep}} (9.5,7.0); |
| 12921 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (4.5,6.5) rectangle (7.5,6.85);% labelwidth |
| 12922 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.5,6.5) rectangle (9.5,6.85);% labelsep |
| 12923 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (9.5,6.5) rectangle (15,6.85);% item width |
| 12924 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (9.5,6.0) rectangle (15,6.35); |
| 12925 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (9.5,5.5) rectangle (15,5.85); |
| 12926 |
% \draw[<->,color=gray] (1.25,5.35) --node[below,text=blue!75]% |
| 12927 |
% {\begin{tabular}{c} |
| 12928 |
% \texttt{\textbackslash{}leftmargin + \textbackslash{}itemindent} \\ |
| 12929 |
% \textcolor{optcolor}{\texttt{list-indent}} |
| 12930 |
% \end{tabular}} (9.5,5.35); |
| 12931 |
% \end{tikzpicture} |
| 12932 |
% \caption{Representation of standard horizontal lengths in \myenv{list} environment.} |
| 12933 |
% \label{fig:eight} |
| 12934 |
% \end{figure} |
| 12935 |
% |
| 12936 |
% The idea is to have control over these margins so that our list does |
| 12937 |
% not overlap the left margin of the page. The \emph{key} relationship is that |
| 12938 |
% the \emph{\enquote{right edge}} of the |\labelsep| equals the \emph{\enquote{right edge}} of the |\itemindent|, |
| 12939 |
% so that the left edge of the \emph{\enquote{label box}} is at |\leftmargin+\itemindent| minus |\labelwidth+\labelsep|. |
| 12940 |
% Thus, the handling of the margins by the package will be as shown in |
| 12941 |
% the figure \ref{fig:nine}. |
| 12942 |
% |
| 12943 |
% \begin{figure}[!htbp] |
| 12944 |
% \centering |
| 12945 |
% \begin{tikzpicture}[line cap=round,line join=round,x=0.8cm,y=0.8cm,every node/.style={font=\footnotesize}] |
| 12946 |
% \draw[<->,color=gray] (-0.5,6.175) --node[below,text=lightgray,font=\footnotesize\ttfamily]{margin page} (2,6.175); |
| 12947 |
% \draw[line width=0.5pt,dash pattern=on 2pt off 2pt,color=gray] (2,4.85) -- (2,7.5); |
| 12948 |
% \draw[<->,color=gray] (2.0,7.0) --node[above,text=optcolor]{\vphantom{p}\texttt{list-offset}} (4.5,7.0); |
| 12949 |
% \draw[<->,color=gray] (4.5,7.0) --node[above,text=blue!75]{\vphantom{p}\texttt{\textbackslash{}labelwidth}} (7.5,7.0); |
| 12950 |
% \draw[<->,color=gray] (7.5,7.0) --node[above,text=blue!75]{\texttt{\textbackslash{}labelsep}} (9.5,7.0); |
| 12951 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (4.5,6.5) rectangle (7.5,6.85);% labelwidth |
| 12952 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.5,6.5) rectangle (9.5,6.85);% labelsep |
| 12953 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (9.5,6.5) rectangle (15,6.85);% item width |
| 12954 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (9.5,6.0) rectangle (15,6.35); |
| 12955 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (9.5,5.5) rectangle (15,5.85); |
| 12956 |
% \draw[<->,color=gray] (4.5,5.35) --node[below,text=blue!75]% |
| 12957 |
% {\begin{tabular}{c} |
| 12958 |
% \texttt{\textbackslash{}leftmargin + \textbackslash{}itemindent} \\ |
| 12959 |
% \textcolor{optcolor}{\texttt{list-indent}} |
| 12960 |
% \end{tabular}} (9.5,5.35); |
| 12961 |
% \end{tikzpicture} |
| 12962 |
% \caption{Representation of horizontal lengths concept in list in \mypkg*{enumext}.} |
| 12963 |
% \label{fig:nine} |
| 12964 |
% \end{figure} |
| 12965 |
% |
| 12966 |
% Where the default values will look like in the figure \ref{fig:last}. |
| 12967 |
% |
| 12968 |
% \begin{figure}[htbp] |
| 12969 |
% \centering |
| 12970 |
% \begin{tikzpicture}[line cap=round,line join=round,x=0.8cm,y=0.8cm,every node/.style={font=\footnotesize}] |
| 12971 |
% \draw[<->,color=gray] (-0.5,6.175) --node[below,text=lightgray,font=\footnotesize\ttfamily]{margin page} (2,6.175); |
| 12972 |
% \draw [line width=0.5pt,dash pattern=on 2pt off 2pt,color=gray] (2,4.85) -- (2,7.5); |
| 12973 |
% \draw[<->,color=gray] (2.0,7.0) --node[above,text=blue!75]{\vphantom{p}\texttt{labelwidth}} (5.0,7.0); |
| 12974 |
% \draw[<->,color=gray] (5.0,7.0) --node[above,text=blue!75]{\texttt{labelsep}} (7.0,7.0); |
| 12975 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (2.0,6.5) rectangle (5.0,6.85);% labelwidth |
| 12976 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (5.0,6.5) rectangle (7.0,6.85);% labelsep |
| 12977 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,6.5) rectangle (15,6.85);% item width |
| 12978 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,6.0) rectangle (15,6.35); |
| 12979 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,5.5) rectangle (15,5.85); |
| 12980 |
% \draw[<->,color=gray] (2.0,5.35) --node[below,text=blue!75]% |
| 12981 |
% {\begin{tabular}{c} |
| 12982 |
% \texttt{\textbackslash{}leftmargin + \textbackslash{}itemindent} \\ |
| 12983 |
% \textcolor{optcolor}{\texttt{list-indent}} |
| 12984 |
% \end{tabular}} |
| 12985 |
% (7.0,5.35); |
| 12986 |
% \end{tikzpicture} |
| 12987 |
% \caption{Default horizontal lengths in \mypkg*{enumext}.} |
| 12988 |
% \label{fig:last} |
| 12989 |
% \end{figure} |
| 12990 |
% |
| 12991 |
% \begin{macro}{\@@_calc_hspace:NNNNNNN, \@@_calc_hspace:ccccccc} |
| 12992 |
% The function \cs{@@_calc_hspace:NNNNNNN} takes seven arguments to be |
| 12993 |
% able to determine horizontal spaces for all list environment: |
| 12994 |
% |
| 12995 |
% \begin{verbatim} |
| 12996 |
% #1: \l__enumext_labelwidth_X_dim #2: \l__enumext_labelsep_X_dim |
| 12997 |
% #3: \l__enumext_listoffset_X_dim #4: \l__enumext_leftmargin_tmp_X_dim |
| 12998 |
% #5: \l__enumext_leftmargin_X_dim #6: \l__enumext_itemindent_X_dim |
| 12999 |
% #7: \l__enumext_leftmargin_tmp_X_bool |
| 13000 |
% \end{verbatim} |
| 13001 |
% |
| 13002 |
% And returns the \emph{\enquote{adjusted}} values of |\leftmargin| |
| 13003 |
% and |\itemindent|. |
| 13004 |
% |
| 13005 |
% |
| 13006 |
% \iffalse |
| 13007 |
%% Function to calc of horizontal length for all list environment. |
| 13008 |
%% #1: \l__enumext_labelwidth_X_dim #2: \l__enumext_labelsep_X_dim |
| 13009 |
%% #3: \l__enumext_listoffset_X_dim #4: \l__enumext_leftmargin_tmp_X_dim |
| 13010 |
%% #5: \l__enumext_leftmargin_X_dim #6: \l__enumext_itemindent_X_dim |
| 13011 |
%% #7: \l__enumext_leftmargin_tmp_X_bool |
| 13012 |
% \fi |
| 13013 |
% \begin{macrocode} |
| 13014 |
\cs_new_protected:Npn \@@_calc_hspace:NNNNNNN #1 #2 #3 #4 #5 #6 #7 |
| 13015 |
{ |
| 13016 |
\dim_compare:nNnT { #1 } < { \c_zero_dim } |
| 13017 |
{ |
| 13018 |
\msg_warning:nnnV { enumext } { width-non-positive }{ labelwidth } #1 |
| 13019 |
\dim_set:Nn #1 { \dim_abs:n { #1 } } |
| 13020 |
} |
| 13021 |
\dim_compare:nNnT { #2 } < { \c_zero_dim } |
| 13022 |
{ |
| 13023 |
\msg_warning:nnnV { enumext } { width-negative }{ labelsep } #2 |
| 13024 |
\dim_set:Nn #2 { \dim_abs:n { #2 } } |
| 13025 |
} |
| 13026 |
% \end{macrocode} |
| 13027 |
% If no value has been passed to the \mykey{labelwidth} and \mykey{labelsep} keys we |
| 13028 |
% set the default values for \myvarenv{l__@@_leftmargin_tmp_X_dim}. |
| 13029 |
% \begin{macrocode} |
| 13030 |
\bool_if:NF #7 { \dim_set:Nn #4 { #1 + #2} } |
| 13031 |
% \end{macrocode} |
| 13032 |
% We now analyze the cases and set the values for \ics{leftmargin} and |
| 13033 |
% \ics{itemindent}. |
| 13034 |
% \begin{macrocode} |
| 13035 |
\dim_compare:nNnTF { #4 } < { \c_zero_dim } |
| 13036 |
{ |
| 13037 |
\dim_set:Nn #6 { #1 + #2 - #4} |
| 13038 |
\dim_set:Nn #5 { #1 + #2 + #3 - #6 } |
| 13039 |
} |
| 13040 |
{ |
| 13041 |
\dim_compare:nNnT { #4 } = { #1 + #2 } |
| 13042 |
{ \dim_set:Nn #6 { \c_zero_dim } } |
| 13043 |
\dim_compare:nNnT { #4 } < { #1 + #2 } |
| 13044 |
{ \dim_set:Nn #6 { #1 + #2 - #4} } |
| 13045 |
\dim_compare:nNnT { #4 } > { #1 + #2 } |
| 13046 |
{ |
| 13047 |
\dim_set:Nn #6 { -#1 - #2 + #4} |
| 13048 |
\dim_set:Nn #6 { #6*-1} |
| 13049 |
} |
| 13050 |
\dim_set:Nn #5 { #1 + #2 + #3 - #6 } |
| 13051 |
} |
| 13052 |
} |
| 13053 |
\cs_generate_variant:Nn \@@_calc_hspace:NNNNNNN { ccccccc } |
| 13054 |
% \end{macrocode} |
| 13055 |
% \end{macro} |
| 13056 |
% |
| 13057 |
% \subsubsection{Setting second argument of the lists} |
| 13058 |
% |
| 13059 |
% \begin{macro}{\@@_list_arg_two_i:,\@@_list_arg_two_ii:,\@@_list_arg_two_iii:, |
| 13060 |
% \@@_list_arg_two_iv:,\@@_list_arg_two_v:,} |
| 13061 |
% We will \enquote{not set} |\leftmargini|, |\leftmarginii|, |\leftmarginiii| or |
| 13062 |
% |\leftmarginiv|, in this case, we will directly set the parameters |
| 13063 |
% for vertical and horizontal list spacing per level. |
| 13064 |
% \iffalse |
| 13065 |
%% Define "second arg" of list for |enumext| and |keyans|. |
| 13066 |
% \fi |
| 13067 |
% \begin{macrocode} |
| 13068 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 13069 |
{ |
| 13070 |
\cs_new_protected:cpn { @@_list_arg_two_#1: } |
| 13071 |
{ |
| 13072 |
\@@_calc_hspace:ccccccc |
| 13073 |
{ l_@@_labelwidth_#1_dim } { l_@@_labelsep_#1_dim } |
| 13074 |
{ l_@@_listoffset_#1_dim } { l_@@_leftmargin_tmp_#1_dim } |
| 13075 |
{ l_@@_leftmargin_#1_dim } { l_@@_itemindent_#1_dim } |
| 13076 |
{ l_@@_leftmargin_tmp_#1_bool } |
| 13077 |
\clist_map_inline:nn |
| 13078 |
{ labelsep, labelwidth, itemindent, leftmargin, rightmargin, listparindent } |
| 13079 |
{ \dim_set_eq:cc {####1} { l_@@_####1_#1_dim } } |
| 13080 |
\clist_map_inline:nn { topsep, parsep, partopsep, itemsep } |
| 13081 |
{ \skip_set_eq:cc {####1} { l_@@_####1_#1_skip } } |
| 13082 |
\clist_map_inline:nn { beginparpenalty, itempenalty, endparpenalty } |
| 13083 |
{ \int_set_eq:cc {@####1} { l_@@_####1_#1_int } } |
| 13084 |
\usecounter { enumX#1 } |
| 13085 |
\setcounter { enumX#1 } { \int_eval:n { \int_use:c { l_@@_start_#1_int } - 1 } } |
| 13086 |
\str_if_eq:nnTF {#1} { v } |
| 13087 |
{ |
| 13088 |
\@@_keyans_redefine_item: |
| 13089 |
\@@_keyans_make_label: |
| 13090 |
\@@_keyans_ref: |
| 13091 |
\@@_keyans_fake_item_indent: |
| 13092 |
\bool_if:cT { l_@@_show_length_#1_bool } |
| 13093 |
{ |
| 13094 |
\msg_term:nnnn { enumext } { list-lengths-not-nested } { v } { keyans } |
| 13095 |
} |
| 13096 |
} |
| 13097 |
{ |
| 13098 |
\@@_redefine_item: |
| 13099 |
\@@_make_label: |
| 13100 |
\@@_standar_ref: |
| 13101 |
\@@_fake_item_indent: |
| 13102 |
\bool_if:cT { l_@@_show_length_#1_bool } |
| 13103 |
{ |
| 13104 |
\msg_term:nnne { enumext } { list-lengths } {#1} |
| 13105 |
{ \int_use:N \l_@@_level_int } |
| 13106 |
} |
| 13107 |
} |
| 13108 |
} |
| 13109 |
} |
| 13110 |
\clist_map_inline:nn { i, ii, iii, iv, v } { \@@_tmp:n {#1} } |
| 13111 |
% \end{macrocode} |
| 13112 |
% \end{macro} |
| 13113 |
% |
| 13114 |
% \begin{macro}{\@@_list_arg_two_vii:,\@@_list_arg_two_viii:,} |
| 13115 |
% For the horizontal environments \myenv*{enumext*} and \myenv*{keyans*} |
| 13116 |
% the implementation is similar, but, the value of |\partopsep| is always |
| 13117 |
% \mydim{0pt}. At this point we will modify the \mykey{parsep} key to |
| 13118 |
% make it take the value of the \mykey{itemsep} key and later, in the |
| 13119 |
% environment definition, we will modify \mykey{parindent} to make it set |
| 13120 |
% the value of \mykey{lisparindent} and \mykey{parsep} to set the value |
| 13121 |
% of |\parskip| locally. |
| 13122 |
% \iffalse |
| 13123 |
%% Define "second arg" of list for |enumext*| and |keyans*|. |
| 13124 |
% \fi |
| 13125 |
% \begin{macrocode} |
| 13126 |
\cs_set_protected:Npn \@@_tmp:n #1 |
| 13127 |
{ |
| 13128 |
\cs_new_protected:cpn { @@_list_arg_two_#1: } |
| 13129 |
{ |
| 13130 |
\bool_set_true:c { l_@@_leftmargin_tmp_#1_bool } |
| 13131 |
\dim_zero:c { l_@@_leftmargin_tmp_#1_dim } |
| 13132 |
\@@_calc_hspace:ccccccc |
| 13133 |
{ l_@@_labelwidth_#1_dim } { l_@@_labelsep_#1_dim } |
| 13134 |
{ l_@@_listoffset_#1_dim } { l_@@_leftmargin_tmp_#1_dim } |
| 13135 |
{ l_@@_leftmargin_#1_dim } { l_@@_itemindent_#1_dim } |
| 13136 |
{ l_@@_leftmargin_tmp_#1_bool } |
| 13137 |
\clist_map_inline:nn |
| 13138 |
{ labelsep, labelwidth, itemindent, leftmargin, rightmargin, listparindent } |
| 13139 |
{ \dim_set_eq:cc {####1} { l_@@_####1_#1_dim } } |
| 13140 |
\clist_map_inline:nn { topsep, parsep, partopsep, itemsep } |
| 13141 |
{ \skip_set_eq:cc {####1} { l_@@_####1_#1_skip } } |
| 13142 |
\clist_map_inline:nn { beginparpenalty, itempenalty, endparpenalty } |
| 13143 |
{ \int_set_eq:cc {@####1} { l_@@_####1_#1_int } } |
| 13144 |
\skip_set_eq:Nc \parsep { l_@@_itemsep_#1_skip } |
| 13145 |
\skip_zero:N \partopsep |
| 13146 |
\usecounter { enumX#1 } |
| 13147 |
\setcounter { enumX#1 } { \int_eval:n { \int_use:c { l_@@_start_#1_int } - 1 } } |
| 13148 |
\@@_starred_ref: |
| 13149 |
\str_if_eq:nnTF {#1} { vii } |
| 13150 |
{ |
| 13151 |
\@@_fake_item_indent_vii: |
| 13152 |
\bool_if:cT { l_@@_show_length_vii_bool } |
| 13153 |
{ \msg_term:nnnn { enumext } { list-lengths-not-nested } { vii } { enumext* } } |
| 13154 |
} |
| 13155 |
{ |
| 13156 |
\@@_fake_item_indent_viii: |
| 13157 |
\bool_if:cT { l_@@_show_length_#1_bool } |
| 13158 |
{ \msg_term:nnnn { enumext } { list-lengths-not-nested } { #1 } { keyans* } } |
| 13159 |
} |
| 13160 |
} |
| 13161 |
} |
| 13162 |
\clist_map_inline:nn { vii, viii } { \@@_tmp:n {#1} } |
| 13163 |
% \end{macrocode} |
| 13164 |
% \end{macro} |
| 13165 |
% |
| 13166 |
% \subsection{The environment \env{enumext}}\label{env:enumext} |
| 13167 |
% |
| 13168 |
% \begin{macro}{\@@_safe_exec:}\label{fun:enumext:safe-exe} |
| 13169 |
% The \cs{@@_safe_exec:} function first call the function \cs{@@_is_not_nested:} |
| 13170 |
% which sets \cs{g_@@_standar_bool} to \emph{\enquote{true}} if we |
| 13171 |
% are NOT nested within \myenv*{enumext*}, then call the function |
| 13172 |
% \cs{@@_internal_mini_page:} to create the environment \myvarenv*{__@@_mini_page}, |
| 13173 |
% we will increment \cs{l_@@_level_int} to restrict nesting of the |
| 13174 |
% environment, set \cs{l_@@_standar_bool} to \emph{\enquote{true}} and |
| 13175 |
% finally call the function \cs{@@_is_on_first_level:} which sets |
| 13176 |
% \cs{l_@@_standar_first_bool} to \emph{\enquote{true}} only if the |
| 13177 |
% environment is NOT nested and we are at the \emph{\enquote{first level}}. |
| 13178 |
% \iffalse |
| 13179 |
%% Safe exec for |enumext| environment. |
| 13180 |
% \fi |
| 13181 |
% \begin{macrocode} |
| 13182 |
\cs_new_protected:Nn \@@_safe_exec: |
| 13183 |
{ |
| 13184 |
\@@_is_not_nested: |
| 13185 |
\@@_internal_mini_page: |
| 13186 |
\int_incr:N \l_@@_level_int |
| 13187 |
\int_compare:nNnT { \l_@@_level_int } > { 4 } |
| 13188 |
{ \msg_fatal:nn { enumext } { list-too-deep } } |
| 13189 |
\bool_set_true:N \l_@@_standar_bool |
| 13190 |
\bool_set_false:N \l_@@_starred_bool |
| 13191 |
\@@_is_on_first_level: |
| 13192 |
} |
| 13193 |
% \end{macrocode} |
| 13194 |
% \end{macro} |
| 13195 |
% |
| 13196 |
% \begin{macro}{\@@_parse_keys:n} |
| 13197 |
% The \cs{@@_parse_store_keys:n} function first we will clear the |
| 13198 |
% variable \cs{l_@@_series_name_str} used by the key \mykey{series} and then |
| 13199 |
% we check if we are at the \emph{\enquote{first level}}, if so we |
| 13200 |
% process the \mymeta{keys} and then execute the function |
| 13201 |
% \cs{@@_parse_series:n} used by the key \mykey{series} and call the |
| 13202 |
% function \cs{@@_nested_base_line_fix:} used by the key |
| 13203 |
% \mykey{base-fix}, otherwise we will pass the \mymeta{keys} to the inner |
| 13204 |
% levels of the environment then we execute the function \cs{@@_store_active_keys:n} |
| 13205 |
% and reprocess the \mymeta{keys} to pass them to the \emph{sequence} |
| 13206 |
% if the key \mykey{save-key} is not active. |
| 13207 |
% \iffalse |
| 13208 |
%% Parse |key=val|, set default series and store keys in seq-name for \printkeyans for |enumext| environment. |
| 13209 |
% \fi |
| 13210 |
% \begin{macrocode} |
| 13211 |
\cs_new_protected:Npn \@@_parse_keys:n #1 |
| 13212 |
{ |
| 13213 |
\tl_if_novalue:nF {#1} |
| 13214 |
{ |
| 13215 |
\str_clear:N \l_@@_series_name_str |
| 13216 |
\int_compare:nNnTF { \l_@@_level_int } = { 1 } |
| 13217 |
{ |
| 13218 |
\keys_set:nn { enumext / level-1 } {#1} |
| 13219 |
\bool_if:NF \l_@@_print_keyans_cmd_bool |
| 13220 |
{ |
| 13221 |
\@@_parse_series:n {#1} |
| 13222 |
} |
| 13223 |
\@@_nested_base_line_fix: |
| 13224 |
} |
| 13225 |
{ |
| 13226 |
\exp_args:Ne \keys_set:nn |
| 13227 |
{ enumext / level-\int_use:N \l_@@_level_int } {#1} |
| 13228 |
\bool_if:NF \l_@@_print_keyans_cmd_bool |
| 13229 |
{ |
| 13230 |
\@@_parse_series:n {#1} |
| 13231 |
} |
| 13232 |
} |
| 13233 |
\@@_store_active_keys:n {#1} |
| 13234 |
} |
| 13235 |
} |
| 13236 |
% \end{macrocode} |
| 13237 |
% \end{macro} |
| 13238 |
% |
| 13239 |
% \begin{macro}{\@@_start_store_level:} |
| 13240 |
% The \cs{@@_start_store_level:} function activate the \emph{\enquote{storing structure}} |
| 13241 |
% mechanism in the \emph{sequence} for the command |
| 13242 |
% \ics*{anskey} and the environment \myenv*{anskey*}. |
| 13243 |
% \iffalse |
| 13244 |
%% Start storing structure in sequence for |save-ans| key in |enumext| environment. |
| 13245 |
% \fi |
| 13246 |
% \begin{macrocode} |
| 13247 |
\cs_new_protected:Nn \@@_start_store_level: |
| 13248 |
{ |
| 13249 |
\bool_lazy_all:nT |
| 13250 |
{ |
| 13251 |
{ \bool_if_p:N \l_@@_store_active_bool } |
| 13252 |
{ \bool_not_p:n { \l_@@_keyans_env_bool } } |
| 13253 |
{ \bool_if_p:N \g_@@_standar_bool } |
| 13254 |
} |
| 13255 |
{ |
| 13256 |
\int_compare:nNnT { \l_@@_level_int } > { 1 } |
| 13257 |
{ |
| 13258 |
\bool_set_true:c { l_@@_store_upper_level_ \@@_level: _bool } |
| 13259 |
\@@_store_level_open: |
| 13260 |
} |
| 13261 |
} |
| 13262 |
% \end{macrocode} |
| 13263 |
% If \myenv*{enumext} are nested in \myenv*{enumext*} add \cs{@@_store_level_open:} |
| 13264 |
% to preserve the \emph{\enquote{storing structure}}. |
| 13265 |
% \begin{macrocode} |
| 13266 |
\bool_lazy_all:nT |
| 13267 |
{ |
| 13268 |
{ \bool_if_p:N \l_@@_store_active_bool } |
| 13269 |
{ \bool_not_p:n { \l_@@_keyans_env_bool } } |
| 13270 |
{ \int_compare_p:nNn { \l_@@_level_h_int } = { 1 } } |
| 13271 |
} |
| 13272 |
{ |
| 13273 |
\int_compare:nNnT { \l_@@_level_int } > { 0 } |
| 13274 |
{ |
| 13275 |
\bool_set_true:c { l_@@_store_upper_level_ \@@_level: _bool } |
| 13276 |
\@@_store_level_open: |
| 13277 |
} |
| 13278 |
} |
| 13279 |
} |
| 13280 |
% \end{macrocode} |
| 13281 |
% \end{macro} |
| 13282 |
% |
| 13283 |
% \begin{macro}{\@@_stop_store_level:} |
| 13284 |
% The \cs{@@_stop_store_level:} function stop the \emph{\enquote{storing structure}} |
| 13285 |
% mechanism in the \emph{sequence} for the command |
| 13286 |
% \ics*{anskey} and the environment \myenv*{anskey*}. |
| 13287 |
% \iffalse |
| 13288 |
%% Stop storing structure in sequence for |save-ans| key in |enumext| environment. |
| 13289 |
% \fi |
| 13290 |
% \begin{macrocode} |
| 13291 |
\cs_new_protected:Nn \@@_stop_store_level: |
| 13292 |
{ |
| 13293 |
\bool_if:cT { l_@@_store_upper_level_ \@@_level: _bool } |
| 13294 |
{ |
| 13295 |
\@@_store_level_close: |
| 13296 |
} |
| 13297 |
} |
| 13298 |
% \end{macrocode} |
| 13299 |
% \end{macro} |
| 13300 |
% |
| 13301 |
% \begin{macro}{\@@_multicols_start:} |
| 13302 |
% The function \cs{@@_multicols_start:} will start the |
| 13303 |
% \myenv{multicols} environment according to the value passed by the |
| 13304 |
% \mykey{columns} key, then set the default value for |
| 13305 |
% \ics{columnsep} when \mykey{columns-sep}=\mydim{0pt} and set the |
| 13306 |
% value of \ics{multicolsep} equal to zero and leave \ics{columnseprule} |
| 13307 |
% equal to zero for inner levels. |
| 13308 |
% \begin{macrocode} |
| 13309 |
\cs_new_protected:Nn \@@_multicols_start: |
| 13310 |
{ |
| 13311 |
\int_compare:nNnT |
| 13312 |
{ \int_use:c { l_@@_columns_ \@@_level: _int } } > { 1 } |
| 13313 |
{ |
| 13314 |
\dim_compare:nNnT |
| 13315 |
{ \dim_use:c { l_@@_columns_sep_ \@@_level: _dim } } = { \c_zero_dim } |
| 13316 |
{ |
| 13317 |
\dim_set:cn { l_@@_columns_sep_ \@@_level: _dim } |
| 13318 |
{ |
| 13319 |
( \dim_use:c { l_@@_labelwidth_ \@@_level: _dim } |
| 13320 |
+ \dim_use:c { l_@@_labelsep_ \@@_level: _dim } |
| 13321 |
) / \int_use:c { l_@@_columns_ \@@_level: _int } |
| 13322 |
- \dim_use:c { l_@@_listoffset_ \@@_level: _dim } |
| 13323 |
} |
| 13324 |
} |
| 13325 |
\dim_set_eq:Nc \columnsep { l_@@_columns_sep_ \@@_level: _dim } |
| 13326 |
\int_compare:nNnT { \l_@@_level_int } > { 1 } |
| 13327 |
{ |
| 13328 |
\dim_zero:N \columnseprule |
| 13329 |
} |
| 13330 |
% \end{macrocode} |
| 13331 |
% We will calculate the \emph{vertical spacing} settings for the |
| 13332 |
% \myenv{multicols} environment using the function \cs{@@_multi_addvspace:}, |
| 13333 |
% apply our \emph{\enquote{vertical adjust spacing}}, then start the |
| 13334 |
% \myenv{multicols} environment. |
| 13335 |
% \begin{macrocode} |
| 13336 |
\bool_if:cF { l_@@_minipage_active_ \@@_level: _bool } |
| 13337 |
{ |
| 13338 |
\skip_zero:N \multicolsep |
| 13339 |
\@@_multi_addvspace: |
| 13340 |
} |
| 13341 |
\raggedcolumns |
| 13342 |
\begin{multicols}{ \int_use:c { l_@@_columns_ \@@_level: _int } } |
| 13343 |
} |
| 13344 |
} |
| 13345 |
% \end{macrocode} |
| 13346 |
% \end{macro} |
| 13347 |
% |
| 13348 |
% \begin{macro}{\@@_multicols_stop:} |
| 13349 |
% The function \cs{@@_multicols_stop:} will stop the \myenv{multicols} |
| 13350 |
% environment and apply our \emph{\enquote{vertical adjust}} spacing. |
| 13351 |
% For compatibility with \emph{tagged} \texttt{PDF}, the closing of the |
| 13352 |
% \myenv{list} environment is executed here along with \cs{@@_stop_store_level:}. |
| 13353 |
% \begin{macrocode} |
| 13354 |
\cs_new_protected:Nn \@@_multicols_stop: |
| 13355 |
{ |
| 13356 |
\int_compare:nNnTF |
| 13357 |
{ \int_use:c { l_@@_columns_ \@@_level: _int } } > { 1 } |
| 13358 |
{ |
| 13359 |
\@@_stop_list: |
| 13360 |
\@@_stop_store_level: |
| 13361 |
\end{multicols} |
| 13362 |
\@@_unskip_unkern: |
| 13363 |
\@@_unskip_unkern: |
| 13364 |
\par\addvspace{ \skip_use:c { l_@@_multicols_below_ \@@_level: _skip } } |
| 13365 |
} |
| 13366 |
{ |
| 13367 |
\@@_stop_list: |
| 13368 |
\@@_stop_store_level: |
| 13369 |
} |
| 13370 |
} |
| 13371 |
% \end{macrocode} |
| 13372 |
% \end{macro} |
| 13373 |
% |
| 13374 |
% \begin{macro}{\@@_before_list:} |
| 13375 |
% The function \cs{@@_before_list:} first calls the function |
| 13376 |
% \cs{@@_vspace_above:} used by the keys \mykey{above} and |
| 13377 |
% \mykey{above*}, then calls the function \cs{@@_before_args_exec:} |
| 13378 |
% used by the key \mykey{before*} and finally execute the function |
| 13379 |
% \cs{@@_check_ans_active:} for the check answer mechanism. |
| 13380 |
% \begin{macrocode} |
| 13381 |
\cs_new_protected:Nn \@@_before_list: |
| 13382 |
{ |
| 13383 |
\@@_vspace_above: |
| 13384 |
\@@_before_args_exec: |
| 13385 |
\@@_check_ans_active: |
| 13386 |
% \end{macrocode} |
| 13387 |
% When the \mykey{mini-env} key is active it will set the value of the |
| 13388 |
% \myvarenv{l__@@_minipage_right_X_dim} to be the \emph{width} of the \myvarenv*{__@@_mini_page} |
| 13389 |
% environment on the \emph{\enquote{right side}}, using this value together with the value |
| 13390 |
% of the \myvarenv{l__@@_minipage_hsep_X_dim} set by the \mykey{mini-sep} key, |
| 13391 |
% the value of \myvarenv{l__@@_minipage_left_X_dim} will be set, which will be |
| 13392 |
% the \emph{width} of \myvarenv*{__@@_mini_page} environment on the |
| 13393 |
% \emph{\enquote{left side}}, always having a current \ics{linewidth} |
| 13394 |
% as \emph{maximum width} between them. |
| 13395 |
% \iffalse |
| 13396 |
%% Set |mini-env| width value. |
| 13397 |
% \fi |
| 13398 |
% \begin{macrocode} |
| 13399 |
\dim_compare:nNnT |
| 13400 |
{ \dim_use:c { l_@@_minipage_right_ \@@_level: _dim } } > { \c_zero_dim } |
| 13401 |
{ |
| 13402 |
\dim_set:cn { l_@@_minipage_left_ \@@_level: _dim } |
| 13403 |
{ |
| 13404 |
\linewidth |
| 13405 |
- \dim_use:c { l_@@_minipage_right_ \@@_level: _dim } |
| 13406 |
- \dim_use:c { l_@@_minipage_hsep_ \@@_level: _dim } |
| 13407 |
} |
| 13408 |
% \end{macrocode} |
| 13409 |
% The boolean variable \myvarenv{l__@@_minipage_active_X_bool} will be |
| 13410 |
% activated and the integer variable \cs{g_@@_minipage_stat_int} |
| 13411 |
% used by the \ics*{miniright} command will be incremented, then |
| 13412 |
% the function \cs{@@_minipage_add_space:} is called and the |
| 13413 |
% \myvarenv*{__@@_mini_page} environment on the \emph{\enquote{left |
| 13414 |
% side}} will be initialized followed by the \emph{\enquote{vertical spacing}} |
| 13415 |
% applied to preserve the \emph{\enquote{baseline}} between the \emph{left} |
| 13416 |
% and \emph{right} side environments. |
| 13417 |
% After these actions, the function \cs{@@_multicols_start:} is |
| 13418 |
% called to handle the \myenv{multicols} environment. |
| 13419 |
% \iffalse |
| 13420 |
%% Use internal minipage with |\nointerlineskip| and |\addvspace| here |
| 13421 |
% \fi |
| 13422 |
% \begin{macrocode} |
| 13423 |
\bool_set_true:c { l_@@_minipage_active_ \@@_level: _bool } |
| 13424 |
\int_gincr:N \g_@@_minipage_stat_int |
| 13425 |
\@@_minipage_add_space: |
| 13426 |
\noindent |
| 13427 |
\@@_mini_page{ \dim_use:c { l_@@_minipage_left_ \@@_level: _dim } } |
| 13428 |
} |
| 13429 |
\@@_multicols_start: |
| 13430 |
} |
| 13431 |
% \end{macrocode} |
| 13432 |
% \end{macro} |
| 13433 |
% |
| 13434 |
% \begin{macro}{\@@_second_part:} |
| 13435 |
% The function \cs{@@_second_part:} first check the state of |
| 13436 |
% the boolean variable \myvarenv{l__@@_minipage_active_X_bool}, if it is |
| 13437 |
% \enquote{true} a small test will be executed to check if we have |
| 13438 |
% omitted the use of \ics*{miniright} (the \myvarenv*{__@@_mini_page} |
| 13439 |
% environment has not been closed), then close \myvarenv*{__@@_mini_page} |
| 13440 |
% and add the \emph{adjusted vertical space} \cs{l_@@_minipage_after_skip}, |
| 13441 |
% otherwise we will close the \myenv{multicols} environment. |
| 13442 |
% \begin{macrocode} |
| 13443 |
\cs_new_protected:Nn \@@_second_part: |
| 13444 |
{ |
| 13445 |
\bool_if:cTF { l_@@_minipage_active_ \@@_level: _bool } |
| 13446 |
{ |
| 13447 |
\int_compare:nNnT { \g_@@_minipage_stat_int } = { 1 } |
| 13448 |
{ |
| 13449 |
\msg_warning:nn { enumext } { missing-miniright } |
| 13450 |
\miniright |
| 13451 |
} |
| 13452 |
\int_gzero:N \g_@@_minipage_stat_int |
| 13453 |
\@@_unskip_unkern: % remove topsep + [partopsep] |
| 13454 |
\end@@_mini_page |
| 13455 |
} |
| 13456 |
{ |
| 13457 |
\@@_multicols_stop: |
| 13458 |
} |
| 13459 |
% \end{macrocode} |
| 13460 |
% Now we will execute the functions \cs{@@_after_stop_list:} used by |
| 13461 |
% the key \mykey{after}, \cs{@@_check_ans_key_hook:} used by the key |
| 13462 |
% \mykey{check-ans}, \cs{@@_vspace_below:} used by the keys \mykey{below} |
| 13463 |
% and \mykey{below*}. Finally set \cs{l_@@_standar_bool} to false and call |
| 13464 |
% the function \cs{@@_resume_save_counter:} used by the \mykey{series}, |
| 13465 |
% \mykey{resume} and \mykey{resume*} keys. |
| 13466 |
% \begin{macrocode} |
| 13467 |
\@@_after_stop_list: |
| 13468 |
\@@_check_ans_key_hook: |
| 13469 |
\@@_vspace_below: |
| 13470 |
\bool_set_false:N \l_@@_standar_bool |
| 13471 |
\bool_if:NF \l_@@_print_keyans_cmd_bool |
| 13472 |
{ |
| 13473 |
\@@_standar_save_counter: |
| 13474 |
} |
| 13475 |
} |
| 13476 |
% \end{macrocode} |
| 13477 |
% \end{macro} |
| 13478 |
% |
| 13479 |
% \begin{macro}{\@@_set_item_width:}\label{dim:item-width-enumext} |
| 13480 |
% The function \cs{@@_set_item_width:} will set the value of |\itemwidth| |
| 13481 |
% taking into account the value established by the \mykey{list-offset} |
| 13482 |
% key for each level of the environment. |
| 13483 |
% \iffalse |
| 13484 |
%% Set |\itemwidth| for |enumext| environment. |
| 13485 |
% \fi |
| 13486 |
% \begin{macrocode} |
| 13487 |
\cs_new_protected:Nn \@@_set_item_width: |
| 13488 |
{ |
| 13489 |
\dim_set:Nn \itemwidth { \linewidth } |
| 13490 |
\dim_compare:nT |
| 13491 |
{ |
| 13492 |
\dim_use:c { l_@@_listoffset_ \_@@_level: _dim } != \c_zero_dim |
| 13493 |
} |
| 13494 |
{ |
| 13495 |
\dim_sub:Nn \itemwidth |
| 13496 |
{ |
| 13497 |
\dim_use:c { l_@@_listoffset_ \_@@_level: _dim } |
| 13498 |
} |
| 13499 |
} |
| 13500 |
} |
| 13501 |
% \end{macrocode} |
| 13502 |
% \end{macro} |
| 13503 |
% |
| 13504 |
% \begin{macro}{enumext} |
| 13505 |
% Now create the \myenv*{enumext} environment based on \myenv{list} |
| 13506 |
% environment by levels. |
| 13507 |
% \iffalse |
| 13508 |
%% Definition of |enumext| environment. |
| 13509 |
% \fi |
| 13510 |
% \begin{macrocode} |
| 13511 |
\NewDocumentEnvironment{enumext}{ O{} } |
| 13512 |
{ |
| 13513 |
\@@_safe_exec: |
| 13514 |
\@@_parse_keys:n {#1} |
| 13515 |
\@@_before_list: |
| 13516 |
\@@_start_store_level: |
| 13517 |
\@@_start_list:nn |
| 13518 |
{ \tl_use:c { l_@@_label_ \@@_level: _tl } } |
| 13519 |
{ |
| 13520 |
\use:c { @@_list_arg_two_ \@@_level: : } |
| 13521 |
\@@_before_keys_exec: |
| 13522 |
} |
| 13523 |
\@@_set_item_width: |
| 13524 |
\@@_after_args_exec: |
| 13525 |
} |
| 13526 |
{ |
| 13527 |
\@@_second_part: |
| 13528 |
} |
| 13529 |
% \end{macrocode} |
| 13530 |
% \end{macro} |
| 13531 |
% |
| 13532 |
% As we don't want our check to be executed \mykey{check-ans} by levels |
| 13533 |
% but on the complete list, we will take it out of the \myenv*{enumext} |
| 13534 |
% environment using the \emph{\enquote{hook}} function \cs{@@_after_env:nn}. |
| 13535 |
% \iffalse |
| 13536 |
%% Execute |check-ans| key out of |enumext| environment. |
| 13537 |
% \fi |
| 13538 |
% \begin{macrocode} |
| 13539 |
\@@_after_env:nn {enumext} |
| 13540 |
{ |
| 13541 |
\@@_execute_after_env: |
| 13542 |
} |
| 13543 |
% \end{macrocode} |
| 13544 |
% |
| 13545 |
% \subsection{The environment \env{keyans}}\label{env:keyans} |
| 13546 |
% |
| 13547 |
% The environment \myenv*{keyans} also based on lists. |
| 13548 |
% The main differences with the \myenv*{enumext} environment are the |
| 13549 |
% \emph{nesting} and the way the \emph{answers} (choice) will be stored and checked, this |
| 13550 |
% environment is intended exclusively for \emph{\enquote{multiple choice questions}}. |
| 13551 |
% |
| 13552 |
% \begin{macro}{\@@_keyans_safe_exec:} |
| 13553 |
% The \myenv*{keyans} environment will only be available if the |
| 13554 |
% \mykey{save-ans} key is active and can only be used at the |
| 13555 |
% \emph{\enquote{first level}} within the \myenv*{enumext} environment. |
| 13556 |
% We do not want the environment to be nested, so we will set a maximum at this point. |
| 13557 |
% If the conditions are not met, an error message will be returned. |
| 13558 |
% \iffalse |
| 13559 |
%% Function for check nested level in |keyans| environment. |
| 13560 |
% \fi |
| 13561 |
% \begin{macrocode} |
| 13562 |
\cs_new_protected:Nn \@@_keyans_safe_exec: |
| 13563 |
{ |
| 13564 |
\bool_if:NF \l_@@_store_active_bool |
| 13565 |
{ |
| 13566 |
\msg_error:nnnn { enumext } { wrong-place }{ keyans }{ save-ans } |
| 13567 |
} |
| 13568 |
\int_incr:N \l_@@_keyans_level_int |
| 13569 |
\bool_set_true:N \l_@@_keyans_env_bool |
| 13570 |
\@@_keyans_name_and_start: |
| 13571 |
% Set false for interfering with enumext nested in keyans (yes, its possible and crayze) |
| 13572 |
\bool_set_false:N \l_@@_store_active_bool |
| 13573 |
\int_compare:nNnT { \l_@@_keyans_level_int } > { 1 } |
| 13574 |
{ |
| 13575 |
\msg_error:nn { enumext } { keyans-nested } |
| 13576 |
} |
| 13577 |
\int_compare:nNnT { \l_@@_level_int } > { 1 } |
| 13578 |
{ |
| 13579 |
\msg_error:nn { enumext } { keyans-wrong-level } |
| 13580 |
} |
| 13581 |
} |
| 13582 |
% \end{macrocode} |
| 13583 |
% \end{macro} |
| 13584 |
% |
| 13585 |
% \begin{macro}{\@@_keyans_parse_keys:n} |
| 13586 |
% Parse \myoarg{key \textnormal{\textcolor{gray}{=}} val} for |
| 13587 |
% \myenv*{keyans} environment. |
| 13588 |
% \iffalse |
| 13589 |
%% Function for parse |key=val| in |keyans|. |
| 13590 |
% \fi |
| 13591 |
% \begin{macrocode} |
| 13592 |
\cs_new_protected:Npn \@@_keyans_parse_keys:n #1 |
| 13593 |
{ |
| 13594 |
\keys_set:nn { enumext / keyans } {#1} |
| 13595 |
} |
| 13596 |
% \end{macrocode} |
| 13597 |
% \end{macro} |
| 13598 |
% |
| 13599 |
% \begin{macro}{\@@_before_list_v:, \@@_keyans_multicols_start:, |
| 13600 |
% \@@_keyans_multicols_stop:, \@@_second_part_v:} |
| 13601 |
% Same implementation as the one used in the \myenv*{enumext} environment. |
| 13602 |
% \iffalse |
| 13603 |
%% Internal functions for |keyans| environment. |
| 13604 |
% \fi |
| 13605 |
% \begin{macrocode} |
| 13606 |
\cs_new_protected:Nn \@@_before_list_v: |
| 13607 |
{ |
| 13608 |
\@@_vspace_above_v: |
| 13609 |
\@@_before_args_exec_v: |
| 13610 |
\dim_compare:nNnT { \l_@@_minipage_right_v_dim } > { \c_zero_dim } |
| 13611 |
{ |
| 13612 |
\dim_set:Nn \l_@@_minipage_left_v_dim |
| 13613 |
{ |
| 13614 |
\linewidth - \l_@@_minipage_right_v_dim - \l_@@_minipage_hsep_v_dim |
| 13615 |
} |
| 13616 |
\bool_set_true:N \l_@@_minipage_active_v_bool |
| 13617 |
\int_gincr:N \g_@@_minipage_stat_int |
| 13618 |
\@@_keyans_minipage_add_space: |
| 13619 |
\@@_mini_page{ \l_@@_minipage_left_v_dim } |
| 13620 |
} |
| 13621 |
\@@_keyans_multicols_start: |
| 13622 |
} |
| 13623 |
\cs_new_protected:Nn \@@_keyans_multicols_start: |
| 13624 |
{ |
| 13625 |
\int_compare:nNnT { \l_@@_columns_v_int } > { 1 } |
| 13626 |
{ |
| 13627 |
\dim_compare:nNnT { \l_@@_columns_sep_v_dim } = { \c_zero_dim } |
| 13628 |
{ |
| 13629 |
\dim_set:Nn \l_@@_columns_sep_v_dim |
| 13630 |
{ |
| 13631 |
( |
| 13632 |
\l_@@_labelwidth_v_dim + \l_@@_labelsep_v_dim |
| 13633 |
) / \l_@@_columns_v_int |
| 13634 |
- \l_@@_listoffset_v_dim |
| 13635 |
} |
| 13636 |
} |
| 13637 |
\dim_set_eq:NN \columnsep \l_@@_columns_sep_v_dim |
| 13638 |
\dim_zero:N \columnseprule % no rule here |
| 13639 |
\bool_if:NF \l_@@_minipage_active_v_bool |
| 13640 |
{ |
| 13641 |
\skip_zero:N \multicolsep |
| 13642 |
\@@_keyans_multi_addvspace: |
| 13643 |
} |
| 13644 |
\raggedcolumns |
| 13645 |
\begin{multicols}{ \l_@@_columns_v_int } |
| 13646 |
} |
| 13647 |
} |
| 13648 |
\cs_new_protected:Nn \@@_keyans_multicols_stop: |
| 13649 |
{ |
| 13650 |
\int_compare:nNnTF { \l_@@_columns_v_int } > { 1 } |
| 13651 |
{ |
| 13652 |
\@@_stop_list: |
| 13653 |
\end{multicols} |
| 13654 |
\@@_unskip_unkern: |
| 13655 |
\@@_unskip_unkern: |
| 13656 |
\par\addvspace{ \l_@@_multicols_below_v_skip } |
| 13657 |
} |
| 13658 |
{ |
| 13659 |
\@@_stop_list: |
| 13660 |
} |
| 13661 |
} |
| 13662 |
\cs_new_protected:Nn \@@_second_part_v: |
| 13663 |
{ |
| 13664 |
\bool_if:NTF \l_@@_minipage_active_v_bool |
| 13665 |
{ |
| 13666 |
\int_compare:nNnT { \g_@@_minipage_stat_int } = { 1 } |
| 13667 |
{ |
| 13668 |
\msg_warning:nn { enumext } { missing-miniright } |
| 13669 |
\miniright |
| 13670 |
} |
| 13671 |
\int_gzero:N \g_@@_minipage_stat_int |
| 13672 |
\@@_unskip_unkern: % remove \topsep + [\partopsep] |
| 13673 |
\end@@_mini_page |
| 13674 |
\par\addvspace{ \l_@@_minipage_after_skip } |
| 13675 |
} |
| 13676 |
{ |
| 13677 |
\@@_keyans_multicols_stop: |
| 13678 |
} |
| 13679 |
\bool_set_false:N \l_@@_keyans_env_bool |
| 13680 |
\@@_after_stop_list_v: |
| 13681 |
\@@_vspace_below_v: |
| 13682 |
} |
| 13683 |
% \end{macrocode} |
| 13684 |
% \end{macro} |
| 13685 |
% |
| 13686 |
% \begin{macro}{\@@_keyans_set_item_width:}\label{dim:item-width-keyans} |
| 13687 |
% The function \cs{@@_keyans_set_item_width:} will set the value of |\itemwidth| |
| 13688 |
% taking into account the value established by the \mykey{list-offset} |
| 13689 |
% key. |
| 13690 |
% \iffalse |
| 13691 |
%% Set |\itemwidth| for |keyans| environment. |
| 13692 |
% \fi |
| 13693 |
% \begin{macrocode} |
| 13694 |
\cs_new_protected:Nn \@@_keyans_set_item_width: |
| 13695 |
{ |
| 13696 |
\dim_set:Nn \itemwidth { \linewidth } |
| 13697 |
\dim_compare:nT |
| 13698 |
{ |
| 13699 |
\l_@@_listoffset_v_dim != \c_zero_dim |
| 13700 |
} |
| 13701 |
{ |
| 13702 |
\dim_sub:Nn \itemwidth { \l_@@_listoffset_v_dim } |
| 13703 |
} |
| 13704 |
} |
| 13705 |
% \end{macrocode} |
| 13706 |
% \end{macro} |
| 13707 |
% |
| 13708 |
% \begin{macro}{keyans} |
| 13709 |
% Now we define the environment \myenv*{keyans} also based on lists. |
| 13710 |
% \iffalse |
| 13711 |
%% Definition of |keyans| environment. |
| 13712 |
% \fi |
| 13713 |
% \begin{macrocode} |
| 13714 |
\NewDocumentEnvironment{keyans}{ O{} } |
| 13715 |
{ |
| 13716 |
\@@_keyans_safe_exec: |
| 13717 |
\@@_keyans_parse_keys:n {#1} |
| 13718 |
\@@_before_list_v: |
| 13719 |
\@@_start_list:nn |
| 13720 |
{ \tl_use:N \l_@@_label_v_tl } |
| 13721 |
{ |
| 13722 |
\@@_list_arg_two_v: |
| 13723 |
\@@_before_keys_exec_v: |
| 13724 |
} |
| 13725 |
\@@_keyans_set_item_width: |
| 13726 |
\@@_after_args_exec_v: |
| 13727 |
} |
| 13728 |
{ |
| 13729 |
\@@_check_starred_cmd:n { item } |
| 13730 |
\@@_second_part_v: |
| 13731 |
} |
| 13732 |
% \end{macrocode} |
| 13733 |
% \end{macro} |
| 13734 |
% |
| 13735 |
% \subsection{Tagging PDF support for non-standart list environments}\label{ltx:tag-nonestandarlist} |
| 13736 |
% |
| 13737 |
% The \hologo{LaTeX} release 2022-06-01 brings automatic support for |
| 13738 |
% \emph{tagged} \texttt{PDF} in several aspects, including the standard |
| 13739 |
% \emph{list environments} and the \myenv{list} environment. Unfortunately |
| 13740 |
% non-standard \emph{list environments} like \myenv*{keyanspic} or the |
| 13741 |
% horizontal list environments \myenv*{enumext*} and \myenv*{keyans*} are |
| 13742 |
% not structured in a nice way, i.e. the expected result in the \texttt{PDF} |
| 13743 |
% file is the expected one, but the underlying structure is not correct. In |
| 13744 |
% simple terms, for \emph{tagged} \texttt{PDF} a \myenv{list} environment |
| 13745 |
% is a \myenv{list} environment, no matter what it looks like in the \texttt{PDF} file. |
| 13746 |
% |
| 13747 |
% \smallskip |
| 13748 |
% |
| 13749 |
% To maintain a correct \myenv{list} structure when |\DocumentMetadata| is |
| 13750 |
% active, it is necessary to do some things manually using |
| 13751 |
% \mypkg{tagpdf}\cite{tagpdf} and \mypkg{ltsockets}\cite{ltsockets}. |
| 13752 |
% This implementation is an adaptation of my answer thanks to Ulrike Fischer's |
| 13753 |
% comments in \href{https://tex.stackexchange.com/a/725902}{How can I modify my \texttt{\textbackslash item} redefinition to be compatible with \texttt{tagging-pdf}}. |
| 13754 |
% |
| 13755 |
% \subsubsection{Socket for tagging support in \env{enumext*} and \env{keyans*}} |
| 13756 |
% |
| 13757 |
% \begin{macro}[int]{start-list-tags, stop-start-tags, stop-list-tags, |
| 13758 |
% \@@_start_list_tag:n,\@@_stop_start_list_tag:, |
| 13759 |
% \@@_stop_list_tag:n} |
| 13760 |
% We will first define the necessary \texttt{sockets} and their |
| 13761 |
% behavior for \myenv*{enumext*} and \myenv*{keyans*}. |
| 13762 |
% \iffalse |
| 13763 |
%% Implement socket for tagging support in |enumext*| and |keyans*| environments. |
| 13764 |
% \fi |
| 13765 |
% \begin{macrocode} |
| 13766 |
\socket_new:nn {tagsupport/@@/starred}{ 1 } |
| 13767 |
\socket_new_plug:nnn {tagsupport/@@/starred} {start-list-tags} |
| 13768 |
{ |
| 13769 |
\tag_resume:n {#1} |
| 13770 |
\tag_struct_begin:n {tag=LI} |
| 13771 |
\tag_struct_begin:n {tag=Lbl} |
| 13772 |
\tag_mc_begin:n {tag=Lbl} |
| 13773 |
} |
| 13774 |
\socket_new_plug:nnn {tagsupport/@@/starred} {stop-start-tags} |
| 13775 |
{ |
| 13776 |
\tag_mc_end: |
| 13777 |
\tag_struct_end:n {tag=Lbl} |
| 13778 |
\tag_struct_begin:n {tag=LBody} |
| 13779 |
\tag_struct_begin:n {tag=text-unit} |
| 13780 |
\tag_struct_begin:n {tag=text} |
| 13781 |
} |
| 13782 |
\socket_new_plug:nnn {tagsupport/@@/starred} {stop-list-tags} |
| 13783 |
{ |
| 13784 |
\tag_struct_end:n {tag=text} |
| 13785 |
\tag_struct_end:n {tag=text-unit} |
| 13786 |
\tag_struct_end:n {tag=LBody} |
| 13787 |
\tag_struct_end:n {tag=LI} |
| 13788 |
\tag_suspend:n {#1} |
| 13789 |
} |
| 13790 |
% \end{macrocode} |
| 13791 |
% |
| 13792 |
% And now we'll wrap them so that they're only active when |\DocumentMetadata| is present. |
| 13793 |
% \iffalse |
| 13794 |
%% Wrap socket in conditional functions for tagging |enumext*| and |keyans*| environments. |
| 13795 |
% \fi |
| 13796 |
% \begin{macrocode} |
| 13797 |
\cs_new_protected_nopar:Npn \@@_start_list_tag:n #1 |
| 13798 |
{ |
| 13799 |
\IfDocumentMetadataT |
| 13800 |
{ |
| 13801 |
\socket_assign_plug:nn {tagsupport/@@/starred} {start-list-tags} |
| 13802 |
\socket_use:nn {tagsupport/@@/starred} {#1} |
| 13803 |
} |
| 13804 |
} |
| 13805 |
\cs_new_protected_nopar:Nn \@@_stop_start_list_tag: |
| 13806 |
{ |
| 13807 |
\IfDocumentMetadataT |
| 13808 |
{ |
| 13809 |
\socket_assign_plug:nn {tagsupport/@@/starred} {stop-start-tags} |
| 13810 |
\socket_use:nn {tagsupport/@@/starred} { } |
| 13811 |
} |
| 13812 |
} |
| 13813 |
\cs_new_protected_nopar:Npn \@@_stop_list_tag:n #1 |
| 13814 |
{ |
| 13815 |
\IfDocumentMetadataT |
| 13816 |
{ |
| 13817 |
\socket_assign_plug:nn {tagsupport/@@/starred} {stop-list-tags} |
| 13818 |
\socket_use:nn {tagsupport/@@/starred} {#1} |
| 13819 |
} |
| 13820 |
} |
| 13821 |
% \end{macrocode} |
| 13822 |
% \end{macro} |
| 13823 |
% |
| 13824 |
% \subsubsection{Socket for tagging support in \env{keyanspic}} |
| 13825 |
% |
| 13826 |
% \begin{macro}[int]{start-list-tags, stop-start-tags, stop-list-tags, |
| 13827 |
% \@@_anspic_start_list_tag:,\@@_anspic_stop_start_list_tag:, |
| 13828 |
% \@@_anspic_stop_list_tag:} |
| 13829 |
% We will first define the necessary \texttt{sockets} and their |
| 13830 |
% behavior for \myenv*{keyanspic} environment. |
| 13831 |
% \iffalse |
| 13832 |
%% Implement socket for tagging support in |keyanspic| environment. |
| 13833 |
% \fi |
| 13834 |
% \begin{macrocode} |
| 13835 |
\socket_new:nn {tagsupport/@@/keyanspic}{ 0 } |
| 13836 |
\socket_new_plug:nnn {tagsupport/@@/keyanspic} {start-list-tags} |
| 13837 |
{ |
| 13838 |
\tag_resume:n {keyanspic} |
| 13839 |
\tag_struct_begin:n {tag=LI} |
| 13840 |
\tag_struct_begin:n {tag=Lbl} |
| 13841 |
\tag_mc_begin:n {tag=Lbl} |
| 13842 |
} |
| 13843 |
\socket_new_plug:nnn {tagsupport/@@/keyanspic} {stop-start-tags} |
| 13844 |
{ |
| 13845 |
\tag_mc_end: |
| 13846 |
\tag_struct_end:n {tag=Lbl} |
| 13847 |
\tag_struct_begin:n {tag=LBody} |
| 13848 |
\tag_struct_begin:n {tag=text-unit} |
| 13849 |
\tag_struct_begin:n {tag=text} |
| 13850 |
\tag_mc_begin:n {tag=text} |
| 13851 |
} |
| 13852 |
\socket_new_plug:nnn {tagsupport/@@/keyanspic} {stop-list-tags} |
| 13853 |
{ |
| 13854 |
\tag_mc_end: |
| 13855 |
\tag_struct_end:n {tag=text} |
| 13856 |
\tag_struct_end:n {tag=text-unit} |
| 13857 |
\tag_struct_end:n {tag=LBody} |
| 13858 |
\tag_struct_end:n {tag=LI} |
| 13859 |
\tag_suspend:n {keyanspic} |
| 13860 |
} |
| 13861 |
% \end{macrocode} |
| 13862 |
% And now we'll wrap them so that they're only active when |
| 13863 |
% |\DocumentMetadata| is present. |
| 13864 |
% \iffalse |
| 13865 |
%% Wrap socket in conditional functions for tagging |keyanspic| environment. |
| 13866 |
% \fi |
| 13867 |
% \begin{macrocode} |
| 13868 |
\cs_new_protected_nopar:Nn \@@_anspic_start_list_tag: |
| 13869 |
{ |
| 13870 |
\IfDocumentMetadataT |
| 13871 |
{ |
| 13872 |
\socket_assign_plug:nn {tagsupport/@@/keyanspic} {start-list-tags} |
| 13873 |
\socket_use:n {tagsupport/@@/keyanspic} |
| 13874 |
} |
| 13875 |
} |
| 13876 |
\cs_new_protected_nopar:Nn \@@_anspic_stop_start_list_tag: |
| 13877 |
{ |
| 13878 |
\IfDocumentMetadataT |
| 13879 |
{ |
| 13880 |
\socket_assign_plug:nn {tagsupport/@@/keyanspic} {stop-start-tags} |
| 13881 |
\socket_use:n {tagsupport/@@/keyanspic} |
| 13882 |
} |
| 13883 |
} |
| 13884 |
\cs_new_protected_nopar:Nn \@@_anspic_stop_list_tag: |
| 13885 |
{ |
| 13886 |
\IfDocumentMetadataT |
| 13887 |
{ |
| 13888 |
\socket_assign_plug:nn {tagsupport/@@/keyanspic} {stop-list-tags} |
| 13889 |
\socket_use:n {tagsupport/@@/keyanspic} |
| 13890 |
} |
| 13891 |
} |
| 13892 |
% \end{macrocode} |
| 13893 |
% \end{macro} |
| 13894 |
% |
| 13895 |
% \subsection{The environment \env{keyanspic} and \cs{anspic}} |
| 13896 |
% |
| 13897 |
% The \myenv*{keyanspic} environment is a \myenv{list} based environment that |
| 13898 |
% uses the same configuration for \emph{\enquote{spacing}} and \mymeta{label} |
| 13899 |
% as the \myenv*{keyans} environment, but it does not use |\item|. |
| 13900 |
% The \mymeta{contents} are passed to the environment by means of the |
| 13901 |
% \ics*{anspic} command as replacement for |\item| command and placed |
| 13902 |
% inside \myenv{minipage} environments, with the \mymeta{label} |
| 13903 |
% centered \emph{\enquote{above}} or \emph{\enquote{below}}, adjusting |
| 13904 |
% \emph{widths} and \emph{position} according to the options passed to |
| 13905 |
% the environment. |
| 13906 |
% |
| 13907 |
% \begin{figure}[ht] |
| 13908 |
% \centering |
| 13909 |
% \begin{tikzpicture}[line cap=round,line join=round,x=0.8cm,y=0.8cm,every node/.style={font=\footnotesize}] |
| 13910 |
% % space above |
| 13911 |
% \draw[color=white] (7.0,6.10) rectangle (17.5,6.5) node[pos=.5,text=black]% |
| 13912 |
% { \textcolor{optcolor}{\texttt{layout-top}} }; |
| 13913 |
% % space between |
| 13914 |
% \draw[color=white] (7.0,4.5) rectangle (17.5,4.9) node[pos=.5,text=black]% |
| 13915 |
% { \textcolor{optcolor}{\texttt{layout-sep}} }; |
| 13916 |
% % space below |
| 13917 |
% \draw[color=white] (7.0,2.9) rectangle (17.5,3.3) node[pos=.5,text=black]% |
| 13918 |
% { \textcolor{optcolor}{\texttt{layout-top}} }; |
| 13919 |
% % labelwidth |
| 13920 |
% \draw[<->,color=gray] (2.0,7.0) --node[above,text=optcolor]{\vphantom{p}\texttt{labelwidth}} (5.0,7.0); |
| 13921 |
% \draw[<->,color=gray] (5.0,7.0) --node[above,text=optcolor]{\texttt{labelsep}} (7.0,7.0); |
| 13922 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (2.0,6.5) rectangle (5.0,6.85);% labelwidth |
| 13923 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (5.0,6.5) rectangle (7.0,6.85);% labelsep |
| 13924 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,6.5) rectangle (17.5,6.85);% item width |
| 13925 |
% % minipage one |
| 13926 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,5.25) rectangle (10.5,6.10) node[pos=.5,text=black]% |
| 13927 |
% {\begin{tabular}{c} |
| 13928 |
% \texttt{minipage one} \\ |
| 13929 |
% \textcolor{blue}{\emph{drawing or tabular}} |
| 13930 |
% \end{tabular}}; |
| 13931 |
% % label one |
| 13932 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,4.9) rectangle (10.5,5.25) node[pos=.5,text=black]% |
| 13933 |
% { \textcolor{blue}{\texttt{label}} }; |
| 13934 |
% % minipage two |
| 13935 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (10.5,5.25) rectangle (14,6.10) node[pos=.5,text=black]% |
| 13936 |
% {\begin{tabular}{c} |
| 13937 |
% \texttt{minipage two} \\ |
| 13938 |
% \textcolor{blue}{\emph{drawing or tabular}} |
| 13939 |
% \end{tabular}}; |
| 13940 |
% % label two |
| 13941 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (10.5,4.9) rectangle (14,5.25) node[pos=.5,text=black]% |
| 13942 |
% { \textcolor{blue}{\texttt{label}} }; |
| 13943 |
% % minipage three |
| 13944 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (14,5.25) rectangle (17.5,6.10) node[pos=.5,text=black]% |
| 13945 |
% {\begin{tabular}{c} |
| 13946 |
% \texttt{minipage three} \\ |
| 13947 |
% \textcolor{blue}{\emph{drawing or tabular}} |
| 13948 |
% \end{tabular}}; |
| 13949 |
% % label three |
| 13950 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (14,4.9) rectangle (17.5,5.25) node[pos=.5,text=black]% |
| 13951 |
% { \textcolor{blue}{\texttt{label}} }; |
| 13952 |
% % minipage four |
| 13953 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,3.65) rectangle (12.25,4.5) node[pos=.5,text=black]% |
| 13954 |
% {\begin{tabular}{c} |
| 13955 |
% \texttt{minipage four} \\ |
| 13956 |
% \textcolor{blue}{\emph{drawing or tabular}} |
| 13957 |
% \end{tabular}}; |
| 13958 |
% % label four |
| 13959 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,3.3) rectangle (12.25,3.65) node[pos=.5,text=black]% |
| 13960 |
% { \textcolor{blue}{\texttt{label}} }; |
| 13961 |
% % minipage five |
| 13962 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (12.25,3.65) rectangle (17.5,4.5) node[pos=.5,text=black]% |
| 13963 |
% {\begin{tabular}{c} |
| 13964 |
% \texttt{minipage five} \\ |
| 13965 |
% \textcolor{blue}{\emph{drawing or tabular}} |
| 13966 |
% \end{tabular}}; |
| 13967 |
% % label five |
| 13968 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (12.25,3.3) rectangle (17.5,3.65) node[pos=.5,text=black]% |
| 13969 |
% { \textcolor{blue}{\texttt{label}} }; |
| 13970 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (2.0,2.55) rectangle (5.0,2.9);% labelwidth |
| 13971 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (5.0,2.55) rectangle (7.0,2.9);% labelsep |
| 13972 |
% \draw[color=lightgray,fill=lightgray,fill opacity=0.15] (7.0,2.55) rectangle (17.5,2.9);% item width |
| 13973 |
% \end{tikzpicture} |
| 13974 |
% \caption{Representation of the \myenv*{keyanspic} spacing in \mypkg*{enumext}.} |
| 13975 |
% \label{fig:keyanspic} |
| 13976 |
% \end{figure} |
| 13977 |
% |
| 13978 |
% \smallskip |
| 13979 |
% |
| 13980 |
% In order for the \myenv*{keyanspic} environment and the |\anspic| |
| 13981 |
% command to work correctly, we need to set and export some variables in |
| 13982 |
% the first part of the environment definition and pass them to |\anspic| |
| 13983 |
% which is executed in the second part of the environment. This |
| 13984 |
% implementation is adapted from the answer given by Enrico Gregorio |
| 13985 |
% (\texttt{@egreg}) in \href{https://tex.stackexchange.com/a/577705/7832}{How to process the body of an environment and divide it by a \textbackslash macro?}. |
| 13986 |
% |
| 13987 |
% \subsubsection{The environment \env{keyanspic}}\label{env:keyanspic} |
| 13988 |
% |
| 13989 |
% \begin{macro}[int]{label-pos, label-sep, layout-sty, layout-sep, |
| 13990 |
% layout-top, mark-ans, mark-pos, mark-sep, save-sep, |
| 13991 |
% wrap-opt, wrap-ans*, show-ans, show-pos} |
| 13992 |
% First we define the keys that allows us to process the position of the |
| 13993 |
% \mymeta{label} centered \enquote{above} or \enquote{below} which will be \mykey{label-pos}, |
| 13994 |
% the vertical separation of these from \emph{drawing or tabular} will be |
| 13995 |
% handled with the key \mykey{label-sep}. |
| 13996 |
% The \emph{\enquote{layout style}} will be handled with the key |
| 13997 |
% \mykey{layout-sty} will take two values separated by comma \mymarg{n° |
| 13998 |
% upper, n° lower} and will determine the number of \myenv{minipage} |
| 13999 |
% environments in which all arguments of |\anspic| will be printed at the |
| 14000 |
% \enquote{upper} and \enquote{lower} within the environments separated |
| 14001 |
% by the value of the key \mykey{layout-sep}. The vertical space |
| 14002 |
% \enquote{top} and \enquote{bottom} of the environment will be handled |
| 14003 |
% with the key \mykey{layout-top}. |
| 14004 |
% \iffalse |
| 14005 |
%% Add keys for |keyanspic| environment. |
| 14006 |
% \fi |
| 14007 |
% \begin{macrocode} |
| 14008 |
\keys_define:nn { enumext / keyanspic } |
| 14009 |
{ |
| 14010 |
label-pos .choice:, |
| 14011 |
label-pos / above .code:n = |
| 14012 |
\bool_set_true:N \l_@@_anspic_label_above_bool |
| 14013 |
\str_set:Nn \l_@@_anspic_mini_pos_str { t }, |
| 14014 |
label-pos / below .code:n = |
| 14015 |
\bool_set_false:N \l_@@_anspic_label_above_bool |
| 14016 |
\str_set:Nn \l_@@_anspic_mini_pos_str { b }, |
| 14017 |
label-pos / unknown .code:n = |
| 14018 |
\msg_error:nneee { enumext } { unknown-choice } |
| 14019 |
{ label-pos } { above,~ below } { \exp_not:n {#1} }, |
| 14020 |
label-pos .initial:n = below, |
| 14021 |
label-pos .value_required:n = true, |
| 14022 |
label-sep .skip_set:N = \l_@@_anspic_label_sep_skip, |
| 14023 |
label-sep .value_required:n = true, |
| 14024 |
layout-sty .tl_set:N = \l_@@_anspic_layout_style_tl, |
| 14025 |
layout-sty .value_required:n = true, |
| 14026 |
layout-sep .code:n = \keys_set:nn { enumext / keyans } { parsep = #1 }, |
| 14027 |
layout-sep .value_required:n = true, |
| 14028 |
layout-top .code:n = \keys_set:nn { enumext / keyans } { topsep = #1 }, |
| 14029 |
layout-top .value_required:n = true, |
| 14030 |
mark-ans .code:n = \keys_set:nn { enumext / keyans } { mark-ans = #1 }, |
| 14031 |
mark-ans .value_required:n = true, |
| 14032 |
mark-pos .code:n = \keys_set:nn { enumext / keyans } { mark-pos = #1 }, |
| 14033 |
mark-pos .value_required:n = true, |
| 14034 |
mark-sep .code:n = \keys_set:nn { enumext / keyans } { mark-sep = #1 }, |
| 14035 |
mark-sep .value_required:n = true, |
| 14036 |
save-sep .code:n = \keys_set:nn { enumext / keyans } { save-sep = #1 }, |
| 14037 |
save-sep .value_required:n = true, |
| 14038 |
wrap-opt .code:n = \keys_set:nn { enumext / keyans } { wrap-opt = #1 }, |
| 14039 |
wrap-opt .value_required:n = true, |
| 14040 |
wrap-ans* .code:n = \keys_set:nn { enumext / keyans } { wrap-ans* = #1 }, |
| 14041 |
wrap-ans* .value_required:n = true, |
| 14042 |
show-ans .code:n = \keys_set:nn { enumext / keyans } { show-ans = #1 }, |
| 14043 |
show-ans .value_required:n = true, |
| 14044 |
show-pos .code:n = \keys_set:nn { enumext / keyans } { show-pos = #1 }, |
| 14045 |
show-pos .value_required:n = true, |
| 14046 |
unknown .code:n = { |
| 14047 |
\tl_set:Nn \l_@@_envir_name_tl { keyanspic } |
| 14048 |
\@@_keyans_unknown_keys:n {#1} |
| 14049 |
}, |
| 14050 |
} |
| 14051 |
% \end{macrocode} |
| 14052 |
% \end{macro} |
| 14053 |
% |
| 14054 |
% \begin{macro}{\@@_keyans_pic_safe_exec:, \@@_keyans_pic_parse_keys:n, |
| 14055 |
% \@@_keyans_pic_skip_abs:N, \@@_keyans_pic_arg_two:,} |
| 14056 |
% The function \cs{@@_keyans_pic_safe_exec:} check the nested level |
| 14057 |
% position inside the \myenv*{enumext} environment. |
| 14058 |
% \iffalse |
| 14059 |
%% Internal check code for |keyanspic| environment. |
| 14060 |
% \fi |
| 14061 |
% \begin{macrocode} |
| 14062 |
\cs_new_protected:Nn \@@_keyans_pic_safe_exec: |
| 14063 |
{ |
| 14064 |
\int_incr:N \l_@@_keyans_pic_level_int |
| 14065 |
\int_compare:nNnT { \l_@@_keyans_pic_level_int } > { 1 } |
| 14066 |
{ |
| 14067 |
\msg_error:nn { enumext } { keyanspic-nested } |
| 14068 |
} |
| 14069 |
\@@_keyans_name_and_start: |
| 14070 |
} |
| 14071 |
% \end{macrocode} |
| 14072 |
% Parse \myoarg{key \textnormal{\textcolor{gray}{=}} val} for |
| 14073 |
% \myenv*{keyanspic} environment. |
| 14074 |
% \begin{macrocode} |
| 14075 |
\cs_new_protected:Npn \@@_keyans_pic_parse_keys:n #1 |
| 14076 |
{ |
| 14077 |
\tl_if_novalue:nF {#1} |
| 14078 |
{ |
| 14079 |
\keys_set:nn { enumext / keyanspic } {#1} |
| 14080 |
} |
| 14081 |
} |
| 14082 |
% \end{macrocode} |
| 14083 |
% The function \cs{@@_keyans_pic_skip_abs:N} will return a positive |
| 14084 |
% value \ics{parsep} from \myenv*{keyans} environment. |
| 14085 |
% \begin{macrocode} |
| 14086 |
\cs_new_protected:Npn \@@_keyans_pic_skip_abs:N #1 |
| 14087 |
{ |
| 14088 |
\dim_compare:nNnT { #1 } < { \c_zero_dim } |
| 14089 |
{ |
| 14090 |
\skip_set:Nn #1 { -#1 } |
| 14091 |
} |
| 14092 |
} |
| 14093 |
% \end{macrocode} |
| 14094 |
% The \cs{@@_keyans_pic_arg_two:} function will be used in the |
| 14095 |
% \emph{second argument} of the \myenv{list} environment that defines |
| 14096 |
% the \myenv*{keyanspic} environment, with this we will take the |
| 14097 |
% configuration of the \emph{\enquote{spaces}} and the keys |
| 14098 |
% \mykey{label}, \mykey{wrap-label}, \mykey{parsep} and \mykey{topsep} |
| 14099 |
% from the \myenv*{keyans} environment. |
| 14100 |
% The first thing we need to do is set the boolean variable |
| 14101 |
% \cs{l_@@_leftmargin_tmp_v_bool} handled by the \mykey{list-indent} key |
| 14102 |
% to \enquote{false}, then copy the definition of the second list argument |
| 14103 |
% from the \myenv*{keyans} environment definition and make sure that |
| 14104 |
% |\parsep| does not have a negative value. |
| 14105 |
% \begin{macrocode} |
| 14106 |
\cs_new_protected:Npn \@@_keyans_pic_arg_two: |
| 14107 |
{ |
| 14108 |
\bool_set_false:N \l_@@_leftmargin_tmp_v_bool |
| 14109 |
\@@_list_arg_two_v: |
| 14110 |
\@@_keyans_pic_skip_abs:N \parsep |
| 14111 |
% \end{macrocode} |
| 14112 |
% Now we increment the counter |enumXv| of the \myenv*{keyans} environment |
| 14113 |
% and save the \emph{total height} of the \mymeta{label} in |
| 14114 |
% \cs{l_@@_anspic_label_htdp_dim} used by |\anspic| and we will adjust |
| 14115 |
% the values of |\parsep| only if the key \mykey{label-pos} is set to \emph{below}. |
| 14116 |
% \begin{macrocode} |
| 14117 |
\bool_if:NF \l_@@_anspic_label_above_bool |
| 14118 |
{ |
| 14119 |
\stepcounter { enumXv } |
| 14120 |
\hbox_set:Nn \l_@@_anspic_label_box { \l_@@_label_v_tl } |
| 14121 |
\dim_set:Nn \l_@@_anspic_label_htdp_dim |
| 14122 |
{ |
| 14123 |
\box_ht_plus_dp:N \l_@@_anspic_label_box |
| 14124 |
} |
| 14125 |
\skip_add:Nn \parsep |
| 14126 |
{ |
| 14127 |
\l_@@_anspic_label_htdp_dim |
| 14128 |
+ \box_dp:N \strutbox |
| 14129 |
+ \l_@@_anspic_label_sep_skip |
| 14130 |
} |
| 14131 |
} |
| 14132 |
% \end{macrocode} |
| 14133 |
% Finally we \emph{adjust} the value of |\leftmargin| and |\topsep| |
| 14134 |
% then set |\listparindent|, |\partopsep| and |\itemsep| to zero so that |
| 14135 |
% the \emph{horizontal} and \emph{vertical} space is not affected. |
| 14136 |
% \begin{macrocode} |
| 14137 |
\dim_add:Nn \leftmargin { -\l_@@_labelwidth_v_dim - \l_@@_labelsep_v_dim } |
| 14138 |
\ignorespaces |
| 14139 |
\skip_add:Nn \topsep { 0.5\box_dp:N \strutbox } |
| 14140 |
\dim_zero:N \listparindent |
| 14141 |
\skip_zero:N \partopsep |
| 14142 |
\skip_zero:N \itemsep |
| 14143 |
} |
| 14144 |
% \end{macrocode} |
| 14145 |
% \end{macro} |
| 14146 |
% |
| 14147 |
% \begin{macro}{keyanspic} |
| 14148 |
% Now we define the environment \myenv*{keyanspic}. For compatibility |
| 14149 |
% with \emph{tagged} \texttt{PDF} we must use the |\begin{|\myenv{list}|}| |
| 14150 |
% form and a lot of conditional code using |\IfDocumentMetadataTF|. |
| 14151 |
% We will first stop the code for automatic \emph{tagged} \texttt{PDF} |
| 14152 |
% for \myenv{list} environments, redefine |\item| so that it cannot be |
| 14153 |
% used, and stop the code for automatic \emph{tagged} \texttt{PDF} for |
| 14154 |
% the \myenv*{keyanspic} environment. |
| 14155 |
% \iffalse |
| 14156 |
%% Define |keyanspic| environment. |
| 14157 |
% \fi |
| 14158 |
% \begin{macrocode} |
| 14159 |
\NewDocumentEnvironment{keyanspic}{ o } |
| 14160 |
{ |
| 14161 |
\@@_keyans_pic_safe_exec: |
| 14162 |
\@@_keyans_pic_parse_keys:n {#1} |
| 14163 |
\begin{list} { } { \@@_keyans_pic_arg_two: } |
| 14164 |
\IfDocumentMetadataT |
| 14165 |
{ |
| 14166 |
\tag_suspend:n {list} |
| 14167 |
} |
| 14168 |
\item[] \scan_stop: |
| 14169 |
\RenewDocumentCommand \item {} |
| 14170 |
{ |
| 14171 |
\msg_error:nn { enumext } { keyanspic-item-cmd } |
| 14172 |
} |
| 14173 |
\IfDocumentMetadataT |
| 14174 |
{ |
| 14175 |
\tag_resume:n {keyanspic} |
| 14176 |
\tag_tool:n {para/tagging=false} % no socket for this now |
| 14177 |
\tag_suspend:n {keyanspic} |
| 14178 |
} |
| 14179 |
} |
| 14180 |
% \end{macrocode} |
| 14181 |
% In the second part of the environment definition we will manually place |
| 14182 |
% our code for \emph{tagged} \texttt{PDF} and execute the command |
| 14183 |
% |\anspic| using the \cs{@@_anspic_exec:} function. |
| 14184 |
% \begin{macrocode} |
| 14185 |
{ |
| 14186 |
\IfDocumentMetadataT |
| 14187 |
{ |
| 14188 |
\tag_resume:n {keyanspic} |
| 14189 |
} |
| 14190 |
\@@_anspic_exec: |
| 14191 |
\IfDocumentMetadataT |
| 14192 |
{ |
| 14193 |
\tag_suspend:n {keyanspic} |
| 14194 |
} |
| 14195 |
\end{list} |
| 14196 |
\IfDocumentMetadataT |
| 14197 |
{ |
| 14198 |
\tag_struct_end:n {tag=L} |
| 14199 |
} |
| 14200 |
% \end{macrocode} |
| 14201 |
% Finally we check if \ics*{anspic*} has been used, set the counter |enumXvi| |
| 14202 |
% to zero and apply our \enquote{adjusted} vertical space bottom. |
| 14203 |
% \begin{macrocode} |
| 14204 |
\@@_check_starred_cmd:n { anspic } |
| 14205 |
\setcounter { enumXvi } { 0 } |
| 14206 |
\bool_if:NTF \l_@@_anspic_label_above_bool |
| 14207 |
{ |
| 14208 |
\par\addvspace{ 0.5\box_dp:N \strutbox } |
| 14209 |
} |
| 14210 |
{ |
| 14211 |
\par |
| 14212 |
\addvspace |
| 14213 |
{ |
| 14214 |
\dim_eval:n |
| 14215 |
{ |
| 14216 |
\l_@@_anspic_label_htdp_dim + \box_ht_plus_dp:N \strutbox |
| 14217 |
+ \l_@@_anspic_label_sep_skip + \l_@@_topsep_v_skip |
| 14218 |
} |
| 14219 |
} |
| 14220 |
} |
| 14221 |
} |
| 14222 |
% \end{macrocode} |
| 14223 |
% \end{macro} |
| 14224 |
% |
| 14225 |
% \subsubsection{The command \cs{anspic}}\label{cmd:anspic} |
| 14226 |
% The \ics*{anspic} command take three arguments, the \emph{starred versions} \ics*{anspic*}\myoarg{content} |
| 14227 |
% \emph{store} the current \mymeta{label} next to the \emph{optional argument} |
| 14228 |
% \myoarg{content} in the \emph{sequence} and \emph{prop list} |
| 14229 |
% defined by \mykey{save-ans} key. The third \emph{mandatory argument} |
| 14230 |
% \mymarg{drawing or tabular} is NOT \emph{stored} in the \emph{sequence} or |
| 14231 |
% \emph{prop list}. |
| 14232 |
% |
| 14233 |
% \begin{important} |
| 14234 |
% One of the complications here to make the \myenv*{keyanspic} |
| 14235 |
% environment compatible with \emph{tagged} PDF is the position of |
| 14236 |
% \mymeta{label}, the \ics*{anspic} command processes the arguments in |
| 14237 |
% order, where |#1| and |#2| correspond to \mymeta{label} and |#3| to the |
| 14238 |
% mandatory argument and puts all this inside a \myenv{minipage} |
| 14239 |
% environment. If |#1| and |#2|, that is \mymeta{label}, is above |#3| |
| 14240 |
% there are no problems with \emph{tagged} PDF, but if |#3| comes first |
| 14241 |
% the list created with \emph{tagged} PDF will not be correct. |
| 14242 |
% \end{important} |
| 14243 |
% |
| 14244 |
% \begin{macro}{\anspic, \@@_anspic_body_dim:n, \@@_anspic_label:nn, |
| 14245 |
% \@@_anspic_label_pos:nnn, \@@_anspic_args:nnn, |
| 14246 |
% \@@_anspic_print:n, \@@_anspic_print:e, \@@_anspic_print:V, |
| 14247 |
% \@@_anspic_row:n, \@@_anspic_exec:,} |
| 14248 |
% We check that the command is active in the \myenv*{keyanspic} |
| 14249 |
% environment only if the \mykey{save-ans} key is present, otherwise |
| 14250 |
% we return an error. |
| 14251 |
% The three arguments are handled by the function \cs{@@_anspic_args:nnn} |
| 14252 |
% and stored in the sequence \cs{l_@@_anspic_args_seq} which is processed |
| 14253 |
% by the \myenv*{keyanspic} environment. |
| 14254 |
% \iffalse |
| 14255 |
%% Define |\anspic| for |keyanspic| environment. |
| 14256 |
% \fi |
| 14257 |
% \begin{macrocode} |
| 14258 |
\NewDocumentCommand \anspic { s o +m } |
| 14259 |
{ |
| 14260 |
\bool_if:NF \l_@@_store_active_bool |
| 14261 |
{ |
| 14262 |
\msg_error:nnnn { enumext } { wrong-place }{ keyanspic }{ save-ans } |
| 14263 |
} |
| 14264 |
\int_compare:nNnT { \l_@@_level_int } > { 1 } |
| 14265 |
{ |
| 14266 |
\msg_error:nn { enumext } { keyanspic-wrong-level } |
| 14267 |
} |
| 14268 |
\int_compare:nNnT { \l_@@_keyans_level_int } = { 1 } |
| 14269 |
{ |
| 14270 |
\msg_error:nnnn { enumext } { command-wrong-place }{ anspic }{ keyans } |
| 14271 |
} |
| 14272 |
\seq_put_right:Nn \l_@@_anspic_args_seq |
| 14273 |
{ |
| 14274 |
\@@_anspic_args:nnn { #1 } { #2 } { #3 } |
| 14275 |
} |
| 14276 |
} |
| 14277 |
% \end{macrocode} |
| 14278 |
% The \cs{@@_anspic_body_dim:n} function will set the value of |
| 14279 |
% \cs{l_@@_anspic_body_htdp_dim} equal to the \enquote{height plus depth} |
| 14280 |
% of the \emph{mandatory argument} if the key \mykey{label-pos} is set |
| 14281 |
% \enquote{below}. |
| 14282 |
% \iffalse |
| 14283 |
%% Set the height plus depth off body arg in dim var for |\anspic|. |
| 14284 |
% \fi |
| 14285 |
% \begin{macrocode} |
| 14286 |
\cs_new_protected:Npn \@@_anspic_body_dim:n #1 |
| 14287 |
{ |
| 14288 |
\bool_if:NF \l_@@_anspic_label_above_bool |
| 14289 |
{ |
| 14290 |
\IfDocumentMetadataT |
| 14291 |
{ |
| 14292 |
\tag_suspend:n {keyanspic} |
| 14293 |
} |
| 14294 |
\vbox_set:Nn \l_@@_anspic_body_box { #1 } |
| 14295 |
\dim_set:Nn \l_@@_anspic_body_htdp_dim |
| 14296 |
{ |
| 14297 |
\box_ht_plus_dp:N \l_@@_anspic_body_box |
| 14298 |
} |
| 14299 |
\IfDocumentMetadataT |
| 14300 |
{ |
| 14301 |
\tag_resume:n {keyanspic} |
| 14302 |
} |
| 14303 |
} |
| 14304 |
} |
| 14305 |
% \end{macrocode} |
| 14306 |
% The \cs{@@_anspic_label:nn} function will process inside |\makebox| the |
| 14307 |
% \emph{starred argument} ‘|*|’ and \emph{optional argument} passed |
| 14308 |
% to the command. Here we will store the \mymeta{label} and |
| 14309 |
% \emph{optional argument} in \emph{prop list} and \emph{sequence} |
| 14310 |
% and execute the \mykey{show-ans}, \mykey{show-pos}, \mykey{font}, |
| 14311 |
% \mykey{wrap-label}, \mykey{wrap-ans*} and \mykey{wrap-opt} keys. |
| 14312 |
% \iffalse |
| 14313 |
%% Process and store label and [opt] for |\anspic|. |
| 14314 |
% \fi |
| 14315 |
% \begin{macrocode} |
| 14316 |
\cs_new_protected:Npn \@@_anspic_label:nn #1 #2 |
| 14317 |
{ |
| 14318 |
\makebox[ \l_@@_anspic_mini_width_dim ][ c ] |
| 14319 |
{ |
| 14320 |
\bool_if:nTF { #1 } |
| 14321 |
{ |
| 14322 |
\bool_set_true:N \l_@@_item_wrap_key_bool |
| 14323 |
\bool_set_true:N \l_@@_wrap_label_v_bool |
| 14324 |
\@@_keyans_save_item_opt:n { #2 } |
| 14325 |
\@@_keyans_addto_prop:n { #2 } |
| 14326 |
\@@_keyans_store_ref: |
| 14327 |
\@@_keyans_addto_seq:n { #2 } |
| 14328 |
\int_gincr:N \g_@@_check_starred_cmd_int |
| 14329 |
\@@_keyans_show_ans: |
| 14330 |
\@@_keyans_show_pos: |
| 14331 |
\makebox[ \l_@@_labelwidth_v_dim ][c] |
| 14332 |
{ |
| 14333 |
\tl_use:N \l_@@_label_font_style_v_tl |
| 14334 |
\@@_keyans_wrapper_label:n { \l_@@_label_vi_tl } |
| 14335 |
} |
| 14336 |
\skip_horizontal:n { \l_@@_labelsep_v_dim } |
| 14337 |
\@@_keyans_show_item_opt: |
| 14338 |
} |
| 14339 |
{ |
| 14340 |
\bool_set_false:N \l_@@_item_wrap_key_bool |
| 14341 |
\tl_use:N \l_@@_label_font_style_v_tl |
| 14342 |
\@@_wrapper_label_v:n { \l_@@_label_vi_tl } |
| 14343 |
} |
| 14344 |
} |
| 14345 |
} |
| 14346 |
% \end{macrocode} |
| 14347 |
% The function \cs{@@_anspic_label_pos:nnn} will be in charge of |
| 14348 |
% handling the \emph{\enquote{counter}} and the position of the \mymeta{label}, |
| 14349 |
% set by \mykey{label-pos} key which will have the same configuration |
| 14350 |
% as the \myenv*{keyans} environment. |
| 14351 |
% \iffalse |
| 14352 |
%% Set position of labels for |\anspic|. |
| 14353 |
% \fi |
| 14354 |
% \begin{macrocode} |
| 14355 |
\cs_new_protected:Npn \@@_anspic_label_pos:nnn #1 #2 #3 |
| 14356 |
{ |
| 14357 |
\stepcounter { enumXvi } |
| 14358 |
\@@_anspic_body_dim:n { #3 } |
| 14359 |
\bool_if:NTF \l_@@_anspic_label_above_bool |
| 14360 |
{ |
| 14361 |
\@@_anspic_label:nn { #1 } { #2 } |
| 14362 |
} |
| 14363 |
{ |
| 14364 |
\raisebox |
| 14365 |
{ |
| 14366 |
-\dim_eval:n |
| 14367 |
{ |
| 14368 |
\l_@@_anspic_label_htdp_dim |
| 14369 |
+ \l_@@_anspic_body_htdp_dim |
| 14370 |
+ \box_dp:N \strutbox |
| 14371 |
+ \l_@@_anspic_label_sep_skip |
| 14372 |
} |
| 14373 |
} |
| 14374 |
[ 0pt ] [ 0pt ] |
| 14375 |
{ |
| 14376 |
\@@_anspic_label:nn { #1 } { #2 } |
| 14377 |
} |
| 14378 |
} |
| 14379 |
} |
| 14380 |
% |
| 14381 |
% \end{macrocode} |
| 14382 |
% The \cs{@@_anspic_args:nnn} function will be responsible for placing |
| 14383 |
% the code compatible with \emph{tagged} \texttt{PDF} and the arguments |
| 14384 |
% within the \cs{l_@@_anspic_args_seq} sequence which will be processed |
| 14385 |
% by the \cs{@@_anspic_print:n} function in the second part of the |
| 14386 |
% definition of the \myenv*{keyanspic} environment. |
| 14387 |
% \iffalse |
| 14388 |
%% Process all code for |\anspic| with tagging PDF support. |
| 14389 |
% \fi |
| 14390 |
% \begin{macrocode} |
| 14391 |
\cs_new_protected:Nn \@@_anspic_args:nnn |
| 14392 |
{ |
| 14393 |
\@@_anspic_start_list_tag: |
| 14394 |
\@@_anspic_label_pos:nnn { #1 } { #2 } { #3 } |
| 14395 |
\@@_anspic_stop_start_list_tag: |
| 14396 |
\bool_if:NTF \l_@@_anspic_label_above_bool |
| 14397 |
{ |
| 14398 |
\\[\l_@@_anspic_label_sep_skip] #3 |
| 14399 |
} |
| 14400 |
{ |
| 14401 |
\\ #3 |
| 14402 |
} |
| 14403 |
\@@_anspic_stop_list_tag: |
| 14404 |
} |
| 14405 |
% \end{macrocode} |
| 14406 |
% The value \mymarg{n° upper, n° lower} passed to the \mykey{layout-sty} |
| 14407 |
% key is split by comma and is handled directly by the function |
| 14408 |
% \cs{@@_anspic_print:n} and passed to the function \cs{@@_anspic_row:n}. |
| 14409 |
% \begin{macrocode} |
| 14410 |
\cs_new_protected:Nn \@@_anspic_print:n |
| 14411 |
{ |
| 14412 |
\clist_map_function:nN { #1 } \@@_anspic_row:n |
| 14413 |
} |
| 14414 |
\cs_generate_variant:Nn \@@_anspic_print:n { e, V } |
| 14415 |
% \end{macrocode} |
| 14416 |
% The function \cs{@@_anspic_row:n} will set the \emph{widths} for the |
| 14417 |
% \myenv{minipage} environments and place \emph{all arguments} passed |
| 14418 |
% to |\anspic| \emph{saved} in the \cs{l_@@_anspic_args_seq} sequence |
| 14419 |
% inside them. |
| 14420 |
% \begin{macrocode} |
| 14421 |
\cs_new_protected:Nn \@@_anspic_row:n |
| 14422 |
{ |
| 14423 |
\dim_set:Nn \l_@@_anspic_mini_width_dim { \linewidth / #1 } |
| 14424 |
\int_set:Nn \l_@@_anspic_above_int { \l_@@_anspic_below_int } |
| 14425 |
\int_set:Nn \l_@@_anspic_below_int { \l_@@_anspic_above_int + #1 } |
| 14426 |
\int_step_inline:nnn |
| 14427 |
{ \l_@@_anspic_above_int + 1 } |
| 14428 |
{ \l_@@_anspic_below_int } |
| 14429 |
{ |
| 14430 |
\IfDocumentMetadataT |
| 14431 |
{ |
| 14432 |
\tag_suspend:n {minipage} |
| 14433 |
} |
| 14434 |
\begin{minipage}[ \l_@@_anspic_mini_pos_str ]{ \l_@@_anspic_mini_width_dim } |
| 14435 |
\centering |
| 14436 |
\seq_item:Nn \l_@@_anspic_args_seq { ##1 } |
| 14437 |
\end{minipage} |
| 14438 |
\IfDocumentMetadataT |
| 14439 |
{ |
| 14440 |
\tag_resume:n {minipage} |
| 14441 |
} |
| 14442 |
} |
| 14443 |
\par |
| 14444 |
} |
| 14445 |
% \end{macrocode} |
| 14446 |
% The \cs{@@_anspic_exec:} function will execute all the code in the |
| 14447 |
% |\anspic| command in the second argument of the |keyanspic| environment |
| 14448 |
% definition. If the key \mykey{layout-sty} is not set, everything will |
| 14449 |
% be printed on a \emph{single line}. |
| 14450 |
% \begin{macrocode} |
| 14451 |
\cs_new_protected:Nn \@@_anspic_exec: |
| 14452 |
{ |
| 14453 |
\tl_if_empty:NTF \l_@@_anspic_layout_style_tl |
| 14454 |
{ |
| 14455 |
\@@_anspic_print:e { \seq_count:N \l_@@_anspic_args_seq } |
| 14456 |
} |
| 14457 |
{ |
| 14458 |
\@@_anspic_print:V \l_@@_anspic_layout_style_tl |
| 14459 |
} |
| 14460 |
} |
| 14461 |
% \end{macrocode} |
| 14462 |
% \end{macro} |
| 14463 |
% |
| 14464 |
% \subsection{The horizontal environments}\label{env:horizontal} |
| 14465 |
% |
| 14466 |
% Generating \emph{horizontal list environments} is NOT as simple as standard |
| 14467 |
% \hologo{LaTeX} list environments. The fundamental part of the code is adapted |
| 14468 |
% from the \mypkg{shortlst} package to a more modern version using \mypkg{expl3}. |
| 14469 |
% It is not possible to redefine |\item| and \ics{makelabel} using |\RenewDocumentCommand| as in |
| 14470 |
% the vertical \emph{non starred} versions. |
| 14471 |
% |
| 14472 |
% \smallskip |
| 14473 |
% |
| 14474 |
% To achieve the \emph{horizontal list environments} we will capture the |\item| |
| 14475 |
% command and the \mymeta{content} of this in \emph{horizontal box} using \ics{makebox} for |
| 14476 |
% the \mykey{label} and a \myenv{minipage} environment for the \mymeta{content} passed to |
| 14477 |
% |\item|, we will also add the \emph{optional argument} \myparg{number} to |\item| |
| 14478 |
% to be able to \emph{join columns} horizontally, in simple terms, we want |
| 14479 |
% |\item| to behave in the same way as in the \myenv*{enumext} environment but |
| 14480 |
% adding an \emph{first optional argument} \myparg{number}. |
| 14481 |
% |
| 14482 |
% \smallskip |
| 14483 |
% |
| 14484 |
% A side effect is the limitation of using |\item| in this way \emph{without} |
| 14485 |
% using |\RenewDocumentCommand|, which loses the original definition and |
| 14486 |
% affects the \emph{standard list environments} provided by \hologo{LaTeX} |
| 14487 |
% and any environment defined using base \myenv{list} environment, including: |
| 14488 |
% \myenv{itemize}, \myenv{enumerate}, \myenv{description}, \myenv{quote}, |
| 14489 |
% \myenv{quotation}, \myenv{verse}, \myenv{center}, \myenv{flushleft}, |
| 14490 |
% \myenv{flushright}, \myenv{verbatim}, \myenv{tabbing}, \myenv{trivlist}, |
| 14491 |
% \myenv{list} and all environments created with |\newtheorem|. |
| 14492 |
% |
| 14493 |
% \smallskip |
| 14494 |
% |
| 14495 |
% \begin{important}* |
| 14496 |
% One way to get around this is to use something like: |
| 14497 |
% |
| 14498 |
% \begin{Verbatim} |
| 14499 |
% \AddToHook{env/enumerate/before}{recover original \item definition} |
| 14500 |
% \end{Verbatim} |
| 14501 |
% |
| 14502 |
% inside \myenv{minipage}, but in my partial tests this does not have the |
| 14503 |
% desired effect and the vertical and horizontal spacing is distorted. |
| 14504 |
% For now this will remain as a limitation and I will see if it is |
| 14505 |
% feasible to implement it in the future. |
| 14506 |
% \end{important} |
| 14507 |
% |
| 14508 |
% \smallskip |
| 14509 |
% |
| 14510 |
% \begin{important} |
| 14511 |
% For compatibility with the \emph{tagged} \texttt{PDF} we close |
| 14512 |
% the environments according to the presence or not of the \mykey{mini-env} key. |
| 14513 |
% \end{important} |
| 14514 |
% |
| 14515 |
% \subsubsection{Functions for item box width} |
| 14516 |
% |
| 14517 |
% \begin{macro}{\@@_starred_columns_set_vii:, \@@_starred_columns_set_viii:,} |
| 14518 |
% We set the default value for the \emph{width of the box} containing the |
| 14519 |
% \mymeta{content} of the items for \myenv*{enumext*} environment. |
| 14520 |
% \iffalse |
| 14521 |
%% Define default item width (columns width) for |enumext*| and |keyans*| environments. |
| 14522 |
% \fi |
| 14523 |
% \begin{macrocode} |
| 14524 |
\cs_new_protected:Nn \@@_starred_columns_set_vii: |
| 14525 |
{ |
| 14526 |
\dim_compare:nNnT { \l_@@_columns_sep_vii_dim } = { \c_zero_dim } |
| 14527 |
{ |
| 14528 |
\dim_set:Nn \l_@@_columns_sep_vii_dim |
| 14529 |
{ |
| 14530 |
( \l_@@_labelwidth_vii_dim + \l_@@_labelsep_vii_dim ) |
| 14531 |
/ \l_@@_columns_vii_int |
| 14532 |
} |
| 14533 |
} |
| 14534 |
\int_set:Nn \l_@@_tmpa_vii_int { \l_@@_columns_vii_int - 1 } |
| 14535 |
\dim_set:Nn \l_@@_item_width_vii_dim |
| 14536 |
{ |
| 14537 |
( \linewidth - \l_@@_columns_sep_vii_dim * \l_@@_tmpa_vii_int ) |
| 14538 |
/ \l_@@_columns_vii_int |
| 14539 |
- \l_@@_labelwidth_vii_dim |
| 14540 |
- \l_@@_labelsep_vii_dim |
| 14541 |
} |
| 14542 |
% \end{macrocode} |
| 14543 |
% When the key \mykey{rightmargin} is active we must adjust the values. |
| 14544 |
% \begin{macrocode} |
| 14545 |
\dim_compare:nNnT { \l_@@_rightmargin_vii_dim } > { \c_zero_dim } |
| 14546 |
{ |
| 14547 |
\dim_sub:Nn \l_@@_item_width_vii_dim |
| 14548 |
{ |
| 14549 |
( \l_@@_rightmargin_vii_dim * \l_@@_tmpa_vii_int ) |
| 14550 |
/ \l_@@_columns_vii_int |
| 14551 |
} |
| 14552 |
\dim_add:Nn \l_@@_columns_sep_vii_dim |
| 14553 |
{ |
| 14554 |
\l_@@_rightmargin_vii_dim |
| 14555 |
} |
| 14556 |
} |
| 14557 |
} |
| 14558 |
% \end{macrocode} |
| 14559 |
% Same implementation for the \myenv*{keyans*} environment. |
| 14560 |
% \begin{macrocode} |
| 14561 |
\cs_new_protected:Nn \@@_starred_columns_set_viii: |
| 14562 |
{ |
| 14563 |
\dim_compare:nNnT { \l_@@_columns_sep_viii_dim } = { \c_zero_dim } |
| 14564 |
{ |
| 14565 |
\dim_set:Nn \l_@@_columns_sep_viii_dim |
| 14566 |
{ |
| 14567 |
( \l_@@_labelwidth_viii_dim + \l_@@_labelsep_viii_dim ) |
| 14568 |
/ \l_@@_columns_viii_int |
| 14569 |
} |
| 14570 |
} |
| 14571 |
\int_set:Nn \l_@@_tmpa_viii_int { \l_@@_columns_viii_int - 1 } |
| 14572 |
\dim_set:Nn \l_@@_item_width_viii_dim |
| 14573 |
{ |
| 14574 |
( \linewidth - \l_@@_columns_sep_viii_dim * \l_@@_tmpa_viii_int ) |
| 14575 |
/ \l_@@_columns_viii_int |
| 14576 |
- \l_@@_labelwidth_viii_dim |
| 14577 |
- \l_@@_labelsep_viii_dim |
| 14578 |
} |
| 14579 |
\dim_compare:nNnT { \l_@@_rightmargin_viii_dim } > { \c_zero_dim } |
| 14580 |
{ |
| 14581 |
\dim_sub:Nn \l_@@_item_width_viii_dim |
| 14582 |
{ |
| 14583 |
( \l_@@_rightmargin_viii_dim * \l_@@_tmpa_vii_int ) |
| 14584 |
/ \l_@@_columns_viii_int |
| 14585 |
} |
| 14586 |
\dim_add:Nn \l_@@_columns_sep_viii_dim |
| 14587 |
{ |
| 14588 |
\l_@@_rightmargin_viii_dim |
| 14589 |
} |
| 14590 |
} |
| 14591 |
} |
| 14592 |
% \end{macrocode} |
| 14593 |
% \end{macro} |
| 14594 |
% |
| 14595 |
% \subsubsection{Functions for join item columns} |
| 14596 |
% |
| 14597 |
% \begin{macro}{\@@_starred_joined_item_vii:n, \@@_starred_joined_item_viii:n,} |
| 14598 |
% The functions \cs{@@_starred_joined_item_vii:n} and \cs{@@_starred_joined_item_viii:n} |
| 14599 |
% will set the \emph{width} of the box in which the \mymeta{content} |
| 14600 |
% passed to \ics*{item}\myparg{columns} will be stored together with |
| 14601 |
% the value of |\itemwidth| for the \myenv*{enumext*} environment. |
| 14602 |
% \iffalse |
| 14603 |
%% Set width for joined item's for |enumext*| and |keyans*| environments. |
| 14604 |
% \fi |
| 14605 |
% \begin{macrocode} |
| 14606 |
\cs_new_protected:Npn \@@_starred_joined_item_vii:n #1 |
| 14607 |
{ |
| 14608 |
\int_set:Nn \l_@@_joined_item_vii_int {#1} |
| 14609 |
\int_compare:nNnT { \l_@@_joined_item_vii_int } > { \l_@@_columns_vii_int } |
| 14610 |
{ |
| 14611 |
\msg_warning:nnee { enumext } { item-joined } |
| 14612 |
{ \int_use:N \l_@@_joined_item_vii_int } |
| 14613 |
{ \int_use:N \l_@@_columns_vii_int } |
| 14614 |
\int_set:Nn \l_@@_joined_item_vii_int |
| 14615 |
{ |
| 14616 |
\l_@@_columns_vii_int - \l_@@_item_column_pos_vii_int + 1 |
| 14617 |
} |
| 14618 |
} |
| 14619 |
\int_compare:nNnT |
| 14620 |
{ \l_@@_joined_item_vii_int } |
| 14621 |
> |
| 14622 |
{ \l_@@_columns_vii_int - \l_@@_item_column_pos_vii_int + 1 } |
| 14623 |
{ |
| 14624 |
\msg_warning:nnee { enumext } { item-joined-columns } |
| 14625 |
{ \int_use:N \l_@@_joined_item_vii_int } |
| 14626 |
{ |
| 14627 |
\int_eval:n |
| 14628 |
{ \l_@@_columns_vii_int - \l_@@_item_column_pos_vii_int + 1 } |
| 14629 |
} |
| 14630 |
\int_set:Nn \l_@@_joined_item_vii_int |
| 14631 |
{ |
| 14632 |
\l_@@_columns_vii_int - \l_@@_item_column_pos_vii_int + 1 |
| 14633 |
} |
| 14634 |
} |
| 14635 |
\int_compare:nNnTF { \l_@@_joined_item_vii_int } > { 1 } |
| 14636 |
{ |
| 14637 |
\int_set_eq:NN \l_@@_joined_item_aux_vii_int \l_@@_joined_item_vii_int |
| 14638 |
\int_decr:N \l_@@_joined_item_aux_vii_int |
| 14639 |
\int_add:Nn \l_@@_item_column_pos_vii_int { \l_@@_joined_item_aux_vii_int } |
| 14640 |
\int_gadd:Nn \g_@@_item_count_all_vii_int { \l_@@_joined_item_aux_vii_int } |
| 14641 |
\dim_set:Nn \l_@@_joined_width_vii_dim |
| 14642 |
{ |
| 14643 |
\l_@@_item_width_vii_dim * \l_@@_joined_item_vii_int |
| 14644 |
+ ( \l_@@_labelwidth_vii_dim + \l_@@_labelsep_vii_dim |
| 14645 |
+ \l_@@_columns_sep_vii_dim |
| 14646 |
)*\l_@@_joined_item_aux_vii_int |
| 14647 |
} |
| 14648 |
\dim_set_eq:NN \itemwidth \l_@@_joined_width_vii_dim |
| 14649 |
} |
| 14650 |
{ |
| 14651 |
\dim_set_eq:NN \l_@@_joined_width_vii_dim \l_@@_item_width_vii_dim |
| 14652 |
\dim_set_eq:NN \itemwidth \l_@@_item_width_vii_dim |
| 14653 |
} |
| 14654 |
} |
| 14655 |
% \end{macrocode} |
| 14656 |
% Same implementation for the \myenv*{keyans*} environment. |
| 14657 |
% \begin{macrocode} |
| 14658 |
\cs_new_protected:Npn \@@_starred_joined_item_viii:n #1 |
| 14659 |
{ |
| 14660 |
\int_set:Nn \l_@@_joined_item_viii_int {#1} |
| 14661 |
\int_compare:nNnT { \l_@@_joined_item_viii_int } > { \l_@@_columns_viii_int } |
| 14662 |
{ |
| 14663 |
\msg_warning:nnee { enumext } { item-joined } |
| 14664 |
{ \int_use:N \l_@@_joined_item_viii_int } |
| 14665 |
{ \int_use:N \l_@@_columns_viii_int } |
| 14666 |
\int_set:Nn \l_@@_joined_item_viii_int |
| 14667 |
{ |
| 14668 |
\l_@@_columns_viii_int - \l_@@_item_column_pos_viii_int + 1 |
| 14669 |
} |
| 14670 |
} |
| 14671 |
\int_compare:nNnT |
| 14672 |
{ \l_@@_joined_item_viii_int } |
| 14673 |
> |
| 14674 |
{ \l_@@_columns_viii_int - \l_@@_item_column_pos_viii_int + 1 } |
| 14675 |
{ |
| 14676 |
\msg_warning:nnee { enumext } { item-joined-columns } |
| 14677 |
{ \int_use:N \l_@@_joined_item_viii_int } |
| 14678 |
{ |
| 14679 |
\int_eval:n |
| 14680 |
{ \l_@@_columns_viii_int - \l_@@_item_column_pos_viii_int + 1 } |
| 14681 |
} |
| 14682 |
\int_set:Nn \l_@@_joined_item_viii_int |
| 14683 |
{ |
| 14684 |
\l_@@_columns_viii_int - \l_@@_item_column_pos_viii_int + 1 |
| 14685 |
} |
| 14686 |
} |
| 14687 |
\int_compare:nNnTF { \l_@@_joined_item_viii_int } > { 1 } |
| 14688 |
{ |
| 14689 |
\int_set_eq:NN \l_@@_joined_item_aux_viii_int \l_@@_joined_item_viii_int |
| 14690 |
\int_decr:N \l_@@_joined_item_aux_viii_int |
| 14691 |
\int_add:Nn \l_@@_item_column_pos_viii_int { \l_@@_joined_item_aux_viii_int } |
| 14692 |
\int_gadd:Nn \g_@@_item_count_all_viii_int { \l_@@_joined_item_aux_viii_int } |
| 14693 |
\dim_set:Nn \l_@@_joined_width_viii_dim |
| 14694 |
{ |
| 14695 |
\l_@@_item_width_viii_dim * \l_@@_joined_item_viii_int |
| 14696 |
+ ( \l_@@_labelwidth_viii_dim + \l_@@_labelsep_viii_dim |
| 14697 |
+ \l_@@_columns_sep_viii_dim |
| 14698 |
)*\l_@@_joined_item_aux_viii_int |
| 14699 |
} |
| 14700 |
\dim_set_eq:NN \itemwidth \l_@@_joined_width_viii_dim |
| 14701 |
} |
| 14702 |
{ |
| 14703 |
\dim_set_eq:NN \l_@@_joined_width_viii_dim \l_@@_item_width_viii_dim |
| 14704 |
\dim_set_eq:NN \itemwidth \l_@@_item_width_viii_dim |
| 14705 |
} |
| 14706 |
} |
| 14707 |
% \end{macrocode} |
| 14708 |
% \end{macro} |
| 14709 |
% |
| 14710 |
% \subsubsection{Functions for \texttt{mini-env}, \texttt{mini-right} and \texttt{mini-right*} keys}\label{env:starred:key:mini-env} |
| 14711 |
% |
| 14712 |
% \begin{macro}{\@@_start_mini_vii:, \@@_stop_mini_vii:} |
| 14713 |
% The implementation of the \mykey{mini-env} key support is almost |
| 14714 |
% identical to the one used in the \myenv*{enumext} and \myenv*{keyans} |
| 14715 |
% environments, the difference is that the \myvarenv*{__@@_mini_page} |
| 14716 |
% environment on the \emph{\enquote{right side}} is executed |
| 14717 |
% \emph{\enquote{after}} closing the environment, so it is necessary to |
| 14718 |
% make a global copy of the variable \cs{l_@@_minipage_right_vii_dim} in |
| 14719 |
% the variable \cs{g_@@_minipage_right_vii_dim}.% |
| 14720 |
% \iffalse |
| 14721 |
%% Start support for |mini-env| key in |enumext*| environment. |
| 14722 |
% \fi |
| 14723 |
% \begin{macrocode} |
| 14724 |
\cs_new_protected:Nn \@@_start_mini_vii: |
| 14725 |
{ |
| 14726 |
\dim_compare:nNnT { \l_@@_minipage_right_vii_dim } > { \c_zero_dim } |
| 14727 |
{ |
| 14728 |
\dim_set:Nn \l_@@_minipage_left_vii_dim |
| 14729 |
{ |
| 14730 |
\linewidth |
| 14731 |
- \l_@@_minipage_right_vii_dim |
| 14732 |
- \l_@@_minipage_hsep_vii_dim |
| 14733 |
} |
| 14734 |
\bool_set_true:N \l_@@_minipage_active_vii_bool |
| 14735 |
\dim_gset_eq:NN |
| 14736 |
\g_@@_minipage_right_vii_dim |
| 14737 |
\l_@@_minipage_right_vii_dim |
| 14738 |
\@@_mini_addvspace_vii: |
| 14739 |
\nointerlineskip\noindent |
| 14740 |
\@@_mini_page{ \l_@@_minipage_left_vii_dim } |
| 14741 |
} |
| 14742 |
} |
| 14743 |
% \end{macrocode} |
| 14744 |
% The function \cs{@@_stop_mini_vii:} closes the \myvarenv*{__@@_mini_page} |
| 14745 |
% environment on the \emph{\enquote{left side}}, applies |\hfill| and |
| 14746 |
% set the variable \cs{g_@@_minipage_active_vii_bool} to \emph{\enquote{true}} |
| 14747 |
% which will be used in the function \cs{@@_after_env:nn} to execute |
| 14748 |
% the \myenv{minipage} on the \emph{\enquote{right side}}. At this point |
| 14749 |
% we will execute the \cs{@@_stop_list:} and \cs{@@_stop_store_level_vii:} |
| 14750 |
% functions stopping the \myenv{list} environment and the level saving |
| 14751 |
% mechanism for storage in \emph{sequence} of the |\anskey| command |
| 14752 |
% and |anskey*| environment. This function is passed to the |
| 14753 |
% \cs{@@_after_list_vii:} function in the second part of the \myenv*{enumext*} |
| 14754 |
% environment definition (\S\ref{env:starred}). |
| 14755 |
% \iffalse |
| 14756 |
%% Stop support for |mini-env| key and stop |list| in |enumext*| environment. |
| 14757 |
% \fi |
| 14758 |
% \begin{macrocode} |
| 14759 |
\cs_new_protected:Nn \@@_stop_mini_vii: |
| 14760 |
{ |
| 14761 |
\bool_if:NTF \l_@@_minipage_active_vii_bool |
| 14762 |
{ |
| 14763 |
\@@_stop_list: |
| 14764 |
\@@_stop_store_level_vii: |
| 14765 |
\IfDocumentMetadataT { \tag_resume:n {enumext*} } |
| 14766 |
\end@@_mini_page |
| 14767 |
\hfill |
| 14768 |
\bool_gset_true:N \g_@@_minipage_active_vii_bool |
| 14769 |
} |
| 14770 |
{ |
| 14771 |
\@@_stop_list: |
| 14772 |
\@@_stop_store_level_vii: |
| 14773 |
} |
| 14774 |
} |
| 14775 |
% \end{macrocode} |
| 14776 |
% \end{macro} |
| 14777 |
% |
| 14778 |
% Finally we execute the \mymarg{code} passed to the \mykey{mini-right} |
| 14779 |
% or \mykey{mini-right*} keys stored in the variable \cs{g_@@_miniright_code_vii_tl} |
| 14780 |
% in the \myenv{minipage} environment on the \emph{\enquote{right |
| 14781 |
% side}}. For compatibility with the \mypkg{caption} package and possibly |
| 14782 |
% other \mymarg{code} passed to this key, we will pass it to a box and |
| 14783 |
% then print it. |
| 14784 |
% \iffalse |
| 14785 |
%% Exec |mini-right|, |mini-right*| keys in |enumext*| environment. |
| 14786 |
% \fi |
| 14787 |
% \begin{macrocode} |
| 14788 |
\@@_after_env:nn {enumext*} |
| 14789 |
{ |
| 14790 |
\bool_if:NT \g_@@_minipage_active_vii_bool |
| 14791 |
{ |
| 14792 |
\@@_minipage:w [ t ] { \g_@@_minipage_right_vii_dim } |
| 14793 |
\legacy_if_gset_false:n { @minipage } |
| 14794 |
\skip_vertical:N \c_zero_skip |
| 14795 |
\par\addvspace { \g_@@_minipage_right_skip } |
| 14796 |
\bool_if:NF \g_@@_minipage_center_vii_bool |
| 14797 |
{ |
| 14798 |
\tl_put_left:Nn \g_@@_miniright_code_vii_tl |
| 14799 |
{ |
| 14800 |
\centering |
| 14801 |
} |
| 14802 |
} |
| 14803 |
\vbox_set_top:Nn \l_@@_miniright_code_vii_box |
| 14804 |
{ |
| 14805 |
\tl_use:N \g_@@_miniright_code_vii_tl |
| 14806 |
} |
| 14807 |
\box_use_drop:N \l_@@_miniright_code_vii_box |
| 14808 |
\skip_vertical:N \c_zero_skip |
| 14809 |
\@@_endminipage: |
| 14810 |
\par\addvspace{ \g_@@_minipage_after_skip } |
| 14811 |
} |
| 14812 |
\bool_gset_false:N \g_@@_minipage_active_vii_bool |
| 14813 |
\bool_gset_true:N \g_@@_minipage_center_vii_bool |
| 14814 |
\tl_gclear:N \g_@@_miniright_code_vii_tl |
| 14815 |
\dim_gzero:N \g_@@_minipage_right_vii_dim |
| 14816 |
\bool_gset_false:N \g_@@_starred_bool |
| 14817 |
} |
| 14818 |
% \end{macrocode} |
| 14819 |
% |
| 14820 |
% \begin{macro}{\@@_start_mini_viii:,\@@_stop_mini_viii:} |
| 14821 |
% The implementation of the \mykey{mini-env}, \mykey{mini-right} and |
| 14822 |
% \mykey{mini-right*} keys is identical to the one used in the |
| 14823 |
% \myenv*{enumext*} environment. |
| 14824 |
% \iffalse |
| 14825 |
%% Support for |mini-env|, |mini-right| and |mini-right*| key in |keyans*| environment. |
| 14826 |
% \fi |
| 14827 |
% \begin{macrocode} |
| 14828 |
\cs_new_protected:Nn \@@_start_mini_viii: |
| 14829 |
{ |
| 14830 |
\dim_compare:nNnT { \l_@@_minipage_right_viii_dim } > { \c_zero_dim } |
| 14831 |
{ |
| 14832 |
\dim_set:Nn \l_@@_minipage_left_viii_dim |
| 14833 |
{ |
| 14834 |
\linewidth |
| 14835 |
- \l_@@_minipage_right_viii_dim |
| 14836 |
- \l_@@_minipage_hsep_viii_dim |
| 14837 |
} |
| 14838 |
\bool_set_true:N \l_@@_minipage_active_viii_bool |
| 14839 |
\dim_gset_eq:NN |
| 14840 |
\g_@@_minipage_right_viii_dim |
| 14841 |
\l_@@_minipage_right_viii_dim |
| 14842 |
\@@_mini_addvspace_viii: |
| 14843 |
\nointerlineskip\noindent |
| 14844 |
\@@_mini_page{ \l_@@_minipage_left_viii_dim } |
| 14845 |
} |
| 14846 |
} |
| 14847 |
\cs_new_protected:Nn \@@_stop_mini_viii: |
| 14848 |
{ |
| 14849 |
\bool_if:NTF \l_@@_minipage_active_viii_bool |
| 14850 |
{ |
| 14851 |
\@@_stop_list: |
| 14852 |
\IfDocumentMetadataT { \tag_resume:n {keyans*} } |
| 14853 |
\end@@_mini_page |
| 14854 |
\hfill |
| 14855 |
\bool_gset_true:N \g_@@_minipage_active_viii_bool |
| 14856 |
} |
| 14857 |
{ |
| 14858 |
\@@_stop_list: |
| 14859 |
} |
| 14860 |
} |
| 14861 |
\@@_after_env:nn {keyans*} |
| 14862 |
{ |
| 14863 |
\bool_if:NT \g_@@_minipage_active_viii_bool |
| 14864 |
{ |
| 14865 |
\@@_mini_page{ \g_@@_minipage_right_viii_dim } |
| 14866 |
\par\addvspace { \g_@@_minipage_right_skip } |
| 14867 |
\bool_if:NF \g_@@_minipage_center_viii_bool |
| 14868 |
{ |
| 14869 |
\tl_put_left:Nn \g_@@_miniright_code_viii_tl |
| 14870 |
{ |
| 14871 |
\centering |
| 14872 |
} |
| 14873 |
} |
| 14874 |
\vbox_set_top:Nn \l_@@_miniright_code_viii_box |
| 14875 |
{ |
| 14876 |
\tl_use:N \g_@@_miniright_code_viii_tl |
| 14877 |
} |
| 14878 |
\box_use_drop:N \l_@@_miniright_code_viii_box |
| 14879 |
\end@@_mini_page |
| 14880 |
\par\addvspace{ \g_@@_minipage_after_skip } |
| 14881 |
} |
| 14882 |
\bool_gset_false:N \g_@@_minipage_active_viii_bool |
| 14883 |
\bool_gset_true:N \g_@@_minipage_center_viii_bool |
| 14884 |
\tl_gclear:N \g_@@_miniright_code_viii_tl |
| 14885 |
\dim_gzero:N \g_@@_minipage_right_viii_dim |
| 14886 |
} |
| 14887 |
% \end{macrocode} |
| 14888 |
% \end{macro} |
| 14889 |
% |
| 14890 |
% \subsection{The environment \env{enumext*}}\label{env:starred} |
| 14891 |
% |
| 14892 |
% \begin{macro}{enumext*} |
| 14893 |
% First we will generate the environment and we will give a |
| 14894 |
% temporary definition to \cs{@@_stop_item_tmp_vii:} equal to |
| 14895 |
% \cs{@@_first_item_tmp_vii:} and next to |\item| equal to \cs{@@_start_item_tmp_vii:} |
| 14896 |
% which we will redefine later. Unlike the implementation used by |
| 14897 |
% the \mypkg{shortlst} package, we will not set the values of |
| 14898 |
% |\rightskip| and |\@rightskip| equal to |\@flushglue| whose value is |
| 14899 |
% \mydim{0.0pt plus 1.0 fil}, in the tests I have performed this fails in |
| 14900 |
% some circumstances and different results are obtained when using |
| 14901 |
% \hologo{pdfTeX} and \hologo{LuaTeX}. |
| 14902 |
% \iffalse |
| 14903 |
%% Define |enumext*| |
| 14904 |
% \fi |
| 14905 |
% \begin{macrocode} |
| 14906 |
\NewDocumentEnvironment{enumext*}{ o } |
| 14907 |
{ |
| 14908 |
\@@_safe_exec_vii: |
| 14909 |
\@@_parse_keys_vii:n {#1} |
| 14910 |
\@@_before_list_vii: |
| 14911 |
\@@_start_store_level_vii: |
| 14912 |
\@@_start_list:nn { } |
| 14913 |
{ |
| 14914 |
\@@_list_arg_two_vii: |
| 14915 |
\@@_before_keys_exec_vii: |
| 14916 |
} |
| 14917 |
\IfDocumentMetadataT { \tag_suspend:n {enumext*} } |
| 14918 |
\@@_starred_columns_set_vii: |
| 14919 |
\item[] \scan_stop: |
| 14920 |
\cs_set_eq:NN \@@_stop_item_tmp_vii: \@@_first_item_tmp_vii: |
| 14921 |
\cs_set_eq:NN \item \@@_start_item_tmp_vii: |
| 14922 |
\ignorespaces |
| 14923 |
} |
| 14924 |
{ |
| 14925 |
\IfDocumentMetadataT { \tag_struct_end:n {tag=text-unit} } |
| 14926 |
\@@_stop_item_tmp_vii: |
| 14927 |
\@@_remove_extra_parsep_vii: |
| 14928 |
\@@_after_list_vii: |
| 14929 |
} |
| 14930 |
% \end{macrocode} |
| 14931 |
% \end{macro} |
| 14932 |
% |
| 14933 |
% \begin{macro}{\@@_safe_exec_vii:}\label{fun:starred:safe-exe} |
| 14934 |
% We will first call the function \cs{@@_is_not_nested:} which sets |
| 14935 |
% \cs{g_@@_starred_bool} to true if we are NOT nested within \myenv*{enumext}, |
| 14936 |
% then call the function \cs{@@_internal_mini_page:} to create the |
| 14937 |
% environment \myvarenv*{__@@_mini_page}, we will increment |
| 14938 |
% \cs{l_@@_level_h_int} to restrict nesting of the environment, set |
| 14939 |
% \cs{l_@@_starred_bool} to true and finally call the function |
| 14940 |
% \cs{@@_is_on_first_level:} which sets \cs{l_@@_starred_first_bool} to |
| 14941 |
% true if we are not nested, allowing the \emph{\enquote{storage system}} |
| 14942 |
% to be used. |
| 14943 |
% \iffalse |
| 14944 |
%% Safe exec for |enumext*| environment (set vars for storage system). |
| 14945 |
% \fi |
| 14946 |
% \begin{macrocode} |
| 14947 |
\cs_new_protected:Nn \@@_safe_exec_vii: |
| 14948 |
{ |
| 14949 |
\@@_is_not_nested: |
| 14950 |
\@@_internal_mini_page: |
| 14951 |
\int_incr:N \l_@@_level_h_int |
| 14952 |
\int_compare:nNnT { \l_@@_level_h_int } > { 1 } |
| 14953 |
{ |
| 14954 |
\msg_error:nn { enumext } { nested } |
| 14955 |
} |
| 14956 |
\int_compare:nNnT { \l_@@_keyans_level_h_int } = { 1 } |
| 14957 |
{ |
| 14958 |
\msg_error:nnn { enumext } { nested-horizontal } { keyans*} |
| 14959 |
} |
| 14960 |
\bool_set_true:N \l_@@_starred_bool |
| 14961 |
\bool_set_false:N \l_@@_standar_bool |
| 14962 |
\@@_is_on_first_level: |
| 14963 |
} |
| 14964 |
% \end{macrocode} |
| 14965 |
% \end{macro} |
| 14966 |
% |
| 14967 |
% \begin{macro}{\@@_parse_keys_vii:n} |
| 14968 |
% We will first check the state of the variable \cs{l_@@_resume_count_vii_bool} |
| 14969 |
% set by the key \mykey{resume} and call the function \cs{@@_resume_last_counter:} |
| 14970 |
% if it is \enquote{true}, then we will clear the variable \cs{l_@@_series_name_str} |
| 14971 |
% used by the key \mykey{series}, process the environment \myoarg{key \textnormal{\textcolor{gray}{=}} val} |
| 14972 |
% and execute the function \cs{@@_parse_series:n} used by the key |
| 14973 |
% \mykey{series}, then we execute the function \cs{@@_store_active_keys_vii:n} |
| 14974 |
% and reprocess the \mymeta{keys} to pass them to the storage \emph{sequence} |
| 14975 |
% if the key \mykey{save-key} is not active. |
| 14976 |
% |
| 14977 |
% \smallskip |
| 14978 |
% |
| 14979 |
% \begin{important}* |
| 14980 |
% Here it is necessary to check the status of \cs{l_@@_resume_count_vii_bool} |
| 14981 |
% in case the key \mykey{resume} is set using |\setenumext{enumext*}{resume}|. |
| 14982 |
% \end{important} |
| 14983 |
% |
| 14984 |
% \smallskip |
| 14985 |
% |
| 14986 |
% \iffalse |
| 14987 |
%% Parse |key=val| and store keys for |enumext*| environment. |
| 14988 |
% \fi |
| 14989 |
% \begin{macrocode} |
| 14990 |
\cs_new_protected:Npn \@@_parse_keys_vii:n #1 |
| 14991 |
{ |
| 14992 |
\bool_if:NT \l_@@_resume_count_vii_bool |
| 14993 |
{ |
| 14994 |
\@@_resume_last_counter: |
| 14995 |
} |
| 14996 |
\tl_if_novalue:nF {#1} |
| 14997 |
{ |
| 14998 |
\str_clear:N \l_@@_series_name_str |
| 14999 |
\keys_set:nn { enumext / enumext* } {#1} |
| 15000 |
\bool_if:NF \l_@@_print_keyans_cmd_bool |
| 15001 |
{ |
| 15002 |
\@@_parse_series:n {#1} |
| 15003 |
} |
| 15004 |
\@@_store_active_keys_vii:n {#1} |
| 15005 |
} |
| 15006 |
} |
| 15007 |
% \end{macrocode} |
| 15008 |
% \end{macro} |
| 15009 |
% |
| 15010 |
% \begin{macro}{\@@_before_list_vii:} |
| 15011 |
% The function \cs{@@_before_list_vii:} first calls the function |
| 15012 |
% \cs{@@_vspace_above_vii:} used by the keys \mykey{above} and |
| 15013 |
% \mykey{above*}, then calls the function \cs{@@_check_ans_active:} for |
| 15014 |
% the check answer mechanism and finally calls the functions |
| 15015 |
% \cs{@@_before_args_exec:} and \cs{@@_start_mini_vii:} used by the |
| 15016 |
% keys \mykey{before*}, \mykey{mini-env}, \mykey{mini-right} and |
| 15017 |
% \mykey{mini-right*}. |
| 15018 |
% \begin{macrocode} |
| 15019 |
\cs_new_protected:Nn \@@_before_list_vii: |
| 15020 |
{ |
| 15021 |
\@@_vspace_above_vii: |
| 15022 |
\@@_check_ans_active: |
| 15023 |
\@@_before_args_exec_vii: |
| 15024 |
\@@_start_mini_vii: |
| 15025 |
} |
| 15026 |
% \end{macrocode} |
| 15027 |
% \end{macro} |
| 15028 |
% |
| 15029 |
% \begin{macro}{\@@_after_list_vii:} |
| 15030 |
% The function \cs{@@_after_list_vii:} first calls the function |
| 15031 |
% \cs{@@_stop_mini_vii:} which internally calls \cs{@@_stop_list:} and |
| 15032 |
% \cs{@@_stop_store_level_vii:} (\S\ref{env:starred:key:mini-env}) used |
| 15033 |
% by the keys \mykey{mini-env}, \mykey{mini-right} and \mykey{mini-right*}, |
| 15034 |
% then to the functions \cs{@@_after_stop_list_vii:} used by the key |
| 15035 |
% \mykey{after}, \cs{@@_check_ans_key_hook:} used by the key \mykey{check-ans}, |
| 15036 |
% \cs{@@_vspace_below_vii:} used by the keys \mykey{below} and |
| 15037 |
% \mykey{below*}. Finally set \cs{l_@@_starred_bool} to false and call |
| 15038 |
% the \cs{@@_resume_save_counter:} function used by the \mykey{series}, |
| 15039 |
% \mykey{resume} and \mykey{resume*} keys. |
| 15040 |
% \begin{macrocode} |
| 15041 |
\cs_new_protected:Nn \@@_after_list_vii: |
| 15042 |
{ |
| 15043 |
\@@_stop_mini_vii: |
| 15044 |
\@@_after_stop_list_vii: |
| 15045 |
\@@_check_ans_key_hook: |
| 15046 |
\@@_vspace_below_vii: |
| 15047 |
\bool_set_false:N \l_@@_starred_bool |
| 15048 |
\bool_if:NF \l_@@_print_keyans_cmd_bool |
| 15049 |
{ |
| 15050 |
\@@_starred_save_counter: |
| 15051 |
} |
| 15052 |
} |
| 15053 |
% \end{macrocode} |
| 15054 |
% \end{macro} |
| 15055 |
% |
| 15056 |
% \begin{macro}{\@@_start_store_level_vii:, \@@_stop_store_level_vii:} |
| 15057 |
% The \cs{@@_start_store_level_vii:} and \cs{@@_stop_store_level_vii:} |
| 15058 |
% functions activate the \emph{\enquote{storing structure}} mechanism |
| 15059 |
% in \emph{sequence} for \ics*{anskey} command and \myenv*{anskey*} |
| 15060 |
% environment if \myenv*{enumext*} are nested in \myenv*{enumext}. |
| 15061 |
% \begin{macrocode} |
| 15062 |
\cs_new_protected:Nn \@@_start_store_level_vii: |
| 15063 |
{ |
| 15064 |
\bool_if:NT \l_@@_store_active_bool |
| 15065 |
{ |
| 15066 |
\int_compare:nNnT { \l_@@_level_int } > { 0 } |
| 15067 |
{ |
| 15068 |
\@@_store_level_open_vii: |
| 15069 |
} |
| 15070 |
} |
| 15071 |
} |
| 15072 |
\cs_new_protected:Nn \@@_stop_store_level_vii: |
| 15073 |
{ |
| 15074 |
\bool_if:NT \l_@@_store_active_bool |
| 15075 |
{ |
| 15076 |
\int_compare:nNnT { \l_@@_level_int } > { 0 } |
| 15077 |
{ |
| 15078 |
\@@_store_level_close_vii: |
| 15079 |
} |
| 15080 |
} |
| 15081 |
} |
| 15082 |
% \end{macrocode} |
| 15083 |
% \end{macro} |
| 15084 |
% |
| 15085 |
% \subsubsection{The command \cs{item} in \env{enumext*}}\label{cmd:item-boxed-vii} |
| 15086 |
% |
| 15087 |
% \begin{macro}{\@@_first_item_tmp_vii:} |
| 15088 |
% |
| 15089 |
% The \cs{@@_first_item_tmp_vii:} function will remove horizontal space |
| 15090 |
% equal to |\labelwidth| plus |\labelsep| to the left of the \emph{\enquote{first}} |
| 15091 |
% |\item| in the environment at the point of execution of this function, |
| 15092 |
% where it is equal to the \cs{@@_stop_item_tmp_vii:} function inside the |
| 15093 |
% environment body definition. |
| 15094 |
% \iffalse |
| 15095 |
%% Remove |\labelwidth+\labelsep| on left in first |\item| for |enumext*| environment. |
| 15096 |
% \fi |
| 15097 |
% \begin{macrocode} |
| 15098 |
\cs_new_protected_nopar:Nn \@@_first_item_tmp_vii: |
| 15099 |
{ |
| 15100 |
\skip_horizontal:n |
| 15101 |
{ |
| 15102 |
-\l_@@_labelwidth_vii_dim - \l_@@_labelsep_vii_dim |
| 15103 |
} |
| 15104 |
\ignorespaces |
| 15105 |
} |
| 15106 |
% \end{macrocode} |
| 15107 |
% \end{macro} |
| 15108 |
% |
| 15109 |
% \begin{macro}{\@@_start_item_tmp_vii:, \@@_item_peek_args_vii:, |
| 15110 |
% \@@_joined_item_vii:w, \@@_standar_item_vii:w, |
| 15111 |
% \@@_starred_item_vii:w, \@@_starred_item_vii_aux_i:w, |
| 15112 |
% \@@_starred_item_vii_aux_ii:w, \@@_starred_item_vii_aux_iii:w,} |
| 15113 |
% First we will call the function \cs{@@_stop_item_tmp_vii:} that we |
| 15114 |
% will redefine later, we will increment the value of |
| 15115 |
% \cs{l_@@_item_column_pos_vii_int} that will count the item's by rows and |
| 15116 |
% the value of \cs{g_@@_item_count_all_vii_int} that will count the |
| 15117 |
% total of item's in the environment. After that we will call the |
| 15118 |
% function \cs{@@_item_peek_args_vii:} that will handle the |
| 15119 |
% arguments passed to \ics*{item}. |
| 15120 |
% \iffalse |
| 15121 |
%% Start boxed item's for |enumext*| environment. |
| 15122 |
% \fi |
| 15123 |
% \begin{macrocode} |
| 15124 |
\cs_new_protected_nopar:Nn \@@_start_item_tmp_vii: |
| 15125 |
{ |
| 15126 |
\@@_stop_item_tmp_vii: |
| 15127 |
\int_incr:N \l_@@_item_column_pos_vii_int |
| 15128 |
\int_gincr:N \g_@@_item_count_all_vii_int |
| 15129 |
\@@_item_peek_args_vii: |
| 15130 |
} |
| 15131 |
% \end{macrocode} |
| 15132 |
% The function \cs{@@_item_peek_args_vii:} will handle the \ics*{item}\myparg{number}. |
| 15133 |
% Look for the argument \enquote{\textcolor{MediumOrchid}{\ttfamily (}}, |
| 15134 |
% if it is present we will call the function \cs{@@_joined_item_vii:w} \myparg{number}, |
| 15135 |
% which is in charge of joining the item's in the same row, in case they |
| 15136 |
% are not present we will set the default value \textcolor{gray}{\ttfamily(\mydim{1})}. |
| 15137 |
% \iffalse |
| 15138 |
%% Peek argument for \item()*[][] for |enumext*| environment. |
| 15139 |
% \fi |
| 15140 |
% \begin{macrocode} |
| 15141 |
\cs_new_protected:Nn \@@_item_peek_args_vii: |
| 15142 |
{ |
| 15143 |
\peek_meaning:NTF ( |
| 15144 |
{ \@@_joined_item_vii:w } |
| 15145 |
{ \@@_joined_item_vii:w (1) } |
| 15146 |
} |
| 15147 |
% \end{macrocode} |
| 15148 |
% The function \cs{@@_joined_item_vii:w} will first call the |
| 15149 |
% function \cs{@@_starred_joined_item_vii:n} in charge of setting the |
| 15150 |
% \emph{width} of the box that will store the content passed to \ics*{item}. Then we |
| 15151 |
% will look for the argument \enquote{\textcolor{MediumOrchid}{\ttfamily *}}, if it is present we will call the |
| 15152 |
% function \cs{@@_starred_item_vii:w} otherwise we will call the |
| 15153 |
% function \cs{@@_standar_item_vii:w}. |
| 15154 |
% \iffalse |
| 15155 |
%% Joined item's for |enumext*| environment. |
| 15156 |
% \fi |
| 15157 |
% \begin{macrocode} |
| 15158 |
\cs_new_protected:Npn \@@_joined_item_vii:w (#1) |
| 15159 |
{ |
| 15160 |
\@@_starred_joined_item_vii:n {#1} |
| 15161 |
\peek_meaning_remove:NTF * |
| 15162 |
{ \@@_starred_item_vii:w } |
| 15163 |
{ \@@_standar_item_vii:w } |
| 15164 |
} |
| 15165 |
% \end{macrocode} |
| 15166 |
% The function \cs{@@_standar_item_vii:w} will first look for the |
| 15167 |
% argument “|[|”, if present it will set the state of the variable |
| 15168 |
% \cs{l_@@_wrap_label_opt_vii_bool} equal to the state of the variable |
| 15169 |
% \cs{l_@@_wrap_label_opt_vii_bool} handled by the key |
| 15170 |
% \mykey{wrap-label*} and finally execute the \emph{non-enumerated} |
| 15171 |
% version \ics*{item}\myoarg{custom} by means of the function |
| 15172 |
% \cs{@@_start_item_vii:w}, otherwise we will set the value of the |
| 15173 |
% variable \cs{l_@@_wrap_label_vii_bool} handled by the |
| 15174 |
% \mykey{wrap-label} key to true and set the switch |\if@noitemarg| to |
| 15175 |
% true to execute the enumerated version of \ics*{item} by means of the |
| 15176 |
% function \cs{@@_start_item_vii:w} |[| \myvarenv{l__@@_label_vii_tl} |]|. |
| 15177 |
% \iffalse |
| 15178 |
%% Set \item[opt] for |enumext*| environment. |
| 15179 |
% \fi |
| 15180 |
% \begin{macrocode} |
| 15181 |
\cs_new_protected:Npn \@@_standar_item_vii:w |
| 15182 |
{ |
| 15183 |
\bool_set_false:N \l_@@_item_starred_vii_bool |
| 15184 |
\peek_meaning:NTF [ |
| 15185 |
{ |
| 15186 |
\bool_set_eq:NN \l_@@_wrap_label_vii_bool \l_@@_wrap_label_opt_vii_bool |
| 15187 |
\@@_start_item_vii:w |
| 15188 |
} |
| 15189 |
{ |
| 15190 |
\bool_set_true:N \l_@@_wrap_label_vii_bool |
| 15191 |
\legacy_if_set_true:n { @noitemarg } |
| 15192 |
\@@_start_item_vii:w [ \l_@@_label_vii_tl ] \ignorespaces |
| 15193 |
} |
| 15194 |
} |
| 15195 |
% \end{macrocode} |
| 15196 |
% The function \cs{@@_starred_item_vii:w} together with the specified |
| 15197 |
% auxiliary functions |aux_i:w|, |aux_ii:w|, and |aux_iii:w| execute \ics*{item*}, |
| 15198 |
% \ics*{item*}\myoarg{symbol} and \ics*{item*}\myoarg{symbol}\myoarg{offset}. |
| 15199 |
% \iffalse |
| 15200 |
%% Set \item*[sym][sep] for |enumext*| environment. |
| 15201 |
% \fi |
| 15202 |
% \begin{macrocode} |
| 15203 |
\cs_new_protected:Npn \@@_starred_item_vii:w |
| 15204 |
{ |
| 15205 |
\bool_set_true:N \l_@@_item_starred_vii_bool |
| 15206 |
\bool_set_true:N \l_@@_wrap_label_vii_bool |
| 15207 |
\peek_meaning:NTF [ |
| 15208 |
{ \@@_starred_item_vii_aux_i:w } |
| 15209 |
{ \@@_starred_item_vii_aux_ii:w } |
| 15210 |
} |
| 15211 |
\cs_new_protected:Npn \@@_starred_item_vii_aux_i:w [#1] |
| 15212 |
{ |
| 15213 |
\tl_gset:Nn \g_@@_item_symbol_aux_vii_tl {#1} |
| 15214 |
\@@_starred_item_vii_aux_ii:w |
| 15215 |
} |
| 15216 |
\cs_new_protected:Npn \@@_starred_item_vii_aux_ii:w |
| 15217 |
{ |
| 15218 |
\peek_meaning:NTF [ |
| 15219 |
{ \@@_starred_item_vii_aux_iii:w } |
| 15220 |
{ |
| 15221 |
\dim_set_eq:NN \l_@@_item_symbol_sep_vii_dim \l_@@_labelsep_vii_dim |
| 15222 |
\legacy_if_set_true:n { @noitemarg } |
| 15223 |
\@@_start_item_vii:w [ \l_@@_label_vii_tl ] \ignorespaces |
| 15224 |
} |
| 15225 |
} |
| 15226 |
\cs_new_protected:Npn \@@_starred_item_vii_aux_iii:w [#1] |
| 15227 |
{ |
| 15228 |
\dim_set:Nn \l_@@_item_symbol_sep_vii_dim {#1} |
| 15229 |
\legacy_if_set_true:n { @noitemarg } |
| 15230 |
\@@_start_item_vii:w [ \l_@@_label_vii_tl ] \ignorespaces |
| 15231 |
} |
| 15232 |
% \end{macrocode} |
| 15233 |
% \end{macro} |
| 15234 |
% |
| 15235 |
% \begin{macro}{\@@_fake_make_label_vii:n} |
| 15236 |
% The \cs{@@_fake_make_label_vii:n} function will be in charge of |
| 15237 |
% handling our definition of |\item|. First we increment the counter |
| 15238 |
% \icounter{enumXvii} for the enumerated items and activate support for |
| 15239 |
% the \emph{check answers} mechanism, followed by support for |
| 15240 |
% \ics*{item*}\myoarg{symbol}\myoarg{offset} if present, then the |
| 15241 |
% \mykey{wrap-label} and \mykey{wrap-label*} keys which we execute using |
| 15242 |
% |\makebox| whose width will be given by the \mykey{labelwidth} key and |
| 15243 |
% position by the \mykey{align} key, inside the argument of this we will |
| 15244 |
% execute the \mykey{font} key together with the function defined by the |
| 15245 |
% \mykey{wrap-label} or \mykey{wrap-label*} keys. Finally we execute the |
| 15246 |
% \mykey{labelsep} key applying a |\skip_horizontal:N| and |\ignorespaces|. |
| 15247 |
% |
| 15248 |
% \smallskip |
| 15249 |
% |
| 15250 |
% \begin{important} |
| 15251 |
% For compatibility with \emph{tagged} \texttt{PDF} and \mypkg{hyperref} |
| 15252 |
% when an environment \myenv*{enumext} is nested in \myenv*{enumext*} |
| 15253 |
% and the key \mykey{save-ans} is not active need setting the |\if@hyper@item| |
| 15254 |
% switch to \emph{\enquote{true}}. The explanation for this is given |
| 15255 |
% by the master Heiko Oberdiek on \href{https://tex.stackexchange.com/a/404911}{\textbackslash |
| 15256 |
% refstepcounter\{enumi\} twice (or more) creates destination with the |
| 15257 |
% same identifier}. |
| 15258 |
% This patch is only needed if you are running |pdflatex| and not if |
| 15259 |
% you are running |lualatex| |
| 15260 |
% \end{important} |
| 15261 |
% |
| 15262 |
% \iffalse |
| 15263 |
%% Fake \makelabel definition for |enumext*| environment. |
| 15264 |
% \fi |
| 15265 |
% \begin{macrocode} |
| 15266 |
\cs_new_protected_nopar:Npn \@@_fake_make_label_vii:n #1 |
| 15267 |
{ |
| 15268 |
\legacy_if:nT { @noitemarg } |
| 15269 |
{ |
| 15270 |
\legacy_if_set_false:n { @noitemarg } |
| 15271 |
\legacy_if:nT { @nmbrlist } |
| 15272 |
{ |
| 15273 |
\IfDocumentMetadataT |
| 15274 |
{ |
| 15275 |
\bool_if:NT \l_@@_hyperref_bool |
| 15276 |
{ |
| 15277 |
\legacy_if_set_true:n { @hyper@item } |
| 15278 |
} |
| 15279 |
} |
| 15280 |
\refstepcounter{enumXvii} |
| 15281 |
\bool_if:NT \l_@@_check_answers_bool |
| 15282 |
{ |
| 15283 |
\int_gincr:N \g_@@_item_number_int |
| 15284 |
\bool_set_true:N \l_@@_item_number_bool |
| 15285 |
} |
| 15286 |
} |
| 15287 |
} |
| 15288 |
\bool_if:NT \l_@@_item_starred_vii_bool |
| 15289 |
{ |
| 15290 |
\tl_if_blank:VT \g_@@_item_symbol_aux_vii_tl |
| 15291 |
{ |
| 15292 |
\tl_gset_eq:NN |
| 15293 |
\g_@@_item_symbol_aux_vii_tl \l_@@_item_symbol_vii_tl |
| 15294 |
} |
| 15295 |
\mode_leave_vertical: |
| 15296 |
\skip_horizontal:n { -\l_@@_item_symbol_sep_vii_dim } |
| 15297 |
\hbox_overlap_left:n { \g_@@_item_symbol_aux_vii_tl } |
| 15298 |
\skip_horizontal:N \l_@@_item_symbol_sep_vii_dim |
| 15299 |
\tl_gclear:N \g_@@_item_symbol_aux_vii_tl |
| 15300 |
} |
| 15301 |
\makebox[ \l_@@_labelwidth_vii_dim ][ \l_@@_align_label_vii_str ] |
| 15302 |
{ |
| 15303 |
\tl_use:N \l_@@_label_font_style_vii_tl |
| 15304 |
\bool_if:NTF \l_@@_wrap_label_vii_bool |
| 15305 |
{ |
| 15306 |
\@@_wrapper_label_vii:n {#1} |
| 15307 |
} |
| 15308 |
{ #1 } |
| 15309 |
} |
| 15310 |
\skip_horizontal:N \l_@@_labelsep_vii_dim \ignorespaces |
| 15311 |
} |
| 15312 |
% \end{macrocode} |
| 15313 |
% \end{macro} |
| 15314 |
% |
| 15315 |
% \subsubsection{Real definition of \cs{item} in \env{enumext*}} |
| 15316 |
% |
| 15317 |
% The functions \cs{@@_start_item_vii:w} and \cs{@@_stop_item_vii:} executing |
| 15318 |
% the true definition of \ics*{item} inside the \myenv*{enumext*} environment, unlike |
| 15319 |
% the implementation in \mypkg{shortlst} we will NOT use an extra group |
| 15320 |
% and the plain form of the \myenv{lrbox} environment. |
| 15321 |
% |
| 15322 |
% \begin{macro}{\@@_start_item_vii:w, \@@_stop_item_vii:} |
| 15323 |
% The first thing we will do is set the value of \cs{@@_stop_item_tmp_vii:} equal to |
| 15324 |
% \cs{@@_stop_item_vii:} which we will define later, after that we will |
| 15325 |
% start capturing |\item| and \emph{\enquote{item content}} in a \emph{horizontal box} |
| 15326 |
% where the width will be |\itemwidth| plus |\labelwidth| plus |\labelsep|. |
| 15327 |
% \begin{macrocode} |
| 15328 |
\cs_new_protected_nopar:Npn \@@_start_item_vii:w [#1] |
| 15329 |
{ |
| 15330 |
\cs_set_eq:NN \@@_stop_item_tmp_vii: \@@_stop_item_vii: |
| 15331 |
\hbox_set_to_wd:Nnw \l_@@_item_text_vii_box |
| 15332 |
{ |
| 15333 |
\l_@@_joined_width_vii_dim |
| 15334 |
+ \l_@@_labelwidth_vii_dim |
| 15335 |
+ \l_@@_labelsep_vii_dim |
| 15336 |
} |
| 15337 |
% \end{macrocode} |
| 15338 |
% Redefine the |\footnote| command. |
| 15339 |
% \begin{macrocode} |
| 15340 |
\@@_renew_footnote_starred: |
| 15341 |
% \end{macrocode} |
| 15342 |
% Now we insert our \emph{sockets} for \emph{tagging} \texttt{PDF} |
| 15343 |
% support and run |\item|. |
| 15344 |
% \begin{macrocode} |
| 15345 |
\@@_start_list_tag:n {enumext*} |
| 15346 |
\@@_fake_make_label_vii:n {#1} |
| 15347 |
\@@_stop_start_list_tag: |
| 15348 |
% \end{macrocode} |
| 15349 |
% Finally we open the \myenv{minipage} environment, capture the |
| 15350 |
% \emph{\enquote{item content}}, make |\parindent| take the value of the |
| 15351 |
% key \mykey{listparindent} and |\parskip| take the value of the key |
| 15352 |
% \mykey{parsep}, then execute the keys \mykey{itemindent} and |
| 15353 |
% \mykey{first}. |
| 15354 |
% |
| 15355 |
% \smallskip |
| 15356 |
% |
| 15357 |
% \begin{important}* |
| 15358 |
% Here the use of |\unskip| and |\skip_horizontal:n| with the value of |
| 15359 |
% \mykey{listparindent} is necessary, otherwise an unwanted space is |
| 15360 |
% created when using |\item|\myoarg{opt} and the value passed to the key |
| 15361 |
% \mykey{itemindent} is incremented. |
| 15362 |
% \end{important} |
| 15363 |
% |
| 15364 |
% \smallskip |
| 15365 |
% |
| 15366 |
% \begin{macrocode} |
| 15367 |
\@@_minipage:w [ t ]{ \l_@@_joined_width_vii_dim } |
| 15368 |
\dim_set_eq:NN \parindent \l_@@_listparindent_vii_dim |
| 15369 |
\skip_set_eq:NN \parskip \l_@@_parsep_vii_skip |
| 15370 |
\@@_unskip_unkern: |
| 15371 |
\@@_unskip_unkern: |
| 15372 |
\skip_horizontal:n { -\l_@@_listparindent_vii_dim } \ignorespaces |
| 15373 |
\tl_use:N \l_@@_fake_item_indent_vii_tl |
| 15374 |
\tl_use:N \l_@@_after_list_args_vii_tl |
| 15375 |
} |
| 15376 |
% \end{macrocode} |
| 15377 |
% The \cs{@@_stop_item_vii:} function will finish the fetching |\item| |
| 15378 |
% and \emph{\enquote{item content}} by closing the \myenv{minipage} |
| 15379 |
% environment, the \emph{sockets} for \emph{tagging} \texttt{PDF} and the |
| 15380 |
% \emph{horizontal box}. |
| 15381 |
% \begin{macrocode} |
| 15382 |
\cs_new_protected_nopar:Nn \@@_stop_item_vii: |
| 15383 |
{ |
| 15384 |
\@@_endminipage: |
| 15385 |
\@@_stop_list_tag:n {enumext*} |
| 15386 |
\hbox_set_end: |
| 15387 |
% \end{macrocode} |
| 15388 |
% Here we will reduce the \emph{warnings} a bit by setting the value |
| 15389 |
% of |\hbadness| to \mydim{10000}, print |\item| and \emph{\enquote{item content}} |
| 15390 |
% from the \emph{horizontal box},. |
| 15391 |
% \begin{macrocode} |
| 15392 |
\int_set:Nn \hbadness { 10000 } |
| 15393 |
\box_use_drop:N \l_@@_item_text_vii_box |
| 15394 |
% \end{macrocode} |
| 15395 |
% Finally apply the \emph{vertical space} between rows set by \mykey{itemsep} |
| 15396 |
% key passed to |\parsep| using |\par\noindent| and \emph{horizontal space} |
| 15397 |
% between columns set by \mykey{columns-sep} key using |\skip_horizontal:N|. |
| 15398 |
% \begin{macrocode} |
| 15399 |
\int_compare:nNnTF |
| 15400 |
{ \l_@@_item_column_pos_vii_int } = { \l_@@_columns_vii_int } |
| 15401 |
{ |
| 15402 |
\par\noindent |
| 15403 |
\int_zero:N \l_@@_item_column_pos_vii_int |
| 15404 |
} |
| 15405 |
{ |
| 15406 |
\skip_horizontal:N \l_@@_columns_sep_vii_dim |
| 15407 |
} |
| 15408 |
} |
| 15409 |
% \end{macrocode} |
| 15410 |
% \end{macro} |
| 15411 |
% |
| 15412 |
% \begin{macro}{\@@_remove_extra_parsep_vii:} |
| 15413 |
% Remove the extra \emph{vertical space} equal to |\parsep=\itemsep| when the |
| 15414 |
% total number of |\item| is divisible by the number of |\item| in the last |
| 15415 |
% row of the environment. Here the use of |\unskip| or |\removelastskip| |
| 15416 |
% fails and does not obtain the expected result, using |\vspace| is |
| 15417 |
% the option and in this case, we can use a simplified version since |
| 15418 |
% we are always in \mymeta{vertical mode}. |
| 15419 |
% \iffalse |
| 15420 |
%% Remove extra \parsep in |enumext*| environment. |
| 15421 |
% \fi |
| 15422 |
% \begin{macrocode} |
| 15423 |
\cs_new_protected:Nn \@@_remove_extra_parsep_vii: |
| 15424 |
{ |
| 15425 |
\int_compare:nNnT |
| 15426 |
{ |
| 15427 |
\int_mod:nn |
| 15428 |
{ \g_@@_item_count_all_vii_int } { \l_@@_columns_vii_int } |
| 15429 |
} |
| 15430 |
= |
| 15431 |
{ 0 } |
| 15432 |
{ |
| 15433 |
\para_end: |
| 15434 |
\skip_vertical:n { -\l_@@_itemsep_vii_skip } |
| 15435 |
\skip_vertical:N \c_zero_skip |
| 15436 |
\int_gzero:N \g_@@_item_count_all_vii_int |
| 15437 |
} |
| 15438 |
} |
| 15439 |
% \end{macrocode} |
| 15440 |
% \end{macro} |
| 15441 |
% |
| 15442 |
% \smallskip |
| 15443 |
% |
| 15444 |
% As we don't want our check to be executed \mykey{check-ans} by levels |
| 15445 |
% but on the complete list, we will take it out of the \myenv*{enumext*} |
| 15446 |
% environment using the \emph{\enquote{hook}} function \cs{@@_after_env:nn}. |
| 15447 |
% \iffalse |
| 15448 |
%% Execute |check-ans| key out of |enumext*| environment. |
| 15449 |
% \fi |
| 15450 |
% \begin{macrocode} |
| 15451 |
\@@_after_env:nn {enumext*} |
| 15452 |
{ |
| 15453 |
\@@_execute_after_env: |
| 15454 |
} |
| 15455 |
% \end{macrocode} |
| 15456 |
% |
| 15457 |
% \subsection{The environment \env{keyans*}}\label{env:keyans-starred} |
| 15458 |
% |
| 15459 |
% \begin{macro}{keyans*} |
| 15460 |
% The implementation of \myenv*{keyans*} environment is the |
| 15461 |
% similar as that used by the \myenv*{enumext*} environment except for the |
| 15462 |
% \cs{@@_check_starred_cmd:n} function added in the second part. |
| 15463 |
% \iffalse |
| 15464 |
%% Define |keyans*| environment. |
| 15465 |
% \fi |
| 15466 |
% \begin{macrocode} |
| 15467 |
\NewDocumentEnvironment{keyans*}{ o } |
| 15468 |
{ |
| 15469 |
\@@_safe_exec_viii: |
| 15470 |
\@@_parse_keys_viii:n {#1} |
| 15471 |
\@@_before_list_viii: |
| 15472 |
\@@_start_list:nn { } |
| 15473 |
{ |
| 15474 |
\@@_list_arg_two_viii: |
| 15475 |
\@@_before_keys_exec_viii: |
| 15476 |
} |
| 15477 |
\IfDocumentMetadataT { \tag_suspend:n {keyans*} } |
| 15478 |
\@@_starred_columns_set_viii: |
| 15479 |
\item[] \scan_stop: |
| 15480 |
\cs_set_eq:NN \@@_stop_item_tmp_viii: \@@_first_item_tmp_viii: |
| 15481 |
\cs_set_eq:NN \item \@@_start_item_tmp_viii: |
| 15482 |
\ignorespaces |
| 15483 |
} |
| 15484 |
{ |
| 15485 |
\IfDocumentMetadataT { \tag_struct_end:n {tag=text-unit} } |
| 15486 |
\@@_stop_item_tmp_viii: |
| 15487 |
\@@_remove_extra_parsep_viii: |
| 15488 |
\@@_check_starred_cmd:n { item } |
| 15489 |
\@@_after_list_viii: |
| 15490 |
} |
| 15491 |
% \end{macrocode} |
| 15492 |
% \end{macro} |
| 15493 |
% |
| 15494 |
% \begin{macro}{\@@_safe_exec_viii:} |
| 15495 |
% The \cs{@@_safe_exec_viii:} function will first check if the |
| 15496 |
% \mykey{save-ans} key is active and only when this is true the |
| 15497 |
% environment will be available, it will increment the value of |
| 15498 |
% \cs{l_@@_keyans_level_h_int} and return an error message when we are |
| 15499 |
% nesting the environment, then it will call the |
| 15500 |
% \cs{@@_keyans_name_and_start:} function in charge of saving the name of |
| 15501 |
% the environment and the line it is running on, then it will check if we |
| 15502 |
% are trying to nest \myenv*{keyans*} in \myenv*{enumext*} returning an |
| 15503 |
% error and we will set \cs{l_@@_starred_bool} to true, finally we will |
| 15504 |
% check if we are within the appropriate level within the |
| 15505 |
% \myenv*{enumext} environment. |
| 15506 |
% \iffalse |
| 15507 |
%% Test deep-level for |keyans*| environment and set bool vars. |
| 15508 |
% \fi |
| 15509 |
% \begin{macrocode} |
| 15510 |
\cs_new_protected:Nn \@@_safe_exec_viii: |
| 15511 |
{ |
| 15512 |
\bool_if:NF \l_@@_store_active_bool |
| 15513 |
{ |
| 15514 |
\msg_error:nnnn { enumext } { wrong-place }{ keyans* }{ save-ans } |
| 15515 |
} |
| 15516 |
\int_incr:N \l_@@_keyans_level_h_int |
| 15517 |
\int_compare:nNnT { \l_@@_keyans_level_h_int } > { 1 } |
| 15518 |
{ |
| 15519 |
\msg_error:nn { enumext } { nested } |
| 15520 |
} |
| 15521 |
\@@_keyans_name_and_start: |
| 15522 |
\bool_if:NT \l_@@_starred_bool |
| 15523 |
{ |
| 15524 |
\msg_error:nnn { enumext } { nested-horizontal } { enumext* } |
| 15525 |
} |
| 15526 |
\bool_set_true:N \l_@@_starred_bool |
| 15527 |
% Set false for interfering with enumext nested in keyans* (yes, its possible and crayze) |
| 15528 |
\bool_set_false:N \l_@@_store_active_bool |
| 15529 |
\int_compare:nNnT { \l_@@_level_int } > { 1 } |
| 15530 |
{ |
| 15531 |
\msg_error:nn { enumext } { keyans-wrong-level } |
| 15532 |
} |
| 15533 |
} |
| 15534 |
% \end{macrocode} |
| 15535 |
% \end{macro} |
| 15536 |
% |
| 15537 |
% \begin{macro}{\@@_parse_keys_viii:n} |
| 15538 |
% Parse \myoarg{key \textnormal{\textcolor{gray}{=}} val} |
| 15539 |
% for \myenv*{keyans*}. |
| 15540 |
% \iffalse |
| 15541 |
%% Parse |key=val| and store keys for |keyans*| environment. |
| 15542 |
% \fi |
| 15543 |
% \begin{macrocode} |
| 15544 |
\cs_new_protected:Npn \@@_parse_keys_viii:n #1 |
| 15545 |
{ |
| 15546 |
\tl_if_novalue:nF {#1} |
| 15547 |
{ |
| 15548 |
\keys_set:nn { enumext / keyans* } {#1} |
| 15549 |
} |
| 15550 |
} |
| 15551 |
% \end{macrocode} |
| 15552 |
% \end{macro} |
| 15553 |
% |
| 15554 |
% \begin{macro}{\@@_before_list_viii:} |
| 15555 |
% The function \cs{@@_before_list_viii:} will add the vertical |
| 15556 |
% spacing on the environment if the \mykey{above} key is active next to |
| 15557 |
% the \mymarg{code} defined by the \mykey{before*} key if |
| 15558 |
% it is active, the call the function \cs{@@_start_mini_viii:} handle by |
| 15559 |
% \mykey{mini-env}. |
| 15560 |
% \begin{macrocode} |
| 15561 |
\cs_new_protected:Nn \@@_before_list_viii: |
| 15562 |
{ |
| 15563 |
\@@_vspace_above_viii: |
| 15564 |
\@@_before_args_exec_viii: |
| 15565 |
\@@_start_mini_viii: |
| 15566 |
} |
| 15567 |
% \end{macrocode} |
| 15568 |
% \end{macro} |
| 15569 |
% |
| 15570 |
% \begin{macro}{\@@_after_list_viii:} |
| 15571 |
% The function \cs{@@_after_list_viii:} first call the function \cs{@@_stop_mini_viii:}, |
| 15572 |
% then apply the \mymarg{code} handled by the \mykey{after} key |
| 15573 |
% together with the \emph{vertical space} handled by the \mykey{below} key if |
| 15574 |
% they are present. |
| 15575 |
% \begin{macrocode} |
| 15576 |
\cs_new_protected:Nn \@@_after_list_viii: |
| 15577 |
{ |
| 15578 |
\@@_stop_mini_viii: |
| 15579 |
\@@_after_stop_list_viii: |
| 15580 |
\@@_vspace_below_viii: |
| 15581 |
} |
| 15582 |
% \end{macrocode} |
| 15583 |
% \end{macro} |
| 15584 |
% |
| 15585 |
% \subsubsection{The command \cs{item} in \env{keyans*}}\label{cmd:item-boxed-viii} |
| 15586 |
% |
| 15587 |
% The idea here is to make the |\item| command behave in the same way as |
| 15588 |
% in the \myenv*{keyans} environment with the difference of the \emph{optional argument} |
| 15589 |
% \myparg{number} which works in the same way as in the \myenv*{enumext*} |
| 15590 |
% environment. |
| 15591 |
% |
| 15592 |
% In simple terms we want to store the \mymeta{label} next to the \myoarg{content} if it is present |
| 15593 |
% in the \emph{sequence} and \emph{prop list} defined by \mykey{save-ans} key for |
| 15594 |
% |\item*|, |\item*|\myoarg{content}, |\item|\myparg{number}|*| and |
| 15595 |
% |\item|\myparg{number}|*|\myoarg{content} commands. |
| 15596 |
% |
| 15597 |
% \begin{macro}{\@@_first_item_tmp_viii:} |
| 15598 |
% The \cs{@@_first_item_tmp_viii:} function will remove horizontal space |
| 15599 |
% equal to |\labelwidth| plus |\labelsep| to the left of the \emph{\enquote{first}} |
| 15600 |
% |\item| in the environment at the point of execution of this function, |
| 15601 |
% where it is equal to the \cs{@@_stop_item_tmp_viii:} function inside the |
| 15602 |
% environment body definition. |
| 15603 |
% \iffalse |
| 15604 |
%% Remove |\labelwidth+\labelsep| on left in first |\item| for |keyans*| environment. |
| 15605 |
% \fi |
| 15606 |
% \begin{macrocode} |
| 15607 |
\cs_new_protected_nopar:Nn \@@_first_item_tmp_viii: |
| 15608 |
{ |
| 15609 |
\skip_horizontal:n |
| 15610 |
{ |
| 15611 |
-\l_@@_labelwidth_viii_dim - \l_@@_labelsep_viii_dim |
| 15612 |
} |
| 15613 |
\ignorespaces |
| 15614 |
} |
| 15615 |
% \end{macrocode} |
| 15616 |
% \end{macro} |
| 15617 |
% |
| 15618 |
% \begin{macro}{\@@_start_item_tmp_viii:, \@@_item_peek_args_viii:, |
| 15619 |
% \@@_joined_item_viii:w, \@@_standar_item_viii:w} |
| 15620 |
% First we will call the function \cs{@@_stop_item_tmp_viii:} that we |
| 15621 |
% will redefine later, we will increment the value of |
| 15622 |
% \cs{l_@@_item_column_pos_viii_int} that will count the item's by rows and |
| 15623 |
% the value of \cs{g_@@_item_count_all_viii_int} that will count the |
| 15624 |
% total of item's in the environment. After that we will call the |
| 15625 |
% function \cs{@@_item_peek_args_viii:} that will handle the |
| 15626 |
% arguments passed to \ics*{item}. |
| 15627 |
% \iffalse |
| 15628 |
%% Start boxed item's for |keyans*| environment. |
| 15629 |
% \fi |
| 15630 |
% \begin{macrocode} |
| 15631 |
\cs_new_protected_nopar:Nn \@@_start_item_tmp_viii: |
| 15632 |
{ |
| 15633 |
\@@_stop_item_tmp_viii: |
| 15634 |
\int_incr:N \l_@@_item_column_pos_viii_int |
| 15635 |
\int_gincr:N \g_@@_item_count_all_viii_int |
| 15636 |
\@@_item_peek_args_viii: |
| 15637 |
} |
| 15638 |
% \end{macrocode} |
| 15639 |
% The function \cs{@@_item_peek_args_viii:} will handle the \ics*{item}\myparg{number}. |
| 15640 |
% Look for the argument \enquote{\textcolor{MediumOrchid}{\ttfamily (}}, if it is |
| 15641 |
% present we will call the function \cs{@@_joined_item_viii:w} \myparg{number}, |
| 15642 |
% which is in charge of joining the item's in the same row, in case they |
| 15643 |
% are not present we will set the default value \textcolor{gray}{\ttfamily(\mydim{1})}. |
| 15644 |
% \iffalse |
| 15645 |
%% Peek argument for \item(number)*[opt] for |keyans*| environment. |
| 15646 |
% \fi |
| 15647 |
% \begin{macrocode} |
| 15648 |
\cs_new_protected:Nn \@@_item_peek_args_viii: |
| 15649 |
{ |
| 15650 |
\peek_meaning:NTF ( |
| 15651 |
{ \@@_joined_item_viii:w } |
| 15652 |
{ \@@_joined_item_viii:w (1) } |
| 15653 |
} |
| 15654 |
% \end{macrocode} |
| 15655 |
% The function \cs{@@_joined_item_viii:w} will first call the |
| 15656 |
% function \cs{@@_starred_joined_item_viii:n} in charge of setting the |
| 15657 |
% \emph{width} of the box that will store the content passed to \ics*{item}. Then we |
| 15658 |
% will look for the argument \enquote{\textcolor{MediumOrchid}{\ttfamily *}}, if it is present we will call the |
| 15659 |
% function \cs{@@_starred_item_viii:w} otherwise we will call the |
| 15660 |
% function \cs{@@_standar_item_viii:w}. |
| 15661 |
% \iffalse |
| 15662 |
%% Joined item's for |keyans*| environment. |
| 15663 |
% \fi |
| 15664 |
% \begin{macrocode} |
| 15665 |
\cs_new_protected:Npn \@@_joined_item_viii:w (#1) |
| 15666 |
{ |
| 15667 |
\@@_starred_joined_item_viii:n {#1} |
| 15668 |
\peek_meaning_remove:NTF * |
| 15669 |
{ \@@_starred_item_viii:w } |
| 15670 |
{ \@@_standar_item_viii:w } |
| 15671 |
} |
| 15672 |
% \end{macrocode} |
| 15673 |
% The function \cs{@@_standar_item_viii:w} will first look for the |
| 15674 |
% argument “|[|”, if present it will set the state of the variable |
| 15675 |
% \cs{l_@@_wrap_label_opt_viii_bool} equal to the state of the variable |
| 15676 |
% \cs{l_@@_wrap_label_opt_viii_bool} handled by the key |
| 15677 |
% \mykey{wrap-label*} and finally execute the \emph{non-enumerated} |
| 15678 |
% version \ics*{item}\myoarg{custom} by means of the function |
| 15679 |
% \cs{@@_start_item_viii:w}, otherwise we will set the value of the |
| 15680 |
% variable \cs{l_@@_wrap_label_viii_bool} handled by the |
| 15681 |
% \mykey{wrap-label} key to true and set the switch |\if@noitemarg| to |
| 15682 |
% true to execute the enumerated version of \ics*{item} by means of the |
| 15683 |
% function \cs{@@_start_item_viii:w} |[| \myvarenv{l__@@_label_viii_tl} |]|. |
| 15684 |
% \iffalse |
| 15685 |
%% Set standard \item[opt] for |keyans*| environment. |
| 15686 |
% \fi |
| 15687 |
% \begin{macrocode} |
| 15688 |
\cs_new_protected:Npn \@@_standar_item_viii:w |
| 15689 |
{ |
| 15690 |
\bool_set_false:N \l_@@_item_starred_viii_bool |
| 15691 |
\bool_set_false:N \l_@@_item_wrap_key_bool |
| 15692 |
\peek_meaning:NTF [ |
| 15693 |
{ |
| 15694 |
\bool_set_eq:NN \l_@@_wrap_label_viii_bool \l_@@_wrap_label_opt_viii_bool |
| 15695 |
\@@_start_item_viii:w |
| 15696 |
} |
| 15697 |
{ |
| 15698 |
\bool_set_true:N \l_@@_wrap_label_viii_bool |
| 15699 |
\legacy_if_set_true:n { @noitemarg } |
| 15700 |
\@@_start_item_viii:w [ \l_@@_label_viii_tl ] \ignorespaces |
| 15701 |
} |
| 15702 |
} |
| 15703 |
% \end{macrocode} |
| 15704 |
% \end{macro} |
| 15705 |
% |
| 15706 |
% \begin{macro}{\@@_starred_item_viii:w, \@@_starred_item_viii_aux_i:w, |
| 15707 |
% \@@_starred_item_viii_aux_ii:w, \@@_keyans_starred_item_star:} |
| 15708 |
% The function \cs{@@_starred_item_viii:w} together with the specified |
| 15709 |
% auxiliary functions |aux_i:w| and |aux_ii:w| execute \ics*{item*} |
| 15710 |
% and \ics*{item*}\myoarg{content}. |
| 15711 |
% \iffalse |
| 15712 |
%% Set \item*[content] for |keyans*| environment. |
| 15713 |
% \fi |
| 15714 |
% \begin{macrocode} |
| 15715 |
\cs_new_protected:Npn \@@_starred_item_viii:w |
| 15716 |
{ |
| 15717 |
\bool_set_true:N \l_@@_item_starred_viii_bool |
| 15718 |
\bool_set_true:N \l_@@_item_wrap_key_bool |
| 15719 |
\bool_set_true:N \l_@@_wrap_label_viii_bool |
| 15720 |
\peek_meaning:NTF [ |
| 15721 |
{ \@@_starred_item_viii_aux_i:w } |
| 15722 |
{ \@@_starred_item_viii_aux_ii:w } |
| 15723 |
} |
| 15724 |
% \end{macrocode} |
| 15725 |
% The function \cs{@@_starred_item_viii_aux_i:w} will save the |
| 15726 |
% \emph{optional argument} to |\item*| in \cs{l_@@_store_current_opt_arg_tl} |
| 15727 |
% and will save this argument along with the spacing set by the key \mykey{save-sep} in |
| 15728 |
% variable \cs{l_@@_store_current_label_tl} if present, then call the |
| 15729 |
% function \cs{@@_starred_item_viii_aux_ii:w}. |
| 15730 |
% \begin{macrocode} |
| 15731 |
\cs_new_protected:Npn \@@_starred_item_viii_aux_i:w [#1] |
| 15732 |
{ |
| 15733 |
\tl_clear:N \l_@@_store_current_label_tl |
| 15734 |
\tl_if_novalue:nF { #1 } |
| 15735 |
{ |
| 15736 |
\tl_if_empty:NF \l_@@_store_keyans_item_opt_sep_viii_tl |
| 15737 |
{ |
| 15738 |
\tl_put_right:NV \l_@@_store_current_label_tl \l_@@_store_keyans_item_opt_sep_viii_tl |
| 15739 |
\tl_put_right:Nn \l_@@_store_current_label_tl { #1 } |
| 15740 |
} |
| 15741 |
\tl_set:Nn \l_@@_store_current_opt_arg_tl { #1 } |
| 15742 |
} |
| 15743 |
\@@_starred_item_viii_aux_ii:w |
| 15744 |
} |
| 15745 |
\cs_new_protected:Npn \@@_starred_item_viii_aux_ii:w |
| 15746 |
{ |
| 15747 |
\legacy_if_set_true:n { @noitemarg } |
| 15748 |
\@@_start_item_viii:w [ \l_@@_label_viii_tl ] \ignorespaces |
| 15749 |
} |
| 15750 |
% \end{macrocode} |
| 15751 |
% The function \cs{@@_keyans_starred_item_star:} will be in charge of storing |
| 15752 |
% the current \mymeta{label} for \ics*{item*} followed by the |
| 15753 |
% \myoarg{content} for \ics*{item*}\myoarg{content} if |
| 15754 |
% present in the \emph{sequence} and \emph{prop list} set by the |
| 15755 |
% \mykey{save-ans} key. In this same function the keys \mykey{show-ans}, |
| 15756 |
% \mykey{show-pos}, \mykey{mark-sep} and \mykey{save-ref} are implemented. |
| 15757 |
% \iffalse |
| 15758 |
%% Set \item*[content] for |keyans*| environment. |
| 15759 |
% \fi |
| 15760 |
% \begin{macrocode} |
| 15761 |
\cs_new_protected:Nn \@@_keyans_starred_item_star: |
| 15762 |
{ |
| 15763 |
\tl_put_left:Ne \l_@@_store_current_label_tl { \l_@@_label_viii_tl } |
| 15764 |
\@@_store_addto_prop:V \l_@@_store_current_label_tl |
| 15765 |
\@@_keyans_store_ref: |
| 15766 |
\tl_put_left:Nn \l_@@_store_current_label_tl { \item } |
| 15767 |
\@@_keyans_addto_seq_link: |
| 15768 |
\int_gincr:N \g_@@_check_starred_cmd_int |
| 15769 |
\dim_compare:nNnT { \l_@@_mark_sym_sep_viii_dim } = { \c_zero_dim } |
| 15770 |
{ |
| 15771 |
\dim_set:Nn \l_@@_mark_sym_sep_viii_dim { \l_@@_labelsep_viii_dim } |
| 15772 |
} |
| 15773 |
\bool_if:NT \l_@@_show_answer_bool |
| 15774 |
{ |
| 15775 |
\tl_set_eq:NN \l_@@_mark_answer_sym_tl \l_@@_mark_answer_sym_viii_tl |
| 15776 |
\str_set_eq:NN \l_@@_mark_position_str \l_@@_mark_position_viii_str |
| 15777 |
\@@_print_keyans_box:NN |
| 15778 |
\l_@@_labelwidth_viii_dim \l_@@_mark_sym_sep_viii_dim |
| 15779 |
} |
| 15780 |
\bool_if:NT \l_@@_show_position_bool |
| 15781 |
{ |
| 15782 |
\tl_set:Ne \l_@@_mark_answer_sym_tl |
| 15783 |
{ |
| 15784 |
\group_begin: |
| 15785 |
\exp_not:N \normalfont |
| 15786 |
\exp_not:N \footnotesize [ \int_eval:n |
| 15787 |
{ |
| 15788 |
\prop_count:c { g_@@_ \l_@@_store_name_tl _prop } |
| 15789 |
} |
| 15790 |
] |
| 15791 |
\group_end: |
| 15792 |
} |
| 15793 |
\str_set_eq:NN \l_@@_mark_position_str \l_@@_mark_position_viii_str |
| 15794 |
\@@_print_keyans_box:NN |
| 15795 |
\l_@@_labelwidth_viii_dim \l_@@_mark_sym_sep_viii_dim |
| 15796 |
} |
| 15797 |
} |
| 15798 |
% \end{macrocode} |
| 15799 |
% \end{macro} |
| 15800 |
% |
| 15801 |
% \begin{macro}{\@@_keyans_wraper_label_viii:n, \@@_fake_make_label_viii:n} |
| 15802 |
% The implementation at this is very similar to that of the |
| 15803 |
% \myenv*{enumext*} environment. |
| 15804 |
% \iffalse |
| 15805 |
%% Define a fake |\makelabel| for |keyans*| environment. |
| 15806 |
% \fi |
| 15807 |
% \begin{macrocode} |
| 15808 |
\cs_new_protected:Npn \@@_keyans_wraper_label_viii:n #1 |
| 15809 |
{ |
| 15810 |
\bool_lazy_all:nT |
| 15811 |
{ |
| 15812 |
{ \bool_if_p:N \l_@@_wrap_label_viii_bool } |
| 15813 |
{ \bool_if_p:N \l_@@_show_answer_bool } |
| 15814 |
{ \bool_if_p:N \l_@@_item_wrap_key_bool } |
| 15815 |
{ \cs_if_exist_p:N \@@_keyans_wrapper_item_viii:n } |
| 15816 |
} |
| 15817 |
{ |
| 15818 |
\cs_set_eq:NN |
| 15819 |
\@@_wrapper_label_viii:n \@@_keyans_wrapper_item_viii:n |
| 15820 |
} |
| 15821 |
\bool_if:NTF \l_@@_wrap_label_viii_bool |
| 15822 |
{ |
| 15823 |
\@@_wrapper_label_viii:n {#1} |
| 15824 |
} |
| 15825 |
{ #1 } |
| 15826 |
} |
| 15827 |
\cs_new_protected_nopar:Npn \@@_fake_make_label_viii:n #1 |
| 15828 |
{ |
| 15829 |
\legacy_if:nT { @noitemarg } |
| 15830 |
{ |
| 15831 |
\legacy_if_set_false:n { @noitemarg } |
| 15832 |
\legacy_if:nT { @nmbrlist } |
| 15833 |
{ |
| 15834 |
\refstepcounter{enumXviii} |
| 15835 |
} |
| 15836 |
} |
| 15837 |
\bool_if:NT \l_@@_item_starred_viii_bool |
| 15838 |
{ |
| 15839 |
\@@_keyans_starred_item_star: |
| 15840 |
} |
| 15841 |
\makebox[ \l_@@_labelwidth_viii_dim ][ \l_@@_align_label_viii_str ] |
| 15842 |
{ |
| 15843 |
\tl_use:N \l_@@_label_font_style_viii_tl |
| 15844 |
\@@_keyans_wraper_label_viii:n {#1} |
| 15845 |
} |
| 15846 |
\skip_horizontal:N \l_@@_labelsep_viii_dim \ignorespaces |
| 15847 |
} |
| 15848 |
% \end{macrocode} |
| 15849 |
% \end{macro} |
| 15850 |
% |
| 15851 |
% \subsubsection{Real definition of \cs{item} in \env{keyans*}} |
| 15852 |
% |
| 15853 |
% \begin{macro}{\@@_start_item_viii:w, \@@_stop_item_viii:} |
| 15854 |
% The implementation at this is very similar to that of the |
| 15855 |
% \myenv*{enumext*} environment. |
| 15856 |
% \iffalse |
| 15857 |
%% Real |\item| definition for |keyans*| environment. |
| 15858 |
% \fi |
| 15859 |
% \begin{macrocode} |
| 15860 |
\cs_new_protected_nopar:Npn \@@_start_item_viii:w [#1] |
| 15861 |
{ |
| 15862 |
\cs_set_eq:NN \@@_stop_item_tmp_viii: \@@_stop_item_viii: |
| 15863 |
\hbox_set_to_wd:Nnw \l_@@_item_text_viii_box |
| 15864 |
{ |
| 15865 |
\l_@@_joined_width_viii_dim |
| 15866 |
+ \l_@@_labelwidth_viii_dim |
| 15867 |
+ \l_@@_labelsep_viii_dim |
| 15868 |
} |
| 15869 |
\@@_renew_footnote_starred: |
| 15870 |
\@@_start_list_tag:n {keyans*} |
| 15871 |
\@@_fake_make_label_viii:n {#1} |
| 15872 |
\@@_stop_start_list_tag: |
| 15873 |
\@@_minipage:w [ t ]{ \l_@@_joined_width_viii_dim } |
| 15874 |
\dim_set_eq:NN \parindent \l_@@_listparindent_viii_dim |
| 15875 |
\skip_set_eq:NN \parskip \l_@@_parsep_viii_skip |
| 15876 |
\@@_unskip_unkern: |
| 15877 |
\@@_unskip_unkern: |
| 15878 |
\skip_horizontal:n { -\l_@@_listparindent_viii_dim } \ignorespaces |
| 15879 |
\tl_use:N \l_@@_fake_item_indent_viii_tl |
| 15880 |
\bool_if:NT \l_@@_item_starred_viii_bool |
| 15881 |
{ |
| 15882 |
\@@_keyans_show_item_opt_viii: |
| 15883 |
} |
| 15884 |
\tl_use:N \l_@@_after_list_args_viii_tl |
| 15885 |
} |
| 15886 |
\cs_new_protected_nopar:Nn \@@_stop_item_viii: |
| 15887 |
{ |
| 15888 |
\@@_endminipage: |
| 15889 |
\@@_stop_list_tag:n {keyans*} |
| 15890 |
\hbox_set_end: |
| 15891 |
\int_set:Nn \hbadness { 10000 } |
| 15892 |
\box_use_drop:N \l_@@_item_text_viii_box |
| 15893 |
\int_compare:nNnTF |
| 15894 |
{ \l_@@_item_column_pos_viii_int } = { \l_@@_columns_viii_int } |
| 15895 |
{ |
| 15896 |
\par\noindent |
| 15897 |
\int_zero:N \l_@@_item_column_pos_viii_int |
| 15898 |
} |
| 15899 |
{ |
| 15900 |
\skip_horizontal:N \l_@@_columns_sep_viii_dim |
| 15901 |
} |
| 15902 |
} |
| 15903 |
% \end{macrocode} |
| 15904 |
% \end{macro} |
| 15905 |
% |
| 15906 |
% \begin{macro}{\@@_remove_extra_parsep_viii:} |
| 15907 |
% The implementation at this is very similar to that of the |
| 15908 |
% \myenv*{enumext*} environment. |
| 15909 |
% \iffalse |
| 15910 |
%% Remove extra \parsep in |keyans*| environment. |
| 15911 |
% \fi |
| 15912 |
% \begin{macrocode} |
| 15913 |
\cs_new_protected:Nn \@@_remove_extra_parsep_viii: |
| 15914 |
{ |
| 15915 |
\int_compare:nNnT |
| 15916 |
{ |
| 15917 |
\int_mod:nn |
| 15918 |
{ \g_@@_item_count_all_viii_int } |
| 15919 |
{ \l_@@_columns_viii_int } |
| 15920 |
} |
| 15921 |
= |
| 15922 |
{ 0 } |
| 15923 |
{ |
| 15924 |
\para_end: |
| 15925 |
\skip_vertical:n { -\l_@@_itemsep_viii_skip } |
| 15926 |
\skip_vertical:N \c_zero_skip |
| 15927 |
\int_gzero:N \g_@@_item_count_all_viii_int |
| 15928 |
} |
| 15929 |
} |
| 15930 |
% \end{macrocode} |
| 15931 |
% \end{macro} |
| 15932 |
% |
| 15933 |
% \subsection{The command \cs{getkeyans}}\label{cmd:getkeyans} |
| 15934 |
% |
| 15935 |
% \begin{macro}{\getkeyans, \@@_getkeyans_aux:n, \@@_getkeyans:nn} |
| 15936 |
% The \ics*{getkeyans} command takes a \emph{mandatory argument} of the |
| 15937 |
% form \mymarg{store name \textcolor{red}{:} position}. |
| 15938 |
% Retrieve a \emph{\enquote{single content}} stored by \ics*{anskey}, \ics*{anspic*} |
| 15939 |
% and \ics*{item*} and \myenv*{anskey*} from \emph{prop list} defined by \mykey{save-ans} key. |
| 15940 |
% \iffalse |
| 15941 |
%% Define |\getkeyans|. |
| 15942 |
% \fi |
| 15943 |
% \begin{macrocode} |
| 15944 |
\NewDocumentCommand \getkeyans { m } |
| 15945 |
{ |
| 15946 |
\exp_args:Ne \@@_getkeyans_aux:n |
| 15947 |
{ \tl_to_str:e { \text_expand:n {#1} } } |
| 15948 |
} |
| 15949 |
% \end{macrocode} |
| 15950 |
% The internal function \cs{@@_getkeyans_aux:n} is in charge of |
| 15951 |
% \emph{splitting} the \emph{mandatory argument} using \enquote{\textcolor{red}{:}}. |
| 15952 |
% If \enquote{\textcolor{red}{:}} is omitted it will return an error. |
| 15953 |
% \iffalse |
| 15954 |
%% Internal functions for |\getkeyans|. |
| 15955 |
% \fi |
| 15956 |
% \begin{macrocode} |
| 15957 |
\cs_new_protected:Npn \@@_getkeyans_aux:n #1 |
| 15958 |
{ |
| 15959 |
\str_if_in:nnTF {#1} { : } |
| 15960 |
{ |
| 15961 |
\use:e |
| 15962 |
{ |
| 15963 |
\cs_set:Npn \exp_not:N \@@_tmp:w ##1 \c_colon_str ##2 \scan_stop: |
| 15964 |
{ {##1} {##2} } |
| 15965 |
} |
| 15966 |
\exp_after:wN \@@_getkeyans:nn \@@_tmp:w #1 \scan_stop: |
| 15967 |
} |
| 15968 |
{ \msg_error:nnn { enumext } { missing-colon } {#1} } |
| 15969 |
} |
| 15970 |
% \end{macrocode} |
| 15971 |
% The internal function \cs{@@_getkeyans:nn} will check for the existence |
| 15972 |
% of the \emph{prop list}, if it does not exist it will return an error |
| 15973 |
% message, then it will fetch the content specified by the \emph{second argument} |
| 15974 |
% from \emph{prop list}. |
| 15975 |
% \begin{macrocode} |
| 15976 |
\cs_new_protected:Npn \@@_getkeyans:nn #1 #2 |
| 15977 |
{ |
| 15978 |
\prop_if_exist:cTF { g_@@_#1_prop } |
| 15979 |
{ |
| 15980 |
\prop_item:cn { g_@@_#1_prop }{#2} |
| 15981 |
} |
| 15982 |
{ |
| 15983 |
\msg_error:nnn { enumext } { undefined-storage-anskey } {#1} |
| 15984 |
} |
| 15985 |
} |
| 15986 |
% \end{macrocode} |
| 15987 |
% \end{macro} |
| 15988 |
% |
| 15989 |
% \subsection{The command \cs{printkeyans}}\label{cmd:printkeyans} |
| 15990 |
% |
| 15991 |
% The \ics*{printkeyans} command prints \emph{\enquote{all stored |
| 15992 |
% content}} in the \emph{sequence} defined by the \mykey{save-ans} key. |
| 15993 |
% |
| 15994 |
% The first thing we will do is define a set of \mymeta{filtered keys} with |
| 15995 |
% which we will control the options of the different nesting levels for |
| 15996 |
% the environment \myenv*{enumext} and \myenv*{enumext*} by storing their |
| 15997 |
% values in the list of tokens \myvarenv{l__@@_print_keyans_X_tl}. |
| 15998 |
% |
| 15999 |
% \smallskip |
| 16000 |
% |
| 16001 |
% The variable \cs{l_@@_print_keyans_starred_tl} will have the default \mymeta{keys} |
| 16002 |
% for \ics*{printkeyans*} and will be set by |\setenumext|\myoarg{print\textnormal{\textcolor{MediumOrchid}{\texttt{*}}}} |
| 16003 |
% and the variable \cs{l__@@_print_keyans_vii_tl} will have the default |
| 16004 |
% keys for the environment \myenv*{enumext*} nested within the \emph{sequence} |
| 16005 |
% and will be set by |\setenumext|\myoarg{print \textnormal{\textcolor{gray}{,}}\textnormal{\textcolor{MediumOrchid}{\texttt{*}}}}, |
| 16006 |
% the rest of the variables will be for the environment \myenv*{enumext} and will be set |
| 16007 |
% by |\setenumext|\myoarg{print \textnormal{\textcolor{gray}{,}} level}. |
| 16008 |
% |
| 16009 |
% \iffalse |
| 16010 |
%% Add keys for |\printkeyans|. |
| 16011 |
% \fi |
| 16012 |
% \begin{macrocode} |
| 16013 |
\keys_define:nn { enumext / print } |
| 16014 |
{ |
| 16015 |
print* .code:n = \keys_precompile:neN { enumext / enumext* } |
| 16016 |
{ \@@_filter_save_key:n {#1} } |
| 16017 |
\l_@@_print_keyans_starred_tl, % starred cmd |
| 16018 |
print* .initial:n = { labelwidth=0pt, labelsep=0.3333em, itemindent=0pt, list-offset=0pt, |
| 16019 |
rightmargin=0pt, listparindent=0pt, nosep, label=\arabic*., |
| 16020 |
columns=2, first=\small, font=\small }, |
| 16021 |
print-1 .code:n = \keys_precompile:neN { enumext / level-1 } |
| 16022 |
{ \@@_filter_save_key:n {#1} } |
| 16023 |
\l_@@_print_keyans_i_tl, |
| 16024 |
print-1 .initial:n = { labelwidth=0pt, labelsep=0.3333em, itemindent=0pt, list-offset=0pt, |
| 16025 |
rightmargin=0pt, listparindent=0pt, nosep, label=\arabic*., |
| 16026 |
columns=2, first=\small, font=\small }, |
| 16027 |
print-2 .code:n = \keys_precompile:neN { enumext / level-2 } |
| 16028 |
{ \@@_filter_save_key:n {#1} } |
| 16029 |
\l_@@_print_keyans_ii_tl, |
| 16030 |
print-2 .initial:n = { labelwidth=0pt, labelsep=0.3333em, itemindent=0pt, list-offset=0pt, |
| 16031 |
rightmargin=0pt, listparindent=0pt, nosep, label=(\alph*), |
| 16032 |
first=\small, font=\small }, |
| 16033 |
print-3 .code:n = \keys_precompile:neN { enumext / level-3 } |
| 16034 |
{ \@@_filter_save_key:n {#1} } |
| 16035 |
\l_@@_print_keyans_iii_tl, |
| 16036 |
print-3 .initial:n = { labelwidth=0pt, labelsep=0.3333em, itemindent=0pt, list-offset=0pt, |
| 16037 |
rightmargin=0pt, listparindent=0pt, nosep, label=\roman*., |
| 16038 |
first=\small, font=\small }, |
| 16039 |
print-4 .code:n = \keys_precompile:neN { enumext / level-4 } |
| 16040 |
{ \@@_filter_save_key:n {#1} } |
| 16041 |
\l_@@_print_keyans_iv_tl, |
| 16042 |
print-4 .initial:n = { labelwidth=0pt, labelsep=0.3333em, itemindent=0pt, list-offset=0pt, |
| 16043 |
rightmargin=0pt, listparindent=0pt, nosep, label=\Alph*., |
| 16044 |
first=\small, font=\small }, |
| 16045 |
print-* .code:n = \keys_precompile:neN { enumext / enumext* } |
| 16046 |
{ \@@_filter_save_key:n {#1} } |
| 16047 |
\l_@@_print_keyans_vii_tl, % starred nested |
| 16048 |
print-* .initial:n = { labelwidth=0pt, labelsep=0.3333em, itemindent=0pt, list-offset=0pt, |
| 16049 |
rightmargin=0pt, listparindent=0pt, nosep, label=\arabic*., |
| 16050 |
first=\small, font=\small }, |
| 16051 |
} |
| 16052 |
% \end{macrocode} |
| 16053 |
% |
| 16054 |
% \begin{important}* |
| 16055 |
% The reason for storing \mymeta{keys} in token lists using |
| 16056 |
% \cs{keys_precompile:neN} is because the keys are set via |
| 16057 |
% \ics*{setenumext} but are later executed by running the command |
| 16058 |
% \ics*{printkeyans} and they are not handled directly by its |
| 16059 |
% \emph{optional argument}, except those related to the \emph{first} |
| 16060 |
% opening level. |
| 16061 |
% \end{important} |
| 16062 |
% |
| 16063 |
% \begin{macro}{\printkeyans, \@@_printkeyans:nnn} |
| 16064 |
% Create a user command to print \emph{\enquote{all stored content}} |
| 16065 |
% in \emph{sequence} for \ics*{anskey}, \myenv*{anskey*}, \ics*{item*} and \ics*{anspic*}. |
| 16066 |
% Within a group we will run our \emph{\enquote{precompiled keys}} and |
| 16067 |
% then call the internal function \cs{@@_printkeyans:nnn}. |
| 16068 |
% \iffalse |
| 16069 |
%% Define |\printkeyans|. |
| 16070 |
% \fi |
| 16071 |
% \begin{macrocode} |
| 16072 |
\NewDocumentCommand \printkeyans { s O{} m } |
| 16073 |
{ |
| 16074 |
\group_begin: |
| 16075 |
\bool_set_true:N \l_@@_print_keyans_cmd_bool |
| 16076 |
\tl_use:N \l_@@_print_keyans_i_tl |
| 16077 |
\tl_use:N \l_@@_print_keyans_ii_tl |
| 16078 |
\tl_use:N \l_@@_print_keyans_iii_tl |
| 16079 |
\tl_use:N \l_@@_print_keyans_iv_tl |
| 16080 |
\tl_use:N \l_@@_print_keyans_vii_tl |
| 16081 |
\@@_printkeyans:nnn { #1 } { #2 } { #3 } |
| 16082 |
\bool_set_false:N \l_@@_print_keyans_cmd_bool |
| 16083 |
\group_end: |
| 16084 |
} |
| 16085 |
% \end{macrocode} |
| 16086 |
% The internal function \cs{@@_printkeyans:nnn} will check |
| 16087 |
% for the existence of the \emph{sequence}, if it does not exist |
| 16088 |
% it will return an error message, then it will check if not empty. |
| 16089 |
% \iffalse |
| 16090 |
%% Internal function for |\printkeyans|. |
| 16091 |
% \fi |
| 16092 |
% \begin{macrocode} |
| 16093 |
\cs_new_protected:Npn \@@_printkeyans:nnn #1 #2 #3 |
| 16094 |
{ |
| 16095 |
\seq_if_exist:cTF { g_@@_#3_seq } |
| 16096 |
{ |
| 16097 |
\seq_if_empty:cF { g_@@_#3_seq } |
| 16098 |
{ |
| 16099 |
% \end{macrocode} |
| 16100 |
% If the \emph{starred argument} ‘|*|’ is present we will check that |
| 16101 |
% the environment \myenv*{enumext*} is not saved in the \emph{sequence}, |
| 16102 |
% then execute the variable \cs{l_@@_print_keyans_starred_tl} that |
| 16103 |
% contains the default \mymeta{keys} for the environment \myenv*{enumext*}, |
| 16104 |
% we set \cs{l_@@_base_line_fix_bool} and \cs{l_@@_print_keyans_star_bool} |
| 16105 |
% to true for \emph{baseline correction}, open the \myenv*{enumext*} |
| 16106 |
% environment passing the \emph{optional argument} and map the \emph{sequence}, |
| 16107 |
% then set \cs{l_@@_base_line_fix_bool} and \cs{l_@@_print_keyans_star_bool} |
| 16108 |
% to false. |
| 16109 |
% \begin{macrocode} |
| 16110 |
\bool_if:nTF {#1} |
| 16111 |
{ |
| 16112 |
\seq_if_in:cnTF { g_@@_#3_seq } { \end{enumext*} } |
| 16113 |
{ |
| 16114 |
\msg_error:nnnn { enumext } { print-starred } {#3} { enumext* } |
| 16115 |
} |
| 16116 |
{ |
| 16117 |
\tl_use:N \l_@@_print_keyans_starred_tl |
| 16118 |
\bool_set_true:N \l_@@_base_line_fix_bool |
| 16119 |
\bool_set_true:N \l_@@_print_keyans_star_bool |
| 16120 |
\begin{enumext*}[#2] |
| 16121 |
\seq_map_inline:cn { g_@@_#3_seq } { ##1 } |
| 16122 |
\end{enumext*} |
| 16123 |
\bool_set_false:N \l_@@_base_line_fix_bool |
| 16124 |
\bool_set_false:N \l_@@_print_keyans_star_bool |
| 16125 |
} |
| 16126 |
} |
| 16127 |
% \end{macrocode} |
| 16128 |
% Otherwise it will open the environment \myenv*{enumext} passing |
| 16129 |
% the \emph{optional argument} to the \emph{\enquote{first level}} |
| 16130 |
% then map the \emph{sequence}. |
| 16131 |
% \begin{macrocode} |
| 16132 |
{ |
| 16133 |
\begin{enumext}[#2] |
| 16134 |
\seq_map_inline:cn { g_@@_#3_seq } { ##1 } |
| 16135 |
\end{enumext} |
| 16136 |
} |
| 16137 |
} |
| 16138 |
} |
| 16139 |
{ |
| 16140 |
\msg_error:nnn { enumext } { undefined-storage-anskey } {#3} |
| 16141 |
} |
| 16142 |
} |
| 16143 |
% \end{macrocode} |
| 16144 |
% \end{macro} |
| 16145 |
% |
| 16146 |
% \subsection{The command \cs{setenumext}}\label{cmd:setenumext} |
| 16147 |
% |
| 16148 |
% The command |\setenumext| will be in charge of managing the |
| 16149 |
% \mymeta{keys} passed to all environments and to the |\printkeyans| |
| 16150 |
% command. We must take precautions with the \myenv*{enumext*} and \myenv*{enumext} |
| 16151 |
% environments so as not to capture \mymeta{keys} that complicate us. |
| 16152 |
% |
| 16153 |
% \begin{macro}{\@@_filter_level:n, \@@_filter_level_key:n, |
| 16154 |
% \@@_filter_level_pair:nn,} |
| 16155 |
% The function \cs{@@_filter_level:n} will be in charge of |
| 16156 |
% filtering the \mymeta{keys} passed to the \myenv*{enumext} |
| 16157 |
% and \myenv*{enumext*} environments. |
| 16158 |
% \iffalse |
| 16159 |
%% Internal function for filter keys in |\setenumext| for |enumext| and |enumext*|. |
| 16160 |
% \fi |
| 16161 |
% \begin{macrocode} |
| 16162 |
\cs_new:Npn \@@_filter_level:n #1 |
| 16163 |
{ |
| 16164 |
\use:e |
| 16165 |
{ |
| 16166 |
\keyval_parse:NNn |
| 16167 |
\@@_filter_level_key:n |
| 16168 |
\@@_filter_level_pair:nn {#1} |
| 16169 |
} |
| 16170 |
} |
| 16171 |
% \end{macrocode} |
| 16172 |
% The function \cs{@@_filter_level_key:n} will be responsible for |
| 16173 |
% filtering the \mymeta{keys} that are passed \emph{\enquote{without value}} by |
| 16174 |
% excluding the keys \mykey{resume*}, \mykey{reset} and \mykey{reset*} |
| 16175 |
% passed to the \myenv*{enumext} and \myenv*{enumext*} environments. |
| 16176 |
% \begin{macrocode} |
| 16177 |
\cs_new:Npn \@@_filter_level_key:n #1 |
| 16178 |
{ |
| 16179 |
\str_case:nnF {#1} |
| 16180 |
{ |
| 16181 |
{ resume* } {} { reset } {} { reset* } {} |
| 16182 |
} |
| 16183 |
{ , { \exp_not:n {#1} } } |
| 16184 |
} |
| 16185 |
% \end{macrocode} |
| 16186 |
% The function \cs{@@_filter_level_pair:nn} will be responsible for |
| 16187 |
% filtering the \mymeta{keys} that are passed \emph{\enquote{with value}} by |
| 16188 |
% excluding the \mykey{series}, \mykey{resume} and \mykey{save-ans} keys |
| 16189 |
% passed to the \myenv*{enumext} and \myenv*{enumext*} environments. |
| 16190 |
% \begin{macrocode} |
| 16191 |
\cs_new:Npn \@@_filter_level_pair:nn #1#2 |
| 16192 |
{ |
| 16193 |
\str_case:nnF {#1} |
| 16194 |
{ |
| 16195 |
{ series } {} { save-ans } {} { resume } {} |
| 16196 |
} |
| 16197 |
{ , { \exp_not:n {#1} } = { \exp_not:n {#2} } } |
| 16198 |
} |
| 16199 |
% \end{macrocode} |
| 16200 |
% \end{macro} |
| 16201 |
% |
| 16202 |
% Now define a \emph{\enquote{meta families}} of \mymeta{keys} |
| 16203 |
% to access from \ics*{setenumext}. |
| 16204 |
% |
| 16205 |
% \iffalse |
| 16206 |
%% Add keys for |\setenumext|. |
| 16207 |
% \fi |
| 16208 |
% \begin{macrocode} |
| 16209 |
\keys_define:nn { enumext / meta-families } |
| 16210 |
{ |
| 16211 |
enumext-1 .code:n = { |
| 16212 |
\keys_set:ne { enumext / level-1 } |
| 16213 |
{ |
| 16214 |
\@@_filter_level:n {#1} |
| 16215 |
} |
| 16216 |
}, |
| 16217 |
enumext-2 .code:n = { |
| 16218 |
\keys_set:ne { enumext / level-2 } |
| 16219 |
{ |
| 16220 |
\@@_filter_level:n {#1} |
| 16221 |
} |
| 16222 |
}, |
| 16223 |
enumext-3 .code:n = { |
| 16224 |
\keys_set:ne { enumext / level-3 } |
| 16225 |
{ |
| 16226 |
\@@_filter_level:n {#1} |
| 16227 |
} |
| 16228 |
}, |
| 16229 |
enumext-4 .code:n = { |
| 16230 |
\keys_set:ne { enumext / level-4 } |
| 16231 |
{ |
| 16232 |
\@@_filter_level:n {#1} |
| 16233 |
} |
| 16234 |
}, |
| 16235 |
enumext* .code:n = { |
| 16236 |
\keys_set:ne { enumext / enumext* } |
| 16237 |
{ |
| 16238 |
\@@_filter_level:n {#1} |
| 16239 |
} |
| 16240 |
}, |
| 16241 |
keyans .code:n = { \keys_set:nn { enumext / keyans } {#1} }, |
| 16242 |
keyans* .code:n = { \keys_set:nn { enumext / keyans* } {#1} }, |
| 16243 |
print* .code:n = { \keys_set:nn { enumext / print } { print* = {#1} } }, |
| 16244 |
print-1 .code:n = { \keys_set:nn { enumext / print } { print-1 = {#1} } }, |
| 16245 |
print-2 .code:n = { \keys_set:nn { enumext / print } { print-2 = {#1} } }, |
| 16246 |
print-3 .code:n = { \keys_set:nn { enumext / print } { print-3 = {#1} } }, |
| 16247 |
print-4 .code:n = { \keys_set:nn { enumext / print } { print-4 = {#1} } }, |
| 16248 |
print-* .code:n = { \keys_set:nn { enumext / print } { print-* = {#1} } }, |
| 16249 |
unknown .code:n = { \msg_error:nn { enumext } { unknown-key-family } }, |
| 16250 |
} |
| 16251 |
% \end{macrocode} |
| 16252 |
% We store them in the constant sequence \cs{c_@@_all_families_seq} |
| 16253 |
% separated by commas. |
| 16254 |
% \begin{macrocode} |
| 16255 |
\seq_const_from_clist:Nn \c_@@_all_families_seq |
| 16256 |
{ |
| 16257 |
enumext-1, enumext-2, enumext-3, enumext-4, keyans, enumext*, |
| 16258 |
keyans*, print-1, print-2, print-3, print-4, print-*, print*, |
| 16259 |
} |
| 16260 |
% \end{macrocode} |
| 16261 |
% |
| 16262 |
% \begin{macro}{\setenumext, \@@_set_parse:n, \@@_set_error:nn,} |
| 16263 |
% Now we define the user command \ics*{setenumext}. |
| 16264 |
% \iffalse |
| 16265 |
%% Define |\setenumext|. |
| 16266 |
% \fi |
| 16267 |
% \begin{macrocode} |
| 16268 |
\NewDocumentCommand \setenumext { O{enumext,1} +m } |
| 16269 |
{ |
| 16270 |
\seq_clear:N \l_@@_setkey_tmpa_seq |
| 16271 |
\seq_set_from_clist:Nn \l_@@_setkey_tmpb_seq {#1} |
| 16272 |
\int_set:Nn \l_@@_setkey_tmpa_int |
| 16273 |
{ |
| 16274 |
\seq_count:N \l_@@_setkey_tmpb_seq |
| 16275 |
} |
| 16276 |
\int_compare:nNnTF { \l_@@_setkey_tmpa_int } > { 1 } |
| 16277 |
{ |
| 16278 |
\seq_pop_left:NN \l_@@_setkey_tmpb_seq \l_@@_setkey_tmpa_tl |
| 16279 |
\seq_map_function:NN \l_@@_setkey_tmpb_seq \@@_set_parse:n |
| 16280 |
\seq_set_map_e:NNn \l_@@_setkey_tmpa_seq \l_@@_setkey_tmpa_seq |
| 16281 |
{ |
| 16282 |
\tl_use:N \l_@@_setkey_tmpa_tl - ##1 |
| 16283 |
} |
| 16284 |
} |
| 16285 |
{ |
| 16286 |
\seq_put_right:Ne \l_@@_setkey_tmpa_seq { \tl_trim_spaces:n {#1} } |
| 16287 |
} |
| 16288 |
\seq_if_empty:NTF \l_@@_setkey_tmpa_seq |
| 16289 |
{ \seq_map_inline:Nn \c_@@_all_families_seq } |
| 16290 |
{ \seq_map_inline:Nn \l_@@_setkey_tmpa_seq } |
| 16291 |
{ |
| 16292 |
\keys_set:nn { enumext / meta-families } { ##1 = {#2} } |
| 16293 |
} |
| 16294 |
} |
| 16295 |
% \end{macrocode} |
| 16296 |
% Internal functions used by the \ics*{setenumext} command. |
| 16297 |
% \begin{macrocode} |
| 16298 |
\cs_new_protected:Npn \@@_set_parse:n #1 |
| 16299 |
{ |
| 16300 |
\tl_set:Ne \l_@@_setkey_tmpb_tl { \tl_trim_spaces:n {#1} } |
| 16301 |
\clist_map_inline:nn { 0, 1, 2, 3, 4, * } % <- max level |
| 16302 |
{ \tl_remove_all:Nn \l_@@_setkey_tmpb_tl {##1} } |
| 16303 |
\tl_if_empty:NTF \l_@@_setkey_tmpb_tl |
| 16304 |
{ |
| 16305 |
\seq_put_right:Ne \l_@@_setkey_tmpa_seq |
| 16306 |
{ \tl_trim_spaces:n {#1} } |
| 16307 |
} |
| 16308 |
{ \@@_set_error:nn {#1} { } } |
| 16309 |
} |
| 16310 |
\cs_new_protected:Npn \@@_set_error:nn #1 #2 |
| 16311 |
{ \msg_error:nnnn { enumext } { invalid-key } {#1} {#2} } |
| 16312 |
% \end{macrocode} |
| 16313 |
% \end{macro} |
| 16314 |
% |
| 16315 |
% \subsection{The command \cs{setenumextmeta}}\label{cmd:setenumextmeta} |
| 16316 |
% |
| 16317 |
% The command \ics*{setenumextmeta} will be responsible for adding new |
| 16318 |
% \emph{\enquote{meta-keys}} for the \myenv*{enumext} and \myenv*{enumext*} environments. |
| 16319 |
% The implementation code was given by Jonathan P. Spratte \texttt{(@Skillmon)} |
| 16320 |
% answer in \href{https://tex.stackexchange.com/a/747159}{Simplify syntax for command that adds \texttt{.meta} key to existing keys (l3keys)}. |
| 16321 |
% |
| 16322 |
% \begin{macro}{\setenumextmeta, \@@_key_set_meta:nnn, |
| 16323 |
% \@@_key_def_meta:nnn, \@@_key_def_meta:Vnn, } |
| 16324 |
% First we will create a \mymeta{keys} of type |.code:n| for \emph{\enquote{all levels}} |
| 16325 |
% of the \myenv*{enumext} environment. |
| 16326 |
% \iffalse |
| 16327 |
%% Define |.code:n| and |.meta:n| for |\setenumextmeta|. |
| 16328 |
% \fi |
| 16329 |
% \begin{macrocode} |
| 16330 |
\int_step_inline:nn { 4 } |
| 16331 |
{ |
| 16332 |
\keys_define:nn { enumext } |
| 16333 |
{ |
| 16334 |
#1 .code:n = \str_set:Nn \l_@@_meta_path_str { level-#1 } |
| 16335 |
,#1 .value_forbidden:n = true |
| 16336 |
} |
| 16337 |
} |
| 16338 |
% \end{macrocode} |
| 16339 |
% And now we define the \mymeta{keys} for the environments using |
| 16340 |
% |.code:n| for the \myenv*{enumext} environment and |.meta:n| for the |
| 16341 |
% \myenv*{enumext*} environment. |
| 16342 |
% \begin{macrocode} |
| 16343 |
\clist_map_inline:nn { enumext } |
| 16344 |
{ |
| 16345 |
\keys_define:nn { enumext } |
| 16346 |
{ |
| 16347 |
#1 .code:n = % ignored for now, might do something useful in the future |
| 16348 |
,#1 .value_forbidden:n = true |
| 16349 |
,#1* .code:n = \str_set:Nn \l_@@_meta_path_str { #1* } |
| 16350 |
,#1* .value_forbidden:n = true |
| 16351 |
} |
| 16352 |
} |
| 16353 |
\keys_define:nn { enumext } |
| 16354 |
{ |
| 16355 |
* .meta:n = enumext* |
| 16356 |
,* .value_forbidden:n = true |
| 16357 |
} |
| 16358 |
% \end{macrocode} |
| 16359 |
% Now we create the user command taking care that \texttt{unknown} |
| 16360 |
% cannot be passed as an argument. |
| 16361 |
% \begin{macrocode} |
| 16362 |
\NewDocumentCommand \setenumextmeta { s O{enumext,1} m +m } |
| 16363 |
{ |
| 16364 |
\str_if_eq:eeTF { \tl_trim_spaces:n {#3} } { unknown } |
| 16365 |
{ \msg_error:nn { enumext } { prohibited-unknown } } |
| 16366 |
{ |
| 16367 |
\bool_if:nTF {#1} |
| 16368 |
{ |
| 16369 |
\int_step_inline:nn { 4 } |
| 16370 |
{ \@@_key_set_meta:nnn { enumext, ##1 } {#3} {#4} } |
| 16371 |
\@@_key_set_meta:nnn { enumext* } {#3} {#4} |
| 16372 |
} |
| 16373 |
{ \@@_key_set_meta:nnn {#2} {#3} {#4} } |
| 16374 |
} |
| 16375 |
} |
| 16376 |
% \end{macrocode} |
| 16377 |
% The internal functions \cs{@@_key_set_meta:nnn} and \cs{@@_key_def_meta:nnn} |
| 16378 |
% will check the \emph{optional argument} and create the \emph{\enquote{meta-key}}. |
| 16379 |
% \begin{macrocode} |
| 16380 |
\cs_new_protected:Npn \@@_key_set_meta:nnn #1 |
| 16381 |
{ |
| 16382 |
\keys_set:nn { enumext } {#1} |
| 16383 |
\@@_key_def_meta:Vnn \l_@@_meta_path_str |
| 16384 |
} |
| 16385 |
\cs_new_protected:Npn \@@_key_def_meta:nnn #1#2#3 |
| 16386 |
{ |
| 16387 |
\bool_lazy_or:nnTF |
| 16388 |
{ \keys_if_exist_p:nn { enumext / #1} {#2} } |
| 16389 |
{ \keys_if_exist_p:nn { enumext / enumext* } {#2} } |
| 16390 |
{ \msg_error:nnn { enumext } { already-defined } {#2} } |
| 16391 |
{ |
| 16392 |
\keys_define:nn { enumext / #1 } |
| 16393 |
{ |
| 16394 |
#2 .meta:n = {#3}, |
| 16395 |
#2 .value_forbidden:n = true |
| 16396 |
} |
| 16397 |
} |
| 16398 |
} |
| 16399 |
\cs_generate_variant:Nn \@@_key_def_meta:nnn { V } |
| 16400 |
% \end{macrocode} |
| 16401 |
% \end{macro} |
| 16402 |
% |
| 16403 |
% \subsection{The command \cs{foreachkeyans}}\label{cmd:foreachkeyans} |
| 16404 |
% |
| 16405 |
% The command \ics*{foreachkeyans} will execute a \emph{loop} over the \emph{prop list} and return its contents. |
| 16406 |
% The implementation code is adapted from the answer provided by Enrico Gregorio \texttt{(@egreg)} in |
| 16407 |
% \href{https://tex.stackexchange.com/a/721130}{Expand a \texttt{.cs} defined by key inside the function}. |
| 16408 |
% |
| 16409 |
% \begin{macro}{\foreachkeyans, \@@_parse_foreach_keys:nn, |
| 16410 |
% \@@_parse_foreach_keys:n, \@@_foreach_keyans:nn, |
| 16411 |
% \@@_foreach_add_body:n} |
| 16412 |
% We define a set of \mymeta{keys} for command and we will save the |
| 16413 |
% default values of these in \cs{g_@@_foreach_default_keys_tl} to avoid |
| 16414 |
% the use of group. |
| 16415 |
% \iffalse |
| 16416 |
%% Define |\foreachkeyans|. |
| 16417 |
% \fi |
| 16418 |
% \begin{macrocode} |
| 16419 |
\keys_define:nn { enumext / foreach } |
| 16420 |
{ |
| 16421 |
before .tl_set:N = \l_@@_foreach_before_tl, |
| 16422 |
before .value_required:n = true, |
| 16423 |
after .tl_set:N = \l_@@_foreach_after_tl, |
| 16424 |
after .value_required:n = true, |
| 16425 |
start .int_set:N = \l_@@_foreach_start_int, |
| 16426 |
start .value_required:n = true, |
| 16427 |
stop .int_set:N = \l_@@_foreach_stop_int, |
| 16428 |
stop .value_required:n = true, |
| 16429 |
step .int_set:N = \l_@@_foreach_step_int, |
| 16430 |
step .value_required:n = true, |
| 16431 |
wrapper .cs_set_protected:Np = \@@_foreach_wrapper:n #1, |
| 16432 |
wrapper .value_required:n = true, |
| 16433 |
sep .tl_set:N = \l_@@_foreach_sep_tl, |
| 16434 |
sep .value_required:n = true, |
| 16435 |
unknown .code:n = { \@@_parse_foreach_keys:n {#1} } |
| 16436 |
} |
| 16437 |
\keys_precompile:nnN { enumext / foreach } |
| 16438 |
{ |
| 16439 |
before={},after={},start=1,step=1,stop=0,wrapper=#1,sep={; } |
| 16440 |
} |
| 16441 |
\l_@@_foreach_default_keys_tl |
| 16442 |
% \end{macrocode} |
| 16443 |
% Functions for handling unknown \mymeta{keys}. |
| 16444 |
% \begin{macrocode} |
| 16445 |
\cs_new_protected:Npn \@@_parse_foreach_keys:nn #1#2 |
| 16446 |
{ |
| 16447 |
\tl_if_blank:nTF {#2} |
| 16448 |
{ |
| 16449 |
\msg_error:nnn { enumext } { for-key-unknown } {#1} |
| 16450 |
} |
| 16451 |
{ |
| 16452 |
\msg_error:nnnn { enumext } { for-key-value-unknown } {#1} {#2} |
| 16453 |
} |
| 16454 |
} |
| 16455 |
\cs_new_protected:Npn \@@_parse_foreach_keys:n #1 |
| 16456 |
{ |
| 16457 |
\exp_args:NV \@@_parse_foreach_keys:nn \l_keys_key_str {#1} |
| 16458 |
} |
| 16459 |
% \end{macrocode} |
| 16460 |
% We create the command. |
| 16461 |
% \begin{macrocode} |
| 16462 |
\NewDocumentCommand \foreachkeyans { +O{} m } |
| 16463 |
{ |
| 16464 |
\@@_foreach_keyans:nn {#1} {#2} |
| 16465 |
} |
| 16466 |
% \end{macrocode} |
| 16467 |
% Finally the internal functions \cs{@@_foreach_keyans:nn} and |
| 16468 |
% \cs{@@_foreach_add_body:n} will loop through the prop list and print |
| 16469 |
% the contents. |
| 16470 |
% \begin{macrocode} |
| 16471 |
\cs_new_protected:Npn \@@_foreach_keyans:nn #1 #2 |
| 16472 |
{ |
| 16473 |
\tl_use:N \l_@@_foreach_default_keys_tl |
| 16474 |
\keys_set:nn { enumext / foreach } {#1} |
| 16475 |
\tl_set:Nn \l_@@_foreach_name_prop_tl {#2} |
| 16476 |
\prop_if_exist:cF { g_@@_#2_prop } |
| 16477 |
{ |
| 16478 |
\msg_error:nnn { enumext } { undefined-storage-anskey } {#2} |
| 16479 |
} |
| 16480 |
\int_compare:nNnT { \l_@@_foreach_stop_int } = { 0 } |
| 16481 |
{ |
| 16482 |
\int_set:Nn \l_@@_foreach_stop_int |
| 16483 |
{ \prop_count:c { g_@@_#2_prop } } |
| 16484 |
} |
| 16485 |
\seq_clear:N \l_@@_foreach_print_seq |
| 16486 |
\int_step_function:nnnN |
| 16487 |
{ \l_@@_foreach_start_int } |
| 16488 |
{ \l_@@_foreach_step_int } |
| 16489 |
{ \l_@@_foreach_stop_int } |
| 16490 |
\@@_foreach_add_body:n |
| 16491 |
\seq_use:NV \l_@@_foreach_print_seq \l_@@_foreach_sep_tl |
| 16492 |
} |
| 16493 |
\cs_new_protected:Npn \@@_foreach_add_body:n #1 |
| 16494 |
{ |
| 16495 |
\seq_put_right:Ne \l_@@_foreach_print_seq |
| 16496 |
{ |
| 16497 |
\exp_not:V \l_@@_foreach_before_tl |
| 16498 |
\@@_foreach_wrapper:n |
| 16499 |
{ |
| 16500 |
\prop_item:cn { g_@@_ \l_@@_foreach_name_prop_tl _prop }{#1} |
| 16501 |
} |
| 16502 |
\exp_not:V \l_@@_foreach_after_tl |
| 16503 |
} |
| 16504 |
} |
| 16505 |
% \end{macrocode} |
| 16506 |
% \end{macro} |
| 16507 |
% |
| 16508 |
% \subsection{Messages} |
| 16509 |
% |
| 16510 |
% \iffalse |
| 16511 |
%% Messages. |
| 16512 |
% \fi |
| 16513 |
% Message used by package-load for \mypkg{multicol} and \mypkg{hyperref} |
| 16514 |
% packages. |
| 16515 |
% \begin{macrocode} |
| 16516 |
\msg_new:nnn { enumext } { package-load } |
| 16517 |
{ |
| 16518 |
The~'#1'~package~is~already~loaded. |
| 16519 |
} |
| 16520 |
\msg_new:nnn { enumext } { package-not-load } |
| 16521 |
{ |
| 16522 |
The~'#1'~package~will~be~loaded~as~a~dependency. |
| 16523 |
} |
| 16524 |
% \end{macrocode} |
| 16525 |
% |
| 16526 |
% Message used in the creation of counters by \mypkg*{enumext} package. |
| 16527 |
% \begin{macrocode} |
| 16528 |
\msg_new:nnn { enumext } { counters } |
| 16529 |
{ |
| 16530 |
The~counter~'#1'~is~already~defined~by~some~\\ |
| 16531 |
package~or~macro,~it~cannot~be~continued. |
| 16532 |
} |
| 16533 |
% \end{macrocode} |
| 16534 |
% |
| 16535 |
% Message used by \mykey{align} and \mykey{mark-pos} keys. |
| 16536 |
% \begin{macrocode} |
| 16537 |
\msg_new:nnn { enumext } { unknown-choice } |
| 16538 |
{ |
| 16539 |
The~value~'#3'~for~'#1'~key~is~invalid~use~('#2'). |
| 16540 |
} |
| 16541 |
% \end{macrocode} |
| 16542 |
% |
| 16543 |
% Message used by reserved \myenv*{anskey*} environment by \mypkg*{enumext} |
| 16544 |
% package. |
| 16545 |
% \begin{macrocode} |
| 16546 |
\msg_new:nnnn { enumext } { anskey-env-error } |
| 16547 |
{ |
| 16548 |
The~environment~'#1'~is~reserved~by ~\\ |
| 16549 |
'enumext'~package,~It~is~already~defined. |
| 16550 |
} |
| 16551 |
{ |
| 16552 |
The~environment~'#1'~is~defined~internally ~ |
| 16553 |
for~the~'save-ans'~key~with~save-ans~key~active.~See~documentation.\\ |
| 16554 |
} |
| 16555 |
% \end{macrocode} |
| 16556 |
% |
| 16557 |
% Message used in the creation of \emph{prop list} by \mypkg*{enumext} |
| 16558 |
% package. |
| 16559 |
% \begin{macrocode} |
| 16560 |
\msg_new:nnn { enumext } { store-prop } |
| 16561 |
{ |
| 16562 |
*~Package~enumext:~Creating ~ |
| 16563 |
\c_backslash_str g_@@_#1_prop~\msg_line_context:. |
| 16564 |
} |
| 16565 |
\msg_new:nnn { enumext } { store-seq } |
| 16566 |
{ |
| 16567 |
*~Package~enumext:~Creating ~ |
| 16568 |
\c_backslash_str g_@@_#1_seq~\msg_line_context:. |
| 16569 |
} |
| 16570 |
\msg_new:nnn { enumext } { store-int } |
| 16571 |
{ |
| 16572 |
*~Package~enumext:~Creating ~ |
| 16573 |
\c_backslash_str g_@@_resume_#1_int~\msg_line_context:. |
| 16574 |
} |
| 16575 |
\msg_new:nnn { enumext } { prop-seq-int-hook } |
| 16576 |
{ |
| 16577 |
*~Package~enumext:~Elements~in ~ |
| 16578 |
\c_backslash_str g_@@_#1_prop~=~#2.\\ |
| 16579 |
*~Package~enumext:~Elements~in ~ |
| 16580 |
\c_backslash_str g_@@_#1_seq~=~#3.\\ |
| 16581 |
*~Package~enumext:~Value~off ~ |
| 16582 |
\c_backslash_str g_@@_resume_#1_int~=~#4. |
| 16583 |
} |
| 16584 |
\msg_new:nnn { enumext } { item-answer-hook } |
| 16585 |
{ |
| 16586 |
*~Package~enumext:~Value~off ~ |
| 16587 |
\c_backslash_str g_@@_item_number_int~=~#1.\\ |
| 16588 |
*~Package~enumext:~Value~off ~ |
| 16589 |
\c_backslash_str g_@@_item_anskey_int~=~#2.\\ |
| 16590 |
*~Package~enumext:~Difference~item_number_int~-~item_anskey_int~=~#3. |
| 16591 |
} |
| 16592 |
% \end{macrocode} |
| 16593 |
% |
| 16594 |
% Message used by \myoarg{key \textnormal{\textcolor{gray}{=}} val} |
| 16595 |
% system and \ics*{setenumext} command. |
| 16596 |
% \begin{macrocode} |
| 16597 |
\msg_new:nnn { enumext } { invalid-key } |
| 16598 |
{ |
| 16599 |
The~key~'#1'~is~not~know~the~level~#2. |
| 16600 |
} |
| 16601 |
\msg_new:nnn { enumext } { unknown-key-family } |
| 16602 |
{ |
| 16603 |
Unknown~key~family~`\l_keys_key_str'~for~enumext. |
| 16604 |
} |
| 16605 |
% \end{macrocode} |
| 16606 |
% Messages used in length calculation. |
| 16607 |
% \begin{macrocode} |
| 16608 |
\msg_new:nnn { enumext } { width-negative } |
| 16609 |
{ |
| 16610 |
Ignoring~negative~value~'#1=#2'~\msg_line_context:.\\ |
| 16611 |
The~key~'#1'~ accepts~values ~>=~0pt. |
| 16612 |
} |
| 16613 |
% \end{macrocode} |
| 16614 |
% Messages used by \mykey{show-length} key in \myenv*{enumext}. |
| 16615 |
% \begin{macrocode} |
| 16616 |
\msg_new:nnn { enumext } { list-lengths } |
| 16617 |
{ |
| 16618 |
****~Lengths~used~by~'enumext'~level~'#2'~\msg_line_context:~\c_space_tl ****\\ |
| 16619 |
\@@_show_length:nnn { dim } { labelsep } {#1} |
| 16620 |
\@@_show_length:nnn { dim } { labelwidth } {#1} |
| 16621 |
\@@_show_length:nnn { dim } { itemindent } {#1} |
| 16622 |
\@@_show_length:nnn { dim } { leftmargin } {#1} |
| 16623 |
\@@_show_length:nnn { dim } { rightmargin } {#1} |
| 16624 |
\@@_show_length:nnn { dim } { listparindent } {#1} |
| 16625 |
\@@_show_length:nnn { skip } { topsep } {#1} |
| 16626 |
\@@_show_length:nnn { skip } { parsep } {#1} |
| 16627 |
\@@_show_length:nnn { skip } { partopsep } {#1} |
| 16628 |
\@@_show_length:nnn { skip } { itemsep } {#1} |
| 16629 |
**************************************************** |
| 16630 |
} |
| 16631 |
% \end{macrocode} |
| 16632 |
% |
| 16633 |
% Messages used by \mykey{show-length} key in \myenv*{enumext*}, |
| 16634 |
% \myenv*{keyans*} and \myenv*{keyans}. |
| 16635 |
% \begin{macrocode} |
| 16636 |
\msg_new:nnn { enumext } { list-lengths-not-nested } |
| 16637 |
{ |
| 16638 |
****~Lengths~used~by~'#2'~environment~\msg_line_context:~\c_space_tl ****\\ |
| 16639 |
\@@_show_length:nnn { dim } { labelsep } {#1} |
| 16640 |
\@@_show_length:nnn { dim } { labelwidth } {#1} |
| 16641 |
\@@_show_length:nnn { dim } { itemindent } {#1} |
| 16642 |
\@@_show_length:nnn { dim } { leftmargin } {#1} |
| 16643 |
\@@_show_length:nnn { dim } { rightmargin } {#1} |
| 16644 |
\@@_show_length:nnn { dim } { listparindent } {#1} |
| 16645 |
\@@_show_length:nnn { skip } { topsep } {#1} |
| 16646 |
\@@_show_length:nnn { skip } { parsep } {#1} |
| 16647 |
\@@_show_length:nnn { skip } { partopsep } {#1} |
| 16648 |
\@@_show_length:nnn { skip } { itemsep } {#1} |
| 16649 |
**************************************************** |
| 16650 |
} |
| 16651 |
% \end{macrocode} |
| 16652 |
% |
| 16653 |
% Messages used by \mykey{ref} key. |
| 16654 |
% \begin{macrocode} |
| 16655 |
\msg_new:nnn { enumext } { key-ref-empty } |
| 16656 |
{ |
| 16657 |
Key~'ref'~need~a~value~in~'#1'~ \msg_line_context:. |
| 16658 |
} |
| 16659 |
% \end{macrocode} |
| 16660 |
% |
| 16661 |
% Messages used by \mykey{save-ans} key. |
| 16662 |
% \begin{macrocode} |
| 16663 |
\msg_new:nnn { enumext } { save-ans-empty } |
| 16664 |
{ |
| 16665 |
Key~'save-ans'~need~a~value~in~'#1'~ \msg_line_context:. |
| 16666 |
} |
| 16667 |
\msg_new:nnn { enumext } { save-ans-log } |
| 16668 |
{ |
| 16669 |
*~Package~enumext:~Start~#1\c_space_tl with~save-ans=#2~\msg_line_context:. |
| 16670 |
} |
| 16671 |
\msg_new:nnn { enumext } { save-ans-log-hook } |
| 16672 |
{ |
| 16673 |
*~Package~enumext:~Stop~#1\c_space_tl with~save-ans=#2~\msg_line_context:. |
| 16674 |
} |
| 16675 |
% \end{macrocode} |
| 16676 |
% |
| 16677 |
% Messages used by the internal system to check answer used by |
| 16678 |
% \mykey{check-ans} key. |
| 16679 |
% \begin{macrocode} |
| 16680 |
\msg_new:nnn { enumext } { items-same-answer } |
| 16681 |
{ |
| 16682 |
****************************************\\ |
| 16683 |
*~Package~enumext:~Checking~answers~in~'#1' ~ |
| 16684 |
for~\c_left_brace_str #2 \c_right_brace_str\\ |
| 16685 |
*~started~#3~and~close~\msg_line_context: : ~ |
| 16686 |
'OK',~all~items~with~answer.\\ |
| 16687 |
**************************************** |
| 16688 |
} |
| 16689 |
\msg_new:nnn { enumext } { item-greater-answer } |
| 16690 |
{ |
| 16691 |
Checking~answers~in~'#1'~for~\c_left_brace_str #2 \c_right_brace_str\\ |
| 16692 |
started~#3~and~close~\msg_line_context: : ~'NOT~OK'\\ |
| 16693 |
Items~>~Answers. |
| 16694 |
} |
| 16695 |
\msg_new:nnn { enumext } { item-less-answer } |
| 16696 |
{ |
| 16697 |
Checking~answers~in~'#1'~for~\c_left_brace_str #2 \c_right_brace_str\\ |
| 16698 |
started~#3~and~close~\msg_line_context: : ~'NOT~OK'\\ |
| 16699 |
Items~<~Answers. |
| 16700 |
} |
| 16701 |
% \end{macrocode} |
| 16702 |
% Messages used by the internal system to check for |
| 16703 |
% \emph{\enquote{starred}} |\item*| and |\anspic*| commands. |
| 16704 |
% \begin{macrocode} |
| 16705 |
\msg_new:nnn { enumext } { missing-starred } |
| 16706 |
{ |
| 16707 |
Missing~'\c_backslash_str #1*'~#2. |
| 16708 |
} |
| 16709 |
\msg_new:nnn { enumext } { many-starred } |
| 16710 |
{ |
| 16711 |
Many~'\c_backslash_str #1*'~#2. |
| 16712 |
} |
| 16713 |
% \end{macrocode} |
| 16714 |
% Messages used by |\printkeyans*| command. |
| 16715 |
% \begin{macrocode} |
| 16716 |
\msg_new:nnn { enumext } { print-starred } |
| 16717 |
{ |
| 16718 |
\c_backslash_str printkeyans*:~ The~sequence~'#1'~already~contains ~ |
| 16719 |
#2~environment~ \msg_line_context:. |
| 16720 |
} |
| 16721 |
% \end{macrocode} |
| 16722 |
% Message for the nesting depth of the environment \myenv*{enumext}. |
| 16723 |
% \begin{macrocode} |
| 16724 |
\msg_new:nnn { enumext } { list-too-deep } |
| 16725 |
{ |
| 16726 |
Too~deep~nesting ~for~'enumext'~\msg_line_context:.~ \\ |
| 16727 |
The~maximum ~level ~of ~nesting ~is~4. |
| 16728 |
} |
| 16729 |
% \end{macrocode} |
| 16730 |
% Messages used by \ics*{anskey}, \myenv*{anskey*} and \ics*{anspic} commands. |
| 16731 |
% \begin{macrocode} |
| 16732 |
\msg_new:nnn { enumext } { anskey-unnumber-item } |
| 16733 |
{ |
| 16734 |
Can't~store~with~a~unnumbered~\c_backslash_str item~\msg_line_context:. |
| 16735 |
} |
| 16736 |
\msg_new:nnn { enumext } { anskey-empty-arg } |
| 16737 |
{ |
| 16738 |
Can't~store~empty~content~\msg_line_context:. |
| 16739 |
} |
| 16740 |
\msg_new:nnn { enumext } { anskey-wrong-place } |
| 16741 |
{ |
| 16742 |
Wrong~place~for~command~'\c_backslash_str #1'~\msg_line_context:.~ \\ |
| 16743 |
'\c_backslash_str #1'~works~in~the~environment~'#2'. |
| 16744 |
} |
| 16745 |
\msg_new:nnn { enumext } { anskey-nested } |
| 16746 |
{ |
| 16747 |
The~command~\c_backslash_str anskey~ can't~be~nested~\msg_line_context:. |
| 16748 |
} |
| 16749 |
\msg_new:nnn { enumext } { anskey-math-mode } |
| 16750 |
{ |
| 16751 |
#1~can't~work~in~math~mode~\msg_line_context:. |
| 16752 |
} |
| 16753 |
\msg_new:nnn { enumext } { anskey-env-wrong } |
| 16754 |
{ |
| 16755 |
The~environment~anskey*~cannot~use~in~'#1'~\msg_line_context:. |
| 16756 |
} |
| 16757 |
\msg_new:nnn { enumext } { command-wrong-place } |
| 16758 |
{ |
| 16759 |
Wrong~place~for~command~'\c_backslash_str #1'~\msg_line_context:.~ \\ |
| 16760 |
'\c_backslash_str #1'~works~outside~the~environment~'#2'. |
| 16761 |
} |
| 16762 |
\msg_new:nnnn { enumext } { anskey-env-key-unknown } |
| 16763 |
{ |
| 16764 |
The~key~'#1'~is~unknown~by~environment~ |
| 16765 |
'anskey*'~and~is~being~ignored. |
| 16766 |
} |
| 16767 |
{ |
| 16768 |
The~environment~'anskey*'~does~not~have~a~key~called ~'#1'.\\ |
| 16769 |
Check~that~you~have~spelled~the~key~name~correctly. |
| 16770 |
} |
| 16771 |
\msg_new:nnnn { enumext } { anskey-env-key-value-unknown } |
| 16772 |
{ |
| 16773 |
The~key~'#1=#2'~is~unknown~by~environment ~ |
| 16774 |
'anskey*'~and~is~being~ignored. |
| 16775 |
} |
| 16776 |
{ |
| 16777 |
The~environment~'anskey*'~does~not~have~a~key~called ~'#1'.\\ |
| 16778 |
Check~that~you~have~spelled~the~key~name~correctly. |
| 16779 |
} |
| 16780 |
\msg_new:nnnn { enumext } { anskey-cmd-key-unknown } |
| 16781 |
{ The~key~'#1'~is~unknown~by~'\c_backslash_str anskey'~and~is~being~ignored.} |
| 16782 |
{ |
| 16783 |
The~command ~'\c_backslash_str anskey'~does~not~have~a~key~called ~'#1'.\\ |
| 16784 |
Check~that~you~have~spelled~the~key~name~correctly. |
| 16785 |
} |
| 16786 |
\msg_new:nnnn { enumext } { anskey-cmd-key-value-unknown } |
| 16787 |
{ The~key~'#1=#2'~is~unknown~by~'\c_backslash_str anskey'~and~is~being~ignored. } |
| 16788 |
{ |
| 16789 |
The~command~'\c_backslash_str anskey'~does~not~have~a~key~called ~'#1'.\\ |
| 16790 |
Check~that~you~have~spelled~the~key~name~correctly. |
| 16791 |
} |
| 16792 |
\msg_new:nnn { enumext } { overwrite-file } |
| 16793 |
{ |
| 16794 |
Overwriting~file~'#1'. |
| 16795 |
} |
| 16796 |
\msg_new:nnn { enumext } { writing-file } |
| 16797 |
{ |
| 16798 |
Writing~file~'#1'. |
| 16799 |
} |
| 16800 |
\msg_new:nnn { enumext } { not-writing } |
| 16801 |
{ |
| 16802 |
File~`#1'~already~exists.~Not~writing. |
| 16803 |
} |
| 16804 |
% \end{macrocode} |
| 16805 |
% |
| 16806 |
% Messages used by \myenv*{keyans}, \myenv*{keyans*} and \myenv*{keyanspic} |
| 16807 |
% environment. |
| 16808 |
% \begin{macrocode} |
| 16809 |
\msg_new:nnn { enumext } { keyans-nested } |
| 16810 |
{ |
| 16811 |
The~environment~'keyans'~can't~be ~nested ~\msg_line_context:. |
| 16812 |
} |
| 16813 |
\msg_new:nnn { enumext } { keyans-wrong-level } |
| 16814 |
{ |
| 16815 |
Wrong~level~position~for~'keyans'~\msg_line_context:.~ \\ |
| 16816 |
The~environment~'keyans'~can~only~be~in~the~first~level. |
| 16817 |
} |
| 16818 |
\msg_new:nnn { enumext } { wrong-place } |
| 16819 |
{ |
| 16820 |
Wrong~place~for~'#1'~environment ~\msg_line_context:.~ \\ |
| 16821 |
'#1'~is~only~found~with~'#2'~ in ~ 'enumext. |
| 16822 |
} |
| 16823 |
\msg_new:nnn { enumext } { keyanspic-nested } |
| 16824 |
{ |
| 16825 |
The~environment~'keyanspic'~can't~be ~nested~ \msg_line_context:.~. |
| 16826 |
} |
| 16827 |
\msg_new:nnn { enumext } { keyanspic-wrong-level } |
| 16828 |
{ |
| 16829 |
Wrong~level~position~for~'keyanspic'~\msg_line_context:.~ \\ |
| 16830 |
The~environment~'keyans'~can~only~be~in~the~first~level. |
| 16831 |
} |
| 16832 |
\msg_new:nnn { enumext } { keyanspic-item-cmd } |
| 16833 |
{ |
| 16834 |
Can't~use ~\c_backslash_str item~in~keyanspic~\msg_line_context:. |
| 16835 |
} |
| 16836 |
\msg_new:nnnn { enumext } { keyans-unknown-key } |
| 16837 |
{ |
| 16838 |
The~key~'#1'~is~unknown~by~environment~ |
| 16839 |
'\l_@@_envir_name_tl'~and~is~being~ignored. |
| 16840 |
} |
| 16841 |
{ |
| 16842 |
The~environment~'\l_@@_envir_name_tl'~does~not |
| 16843 |
~have~a~key~called ~'#1'.\\ |
| 16844 |
Check~that~you~have~spelled~the~key~name~correctly. |
| 16845 |
} |
| 16846 |
\msg_new:nnnn { enumext } { keyans-unknown-key-value } |
| 16847 |
{ |
| 16848 |
The~key~'#1=#2'~is~unknown~by~environment ~ |
| 16849 |
'\l_@@_envir_name_tl'~and~is~being~ignored. |
| 16850 |
} |
| 16851 |
{ |
| 16852 |
The~environment~'\l_@@_envir_name_tl'~does~not |
| 16853 |
~have~a~key~called ~'#1'.\\ |
| 16854 |
Check~that~you~have~spelled~the~key~name~correctly. |
| 16855 |
} |
| 16856 |
% \end{macrocode} |
| 16857 |
% |
| 16858 |
% Message used by unknown \mymeta{keys} in \myenv*{enumext*}. |
| 16859 |
% environment. |
| 16860 |
% \begin{macrocode} |
| 16861 |
\msg_new:nnnn { enumext } { starred-unknown-key } |
| 16862 |
{ |
| 16863 |
The~key~'#1'~is~unknown~by~environment~ |
| 16864 |
'\l_@@_envir_name_tl'~and~is~being~ignored. |
| 16865 |
} |
| 16866 |
{ |
| 16867 |
The~environment~'\l_@@_envir_name_tl'~does~not |
| 16868 |
~have~a~key~called ~'#1'.\\ |
| 16869 |
Check~that~you~have~spelled~the~key~name~correctly. |
| 16870 |
} |
| 16871 |
\msg_new:nnnn { enumext } { starred-unknown-key-value } |
| 16872 |
{ |
| 16873 |
The~key~'#1=#2'~is~unknown~by~environment ~ |
| 16874 |
'\l_@@_envir_name_tl'~and~is~being~ignored. |
| 16875 |
} |
| 16876 |
{ |
| 16877 |
The~environment~'\l_@@_envir_name_tl'~does~not |
| 16878 |
~have~a~key~called ~'#1'.\\ |
| 16879 |
Check~that~you~have~spelled~the~key~name~correctly. |
| 16880 |
} |
| 16881 |
% \end{macrocode} |
| 16882 |
% Message used by unknown \mymeta{keys} in \myenv*{enumext} |
| 16883 |
% environment. |
| 16884 |
% \begin{macrocode} |
| 16885 |
\msg_new:nnnn { enumext } { standar-unknown-key } |
| 16886 |
{ |
| 16887 |
The~key~'#1'~is~unknown~by~environment~'\l_@@_envir_name_tl' \c_space_tl |
| 16888 |
~on~level~\int_use:N \l_@@_level_int \c_space_tl and~is~being~ignored. |
| 16889 |
} |
| 16890 |
{ |
| 16891 |
The~environment~'\l_@@_envir_name_tl'~does~not |
| 16892 |
~have~a~key~called ~'#1'~on~level~\int_use:N \l_@@_level_int.\\ |
| 16893 |
Check~that~you~have~spelled~the~key~name~correctly. |
| 16894 |
} |
| 16895 |
\msg_new:nnnn { enumext } { standar-unknown-key-value } |
| 16896 |
{ |
| 16897 |
The~key~'#1=#2'~is~unknown~by~environment~'\l_@@_envir_name_tl' \c_space_tl |
| 16898 |
~on~level~\int_use:N \l_@@_level_int \c_space_tl and~is~being~ignored. |
| 16899 |
} |
| 16900 |
{ |
| 16901 |
The~environment~'\l_@@_envir_name_tl'~does~not |
| 16902 |
~have~a~key~called ~'#1'~on~level~\int_use:N \l_@@_level_int.\\ |
| 16903 |
Check~that~you~have~spelled~the~key~name~correctly. |
| 16904 |
} |
| 16905 |
% \end{macrocode} |
| 16906 |
% Message used by unknown \mymeta{keys} in \ics*{foreachkeyans}. |
| 16907 |
% \begin{macrocode} |
| 16908 |
\msg_new:nnnn { enumext } { for-key-unknown } |
| 16909 |
{ The~key~'#1'~is~unknown~by~'\c_backslash_str foreachkeyans'~and~is~being~ignored.} |
| 16910 |
{ |
| 16911 |
The~command~'\c_backslash_str foreachkeyans'~does~not~have~a~key~called~'#1'.\\ |
| 16912 |
Check~that~you~have~spelled~the~key~name~correctly. |
| 16913 |
} |
| 16914 |
\msg_new:nnnn { enumext } { for-key-value-unknown } |
| 16915 |
{ The~key~'#1=#2'~is~unknown~by~'\c_backslash_str foreachkeyans'~and~is~being~ignored. } |
| 16916 |
{ |
| 16917 |
The~command~'\c_backslash_str foreachkeyans'~does~not~have~a~key~called~'#1'.\\ |
| 16918 |
Check~that~you~have~spelled~the~key~name~correctly. |
| 16919 |
} |
| 16920 |
% \end{macrocode} |
| 16921 |
% |
| 16922 |
% Messages used by \ics*{getkeyans} command. |
| 16923 |
% \begin{macrocode} |
| 16924 |
\msg_new:nnn { enumext } { undefined-storage-anskey } |
| 16925 |
{ |
| 16926 |
Storage~named~'#1'~is~not~defined~\msg_line_context:. |
| 16927 |
} |
| 16928 |
% \end{macrocode} |
| 16929 |
% |
| 16930 |
% Messages used by \ics*{miniright} command. |
| 16931 |
% \begin{macrocode} |
| 16932 |
\msg_new:nnn { enumext } { missing-miniright } |
| 16933 |
{ |
| 16934 |
Missing~'\c_backslash_str miniright'~in~\msg_line_context:.\\ |
| 16935 |
The~key~'mini-env'~need~'\c_backslash_str miniright'. |
| 16936 |
} |
| 16937 |
\msg_new:nnn { enumext } { wrong-miniright-place } |
| 16938 |
{ |
| 16939 |
Wrong~place~for~'\c_backslash_str miniright'~\msg_line_context:.~ \\ |
| 16940 |
Works~in~'enumext'~and~'keyans'~with~key~'mini-env'. |
| 16941 |
} |
| 16942 |
\msg_new:nnn { enumext } { wrong-miniright-use } |
| 16943 |
{ |
| 16944 |
Wrong~use~for~'\c_backslash_str miniright'~\msg_line_context:.~ \\ |
| 16945 |
'\c_backslash_str miniright'~need~a~key~'mini-env'. |
| 16946 |
} |
| 16947 |
\msg_new:nnn { enumext } { wrong-miniright-starred } |
| 16948 |
{ |
| 16949 |
Can't~use ~\c_backslash_str miniright~in~starred~environments~\msg_line_context:. |
| 16950 |
} |
| 16951 |
\msg_new:nnn { enumext } { many-miniright-used } |
| 16952 |
{ |
| 16953 |
Can't~use ~\c_backslash_str miniright~more~than~once~ \msg_line_context:. |
| 16954 |
} |
| 16955 |
% \end{macrocode} |
| 16956 |
% Messages used by \ics*{setenumextmeta} command. |
| 16957 |
% \begin{macrocode} |
| 16958 |
\msg_new:nnn { enumext } { already-defined } |
| 16959 |
{ |
| 16960 |
The~key~'#1'~is~already~defined~\msg_line_context:. |
| 16961 |
} |
| 16962 |
\msg_new:nnn { enumext } { prohibited-unknown } |
| 16963 |
{ |
| 16964 |
The~name~'unknown'~can't~be~chosen~ for~a~meta~key~\msg_line_context:. |
| 16965 |
} |
| 16966 |
% \end{macrocode} |
| 16967 |
% Messages used by \myenv*{enumext*} and \myenv*{keyans*} environments. |
| 16968 |
% \begin{macrocode} |
| 16969 |
\msg_new:nnn { enumext } { nested } |
| 16970 |
{ |
| 16971 |
The~environment~\l_@@_envir_name_tl \c_space_tl can't~be~nested~\msg_line_context:. |
| 16972 |
} |
| 16973 |
\msg_new:nnn { enumext } { nested-horizontal } |
| 16974 |
{ |
| 16975 |
The~environment~\l_@@_envir_name_tl \c_space_tl can't~be~nested~in~'#1'~ \msg_line_context:. |
| 16976 |
} |
| 16977 |
\msg_new:nnn { enumext } { item-joined } |
| 16978 |
{ |
| 16979 |
Items~joined~(#1)~>~#2 ~columns ~\msg_line_context:. |
| 16980 |
} |
| 16981 |
\msg_new:nnn { enumext } { item-joined-columns } |
| 16982 |
{ |
| 16983 |
Not~space~to~join~items~(#1)~>~#2 ~\msg_line_context:. |
| 16984 |
} |
| 16985 |
% \end{macrocode} |
| 16986 |
% Messages used by \mykey{resume} key. |
| 16987 |
% \begin{macrocode} |
| 16988 |
\msg_new:nnn { enumext } { unknown-series-starred } |
| 16989 |
{ |
| 16990 |
The~series~'#1'~for~the~resume~key~does~not~exist~in~the~ |
| 16991 |
~enumext*~environment~ \msg_line_context:. |
| 16992 |
} |
| 16993 |
\msg_new:nnn { enumext } { unknown-series-standar } |
| 16994 |
{ |
| 16995 |
The~series~'#1'~for~the~resume~key~does~not~exist~at~level~\int_use:N \l_@@_level_int |
| 16996 |
\c_space_tl of~enumext~environment~ \msg_line_context:. |
| 16997 |
} |
| 16998 |
\msg_new:nnnn { enumext } { out-of-range } |
| 16999 |
{ The~number~must~be~exactly~1,~2,~3~or~4. } |
| 17000 |
{ Received:~'#1'. } |
| 17001 |
% \end{macrocode} |
| 17002 |
% \subsection{Finish package} |
| 17003 |
% |
| 17004 |
% Finish package implementation. |
| 17005 |
% |
| 17006 |
% \begin{macrocode} |
| 17007 |
\file_input_stop: |
| 17008 |
%</package> |
| 17009 |
% \end{macrocode} |
| 17010 |
% \Finale |