Skip to content
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

Bookmarks are displaying at the correct depth only in the Typst app but not in other PDF readers. #5615

Open
1 task done
ErickFG08 opened this issue Dec 20, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@ErickFG08
Copy link

Description

REPREX:

#outline(
  title: auto,
  indent: 2em,
)
    
#heading("Heading A.1", level: 1, outlined: true, bookmarked: true)
#heading("Heading B.1", level: 2, outlined: true, bookmarked: true)
#heading("Heading C.1", level: 3, outlined: true, bookmarked: true)
#heading("Heading C.2", level: 3, outlined: true, bookmarked: true)
#heading("Heading C.3", level: 3, outlined: true, bookmarked: true)

#heading("Heading A.1", level: 1, outlined: false, bookmarked: false)
#heading("Heading B.2", level: 2, outlined: true, bookmarked: true)
#heading("Heading C.1", level: 3, outlined: true, bookmarked: true)
#heading("Heading C.2", level: 3, outlined: true, bookmarked: true)
image image

Heading B.2 should be inside Heading A.1

Here's the output file.

Test.pdf

Reproduction URL

No response

Operating system

No response

Typst version

  • I am using the latest version of Typst
@ErickFG08 ErickFG08 added the bug Something isn't working label Dec 20, 2024
@wznmickey
Copy link
Contributor

wznmickey commented Dec 20, 2024

From the comment in crates/typst-pdf/src/outline.rs https://github.com/typst/typst/blob/main/crates/typst-pdf/src/outline.rs

// Stores the level of the topmost skipped ancestor of the next bookmarked
// heading. A skipped heading is a heading with 'bookmarked: false', that
// is, it is not added to the PDF outline, and so is not in the tree.
// Therefore, its next descendant must be added at its level, which is
// enforced in the manner shown below.

I think it is a designed feature that B.2 in level 2 will be added as a level 1 bookmark.

Since the webapp is not opensource, not sure how the web outline is designed.

@laurmaedje
Copy link
Member

Seems to be inconsistent either way. cc @PgBiel

@PgBiel
Copy link
Contributor

PgBiel commented Dec 20, 2024

I'm not sure if the web app's outline feature already existed when #1566 was merged, but either way that PR has further discussion. I think the current behavior is more in line with what is expected of PDFs, especially when e.g. a heading is orphaned, so a promotion is forced. But there could be some change in the behavior to make it at least slightly more uniform with outline, if we decide that to be desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants