latex3 / pdfresources

LaTeX PDF resource management
LaTeX Project Public License v1.3c
22 stars 5 forks source link

\GetDocumentProperties doesn't display anything #20

Closed dbitouze closed 3 years ago

dbitouze commented 3 years ago

The following MCE shows the document property {top-level/topic} => {Demo} but \GetDocumentProperties{topic} doesn't expand its corresponding "Demo" value in the resulting PDF.

\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{uncompress}
\documentclass{article}
\AddToDocumentProperties{topic}{Demo}
\begin{document}
\ShowDocumentProperties
+\GetDocumentProperties{topic}+
\end{document}
u-fischer commented 3 years ago

You must add the label too: \GetDocumentProperties{top-level/topic}

dbitouze commented 3 years ago

You must add the label too: \GetDocumentProperties{top-level/topic}

Nevertheless, instead of silently not printing anything, an error message would be welcome.

u-fischer commented 3 years ago

Nevertheless, instead of silently not printing anything, an error message would be welcome.

No, an error is neither wanted nor possible. The command should be expandable, and it must be possible to query e.g. a hyperref value without getting an error if hyperref hasn't set it or hasn't been loaded at all. It is like with the hooks: you don't get an error if you add something to a hook that doesn't exist (yet). If you want an error you will have to add a check yourself.