How does Spotlight determine which category a file belongs to?
I think it depends on the parent UTIs defined in an application's Info.plist or in /System/Library/CoreServices/CoreTypes.bundle/Contents/Info.plist. .tex is not included in the CoreTypes Info.plist, so the UTI depends on which application's UTI declaration was registered first. For example on my installation the UTI was com.barebones.bbedit.tex-source and the first parent UTI was public.source-code:

$ touch a.tex; mdls -n kMDItemContentTypeTree a.tex
kMDItemContentTypeTree = (
    "com.barebones.bbedit.tex-source",
    "public.source-code",
    "public.plain-text",
    "public.text",
    "public.data",
    "public.item",
    "public.content"
)


When I deleted BBEdit and rebuilt the Launch Services database, the UTI became org.tug.tex and the first parent UTI became public.text:

$ touch b.tex; mdls -n kMDItemContentTypeTree b.tex
kMDItemContentTypeTree = (
    "org.tug.tex",
    "public.text",
    "public.data",
    "public.item",
    "public.content",
    "public.plain-text"
)