summaryrefslogtreecommitdiff
path: root/macros/latex-dev/required/latex-lab/latex-lab-block.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex-dev/required/latex-lab/latex-lab-block.dtx')
-rw-r--r--macros/latex-dev/required/latex-lab/latex-lab-block.dtx153
1 files changed, 104 insertions, 49 deletions
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-block.dtx b/macros/latex-dev/required/latex-lab/latex-lab-block.dtx
index e0a723ca87..75203f8ed5 100644
--- a/macros/latex-dev/required/latex-lab/latex-lab-block.dtx
+++ b/macros/latex-dev/required/latex-lab/latex-lab-block.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: latex-lab-block.dtx (C) Copyright 2021-2023 LaTeX Project
+%% File: latex-lab-block.dtx (C) Copyright 2021-2024 LaTeX Project
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -9,10 +9,10 @@
%
% https://www.latex-project.org/lppl.txt
%
-\def\ltlabblockdate{2023-09-01}
-\def\ltlabblockversion{0.8h}
+\def\ltlabblockdate{2024-02-12}
+\def\ltlabblockversion{0.8l}
%<*driver>
-\documentclass{l3doc}
+\documentclass[kernel]{l3doc}
\usepackage{amstext}
\EnableCrossrefs
\CodelineIndex
@@ -308,7 +308,7 @@
% \end{TemplateDescription}
%
% The maximum number of \xt{blockenv}s that can be nested into each
-% other is is restricted by the \LaTeX{} counter
+% other is restricted by the \LaTeX{} counter
% \texttt{maxblocklevels} with a default value of \texttt{6}. If this
% value is increased then it is necessary to provide additional
% instances, e.g., \texttt{displayblock-7}, etc. Decreasing is, of
@@ -646,11 +646,59 @@
%
% \end{description}
%
+% \section{Debugging}
+%
+% \begin{function}{\DebugBlocksOn,\DebugBlocksOff, \block_debug_on:, \block_debug_off:}
+%
+% These commands enable/disable debugging messages.
+%
+% \end{function}
%
+% \section{New and redefined kernel command}
+%
+% \begin{function}{\@doendpe}
+% The original \LaTeXe{} command is augmented to allow for tagging.
+% \end{function}
%
+% \begin{function}{\legacyverbatimsetup,\legacylistsetupcode}
+% \emph{to be documented}
+% \end{function}
+%
+% \begin{function}{\@setupverbinvisiblespace}
+% A counterpart definition to the kernel command \cs{@setupverbinvisiblespace},
+% needed as we need to handle real space chars in verbatim.
+% \end{function}
+%
+% \begin{function}{endblockenv,\g_block_nesting_depth_int}
+% \emph{to be documented}
+% \end{function}
+%
+% \begin{function}{\newtheorem,\@thm,\@begintheorem}
+% Redefined to make theorems tagging aware.
+% \end{function}
%
+% \begin{function}{\item,\@itemlabel}
+% The \cs{item} is redefined.
+% \end{function}
%
-%
+% \begin{function}{\c@maxblocklevels}
+% A counter to increase or decrease the number of supported
+% level. If increased, one needs to supply additional level instances.
+% \end{function}
+%
+% \begin{function}{\begin}
+% The \cs{begin} is slightly redefine to handle \cs{@doendpe} better.
+% TODO: move to kernel
+% \end{function}
+%
+% \begin{function}{\para_end:}
+% TODO: consider name, document
+% \end{function}
+%
+% \begin{function}{para/begin}
+% The para/begin hook is enhanced to support list ends
+% \end{function}
+%
% \end{documentation}
%
% \StopEventually{\setlength\IndexMin{200pt} \PrintIndex }
@@ -674,10 +722,6 @@
blockenv implementation]
% \end{macrocode}
%
-% We make use of templates:
-% \begin{macrocode}
-\RequirePackage{xtemplate}
-% \end{macrocode}
% Generell kernel changes, also loaded by the sec and toc code.
% \begin{macrocode}
\RequirePackage{latex-lab-kernel-changes}
@@ -691,7 +735,7 @@
\tl_new:N \l_@@_item_align_tl
\tl_new:N\l_@@_legacy_env_params_tl
% \end{macrocode}
-
+%
% \subsection{Handling \cs{par} after the end of the list}
%
% An empty line (or a \cs{par}) after a list has semantic meaning as
@@ -767,11 +811,11 @@
% given use in the document. This section is devoted to template
% interfaces, and the template code is covered later.
% \begin{macrocode}
-\DeclareObjectType{blockenv}{1}
-\DeclareObjectType{block}{1}
-\DeclareObjectType{para}{1}
-\DeclareObjectType{list}{1}
-\DeclareObjectType{item}{1}
+\NewTemplateType{blockenv}{1}
+\NewTemplateType{block}{1}
+\NewTemplateType{para}{1}
+\NewTemplateType{list}{1}
+\NewTemplateType{item}{1}
% \end{macrocode}
% \end{objecttype}
%
@@ -907,12 +951,9 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\tl_if_novalue:nTF}
-%
% \begin{macrocode}
\cs_generate_variant:Nn \tl_if_novalue:nTF { o }
% \end{macrocode}
-% \end{macro}
%
%
% \subsubsection{Debugging}
@@ -1342,14 +1383,14 @@
\@definecounter {#2}
\IfNoValueTF {#4}
{ % @ynthm
- \tl_gset:cx { the #2 }
+ \tl_gset:ce { the #2 }
{
\@thmcounter{#2}
}
}
{ % @xnthm
\@newctr{#1}[#4]
- \tl_gset:cx { the #2 }
+ \tl_gset:ce { the #2 }
{
\expandafter\noexpand\csname the#4\endcsname
\@thmcountersep
@@ -1802,7 +1843,7 @@
fixed-word-spaces = \l__par_fixed_word_spaces_bool , % name??
final-hyphen-demerits = \finalhyphendemerits ,
cr-cmd = \\ ,
- para-class = \l_tag_para_attr_class_tl ,
+ para-class = \l__tag_para_attr_class_tl ,
}
{
\tl_if_empty:nF {#1} { \SetTemplateKeys{para}{std}{#1} }
@@ -2488,10 +2529,13 @@
{
\@inmatherr \item
% \end{macrocode}
-% TODO: Test for being outside of a list needs updating!
+% TODO: Check if test for being outside of a list is sensible
% \begin{macrocode}
- \tl_if_empty:oTF \@@_item_instance:n %%FMi?
- { \msg_error:nnn { @@ } { item-in-nonlist } { \item[{#1}] } }
+ \cs_if_free:NTF \@@_item_instance:n
+ {
+ \@latex@error{Lonely~\string\item--perhaps~a~missing~
+ list~environment}\@ehc
+ }
{
\legacy_if:nTF { @newlist }
{ \__kernel_list_item_begin: }
@@ -2630,7 +2674,7 @@
%
% \item Then open an new (inner) structure (by default
% \texttt{Figure} but typically the one specified on the instance).
-% \item At the end of the block close the the inner structure
+% \item At the end of the block close the inner structure
% (\texttt{Figure} or explicit one)
% but leave the \texttt{text-unit} open to be either continued or closed due to a
% following \cs{par}.
@@ -3290,6 +3334,7 @@
\DeclareInstance{item}{description}{std}
{
label-format = \normalfont\bfseries #1 ,
+ label-align = left
}
% \end{macrocode}
% \end{instance}
@@ -3389,9 +3434,7 @@
%
% In this section we provide code to the various kernel hooks to support
% the tagging of the different displayblock environments.
-%
-%
-%
+%
% All of the following definitions should only be made if tagging
% is active!
% \begin{macrocode}
@@ -3424,8 +3467,12 @@
{
\int_compare:nNnT \l_@@_flattened_level_int < 2
{
- \int_gincr:N \g__tag_para_main_begin_int
- \tagstructbegin{tag=\l__tag_para_main_tag_tl}
+ \__tag_gincr_para_main_begin_int:
+ \tag_struct_begin:n
+ {
+ tag=\l__tag_para_main_tag_tl,
+ attribute-class=\l__tag_para_main_attr_class_tl,
+ }
}
}
}
@@ -3445,7 +3492,7 @@
\cs_set:Npn \@@_beginpar_hmode:N #1
{
\tag_mc_end:
- \int_gincr:N \g__tag_para_end_int
+ \__tag_gincr_para_end_int:
\@@_debug_typeout:n{increment~ /P \on@line }
\bool_if:NT \l__tag_para_show_bool
{ \tag_mc_begin:n{artifact}
@@ -3492,7 +3539,7 @@
{
\@@_debug_typeout:n{Structure-end~
\l__tag_para_main_tag_tl\space after~ displayblock \on@line }
- \int_gincr:N \g__tag_para_main_end_int
+ \__tag_gincr_para_main_end_int:
\tag_struct_end: %text-unit
}
}
@@ -3551,16 +3598,20 @@
{
\bool_if:NF \l__tag_para_flattened_bool
{
- \int_gincr:N \g__tag_para_main_begin_int
- \tag_struct_begin:n{tag=\l__tag_para_main_tag_tl}
+ \__tag_gincr_para_main_begin_int:
+ \tag_struct_begin:n
+ {
+ tag=\l__tag_para_main_tag_tl,
+ attribute-class=\l__tag_para_main_attr_class_tl,
+ }
}
}
- \int_gincr:N \g__tag_para_begin_int
+ \__tag_gincr_para_begin_int:
\@@_debug_typeout:n{increment~ P \on@line }
\tag_struct_begin:n
{
tag=\l__tag_para_tag_tl
- ,attribute-class=\l_tag_para_attr_class_tl
+ ,attribute-class=\l__tag_para_attr_class_tl
}
\__tag_check_para_begin_show:nn {green}{#1}
\tag_mc_begin:n {}
@@ -3572,15 +3623,19 @@
\cs_new_protected:Npn \@@_start_para_structure_unconditionally:n #1 {
\bool_if:NF \l__tag_para_flattened_bool
{
- \int_gincr:N \g__tag_para_main_begin_int
- \tag_struct_begin:n{tag=\l__tag_para_main_tag_tl}
+ \__tag_gincr_para_main_begin_int:
+ \tag_struct_begin:n
+ {
+ tag=\l__tag_para_main_tag_tl,
+ attribute-class=\l__tag_para_main_attr_class_tl,
+ }
}
- \int_gincr:N \g__tag_para_begin_int
+ \__tag_gincr_para_begin_int:
\@@_debug_typeout:n{increment~ P \on@line }
\tag_struct_begin:n
{
tag=\l__tag_para_tag_tl
- ,attribute-class=\l_tag_para_attr_class_tl
+ ,attribute-class=\l__tag_para_attr_class_tl
}
\__tag_check_para_begin_show:nn {green}{#1}
\tag_mc_begin:n {}
@@ -3594,14 +3649,14 @@
{
\bool_if:NT \l__tag_para_bool
{
- \int_gincr:N \g__tag_para_end_int
+ \__tag_gincr_para_end_int:
\@@_debug_typeout:n{increment~ /P \on@line }
\tag_mc_end:
\__tag_check_para_end_show:nn {red}{}
\tag_struct_end:
\bool_if:NF \l__tag_para_flattened_bool
{
- \int_gincr:N \g__tag_para_main_end_int
+ \__tag_gincr_para_main_end_int:
\tag_struct_end:
}
}
@@ -3657,7 +3712,7 @@
\DeclareRobustCommand*\begin[1]{%
\UseHook{env/#1/before}%
\@ifundefined{#1}%
- {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}%
+ {\def\reserved@a{\@latex@error{Environment~#1~undefined}\@eha}}%
{\def\reserved@a{\def\@currenvir{#1}%
\edef\@currenvline{\on@line}%
\@execute@begin@hook{#1}%
@@ -3680,7 +3735,7 @@
{
\bool_if:NF \l__tag_para_flattened_bool
{
- \int_gincr:N \g__tag_para_main_end_int
+ \__tag_gincr_para_main_end_int:
\tag_struct_end:
}
\@endpefalse
@@ -3722,7 +3777,7 @@
\@@_debug_typeout:n{block-end \on@line}
\legacy_if:nT { @endpe }
{
- \int_gincr:N \g__tag_para_main_end_int
+ \__tag_gincr_para_main_end_int:
\@@_debug_typeout:n{close~ /text-unit \on@line}
\tagstructend
}
@@ -3792,7 +3847,7 @@
\cs_set:Npn \__kernel_list_label_begin: {
%
% FMi: this needs a different logic to decide when to make the label
-% an artifact (after cleaning up the the \item code ), therefore
+% an artifact (after cleaning up the \item code ), therefore
% disabled for now
% \tl_if_empty:oTF \@itemlabel
% {
@@ -3835,7 +3890,7 @@
\cs_set:Npn \@@_list_item_end: {
\legacy_if:nT { @endpe }
{
- \int_gincr:N \g__tag_para_main_end_int
+ \__tag_gincr_para_main_end_int:
\tagstructend % text-unit
% \@@_debug_typeout:n{Structure-end~ P~ at~ item-end \on@line }
}
@@ -3854,7 +3909,7 @@
\cs_set:Npn \@@_list_end: {
\legacy_if:nT { @endpe }
{
- \int_gincr:N \g__tag_para_main_end_int
+ \__tag_gincr_para_main_end_int:
\tagstructend % text-unit
\@@_debug_typeout:n{Structure-end~ P~ at~ list-end \on@line }
}