diff options
author | Norbert Preining <norbert@preining.info> | 2024-11-15 03:03:42 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-11-15 03:03:42 +0000 |
commit | 22e21515873b6468b5be3ed37ec5ad63be574808 (patch) | |
tree | 7a454399037a4b30e97cc518edaee0f48936be41 /macros | |
parent | 61eeeb436405039582f55c461632d4ca4a8b6b09 (diff) |
CTAN sync 202411150303
Diffstat (limited to 'macros')
21 files changed, 1342 insertions, 544 deletions
diff --git a/macros/latex/contrib/enumext/README.md b/macros/latex/contrib/enumext/README.md index 8ead16580f..bf3ac1f08c 100644 --- a/macros/latex/contrib/enumext/README.md +++ b/macros/latex/contrib/enumext/README.md @@ -1,6 +1,6 @@ ## enumext — Enumerate exercise sheets -Release v1.0 \[2024-11-01\] +Release v1.1 \[2024-11-14\] ## Description diff --git a/macros/latex/contrib/enumext/enumext.dtx b/macros/latex/contrib/enumext/enumext.dtx index 5cc3a17b60..ea8cc0f159 100644 --- a/macros/latex/contrib/enumext/enumext.dtx +++ b/macros/latex/contrib/enumext/enumext.dtx @@ -272,6 +272,14 @@ { \textcolor{\l_userdoc_meta_brackcolor_tl}{#1} } +% Rewrite \textborn | textasteriskcentered +\DeclareTextSymbol{\textbornstd}{TS1}{98} +\UndeclareTextCommand{\textborn}{TS1} +\makeatletter +\DeclareTextCommandDefault{\textbornstd}{\tc@check@symbol2\textbornstd} +\makeatother +\DeclareRobustCommand{\textborn}{{\fontfamily{lmr}\selectfont\textbornstd}} +\newcommand{\oldtextasteriskcentered}{{\fontfamily{lmr}\selectfont\textasteriskcentered}} % \envexamp{m} \newsavebox{\boxexaenv} \tl_new:N \l_tempc_tl @@ -594,7 +602,7 @@ multicolsep,leftmargini,leftmarginii, hfill, small, vspace, par, parbox, value, noindent, makebox, textcolor, % itemindent, labelwidth, leftmarginiii,leftmarginiv,itemindent, itemsep, strutbox, raggedright, cs_new_eq, N, NN,% labelwidth, fbox, addvspace, Alph, alph, arabic, Roman, roman, partopsep, baselineskip, mode_leave_vertical,% - textbullet, textendash, textasteriskcentered, textperiodcentered, raggedleft, peek_remove_spaces, skip_horizontal, % + textborn, textbullet, textendash, textasteriskcentered, textperiodcentered, raggedleft, peek_remove_spaces, skip_horizontal, % triangleright, diamond, circ, parleft, star, centering, ast, hyperlink,hypertarget,IfHyperBoolean,newtheorem, % aux_i, aux_ii, aux_iii, w, n, N, if@noitemarg, if, if@hyper@item, hyper, noitemarg, skip_vertical, },% % Other words 3 @@ -615,9 +623,9 @@ keywords = [6]{save-ans,wrap-ans,save-ref,show-pos,show-ans,columns,list-offset, eunumXi,% nosep,before,after,start, right, item-sym, item-sep, hyperfootnotes, item-star, % scale,wrap-label,font,first,widest,mini-env,list-indent, no-store, save-key,% - store-env, print-env, write-out, force-eol, write-env, overwrite, unknown, % + store-env, print-env, write-out, force-eol, write-env, overwrite, unknown, base-fix,% midsep, wrapper,label-pos,label-sep, layout-sty, layout-sep, layout-top, lang,% - pdfversion, pdfstandard, testphase, alt},% + pdfversion, pdfstandard, testphase, alt, mark-sep, wrap-ans*, mark-ans, mark-sep},% % Reserved words 7 (label values) keywordstyle = [7]{\color{MediumOrchid}},% keywords = [7]{m,s,M,VIII,viii,v,E,t,l,A,XXIII,true, false,test,sample,above,below,ua-2,phase-III,% @@ -805,16 +813,54 @@ {\strut\smash{\parbox[t]{\labelwidth}{\raggedright{#2}}}}% {\strut\smash{\parbox[t]{\labelwidth}{\raggedleft{#2}}}}% } -%%%\ExplSyntaxOn -%%5\NewDocumentCommand \labelbx { s +m } -%% { -%% %% \tag_suspend:n {\parbox} -%% \IfBooleanTF{#1} -%% { \parbox[t]{\labelwidth}{\raggedright{#2}} } -%% { \parbox[t]{\labelwidth}{\raggedleft{#2}} } -%% %% \tag_resume:n {\parbox} -%% } -%%%\ExplSyntaxOff +% For azetina sample +\newlength{\itemwd} +\settowidth{\itemwd}{\bfseries 10.} % max width +\NewDocumentCommand \rating { }{8.5a, KSC} +\ExplSyntaxOn +\bool_new:N \l_azetina_rating_bool +\NewDocumentCommand \showrating { m } + { + \str_case:nn {#1} + { + { true } + { + \bool_set_true:N \l_azetina_rating_bool + \setenumext{show-ans=true,save-sep={ }} + } + { false } + { + \bool_set_false:N \l_azetina_rating_bool + \setenumext{show-ans=false,save-sep={ }} + } + } + } +\NewDocumentCommand \myans { m +m } + { + \bool_if:NTF \l_azetina_rating_bool + { + \item*[(#1)] \textcolor{red}{#2} + } + { + \item*[(#1)] \textcolor{black}{#2} + } + } +\NewDocumentCommand \azwrapp { m } + { + \bool_if:NTF \l_azetina_rating_bool + { + \makebox[\dim_eval:n{\marginparwidth}][r] + { + \textcolor{red}{\bfseries\footnotesize\rating} + } + \hspace{\marginparsep}\textbf{#1} + } + { + \makebox[\dim_eval:n{\marginparwidth+\marginparsep}][l]{ }\textbf{#1} + } + } +\ExplSyntaxOff +\setenumextmeta[enumext,1]{azetinasty}{label={\arabic*.},labelwidth={\marginparwidth+\marginparsep+\itemwd},list-offset={-\marginparwidth-\marginparsep},} \begin{document} \DocInput{\jobname.dtx} \end{document} @@ -910,7 +956,7 @@ % % \section{Introduction} % -% In the \hologo{LaTeX} world world there are many useful packages and +% In the \hologo{LaTeX} world there are many useful packages and % classes for creating \emph{\enquote{lists of exercises}}, \emph{\enquote{worksheets}} or % \emph{\enquote{multiple choice questions}}, classes like \myclass{exam}\cite{exam} % and packages like \mypkg{xsim}\cite{xsim} do the job perfectly, but @@ -952,7 +998,7 @@ % % \smallskip % -% \begin{enumext}[save-ans=worksheet,columns=2,show-ans=true,nosep,save-ref=true] +% \begin{enumext}[save-ans=worksheet,mark-ans={\oldtextasteriskcentered},columns=2,show-ans=true,nosep,save-ref=true] % \item Factor $x^{2}-2x+1$ \anskey{$\left(x-1\right)^{2}$} % \item Factor $3x+3y+3z$ \anskey{$3(x+y+z)$} % \item True False @@ -1042,7 +1088,7 @@ % \anspic*[A duck]{\includegraphics[scale=0.30]{example-image-duck}} % \end{keyanspic} % -% \item Question with image on left side: +% \item Question with image on right side: % % \begin{keyans}[mini-env=0.5\linewidth, columns=1,noitemsep] % \item value @@ -1534,7 +1580,7 @@ % % \subsubsection{Keys for \cs[no-index]{item*}} % -% \keyexamp{item-sym\textcolor{MediumOrchid}{*}}{symbol}{\textbackslash{}textasteriskcentered} +% \keyexamp{item-sym\textcolor{MediumOrchid}{*}}{symbol}{\textbackslash{}textborn} % Sets the \emph{symbol} to be displayed in the \emph{\enquote{left}} of the % box containing the current \mymeta{label} set by \mykey{labelwidth} key for \ics*{item*} in % \myenv*{enumext} and \myenv*{enumext*}. The \emph{symbol} can be in @@ -1744,8 +1790,9 @@ % % \smallskip % -% Sets the \mymeta{label} that will be printed at the \emph{current -% level}. The default value for the first level of the environments +% Sets the \mymeta{label} that will be printed at the \emph{current level} +% and default value for \mykey{labelwidth} key. +% The default value for the first level of the environments % \myenv*{enumext} and \myenv*{enumext*} are \ilabel{arabic*.}, for % second level are \ilabel*{alph*)}, for third level are \ilabel{roman*.} % and for fourth level are \ilabel{Alph*.}. For \myenv*{keyans} @@ -1775,12 +1822,14 @@ % \smallskip % % \keyexamp{labelwidth}{rigid length}{by label} -% Sets the \emph{width} of the box containing the current \mymeta{label} set -% by \mykey{label} key. Internally sets the value of \ics{labelwidth} for the current -% level. The default values are calculated by means of the \emph{width} -% of a box by setting a \emph{value} to the current counter using ‘\mydim{0}’ for -% \ilabel{arabic*}, ‘|M|’ for \ilabel{Alph*}, ‘|m|’ for \ilabel{alph*}, ‘|VIII|’ -% for \ilabel{Roman*} and ‘|viii|’ for \ilabel{roman*}. +% Sets the \emph{width} of the box containing the current \mymeta{label} +% set by the \mykey{label} key. +% Internally sets the value of \ics{labelwidth} for the current level. +% The default values are calculated by means of the \emph{width} of a box +% by setting a \emph{value} to the current counter set by \mykey{label} +% key using ‘\mydim{0}’ for \ilabel{arabic*}, ‘|M|’ for \ilabel{Alph*}, +% ‘|m|’ for \ilabel{alph*}, ‘|VIII|’ for \ilabel{Roman*} and ‘|viii|’ +% for \ilabel{roman*}. % % \smallskip % @@ -1815,12 +1864,13 @@ % % \smallskip % -% Wraps the \emph{current} \mymeta{label} defined by \mykey{label} key referenced by |{#1}|. -% The \mymarg{code} must be passed between braces. -% This key does not modify the value set by the \mykey{labelwidth} key -% and is applied only on \ics*{item} and \ics*{item*}. +% Wraps the \emph{current} \mymeta{label} defined by \mykey{label} key +% referenced by |{#1}| after executing the \mykey{align} and \mykey{font} +% keys. The \mymarg{code} must be passed between braces and this does not +% modify the value set by the \mykey{labelwidth} key and is applied \emph{only} +% on \ics*{item} and \ics*{item*}. % When using it in the \ics*{setenumext} command it is necessary to use the -% \emph{double hash} ‘|{##1}|’. For example |wrap-label={\fbox{#1}}| +% \emph{double} ‘|{##1}|’. For example |wrap-label={\fbox{#1}}| % or you can create a command: % % \iffalse @@ -2302,8 +2352,11 @@ % \smallskip % % Set the \emph{number of columns} to be used by the \myenv{multicols} -% environment within the environment. The value must be a positive +% environment within the environments \myenv*{enumext} and \myenv*{keyans}. The value must be a positive % integer less than or equal to \mydim{10}. +% In the \myenv*{enumext*} and \myenv*{keyans*} environments they +% correspond to the default number of columns (without joining) and +% internally adjust the value of |\itemwidth|. % % \smallskip % @@ -2312,10 +2365,13 @@ % \smallskip % % Set the \emph{space between} columns used by the \myenv{multicols} -% environment within the environment. Internally sets the value of +% environment within the environments \myenv*{enumext} and \myenv*{keyans}. Internally sets the value of % \ics{columnsep}, by default its value is equal to the sum of the % values set in the keys \mykey{labelwidth} and \mykey{labelsep} of the % current level. +% In the \myenv*{enumext*} and \myenv*{keyans*} environments they +% correspond to the \emph{space between} columns (without joining) and +% internally adjust the value of |\itemwidth|. % % \subsection{Keys for \env{minipage}}\label{key:mini} % @@ -2446,14 +2502,12 @@ % % \smallskip % -%^^A \begin{important}* -% For security reasons the \emph{optional argument} of the inner levels -% or the nested environment are \emph{filtered} by excluding all \mymeta{keys} -% related to the \emph{\enquote{storage system}} (\S\ref{subsec:storage-keys}) -% along with the keys \mykey{mini-env}, \mykey{mini-sep}, \mykey{mini-right}, -% \mykey{mini-right*}, \mykey{series}, \mykey{resume} and \mykey{resume*} -% when storing in \emph{sequence} \mymarg{store name} set by \mykey{save-ans} key. -%^^A \end{important} +% For security reasons the \emph{optional argument} of the inner levels +% or the nested environment are \emph{filtered} by excluding all \mymeta{keys} +% related to the \emph{\enquote{storage system}} (\S\ref{subsec:storage-keys}) +% along with the keys \mykey{mini-env}, \mykey{mini-sep}, \mykey{mini-right}, +% \mykey{mini-right*}, \mykey{series}, \mykey{resume} and \mykey{resume*} +% when storing in \emph{sequence} \mymarg{store name} set by \mykey{save-ans} key. % % \subsection{Keys for storage system}\label{subsec:storage-keys} % @@ -2522,6 +2576,22 @@ % affects the \emph{\enquote{stored content}} and not what is displayed % when using the \mykey{show-ans} or \mykey{show-pos} keys. % +% \smallskip +% +% \keyexamp*{no-store}{value forbidden}{not used} +% +% \smallskip +% +% This is a \emph{\enquote{switch-key}} that does not receive an argument +% and disables the \emph{\enquote{storing content}} in the \emph{sequence} +% and \emph{prop list} \mymarg{store name} set by \mykey{save-ans} key at +% the entire level or a nested environment in which it runs. This key +% is intended for use in internal levels or nested \myenv*{enumext} or +% \myenv*{enumext*} environments in which you want to use \myenv*{enumext} +% or \myenv*{enumext*} but \emph{\enquote{without}} using the \ics*{anskey} +% command or use \myenv*{anskey*} environment and \emph{\enquote{without}} +% interfering with the \mykey{check-ans} key. +% % \subsubsection{Keys for \texttt{label} and \texttt{ref}}\label{subsec:label-ref} % % \keyexamp{save-ref}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false} @@ -2539,7 +2609,7 @@ % % \smallskip % -% \keyexamp{mark-ref}{symbol}{\textbackslash{}\textreferencemark} +% \keyexamp{mark-ref}{symbol}{\textbackslash{}textreferencemark} % Sets the \emph{symbol} that will be displayed by the \ics*{printkeyans} % command only if the \mypkg{hyperref} package is detected and the % \mykey{save-ref} key are active. @@ -2547,17 +2617,136 @@ % in which the \mykey{save-ans} key was used and the place where the % command is executed. % -% \subsubsection{Keys for \texttt{wrap} and \texttt{display}}\label{subsec:wrap-display} +% \subsubsection{Keys for \texttt{wrap} and \texttt{marks}}\label{subsec:wrap-display} +% +% The \mypkg*{enumext} package provides a set of \mymeta{keys} to set and +% manipulate \emph{\enquote{symbol marks}} associated with +% \emph{\enquote{answers}} and how they are displayed and stored in the +% \emph{sequence} and \emph{prop list}. +% +% \smallskip +% +% The \mymeta{keys} available for the |\anskey| command and the +% \myenv*{anskey*} environment can be passed \emph{\enquote{only}} in the +% \emph{optional argument} in the \emph{\enquote{first level}} of the +% \myenv*{enumext} or \myenv*{enumext*} environment. +% +% \smallskip +% +% The \mymeta{keys} available for the \myenv*{keyans} and +% \myenv*{keyans*} environments can be passed locally in the +% \emph{optional argument}, at the \emph{\enquote{first level}} of the +% \myenv*{enumext} or \myenv*{enumext*} environment or via the +% |\setenumext| command with one minor difference, when \mymeta{keys} are passed +% through the \emph{\enquote{first level}} of the \myenv*{enumext} or +% \myenv*{enumext*} environment they are set in \emph{\enquote{both}} +% environments, but when they are passed using the |\setenumext| command +% they are set \emph{\enquote{individually}} in each environment. +% +% \smallskip +% +% \keyexamp{show-ans}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false} +% +% Display the \emph{symbol} set by the \mykey{mark-ans} key to the left of +% the \emph{mandatory argument} \mymeta{content} passed to the |\anskey| +% command and \mymeta{body} for the \myenv*{anskey*} environment using +% the \mykey{wrap-ans} key if set. +% +% For \ics*{item*} and \ics*{anspic}|*| the \myenv*{keyans}, +% \myenv*{keyans*} and \myenv*{keyanspic} environments it will display +% the \emph{symbol} set by the \mykey{mark-ans*} key to the left of the +% current \mymeta{label} and \emph{optional argument}. If the +% \emph{optional argument} is present in \ics*{item*} or \ics*{anspic}|*| +% it will be shown using \mykey{wrap-opt} key. +% +% \subsubsection*{Keys for \texttt{\textbackslash{}anskey} and \texttt{anskey*}} +% +% \keyexamp{mark-ans}{symbol}{\textbackslash{}textasteriskcentered} +% Sets the \emph{symbol} to be displayed in the left margin for +% \ics*{anskey} command and \myenv*{anskey*} environment when using the +% key \mykey{show-ans}. The \emph{\enquote{symbol}} is placed in a box +% of width equal to the value of \mykey{labelwidth} at the current level, +% separated by the value of the key \mykey{mark-sep} and aligned by +% the value of the key \mykey{mark-pos}. This key is not affected by the +% keys \mykey{font} or \mykey{wrap-label} so if you want to apply +% \emph{styling} you have to do it directly, for example: |mark-ans={\textcolor{red}{\textbf{\textasteriskcentered}}| +% +% \smallskip +% +% \keyexamp{mark-pos}{left \textnormal{\textcolor{lightgray}{\textbar}} right \textnormal{\textcolor{lightgray}{\textbar}} center}{left} +% Sets the \emph{aligned} of the \emph{\enquote{symbol}} defined by +% \mykey{mark-ans} key for \ics*{anskey} command and \myenv*{anskey*} +% environment. The \emph{\enquote{symbol}} is aligned in a box with the +% same dimensions of the label box defined by \mykey{labelwidth} key +% on the current level and separated by the value of the \mykey{mark-sep} +% key. +% +% \smallskip +% +% \keyexamp{mark-sep}{rigid length}{labelsep} +% Sets the \emph{horizontal space} between the box containing the +% \emph{\enquote{symbol}} defined by \mykey{mark-ans} key and the +% \emph{mandatory argument} \mymeta{content} passed to the \ics*{anskey} +% command and the \emph{body} in \myenv*{anskey*} environment. +% +% \smallskip % % \keyexamp{wrap-ans}{code{} \space\usebox{\hashbox} more code}{\textbackslash{}fbox+\textbackslash{}parbox\{\#1\}} -% Wraps the \emph{argument} passed to the \ics*{anskey} and the \emph{body} in \myenv*{anskey*} environment -% referenced by |{#1}| when using the \mykey{show-ans} or \mykey{show-pos} keys. -% The \mymarg{code} must be passed between braces and only affects the -% \emph{argument} or \emph{body} and NOT the \emph{\enquote{stored +% Wraps the \emph{mandatory argument} \mymeta{content} passed to the \ics*{anskey} +% and the \mymeta{body} in \myenv*{anskey*} environment referenced by |{#1}| +% when using the \mykey{show-ans} or \mykey{show-pos} keys. +% The \mymarg{code} must be passed between braces and only affects how the +% \emph{argument} or \emph{body} is displayed and NOT the \emph{\enquote{stored % content}} in the \emph{sequence} and \emph{prop list} \mymarg{store % name} set by \mykey{save-ans} key. If this key is passed using % \ics*{setenumext} it is necessary to use double ‘|{##1}|’. % +% \subsubsection*{Keys for \texttt{keyans}, \texttt{keyans*} and \texttt{keyanspic}} +% +% \keyexamp{mark-ans\textcolor{MediumOrchid}{*}}{symbol}{\textbackslash{}textasteriskcentered} +% Sets the \emph{symbol} to be displayed in the left margin for +% \ics*{item*} and \ics*{anspic}|*| for the \myenv*{keyans}, \myenv*{keyans*} +% and \myenv*{keyanspic} environments when using the key \mykey{show-ans}. +% The \emph{\enquote{symbol}} is placed in a box of width equal to the value of +% \mykey{labelwidth} of the environment in which it is executed, separated by the value of the +% key \mykey{mark-sep*} and aligned by the value of the key +% \mykey{mark-pos*}. This key is not affected by the keys \mykey{font} or +% \mykey{wrap-label} so if you want to apply \emph{styling} you have to do it +% directly, for example: |mark-ans*={\textcolor{red}{\textbf{\textasteriskcentered}}|. +% +% \smallskip +% +% \keyexamp{mark-pos\textcolor{MediumOrchid}{*}}{left \textnormal{\textcolor{lightgray}{\textbar}} right \textnormal{\textcolor{lightgray}{\textbar}} center}{left} +% Sets the \emph{aligned} of the \emph{\enquote{symbol}} defined by +% \mykey{mark-ans*} key for the \myenv*{keyans}, \myenv*{keyans*} +% and \myenv*{keyanspic} environments. The \emph{\enquote{symbol}} is +% aligned in a box with the same dimensions of the label box defined by +% \mykey{labelwidth} key of the environment in which it is executed and +% separated by the value of the \mykey{mark-sep*} key. +% +% \smallskip +% +% \keyexamp{mark-sep\textcolor{MediumOrchid}{*}}{rigid length}{labelsep} +% Sets the \emph{horizontal space} between the box containing the +% \emph{\enquote{symbol}} defined by \mykey{mark-ans*} key and the current \mymeta{label} for +% \ics*{item*} and \ics*{anspic}|*| in the \myenv*{keyans}, \myenv*{keyans*} +% and \myenv*{keyanspic} environments. +% +% \smallskip +% +% \keyexamp{wrap-ans\textcolor{MediumOrchid}{*}}{code{} \space\usebox{\hashbox} more code}{not used} +% Wraps the \emph{current} \mymeta{label} when using the \mykey{show-ans} +% key for \ics*{item*} and \ics*{anspic}|*| referenced by |{#1}| in the +% \myenv*{keyans}, \myenv*{keyans*} and \myenv*{keyanspic} environments +% after executing the \mykey{align} and \mykey{font} keys. +% The \mymarg{code} must be passed between braces and \emph{only} affects +% how the \mymeta{label} is displayed and NOT the \emph{\enquote{stored label}} +% in the \emph{sequence} and \emph{prop list} \mymarg{store name} set by +% \mykey{save-ans} key. This key overwrites the key \mykey{wrap-label} +% and if is passed using \ics*{setenumext} it is necessary to use double ‘|{##1}|’. +% For example, if you want the \mymeta{label} to be displayed in red when +% using \mykey{show-ans} you just set |wrap-ans*={\textcolor{red}{#1}}|. +% % \smallskip % % \keyexamp{wrap-opt}{code{} \space\usebox{\hashbox} more code}{[\{\#1\}]} @@ -2571,30 +2760,6 @@ % \mymarg{store name} set by \mykey{save-ans} key. % If this key is passed using \ics*{setenumext} it is necessary to use double ‘|{##1}|’. % -% \smallskip -% -% \keyexamp{show-ans}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false} -% Displays the \emph{argument} passed to the \ics*{anskey}, the -% \emph{body} for \myenv*{anskey*} environment, the \mymeta{label} -% for \ics*{item*} and \ics*{anspic}|*| at the place where it is executed. -% If the \emph{optional argument} is present in \ics*{item*} or \ics*{anspic}|*| it will -% be shown using \mykey{wrap-opt} key. -% -% \smallskip -% -% \keyexamp{mark-ans}{symbol}{\textbackslash{}textasteriskcentered} -% Sets the \emph{symbol} to be displayed in the left margin for -% \ics*{anskey}, \myenv*{anskey*}, \ics*{item*} and \ics*{anspic}|*| in the place -% where they are executed when using the key \mykey{show-ans}. -% -% \smallskip -% -% \keyexamp{mark-pos}{left \textnormal{\textcolor{lightgray}{\textbar}} right}{left} -% Sets the \emph{aligned} of the symbol defined by \mykey{mark-ans} key. The -% \emph{\enquote{symbol}} is aligned in a box with the same dimensions of the label box -% defined by \mykey{labelwidth} key on the current level and separated by the value of the -% \mykey{labelsep} key. -% % \subsubsection{Keys for debug and checking} % % \keyexamp{show-pos}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false} @@ -2621,23 +2786,6 @@ % or \myenv*{anskey*}. It is intended to be used in conjunction with the % \mykey{no-store} key. % -% \smallskip -% -% \keyexamp*{no-store}{value forbidden}{not used} -% -% \smallskip -% -% This is a \emph{\enquote{switch-key}} that does not receive an argument -% and disables the \emph{\enquote{stored structure}} in the \emph{sequence} -% \mymarg{store name} set by \mykey{save-ans} key at the entire level -% or a nested environment in which it runs. This key -% is intended for use in internal levels or nested \myenv*{enumext} or -% \myenv*{enumext*} environments in which -% you want to use \myenv*{enumext} or \myenv*{enumext*} but \emph{\enquote{without}} using -% the \ics*{anskey},\emph{\enquote{without}} use \myenv*{anskey*}, \emph{\enquote{without}} interfering with the -% \mykey{check-ans} key and \emph{\enquote{without}} storing an unwanted -% structure in the \emph{sequence} \mymarg{store name}. -% % \subsection{The command \cs[no-index]{anskey}} % \label{sec:anskey} % @@ -2673,11 +2821,10 @@ % % \subsubsection{Keys for \cs[no-index]{anskey}} % -% By default the \mymarg{content} passed to |\anskey| when -% \emph{\enquote{storing}} in the \emph{sequence} \mymarg{store name} has -% the form |\item| \mymeta{content}, the following \mymeta{keys} allow -% modifying the way in which it is \emph{\enquote{stored}} in the -% \emph{sequence}. +% By default the \emph{mandatory argument} \mymeta{content} passed to |\anskey| +% when \emph{\enquote{storing}} in the \emph{sequence} \mymarg{store name} +% has the form |\item| \mymeta{content}, the following \mymeta{keys} allow +% modifying the way in which it is \emph{\enquote{stored}} in the \emph{sequence}. % % \smallskip % @@ -2743,7 +2890,7 @@ %</example> % \fi % -% \begin{enumext}[save-ans=test,show-ans=true,columns=2,nosep] +% \begin{enumext}[save-ans=test,mark-ans={\oldtextasteriskcentered},show-ans=true,columns=2,nosep] % \item* Text containing our instructions or questions.\anskey{first answer} % \item Text containing our instructions or questions. % \begin{enumext} @@ -2767,17 +2914,26 @@ % key are active and the \mypkg{hyperref}\cite{hyperref} package is % detected |\hyperlink| and |\hypertarget| will be used, otherwise the % usual \emph{\enquote{label and ref}} system provided by \hologo{LaTeX} will be used. -% By design the environment cannot be nested but full supports \emph{\enquote{verbatim material}} in the -% body and it is assumed that each numbered|\item| or |\item*| within the -% environment in which it is active it has a \emph{\enquote{single -% execution}} unless |\item| or |\item*| open a nested level -% or use the \mykey{no-store} key. % \end{function} % +% \smallskip +% +% By design the environment cannot be nested but full supports +% \emph{\enquote{verbatim material}} in the \mymeta{body} and it is assumed +% that \emph{\enquote{each numbered}} |\item| or |\item*| within the +% environment in which it is active it has a \emph{\enquote{single +% execution}} unless |\item| or |\item*| open a nested level +% or use the \mykey{no-store} key. +% +% \smallskip +% % The \myenv*{anskey*} environment is implemented using the \mypkg{scontents} -% package, for the correct operation |\begin{anskey*}| and |\end{anskey*}| -% must be in different lines, all \mymeta{keys} must be passed separated by -% commas and \enquote{without separation} of the start of the environment. +% package, |\begin{anskey*}| and |\end{anskey*}| must be in different lines, +% all \mymeta{keys} must be passed separated by commas and \enquote{without separation} +% of the start of the environment. +% +% \smallskip +% % Comments \enquote{\textcolor{gray}{\%}} or \enquote{any character} % after |\begin{anskey*}| or \myoarg{key \textnormal{\textcolor{gray}{=}} val} % on the same line are NOT supported, the package \mypkg{scontents} will return an @@ -2789,8 +2945,8 @@ % \subsubsection{Keys for \texttt{anskey*}} % % The \myenv*{anskey*} environment uses the same \mymeta{keys} as the -% \ics*{anskey} command next to the keys inherited from package \mypkg{scontents}. -% The environment is available for all levels of the +% \ics*{anskey} command next to the \mymeta{keys} inherited from package +% \mypkg{scontents}. The environment is available for all levels of the % \myenv*{enumext} environment and the \myenv*{enumext*} environment, but % it is disabled for the \myenv*{keyans}, \myenv*{keyans*} and % \myenv*{keyanspic} environments. @@ -2812,7 +2968,7 @@ % Sets whether the \mymeta{file.ext} generated by \mykey{write-env} % from the \myenv*{anskey*} environment will be rewritten. % -% \smallskip +% \newpage % % \keyexampenv{force-eol}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false} % @@ -2841,6 +2997,7 @@ \begin{examplecode}[frame=single] \begin{enumext}[save-ans=test,show-pos=true,start=5] \item* Text containing our instructions or questions. + \begin{anskey*}[item-star] `\mymeta{first answer}` \end{anskey*} @@ -2855,11 +3012,13 @@ \end{enumext} \item Text containing our instructions or questions. + \begin{anskey*} `\mymeta{third answer}` \end{anskey*} \item Text containing our instructions or questions. + \begin{anskey*} `\mymeta{fourth answer}` \end{anskey*} @@ -2952,6 +3111,12 @@ % as the \emph{\enquote{second level}} of the \myenv*{enumext} environment % with the difference in the \mymeta{label} which will be set to \mykey{label}=\ilabel{Alph*)}. % +% \smallskip +% +% The keys \mykey{mark-ans*}, \mykey{mark-pos*}, \mykey{mark-sep*}, \mykey{save-sep}, +% \mykey{wrap-opt}, \mykey{wrap-ans*}, \mykey{show-ans} and \mykey{show-pos} +% are available for both environments. +% % \subsubsection[The \texttt{\textbackslash item*} in \texttt{keyans}]{The \cs[no-index]{item*} in \texttt{keyans} and \texttt{keyans*}} % % \vspace*{-\baselineskip} @@ -3009,7 +3174,7 @@ %</example> % \fi % -% \begin{enumext}[save-ans=test,show-ans=true,columns=2,nosep] +% \begin{enumext}[save-ans=test,mark-ans*={\oldtextasteriskcentered},show-ans=true,columns=2,nosep] % \item Text containing a question. % % \begin{keyans*}[nosep,columns=2] @@ -3126,9 +3291,9 @@ % % \smallskip % -% This environment cannot be nested and must always be at the +% This environment cannot be nested and must \emph{always} be at the % \emph{\enquote{first level}} of the \myenv*{enumext} environment, the -% \ics*{item} command is disabled and keys cannot be set using +% \ics*{item} command is disabled and \mymeta{keys} cannot be set using % |\setenumext|. % % \subsubsection{Keys for \texttt{keyanspic}} @@ -3182,6 +3347,12 @@ % Set the \emph{vertical space} added to both the top and bottom of the environment. % Internally adjust the value of \mykey{topsep} taken from \myenv*{keyans} environment. % +% \smallskip +% +% The keys \mykey{mark-ans*}, \mykey{mark-pos*}, \mykey{mark-sep*}, \mykey{save-sep}, +% \mykey{wrap-opt}, \mykey{wrap-ans*}, \mykey{show-ans} and \mykey{show-pos} +% are available for this environment. +% % \subsubsection{The command \cs[no-index]{anspic}} % % \vspace*{-\baselineskip} @@ -3211,7 +3382,7 @@ %<*example> % \fi \begin{examplecode}[frame=single] -\begin{enumext}[save-ans=test,show-ans,nosep] +\begin{enumext}[save-ans=test,show-ans=true,nosep] \item Question with images and labels below. \begin{keyanspic}[layout-sty={3,2}] @@ -3241,13 +3412,16 @@ \anspic{\includegraphics[scale=0.15]{example-image-a}} \anspic*[note]{\includegraphics[scale=0.15]{example-image-a}} \end{keyanspic} + \end{enumext} \end{examplecode} % \iffalse %</example> % \fi % -% \begin{enumext}[save-ans=test,show-ans=true,nosep, before={\setenumext[keyans]{nosep,parsep=5mm}}] +% \newpage +% +% \begin{enumext}[save-ans=test, mark-ans*={\oldtextasteriskcentered},show-ans=true,nosep, before={\setenumext[keyans]{nosep,parsep=5mm}}] % \item Question with images and labels below. % \begin{keyanspic}[layout-sty={3,2}] % \anspic{\includegraphics[scale=0.15]{example-image-a}} @@ -3257,7 +3431,7 @@ % \anspic*[note]{\includegraphics[scale=0.15]{example-image-a}} % \end{keyanspic} % \item Question with images and labels above. -% \begin{keyanspic}[label-pos=above, layout-sty={3,2},layout-sep=0.25cm] +% \begin{keyanspic}[label-pos=above, layout-sty={3,2},layout-sep=0.25cm,layout-top=10pt] % \anspic{\includegraphics[scale=0.15]{example-image-a}} % \anspic{\includegraphics[scale=0.15]{example-image-b}} % \anspic{\includegraphics[scale=0.15]{example-image-a}} @@ -3265,7 +3439,7 @@ % \anspic*[note]{\includegraphics[scale=0.15]{example-image-a}} % \end{keyanspic} % \item Question with images and labels below on a single line. -% \begin{keyanspic} +% \begin{keyanspic}[layout-top=10pt] % \anspic{\includegraphics[scale=0.15]{example-image-a}} % \anspic{\includegraphics[scale=0.15]{example-image-b}} % \anspic{\includegraphics[scale=0.15]{example-image-a}} @@ -3296,6 +3470,9 @@ % in \emph{prop list} \mymarg{store name} defined by % \mykey{save-ans} key in the \mymeta{position} returned by the % \mykey{show-pos} key. +% +% \smallskip +% % The \emph{\enquote{stored content}} can only be accessed \emph{after} % it is stored, if \mymarg{store name} does not exist the command % will return an error. @@ -3496,7 +3673,7 @@ all the worksheets are as follows: %</example> % \fi % -% \begin{enumext}[save-ans=sampleXX,columns=1,show-pos=true,nosep,save-ref=true] +% \begin{enumext}[save-ans=sampleXX,columns=1,show-pos=true,save-ref=true] % \item Factor $3x+3y+3z$. \anskey{$3(x+y+z)$} % \item True False % \begin{enumext}[nosep] @@ -3605,7 +3782,7 @@ $ pdfdetach -saveall enumext.pdf % \textattachfile[color=red,print=false]{enumext-exa-1.tex}{\faFile*[regular]}. % % \setenumext[keyans]{label=\Alph*,font=\small,nosep,wrap-label={\fbox{\makebox[\height]{##1}}}} -% \begin{enumext}[columns=2,save-ans=sabastiano,itemsep=0pt, topsep=0pt,below*={8pt}] +% \begin{enumext}[columns=2,save-ans=sabastiano,itemsep=2pt, topsep=5pt,below*={8pt}] % \item La velocità di \SI{1,00e2}{m/s} espressa in \si{km/h} è: % % \begin{keyans} @@ -3647,7 +3824,7 @@ $ pdfdetach -saveall enumext.pdf % \end{keyans} % \end{enumext} % -% \printkeyans[columns=4]{sabastiano} +% \printkeyans[columns=1]{sabastiano} % % \subsubsection*{Example 2} % @@ -3660,7 +3837,7 @@ $ pdfdetach -saveall enumext.pdf % arara: clean: { extensions: [ aux, log, out] } \documentclass{article} \usepackage[colorlinks]{hyperref} -\usepackage{siunitx,amssymb,tikz,enumext} +\usepackage{siunitx,amssymb,tikz,enumext,libertinus} \usetikzlibrary{shapes.geometric} \sisetup{output-decimal-marker={,}} \DeclareSIUnit{\angstrom}{\textup{\AA}} @@ -3672,7 +3849,7 @@ $ pdfdetach -saveall enumext.pdf \pagestyle{empty} \begin{document} \setenumext[keyans]{label=\Alph*,font=\small,nosep,wrap-label={\mySquared{##1}}} -\begin{enumext}[columns=1,save-ans=sabastiano2,mark-pos=left,mark-ans=$\checkmark$,save-ref=true,show-ans=true,itemsep=0pt] +\begin{enumext}[columns=1,save-ans=sabastiano2,mark-sep*=2pt,mark-ans*={\textcolor{gray}{✔}},save-ref=true,show-ans=true,itemsep=0pt] \item La velocità di \qty{1,00e2}{m/s} espressa in \unit{km/h} è: \begin{keyans} \item \qty{36}{km/h}. @@ -3722,7 +3899,7 @@ $ pdfdetach -saveall enumext.pdf % 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)} % \textattachfile[color=red,print=false]{enumext-exa-2.tex}{\faFile*[regular]}. % \setenumext[keyans]{label=\Alph*,font=\small,nosep,wrap-label={\mySquared{##1}}} -% \begin{enumext}[columns=2,save-ans=sabastiano2,mark-pos=left,mark-ans=$\checkmark$,save-ref=true,show-ans=true,itemsep=0pt] +% \begin{enumext}[columns=2,save-ans=sabastiano2,mark-sep*=2pt,mark-ans*={\textcolor{gray}{✔}},save-ref=true,show-ans=true,itemsep=0pt] % \item La velocità di \SI{1,00e2}{m/s} espressa in \si{km/h} è: % \begin{keyans} % \item \SI{36}{km/h}. @@ -3791,7 +3968,7 @@ $ pdfdetach -saveall enumext.pdf \setenumextmeta[enumext,2]{myarabic}{no-store,list-offset=0.5cm,label=(\arabic*),noitemsep} \begin{enumext}[mode-box,save-ans=simplemc,columns=1,nosep,save-ref=true] \item First type of questions - \begin{keyans*}[columns=1,noitemsep] + \begin{keyans*}[columns=2,noitemsep] \item value \item*[$x=5$] correct \item value @@ -3832,7 +4009,7 @@ $ pdfdetach -saveall enumext.pdf \anspic*[A duck]{\includegraphics[scale=0.32]{example-image-duck}} \end{keyanspic} -\item Question with image on left side: +\item Question with image on right side: \begin{keyans}[mini-env=0.5\linewidth, columns=1,noitemsep] \item value \item value @@ -3856,10 +4033,10 @@ Test keys % \fi % % A \emph{\enquote{simple multiple choice}} test \textattachfile[color=red,print=false]{enumext-exa-3.tex}{\faFile*[regular]}. -% \setenumext[keyans]{label=\Alph*,font=\small,nosep,wrap-label={\myCircled{##1}}} -% \begin{enumext}[save-ans=simplemc,columns=1,nosep,save-ref=true] +% \setenumext[keyans]{labelsep=8pt,label=\Alph*,font=\small,nosep,wrap-label={\myCircled{##1}}} +% \begin{enumext}[mode-box,save-ans=simplemc,columns=1,nosep,save-ref=true] % \item First type of questions -% \begin{keyans*}[columns=2,noitemsep] +% \begin{keyans*}[labelsep=8pt,label=\Alph*,font=\small,nosep,wrap-label={\myCircled{#1}},columns=2] % \item value % \item*[$x=5$] correct % \item value @@ -3892,7 +4069,7 @@ Test keys % \end{keyans} % % \item Question with image and label below: -% \begin{keyanspic} +% \begin{keyanspic}[label-sep=3pt] % \anspic{\includegraphics[scale=0.15]{example-image-a}} % \anspic{\includegraphics[scale=0.15]{example-image-b}} % \anspic{\includegraphics[scale=0.15]{example-image-a}} @@ -3900,7 +4077,7 @@ Test keys % \anspic*[A duck]{\includegraphics[scale=0.32]{example-image-duck}} % \end{keyanspic} % -% \item Question with image on left side: +% \item Question with image on right side: % \begin{keyans}[mini-env=0.5\linewidth, columns=1,noitemsep] % \item value % \item value @@ -4110,6 +4287,166 @@ to \ref{simplews:3} is \getkeyans{simplews:3}. % % \printkeyans[columns=4]{stylesat} % +% \subsubsection*{Example 6} +% +% \iffalse +%<*example> +% \fi +\begin{filecontents*}[overwrite]{enumext-exa-6.tex} +% arara: lualatex: { branch: developer, draft: true } +% arara: lualatex: { branch: developer, draft: true } +% arara: lualatex: { branch: developer } +% arara: clean: { extensions: [ aux, log, out] } +\documentclass[letterpaper,twoside]{article} +\usepackage{xcolor,enumext,libertinus} +\newlength{\itemwd} +\settowidth{\itemwd}{\bfseries 10.} % max width +\NewDocumentCommand \rating { }{8.5a, KSC} +\ExplSyntaxOn +\bool_new:N \l_azetina_rating_bool +\NewDocumentCommand \showrating { m } + { + \str_case:nn {#1} + { + { true } + { + \bool_set_true:N \l_azetina_rating_bool + \setenumext{show-ans=true,save-sep={ }} + } + { false } + { + \bool_set_false:N \l_azetina_rating_bool + \setenumext{show-ans=false,save-sep={ }} + } + } + } +\NewDocumentCommand \myans { m +m } + { + \bool_if:NTF \l_azetina_rating_bool + { + \item*[(#1)] \textcolor{red}{#2} + } + { + \item*[(#1)] \textcolor{black}{#2} + } + } +\NewDocumentCommand \azwrapp { m } + { + \bool_if:NTF \l_azetina_rating_bool + { + \makebox[\dim_eval:n{\marginparwidth}][r] + { + \textcolor{red}{\bfseries\footnotesize\rating} + } + \hspace{\marginparsep}\textbf{#1} + } + { + \makebox[\dim_eval:n{\marginparwidth+\marginparsep}][l]{ }\textbf{#1} + } + } +\ExplSyntaxOff +\setenumextmeta[enumext,1]{azetinasty}{label={\arabic*.},labelwidth={\marginparwidth+\marginparsep+\itemwd},list-offset={-\marginparwidth-\marginparsep},} +\setenumext[keyans]{ + label={\Alph*}, + font={\bfseries}, + wrap-ans*={\textcolor{red}{\bfseries##1}}, + mark-ans*={\textcolor{red}{✔}}, + wrap-opt={ }, + } +\begin{document} + +\showrating{true} +\begin{enumext}[azetinasty,start=10,wrap-label={\azwrapp{#1}},save-ans=test2024] + \item sample + \begin{keyans} + \item sample + %\item*[(8.5a, KSC)] answer + \myans{8.5a, KSC}{answer} + \item sample + \item sample + \end{keyans} + % Renew \rating here + \RenewDocumentCommand \rating { }{9.5a, KSC} + \item sample + \begin{keyans} + \item sample + \item sample + \item sample + %\item*[(9.5a, KSC)] answer + \myans{9.5a, KSC}{answer} + \end{keyans} +\end{enumext} +\showrating{false} +\RenewDocumentCommand \rating { }{10.5a, KSC} +\begin{enumext}[resume*,save-ans=test2024] + \item sample + \begin{keyans} + \item sample + %\item*[(10.5a, KSC)] answer + \myans{10.5a, KSC}{answer} + \item sample + \item sample + \end{keyans} + % Renew \rating here + \RenewDocumentCommand \rating { }{11.5a, KSC} + \item sample + \begin{keyans} + \item sample + \item sample + \item sample + %\item*[(11.5a, KSC)] answer + \myans{11.5a, KSC}{answer} + \end{keyans} +\end{enumext} +\printkeyans[start=10]{test2024} +\end{document} +\end{filecontents*} +% \iffalse +%</example> +% \fi +% +% Adapted from the response to \href{https://tex.stackexchange.com/q/728584}{Environment for enumerate environment} +% \textattachfile[color=red,print=false]{enumext-exa-6.tex}{\faFile*[regular]}. +% \setenumext[keyans]{label={\Alph*},font={\bfseries},wrap-ans*={\textcolor{red}{\bfseries##1}},mark-ans*={\textcolor{red}{✔}},wrap-opt={ },} +% \showrating{true} +% \begin{enumext}[azetinasty,start=10,wrap-label={\azwrapp{#1}},save-ans=test2024,save-sep={ }] +% \item sample +% \begin{keyans} +% \item sample +% \item*[(8.5a, KSC)] answer +% \item sample +% \item sample +% \end{keyans} +% \RenewDocumentCommand \rating { }{9.5a, KSC} +% \item sample +% \begin{keyans} +% \item sample +% \item sample +% \item sample +% \item*[(9.5a, KSC)] answer +% \end{keyans} +% \end{enumext} +% \showrating{false} +% \RenewDocumentCommand \rating { }{10.5a, KSC} +% \begin{enumext}[resume*,save-ans=test2024] +% \item sample +% \begin{keyans} +% \item sample +% \item*[(10.5a, KSC)] answer +% \item sample +% \item sample +% \end{keyans} +% \RenewDocumentCommand \rating { }{11.5a, KSC} +% \item sample +% \begin{keyans} +% \item sample +% \item sample +% \item sample +% \item*[(11.5a, KSC)] answer +% \end{keyans} +% \end{enumext} +% \printkeyans[start=10]{test2024} +% % \section{Tagged PDF examples} % % This section is just to show the compatibility of \mypkg*{enumext} with @@ -4448,7 +4785,7 @@ Some text here \item Question B. \anskey{Answer B} \item Question C. \begin{anskey*} - Answer whit \verb+code+ and more + Answer with \verb+code+ and more \begin{verbatim} Some code here \end{verbatim} @@ -4469,7 +4806,7 @@ Some text here \item Question B. \anskey{Answer B} \item Question C. \begin{anskey*} - Answer whit \verb+code+ and more + Answer with \verb+code+ and more \begin{verbatim} Some code here \end{verbatim} @@ -5169,10 +5506,17 @@ Some text here % % \setlist[itemize,1]{label=\textendash,wide=0.5em,nosep,noitemsep,leftmargin=10pt} % \newlength\descrwidth -% \settowidth{\descrwidth}{\textsf{v1.0a, --- 2023-08-18} } +% \settowidth{\descrwidth}{\textsf{v1.0, (ctan), 2024-11-01} } % % \begin{description}[font=\small\sffamily,wide=0pt,style=multiline,leftmargin=1.1\descrwidth,nosep,noitemsep] -% \item [\fileversion{} \, \filedate] +% \item [\fileversion{} (ctan), \filedate] +% \begin{itemize} +% \item Fixed implementation for |font| and |base-fix| keys. +% \item Added new keys for symbol marks. +% \item Update and improvements in the internal code. +% \item Adjustments in the documentation. +% \end{itemize} +% \item [v1.0 (ctan), 2024-11-01] % \begin{itemize} % \item First public release. % \end{itemize} @@ -5273,7 +5617,7 @@ Some text here % \end{macrocode} % Now declare the \mypkg*{enumext} package. % \begin{macrocode} -\ProvidesExplPackage {enumext} {2024-11-01} {1.0} {Enumerate exercise sheets} +\ProvidesExplPackage {enumext} {2024-11-14} {1.1} {Enumerate exercise sheets} % \end{macrocode} % Finally check if the \mypkg{multicol} and \mypkg{scontents} packages % are loaded, if not we load it. @@ -5622,13 +5966,16 @@ Some text here % % % \begin{variable}[int]{\l_@@_print_keyans_starred_tl, \l_@@_print_keyans_star_bool, -% \l_@@_mark_position_str, \g_@@_item_symbol_aux_tl, -% \l_@@_print_keyans_X_tl, \l_@@_store_save_key_X_tl, -% \l_@@_store_save_key_X_bool, \l_@@_store_upper_level_X_bool,} -% Internal variables used by command \ics*{printkeyans} -% (\S\ref{cmd:printkeyans}), \mykey{show-pos} key (\S\ref{int:storage-system}), -% \mykey{item-sym*} key (\S\ref{key:item-starred}), \mykey{save-key} key -% (\S\ref{key:save-key}) and \emph{\enquote{storing structure}}. +% \l_@@_mark_position_str, \l_@@_mark_position_v_str, +% \l_@@_mark_position_viii_str, \l_@@_mark_sep_tmpa_dim, +% \l_@@_mark_sep_tmpb_dim, \l_@@_show_pos_tmp_int, +% \g_@@_item_symbol_aux_tl, \l_@@_print_keyans_X_tl, +% \l_@@_store_save_key_X_tl, \l_@@_store_save_key_X_bool, +% \l_@@_store_upper_level_X_bool,} +% Internal variables used by command \ics*{printkeyans} +% (\S\ref{cmd:printkeyans}), \mykey{show-pos}, \mykey{show-ans}, \mykey{mark-pos}, \mykey{mark-sep} keys (\S\ref{int:storage-system}), +% \mykey{item-sym*} key (\S\ref{key:item-starred}), \mykey{save-key} key +% (\S\ref{key:save-key}) and \emph{\enquote{storing structure}}. % \iffalse %% Variables used by |\printkeyans|, |mark-pos|, |item-sym*|, |save-key| and storing structure in |enumext| and |enumext*|. % \fi @@ -5636,6 +5983,11 @@ Some text here \tl_new:N \l_@@_print_keyans_starred_tl \bool_new:N \l_@@_print_keyans_star_bool \str_new:N \l_@@_mark_position_str +\str_new:N \l_@@_mark_position_v_str +\str_new:N \l_@@_mark_position_viii_str +\dim_new:N \l_@@_mark_sep_tmpa_dim +\dim_new:N \l_@@_mark_sep_tmpb_dim +\int_new:N \l_@@_show_pos_tmp_int \tl_new:N \g_@@_item_symbol_aux_tl \cs_set_protected:Npn \@@_tmp:n #1 { @@ -5651,7 +6003,7 @@ Some text here % \begin{variable}{\l_@@_anspic_args_seq, \l_@@_anspic_mini_width_dim, % \l_@@_anspic_above_int,\l_@@_anspic_below_int, % \l_@@_anspic_label_above_bool, \l_@@_anspic_mini_pos_str, -% \g_@@_keyans_pic_parsep_skip, \l_@@_anspic_label_box, \l_@@_anspic_body_box, +% \l_@@_anspic_label_box, \l_@@_anspic_body_box, % \l_@@_anspic_label_htdp_dim, \l_@@_anspic_body_htdp_dim,} % Internal variables used by \myenv*{keyanspic} environment and % \ics*{anspic} command (\S\ref{env:keyanspic}). @@ -5665,7 +6017,6 @@ Some text here \int_new:N \l_@@_anspic_below_int \bool_new:N \l_@@_anspic_label_above_bool \str_new:N \l_@@_anspic_mini_pos_str -\skip_new:N \g_@@_keyans_pic_parsep_skip \box_new:N \l_@@_anspic_label_box \box_new:N \l_@@_anspic_body_box \dim_new:N \l_@@_anspic_label_htdp_dim @@ -5674,21 +6025,23 @@ Some text here % \end{variable} % % \begin{variable}{\l_@@_check_answers_bool,\g_@@_check_ans_key_bool, -% \l_@@_check_start_line_env_tl, \g_@@_check_starred_cmd_int, -% \g_@@_item_anskey_int, \g_@@_item_number_int, -% \g_@@_item_number_bool, \g_@@_item_answer_diff_int,} -% Internal variables used by \emph{\enquote{internal check answer}} mechanism -% (\S\ref{int:check-answer}) used by the \mykey{check-ans} and -% \mykey{no-store} keys and check for starred commands \ics*{item*} -% in \myenv*{keyans} and \myenv*{keyans*} environments and \ics*{anspic*} -% in \myenv*{keyanspic} environment. +% \l_@@_check_start_line_env_tl, \l_@@_item_wrap_key_bool, +% \g_@@_check_starred_cmd_int, \g_@@_item_anskey_int, +% \g_@@_item_number_int, \g_@@_item_number_bool, +% \g_@@_item_answer_diff_int,} +% Internal variables used by \emph{\enquote{internal check answer}} mechanism +% (\S\ref{int:check-answer}) used by the \mykey{check-ans}, \mykey{no-store}, \mykey{wrap-ans*} +% keys and check for starred commands \ics*{item*} in \myenv*{keyans} and +% \myenv*{keyans*} environments and \ics*{anspic*} +% in \myenv*{keyanspic} environment. % \iffalse -%% Variables used by check-answer mechanism, |check-ans| and |no-store| keys. +%% Variables used by check-answer mechanism, |check-ans|, |wrap-ans*| and |no-store| keys. % \fi % \begin{macrocode} \bool_new:N \l_@@_check_answers_bool \bool_new:N \g_@@_check_ans_key_bool \tl_new:N \l_@@_check_start_line_env_tl +\bool_new:N \l_@@_item_wrap_key_bool \int_new:N \g_@@_check_starred_cmd_int \int_new:N \g_@@_item_anskey_int \int_new:N \g_@@_item_number_int @@ -5698,11 +6051,10 @@ Some text here % \end{variable} % % \begin{variable}[int]{\l_@@_hyperref_bool, \l_@@_footnotes_key_bool,} -% The boolean variable \cs{l_@@_hyperref_bool} will determine if the -% \mypkg{hyperref} package is present or load in memory -% (\S\ref{pkg:hyperref}). The boolean variable \cs{l_@@_footnotes_key_bool} -% determine if \mypkg{hyperref} is load with key |hyperfootnotes=true|. -% +% The boolean variable \cs{l_@@_hyperref_bool} will determine if the +% \mypkg{hyperref} package is present or load in memory +% (\S\ref{pkg:hyperref}). The boolean variable \cs{l_@@_footnotes_key_bool} +% determine if \mypkg{hyperref} is load with key |hyperfootnotes=true|. % \iffalse %% Variables used for hyperref detection. % \fi @@ -5714,17 +6066,16 @@ Some text here % % \begin{variable}[int]{ \l_@@_newlabel_arg_one_tl, \l_@@_newlabel_arg_two_tl, % \l_@@_write_aux_file_tl, \l_@@_label_copy_X_tl, } +% Internal variables used by \mykey{save-ref} key (\S\ref{int:storage-system}). +% The variables \myvarenv{l__@@_label_copy_X_tl} correspond to temporary +% copies of the \mymeta{labels} defined by level on which operations will be performed. % -% Internal variables used by \mykey{save-ref} key (\S\ref{int:storage-system}). -% The variables \myvarenv{l__@@_label_copy_X_tl} correspond to temporary -% copies of the \mymeta{labels} defined by level on which operations will be performed. -% -% \smallskip +% \smallskip % -% The variables \cs{l_@@_newlabel_arg_one_tl} and \cs{l_@@_newlabel_arg_two_tl} -% will be used to form the arguments passed to the function -% \cs{@@_newlabel:nn} (\S\ref{fun:newlabel}) and the variable \cs{l_@@_write_aux_file_tl} -% will be in charge of executing the writing code in the |.aux| file. +% The variables \cs{l_@@_newlabel_arg_one_tl} and \cs{l_@@_newlabel_arg_two_tl} +% will be used to form the arguments passed to the function +% \cs{@@_newlabel:nn} (\S\ref{fun:newlabel}) and the variable \cs{l_@@_write_aux_file_tl} +% will be in charge of executing the writing code in the |.aux| file. % \iffalse %% Variables used by |save-ref| key (internal label and ref). % \fi @@ -6833,9 +7184,9 @@ Some text here % \subsubsection{Define and set \texttt{label} and \texttt{ref} keys for \env{enumext} environment} % % \begin{macro}[int]{label,ref,\l_@@_label_i_tl,\l_@@_label_ii_tl, \l_@@_label_iii_tl, \l_@@_label_iv_tl} -% Here we set the default \mymeta{labels} of the \emph{four levels} of -% \myenv*{enumext} environment, along with the default value for -% \mykey{labelwidth} key and \mykey{ref} key. +% Here we set the default \mymeta{labels} of the \emph{four levels} of +% \myenv*{enumext} environment, along with the default value for +% \mykey{labelwidth} key and \mykey{ref} key. % \iffalse %% Define and set |label| and |ref| keys for |enumext|. % \fi @@ -6864,14 +7215,14 @@ Some text here % \end{macro} % % \begin{macro}[int]{\@@_standar_ref:n, \@@_standar_ref:,} -% The \cs{@@_standar_ref:n} first we will pass the key argument to -% \cs{l_@@_ref_key_arg_tl} and we will analyze its state, if it is not -% \emph{empty} we will make a copy of the current counter in \cs{l_@@ _ref_the_count_tl} -% and we will execute the function \cs{@@_regex_counter_style:} which -% will return the modified \cs{l_@@_ref_key_arg_tl} and we make the -% value of \cs{l_@@_ref_the_count_tl} the same as that \myvarenv{l__@@_the_counter_X_tl} -% which contains |\theenumX| and finally we set \myvarenv{l__@@_renew_the_count_X_tl} -% with the renewed command. +% The \cs{@@_standar_ref:n} first we will pass the key argument to +% \cs{l_@@_ref_key_arg_tl} and we will analyze its state, if it is not +% \emph{empty} we will make a copy of the current counter in \cs{l_@@_ref_the_count_tl} +% and we will execute the function \cs{@@_regex_counter_style:} which +% will return the modified \cs{l_@@_ref_key_arg_tl} and we make the +% value of \cs{l_@@_ref_the_count_tl} the same as that \myvarenv{l__@@_the_counter_X_tl} +% which contains |\theenumX| and finally we set \myvarenv{l__@@_renew_the_count_X_tl} +% with the renewed command. % \iffalse %% Internal function used by |ref| key in enumext environment. % \fi @@ -6931,7 +7282,7 @@ Some text here \@@_label_style:cvn { l_@@_label_#2_tl } { l_@@_counter_#2_tl } {##1} \dim_set_eq:cN { l_@@_labelwidth_#2_dim } - \l_@@_current_widest_dim + \l_@@_current_widest_dim }, label .initial:n = #3, label .value_required:n = true, @@ -7019,11 +7370,11 @@ Some text here % % \begin{macro}[int]{label, ref} % \begin{macro}{\l_@@_label_v_tl,\l_@@_label_vi_tl,} -% Here we set the default \mymeta{label} for \myenv*{keyans} -% and \myenv*{keyanspic} environment, along with the default value for -% \mykey{labelwidth} and \mykey{ref} key. The \myenv*{keyanspic} -% environment use the same \mymeta{label} as the \myenv*{keyans} -% environment. +% Here we set the default \mymeta{label} for \myenv*{keyans} +% and \myenv*{keyanspic} environment, along with the default value for +% \mykey{labelwidth} if it has not been established and \mykey{ref} key. +% The \myenv*{keyanspic} environment use the same \mymeta{label} as +% the \myenv*{keyans} environment. % \iffalse %% Define and set |label| and |ref| keys for |keyans| and |keyanspic|. % \fi @@ -7033,12 +7384,10 @@ Some text here label .code:n = { \@@_label_style:cvn { l_@@_label_v_tl } { l_@@_counter_v_tl } {#1} - \dim_set_eq:cN { l_@@_labelwidth_v_dim } - \l_@@_current_widest_dim \@@_label_style:cvn { l_@@_label_vi_tl } - { l_@@_counter_vi_tl } {#1} - \dim_set_eq:cN { l_@@_labelwidth_v_dim } - \l_@@_current_widest_dim + { l_@@_counter_vi_tl } {#1} + \dim_set_eq:NN + \l_@@_labelwidth_v_dim \l_@@_current_widest_dim }, label .initial:n = \Alph*), label .value_required:n = true, @@ -7313,6 +7662,13 @@ Some text here % to apply it within the document in which case the variable % \cs{l_@@_print_keyans_star_bool} set by the |\printkeyans| command is % false and the variable \cs{l_@@_base_line_fix_bool} is true. +% +% \smallskip +% +% We set the values of the keys \mykey{topsep}, \mykey{above} +% and \mykey{above*} for the \emph{\enquote{first level}} of \myenv*{enumext} +% environment equal to \mydim{0pt} and finally set the variable \cs{l_@@_base_line_fix_bool} +% to false. % \iffalse %% Internal function for |base-fix| key in |enumext| environment. % \fi @@ -7328,6 +7684,10 @@ Some text here { \mode_leave_vertical: \vspace { -\dim_eval:n { \baselineskip + \parsep } } + \keys_set:nn { enumext / level-1 } + { + topsep = 0pt, above = 0pt, above* = 0pt, + } } % \end{macrocode} % When we are running the |\printkeyans| command with the \emph{starred @@ -7341,16 +7701,10 @@ Some text here \mode_leave_vertical: \skip_vertical:n { -\baselineskip } \skip_vertical:N \c_zero_skip - } -% \end{macrocode} -% Finally we set the values of the keys \mykey{topsep}, \mykey{above} -% and \mykey{above*} for the \emph{\enquote{first level}} of \myenv*{enumext} -% environment equal to \mydim{0pt} and set the variable \cs{l_@@_base_line_fix_bool} -% to false. -% \begin{macrocode} - \keys_set:nn { enumext / level-1 } - { - topsep = 0pt, above = 0pt, above* = 0pt, + \keys_set:nn { enumext / level-1 } + { + topsep = 0pt, above = 0pt, above* = 0pt, + } } \bool_set_false:N \l_@@_base_line_fix_bool } @@ -9276,7 +9630,7 @@ Some text here % \ics*{anskey} command and the \myenv*{anskey*}, \myenv*{keyans}, % \myenv*{keyans*} and \myenv*{keyanspic} environments and will set % to \enquote{true} the variable \cs{l_@@_check_answers_bool} used for -% intenal checking answers mechanism set by the \mykey{check-ans} and \mykey{no-store} +% internal checking answers mechanism set by the \mykey{check-ans} and \mykey{no-store} % keys, copy \mymarg{store name} into the variable \cs{g_@@_store_name_tl} % and execute the function \cs{@@_anskey_env_make:V} creating the environment % \myenv*{anskey*} (\S\ref{env:anskey}). @@ -9640,86 +9994,146 @@ Some text here % % \subsection{Keys and functions associated with storage}\label{int:storage-system} % -% \begin{macro}[int]{wrap-ans, wrap-opt, save-sep,mark-ans, mark-pos, show-ans, mark-ref, save-ref} -% We add the keys \mykey{wrap-ans}, \mykey{wrap-opt}, \mykey{save-sep}, -% \mykey{mark-ans}, \mykey{mark-pos}, \mykey{show-ans}, \mykey{show-pos}, -% \mykey{mark-ref} and \mykey{save-ref} related to the \emph{\enquote{storage system}} -% and internal mechanism of \emph{\enquote{label and ref}} only at -% the \emph{first level} of \myenv*{enumext} and \myenv*{enumext*}. +% \subsubsection{Keys for \texttt{marks}, \texttt{wrapp} and \texttt{show}} +% +% The \mypkg*{enumext} package provides a set of \mymeta{keys} for +% manipulating \emph{\enquote{symbol marks}} associated with \emph{\enquote{answers}} +% and how they are displayed and stored in the \emph{sequence} and \emph{prop list} +% as well as an internal \emph{\enquote{label and ref}} system. +% +% \begin{macro}[int]{mark-ans*, mark-pos*, mark-sep*, wrap-ans*, wrap-opt, +% save-sep, show-ans, show-pos} +% For the \myenv*{keyans} and \myenv*{keyans*} environments we will +% only add the keys \mykey{mark-ans*}, \mykey{mark-pos*}, \mykey{mark-sep*}, +% \mykey{wrap-ans*}, \mykey{wrap-opt}, \mykey{save-sep}, \mykey{show-ans} +% and \mykey{show-pos}. % \iffalse -%% Add keys associated with storage on first level of |enumext| and |enumext*|. +%% Add the keys for marks style and show for |keyans| and |keyans*| environments. % \fi % \begin{macrocode} -\cs_set_protected:Npn \@@_tmp:n #1 +\cs_set_protected:Npn \@@_tmp:nn #1 #2 { \keys_define:nn { enumext / #1 } { - wrap-ans .cs_set_protected:Np = \@@_anskey_wrapper:n ##1, - wrap-ans .initial:n = - { - \fbox{\parbox[t]{\dimeval{\itemwidth -2\fboxsep -2\fboxrule}}{##1}} - }, - wrap-ans .value_required:n = true, - wrap-opt .cs_set_protected:Np = \@@_keyans_wrapper_opt:n ##1, + mark-ans* .tl_set:c = { l_@@_mark_answer_sym_#2_tl }, + mark-ans* .initial:n = \textasteriskcentered, + mark-ans* .value_required:n = true, + mark-pos* .choice:, + mark-pos* / left .code:n = \str_set:cn { l_@@_mark_position_#2_str } { l }, + mark-pos* / right .code:n = \str_set:cn { l_@@_mark_position_#2_str } { r }, + mark-pos* / center .code:n = \str_set:cn { l_@@_mark_position_#2_str } { c }, + mark-pos* / unknown .code:n = + \msg_error:nneee { enumext } { unknown-choice } + { mark-pos } { left, ~ right, ~ center } { \exp_not:n {##1} }, + mark-pos* .initial:n = right, + mark-pos* .value_required:n = true, + mark-sep* .dim_set:c = { l_@@_mark_sym_sep_#2_dim }, + mark-sep* .value_required:n = true, + wrap-ans* .cs_set_protected:cp = { @@_keyans_wrapper_item_#2:n } ##1, + wrap-ans* .value_required:n = true, + wrap-opt .cs_set_protected:cp = { @@_keyans_wrapper_opt_#2:n } ##1, wrap-opt .initial:n = [{##1}], wrap-opt .value_required:n = true, - save-sep .tl_set:N = \l_@@_store_keyans_item_opt_sep_tl, + save-sep .tl_set:c = { l_@@_store_keyans_item_opt_sep_#2_tl }, save-sep .initial:n = {, ~ }, save-sep .value_required:n = true, - mark-ans .tl_set:N = \l_@@_mark_answer_sym_tl, - mark-ans .initial:n = \textasteriskcentered, - mark-ans .value_required:n = true, - mark-pos .choice:, - mark-pos / left .code:n = \str_set:Nn \l_@@_mark_position_str { l }, - mark-pos / right .code:n = \str_set:Nn \l_@@_mark_position_str { r }, - mark-pos / unknown .code:n = - \msg_error:nneee { enumext } { unknown-choice } - { mark-pos } { left, ~ right } { \exp_not:n {##1} }, - mark-pos .initial:n = right, - mark-pos .value_required:n = true, show-ans .bool_set:N = \l_@@_show_answer_bool, - show-ans .initial:n = false, + show-ans .initial:n = false, show-ans .value_required:n = true, show-pos .bool_set:N = \l_@@_show_position_bool, - show-pos .initial:n = false, + show-pos .initial:n = false, show-pos .value_required:n = true, - mark-ref .tl_set:N = \l_@@_mark_ref_sym_tl, - mark-ref .initial:n = \textreferencemark, - mark-ref .value_required:n = true, - save-ref .bool_set:N = \l_@@_store_ref_key_bool, - save-ref .initial:n = false, - save-ref .value_required:n = true, } } -\clist_map_inline:nn { level-1, enumext* } { \@@_tmp:n {#1} } +\clist_map_inline:nn { {keyans}{v}, {keyans*}{viii} } { \@@_tmp:nn #1 } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{mark-pos, show-ans, show-pos} -% For the \myenv*{keyans} and \myenv*{keyans*} environments we will -% only add the keys \mykey{mark-pos}, \mykey{show-ans} and \mykey{show-pos}. +% \begin{macro}[int]{mark-ref, save-ref, show-ans, show-pos, mark-ans, +% mark-pos, mark-sep, wrap-ans, mark-ans*, mark-pos*, +% mark-sep*, wrap-ans*, wrap-opt, save-sep,} +% We add the \mymeta{keys} \mykey{mark-ref} and \mykey{save-ref} related to the +% \emph{\enquote{storage system}} and internal mechanism of +% \emph{\enquote{label and ref}} along with the \mymeta{keys} \mykey{show-ans}, +% \mykey{show-pos} and the\mymeta{keys} \mykey{mark-ans}, \mykey{mark-pos}, +% \mykey{mark-sep} and \mykey{wrap-ans} for the command |\anskey|, +% the environment \myenv*{anskey*} and the the \mymeta{keys} for environments +% \myenv*{keyans} and \myenv*{keyans*} only at the \emph{first level} +% of \myenv*{enumext} and \myenv*{enumext*}. % \iffalse -%% Add keys |mark-pos|, |show-pos| and |show-ans| keys for |keyans| and |keyans*| environments. +%% Add keys associated with mark and internal label/ref on first level of |enumext| and |enumext*| environments. % \fi % \begin{macrocode} \cs_set_protected:Npn \@@_tmp:n #1 { \keys_define:nn { enumext / #1 } { - mark-pos .choice:, - mark-pos / left .code:n = \str_set:Nn \l_@@_mark_position_str { l }, - mark-pos / right .code:n = \str_set:Nn \l_@@_mark_position_str { r }, - mark-pos .initial:n = right, - mark-pos .value_required:n = true, - show-ans .bool_set:N = \l_@@_show_answer_bool, - show-ans .initial:n = false, - show-ans .value_required:n = true, - show-pos .bool_set:N = \l_@@_show_position_bool, - show-pos .initial:n = false, - show-pos .value_required:n = true, + mark-ref .tl_set:N = \l_@@_mark_ref_sym_tl, + mark-ref .initial:n = \textreferencemark, + mark-ref .value_required:n = true, + save-ref .bool_set:N = \l_@@_store_ref_key_bool, + save-ref .initial:n = false, + save-ref .value_required:n = true, + show-ans .bool_set:N = \l_@@_show_answer_bool, + show-ans .initial:n = false, + show-ans .value_required:n = true, + show-pos .bool_set:N = \l_@@_show_position_bool, + show-pos .initial:n = false, + show-pos .value_required:n = true, + mark-ans .tl_set:N = \l_@@_mark_answer_sym_tl, + mark-ans .initial:n = \textasteriskcentered, + mark-ans .value_required:n = true, + mark-sep .dim_set:N = \l_@@_mark_sym_sep_dim, + mark-sep .value_required:n = true, + mark-pos .choice:, + mark-pos / left .code:n = \str_set:Nn \l_@@_mark_position_str { l }, + mark-pos / right .code:n = \str_set:Nn \l_@@_mark_position_str { r }, + mark-pos / center .code:n = \str_set:Nn \l_@@_mark_position_str { c }, + mark-pos / unknown .code:n = + \msg_error:nneee { enumext } { unknown-choice } + { mark-pos } { left, ~ right, ~ center } { \exp_not:n {##1} }, + mark-pos .initial:n = right, + mark-pos .value_required:n = true, + + wrap-ans .cs_set_protected:Np = \@@_anskey_wrapper:n ##1, + wrap-ans .initial:n = + { + \fbox{\parbox[t]{\dimeval{\itemwidth -2\fboxsep -2\fboxrule}}{##1}} + }, + wrap-ans .value_required:n = true, + mark-ans* .code:n = { + \keys_set:nn { enumext / keyans } { mark-ans* = {##1} } + \keys_set:nn { enumext / keyans* } { mark-ans* = {##1} } + }, + mark-ans* .value_required:n = true, + mark-pos* .code:n = { + \keys_set:nn { enumext / keyans } { mark-pos* = {##1} } + \keys_set:nn { enumext / keyans* } { mark-pos* = {##1} } + }, + mark-pos* .value_required:n = true, + mark-sep* .code:n = { + \keys_set:nn { enumext / keyans } { mark-sep* = {##1} } + \keys_set:nn { enumext / keyans* } { mark-sep* = {##1} } + }, + mark-sep* .value_required:n = true, + wrap-ans* .code:n = { + \keys_set:nn { enumext / keyans } { wrap-ans* = {##1} } + \keys_set:nn { enumext / keyans* } { wrap-ans* = {##1} } + }, + wrap-ans* .value_required:n = true, + wrap-opt .code:n = { + \keys_set:nn { enumext / keyans } { wrap-opt = {##1} } + \keys_set:nn { enumext / keyans* } { wrap-opt = {##1} } + }, + wrap-opt .value_required:n = true, + save-sep .code:n = { + \keys_set:nn { enumext / keyans } { save-sep = {##1} } + \keys_set:nn { enumext / keyans* } { save-sep = {##1} } + }, + save-sep .value_required:n = true, } } -\clist_map_inline:nn { keyans, keyans* } { \@@_tmp:n {#1} } +\clist_map_inline:nn { level-1, enumext* } { \@@_tmp:n {#1} } % \end{macrocode} % \end{macro} % @@ -9828,7 +10242,8 @@ Some text here % % \subsubsection{Internal functions to store optional arguments} % -% \begin{macro}{\@@_filter_save_key:n, \@@_filter_save_key_key:n, \@@_filter_save_key_pair:nn} +% \begin{macro}{\@@_filter_save_key:n, \@@_filter_save_key_key:n, +% \@@_filter_save_key_pair:nn} % The function \cs{@@_filter_save_key:n} will be in charge of % \emph{\enquote{filtering keys}} we want to \emph{stored} in % \emph{sequence} where |{#1}| represents the \emph{optional argument} @@ -9862,20 +10277,23 @@ Some text here % \end{macrocode} % The function \cs{@@_filter_save_key_pair:nn} will be responsible for % \emph{\enquote{filtering keys}} that are passed \emph{\enquote{with value}} by -% excluding the \mykey{series}, \mykey{resume}, \mykey{save-ans}, \mykey{save-ref}, \mykey{check-ans}, -% \mykey{show-ans}, \mykey{save-pos}, \mykey{wrap-ans}, \mykey{mark-ans}, -% \mykey{wrap-opt}, \mykey{save-sep}, \mykey{mark-ref}, \mykey{mini-env}, \mykey{mini-sep}, -% \mykey{mini-right} and \mykey{mini-right*} keys. +% excluding the \mykey{series}, \mykey{resume}, \mykey{save-ans}, \mykey{save-ref}, +% \mykey{save-key}, \mykey{check-ans}, \mykey{show-ans}, \mykey{save-pos}, +% \mykey{mark-ans}, \mykey{mark-pos}, \mykey{mark-sep}, \mykey{wrap-ans}, +% \mykey{mark-ans*}, \mykey{mark-pos*}, \mykey{mark-sep*}, \mykey{wrap-ans*}, +% \mykey{wrap-opt}, \mykey{save-sep}, \mykey{mark-ref}, \mykey{mini-env}, +% \mykey{mini-sep}, \mykey{mini-right} and \mykey{mini-right*} keys. % \begin{macrocode} \cs_new:Npn \@@_filter_save_key_pair:nn #1#2 { \str_case:nnF {#1} { - { series } {} { resume } {} { save-ans } {} { save-ref } {} - { save-key } {} { check-ans } {} { show-ans } {} { show-pos } {} - { wrap-ans } {} { mark-ans } {} { wrap-opt } {} { save-sep } {} - { mark-ref } {} { mini-env } {} { mini-sep } {} { mini-right } {} - { mini-right* } {} + { series } {} { resume } {} { save-ans } {} { save-ref } {} + { save-key } {} { check-ans } {} { show-ans } {} { show-pos } {} + { mark-ans } {} { mark-pos } {} { mark-sep } {} { wrap-ans } {} + { mark-ans* } {} { mark-pos* } {} { mark-sep* } {} { wrap-ans* } {} + { wrap-opt } {} { save-sep } {} { mark-ref } {} { mini-env } {} + { mini-sep } {} { mini-right } {} { mini-right* } {} } { , { \exp_not:n {#1} } = { \exp_not:n {#2} } } } @@ -10050,7 +10468,7 @@ Some text here { \mode_leave_vertical: \skip_horizontal:n { -\dim_use:N #2 } - \makebox[0pt][ r ] + \hbox_overlap_left:n { \makebox[ \dim_use:N #1 ][ \l_@@_mark_position_str ] { @@ -10285,7 +10703,7 @@ Some text here % \begin{macro}{\@@_anskey_show_wrap_arg:n,} % The function \cs{@@_anskey_show_wrap_arg:n} \emph{\enquote{wraps}} % the \mymarg{argument} passed to \ics*{anskey} and the \mymeta{body} -% for \myenv*{anskey*} when using the \mykey{wrap-ans} key. +% for \myenv*{anskey*} when using the \mykey{wrap-ans} and \mykey{wrap-sep} keys. % \iffalse %% Internal |wrap-ans| implementation for |\anskey| and |anskey*|. % \fi @@ -10295,13 +10713,23 @@ Some text here \par \bool_if:NTF \l_@@_starred_bool { + \dim_compare:nNnT { \l_@@_mark_sym_sep_dim } = { \c_zero_dim } + { + \dim_set:Nn \l_@@_mark_sym_sep_dim { \l_@@_labelsep_vii_dim } + } \@@_print_keyans_box:NN - \l_@@_labelwidth_vii_dim \l_@@_labelsep_vii_dim + \l_@@_labelwidth_vii_dim \l_@@_mark_sym_sep_dim } { + \dim_compare:nNnT { \l_@@_mark_sym_sep_dim } = { \c_zero_dim } + { + \dim_set:Nn \l_@@_mark_sym_sep_dim + { + \dim_use:c {l_@@_labelsep_ \@@_level: _dim } + } + } \@@_print_keyans_box:cc - { l_@@_labelwidth_ \@@_level: _dim } - { l_@@_labelsep_ \@@_level: _dim } + { l_@@_labelwidth_ \@@_level: _dim } { l_@@_mark_sym_sep_dim } } \@@_anskey_wrapper:n { #1 } } @@ -10358,9 +10786,10 @@ Some text here % behaviour to that of |\item| in the \myenv*{enumext} and \myenv*{enumext*} % environments executed as follows \ics*{anskey}\myoarg{key \textnormal{\textcolor{gray}{=}} val}\mymarg{content}. % -% \begin{macro}{\@@_anskey_unknown:n, \@@_anskey_unknown:nn} -% First we'll add the keys \mykeycmd{break-col}, \mykeycmd{item-join}, -% \mykeycmd{item-star}, \mykeycmd{item-sym*} and \mykeycmd{item-pos*}. +% \begin{macro}[int]{break-col, item-join, item-star, item-sym*, item-pos*, +% unknown, \@@_anskey_unknown:n, \@@_anskey_unknown:nn} +% First we'll add the keys \mykeycmd{break-col}, \mykeycmd{item-join}, +% \mykeycmd{item-star}, \mykeycmd{item-sym*} and \mykeycmd{item-pos*}. % \iffalse %% Add |key=val| for |\anskey|. % \fi @@ -10578,7 +11007,7 @@ Some text here % a not numbered |\item| or if it is in \emph{math mode} returning % the appropriate messages. % \iffalse -%% Hooks for |anskey*| inside the |keyans|, |keyans*| and |keyanspic| environments, math-mode ans not number |\item|. +%% Hooks for |anskey*| inside the |keyans|, |keyans*| and |keyanspic| environments, math-mode and not number |\item|. % \fi % \begin{macrocode} \@@_before_env:nn { anskey* } @@ -10977,11 +11406,11 @@ Some text here % \begin{macrocode} \tl_if_novalue:nF { #1 } { - \tl_if_empty:NF \l_@@_store_keyans_item_opt_sep_tl + \tl_if_empty:NF \l_@@_store_keyans_item_opt_sep_v_tl { \tl_put_right:Ne \l_@@_store_current_label_tl { - \l_@@_store_keyans_item_opt_sep_tl + \l_@@_store_keyans_item_opt_sep_v_tl } } \tl_put_right:Ne \l_@@_store_current_label_tl { #1 } @@ -11106,11 +11535,11 @@ Some text here } \tl_if_novalue:nF { #1 } { - \tl_if_empty:NF \l_@@_store_keyans_item_opt_sep_tl + \tl_if_empty:NF \l_@@_store_keyans_item_opt_sep_v_tl { \tl_put_right:Ne \l_@@_store_current_label_tl { - \l_@@_store_keyans_item_opt_sep_tl + \l_@@_store_keyans_item_opt_sep_v_tl } } \tl_put_right:Ne \l_@@_store_current_label_tl { #1 } @@ -11154,33 +11583,48 @@ Some text here % % \subsubsection{The \texttt{show-ans} and \texttt{show-pos} keys for \env{keyans} and \env{keyanspic}} % -% The code is very similar to the \ics*{anskey} code, but, if I change -% the order of the operations the counter off \mymeta{label} are incorrect. -% -% \begin{macro}{\@@_keyans_show_left:n,\@@_keyans_show_ans:, \@@_keyans_show_pos:, \@@_keyans_show_item_opt:,} -% Common function to show \emph{starred commands} |\item*| and \mymeta{position} of -% stored content in \emph{prop list} for \myenv*{keyans} and -% \myenv*{keyanspic}. Need add |1| to \myvarenv{g__@@_\mymeta[cf=gray]{store name}_prop} for \mykey{show-pos} key. +% \begin{macro}{\@@_keyans_save_item_opt:n,\@@_keyans_show_item_opt:, +% \@@_keyans_show_item_opt_viii:, } +% The function \cs{@@_keyans_save_item_opt:n} will save the optional +% argument of |\item*| and |\anspic*| in the variable +% \cs{l_@@_store_current_opt_arg_tl}. % \iffalse -%% Function for |show-ans| and |show-pos| keys for |keyans| and |keyanspic| environments. +%% Function for |wrap-opt| key for |keyans|, |keyanspic| and |keyans*| environments. % \fi % \begin{macrocode} -\cs_new_protected:Npn \@@_keyans_show_left:n #1 +\cs_new_protected:Npn \@@_keyans_save_item_opt:n #1 { \tl_if_novalue:nF { #1 } { \tl_set:Ne \l_@@_store_current_opt_arg_tl { #1 } } - \bool_if:NT \l_@@_show_answer_bool - { - \@@_keyans_show_ans: - } - \bool_if:NT \l_@@_show_position_bool + } +% \end{macrocode} +% The function \cs{@@_keyans_show_item_opt:} will print the optional +% arguments of |\item*| and |\anspic*| when the \mykey{show-ans} or +% \mykey{show-pos} keys are set next to the key \mykey{wrap-opt} in +% \myenv*{keyans} and \myenv*{keyanspic} environments. +% \begin{macrocode} +\cs_new_protected:Nn \@@_keyans_show_item_opt: + { + \tl_if_empty:NF \l_@@_store_current_opt_arg_tl { - \@@_keyans_show_pos: + \bool_lazy_or:nnT + { \bool_if_p:N \l_@@_show_answer_bool } + { \bool_if_p:N \l_@@_show_position_bool } + { + \@@_keyans_wrapper_opt_v:n + { \l_@@_store_current_opt_arg_tl } \c_space_tl + } } } -\cs_new_protected:Nn \@@_keyans_show_item_opt: +% \end{macrocode} +% The function \cs{@@_keyans_show_item_opt_viii:} will print the optional +% argument of |\item*| when the \mykey{show-ans} or \mykey{show-pos} +% keys are set next to the key \mykey{wrap-opt} in \myenv*{keyans*} +% environment. +% \begin{macrocode} +\cs_new_protected:Nn \@@_keyans_show_item_opt_viii: { \tl_if_empty:NF \l_@@_store_current_opt_arg_tl { @@ -11188,61 +11632,107 @@ Some text here { \bool_if_p:N \l_@@_show_answer_bool } { \bool_if_p:N \l_@@_show_position_bool } { - \@@_keyans_wrapper_opt:n { \l_@@_store_current_opt_arg_tl } \c_space_tl + \@@_keyans_wrapper_opt_viii:n + { \l_@@_store_current_opt_arg_tl } \c_space_tl } } } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_keyans_pos_mark_set:, \@@_keyans_show_ans:, \@@_keyans_show_pos:} +% The function \cs{@@_keyans_pos_mark_set:} adjusts the horizontal +% spaces for the \mykey{mark-sep*} key taking into account the value of +% the \mykey{align} key and the width of \mymeta{label}. +% \iffalse +%% Function for |mark-sep*|, |show-ans| and |show-pos| keys for |keyans| and |keyanspic| environments. +% \fi +% \begin{macrocode} +\cs_new_protected:Nn \@@_keyans_pos_mark_set: + { + \@@_label_width_by_box:Nn + \l_@@_mark_sep_tmpa_dim { \l_@@_label_v_tl } + \str_case:Vn \l_@@_align_label_pos_v_str + { + { l } + { + \dim_set:Nn \l_@@_mark_sep_tmpb_dim { \c_zero_dim } + } + { r } + { + \dim_set:Nn \l_@@_mark_sep_tmpb_dim + { \l_@@_labelwidth_v_dim - \l_@@_mark_sep_tmpa_dim } + } + { c } + { + \dim_set:Nn \l_@@_mark_sep_tmpb_dim + { 0.5\l_@@_labelwidth_v_dim - 0.5\l_@@_mark_sep_tmpa_dim } + } + } +% \end{macrocode} +% Here we set the default values for the key \mykey{mark-ans*}, \mykey{mark-sep*} and \mykey{mark-pos*}. +% \begin{macrocode} + \dim_compare:nNnT { \l_@@_mark_sym_sep_v_dim } = { \c_zero_dim } + { + \dim_set:Nn \l_@@_mark_sym_sep_v_dim { \l_@@_labelsep_v_dim } + } + \tl_set_eq:NN \l_@@_mark_answer_sym_tl \l_@@_mark_answer_sym_v_tl + \dim_add:Nn \l_@@_mark_sym_sep_v_dim { \l_@@_mark_sep_tmpb_dim } + \str_set_eq:NN \l_@@_mark_position_str \l_@@_mark_position_v_str + } +% \end{macrocode} +% The function \cs{@@_keyans_show_ans:} will print the \mymeta{symbol} +% set by the \mykey{mark-ans*} key when the \mykey{show-ans} key is active. +% \begin{macrocode} \cs_new_protected:Nn \@@_keyans_show_ans: { - \bool_if:NT \l_@@_starred_bool + \bool_lazy_all:nT { - \dim_set_eq:NN \l_@@_labelwidth_i_dim \l_@@_labelwidth_vii_dim - \dim_set_eq:NN \l_@@_labelsep_i_dim \l_@@_labelsep_vii_dim + { \bool_if_p:N \l_@@_show_answer_bool } + { \bool_if_p:N \l_@@_item_wrap_key_bool } } - \tl_put_left:Nn \l_@@_label_v_tl { + \@@_keyans_pos_mark_set: \@@_print_keyans_box:NN - \l_@@_labelwidth_i_dim \l_@@_labelsep_i_dim + \l_@@_labelwidth_v_dim \l_@@_mark_sym_sep_v_dim } } +% \end{macrocode} +% The function \cs{@@_keyans_show_pos:} will print the \mymeta{position} +% of the stored content in \emph{prop list}. Need add |1| to +% \myvarenv{g__@@_\mymeta[cf=gray]{store name}_prop} for \myenv*{keyans} +% environment. +% \begin{macrocode} \cs_new_protected:Nn \@@_keyans_show_pos: { - \bool_if:NT \l_@@_starred_bool + \int_compare:nNnTF { \l_@@_keyans_level_int } = { 1 } { - \dim_set_eq:NN \l_@@_labelwidth_i_dim \l_@@_labelwidth_vii_dim - \dim_set_eq:NN \l_@@_labelsep_i_dim \l_@@_labelsep_vii_dim + \int_incr:N \l_@@_show_pos_tmp_int } - \int_compare:nNnTF { \l_@@_keyans_pic_level_int } = { 1 } { - \tl_set:Ne \l_@@_mark_answer_sym_tl - { - \group_begin: - \exp_not:N \normalfont - \exp_not:N \footnotesize [ \int_eval:n - { - \prop_count:c { g_@@_ \l_@@_store_name_tl _prop } - } - ] - \group_end: - } + \int_zero:N \l_@@_show_pos_tmp_int } + \bool_lazy_all:nT { - \tl_set:Ne \l_@@_mark_answer_sym_tl + { \bool_if_p:N \l_@@_show_position_bool } + { \bool_if_p:N \l_@@_item_wrap_key_bool } + } + { + \tl_set:Ne \l_@@_mark_answer_sym_v_tl { \group_begin: - \exp_not:N \normalfont - \exp_not:N \footnotesize [ \int_eval:n - { - \prop_count:c { g_@@_ \l_@@_store_name_tl _prop } + 1 - } + \exp_not:N \normalfont + \exp_not:N \footnotesize [ \int_eval:n + { + \prop_count:c { g_@@_ \l_@@_store_name_tl _prop } + + \l_@@_show_pos_tmp_int + } ] \group_end: } - } - \tl_put_left:Nn \l_@@_label_v_tl - { + \@@_keyans_pos_mark_set: \@@_print_keyans_box:NN - \l_@@_labelwidth_i_dim \l_@@_labelsep_i_dim + \l_@@_labelwidth_v_dim \l_@@_mark_sym_sep_v_dim } } % \end{macrocode} @@ -11281,7 +11771,7 @@ Some text here % by the key \mykey{wrap-label*} and execute \cs{@@_item_std:w} with % the \emph{optional argument} and the key \mykey{itemindent}. % \iffalse -%% Internal function for |\item| whit check-answer mechanism in |enumext| environment. +%% Internal function for |\item| with check-answer mechanism in |enumext| environment. % \fi % \begin{macrocode} \cs_new_protected:Npn \@@_default_item:n #1 @@ -11306,7 +11796,7 @@ Some text here % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\@@_starred_item:nn, \@@_item_star_exec:,} +% \begin{macro}[int]{\@@_item_starred_exec:nn, \@@_item_starred_exec:,} % The \ics*{item*}, \ics*{item*}\myoarg{symbol} and \ics*{item*}\myoarg{symbol}\myoarg{offset} % works like the \emph{numbered} |\item|, but placing a \mymeta{symbol} % to the \emph{\enquote{left}} of the \mymeta{label} separated from @@ -11327,10 +11817,10 @@ Some text here % \myvarenv{l__@@_wrap_label_X_bool} to \enquote{true} for the key \mykey{wrap-label} % and execute \cs{@@_item_std:w} and the key \mykey{itemindent}. % \iffalse -%% Internal function for |\item*[symb][sep]| whit check-answer mechanism in |enumext| environment. +%% Internal function for |\item*[symb][sep]| with check-answer mechanism in |enumext| environment. % \fi % \begin{macrocode} -\cs_new_protected:Npn \@@_starred_item:nn #1 #2 +\cs_new_protected:Npn \@@_item_starred_exec:nn #1 #2 { \tl_if_novalue:nTF {#1} { @@ -11358,13 +11848,13 @@ Some text here \@@_item_std:w \tl_use:c { l_@@_fake_item_indent_ \@@_level: _tl } } % \end{macrocode} -% The function \cs{@@_item_star_exec:} will be responsible for +% The function \cs{@@_item_starred_exec:} will be responsible for % executing |\item*| for the \myenv*{enumext} environment. % \iffalse %% Function for |\item*[sym][sep]| in |\makelabel| for |enumext| environment. % \fi % \begin{macrocode} -\cs_new_protected:Nn \@@_item_star_exec: +\cs_new_protected:Nn \@@_item_starred_exec: { \tl_if_empty:cF { l_@@_item_symbol_ \@@_level: _tl } { @@ -11392,7 +11882,7 @@ Some text here { \bool_if:nTF {##1} { - \@@_starred_item:nn {##2} {##3} + \@@_item_starred_exec:nn {##2} {##3} } { \@@_default_item:n {##2} } } @@ -11436,10 +11926,10 @@ Some text here \RenewDocumentCommand \makelabel { m } { \tl_use:c { l_@@_label_fill_left_ \@@_level: _tl } + \@@_item_starred_exec: \tl_use:c { l_@@_label_font_style_ \@@_level: _tl } \bool_if:cTF { l_@@_wrap_label_ \@@_level: _bool } { - \@@_item_star_exec: \use:c { @@_wrapper_label_ \@@_level: :n } { ##1 } } { ##1 } @@ -11471,10 +11961,10 @@ Some text here [ \dim_use:c { l_@@_labelwidth_ \@@_level: _dim } ] [ \str_use:c { l_@@_align_label_pos_ \@@_level: _str } ] { + \@@_item_starred_exec: \tl_use:c { l_@@_label_font_style_ \@@_level: _tl } \bool_if:cTF { l_@@_wrap_label_ \@@_level: _bool } { - \@@_item_star_exec: \use:c { @@_wrapper_label_ \@@_level: :n } { ##1 } } { ##1 } @@ -11506,7 +11996,7 @@ Some text here { item-sym* .tl_set:c = { l_@@_item_symbol_#2_tl }, item-sym* .value_required:n = true, - item-sym* .initial:n = {\textasteriskcentered}, + item-sym* .initial:n = {\textborn}, item-pos* .dim_set:c = { l_@@_item_symbol_sep_#2_dim }, item-pos* .value_required:n = true, } @@ -11521,17 +12011,26 @@ Some text here % % \subsection{Handling unknown keys}\label{key:unknown-keys} % -% At this point in the code I already know that I will not add more -% \mymeta{keys} and since I have already been quite \emph{paranoid and +% At this point in the code I already know that I will NOT add more +% \mymeta{keys} for and since I have already been quite \emph{paranoid and % restrictive} with the definitions of environments and commands, the % only thing left to do is do it with the \mymeta{keys} (you have to be % consistent in life). % +% \smallskip +% +% \begin{important}* +% Well, the paragraph above is not so real, after all I had to add more +% \mymeta{keys} than I had planned, not everything turns out the way one thinks in +% life. +% \end{important} +% % \subsubsection{Handling unknown keys for \env{keyans}, \env{keyans*} and \env{keyanspic}}\label{key:unknown-keys-keyans} % % \begin{macro}[int]{unknown, \@@_keyans_unknown_keys:n, \@@_keyans_unknown_keys:nn} % Define and set |unknown| key for \myenv*{keyans}, \myenv*{keyans*} -% and \myenv*{keyanspic} environments. +% and \myenv*{keyanspic} environments. Here it is necessary to set +% \cs{l_@@_envir_name_tl} in case an |unknown| key is passed using |\setenumext|. % \iffalse %% Add keys |unknown| for |keyans|, |keyans*| and |keyanspic| environments. % \fi @@ -11540,7 +12039,10 @@ Some text here { \keys_define:nn { enumext / #1 } { - unknown .code:n = { \@@_keyans_unknown_keys:n {##1} } + unknown .code:n = { + \tl_set:Nn \l_@@_envir_name_tl {#1} + \@@_keyans_unknown_keys:n {##1} + }, } } \clist_map_inline:nn { keyans, keyans*, keyanspic } { \@@_tmp:n {#1} } @@ -11555,10 +12057,10 @@ Some text here { \tl_if_blank:nTF {#2} { - \msg_error:nnn { enumext } { keyans-unknown-key } {#1} + \msg_error:nne { enumext } { keyans-unknown-key } {#1} } { - \msg_error:nnnn { enumext } { keyans-unknown-key-value } {#1} {#2} + \msg_error:nnee { enumext } { keyans-unknown-key-value } {#1} {#2} } } % \end{macrocode} @@ -11574,7 +12076,7 @@ Some text here % \begin{macrocode} \keys_define:nn { enumext / enumext* } { - unknown .code:n = { \@@_starred_unknown_keys:n {#1} } + unknown .code:n = { \@@_starred_unknown_keys:n {#1} }, } % \end{macrocode} % Internal functions for handling |unknown| key. @@ -11608,7 +12110,7 @@ Some text here { \keys_define:nn { enumext / #1 } { - unknown .code:n = { \@@_standar_unknown_keys:n {##1} } + unknown .code:n = { \@@_standar_unknown_keys:n {##1} }, } } \clist_map_inline:nn { level-1,level-2,level-3,level-4 } { \@@_tmp:n {#1} } @@ -11661,31 +12163,27 @@ Some text here % \end{macro} % % \begin{macro}{\@@_keyans_starred_item:n} -% The function \cs{@@_keyans_starred_item:n} which will make a temporary -% copy of the current \mymeta{label}, execute the \mykey{show-ans} -% or \mykey{show-pos} keys using the function \cs{@@_keyans_show_left:n} -% and will display the \mymeta{contents} of that item using the internal -% copy \cs{@@_item_std:w}, this is necessary to prevent incrementing -% the current \emph{\enquote{counter}} of the original \mymeta{label}, -% followed by this it will execute function \cs{@@_keyans_show_item_opt:} -% handled by \mykey{wrap-opt} key. +% The function \cs{@@_keyans_starred_item:n} will take as argument |#1| +% the \emph{optional argument} \myoarg{content} passed to |\item*| and +% save it via the \cs{@@_keyans_save_item_opt:n} function, then activate +% the \mykey{wrap-label} key, execute |\item| using \cs{@@_item_std:w}, +% the \mykey{itemindent} key and print the \emph{optional argument} using +% the \cs{@@_keyans_show_item_opt:} function handled by the +% \mykey{wrap-opt} key. % \begin{macrocode} \cs_new_protected:Npn \@@_keyans_starred_item:n #1 { - \tl_set_eq:NN \l_@@_store_current_label_tmp_tl \l_@@_label_v_tl - \@@_keyans_show_left:n { #1 } + \@@_keyans_save_item_opt:n { #1 } \bool_set_true:N \l_@@_wrap_label_v_bool \@@_item_std:w \tl_use:N \l_@@_fake_item_indent_v_tl \@@_keyans_show_item_opt: % \end{macrocode} -% Recover the original value of the current \mymeta{label} and \emph{store} -% it first in the \emph{prop list} (including the \emph{optional argument}), -% run the internal \emph{\enquote{label and ref}} system if the -% \mykey{save-ref} key is active, \emph{store} it in the \emph{sequence} -% and finally increments \cs{g_@@_check_starred_cmd_int} for internal -% check system. +% Now \emph{store} the current \mymeta{label} first in the \emph{prop list} +% (including the \emph{optional argument}), run the internal \emph{\enquote{label and ref}} +% system if the \mykey{save-ref} key is active, then \emph{store} in the \emph{sequence} +% and finally increments \cs{g_@@_check_starred_cmd_int} for internal +% check system. % \begin{macrocode} - \tl_set_eq:NN \l_@@_label_v_tl \l_@@_store_current_label_tmp_tl \@@_keyans_addto_prop:n { #1 } \@@_keyans_store_ref: \@@_keyans_addto_seq:n { #1 } @@ -11695,14 +12193,16 @@ Some text here % \end{macro} % % \begin{macro}{\item*,\@@_keyans_redefine_item:} -% The function \cs{@@_keyans_redefine_item:} is responsible for adding -% the \emph{starred argument} and \emph{optional argument} by the -% \cs{@@_list_arg_two_v:} function in the definition of the -% \myenv*{keyans} environment. Here we need to use -% |\peek_remove_spaces:n| to prevent an unwanted space when using -% |\item*| in conjunction with the \mykey{itemindent} key. -% This function are passed to \myvarenv{__@@_list_arg_two_v:} used -% in the definition of the \myenv*{keyans} environment (\S\ref{ltx:second-arg}). +% The function \cs{@@_keyans_redefine_item:} is responsible for adding +% the \emph{starred argument} and \emph{optional argument} by the +% \cs{@@_list_arg_two_v:} function in the definition of the +% \myenv*{keyans} environment. Here we will set to true the variable +% \cs{l_@@_item_wrap_key_bool} used by the \mykey{wrap-ans*} key +% only when |\item*| is executed and additionally we need to use +% |\peek_remove_spaces:n| to avoid an unwanted space when using +% |\item*| together with the \mykey{itemindent} key. +% This function are passed to \myvarenv{__@@_list_arg_two_v:} used +% in the definition of the \myenv*{keyans} environment (\S\ref{ltx:second-arg}). % \iffalse %% Redefine |\item| for |keyans| environment. % \fi @@ -11713,12 +12213,14 @@ Some text here { \bool_if:nTF {##1} { + \bool_set_true:N \l_@@_item_wrap_key_bool % wrap-ans* \peek_remove_spaces:n { \@@_keyans_starred_item:n {##2} } } { + \bool_set_false:N \l_@@_item_wrap_key_bool \@@_keyans_default_item:n {##2} } } @@ -11726,11 +12228,12 @@ Some text here % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_keyans_make_label:,\@@_keyans_make_label_std:,\@@_keyans_make_label_box:} +% \begin{macro}{\@@_keyans_make_label:,\@@_keyans_wrapper_label:n, +% \@@_keyans_make_label_std:,\@@_keyans_make_label_box:} % The function \cs{@@_keyans_make_label:} redefine \ics{makelabel} % for the keys \mykey{mode-box}, \mykey{align}, \mykey{font}, -% \mykey{wrap-label}, \mykey{wrap-label*} and |\item*| for \myenv*{keyans} -% environment. +% \mykey{wrap-label}, \mykey{wrap-label*}, \mykey{wrap-ans*} and |\item*| +% for \myenv*{keyans} environment. % This function are passed to \myvarenv{__@@_list_arg_two_v:} used % in the definition of the \myenv*{keyans} environment (\S\ref{ltx:second-arg}). % \iffalse @@ -11754,6 +12257,28 @@ Some text here } } % \end{macrocode} +% We added conditionals to the \cs{@@_keyans_wraper_label:n} function +% to handle the keys \mykey{wrap-ans*}, \mykey{wrap-label} and \mykey{wrap-label*}. +% \begin{macrocode} +\cs_new_protected:Npn \@@_keyans_wrapper_label:n #1 + { + \bool_lazy_all:nT + { + { \bool_if_p:N \l_@@_wrap_label_v_bool } + { \bool_if_p:N \l_@@_show_answer_bool } + { \bool_if_p:N \l_@@_item_wrap_key_bool } + { \cs_if_exist_p:N \@@_keyans_wrapper_item_v:n } + } + { + \cs_set_eq:NN \@@_wrapper_label_v:n \@@_keyans_wrapper_item_v:n + } + \bool_if:NTF \l_@@_wrap_label_v_bool + { + \@@_wrapper_label_v:n { #1 } + } + { #1 } + } +% \end{macrocode} % Standard definition when |\DocumentMetadata| is not active. % \begin{macrocode} \cs_new_protected:Nn \@@_keyans_make_label_std: @@ -11761,12 +12286,10 @@ Some text here \RenewDocumentCommand \makelabel { m } { \tl_use:N \l_@@_label_fill_left_v_tl + \@@_keyans_show_ans: + \@@_keyans_show_pos: \tl_use:N \l_@@_label_font_style_v_tl - \bool_if:NTF \l_@@_wrap_label_v_bool - { - \@@_wrapper_label_v:n { ##1 } - } - { ##1 } + \@@_keyans_wrapper_label:n { ##1 } \tl_use:N \l_@@_label_fill_right_v_tl } } @@ -11782,12 +12305,10 @@ Some text here { \makebox[ \l_@@_labelwidth_v_dim ][ \l_@@_align_label_pos_v_str ] { + \@@_keyans_show_ans: + \@@_keyans_show_pos: \tl_use:N \l_@@_label_font_style_v_tl - \bool_if:NTF \l_@@_wrap_label_v_bool - { - \@@_wrapper_label_v:n { ##1 } - } - { ##1 } + \@@_keyans_wrapper_label:n { ##1 } } } } @@ -11797,11 +12318,11 @@ Some text here % % \subsection{Second argument of the lists}\label{ltx:second-arg} % -% At this point of the code we have already programmed most the necessary -% tools to create a custom \myenv{list} environment, remember that the function -% \cs{@@_start_list:nn} takes two arguments, the first one we have -% ready, the second one we will define for all the levels of the -% environment \myenv*{enumext} and the environment \myenv*{keyans}. +% At this point of the code we have already programmed most the necessary +% tools to create a custom \myenv{list} environment, remember that the function +% \cs{@@_start_list:nn} takes two arguments, the first one we have +% ready, the second one we will define for all the levels of the +% environment \myenv*{enumext} and the environment \myenv*{keyans}. % % \subsubsection{Calculation of \cs{leftmargin} and \cs{itemindent}}\label{int:leftmargin} % @@ -12879,7 +13400,8 @@ Some text here % \subsubsection{The environment \env{keyanspic}}\label{env:keyanspic} % % \begin{macro}[int]{label-pos, label-sep, layout-sty, layout-sep, -% layout-top,} +% layout-top, mark-ans, mark-pos, mark-sep, save-sep, +% wrap-opt, wrap-ans*, show-ans, show-pos} % First we define the key that allows us to process the position of the % \mymeta{label} centered \enquote{above} or \enquote{below} which will be \mykey{label-pos}, % the vertical separation of these from \emph{drawing or tabular} will be @@ -12914,13 +13436,30 @@ Some text here label-sep .value_required:n = true, layout-sty .tl_set:N = \l_@@_anspic_layout_style_tl, layout-sty .value_required:n = true, - layout-sep .code:n = \keys_set:nn { enumext / keyans } - { parsep = #1 }, + layout-sep .code:n = \keys_set:nn { enumext / keyans } { parsep = #1 }, layout-sep .value_required:n = true, - layout-top .code:n = \keys_set:nn { enumext / keyans } - { topsep = #1 }, + layout-top .code:n = \keys_set:nn { enumext / keyans } { topsep = #1 }, layout-top .value_required:n = true, - unknown .code:n = { \@@_keyans_unknown_keys:n {#1} } + mark-ans .code:n = \keys_set:nn { enumext / keyans } { mark-ans = #1 }, + mark-ans .value_required:n = true, + mark-pos .code:n = \keys_set:nn { enumext / keyans } { mark-pos = #1 }, + mark-pos .value_required:n = true, + mark-sep .code:n = \keys_set:nn { enumext / keyans } { mark-sep = #1 }, + mark-sep .value_required:n = true, + save-sep .code:n = \keys_set:nn { enumext / keyans } { save-sep = #1 }, + save-sep .value_required:n = true, + wrap-opt .code:n = \keys_set:nn { enumext / keyans } { wrap-opt = #1 }, + wrap-opt .value_required:n = true, + wrap-ans* .code:n = \keys_set:nn { enumext / keyans } { wrap-ans* = #1 }, + wrap-ans* .value_required:n = true, + show-ans .code:n = \keys_set:nn { enumext / keyans } { show-ans = #1 }, + show-ans .value_required:n = true, + show-pos .code:n = \keys_set:nn { enumext / keyans } { show-pos = #1 }, + show-pos .value_required:n = true, + unknown .code:n = { + \tl_set:Nn \l_@@_envir_name_tl { keyanspic } + \@@_keyans_unknown_keys:n {#1} + }, } % \end{macrocode} % \end{macro} @@ -13008,7 +13547,8 @@ Some text here % then set |\listparindent|, |\partopsep| and |\itemsep| to zero so that % the \emph{horizontal} and \emph{vertical} space is not affected. % \begin{macrocode} - \dim_add:Nn \leftmargin { -\labelwidth - \labelsep } + \dim_add:Nn \leftmargin { -\l_@@_labelwidth_v_dim - \l_@@_labelsep_v_dim } + \ignorespaces \skip_add:Nn \topsep { 0.5\box_dp:N \strutbox } \dim_zero:N \listparindent \skip_zero:N \partopsep @@ -13186,7 +13726,7 @@ Some text here % to the command. Here we will store the \mymeta{label} and % \emph{optional argument} in \emph{prop list} and \emph{sequence} % and execute the \mykey{show-ans}, \mykey{show-pos}, \mykey{font}, -% \mykey{wrap-label} and \mykey{wrap-opt} keys. +% \mykey{wrap-label}, \mykey{wrap-ans*} and \mykey{wrap-opt} keys. % \iffalse %% Process and store label and [opt] for |\anspic|. % \fi @@ -13195,24 +13735,30 @@ Some text here { \makebox[ \l_@@_anspic_mini_width_dim ][ c ] { - \bool_if:nT { #1 } + \bool_if:nTF { #1 } { + \bool_set_true:N \l_@@_item_wrap_key_bool + \bool_set_true:N \l_@@_wrap_label_v_bool + \@@_keyans_save_item_opt:n { #2 } \@@_keyans_addto_prop:n { #2 } \@@_keyans_store_ref: \@@_keyans_addto_seq:n { #2 } \int_gincr:N \g_@@_check_starred_cmd_int - \bool_lazy_or:nnT - { \bool_if_p:N \l_@@_show_answer_bool } - { \bool_if_p:N \l_@@_show_position_bool } + \@@_keyans_show_ans: + \@@_keyans_show_pos: + \makebox[ \l_@@_labelwidth_v_dim ][c] { - \tl_set_eq:NN \l_@@_label_v_tl \l_@@_label_vi_tl - \@@_keyans_show_left:n { #2 } - \tl_set_eq:NN \l_@@_label_vi_tl \l_@@_label_v_tl + \tl_use:N \l_@@_label_font_style_v_tl + \@@_keyans_wrapper_label:n { \l_@@_label_vi_tl } } + \skip_horizontal:n { \l_@@_labelsep_v_dim } + \@@_keyans_show_item_opt: + } + { + \bool_set_false:N \l_@@_item_wrap_key_bool + \tl_use:N \l_@@_label_font_style_v_tl + \@@_wrapper_label_v:n { \l_@@_label_vi_tl } } - \tl_use:N \l_@@_label_font_style_v_tl - \@@_wrapper_label_v:n { \l_@@_label_vi_tl } - \@@_keyans_show_item_opt: } } % \end{macrocode} @@ -13625,7 +14171,7 @@ Some text here % \cs{@@_after_list_vii:} function in the second part of the \myenv*{enumext*} % environment definition (\S\ref{env:starred}). % \iffalse -%% Stop support for |mini-env| key ans stop |list| in |enumext*| environment. +%% Stop support for |mini-env| key and stop |list| in |enumext*| environment. % \fi % \begin{macrocode} \cs_new_protected:Nn \@@_stop_mini_vii: @@ -14490,9 +15036,9 @@ Some text here % \end{macrocode} % The function \cs{@@_item_peek_args_viii:} will handle the \ics*{item}\myparg{number}. % Look for the argument \enquote{\textcolor{MediumOrchid}{\ttfamily (}}, if it is -% present we will call the function \cs{@@_joined_item_viii:w} \myparg{number}, which is in charge of joining the item's -% in the same row, in case they are not present we will set the default -% value \textcolor{gray}{\ttfamily(\mydim{1})}. +% present we will call the function \cs{@@_joined_item_viii:w} \myparg{number}, +% which is in charge of joining the item's in the same row, in case they +% are not present we will set the default value \textcolor{gray}{\ttfamily(\mydim{1})}. % \iffalse %% Peek argument for \item(number)*[opt] for |keyans*| environment. % \fi @@ -14518,7 +15064,7 @@ Some text here { \@@_starred_joined_item_viii:n {#1} \peek_meaning_remove:NTF * - { \@@_starred_item_viii:w } + { \@@_starred_item_viii:w } { \@@_standar_item_viii:w } } % \end{macrocode} @@ -14540,6 +15086,7 @@ Some text here \cs_new_protected:Npn \@@_standar_item_viii:w { \bool_set_false:N \l_@@_item_starred_viii_bool + \bool_set_false:N \l_@@_item_wrap_key_bool \peek_meaning:NTF [ { \bool_set_eq:NN \l_@@_wrap_label_viii_bool \l_@@_wrap_label_opt_viii_bool @@ -14555,7 +15102,7 @@ Some text here % \end{macro} % % \begin{macro}{\@@_starred_item_viii:w, \@@_starred_item_viii_aux_i:w, -% \@@_starred_item_viii_aux_ii:w, \@@_starred_item_exec:} +% \@@_starred_item_viii_aux_ii:w, \@@_keyans_starred_item_star:} % The function \cs{@@_starred_item_viii:w} together with the specified % auxiliary functions |aux_i:w| and |aux_ii:w| execute \ics*{item*} % and \ics*{item*}\myoarg{content}. @@ -14566,6 +15113,7 @@ Some text here \cs_new_protected:Npn \@@_starred_item_viii:w { \bool_set_true:N \l_@@_item_starred_viii_bool + \bool_set_true:N \l_@@_item_wrap_key_bool \bool_set_true:N \l_@@_wrap_label_viii_bool \peek_meaning:NTF [ { \@@_starred_item_viii_aux_i:w } @@ -14583,11 +15131,11 @@ Some text here \tl_clear:N \l_@@_store_current_label_tl \tl_if_novalue:nF { #1 } { - \tl_if_empty:NF \l_@@_store_keyans_item_opt_sep_tl + \tl_if_empty:NF \l_@@_store_keyans_item_opt_sep_viii_tl { \tl_put_right:Ne \l_@@_store_current_label_tl { - \l_@@_store_keyans_item_opt_sep_tl + \l_@@_store_keyans_item_opt_sep_viii_tl } \tl_put_right:Ne \l_@@_store_current_label_tl { #1 } } @@ -14601,17 +15149,17 @@ Some text here \@@_start_item_viii:w [ \l_@@_label_viii_tl ] \ignorespaces } % \end{macrocode} -% The function \cs{@@_starred_item_exec:} will be in charge of storing +% The function \cs{@@_keyans_starred_item_star:} will be in charge of storing % the current \mymeta{label} for \ics*{item*} followed by the % \myoarg{content} for \ics*{item*}\myoarg{content} if % present in the \emph{sequence} and \emph{prop list} set by the % \mykey{save-ans} key. In this same function the keys \mykey{show-ans}, -% \mykey{show-pos} and \mykey{save-ref} are implemented. +% \mykey{show-pos}, \mykey{mark-sep} and \mykey{save-ref} are implemented. % \iffalse %% Set \item*[content] for |keyans*| environment. % \fi % \begin{macrocode} -\cs_new_protected:Nn \@@_starred_item_exec: +\cs_new_protected:Nn \@@_keyans_starred_item_star: { \tl_put_left:Ne \l_@@_store_current_label_tl { \l_@@_label_viii_tl } \@@_store_addto_prop:V \l_@@_store_current_label_tl @@ -14619,9 +15167,16 @@ Some text here \tl_put_left:Ne \l_@@_store_current_label_tl { \item } \@@_keyans_addto_seq_link: \int_gincr:N \g_@@_check_starred_cmd_int + \dim_compare:nNnT { \l_@@_mark_sym_sep_viii_dim } = { \c_zero_dim } + { + \dim_set:Nn \l_@@_mark_sym_sep_viii_dim { \l_@@_labelsep_viii_dim } + } \bool_if:NT \l_@@_show_answer_bool { - \@@_print_keyans_box:NN \l_@@_labelwidth_i_dim \l_@@_labelsep_i_dim + \tl_set_eq:NN \l_@@_mark_answer_sym_tl \l_@@_mark_answer_sym_viii_tl + \str_set_eq:NN \l_@@_mark_position_str \l_@@_mark_position_viii_str + \@@_print_keyans_box:NN + \l_@@_labelwidth_viii_dim \l_@@_mark_sym_sep_viii_dim } \bool_if:NT \l_@@_show_position_bool { @@ -14636,19 +15191,40 @@ Some text here ] \group_end: } - \@@_print_keyans_box:NN \l_@@_labelwidth_i_dim \l_@@_labelsep_i_dim + \str_set_eq:NN \l_@@_mark_position_str \l_@@_mark_position_viii_str + \@@_print_keyans_box:NN + \l_@@_labelwidth_viii_dim \l_@@_mark_sym_sep_viii_dim } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_fake_make_label_viii:n} +% \begin{macro}{\@@_keyans_wraper_label_viii:n, \@@_fake_make_label_viii:n} % The implementation at this is very similar to that of the % \myenv*{enumext*} environment. % \iffalse %% Define a fake |\makelabel| for |keyans*| environment. % \fi % \begin{macrocode} +\cs_new_protected:Npn \@@_keyans_wraper_label_viii:n #1 + { + \bool_lazy_all:nT + { + { \bool_if_p:N \l_@@_wrap_label_viii_bool } + { \bool_if_p:N \l_@@_show_answer_bool } + { \bool_if_p:N \l_@@_item_wrap_key_bool } + { \cs_if_exist_p:N \@@_keyans_wrapper_item_viii:n } + } + { + \cs_set_eq:NN + \@@_wrapper_label_viii:n \@@_keyans_wrapper_item_viii:n + } + \bool_if:NTF \l_@@_wrap_label_viii_bool + { + \@@_wrapper_label_viii:n {#1} + } + { #1 } + } \cs_new_protected_nopar:Npn \@@_fake_make_label_viii:n #1 { \legacy_if:nT { @noitemarg } @@ -14661,16 +15237,12 @@ Some text here } \bool_if:NT \l_@@_item_starred_viii_bool { - \@@_starred_item_exec: + \@@_keyans_starred_item_star: } \makebox[ \l_@@_labelwidth_viii_dim ][ \l_@@_align_label_viii_str ] { \tl_use:N \l_@@_label_font_style_viii_tl - \bool_if:NTF \l_@@_wrap_label_viii_bool - { - \@@_wrapper_label_viii:n {#1} - } - { #1 } + \@@_keyans_wraper_label_viii:n {#1} } \skip_horizontal:N \l_@@_labelsep_viii_dim \ignorespaces } @@ -14708,7 +15280,7 @@ Some text here \tl_use:N \l_@@_fake_item_indent_viii_tl \bool_if:NT \l_@@_item_starred_viii_bool { - \@@_keyans_show_item_opt: + \@@_keyans_show_item_opt_viii: } \tl_use:N \l_@@_after_list_args_viii_tl } @@ -14844,27 +15416,39 @@ Some text here print* .code:n = \keys_precompile:neN { enumext / enumext* } { \@@_filter_save_key:n {#1} } \l_@@_print_keyans_starred_tl, % starred cmd - print* .initial:n = { nosep, label=\arabic*., columns=2, first=\small, font=\small }, + print* .initial:n = { labelwidth=0pt, labelsep=0.3333em, itemindent=0pt, list-offset=0pt, + rightmargin=0pt, listparindent=0pt, nosep, label=\arabic*., + columns=2, first=\small, font=\small }, print-1 .code:n = \keys_precompile:neN { enumext / level-1 } { \@@_filter_save_key:n {#1} } \l_@@_print_keyans_i_tl, - print-1 .initial:n = { nosep, label=\arabic*., columns=2, first=\small, font=\small }, + print-1 .initial:n = { labelwidth=0pt, labelsep=0.3333em, itemindent=0pt, list-offset=0pt, + rightmargin=0pt, listparindent=0pt, nosep, label=\arabic*., + columns=2, first=\small, font=\small }, print-2 .code:n = \keys_precompile:neN { enumext / level-2 } { \@@_filter_save_key:n {#1} } \l_@@_print_keyans_ii_tl, - print-2 .initial:n = { nosep, label=(\alph*), first=\small, font=\small }, + print-2 .initial:n = { labelwidth=0pt, labelsep=0.3333em, itemindent=0pt, list-offset=0pt, + rightmargin=0pt, listparindent=0pt, nosep, label=(\alph*), + first=\small, font=\small }, print-3 .code:n = \keys_precompile:neN { enumext / level-3 } { \@@_filter_save_key:n {#1} } \l_@@_print_keyans_iii_tl, - print-3 .initial:n = { nosep, label=\roman*., first=\small, font=\small }, + print-3 .initial:n = { labelwidth=0pt, labelsep=0.3333em, itemindent=0pt, list-offset=0pt, + rightmargin=0pt, listparindent=0pt, nosep, label=\roman*., + first=\small, font=\small }, print-4 .code:n = \keys_precompile:neN { enumext / level-4 } { \@@_filter_save_key:n {#1} } \l_@@_print_keyans_iv_tl, - print-4 .initial:n = { nosep, label=\Alph*., first=\small, font=\small }, + print-4 .initial:n = { labelwidth=0pt, labelsep=0.3333em, itemindent=0pt, list-offset=0pt, + rightmargin=0pt, listparindent=0pt, nosep, label=\Alph*., + first=\small, font=\small }, print-* .code:n = \keys_precompile:neN { enumext / enumext* } { \@@_filter_save_key:n {#1} } \l_@@_print_keyans_vii_tl, % starred nested - print-* .initial:n = { nosep, label=\arabic*., first=\small, font=\small }, + print-* .initial:n = { labelwidth=0pt, labelsep=0.3333em, itemindent=0pt, list-offset=0pt, + rightmargin=0pt, listparindent=0pt, nosep, label=\arabic*., + first=\small, font=\small }, } % \end{macrocode} % diff --git a/macros/latex/contrib/enumext/enumext.pdf b/macros/latex/contrib/enumext/enumext.pdf Binary files differindex 0a70a539d5..cd5ed29770 100644 --- a/macros/latex/contrib/enumext/enumext.pdf +++ b/macros/latex/contrib/enumext/enumext.pdf diff --git a/macros/latex/contrib/postnotes/CHANGELOG.md b/macros/latex/contrib/postnotes/CHANGELOG.md index 26355acbff..50939a8571 100644 --- a/macros/latex/contrib/postnotes/CHANGELOG.md +++ b/macros/latex/contrib/postnotes/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog -## [Unreleased](https://github.com/gusbrs/postnotes/compare/v0.4.0...HEAD) +## [Unreleased](https://github.com/gusbrs/postnotes/compare/v0.4.1...HEAD) + +## [v0.4.1](https://github.com/gusbrs/postnotes/compare/v0.4.0...v0.4.1) (2024-11-14) + +### Fixed +- Explicitly set `\@currentHref` before storing data at `\postnote`. ## [v0.4.0](https://github.com/gusbrs/postnotes/compare/v0.3.0...v0.4.0) (2024-11-04) diff --git a/macros/latex/contrib/postnotes/postnotes-code.pdf b/macros/latex/contrib/postnotes/postnotes-code.pdf Binary files differindex 6e988f9d09..26dea12800 100644 --- a/macros/latex/contrib/postnotes/postnotes-code.pdf +++ b/macros/latex/contrib/postnotes/postnotes-code.pdf diff --git a/macros/latex/contrib/postnotes/postnotes-doc.pdf b/macros/latex/contrib/postnotes/postnotes-doc.pdf Binary files differindex d5a31a5aa7..7dccd503c1 100644 --- a/macros/latex/contrib/postnotes/postnotes-doc.pdf +++ b/macros/latex/contrib/postnotes/postnotes-doc.pdf diff --git a/macros/latex/contrib/postnotes/postnotes.dtx b/macros/latex/contrib/postnotes/postnotes.dtx index f218888dac..ed80d0e1cd 100644 --- a/macros/latex/contrib/postnotes/postnotes.dtx +++ b/macros/latex/contrib/postnotes/postnotes.dtx @@ -153,7 +153,7 @@ % % % \begin{macrocode} -\ProvidesExplPackage {postnotes} {2024-11-04} {0.4.0} +\ProvidesExplPackage {postnotes} {2024-11-14} {0.4.1} {Endnotes for LaTeX} % \end{macrocode} % @@ -1247,6 +1247,8 @@ { \l_postnotes_note_id_tl } \cs_set:Npn \@currentcounter { postnote } \cs_set:Npe \@currentlabel { \p@postnote \l_@@_mark_tl } + \cs_gset:Npe \@currentHref + { postnote. \l_postnotes_note_id_tl .mark } \@@_store:nn { \l_postnotes_note_id_tl } {#2} \tl_set_eq:NN \l_@@_mark_typeset_tl \l_@@_mark_tl % \end{macrocode} diff --git a/macros/latex/contrib/rebuttal/README.md b/macros/latex/contrib/rebuttal/README.md index 1dfeb826b3..13c5c8644f 100644 --- a/macros/latex/contrib/rebuttal/README.md +++ b/macros/latex/contrib/rebuttal/README.md @@ -107,3 +107,8 @@ The `ref` option provided by markup commands may specify multiple labels: * Rebuttal markup cannot be used within floating environments such as `figure` and `table`, and the `\caption` command. + +## License + +The `rebuttal` package is distributed under the [LaTeX Project Public +License 1.3](https://ctan.org/license/lppl1.3) or later. diff --git a/macros/latex/contrib/rebuttal/examples/01-scrlttr2.pdf b/macros/latex/contrib/rebuttal/examples/01-scrlttr2.pdf Binary files differnew file mode 100644 index 0000000000..f6a6a62e39 --- /dev/null +++ b/macros/latex/contrib/rebuttal/examples/01-scrlttr2.pdf diff --git a/macros/latex/contrib/rebuttal/examples/02-article.pdf b/macros/latex/contrib/rebuttal/examples/02-article.pdf Binary files differnew file mode 100644 index 0000000000..ad39184b55 --- /dev/null +++ b/macros/latex/contrib/rebuttal/examples/02-article.pdf diff --git a/macros/latex/contrib/rebuttal/rebuttal.dtx b/macros/latex/contrib/rebuttal/rebuttal.dtx index 288f47e1bd..9e8b1d8233 100644 --- a/macros/latex/contrib/rebuttal/rebuttal.dtx +++ b/macros/latex/contrib/rebuttal/rebuttal.dtx @@ -15,7 +15,7 @@ % \iffalse %<package>\NeedsTeXFormat{LaTeX2e} %<package>\ProvidesPackage{rebuttal} -%<package> [2024-11-01 v0.1.0 Markup for rebuttal letters] +%<package> [2024-11-14 v0.1.1 Markup for rebuttal letters] % %<*driver> \ProvidesFile{rebuttal.dtx} @@ -31,13 +31,14 @@ \usepackage{hyperref} \EnableCrossrefs -\OnlyDescription \CodelineIndex \RecordChanges \hypersetup{% pdfauthor = {Sergiu Deitsch}, pdftitle = {The rebuttal package}, + urlcolor = NavyBlue, + linkcolor = Firebrick3, } \begin{document} @@ -66,22 +67,25 @@ % % % \changes{v0.1.0}{2024-11-01}{Initial release} +% \changes{v0.1.1}{2024-11-14}{Improved documentation} % % \GetFileInfo{rebuttal.sty} % -% \DoNotIndex{\newcommand,\newenvironment,\def,\the,\let,\if,\fi,\else} +% \DoNotIndex{\newcommand,\newenvironment,\def,\the,\let,\if,\fi,\else,\\} % \DoNotIndex{\newif,\ifx,\ifcase,\or} % \DoNotIndex{\begingroup,\endgroup} % -% \title{The \textsf{rebuttal} package\thanks{This document -% corresponds to \textsf{rebuttal}~\fileversion, dated \filedate.}} -% \author{Sergiu Deitsch\\\texttt{sergiu.deitsch@gmail.com}} -% \date{November 1, 2024} +% \title{The \href{https://github.com/sergiud/rebuttal}{\textsf{rebuttal}} package% +% \thanks{This document corresponds to \textsf{rebuttal}~\fileversion, dated \filedate.}} +% \author{Sergiu % Deitsch\\% +% \href{mailto:sergiu.deitsch@gmail.com}{\texttt{sergiu.deitsch@gmail.com}}% +% } +% \date{November 14, 2024} % % \maketitle % % \begin{abstract} -% The rebuttal LaTeX package provides means for writing structured journal and +% The rebuttal \LaTeX\ package provides means for writing structured journal and % conference paper rebuttals. % \end{abstract} % @@ -110,8 +114,9 @@ % \DescribeEnv{answer} % The packages defines the |rebuttal| environment that can contain several % blocks that refer to editor's or specific reviewers' comments and your replies -% to referees' comments. Specifically, the environment is expected to contain a -% |comment| and an |answer| environment. The general layout looks as follows: +% to referees' comments. Specifically, the environment accepts an optional +% \oarg{title} and is expected to contain a |comment| and an |answer| +% environment. The general layout looks as follows: % % \begin{verbatim} % \begin{rebuttal}[Editor's Comments] @@ -132,7 +137,9 @@ % Within the manuscript, three main commands can be used to denote additions, % deletions, or changes. The corresponding commands are % |\addition|\oarg{options}\marg{text}, |\deletion|\oarg{options}\marg{text}, -% and |\change|\oarg{options}\marg{old text}\marg{new text}. +% and |\change|\oarg{options}\marg{old text}\marg{new text}. While |\addition| +% and |\deletion| require a single argument. |\change| expects two arguments, +% where the first one denotes the changed text, and the second one the new text. % % All three commands require specifying their labels for referencing the % modifications using the \meta{label} option. Additionally, the \meta{ref} @@ -143,11 +150,6 @@ % \addition[label=a:new,ref={c:c1,c:c2}]{new text}. % \end{verbatim} % -% While |\addition| and -% |\deletion| require a single argument. |\change| expects two arguments, where -% the first one denotes the changed text, and the second one the new text. -% -% % \subsection{Annotating Multiple Paragraphs} % % \DescribeEnv{additionenv} @@ -173,12 +175,24 @@ % \end{deletionenv} % \end{verbatim} % +% \subsection{Disabling Annotations} +% +% \DescribeMacro{\rebuttalset} +% Once a manuscript has been accepted for publication, rebuttal annotations are +% no longer necessary and only the accepted changes should be typeset. +% \textsf{rebuttal} allows to disable annotations using the |\rebuttalset| +% command by disabling the \meta{marked} option, \ie, +% \begin{verbatim} +% \rebuttalset{marked=false} +% \end{verbatim} +% which will disable the annotiations in the current group. +% % \section{Known Limitations} % % Rebuttal markup cannot be used within floating environments such as |figure| % and |table|, and the |\caption| command. % -% \MaybeStop{\PrintChanges} +% \MaybeStop{\PrintChanges\PrintIndex} % % \section{Implementation} % @@ -187,10 +201,12 @@ % \begin{macrocode} %<*package> % \end{macrocode} +% We need to load additional color sets. % \begin{macrocode} - \PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor} - +% \end{macrocode} +% Package dependencies. +% \begin{macrocode} \RequirePackage{calc} \RequirePackage{environ} \RequirePackage{etoolbox} @@ -210,7 +226,10 @@ \ifx\counterwithin\@undefined \RequirePackage{chngcntr} \fi - +% \end{macrocode} +% \begin{macro}{\rebuttal@triangle} +% The following command is used to generate a triangle in the left margin. +% \begin{macrocode} \newcommand\rebuttal@triangle{% \begingroup \ifx\tikzexternaldisable\@undefined\else @@ -221,7 +240,12 @@ \end{tikzpicture}% \endgroup } - +% \end{macrocode} +% \end{macro} +% \begin{macro}{\rebuttal@decbookmarklevel} +% Unless \textsf{hyperref} was not loaded, the command decrements the current +% bookmark level. +% \begin{macrocode} \newcommand\rebuttal@decbookmarklevel{% \ifx\Hy@currentbookmarklevel\@undefined\else \@tempcnta\Hy@currentbookmarklevel @@ -229,7 +253,13 @@ \xdef\Hy@currentbookmarklevel{\the\@tempcnta}% \fi } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\rebuttal@incbookmarklevel} +% Unless \textsf{hyperref} was not loaded, the command incements the current +% bookmark level. +% \begin{macrocode} \newcommand\rebuttal@incbookmarklevel{% \ifx\Hy@currentbookmarklevel\@undefined\else \@tempcnta\Hy@currentbookmarklevel @@ -237,7 +267,10 @@ \xdef\Hy@currentbookmarklevel{\the\@tempcnta}% \fi } +% \end{macrocode} +% \end{macro} +% \begin{macrocode} \newif\ifrebuttal@marked \newif\ifrebuttal@nohyperlinks \newif\ifrebuttal@refbreak @@ -371,22 +404,30 @@ \label{\pgfkeysvalueof{/rebuttal/#1/label}}% \colorlet{Changes@Color}{rebuttal@#1}% \begingroup - % Main content +% \end{macrocode} +% Main content. +% \begin{macrocode} #2% \endgroup \StrLeft{#1}{1}[\rebuttal@id]% \ifx\tikzexternaldisable\@undefined\else \tikzexternaldisable \fi - % Shrink to text +% \end{macrocode} +% Shrink to text. +% \begin{macrocode} \settowidth\rebuttal@textwidth{\rebuttal@reference{#1}}% \tikzset{notestyleraw/.append style={text width=\rebuttal@textwidth}}% - % Place labels in left margin at the same distance as on the right +% \end{macrocode} +% Place labels in left margin at the same distance as on the right. +% \begin{macrocode} \setlength\rebuttal@hskip{\marginparwidth}% \addtolength\rebuttal@hskip{-\rebuttal@textwidth}% \let\old@xmpar\@xmpar - % Hook into LaTeX kernel command since \if@firstcolumn is not unreliable - % because margin notes are floats. +% \end{macrocode} +% Hook into \LaTeX\ kernel command since |\if@firstcolumn| is not unreliable +% because margin notes are floats. +% \begin{macrocode} \renewcommand\@xmpar[2][]{% \old@xmpar[\hspace*{\rebuttal@hskip}####1]{####2}% }% @@ -406,20 +447,36 @@ \fi }% } +% \end{macrocode} -% Provide an equivalent environment for rebuttal commands +% \begin{environment}{additionenv} +% Provide an equivalent environment for the |\addition| command. +% \begin{macrocode} \NewEnviron{additionenv}[1][]{% \addition[#1]{\BODY}% }% +% \end{macrocode} +% \end{environment} +% \begin{environment}{changeenv} +% Provide an equivalent environment for the |\change| command. +% \begin{macrocode} \NewEnviron{changeenv}[2][]{% \change[#1]{#2}{\BODY}% }% +% \end{macrocode} +% \end{environment} +% \begin{environment}{deletionenv} +% Provide an equivalent environment for the |\deletion| command. +% \begin{macrocode} \NewEnviron{deletionenv}[1][]{% \deletion[#1]{\BODY}% }% +% \end{macrocode} +% \end{environment} +% \begin{macrocode} \newcommand\rebuttal@added[1]{% \ifrebuttal@marked \rebuttal@addition@font% @@ -472,8 +529,11 @@ \counterwithin*{rebuttalanswer}{rebuttalcomment}% \newdimen\rebuttal@labelsep +% \end{macrocode} -% Disable hyperlinks if NoHyper environment is available +% \begin{macro}{\rebuttal@startlinkguard} +% Disable hyperlinks if |NoHyper| environment is available. +% \begin{macrocode} \newcommand\rebuttal@startlinkguard{% \ifx\NoHyper\@undefined\else \ifrebuttal@nohyperlinks @@ -481,8 +541,12 @@ \fi \fi } +% \end{macrocode} +% \end{macro} -% End of disable hyperlinks if NoHyper environment is available +% \begin{macro}{\rebuttal@startlinkguard} +% End of disable hyperlinks if |NoHyper| environment is available. +% \begin{macrocode} \newcommand\rebuttal@endlinkguard{ \ifx\endNoHyper\@undefined\else \ifrebuttal@nohyperlinks @@ -490,17 +554,27 @@ \fi \fi } +% \end{macrocode} +% \end{macro} % TODO Comment labels tooltips +% \begin{environment}{rebuttal} +% The main environment that defines the remaining ones. +% \changes{v0.1.1}{2024-11-14}{Fixed incorrect bookmark structure} +% \begin{macrocode} \newenvironment{rebuttal}[1][]{% \rebuttal@startlinkguard - % Execute user code +% \end{macrocode} +% Execute user code. +% \begin{macrocode} \pgfkeysvalueof{/rebuttal/execute on begin}% \begingroup \refstepcounter{rebuttal}% \if@twocolumn \onecolumn - % Remember the layout +% \end{macrocode} +% Remember the layout. +% \begin{macrocode} \rebuttal@twocolumntrue \else \rebuttal@twocolumnfalse @@ -509,8 +583,22 @@ \par \addvspace{\bigskipamount}% \ifstrempty{#1}{}{% - \ifx\subpdfbookmark\@undefined\else - \subpdfbookmark{#1}{rebuttalcomment.\therebuttalcomment}% +% \end{macrocode} +% In case the current bookmark level is 0, we leave it as is. Otherwise, we +% increment the level to anchor the following bookmarks below the current +% bookmark. This ensures that the bookmark structure is correct even if the +% document either does not use or provides structuring commands (\eg, +% missing |\section| in a \textsf{scrlttr2} document). +% \begin{macrocode} + \ifx\Hy@currentbookmarklevel\@undefined\else + \ifnum\Hy@currentbookmarklevel>0 + \@tempcnta\Hy@currentbookmarklevel + \advance\@tempcnta by 1 % + \xdef\Hy@currentbookmarklevel{\the\@tempcnta}% + \fi + \fi + \ifx\currentpdfbookmark\@undefined\else + \currentpdfbookmark{#1}{rebuttalcomment.\therebuttalcomment}% \fi \noindent\bgroup\rebuttal@titlefont\strut \pgfkeys{/rebuttal/title/format=#1}\egroup% @@ -541,8 +629,10 @@ \PackageWarning{rebuttal}{Failed to patch the \string\@item\space command. Bookmarks may not be displayed correctly.}% }% - % Do not allow to place answers within a comment by undefining the answer - % environment +% \end{macrocode} +% Do not allow to place answers within a comment by undefining the answer +% environment +% \begin{macrocode} \let\answer\@undefined \let\endanswer\@undefined \stepcounter{rebuttalcomments}% @@ -598,16 +688,23 @@ \endgroup \par\addvspace{\bigskipamount}% \ifrebuttal@twocolumn - % Restore the layout +% \end{macrocode} +% Restore the layout. +% \begin{macrocode} \twocolumn \fi \endgroup - % Execute user code +% \end{macrocode} +% Execute user code. +% \begin{macrocode} \pgfkeysvalueof{/rebuttal/execute on end}% \rebuttal@endlinkguard } +% \end{macrocode} +% \end{environment} -% Support cleveref +% Support \textsf{cleveref}. +% \begin{macrocode} \AtEndPreamble{% \@ifpackageloaded{cleveref}{% \crefname{rebuttalcomment}{comment}{comments} @@ -633,11 +730,20 @@ \gdef\string\rebuttaltotalchanges{\arabic{rebuttalchanges}}% } } - +% \end{macrocode} +% \begin{macro}{\rebuttalset}\marg{options} +% Allows to update package options. +% \begin{macrocode} \newcommand\rebuttalset[1]{% \pgfqkeys{/rebuttal}{#1}% } %</package> +% \end{macrocode} +% \end{macro} +% +% \subsection{Example} +% +% \begin{macrocode} %<*example1> \documentclass[american,version=last,fromphone,fromemail,svgnames,dvipsnames,x11names]{scrlttr2} \usepackage[T1]{fontenc} @@ -695,16 +801,38 @@ We are looking forward to hearing from you. \closing{With kind regards,} \end{letter} +\include{rebuttal} +\end{document} +%</example1> +% \end{macrocode} +% +% \begin{macrocode} +%<*example2> +\documentclass{article} +\usepackage{rebuttal} +\usepackage[colorlinks]{hyperref} +\usepackage{lipsum} +\usepackage{cleveref} -\clearpage\noindent The following pages contain a list of editor's and -reviewers' comments followed by our replies. The comments are sequentially -numbered and associated either with the editor or the corresponding reviewer. -The replies may contain references to changes in the original manuscript which -are identified by a label consisting of a running number and followed by the -label of the original comment in parentheses. The label back references the -original reviewer comment within the manuscript. For instance, the reference -\textbf{C2~(1.3)}, which is typeset in the manuscript margin, refers to the -second change stemming from the third comment of the first reviewer. +\begin{document} +\section{Test} +\input{rebuttal} +\end{document} +%</example2> +% \end{macrocode} +% +% \begin{macrocode} +%<*rebuttal-comments> + +The following pages contain a list of editor's and reviewers' comments followed +by our replies. The comments are sequentially numbered and associated either +with the editor or the corresponding reviewer. The replies may contain +references to changes in the original manuscript which are identified by a label +consisting of a running number and followed by the label of the original comment +in parentheses. The label back references the original reviewer comment within +the manuscript. For instance, the reference \textbf{C2~(1.3)}, which is typeset +in the manuscript margin, refers to the second change stemming from the third +comment of the first reviewer. \begin{rebuttal}[Editor's Comments] \begin{comment} @@ -782,9 +910,11 @@ Additional notes: \item If the references do not fit into a single line in the margin, you may force a \addition[label=a:break,ref={c:specific,c:c2},break]{break}. \end{itemize} - -\end{document} -%</example1> +%</rebuttal-comments> % \end{macrocode} % +% \Finale + +% \endinput + % vim: ft=tex diff --git a/macros/latex/contrib/rebuttal/rebuttal.ins b/macros/latex/contrib/rebuttal/rebuttal.ins index 5e1d03bf2e..fc6493ddd7 100644 --- a/macros/latex/contrib/rebuttal/rebuttal.ins +++ b/macros/latex/contrib/rebuttal/rebuttal.ins @@ -39,7 +39,9 @@ This work consists of the files rebuttal.dtx and rebuttal.ins. \generate{ \file{rebuttal.sty}{\from{rebuttal.dtx}{package}} - \file{01-example.tex}{\from{rebuttal.dtx}{example1}} + \file{rebuttal.tex}{\from{rebuttal.dtx}{rebuttal-comments}} + \file{01-scrlttr2.tex}{\from{rebuttal.dtx}{example1}} + \file{02-article.tex}{\from{rebuttal.dtx}{example2}} } \obeyspaces diff --git a/macros/latex/contrib/rebuttal/rebuttal.pdf b/macros/latex/contrib/rebuttal/rebuttal.pdf Binary files differindex 686fe30326..b567dba78c 100644 --- a/macros/latex/contrib/rebuttal/rebuttal.pdf +++ b/macros/latex/contrib/rebuttal/rebuttal.pdf diff --git a/macros/latex/contrib/setspaceenhanced/README.md b/macros/latex/contrib/setspaceenhanced/README.md index a7787744c1..fe19fd2ed1 100644 --- a/macros/latex/contrib/setspaceenhanced/README.md +++ b/macros/latex/contrib/setspaceenhanced/README.md @@ -2,7 +2,7 @@ Copyright © 2008–2024 Markus Kohm -Release: 2024-11-05 v1.03 +Release: 2024-11-12 v1.04 License: LPPL 1.3c diff --git a/macros/latex/contrib/setspaceenhanced/announcement.txt b/macros/latex/contrib/setspaceenhanced/announcement.txt new file mode 100644 index 0000000000..d45adfaa8f --- /dev/null +++ b/macros/latex/contrib/setspaceenhanced/announcement.txt @@ -0,0 +1,13 @@ +setspaceenhanced is based on the setspace package whose functionality +it extends and improves. Changes in version 1.04 are: + + +- Fixed an initialization error when using option byselectfont → Issue #3. + + +- Implementation of the little-known setspace option nodispayskipstretch + for compatibility reasons → Issue #4. + + +- Automatic adoption of the options of a previously loaded setspace for + the initialization of own options. diff --git a/macros/latex/contrib/setspaceenhanced/setspaceenhanced.dtx b/macros/latex/contrib/setspaceenhanced/setspaceenhanced.dtx index 20b59cc7c8..61ab7bbb10 100644 --- a/macros/latex/contrib/setspaceenhanced/setspaceenhanced.dtx +++ b/macros/latex/contrib/setspaceenhanced/setspaceenhanced.dtx @@ -32,7 +32,7 @@ %</dtx> %<*dtx|package> %<package>\ProvidesExplPackage{setspaceenhanced} - {2024-11-05}{1.03} + {2024-11-12}{1.04} {% %<*dtx> sources and unpack driver of @@ -284,8 +284,8 @@ by \end{verbatim} If you want you can alternatively also load both packages explicitly, either -\pkg{setspace} before \pkg{setspaceenhanced} or---if you -want---\pkg{setspaceenhanced} before \pkg{setspace}. In this case, you should +\pkg{setspace} before \pkg*{setspaceenhanced} or---if you +want---\pkg*{setspaceenhanced} before \pkg{setspace}. In this case, you should use the same options for both package. This is also useful, if you use a package, that uses \pkg{setspace} itself. In @@ -314,6 +314,40 @@ also before \cs{documentclass}. This would require the \KOMAScript{} package same optional argument for \cs{RequirePackage}, that is used for loading \pkg{setspace}. +\leavevmode\marginpar{\raggedleft\footnotesize\textcolor{black}{(added 2024-11-12)}}% +Note: If package \pkg{setspace} has been loaded \emph{before} package +\pkg*{setspaceenhanced}, \pkg*{setspaceenhanced} uses the options to +package \pkg{setspace} for the initialization. But you can overwrite the +initialization by loading \pkg*{setspaceenhancded} with options or passing +options to \pkg*{setspaceenhanced}. On the other hand, package \pkg{setspace} +\emph{should never} be loaded with options after loading +\pkg*{setspaceenhanced}. So +\begin{verbatim} + \usepackage[doublespacing]{setspace} + \usepackage{setspaceenhanced} +\end{verbatim} +would be the same like +\begin{verbatim} + \usepackage{setspace} + \usepackage[doublespacing]{setspaceenhanced} +\end{verbatim} +or like +\begin{verbatim} + \usepackage[doublespacing]{setspaceenhanced} + \usepackage{setspace} +\end{verbatim} +or like +\begin{verbatim} + \usepackage[doublespacing]{setspaceenhanced} +\end{verbatim} +But +\begin{verbatim} + \usepackage{setspaceenhanced} + \usepackage[doublespacing]{setspace} +\end{verbatim} +would fail with an option clash error, because \pkg*{setspaceenhanced} already +loaded \pkg{setspace} without options. + Package \pkg*{setspaceenhanced} provides all options and commands of the user interface of \pkg{setspace}, see \autocite{pkg:setspace:manual}. Following we document only the differences and enhancements. @@ -355,6 +389,14 @@ group. my opinion using a baselineskip less than the font size never makes sense. But \LaTeX{} itself uses baselineskip 0 inside the definition of \cs{LaTeX}.} + + Please note:\marginpar{\raggedleft\raisebox{\dimexpr\ht\strutbox-\height\relax}{\Huge\textcolor{red}{!}}} + The capabilities of this option are unfortunately limited. + Among other things, it is dependent on the internal function of + \cs{selectfont}. It can therefore lead to undesirable effects in some cases. + In this case, you should disable the option either locally or globally + via |\spacesetup{byselectfont=false}| or directly when loading + \pkg*{setspaceenhanced}. \item[doublespacing=\meta{real}]% \DescribeOption{onehalfspacing}% \hfill initial=\texttt{nan}, default=\emph{empty}\\ @@ -406,6 +448,11 @@ group. would activate the calculation of the factor depending on the font size and the baseline skip set for the font size. It is recommended to use the option always without value! +\item[nodispayskipstretch]% + \DescribeOption{nodisplayskipstretch}% + \marginpar{\raggedleft\footnotesize (added 2024-11-12)}% + Same as with \pkg{setspace}. The option turns off the stretching of the + space before and after displays using |\setdisplayskipstretch{1.0}|. \end{description} \subsubsection*{Compatibility Notes:} @@ -447,7 +494,7 @@ font size. It is also not onehalfspacing depending on the document font size, because this would need a baseline skip of 18\,pt. So what is it? It is using the stretch factor of 12\,pt for the 10.95\,pt of \cs{small}. -With \pkg{setspaceenhanced}: +With \pkg*{setspaceenhanced}: \begin{verbatim} \documentclass[12pt]{article} \usepackage{setspaceenhanced} @@ -684,24 +731,53 @@ In my opinion this is more the expected result. See the previous % \changes{v1.01}{2023/09/19}{option \opt{fontsize} renamed to % \opt{keepfontsize} because of incompatibility (issue % \href{https://github.com/komascript/third-party-enhancements/issues/1} -% {\#1})} +% {\#1})% +% } +% \changes{v1.04}{2024/11/12}{changed order for correct initialization before +% executing code} +% \changes{v1.04}{2024/11/12}{initialize \opt{singlespacing} (issue +% \href{https://github.com/komascript/third-party-enhancements/issues/3} +% {\#3})% +% } +% \changes{v1.04}{2024/11/12}{options \opt{displayskipstretch} and +% \opt{nodisplayskipstretch} added% +% } % \begin{macrocode} \DeclareKeys{% - singlespacing .code = \@@_set_spacing:nn {#1} {single}, - singlespacing .usage = general, - onehalfspacing .code = \@@_set_spacing:nn {#1} {onehalf}, - onehalfspacing .usage = general, - doublespacing .code = \@@_set_spacing:nn {#1} {double}, - doublespacing .usage = general, byselectfont .bool_set:N = \g_@@_byselectfont_bool, byselectfont .default:n = true, byselectfont .initial:n = false, + byselectfont .usage = general, keepfontsize .bool_set:N = \g_@@_fontsize_bool, keepfontsize .default:n = true, keepfontsize .initial:n = false, + keepfontsize .usage = general, + singlespacing .code = \@@_set_spacing:nn {#1} {single}, + singlespacing .usage = general, + singlespacing .initial:n = , + onehalfspacing .code = \@@_set_spacing:nn {#1} {onehalf}, + onehalfspacing .usage = general, + doublespacing .code = \@@_set_spacing:nn {#1} {double}, + doublespacing .usage = general, + nodisplayskipstretch .code = \setdisplayskipstretch{1.0}, + nodisplayskipstretch .usage = general, } % \end{macrocode} -% And process them: +% \changes{v1.04}{2024/11/12}{extended initialization by \pkg{setspace} +% options +% } +% Now, test for the options used by \pkg{setspace} and use them also for +% the initialization of the keys above. We do it option by option instead +% of processing all \pkg{setspace} options, because we want to process only +% those options \pkg*{setspaceenhanced} also knows. +% \begin{macrocode} +\clist_map_inline:nn + { nodisplayskipstretch, singlespacing, onehalfspacing, doublespacing } + { + \@ifpackagewith {setspace} {#1} {\SetKeys{#1}} { } + } +% \end{macrocode} +% Last but not least process the package options: % \begin{macrocode} \ProcessKeyOptions\relax % \end{macrocode} diff --git a/macros/latex/contrib/setspaceenhanced/setspaceenhanced.pdf b/macros/latex/contrib/setspaceenhanced/setspaceenhanced.pdf Binary files differindex 0f9eeda59d..a1ec82ca0e 100644 --- a/macros/latex/contrib/setspaceenhanced/setspaceenhanced.pdf +++ b/macros/latex/contrib/setspaceenhanced/setspaceenhanced.pdf diff --git a/macros/latex/contrib/stocksize/README.md b/macros/latex/contrib/stocksize/README.md index 778a7c186d..48852a2660 100644 --- a/macros/latex/contrib/stocksize/README.md +++ b/macros/latex/contrib/stocksize/README.md @@ -1,7 +1,7 @@ # stocksize This package provides a flexible and easy interface to change the paper (stock) dimensions in LaTeX documents. -Multiple user defined stock sizes are allowed in the same document, and sock sizes can be nested (in a LIFO order). +Multiple user defined stock sizes are allowed in the same document, and stock sizes can be nested (in a LIFO order). ## About @@ -13,7 +13,7 @@ Multiple user defined stock sizes are allowed in the same document, and sock siz ## Introduction -The package [geometry](https://github.com/LaTeX-Package-Repositories/geometry) is excellent for customuzing the page layout. However, changing the page size in the middle of the document only changes the typing area and does not affect the real paper (sock) size. This package circunvents this situation, by resizing the paper (stock) size to the given size. +The package [geometry](https://github.com/LaTeX-Package-Repositories/geometry) is excellent for customising the page layout. However, changing the page size in the middle of the document only changes the typing area and does not affect the real paper (stock) size. This package circumvents this situation by resizing the paper (stock) size to the given size. ## User Interface @@ -29,18 +29,20 @@ Simply load the package with (with no options): To start a new page with a different page/stock size use the \verb!\newstocksize! and \verb!restorestocksize! commands. ```latex -\newstocksize{options} — This command starts a new stock (and paper) size. The `options` are passed straight to the \newgeometry command form the `geometry` package. -\restorestocksize — This command ends trhe current stock size and restores the previous one (in a LIFO fashion). +\newstocksize{options} — This command starts a new stock (and paper) size. The `options` may include: + `keepmargins` — The current (left, right, top, and bottom) margins will be prreseved in the new page layout; + `other_options` — The `other_options` are passed straight to the \newgeometry command form the`geometry` package. +\restorestocksize — This command ends the current stock size and restores the previous one (in a LIFO fashion). ``` ### Nesting Different Page/Stock Sizes - Multiple paper/stock sizes can be nested. With each `\restorestocksize` command, the previous size is resmued. + Multiple paper/stock sizes can be nested. With each `\restorestocksize` command, the previous size is resumed. ```latex This page has the default size (e.g., a4paper). - \newstocksize[margin=0pt]{layoutsize={15cm,10cm},margin=1.5cm} + \newstocksize{layoutsize={15cm,10cm},margin=1.5cm} This page size is 15cm wide x 10cm high, with margins of 1.5cm. \newstocksize{layoutsize={20cm,20cm},margin=4.0cm} diff --git a/macros/latex/contrib/stocksize/stocksize-doc.pdf b/macros/latex/contrib/stocksize/stocksize-doc.pdf Binary files differindex 8f5726a9c5..5f0e34cf40 100644 --- a/macros/latex/contrib/stocksize/stocksize-doc.pdf +++ b/macros/latex/contrib/stocksize/stocksize-doc.pdf diff --git a/macros/latex/contrib/stocksize/stocksize-doc.tex b/macros/latex/contrib/stocksize/stocksize-doc.tex index 04ed5a1bd9..5dd3b53d85 100644 --- a/macros/latex/contrib/stocksize/stocksize-doc.tex +++ b/macros/latex/contrib/stocksize/stocksize-doc.tex @@ -49,14 +49,14 @@ \begin{abstract} This package provides a flexible and easy interface to change the paper (stock) dimensions in LaTeX documents. - Multiple user defined stock sizes are allowed in the same document, and sock sizes can be nested (in a LIFO order). + Multiple user defined stock sizes are allowed in the same document, and stock sizes can be nested (in a LIFO order). \end{abstract} \section{Introduction} The package \href{https://github.com/davidcarlisle/geometry}{geometry} -is excellent for customizing the page layout. However, using the \verb!\newgeometry! command to change the page size in the middle of the document only affects the typing area and does not impact the real paper (sock) size. This package circumvents this situation, by resizing the paper (stock) size to the new page layout. +is excellent for customising the page layout. However, using the \verb!\newgeometry! command to change the page size in the middle of the document only affects the typing area and does not impact the real paper (stock) size. This package circumvents this situation by resizing the paper (stock) size to the new page layout. \section{User Interface} @@ -70,21 +70,25 @@ is excellent for customizing the page layout. However, using the \verb!\newgeome \subsection{Starting a new page with a different page/stock size} -To start a new page with a different page/stock size use the \verb!\newstocksize! and \verb!restorestocksize! commands. +To start a new page with a different page/stock size use the \verb!\newstocksize! and \verb!\restorestocksize! commands. \begin{description} - \item[] \verb!newstocksize{options}! — This command starts a new stock (and paper) size. The \verb!options! are passed straight to the \verb!\newgeometry! command form the \verb!geometry! package. - \item[] \verb!restorestocksize! — This command ends trhe current stock size and restores the previous one (in a LIFO fashion). + \item[] \verb!\newstocksize{options}! — This command starts a new stock (and paper) size. The \verb!options! may include: + \begin{description} + \item[] \verb!keepmargins! — The current (left, right, top, and bottom) margins will be preserved in the new page layout; + \item[] \verb!other_options! — The \verb!other_options! are passed straight to the \verb!\newgeometry! command form the \verb!geometry! package. + \end{description} + \item[] \verb!\restorestocksize! — This command ends the current stock size and restores the previous one (in a LIFO fashion). \end{description} \subsection{Nesting different page/stock sizes} - Multiple paper/stock sizes can be nested. With each \verb!\restorestocksize! command, the previous size is resmued. + Multiple paper/stock sizes can be nested. With each \verb!\restorestocksize! command, the previous size is resumed. \begin{verbatim} This page has the default size (e.g., a4paper). - \newstocksize[margin=0pt]{layoutsize={15cm,10cm},margin=1.5cm} + \newstocksize{layoutsize={15cm,10cm},margin=1.5cm} This page size is 15cm wide x 10cm high, with margins of 1.5cm. \newstocksize{layoutsize={20cm,20cm},margin=4.0cm} diff --git a/macros/latex/contrib/stocksize/stocksize.sty b/macros/latex/contrib/stocksize/stocksize.sty index 4b89d4d211..36c6f18998 100644 --- a/macros/latex/contrib/stocksize/stocksize.sty +++ b/macros/latex/contrib/stocksize/stocksize.sty @@ -12,8 +12,8 @@ %% and version 1.3c or later is part of all distributions of LaTeX %% version 2006/05/20 or later. %% -\def\fileversion{1.0.1} -\def\filedate {2024/11/12} +\def\fileversion{1.0.2} +\def\filedate {2024/11/13} \edef\filename {\@currname} \ProvidesPackage{stocksize}[% @@ -22,7 +22,7 @@ % Load geometry if it was was not loaded by the user \AddToHook{begindocument/before}{ \@ifpackageloaded{geometry}{}{ - \RequirePackage[pass]{geometry} + \RequirePackage[reset]{geometry} } } @@ -31,65 +31,40 @@ \newcommand*{\@ss@setpdfpagesize}[2]{% \@ifundefined{pdfpageheight}{}{\pdfpageheight=#1}% \@ifundefined{pdfpagewidth}{}{\pdfpagewidth=#2}% - \@ifundefined{pageheight}{}{\pageheight=31}% + \@ifundefined{pageheight}{}{\pageheight=#1}% \@ifundefined{pagewidth}{}{\pagewidth=#2}% -} - - -% Fix page layout -\DeclareRobustCommand{\@ss@fixpagelayout}{% - \setlength{\paperheight}{\the\dimexpr\Gm@tmargin+\Gm@height+\Gm@bmargin\relax} - \setlength{\paperwidth}{\the\dimexpr\Gm@lmargin+\Gm@width+\Gm@rmargin\relax} - \setlength{\stockheight}{\paperheight} - \setlength{\stockwidth}{\paperwidth} - \setlength{\@colht}{\textheight} - \setlength{\@colroom}{\textheight}% - \setlength{\vsize}{\textheight} - \setlength{\columnwidth}{\textwidth}% - \if@twocolumn% - \advance\columnwidth-\columnsep - \divide\columnwidth\tw@% - \@firstcolumntrue% - \fi% - \setlength{\hsize}{\columnwidth}% - \setlength{\linewidth}{\hsize}% + \paperheight=#1\stockheight=#1% + \paperwidth=#2\stockwidth=#2% } \newcounter{@ss@cnt} -\newcommand{\pdfsavegeometry}[1]{% +\newcommand*{\pdfsavegeometry}[1]{% \expandafter\edef\csname @sspw@\arabic{@ss@cnt}\endcsname% {\the\dimexpr\Gm@lmargin+\Gm@width+\Gm@rmargin\relax}% \expandafter\edef\csname @ssph@\arabic{@ss@cnt}\endcsname% {\the\dimexpr\Gm@tmargin+\Gm@height+\Gm@bmargin\relax}% \stepcounter{@ss@cnt}% \savegeometry{@ss@cnt@\arabic{@ss@cnt}}% + \newdimen\@tempdimd% + \@tempdima=\Gm@lmargin\@tempdimb=\Gm@rmargin% + \@tempdimc=\Gm@tmargin\@tempdimd=\Gm@bmargin% + \define@key{Gm}{keepmargins}[true]{\setkeys{Gm}{lmargin=\the\@tempdima, + rmargin=\the\@tempdimb, tmargin=\the\@tempdimc, bmargin=\the\@tempdimd + }}% \restoregeometry% \newgeometry{#1}% - \@ss@fixpagelayout% \edef\@sspw{\the\dimexpr\Gm@lmargin+\Gm@width+\Gm@rmargin\relax}% \edef\@ssph{\the\dimexpr\Gm@tmargin+\Gm@height+\Gm@bmargin\relax}% \@ss@setpdfpagesize{\@ssph}{\@sspw}% } -\newcommand{\pdfrestoregeometry}{% +\newcommand*{\pdfrestoregeometry}{% \loadgeometry{@ss@cnt@\arabic{@ss@cnt}}% - \@ss@fixpagelayout% \addtocounter{@ss@cnt}{-1}% \@ss@setpdfpagesize{\csname @ssph@\arabic{@ss@cnt}\endcsname}% {\csname @sspw@\arabic{@ss@cnt}\endcsname}% } -% To support multiple levels (nesting) of stock sizes -\newcommand{\newstocksize}[1]{% - % #1 = layout arguments to be passed to \newgeometry - \pdfsavegeometry{#1}% -} - -\newcommand{\restorestocksize}{% - \pdfrestoregeometry% -} - -% Set stock dimensions to current paper dimensions -% \stockheight=\paperheight -% \stockwidth=\paperwidth +\newcommand*{\newstocksize}{\pdfsavegeometry} +\newcommand*{\restorestocksize}{\pdfrestoregeometry} |