Thought I had understood the behavior of whitespace around `~` in TeX (namely, that it was ignored) but I was wrong. Code like:

some words~

typesets two spaces before the reference. I'm too lazy to go read the TeXbook again (Ch. 8) to try and figure out the exact rules 😣

@otini use % after ~ (or anywhere you want to line break for your convenience/source but keep things attached (no space)).

So assuming your desired output is produced by

some words~\cite{ref}

Then this should work too:

some words~%

Also it's good to know about this, as in "why your comment can change output if put in wrong(/right) place"!

I did this all the time haha (didn't want it on previous line, often long ref list/strings or whatever). Hope this helps!

@otini checked my thesis and seems I standardized on

some words%

I think to make linting for missed '~'s before '\cite' less difficult. But I don't think it matters which way you do it :).

@otini sorry if you weren't looking for a workaround/solution/alternative. I don't know the exact rules either >.<

@wdtz I was more looking for the rules, but I appreciate the advice! I use that too :)

Sign in to participate in the conversation
Functional Café

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!