patch 9.1.0289: filetype: some TeX files are not recognized

Problem:  filetype: some TeX files are not recognized
Solution: Add more patterns for TeX files and inspect
          a few more files for being TeX files
          (Wu, Zhenyu)

closes: #14456

Signed-off-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 1462830..05f1611 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -10,7 +10,9 @@
 # faster.
 
 export def Check_inp()
-  if getline(1) =~ '^\*'
+  if getline(1) =~ '%%'
+    setf tex
+  elseif getline(1) =~ '^\*'
     setf abaqus
   else
     var n = 1
@@ -280,6 +282,10 @@
 enddef
 
 export def FTdef()
+  # LaTeX def files are usually generated by docstrip, which will output '%%' in first line
+  if getline(1) =~ '%%'
+    setf tex
+  endif
   if get(g:, "filetype_def", "") == "modula2" || IsModula2()
     SetFiletypeModula2()
     return