Debugging.

This commit is contained in:
Silcantar
2025-09-09 23:48:36 -05:00
parent 1f79529bba
commit d0e3687583
5 changed files with 234 additions and 158 deletions

View File

@@ -27,4 +27,55 @@
\RaggedLeft%
\fi%
}%
}
}
\ExplSyntaxOn
\keys_define:nn {MyCaption} {
figure .code:n = {\str_set:Nn \l_MyCaption_type_str {figure}},
format .tl_set:N = \l_MyCaption_format_tl,
format .initial:n = {\Centering\small\color{caption}},
table .code:n = {\str_set:Nn \l_MyCaption_type_str {table}},
type .choices:nn = {figure,table}{
\str_set:Ne \l_MyCaption_type_str {\l_keys_choice_tl}
},
type .initial:n = {figure},
}
\tl_new:N \l_MyCaption_label_tl
\tl_new:N \l_MyCaption_number_tl
\NewDocumentCommand{\MyCaption}{
% #1: Key-value options.
O{}
% #2: Label
m
% #3: Caption
m
}{ \group_begin:
\keys_set:nn {MyCaption} {#1}
\str_case:en {\l_MyCaption_type_str} {
{figure} {
\addtocounter{figure}{1}
\tl_set:Nn \l_MyCaption_label_tl {Figure}
\tl_set:Nn \l_MyCaption_number_tl {
\arabic{chapter}.\arabic{figure}
}
\addcontentsline{lof}{figure}{\l_MyCaption_number_tl\numberline#3}
}
{table} {
\addtocounter{table}{1}
\tl_set:Nn \l_MyCaption_label_tl {Table}
\tl_set:Nn \l_MyCaption_number_tl {
\arabic{chapter}.\arabic{table}
}
\addcontentsline{lot}{table}{\l_MyCaption_number_tl\numberline#3}
}
}
\l_MyCaption_format_tl
\l_MyCaption_label_tl~\l_MyCaption_number_tl :~#3
\label{#2}
\group_end: }