racket / scribble

Other
199 stars 91 forks source link

Why is `~` converted to `$\sim$` by the LaTeX renderer? #370

Closed benknoble closed 1 year ago

benknoble commented 1 year ago

This bit me recently because $\sim$ is hard to copy-paste as a tilde, and I had much better luck switching to \textasciitilde{} which is admittedly not as pretty in @racket and friends.

If there's no good reason, I'm happy to send this diff of scribble-lib/scribble/latex-render.rkt as a PR:

1078c1078
<                      [(#\~) "$\\sim$"]
---
>                      [(#\~) "{\\textasciitilde}"]
1457c1457
<         [(#\∼) "$\\sim$"]
---
>         [(#\∼) "{\\textasciitilde}"]
racket-discourse-github-bot commented 1 year ago

This issue has been mentioned on Racket Discussions. There might be relevant details there:

https://racket.discourse.group/t/copy-paste-from-scribble-acmart-sigplan-into-drracket/2078/15

rfindler commented 1 year ago

I think the second one of those is a different character that should actually be `$\sim$.

benknoble commented 1 year ago

I think the second one of those is a different character that should actually be `$\sim$.

Oh, indeed it is! I don't think my font showed the difference well, but I can tell on GitHub at least. Let me check my font again; it might be worth a comment that it's not a regular tilde.

rfindler commented 1 year ago

I think the second one of those is a different character that should actually be `$\sim$.

Oh, indeed it is! I don't think my font showed the difference well, but I can tell on GitHub at least. Let me check my font again; it might be worth a comment that it's not a regular tilde.

Yeah, mine didn't either! I just had a hunch so checked it by typing a regular tilde and comparing the two characters. 😄

I've (finally) finished running raco setup --doc-pdf with the change locally and it doesn't seem to cause any errors so I'm happy to merge a pull request. Or I can just push a commit too if that's easier?

benknoble commented 1 year ago

Whichever is easier for you. Thanks for looking!

benknoble commented 1 year ago

Closing the loop: my font does a better job distinguishing (0x223c) from ~ (0x7e) than I thought it did. I just made the mistake of not looking carefully; in retrospect, I should have questioned harder why there were two substitutions of the same character.