I have some related questions.
I would like to use the symbol U+21F8 ⇸ in my Typst document.
But, I would prefer it to be stylistically similar to the →
symbol (rather its math-mode version) and so I am interested in modifying that symbol. I don’t know how to do this.
I see that there is a function to draw a line, so I could use this to draw a vertical line through the → symbol. But I am not sure what would be an appropriate way to get this to scale appropriately to the size of the text.
Second question: I would like to input the symbol into my document using the notation -|->. I tried to use a show rule but I was unsuccessful, the pattern show "-|->" : it => [+] does not appear to do anything to $F -|-> G$. How should I do this?
Hi. Do you understand that “non math mode” (and math mode) rightwards arrow with vertical stroke depends on the font used? What exact features do you want from the arrow and what features you don’t like from $⇸$? You can insert the ⇸ in markup, and it will be stylistically similar to the →.
/ math: $->⇸$
/ markup: #sym.arrow⇸
For second question, do you need to insert it to markup mode or math?
#show "-|->": "⇸"
-|->
#show math.equation: it => {
if it.body.func() != [].func() { return it }
let new-children = ()
let i = 0
let last = it.body.children.len() - 1
let all = it.body.children
while i <= last {
let current = all.at(i)
if current == $-$.body and i + 1 <= last and all.at(i + 1) == $|->$.body {
new-children.push("⇸")
i += 2
continue
}
new-children.push(current)
i += 1
}
new-children.join()
}
$x -|-> y$
$⇸ -|->$
$-|->$
If you mean that use markup mode font in math mode, then use new-children.push(text(font: "Liberation Serif")[⇸]) instead.
It’s hard to modify math mode stuff, and this show rule is also hacky, so things like numbering doesn’t work.
You can find another font from which you like how ⇸ looks like.
Okay. No, it simply didn’t occur to me that I could insert the Unicode symbol directly and it would appear in the appropriate font. I thought that all the objects accessible in sym were essentially font-independent glyphs that are somehow drawn using SVG features of Typst, but it seems that this has nothing to do with Typst and it is drawn from the default Libertinus font. This might be fine for what I need. I am Googling “OpenType” and I see that there are a variety of fonts which implement the math component of this standard. Is it the case that any font which implements the math part of the OpenType standard can be used in math mode with common math-y unicode symbols?
You can select and copy the Unicode character in a PDF viewer, which means it’s not an SVG image. Only SVG and HTML formats currently render glyphs as SVG.
I have no idea. You can probably search it. I assume that a font just needs to have this glyph added, like a Latin or Cyrillic script. So probably any math font, or font that has math-related characters included, should just work.
On the topic of custom arrows outside unicode - package fletcher does that, so it has an even bigger repertoire of arrows. There, arrows in fletcher diagrams can be customized completely.