diff options
Diffstat (limited to 'macros/latex-dev/required/latex-lab/latex-lab-float.dtx')
-rw-r--r-- | macros/latex-dev/required/latex-lab/latex-lab-float.dtx | 71 |
1 files changed, 53 insertions, 18 deletions
diff --git a/macros/latex-dev/required/latex-lab/latex-lab-float.dtx b/macros/latex-dev/required/latex-lab/latex-lab-float.dtx index 3bd3483600..e1c70968ab 100644 --- a/macros/latex-dev/required/latex-lab/latex-lab-float.dtx +++ b/macros/latex-dev/required/latex-lab/latex-lab-float.dtx @@ -16,8 +16,8 @@ % % for those people who are interested or want to report an issue. % -\def\ltlabfloatdate{2023-07-20} -\def\ltlabfloatversion{0.81a} +\def\ltlabfloatdate{2024-02-05} +\def\ltlabfloatversion{0.81c} %<*driver> \documentclass{l3doc} \EnableCrossrefs @@ -86,8 +86,8 @@ % In PDF~2.0 there is the suitable \texttt{Aside} tag which hopefully will % be handled correctly regarding the reading order once processor actually support % PDF~2.0. But in PDF~1.7 we rolemap it to \texttt{Note} and this doesn't lead to -% a good reading order. The code therefore collect the float structures and moves -% them to a \texttt{Sect} the end of the document or the chapter +% a good reading order. The code therefore collects the float structures and moves +% them to a \texttt{Sect} at the end of the document or the chapter % (H-floats once they are handled will not be moved). % % To fulfill the requirement that a \texttt{Caption} should be at the begin or end, we always @@ -106,6 +106,8 @@ % % The code add two keys for the \cs{tagtool} command % +% +% \begin{function}{flush-floats,split-float} % \begin{description} % \item[flush-floats] This will flush out the collected floats sofar (currently % table and figure. The value is a sectioning level, e.g. \texttt{section} or \texttt{chapter}, @@ -117,9 +119,19 @@ % \item[split-float] This can be used inside a float if there are two captions. % It will only work reasonably well if the content of the float parts are in a sensible order % and can be separated by this command. More complex setups with tabulars will need more -% thoughts +% thoughts. +% \end{description} +% \end{function} +% +% \section{Kernel commands} +% \begin{function}{\@current@float@struct} +% This variable holds the structure number of current float structure. +% \end{function} % -% \end{description} +% \begin{function}{\@makecaption} +% \cs{@makecaption} is defined by the classes so we overwrite it for now +% at begin document. +% \end{function} % % % \begin{macrocode} @@ -182,7 +194,7 @@ \seq_map_inline:Nn\g_@@_float_types_seq { \tag_struct_begin:n{tag=##1s,stash} - \prop_gput:Nnx\g_@@_float_sect_prop {##1-struct}{\int_use:N\c@g__tag_struct_abs_int} + \prop_gput:Nne\g_@@_float_sect_prop {##1-struct}{\int_use:N\c@g__tag_struct_abs_int} \tag_struct_end: } } @@ -239,6 +251,7 @@ {\par\__tag_sec_end:n{-10}\@@_float_stop_sect:} \DeclareHookRule{tagpdf/finish/before}{latex-lab/float}{before}{tagpdf} % \end{macrocode} +% % \subsection{Splitting floats} % \begin{macro}{split-float} % TODO: check if the target affect spacing!! @@ -249,7 +262,7 @@ { \@@_float_end: \@@_float_begin: - \MakeLinkTarget[tagstructure]{g__tag_struct_abs_int} + \MakeLinkTarget*{floatstructure.\int_use:N\c@g__tag_struct_abs_int} } } % \end{macrocode} @@ -290,12 +303,12 @@ { \exp_args:Ne \tag_struct_begin:n{tag=float,parent=0\prop_item:No\g_@@_float_sect_prop{\@captype-struct}}% - \prop_gput:Nxx \g_@@_float_sect_prop {\@captype-used}{true} + \prop_gput:Nee \g_@@_float_sect_prop {\@captype-used}{true} } { \tag_struct_begin:n{tag=float} } - \tl_set:Nx\@current@float@struct{\tag_get:n{struct_num}}% + \tl_set:Ne\@current@float@struct{\tag_get:n{struct_num}}% \typeout{Float structure: \@current@float@struct} } @@ -381,7 +394,7 @@ % \end{macrocode} % We add a target for links. TODO: check that it doesn't affect spacing!! % \begin{macrocode} - \MakeLinkTarget[tagstructure]{g__tag_struct_abs_int}% + \MakeLinkTarget*{floatstructure.\number\value{g__tag_struct_abs_int}}% }% % \end{macrocode} % The end code of the float ... @@ -446,10 +459,24 @@ \let\@kernel@refstepcounter\refstepcounter %as long it is not in the kernel \def\caption{% \ifx\@captype\@undefined - \@latex@error{\noexpand\caption outside float}\@ehd + \@latex@error{\noexpand\caption\c_space_tl outside~float}\@ehd \expandafter\@gobble - \else - \@kernel@refstepcounter\@captype + \else +% \end{macrocode} +% if a caption is used outside a float no +% target has been set and \cs{@current@float@struct} is empty +% \begin{macrocode} + \tl_if_empty:NTF\@current@float@struct + { + \refstepcounter\@captype + } + { + \@kernel@refstepcounter\@captype +% \end{macrocode} +% we need to reset the target for \cs{addcontentsline}. +% \begin{macrocode} + \xdef\@currentHref{floatstructure.\@current@float@struct}% + } \expandafter\@firstofone \fi {\@dblarg{\@caption\@captype}}% @@ -471,7 +498,6 @@ { \long\def\@makecaption#1#2{% \vskip\abovecaptionskip - \xdef\@currentHref{tagstructure.\@current@float@struct}% % \end{macrocode} % we don't want tagging when storing the caption for the singleline check % \begin{macrocode} @@ -482,12 +508,21 @@ % we stop paratagging. TODO: check % \begin{macrocode} \tagtool{para=false} - \tag_struct_begin:n{tag=Caption,parent=\@current@float@struct} +% \end{macrocode} +% if caption is used outside a float there is perhaps no number, then we use +% the parent structure and hope ... +% \begin{macrocode} + \tl_if_empty:NT \@current@float@struct + { \tl_set:Ne \@current@float@struct {\tag_get:n{struct_num}} } + \tag_struct_begin:n{tag=Caption,parent=\@current@float@struct} % \end{macrocode} % move the caption to the begin of the float structure: % \begin{macrocode} - \seq_gpop_right:cN {g__tag_struct_kids_\@current@float@struct _seq}\l_@@_tmpa_tl - \seq_gput_left:cV {g__tag_struct_kids_\@current@float@struct _seq}\l_@@_tmpa_tl + \tag_if_active:T + { + \seq_gpop_right:cN {g__tag_struct_kids_\@current@float@struct _seq}\l_@@_tmpa_tl + \seq_gput_left:cV {g__tag_struct_kids_\@current@float@struct _seq}\l_@@_tmpa_tl + } \ifdim \wd\@tempboxa >\hsize \tag_struct_begin:n{tag=Lbl} \tag_mc_begin:n{} |