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

Long formulae are truncated on phone #56

Open
ice1000 opened this issue Mar 30, 2024 · 6 comments
Open

Long formulae are truncated on phone #56

ice1000 opened this issue Mar 30, 2024 · 6 comments

Comments

@ice1000
Copy link
Contributor

ice1000 commented Mar 30, 2024

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
Copy link
Owner

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
Copy link
Owner

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

@ice1000
Copy link
Contributor Author

ice1000 commented Mar 30, 2024

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
Copy link
Contributor Author

ice1000 commented Mar 30, 2024

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

@ice1000
Copy link
Contributor Author

ice1000 commented Mar 30, 2024

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!

This was referenced Mar 31, 2024
@Myriad-Dreamin
Copy link
Owner

Since we have customized label now, I believe we can experiment it a bit.

Context, there is a "data-typst-label" to utilize:

https://github.com/typst/typst/blob/bb38a01d0625d5bdab0af50daf479e60c774d90e/crates/typst-svg/src/lib.rs#L254-L256C10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants