uwdata / living-papers

Authoring tools for scholarly communication. Create interactive web pages or formal research papers from markdown source.
BSD 3-Clause "New" or "Revised" License
131 stars 10 forks source link

Non breaking spaces before citations #106

Open domoritz opened 1 month ago

domoritz commented 1 month ago

It would be great if living papers could render non breaking spaces before citations to get a smoother reading flow and avoid this:

Screenshot 2024-10-15 at 20 29 36

In latex, it would compile to ~.

jheer commented 1 month ago

Yes that would be nice. The design question here is what should the syntax be? For HTML it is   which is not the nicest but would work. We don’t want to use ~ as we want to preserve straightforward use of tilde as a character. Any other ideas?

jheer commented 1 month ago

We could try to do this automatically before citations but I’m not sure that’s something one always wants to do, especially across varied citation styles.

domoritz commented 1 month ago

What are cases where you don't want it? Long citation styles?

As a simple step, you could support the   (non breaking space char, option + space) and convert it to ~ in latex (or maybe panda does that already). The bad thing is that it's pretty much indistinguishable from a normal space in the markdown. I can't think of a good symbol for non breaking spaces. Typst also uses ~.

Another odd thing I found were breaking spaces in Figure X references but that's probably an easier fix.

Screenshot 2024-10-15 at 23 32 25