#How to protect smart quotes from being swapped

18 messages · Page 1 of 1 (latest)

crude robin
#

i have a code like

#let refs = yaml("/shared/refs.yml")

#let citetitle(id)      = refs.at(str(id)).at(default: {}, "title")
#let citeurl(id)        = refs.at(str(id)).at(default: {}, "url")
#let citeauthor(id)     = [#cite(id, form: "author")]
#let citeyear(id)       = [#cite(id, form: "year")]
#let citeauthoryear(id) = [#citeauthor(label(id)), #citeyear(label(id))]

#let citembed(id) = {
  smartquote() + citetitle(id) + smartquote()

  if "url" in refs.at(str(id)) {
    url(citeurl(id))
  }

  " (" + citeyear(id) + "), "
  citeauthor(id)
}

which renders

#

but i want to use lang-based quotes, and when i do

#let citembed(id) = {
  smartquote() + citetitle(id) + smartquote()

  if "url" in refs.at(str(id)) {
    url(citeurl(id))
  }

  " (" + citeyear(id) + "), "
  citeauthor(id)
}
#

i get a different trailing quote

#

it's more apparents when lang is set to other ones

#

is there a way to prevent the quote being rendered as a plain "?

#

prob doing something wrong here, help much welcome typstguy

rich delta
#

it seems, there needs to be some kind of space between the last smartquote and the next content, for example either a literal space or #h(0em)

#

?r

#{
 smartquote() + "test test" + smartquote() + h(0em)
 link("google.com")[#box(rect(width: 5mm, height: 5mm))]
}
rich delta
#

compared to

#

?r

#{
 smartquote() + "test test" + smartquote()
 link("google.com")[#box(rect(width: 5mm, height: 5mm))]
}
hushed elm
#

Interesting that h(0em) does the job, but sym.zwj not

rich delta
#

Yea I tried that too

#

Dunno what it exactly expects

crude robin
#

thx a lot @rich delta @hushed elm u're the best excited

hushed elm
#

I did exactly nothing 😄

crude robin