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

\listoffigures generates "Destination figure.1 has no related structure" warnings #55

Closed jfbu closed 2 weeks ago

jfbu commented 6 months ago

I thought this would be here but I searched issues for \listoffigures and did not find it.

\listoffigures causes warning (on second compilation with pdflatex):

Package tagpdf Warning: Destination figure.1 has no related structure.
(tagpdf)                /Ref for structure 7 not updated

If one uses hyperref more warnings will be generated.

test file

\DocumentMetadata{
 uncompress,
 pdfversion=1.7,
 lang=en-US,
 testphase=phase-III
}

\documentclass{article}

%\usepackage{hyperref}

\begin{document}

%\tableofcontents

\listoffigures

\section{foo}

\subsection{subfoo1}

\begin{figure}[htbp]
  \centering
  figure coucou
  \caption{figure1}
\end{figure}

\end{document}
u-fischer commented 6 months ago

Hm. That looks like a bug in the float code.

u-fischer commented 5 months ago

I fixed that in a development branch.

jfbu commented 5 months ago

I tested the fix but it seems warning goes away only on third pdflatex-dev pass

I checked the console output did display the path to my TEXMFHOME, after I had rebuild the pdflatex-dev format and used l3build install.

edit: similar with lualatex-dev

FrankMittelbach commented 5 months ago

I doubt that it is possible now or in the future to avoid warnings during intermediate runs. This is, to some extend similar to warnings like "Warning: undefined reference" except that in cases of label/refs it is fairly easy to determine at the end if another run is likely to correct the issue, while I doubt that there is an easy test to figure out if tagging issues resolve themselves through another run. We'll have to see, but for now I think this has to be taken as "intermediate runs may show warnings that resolve themselves with additional runs. Adding something like "Rerun to get tagging right" is a bit pointless if it may equally stay forever because of real issue or incompatible packages.

u-fischer commented 5 months ago

I tested the fix but it seems warning goes away only on third pdflatex-dev pass

  • no warning on first pass
  • warning on second pass
  • no warning on third

Well sure, on the first pass there is no list of figures and so also no need to add a /Ref key, on the second run it detects the missing /Ref key but as (due to the additional toc) the structure numbers moved around it can't resolve it and so a third compilation is needed. I can look if one can avoid the third pass, but as page numbers changes anyway if a list of figure is inserted and so normally a third compilation is needed to resolve page references it doesn't have a high priority.

John02139 commented 1 month ago

This issue is fixed in the current pdflatex-dev; but if I load caption or subcaption in the script above, a very similar error is generated:

Package tagpdf Warning: Destination figure.caption.3 has no related structure.
(tagpdf)                /Ref for structure 20 not updated

I realize that caption and subcaption are not yet supported. But does the fix used in the dev code suggest a workaround for these two packages?

FrankMittelbach commented 2 weeks ago

I realize that caption and subcaption are not yet supported. But does the fix used in the dev code suggest a workaround for these two packages?

@John02139 caption and subcaption need more work than that. You can open an issue for each of them, so that this is on record, but it will take time until we get to them.

John02139 commented 2 weeks ago

Done, as requested.