summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tagpdf/tagpdf-user.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-02-16 03:01:36 +0000
committerNorbert Preining <norbert@preining.info>2023-02-16 03:01:36 +0000
commit024d47cb1c4e5ba541f3865b69168bef20f2bfce (patch)
tree4e55e91ce72e278a079000c9871135034111f910 /macros/latex/contrib/tagpdf/tagpdf-user.dtx
parenta7d99429152acee049db679dc26a92e01faf4992 (diff)
CTAN sync 202302160301
Diffstat (limited to 'macros/latex/contrib/tagpdf/tagpdf-user.dtx')
-rw-r--r--macros/latex/contrib/tagpdf/tagpdf-user.dtx82
1 files changed, 63 insertions, 19 deletions
diff --git a/macros/latex/contrib/tagpdf/tagpdf-user.dtx b/macros/latex/contrib/tagpdf/tagpdf-user.dtx
index 980641b6b7..01de768a15 100644
--- a/macros/latex/contrib/tagpdf/tagpdf-user.dtx
+++ b/macros/latex/contrib/tagpdf/tagpdf-user.dtx
@@ -46,7 +46,7 @@
% }^^A
% }
%
-% \date{Version 0.98c, released 2023-01-30}
+% \date{Version 0.98d, released 2023-02-15}
% \maketitle
% \begin{documentation}
% \section{Setup commands}
@@ -64,10 +64,14 @@
% add a document structure.
% \end{function}
%
-%
-% \begin{function}{\tagpdfifluatexTF,\tagpdfifluatexT,\tagpdfifpdftexT}
-% small wrappers around engine tests. This functions should not be used and will be removed
-% in one of the next versions.
+% \begin{function}{\tag_tool:n,\tagtool}
+% \begin{syntax}
+% \cs{tag_tool:n}\Arg{key val}
+% \end{syntax}
+% The tagging of basic document elements will require a variaty of small commands
+% to configure and adapt the tagging. This command will collect them under a command
+% interface. The argument is \emph{one} key-value like string. This is work in progress
+% and both syntax, known arguments and implementation can change!
% \end{function}
%
% \section{Commands related to mc-chunks}
@@ -246,7 +250,7 @@
% \begin{macrocode}
%<@@=tag>
%<*header>
-\ProvidesExplPackage {tagpdf-user} {2023-01-30} {0.98c}
+\ProvidesExplPackage {tagpdf-user} {2023-02-15} {0.98d}
{tagpdf - user commands}
%</header>
% \end{macrocode}
@@ -263,6 +267,22 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\tag_tool:n,\tagtool}
+% This is a first definition of the tool command.
+% Currently it uses key-val, but this should be probably
+% be flattened to speed it up.
+% \begin{macrocode}
+%<base>\cs_new_protected:Npn\tag_tool:n #1 {}
+%<base>\cs_set_eq:NN\tagtool\tag_tool:n
+%<*package>
+\cs_set_protected:Npn\tag_tool:n #1
+ {
+ \tag_if_active:T { \keys_set:nn {tag / tool}{#1} }
+ }
+\cs_set_eq:NN\tagtool\tag_tool:n
+%</package>
+% \end{macrocode}
+% \end{macro}
% \section{Commands for the mc-chunks}
% \begin{macro}{\tagmcbegin,\tagmcend,\tagmcuse }
@@ -579,10 +599,13 @@
% {
% paratagging (setup-key),
% paratagging-show (setup-key),
+% paratag (setup-key),
+% paratag (tool-key),
% }
% These keys enable/disable locally paratagging, and the debug modus.
% It can affect the typesetting if |paratagging-show| is used. The small numbers
-% are boxes and they have a (small) height.
+% are boxes and they have a (small) height. The |paratag| key sets the tag used by
+% the next automatic paratagging, it can also be changed with |\tag_tool:n|
% \begin{macrocode}
\keys_define:nn { @@ / setup }
{
@@ -590,22 +613,43 @@
paratagging-show .bool_set:N = \l_@@_para_show_bool,
paratag .tl_set:N = \l_@@_para_tag_tl
}
-
+\keys_define:nn { tag / tool}
+ {
+ paratag .tl_set:N = \l_@@_para_tag_tl
+ }
% \end{macrocode}
% \end{macro}
% This fills the para hooks with the needed code.
% \begin{macrocode}
+\cs_new_protected:Npn \@@_check_para_begin_show:nn #1 #2
+ %#1 color, #2 prefix
+ {
+ \bool_if:NT \l_@@_para_show_bool
+ {
+ \tag_mc_begin:n{artifact}
+ \llap{\color_select:n{#1}\tiny#2\int_use:N\g_@@_para_begin_int\ }
+ \tag_mc_end:
+ }
+ }
+
+\cs_new_protected:Npn \@@_check_para_end_show:nn #1 #2
+ %#1 color, #2 prefix
+ {
+ \bool_if:NT \l_@@_para_show_bool
+ {
+ \tag_mc_begin:n{artifact}
+ \rlap{\color_select:n{#1}\tiny\ #2\int_use:N\g_@@_para_end_int}
+ \tag_mc_end:
+ }
+ }
+
\AddToHook{para/begin}
{
\bool_if:NT \l_@@_para_bool
{
\int_gincr:N \g_@@_para_begin_int
\tag_struct_begin:n {tag=\l_@@_para_tag_tl}
- \bool_if:NT \l_@@_para_show_bool
- { \tag_mc_begin:n{artifact}
- \llap{\color_select:n{red}\tiny\int_use:N\g_@@_para_begin_int\ }
- \tag_mc_end:
- }
+ \@@_check_para_begin_show:nn {green}{}
\tag_mc_begin:n {}
}
}
@@ -615,11 +659,7 @@
{
\int_gincr:N \g_@@_para_end_int
\tag_mc_end:
- \bool_if:NT \l_@@_para_show_bool
- { \tag_mc_begin:n{artifact}
- \rlap{\color_select:n{red}\tiny\ \int_use:N\g_@@_para_end_int}
- \tag_mc_end:
- }
+ \@@_check_para_end_show:nn {red}{}
\tag_struct_end:
}
}
@@ -671,13 +711,17 @@
% \tagpdfparaOff
% }
% This two command switch para mode on and off. |\tagpdfsetup| could be used
-% too but is longer.
+% too but is longer. An alternative is |\tag_tool:n{para=false}|
% \begin{macrocode}
%<base>\newcommand\tagpdfparaOn {}
%<base>\newcommand\tagpdfparaOff{}
%<*package>
\renewcommand\tagpdfparaOn {\bool_set_true:N \l_@@_para_bool}
\renewcommand\tagpdfparaOff{\bool_set_false:N \l_@@_para_bool}
+\keys_define:nn { tag / tool}
+ {
+ para .bool_set:N = \l_@@_para_bool
+ }
% \end{macrocode}
% \end{macro}
%