我有一个自定义函数,它使用图标来格式化 URL。我希望标签和图标之间的空格不间断。为此,我会使用字符~
,但这在代码中不起作用。
例如
== Unsuccessful attempt
#let mylink(label, dest) = {
link(dest)[#emph(underline(label + "~" + box("URL!")))]
}
#mylink("hello", "https://wikipedia.org") // FAILS as ~ is used as a character
== Without code
hello~#box("URL!") // works
#link("https://wikipedia.org")[hello~URL!] // works
#link("https://wikipedia.org")[#underline("hello~URL!")] // FAILS as ~ is used as a character
在代码中,您可以访问
sym.space.nobreak
符号:如果您发现自己经常需要在代码中使用不间断空格,那么您可以使用规则定义自己的简写函数
show
: