LATEX (.latex)
.latex file signature | application/x-latex
LaTeX is a document preparation system and markup language originally developed by Leslie Lamport and now maintained as part of the LaTeX Project. It is used to create scientific articles, theses, books, presentations, and other technical documents, especially where complex formulas, citations, and cross-references are required. LaTeX source files are plain text and generally safe, though they may reference external packages or auxiliary files; the format is still widely used rather than obsolete.
Magic Bytes
Offset 0
25 20 2D 2A 2D 6C 61 74 65 78 2D 2A 2D
Sources: Apache Tika
Extension
.latex
MIME Type
application/x-latex
Byte Offset
0
Risk Level
Safe
Validation Code
How to validate .latex files in Python
def is_latex(file_path: str) -> bool:
"""Check if file is a valid LATEX by magic bytes."""
signature = bytes([0x25, 0x20, 0x2D, 0x2A, 0x2D, 0x6C, 0x61, 0x74, 0x65, 0x78, 0x2D, 0x2A, 0x2D])
with open(file_path, "rb") as f:
return f.read(13) == signature
How to validate .latex files in Node.js
function isLATEX(buffer: Buffer): boolean {
const signature = Buffer.from([0x25, 0x20, 0x2D, 0x2A, 0x2D, 0x6C, 0x61, 0x74, 0x65, 0x78, 0x2D, 0x2A, 0x2D]);
return buffer.subarray(0, 13).equals(signature);
}
How to validate .latex files in Go
func IsLATEX(data []byte) bool {
signature := []byte{0x25, 0x20, 0x2D, 0x2A, 0x2D, 0x6C, 0x61, 0x74, 0x65, 0x78, 0x2D, 0x2A, 0x2D}
if len(data) < 13 {
return false
}
return bytes.Equal(data[:13], signature)
}
API Endpoint
/api/v1/latex
curl https://filesignature.org/api/v1/latex
See the full API documentation for all endpoints and parameters.
Frequently Asked Questions
What is a .latex file?
A .latex file is identified by the magic bytes 25 20 2D 2A 2D 6C 61 74 65 78 2D 2A 2D at byte offset 0. LaTeX is a document preparation system and markup language originally developed by Leslie Lamport and now maintained as part of the LaTeX Project. It is used to create scientific articles, theses, books, presentations, and other technical documents, especially where complex formulas, citations, and cross-references are required. LaTeX source files are plain text and generally safe, though they may reference external packages or auxiliary files; the format is still widely used rather than obsolete.
What are the magic bytes for .latex files?
The magic bytes for LATEX files are 25 20 2D 2A 2D 6C 61 74 65 78 2D 2A 2D at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.
How do I validate a .latex file?
To validate a .latex file, read the first bytes of the file and compare them against the known magic bytes (25 20 2D 2A 2D 6C 61 74 65 78 2D 2A 2D) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .latex files?
The primary MIME type for .latex files is application/x-latex.
Is it safe to open .latex files?
LATEX (.latex) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.