typst / typst/typst

Typst's `pattern` inside a PDF file prevents MuPDF viewer from showing any pattern changes

Open
#2,893 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

Using the MuPDF from the nix shell nixpkgs#mupdf: v1.23.5

  1. Paste this code into a text editor:
#set rect(width: 100%, height: 20pt)
#let pattern = pattern(size: (20pt, 20pt), square(size: 5pt, fill: black))
// #let pattern = pattern(size: (20pt, 20pt), square(size: 5pt))
#rect(fill: pattern)
  1. Run the typst watch.
  2. Open the PDF file with the mupdf-x11 (mupdf).
  3. Comment out the 2nd line and uncomment the 3rd line (from the top).
  4. The output of MuPDF doesn't change. Although you can still write some text below or anything else and the PDF preview will be updated. But the section/part of the PDF preview where the pattern is shown won't be updated, i.e., the MuPDF "remembers" the last state of the shown pattern and doesn't forget/refresh this state.

I can demonstrate how it worked in my document:

Run the editor, MuPDF, typst watch (and echo "$pdf_file" | entr -n kill -HUP $mupdf_pid to update the preview):
image

Change the pattern (doesn't update only the pattern part):
image

Press the e key (toggle spot color mode) (updated the pattern part, but the colors are ugly):
image

Press the e key again (colors are fine, but now the pattern part is completely broken):
image

But with the minimal example above, the e key (or E) doesn't work/fix. So I'm stuck with the unupdatable pattern part of the PDF preview, and I can only "fix" this by restarting the MuPDF. And this happens every time I edit the pattern.

Reproduction URL

No response

Operating system

Linux

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 by running the minimal Typst example with typst watch and opening the generated PDF in MuPDF. Compare the preview after changing the pattern and check whether the generated PDF reflects the change. Done means MuPDF refreshes the pattern region without restarting or toggling modes.

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
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.