latex3 / tagpdf

Tagging support code for LaTeX
59 stars 7 forks source link

tagging reverts footmisc abovefloats option #58

Closed u-fischer closed 8 months ago

u-fischer commented 2 years ago

The code to attach missing mc-commands to the page looses the \vfill needed to push the footnote to the top if a \newpage follows:

\DocumentMetadata{}
\documentclass{article}
\usepackage{tagpdf}
\tagpdfsetup{activate-mc} %only  mc here for demo
\ExplSyntaxOn\makeatletter

\cs_set_protected:Npn\__tag_add_missing_mcs:Nn #1 #2 {
  \vbadness \@M
  \vfuzz    \c_max_dim
  \vbox_set_to_ht:Nnn #1 { \box_ht:N #1 } {
    \hbox_set:Nn \l__tag_tmpa_box { \__tag_mc_insert_extra_tmb:n {#2} }
    \hbox_set:Nn \l__tag_tmpb_box { \__tag_mc_insert_extra_tme:n {#2} }
    \int_compare:nNnT {\l__tag_loglevel_int} > { 0 }
         {
           \seq_log:c { g__tag_mc_#2_marks_seq}
         }
    \box_set_ht:Nn \l__tag_tmpa_box \c_zero_dim
    \box_set_dp:Nn \l__tag_tmpa_box \c_zero_dim
    \box_set_ht:Nn \l__tag_tmpb_box \c_zero_dim
    \box_set_dp:Nn \l__tag_tmpb_box { \box_dp:N #1 }
    \boxmaxdepth \@maxdepth
    \box_use_drop:N        \l__tag_tmpa_box
    \vbox_unpack_drop:N     #1
    \tex_kern:D -\box_dp:N \l__tag_tmpb_box
    \nointerlineskip
    \box_use_drop:N \l__tag_tmpb_box
    %\vfill %<------- how to add this in the right way ??       
  }
}

\ExplSyntaxOff\makeatother

\usepackage[abovefloats]{footmisc}
\raggedbottom

\begin{document}

Text, footnotes\footnote{A}

\newpage 

blub

\end{document}

image

The correct output should be

image

u-fischer commented 1 year ago

Shorter example in 2023

\DocumentMetadata{testphase=phase-I}
\documentclass{article}
\usepackage[abovefloats]{footmisc}
\raggedbottom
\begin{document}

Text, footnotes\footnote{A}

\newpage 

blub

\end{document}
FrankMittelbach commented 1 year ago
\makeatletter

\ExplSyntaxOn
\cs_set:Npn \@kernel@before@cclv{
  \__tag_check_typeout_v:n {====> In \token_to_str:N 
    \@makecol \c_space_tl \the \c@page }
    \__tag_add_missing_mcs_to_stream:Nn \@outputbox %<-- alter this box
{main}}
\ExplSyntaxOff

\def \@makecol {%
  \setbox\@outputbox \box\@cclv
  \showbox\@outputbox
  \@outputbox@removebskip
  \@kernel@before@cclv    %  <--- here instead (and name now wrong)
  \showbox\@outputbox
  \let\@elt\relax
  \xdef\@freelist{\@freelist\@midlist}%
  \global \let \@midlist \@empty
  \@makecol@appendblocks
  \ifvbox\@kludgeins
     \@makespecialcolbox
  \else
     \@makenormalcolbox
  \fi
  \global \maxdepth \@maxdepth
}

\makeatother
u-fischer commented 8 months ago

resolved in current LaTeX.