xref: /freebsd/contrib/file/magic/Magdir/tex (revision 7af41682a96bf7058b82665c33bb9b1bfa079c17)
1
2#------------------------------------------------------------------------------
3# $File: tex,v 1.25 2026/06/02 18:16:34 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\ pdfTeX,	pdfTeX transcript text
240	search/1	This\ is\ XeTeX,	XeTeX transcript text
250	search/1	This\ is\ LuaTeX,	LuaTeX transcript text
260	search/1	This\ is\ LuaHBTeX,	LuaTeX transcript text
270	search/1	This\ is\ LuajitTeX,	LuaTeX transcript text
280	search/1	This\ is\ LuajitHBTeX,	LuaTeX transcript text
290	search/1	This\ is\ pTeX,	pTeX transcript text
300	search/1	This\ is\ e-pTeX,	e-pTeX transcript text
310	search/1	This\ is\ upTeX,	upTeX transcript text
320	search/1	This\ is\ e-upTeX,	e-upTeX transcript text
330	search/1	This\ is\ HiTeX,	HiTeX transcript text
340	search/1	This\ is\ METAFONT,	METAFONT transcript text
35
36# There is no way to detect TeX Font Metric (*.tfm) files without
37# breaking them apart and reading the data.  The following patterns
38# match most *.tfm files generated by METAFONT or afm2tfm.
392	string		\000\021	TeX font metric data
40!:mime	application/x-tex-tfm
41>33	string		>\0		(%s)
422	string		\000\022	TeX font metric data
43!:mime	application/x-tex-tfm
44>33	string		>\0		(%s)
45
46# Texinfo and GNU Info, from Daniel Quinlan (quinlan@yggdrasil.com)
470	search/b/1	\\input\ texinfo	Texinfo source text
48!:mime	text/x-texinfo
490	search/b/1	This\ is\ Info\ file	GNU Info text
50!:mime	text/x-info
510	search/b/10	INFO-DIR-SECTION	GNU Info text
52!:mime	text/x-info
530	search/b/10	START-INFO-DIR-ENTRY	GNU Info text
54!:mime	text/x-info
55
560	string		%!TEX\040root	TeX Document text
57!:mime	text/x-tex
58!:strength + 15
59
60# TeX documents, from Daniel Quinlan (quinlan@yggdrasil.com)
610	search/4096	\\input		TeX document text
62!:mime	text/x-tex
63!:strength + 15
640	search/4096	\\begin		LaTeX document text
65!:mime	text/x-tex
66!:strength + 15
670	search/4096	\\section	LaTeX document text
68!:mime	text/x-tex
69!:strength + 18
700	search/4096	\\setlength	LaTeX document text
71!:mime	text/x-tex
72!:strength + 15
730	search/4096	\\documentstyle	LaTeX document text
74!:mime	text/x-tex
75!:strength + 18
760	search/4096	\\chapter	LaTeX document text
77!:mime	text/x-tex
78!:strength + 18
790	search/4096	\\documentclass	LaTeX 2e document text
80!:mime	text/x-tex
81!:strength + 15
820	search/4096	\\relax		LaTeX auxiliary file
83!:mime	text/x-tex
84!:strength + 15
850	search/4096	\\contentsline	LaTeX table of contents
86!:mime	text/x-tex
87!:strength + 15
880	search/4096	%\ -*-latex-*-	LaTeX document text
89!:mime	text/x-tex
90
91# Tex document, from Hendrik Scholz <hendrik@scholz.net>
920   	search/1	\\ifx		TeX document text
93
94# Index and glossary files
950	search/4096	\\indexentry	LaTeX raw index file
960	search/4096	\\begin{theindex}	LaTeX sorted index
970	search/4096	\\glossaryentry	LaTeX raw glossary
980	search/4096	\\begin{theglossary}	LaTeX sorted glossary
990	search/4096	This\ is\ makeindex	Makeindex log file
100
101# End of TeX
102
103#------------------------------------------------------------------------------
104# file(1) magic for BibTex text files
105# From Hendrik Scholz <hendrik@scholz.net>
106
1070	search/1/c	@article{	BibTeX text file
1080	search/1/c	@book{		BibTeX text file
1090	search/1/c	@inbook{	BibTeX text file
1100	search/1/c	@incollection{	BibTeX text file
1110	search/1/c	@inproceedings{	BibTeX text file
1120	search/1/c	@manual{	BibTeX text file
1130	search/1/c	@misc{		BibTeX text file
1140	search/1/c	@preamble{	BibTeX text file
1150	search/1/c	@phdthesis{	BibTeX text file
1160	search/1/c	@techreport{	BibTeX text file
1170	search/1/c	@unpublished{	BibTeX text file
118
11973	search/1	%%%\ \ 		BibTeX-file{ BibTex text file (with full header)
120
12173	search/1	%%%\ \ @BibTeX-style-file{   BibTeX style text file (with full header)
122
1230	search/1	%\ BibTeX\ standard\ bibliography\ 	BibTeX standard bibliography style text file
124
1250	search/1	%\ BibTeX\ `	BibTeX custom bibliography style text file
126
1270	search/1	@c\ @mapfile{	TeX font aliases text file
128
1290	string		#LyX		LyX document text
130
131# ConTeXt documents
132#	https://wiki.contextgarden.net/
1330	search/4096	\\setupcolors[		ConTeXt document text
134!:strength + 15
1350	search/4096	\\definecolor[		ConTeXt document text
136!:strength + 15
1370	search/4096	\\setupinteraction[	ConTeXt document text
138!:strength + 15
1390	search/4096	\\useURL[		ConTeXt document text
140!:strength + 15
1410	search/4096	\\setuppapersize[	ConTeXt document text
142!:strength + 15
1430	search/4096	\\setuplayout[		ConTeXt document text
144!:strength + 15
1450	search/4096	\\setupfooter[		ConTeXt document text
146!:strength + 15
1470	search/4096	\\setupfootertexts[	ConTeXt document text
148!:strength + 15
1490	search/4096	\\setuppagenumbering[	ConTeXt document text
150!:strength + 15
1510	search/4096	\\setupbodyfont[	ConTeXt document text
152!:strength + 15
1530	search/4096	\\setuphead[		ConTeXt document text
154!:strength + 15
1550	search/4096	\\setupitemize[		ConTeXt document text
156!:strength + 15
1570	search/4096	\\setupwhitespace[	ConTeXt document text
158!:strength + 15
1590	search/4096	\\setupindenting[	ConTeXt document text
160!:strength + 15
161