You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Author metadata wrong with multiple authors in v0.9.0 #2556
bugSomething isn't workingmodelRelated to model category, which is all about structure and semantics.needs-investigationMore investigation is necessary.pdfRelated to PDF export or PDF embedding.urgentShould be fixed before the next release.
Moreover, both the PDF metadata (/Author (author 1, author 2, author 3)) and XMP info (<dc:creator><rdf:Seq><rdf:li>author 1</rdf:li><rdf:li>author 2</rdf:li><rdf:li>author 3</rdf:li></rdf:Seq></dc:creator>) look correct.
I assumed that Typst version 0.8.0 does not include the XMP-dc Creator and that's why Adobe Acrobat shows the authors correctly. That assumption was wrong however as the same document compiled with Typst version 0.8.0 has [PDF] Author and XMP-dc Creator set. This leads me to believe that version 0.9.0 does things differently.
Are there any other PDF properties that store information about the authors?
This is the output of exiftool when the document is compiled with version 0.8.0:
$ exiftool -a -G1 test.pdf
[ExifTool] ExifTool Version Number : 11.88
[System] File Name : test.pdf
[System] Directory :.
[System] File Size : 9.9 kB
[System] File Modification Date/Time : 2023:11:02 08:12:54+01:00
[System] File Access Date/Time : 2023:11:02 08:12:55+01:00
[System] File Inode Change Date/Time : 2023:11:02 08:12:55+01:00
[System] File Permissions : rwxrwxrwx
[File] File Type : PDF
[File] File Type Extension : pdf
[File] MIME Type : application/pdf
[PDF] PDF Version : 1.7
[PDF] Linearized : No
[PDF] Page Count : 1
[PDF] Language : en
[PDF] Author : author 1, author 2
[PDF] Creator : Typst
[XMP-x] XMP Toolkit : xmp-writer
[XMP-dc] Creator : author 1, author 2
[XMP-dc] Format : application/pdf
[XMP-dc] Language : en
[XMP-xmp] Creator Tool : Typst
[XMP-xmpTPg] N Pages : 1
[XMP-xmpMM] Rendition Class : proof
[XMP-pdf] PDF Version : 1.7
And as @GFPJ said, without any content in the document, no author information is shown regardless of author count. The style chain entry for author is simply empty there.
At first, my assumption was that the style was taken out of the child itself, so when the loop is not entered it won't get those styles of the first page. But this cannot be true as styles is never written to from inside the loop, it's shadowed.
Unfortunately, that's all I found out so far, as the style.rs is rather complicated, containing a lot of very similarly named structs. @laurmaedje I think this is important for the styling rework you're working on. Maybe working on this independently is not worth it if this changes drastically in the new future.
@tingerrr I agree, there seems to be a general issue that documents with only set rules don't produce a correct document, not that it really matters I suppose.
Acrobat takes the first author from the document information dictionary and the remaining authors from the XMP metadata.
To fix this for Acrobat, we could omit the remaining authors or all metadata from the document information catalog (it is optional) and only write XMP. However, not all other tools (including Apple Preview) read the XMP data. This means we do want to include all authors in the document information dictionary.
Thus, the only alternative is to fold all authors into a single <rdf:li> in the XMP metadata. This is, in fact, exactly what the PDF/A spec Part 1 section 6.7.3 has to say about the matter. It's a bit weird to not use the array (and it makes Acrobat show the author list in quotes), but there's not much we can do about that.
bugSomething isn't workingmodelRelated to model category, which is all about structure and semantics.needs-investigationMore investigation is necessary.pdfRelated to PDF export or PDF embedding.urgentShould be fixed before the next release.
Activity
samueltardieu commentedon Nov 1, 2023
I cannot reproduce this on Linux with typst 0.9.0:
$ pdfinfo t.pdf Author: author 1, author 2, author 3Moreover, both the PDF metadata (
/Author (author 1, author 2, author 3)) and XMP info (<dc:creator><rdf:Seq><rdf:li>author 1</rdf:li><rdf:li>author 2</rdf:li><rdf:li>author 3</rdf:li></rdf:Seq></dc:creator>) look correct.marnicbar commentedon Nov 2, 2023
I used the web app with either version 0.8.0 or 0.9.0 selected.
I haven‘t tested it locally yet.
marnicbar commentedon Nov 2, 2023
I compiled the same test file locally on Windows 11 and Adobe Acrobat shows the authors in the same weird way.
I then tried pdfinfo and exiftool and they both showed the authors correctly.
It seems to be the behavior of Adobe Acrobat (which does not look right to me) rather than an issue with Typst. Sorry for the false bug report.
marnicbar commentedon Nov 2, 2023
I assumed that Typst version 0.8.0 does not include the
XMP-dc Creatorand that's why Adobe Acrobat shows the authors correctly. That assumption was wrong however as the same document compiled with Typst version 0.8.0 has[PDF] AuthorandXMP-dc Creatorset. This leads me to believe that version 0.9.0 does things differently.Are there any other PDF properties that store information about the authors?
This is the output of exiftool when the document is compiled with version 0.8.0:
tingerrr commentedon Nov 14, 2023
I've investigated a bit. The value that is written to the PDF in the end is set here:
typst/crates/typst-library/src/meta/document.rs
Line 94 in 897447e
And as @GFPJ said, without any content in the document, no author information is shown regardless of author count. The style chain entry for
authoris simply empty there.At first, my assumption was that the style was taken out of the child itself, so when the loop is not entered it won't get those styles of the first page. But this cannot be true as styles is never written to from inside the loop, it's shadowed.
Unfortunately, that's all I found out so far, as the
style.rsis rather complicated, containing a lot of very similarly named structs. @laurmaedje I think this is important for the styling rework you're working on. Maybe working on this independently is not worth it if this changes drastically in the new future.laurmaedje commentedon Nov 14, 2023
@tingerrr I think the fact that no author metadata is written at all without content is independent from the issue with the wrong metadata.
tingerrr commentedon Nov 14, 2023
Yes, indeed, perhaps we should open an additional issue just for that?
Dherse commentedon Nov 17, 2023
@tingerrr I agree, there seems to be a general issue that documents with only
setrules don't produce a correct document, not that it really matters I suppose.laurmaedje commentedon Nov 17, 2023
I will try to fix that when reworking the styling system. Feel free to open an issue for it.
laurmaedje commentedon Nov 29, 2023
Turns out that if the authors are given in both the document information dictionary and the XMP metadata, Acrobat takes a little bit of both.
With document information
and XMP metadata
Acrobat takes the first author from the document information dictionary and the remaining authors from the XMP metadata.
To fix this for Acrobat, we could omit the remaining authors or all metadata from the document information catalog (it is optional) and only write XMP. However, not all other tools (including Apple Preview) read the XMP data. This means we do want to include all authors in the document information dictionary.
Thus, the only alternative is to fold all authors into a single
<rdf:li>in the XMP metadata. This is, in fact, exactly what the PDF/A spec Part 1 section 6.7.3 has to say about the matter. It's a bit weird to not use the array (and it makes Acrobat show the author list in quotes), but there's not much we can do about that.Don't write multiple authors in XMP metadata
Don't write multiple authors in XMP metadata