Backport of #8989 and #9137 squashed.

Make Latex completion work in strings.
@tkelman merge this when you find it the timing is right.