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

hyperref + savebox warning if savebox is defined in preamble with phase-I, II and III #68

Open AlphaJack opened 4 months ago

AlphaJack commented 4 months ago

MWE:

\DocumentMetadata{
 testphase=phase-I,
 pdfversion=2.0
}

\documentclass{article}

\usepackage{hyperref}

\newsavebox{\mailText}
\newcommand{\mail}[1]{\savebox{\mailText}{\href{mailto:#1}{#1}}}

% triggers warning if defined in preamble
\mail{about@example.com}

\begin{document}

% does not trigger warning if defined in body
%\mail{about@example.com}

My e-mail is \usebox{\mailText}.

\end{document}

Output:

lualatex mwe.tex | texlogfilter
LaTeX2e <2022-11-01> patch level 1
Document Class: article 2022/07/02 v1.4n Standard LaTeX document class
Package tagpdf Warning: The rule between parent 'StructTreeRoot/pdf' 
(tagpdf)                and child 'Link/pdf2' is not allowed (struct 1)

Output written on microtype.pdf (1 page, 20235 bytes).

Found 1 warning(s)
u-fischer commented 4 months ago

Well at first you shouldn't do typesetting (and this includes storin text in boxes) in the preamble (quite independant from tagging). Fonts aren't fully setup there.

At second even in the document your code is not correct, the structure it produces is faulty. \savebox and \usebox aren't supported yet. The tagpdf documentation contains some remarks about the problems here (it is in no way trivial ...).