diff options
Diffstat (limited to 'macros/latex/contrib/tagpdf/tagpdfdocu-patches.sty')
-rw-r--r-- | macros/latex/contrib/tagpdf/tagpdfdocu-patches.sty | 137 |
1 files changed, 131 insertions, 6 deletions
diff --git a/macros/latex/contrib/tagpdf/tagpdfdocu-patches.sty b/macros/latex/contrib/tagpdf/tagpdfdocu-patches.sty index 2501381ded..3590017267 100644 --- a/macros/latex/contrib/tagpdf/tagpdfdocu-patches.sty +++ b/macros/latex/contrib/tagpdf/tagpdfdocu-patches.sty @@ -1,5 +1,5 @@ %\RequirePackage[enable-debug]{expl3}[2018/06/14] -\ProvidesExplPackage {tagpdfdocu-patches} {2023-03-07} {0.98e} +\ProvidesExplPackage {tagpdfdocu-patches} {2023-04-24} {0.98f} {patches/commands for the tagpdf documentation} \RequirePackage{etoolbox,xpatch} @@ -9,7 +9,7 @@ \DeclareRobustCommand\TeX{ \leavevmode \tag_mc_end_push: - \tag_struct_begin:n{tag=Span,alt=TeX,actualtext=TeX} + \tag_struct_begin:n{tag=Span,actualtext=TeX} \tagmcbegin{} T\kern-.1667em\lower.5ex\hbox{E}\kern-.05emX\@ %changed from -.125em \tagmcend @@ -18,7 +18,7 @@ \DeclareRobustCommand{\LaTeX}{ \leavevmode \tag_mc_end_push: - \tag_struct_begin:n{tag=Span,alt=LaTeX,actualtext=LaTeX} + \tag_struct_begin:n{tag=Span,actualtext=LaTeX} \tagmcbegin{} L\kern-.25em % %changed from -0.36em \sbox\z@ T% @@ -136,8 +136,6 @@ % no internal patches, but redefining begentry/finentry is not safe. % better hook is needed. -\newbibmacro*{begentry}{\tagstructbegin{tag=BibEntry}\tagmcbegin{}} -\newbibmacro*{finentry}{\finentry\tagmcend\tagstructend} \def\blx@endbibliography{% \csuse{blx@endenv@\blx@theenv}% @@ -162,8 +160,8 @@ \let\tagstructend\relax }}{} +%====== picture ======= -%====== pictures ======== % PAC3 complained that the BBox is missing, so we are cheating for now % and add a fix size. \tagpdfsetup @@ -172,4 +170,131 @@ {bbox}{/O /Layout /BBox [0 0 100 100]} } + +%====== floats ======== + +\tagpdfsetup{add-new-tag=float/Div} +\makeatletter +\def\@xfloat #1[#2]{% + \@nodocument + \def \@captype {#1}% + \def \@fps {#2}% + \@onelevel@sanitize \@fps + \def \reserved@b {!}% + \ifx \reserved@b \@fps + \@fpsadddefault + \else + \ifx \@fps \@empty + \@fpsadddefault + \fi + \fi + \ifhmode + \@bsphack + \tagmcend%end P + \@floatpenalty -\@Mii + \else + \@floatpenalty-\@Miii + \fi + \ifinner + \@parmoderr\@floatpenalty\z@ + \else + \@next\@currbox\@freelist + {% + \@tempcnta \sixt@@n + \expandafter \@tfor \expandafter \reserved@a + \expandafter :\expandafter =\@fps + \do + {% + \if \reserved@a h% + \ifodd \@tempcnta + \else + \advance \@tempcnta \@ne + \fi + \else\if \reserved@a t% + \@setfpsbit \tw@ + \else\if \reserved@a b% + \@setfpsbit 4% + \else\if \reserved@a p% + \@setfpsbit 8% + \else\if \reserved@a !% + \ifnum \@tempcnta>15 + \advance\@tempcnta -\sixt@@n\relax + \fi + \else + \@latex@error{Unknown float option `\reserved@a'}% + {Option `\reserved@a' ignored and `p' used.}% + \@setfpsbit 8% + \fi\fi\fi\fi\fi + }% + \@tempcntb \csname ftype@\@captype \endcsname + \multiply \@tempcntb \@xxxii + \advance \@tempcnta \@tempcntb + \global \count\@currbox \@tempcnta + }% + \@fltovf + \fi + \tagstructbegin{tag=float}%float + \edef\@current@float@struct{\csname tag_get:n\endcsname{struct_num}}% + \typeout{Float structure: \@current@float@struct} + \global \setbox\@currbox + \color@vbox + \normalcolor + \vbox \bgroup + \hsize\columnwidth + \@parboxrestore + \@floatboxreset +}% + +\def\end@float{% + \@endfloatbox + \tagstructend %end div + \ifnum\@floatpenalty <\z@ + \@largefloatcheck + \@cons\@currlist\@currbox + \ifnum\@floatpenalty <-\@Mii + \penalty -\@Miv + \@tempdima\prevdepth + \vbox{}% + \prevdepth\@tempdima + \penalty\@floatpenalty + \else + \vadjust{\penalty -\@Miv \vbox{}\penalty\@floatpenalty}\@Esphack + \tagmcbegin{tag=P}%restart P Safe here?? + \fi + \fi +} + +\ExplSyntaxOn +\long\def\@makecaption#1#2{% + \vskip\abovecaptionskip + \tagtool{para=false} + \sbox\@tempboxa{#1:~#2}% + \tag_struct_begin:n{tag=Caption} + \ifdim \wd\@tempboxa >\hsize + \tag_struct_begin:n{tag=Lbl} + \tag_mc_begin:n{} + #1:~ + \tag_mc_end: + \tag_struct_end: + \tag_mc_begin:n{} + #2\par + \tag_mc_end: + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil + \tag_struct_begin:n{tag=Lbl} + \tag_mc_begin:n{} + #1:~ + \tag_mc_end: + \tag_struct_end: + \tag_mc_begin:n{} + #2\par + \tag_mc_end:\hfil}% + \fi + \tagstructend %caption + \vskip\belowcaptionskip} +\ExplSyntaxOff + + + \endinput |