Skip to content

different behavior after pagebreak using block, place and image #6125

@TabError

Description

@TabError

Description

Please rename the title if you found out what the actual problem is.

Here is the code:

#set page("a6")
#set text(font: "Noto Sans")
#set text(size: 20pt)

// ========== Scripting ==========

// Icons
#let sensorIcon = image("sensor-icon.png")
#let mcIcon = image("microcomputer-icon.png")

// Symbols
#let makeSym(im, te, spacing: 1em, width: 3cm, textSize: 16pt) = {
  set text(size: textSize)
  block(width: width, stroke: none)[
    #set align(center)
    #im
    #v(-2em + spacing)
    #text(te)
  ]
}

#let sensorSym = makeSym(sensorIcon, "Sensor", spacing: 0.6em)
#let mcSym = makeSym(mcIcon, "MicroComputer", spacing: 1.3em)

// combined Symbols
#let combo = block(stroke: 1pt)[
  #scale(90%, mcSym)
  #place(top + left, dx: 0pt, dy: 0pt, scale(50%, block(stroke: 1pt, sensorIcon)))
]

// ========== Document ==========
#combo

#combo

#combo

#combo

#combo

Here is an image of the pdf:
Image

The problem:
The command #combo produces 2 different visualizations. This happens only when the third usage is moved to the next page (that's why i set page format to a6). Since it is the same variable it should produce exactly the same output, right?

I assume this is an issue of place(). But I don't know for sure. The docs say:
place := Places content relatively to its parent container.
In this case the parent container should be the block, right?

I also found out, that if i set sensorIcon to image("sensor-icon.png", width: 3cm) it seems to be working just fine. As if the problem would be about the image handling and scaling etc. But since the same scaling is used why is it different in the two calls??

I actually don't know what is the problem but something seems odd here. Maybe I just miss something relevant here and it is not a bug. In that case I'd be sorry to waste your time, but I think the behavior is not explained very well anywhere.

Best regards

PS: I love typst :)

Reproduction URL

https://typst.app/project/rQS0GegYiJegfS7NxmEXYT

Operating system

Linux

Typst version

  • I am using the latest version of Typst

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglayoutRelated to layout, positioning, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions