Myriad-Dreamin / shiroa

shiroa is a simple tool for creating modern online books in pure typst.
https://myriad-dreamin.github.io/shiroa/
Apache License 2.0
204 stars 17 forks source link

Long formulae are truncated on phone #56

Open ice1000 opened 3 months ago

ice1000 commented 3 months ago

Code:

#import "@preview/ctheorems:1.1.2": *
#import "/book.typ": book-page
#show: book-page.with(title: "Tesla Zhang")

The purpose of this page is to test some random things.

#show: thmrules.with(qed-symbol: $square$)

#let definition = thmbox("definition", "Definition", inset: (x: 1.2em, top: 1em))

#let emsp = h(2em)
#definition("Heterogeneous Composition")[
$ (A:bb(I) → cal(U)_1 #emsp φ:bb(F) #emsp r, s : bb(I)
  #emsp u: (i:bb(I)) → "Partial"(φ ∨ i=r, A(i)))/(
  "com"^(r arrow.squiggly s)(u) : { A(s) | φ ∨ r=s ↦ u(s) }) $
]

image

On mobile, it is truncated:

image

Trebor said maybe we should change the css into overflow-x: auto, currently it says overflow-x: hidden, is that why?

Myriad-Dreamin commented 3 months ago

It is a long term issues that how to show long math on small screen devices. The canonical way is breaking down equations manually:

#import "@preview/book:0.2.4": get-page-width
#let page-width = get-page-width()

#if page-width < 400pt { $shorter$ } else { $ longer $ }

Notably, this also happens in writing math in LaTeX.

Any smarter idea?

Myriad-Dreamin commented 3 months ago

We can turn overflow-x: hidden into overflow-x: auto, but it is not nice to have a page with overflowed content.

ice1000 commented 3 months ago

Any smarter idea?

Can every math block be in its own box and make that box horizontally scrollable? Is this very hard to achieve?

ice1000 commented 3 months ago

I don't want to ask for something super difficult...

ice1000 commented 3 months ago

We can turn overflow-x: hidden into overflow-x: auto, but it is not nice to have a page with overflowed content.

Would be nice if this can be a custom option!