What is MIME type "text/x-stex"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

The MIME type text/x-stex signals that a file contains source code formatted for TeX documents. It guides text editors, compilers, and web servers to treat these files as plain text with TeX-specific markup.
Examples include files like TEX, LBX, TOC, STY, BIB, CLS, AUX, CBX, BBX, DTX, LTX, BIBTEX, INS, MKII, MKIV, and MKVI.

This MIME type is common in environments that handle complex manuscript projects. It ensures that files with TeX and BibTeX content are treated correctly during editing and processing.
More details can be found at TeX on Wikipedia.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: text/x-stex    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="text/x-stex">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'text/x-stex');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

What is the purpose of the text/x-stex MIME type?

The text/x-stex MIME type identifies source code for TeX and LaTeX documents, such as those ending in .tex or .bib. It tells web servers and clients that the file contains plain text with TeX-specific markup commands, rather than a compiled binary or generic text.

Will web browsers render text/x-stex files as formatted documents?

No, browsers typically display the raw source code or prompt a file download when encountering this type. To view the formatted document with mathematical formulas, the source must usually be compiled into a PDF (application/pdf) or rendered using JavaScript libraries like MathJax.

How do I configure Apache to serve TeX files as text/x-stex?

You can associate the MIME type with specific extensions by modifying your .htaccess file or server config. Add the line AddType text/x-stex .tex .ltx .sty .cls to ensure these files are served with the correct header.

Is text/x-stex the standard MIME type for TeX files?

No, it is a non-standard experimental type (indicated by the x- prefix). While text/x-stex is common in some Linux environments and KDE applications, other servers may use application/x-tex, application/x-latex, or simply text/plain.

How do I open a file downloaded as text/x-stex?

Since these are plain text files, you can view them in any basic text editor like Notepad or VS Code. for the best experience, use a dedicated TeX editor like TeXShop or TeXworks, which provides syntax highlighting for extensions like .sty and .cls.

Why are my .bib files identified as text/x-stex?

The .bib extension represents BibTeX bibliography databases, which are integral to the TeX typesetting system. Grouping them under text/x-stex helps systems recognize them as part of a TeX project rather than generic text files.

Can I use text/plain instead of text/x-stex?

Yes, using text/plain is a safe fallback that ensures the file is viewable in a browser without downloading. However, using text/x-stex is more semantic and allows specialized client-side applications to automatically launch the correct TeX editing tools.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.