Skip to content

Skipping files with includeonly leads to compilation errors #838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
teepeemm opened this issue May 1, 2025 · 3 comments
Open

Skipping files with includeonly leads to compilation errors #838

teepeemm opened this issue May 1, 2025 · 3 comments

Comments

@teepeemm
Copy link

teepeemm commented May 1, 2025

The following compiles fine:

\DocumentMetadata{testphase={latest},lang=en}
\begin{filecontents*}{includedFile.tex}
Some content to create a tag in an included file.
\end{filecontents*}
%\includeonly{nothing}
\documentclass{article}
\begin{document}
Some content to create a tag
\include{includedFile}
\end{document}

If I then uncomment the \includeonly command, however, I get the errors

./root.tex:10: Package tagpdf Error: objnum missing for structure 7

Type <return> to continue.
 ...                                              
                                                  
l.10 \end{document}
                   
? 

./root.tex:10: Package tagpdf Error: objnum missing for structure 8

Type <return> to continue.
 ...                                              
                                                  
l.10 \end{document}
                   
? 

(and it appears that the more complicated an included file is, the more errors that I get).

@u-fischer
Copy link
Member

hm, yes. Looking back it was probably the wrong decision to use an latex counter for the structures. I had some vage idea that it would help with trial typesetting, but in the end it never came true, we suspend tagging in such places.

I will test if one can use an normal int instead. For now you could use \DocumentMetadata{tagging=draft,lang=en} when using \includeonly, this doesn't write the structures at the end.

u-fischer added a commit to latex3/tagpdf that referenced this issue May 1, 2025
@teepeemm
Copy link
Author

But with tagging=draft, the output doesn't seem to be tagged at all.

I've found that, just after the \include command, if I subtract the number of errors off of g__tag_struct_abs_int (in this case \ExplSyntaxOn \addtocounter{g__tag_struct_abs_int}{-2} \ExplSyntaxOff), then I don't get the errors. But I'm not sure of other consequences (it appears that pdflatex gets confused and collapses all text tags to one, but lualatex is ok). I would also need to look into \include enough to figure out how to subtract that off whenever \includeonly excluded the file.

Or will lualatex-dev work in this case in the near future, and will take care of the count on its own?

@u-fischer
Copy link
Member

I'm planing an tagpdf update today or tomorrow which will avoid this error. (I'm not sure if then everything works. And I certainly recommend to prefer lualatex, the structure there gets less easily confused).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants