Where should citations be placed relative to punctuation (e.g., full stops and commas)? This question pops up every time I write an article (in the computer science domain), and I am unable to find a British English style-guide providing a proper answer. 

Where should citations be placed within the sentence and its punctuation?
Where to put white space?

E.g., which options are preferable:


More coffee is always better. [XY]
More coffee is always better [XY].
More coffee is always better[XY].
More coffee is always better.[XY]
According to [XY], more coffee is always better.
According to XY[XY], more coffee is always better.
According to XY [XY], more coffee is always better.
According to XY, [XY] more coffee is always better.
According to XY,[XY] more coffee is always better.
According to XY, more coffee is always better [XY].
According to XY, more coffee is always better. [XY]




In the IEEE editor's style manual it says on page 34:


  References in Text: References need not be cited in the text. When they are, they appear on the line, in square
  brackets, inside the punctuation. Grammatically, they may be treated as if they were footnote numbers ...


I would interpret "inside the punctuation" as ruling out options 1, 4, and 11, even though the grammatical treatment of footnotes is not quite clear to me.

The Springer guide does not appear to comment on the question.

Any other hints / links / viable styles?
As others have mentioned, all sentences should be grammatically correct. The citation marker of the form [X] may play the role of a noun, or of silent word.

1, 4 and 11 are never correct - they put the citation into the next sentence, where it doesn't belong. Similarly, 8 and 9 put it into the wrong phrase of the sentence. 

3, 6 and 9 combine words incorrectly. Spaces can't just be ignored.

That leaves 2, 5, 7 and 10. These are all used, except that the exact form of 7 will depend on the referencing style in use. You could have 'According to Smith [3]', but not 'According to Smith [Smith, 2017]', The latter would become 'According to Smith [2017]'. Also, for 10 you need to think about how long the second phrase is.