How can one use an arbitrary symbol as a separator without having it appear at the beginning of a line?

I would like to use a dot as a separator within a sentence. The symbol hyph.point seems suitable. The result looks good. Unfortunately, there’s a drawback. In certain cases, the symbol can appear at the beginning of a line. That doesn’t look good:

#set page(width: 90pt, height: 100pt)

#let dt = sym.hyph.point

Aaa #dt Bbb #dt Ccc #dt Ddd

To prevent this, I inserted a non-breaking space (space.nobreak). To maintain equal spacing before and after the dot, I had to add a regular space (space) after the dot. This ensures that the dot doesn’t appear at the beginning of a line:

#set page(width: 100pt, height: 100pt)

#let dt = {
  sym.space.nobreak
  sym.hyph.point
  sym.space
}

Aaa #dt Bbb #dt Ccc #dt Ddd

Unfortunately, the spacing around the dot now feels too wide. I would prefer the same spacing as in the first attempt. Is there a solution?

Hi, I think you are looking for a word joiner (sym.wj). This Unicode symbol join two symbols with no space or other visual impact.

#set page(width: 90pt, height: 100pt)

#let dt = {
  sym.wj
  sym.hyph.point
}

Aaa #dt Bbb #dt Ccc #dt Ddd

Alternatively, you can remove the spaces at the place you’re using the separator:

#set page(width: 90pt, height: 100pt)

#let dt = {
  sym.space.nobreak
  sym.hyph.point
  sym.space
}
// or equivalently
#let dt = [~#sym.hyph.point ]

Aaa#dt;Bbb#dt;Ccc#dt;Ddd

… although I think the other option looks nicer code-wise.
It has its place though: when you have a list that you then join with the separator:

#set page(width: 90pt, height: 100pt)

#([Aaa], [Bbb], [Ccc], [Ddd]).join[~#sym.hyph.point ]

here, I think having the space as part of the separator is more readable.

1 Like