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

Match size of brakets #29

Open
mpmdean opened this issue May 15, 2024 · 5 comments
Open

Match size of brakets #29

mpmdean opened this issue May 15, 2024 · 5 comments

Comments

@mpmdean
Copy link

mpmdean commented May 15, 2024

Thanks for the nice package.

If I write

$ braket(f, D^dagger , n) braket(n, D, i) $
The left and right brakets don't match
Screenshot 2024-05-15 at 12 48 00 PM

I failed to work out how to add a hidden superscript, which seems like the natural way to address this?

@Leedehai
Copy link
Owner

Hi, I'm glad that you find the package useful!

This issue is actually part of Typst itself: a symbol's attachment (superscript, subscript) can affect the symbol frame's overall height, and the bracket's height is too sensitive on the content's height - though we certainly want the bracket to be taller if the contained symbol is very tall, e.g. an integration symbol. Maybe you could consider filing an issue on https://github.com/typst/typst.

@YDX-2147483647
Copy link
Contributor

Besides, the height of lr is settable. Maybe we can add a size argument to braket?

typst-physics/physica.typ

Lines 471 to 476 in e360430

if args.len() <= 2 {
$ lr(angle.l bra#h(0pt)mid(|)#h(0pt)ket angle.r) $
} else {
let middle = args.at(1)
$ lr(angle.l bra#h(0pt)mid(|)#h(0pt)middle#h(0pt)mid(|)#h(0pt)ket angle.r) $
}

//  This is NOT a full solution.
#set math.lr(size: 500%)

$ lr(angle.l D angle.r) $

Left/Right Functions – Typst Documentation

@Leedehai
Copy link
Owner

Maybe we can add a size argument to braket?

Hi - that's a great idea. Feel free to open a PR:) However, I noticed Typst's lr() doesn't handle mid() well with the size parameter. I think that'd be a blocking issue:

#set math.lr(size: 500%)

$ lr(angle.l A mid(|) B angle.r), lr(angle.l A B angle.r) $

@sjfhsjfh
Copy link

sjfhsjfh commented Jun 2, 2024

typst/typst#3186

@mkorje
Copy link

mkorje commented Sep 27, 2024

Maybe we can add a size argument to braket?

Hi - that's a great idea. Feel free to open a PR:) However, I noticed Typst's lr() doesn't handle mid() well with the size parameter. I think that'd be a blocking issue:

#set math.lr(size: 500%)

$ lr(angle.l A mid(|) B angle.r), lr(angle.l A B angle.r) $

This isn't an issue with Typst, but with the font I believe. The font doesn't have constructable angle brackets, and so only has the fixed preconstructed sizes which stop at approx. 300% (33pt).

These are the 8 variants it has (sizes aren't exact, I just picked percentages that work to show the variants):

$
  stretch(|, size: #500%)
  stretch(angle.r, size: #100%)
  stretch(angle.r, size: #107%)
  stretch(angle.r, size: #112.5%)
  stretch(angle.r, size: #125%)
  stretch(angle.r, size: #150%)
  stretch(angle.r, size: #200%)
  stretch(angle.r, size: #225%)
  stretch(angle.r, size: #250%)
$

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

5 participants