How to make tight double braces with quick-maths?

I want to make tight double braces like so:

image

The built-in symbols $brace.l.stroked ... brace.r.stroked$ do not look like proper double braces for denoting multisets, so I’m considering using quick-maths to replace all ${{$ and $}}$ with a custom macro.

However, the following rule does not work, what did I do wrong?

#import "@preview/quick-maths:0.2.1": shorthands

#let dbl = ${ #h(-.2em) {$
#let dbr = $} #h(-.2em) }$

#show: shorthands.with(
  (${{$, dbl),
  ($}}$, dbr),
)

$dbl ... dbr$ (What I want)

${{ ... }}$ (What I get)

Since double brace is not a special thing, you can’t alias it. You can open a feature request. It might be possible to add it.

I think the reason that the replacement doesn’t work is that { is recognized as an opening brace (will automatically use lr and so on). If you instead type \{ then you get just the symbol { and we can verify that

$\{\{ ... \}\}$

will give you your wanted replacements. So quick-maths actually works with these symbols. Now maybe that’s no longer the “shorthand” you want.

Maybe it’s a bug or feature request for quick-maths, could it be made to work with {{ too?

You could experiment with other shorthands. I think these work better, for example, it’s open to you to find something that both works and is an enjoyable shorthand:

  (${=$, dbl),
  ($=}$, dbr),

So you can alias a double brace, but if you pair them up (automatic lr) then it doesn’t work. (Likely something like "{{}}" => "lr({lr({ })})" going on there so to speak.)