1
2#------------------------------------------------------------------------------
3# $File: tex,v 1.22 2022/12/21 16:50:04 christos Exp $
4# tex:  file(1) magic for TeX files
5#
6# XXX - needs byte-endian stuff (big-endian and little-endian DVI?)
7#
8# From <conklin@talisman.kaleida.com>
9
10# Although we may know the offset of certain text fields in TeX DVI
11# and font files, we can't use them reliably because they are not
12# zero terminated. [but we do anyway, christos]
130         string              \367\002
14>(14.b+15)          string    \213
15>>14      pstring             >\0                 TeX DVI file (%s)
16!:mime    application/x-dvi
170         string              \367\203  TeX generic font data
180         string              \367\131  TeX packed font data
19>3        string              >\0                 (%s)
200         string              \367\312
21>(2.b+11) string    \363      TeX virtual font data
220         search/1  This\ is\ TeX,      TeX transcript text
230         search/1  This\ is\ METAFONT, METAFONT transcript text
24
25# There is no way to detect TeX Font Metric (*.tfm) files without
26# breaking them apart and reading the data.  The following patterns
27# match most *.tfm files generated by METAFONT or afm2tfm.
282         string              \000\021  TeX font metric data
29!:mime    application/x-tex-tfm
30>33       string              >\0                 (%s)
312         string              \000\022  TeX font metric data
32!:mime    application/x-tex-tfm
33>33       string              >\0                 (%s)
34
35# Texinfo and GNU Info, from Daniel Quinlan (quinlan@yggdrasil.com)
360         search/1  \\input\ texinfo    Texinfo source text
37!:mime    text/x-texinfo
380         search/1  This\ is\ Info\ file          GNU Info text
39!:mime    text/x-info
40
41# TeX documents, from Daniel Quinlan (quinlan@yggdrasil.com)
420         search/4096         \\input             TeX document text
43!:mime    text/x-tex
44!:strength + 15
450         search/4096         \\begin             LaTeX document text
46!:mime    text/x-tex
47!:strength + 15
480         search/4096         \\section LaTeX document text
49!:mime    text/x-tex
50!:strength + 18
510         search/4096         \\setlength         LaTeX document text
52!:mime    text/x-tex
53!:strength + 15
540         search/4096         \\documentstyle     LaTeX document text
55!:mime    text/x-tex
56!:strength + 18
570         search/4096         \\chapter LaTeX document text
58!:mime    text/x-tex
59!:strength + 18
600         search/4096         \\documentclass     LaTeX 2e document text
61!:mime    text/x-tex
62!:strength + 15
630         search/4096         \\relax             LaTeX auxiliary file
64!:mime    text/x-tex
65!:strength + 15
660         search/4096         \\contentsline      LaTeX table of contents
67!:mime    text/x-tex
68!:strength + 15
690         search/4096         %\ -*-latex-*-      LaTeX document text
70!:mime    text/x-tex
71
72# Tex document, from Hendrik Scholz <hendrik@scholz.net>
730         search/1  \\ifx               TeX document text
74
75# Index and glossary files
760         search/4096         \\indexentry        LaTeX raw index file
770         search/4096         \\begin{theindex}   LaTeX sorted index
780         search/4096         \\glossaryentry     LaTeX raw glossary
790         search/4096         \\begin{theglossary}          LaTeX sorted glossary
800         search/4096         This\ is\ makeindex Makeindex log file
81
82# End of TeX
83
84#------------------------------------------------------------------------------
85# file(1) magic for BibTex text files
86# From Hendrik Scholz <hendrik@scholz.net>
87
880         search/1/c          @article{ BibTeX text file
890         search/1/c          @book{              BibTeX text file
900         search/1/c          @inbook{  BibTeX text file
910         search/1/c          @incollection{      BibTeX text file
920         search/1/c          @inproceedings{     BibTeX text file
930         search/1/c          @manual{  BibTeX text file
940         search/1/c          @misc{              BibTeX text file
950         search/1/c          @preamble{          BibTeX text file
960         search/1/c          @phdthesis{         BibTeX text file
970         search/1/c          @techreport{        BibTeX text file
980         search/1/c          @unpublished{       BibTeX text file
99
10073        search/1  %%%\ \              BibTeX-file{ BibTex text file (with full header)
101
10273        search/1  %%%\ \ @BibTeX-style-file{   BibTeX style text file (with full header)
103
1040         search/1  %\ BibTeX\ standard\ bibliography\      BibTeX standard bibliography style text file
105
1060         search/1  %\ BibTeX\ `        BibTeX custom bibliography style text file
107
1080         search/1  @c\ @mapfile{       TeX font aliases text file
109
1100         string              #LyX                LyX document text
111
112# ConTeXt documents
113#         https://wiki.contextgarden.net/
1140         search/4096         \\setupcolors[                ConTeXt document text
115!:strength + 15
1160         search/4096         \\definecolor[                ConTeXt document text
117!:strength + 15
1180         search/4096         \\setupinteraction[ ConTeXt document text
119!:strength + 15
1200         search/4096         \\useURL[           ConTeXt document text
121!:strength + 15
1220         search/4096         \\setuppapersize[   ConTeXt document text
123!:strength + 15
1240         search/4096         \\setuplayout[                ConTeXt document text
125!:strength + 15
1260         search/4096         \\setupfooter[                ConTeXt document text
127!:strength + 15
1280         search/4096         \\setupfootertexts[ ConTeXt document text
129!:strength + 15
1300         search/4096         \\setuppagenumbering[         ConTeXt document text
131!:strength + 15
1320         search/4096         \\setupbodyfont[    ConTeXt document text
133!:strength + 15
1340         search/4096         \\setuphead[                  ConTeXt document text
135!:strength + 15
1360         search/4096         \\setupitemize[               ConTeXt document text
137!:strength + 15
1380         search/4096         \\setupwhitespace[  ConTeXt document text
139!:strength + 15
1400         search/4096         \\setupindenting[   ConTeXt document text
141!:strength + 15
142