latex3 / tagging-project

Issues related to the tagging project
https://latex3.github.io/tagging-project/
LaTeX Project Public License v1.3c
23 stars 5 forks source link

Footnote modification (or hack, really) leads to tagging error #60

Closed John02139 closed 5 months ago

John02139 commented 5 months ago

Perhaps I simply shouldn't hack things this way, but in case it's useful to know ...

Changing \@makefntext as shown has worked fine for years. With phase-III, however, I get an undefined control sequence error -- which I can eliminate by setting the hack to \AtBeginDocument{..}.

\DocumentMetadata{ 
    testphase = {phase-III},
}
\documentclass[10pt]{article} 

\makeatletter
%% reduce indentation of footnotes
%\AtBeginDocument{
\RenewDocumentCommand\@makefntext{m}{%
  \noindent\makebox[2ex][r]{\@makefnmark}#1}
%}
\makeatother

\begin{document}
\section{Preliminary remarks}
Introductory comments with a humorous anecdote.

And here's what it really means.\footnote{A footnote}
\end{document}

% If \AtBeginDocument{..} is NOT used, the following error appears with tagging:
%
%! Undefined control sequence.
%<argument> \ERROR 
%                  \cs_set_eq:NN \__fnote_tmp:w \exp_stop_f: 

Uncommenting \AtBeginDocument{..} clears the error.

u-fischer commented 5 months ago

You will break the tagging if you redefine \@makefntext like this. It is not very obvious but if you look carefully you can see that the label (the 1) is not in the footnotelabel structure but in the text itself:

image

You can probably get your wanted output simply by setting \setlength\footnotemargin{2ex}, if that is not enough you must define a new plug for the fntext/mark socket.

John02139 commented 5 months ago

The simple (and in hindsight, very obvious) fix of \setlength{..} resolves the problem for me.

John02139 commented 5 months ago

Perhaps worth mentioning that \footnotemargin is defined in testphase={phase-III} but otherwise requires loading the package footmisc.