typst / typst/typst

References to floating figures point to wrong location

Open
#4,359 14 comments 15 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug introspection
Dominant language
Rust
Stars
56.1k
Forks
1.7k
Avg merge
3d 10h
Merged PRs (30d)
22

Description

Description

The location of a floating figure is set to where it is created, but not where it is actually laid out.
This is visible in the location function, and also noticeable when clicking on a reference only to not end up at the figure.

#set page(height: 2.2cm, width: 8cm)

@figure

#figure(
  [#rect()<actual>],
  placement: top,
  caption: [A rectangle]
) <figure>

`figure:` #context query(<figure>).first().location().position() \
`rect:  ` #context query(<actual>).first().location().position()

image

Tried with 0.11.1 on the webapp, and on main with f91cad7d

Reproduction URL

No response

Operating system

Web app, Windows

Typst version
  • I am using the latest version of Typst

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the location function and run the supplied Typst example with the floating figure. Compare the reported positions and reference navigation for the figure and its actual content; done means both point to the figure's laid-out location rather than its creation location.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.