Convert LaTeX to TEX
Max file size 100mb.
LaTeX vs TEX Format Comparison
| Aspect | LaTeX (Source Format) | TEX (Target Format) |
|---|---|---|
| Format Overview |
LaTeX
High-Level Document Preparation System
LaTeX is a document preparation macro package built on TeX by Leslie Lamport in 1984. It provides high-level commands for document structure (sections, figures, tables, bibliographies) while abstracting away TeX's low-level typesetting primitives. LaTeX is the dominant format for academic and scientific publishing. High-Level Macro Package |
TEX
Plain TeX / Raw TeX Primitives
Plain TeX refers to the minimal format created by Donald Knuth in 1978 that provides basic formatting macros on top of TeX's approximately 300 primitives. It offers the lowest level of control over typesetting, without the structured abstractions that LaTeX provides. It is the foundation upon which all TeX formats are built. Low-Level TeX Primitives |
| Technical Specifications |
Structure: Semantic markup with \begin/\end environments
Engine: pdfTeX, XeTeX, LuaTeX Format: LaTeX2e macro package Processing: latex/pdflatex/xelatex/lualatex Extensions: .tex, .latex, .ltx |
Structure: Primitive commands and basic macros
Engine: TeX, pdfTeX, XeTeX, LuaTeX Format: Plain TeX (plain.fmt) Processing: tex/pdftex Extensions: .tex |
| Syntax Examples |
LaTeX high-level commands: \documentclass{article}
\begin{document}
\section{Introduction}
This is a paragraph with
\textbf{bold} and \textit{italic}.
\begin{enumerate}
\item First item
\item Second item
\end{enumerate}
$$E = mc^2$$
\end{document}
|
Plain TeX low-level primitives: \nopagenumbers
\centerline{\bf Introduction}
\bigskip
This is a paragraph with
{\bf bold} and {\it italic\/}.
\item{1.} First item
\item{2.} Second item
$$E = mc^2$$
\bye
|
| Content Support |
|
|
| Advantages |
|
|
| Disadvantages |
|
|
| Common Uses |
|
|
| Best For |
|
|
| Version History |
LaTeX Introduced: 1984 (Leslie Lamport)
LaTeX 2.09: 1985-1994 LaTeX2e: 1994-present Status: Active development (LaTeX3 kernel) |
TeX Introduced: 1978 (Donald Knuth)
Current Version: TeX 3.141592653 (converging to pi) Plain TeX: Included with all TeX distributions Status: Frozen by design (Knuth's intent) |
| Software Support |
TeX Live: pdflatex, xelatex, lualatex
MiKTeX: Full LaTeX support Overleaf: Online LaTeX editor Editors: TeXstudio, TeXmaker, VS Code |
TeX Live: pdftex, tex, luatex
MiKTeX: Plain TeX support Editors: Any text editor Compilation: pdftex filename.tex |
Why Convert LaTeX to Plain TeX?
Converting LaTeX documents to plain TeX is a specialized task undertaken by TeX experts who need to eliminate LaTeX's abstraction layers for greater control over the typesetting process. Plain TeX provides direct access to TeX's approximately 300 primitives, enabling fine-grained manipulation of every aspect of page layout, line breaking, font selection, and spacing.
One common reason for this conversion is the development of custom TeX formats. Developers creating new document classes or typesetting systems (similar to how ConTeXt was built) may start with LaTeX documents and convert them to plain TeX to understand exactly which TeX primitives are required. This process reveals the underlying mechanics hidden behind LaTeX's convenient macros.
Performance optimization is another motivation. Plain TeX documents compile faster than LaTeX because the plain format file is much smaller than the LaTeX format file. For automated typesetting pipelines that process thousands of documents, the reduced overhead of plain TeX can result in significant time savings. The simpler macro structure also produces more predictable behavior.
Educational purposes also drive this conversion. Students learning TeX programming benefit from seeing how LaTeX commands expand into plain TeX primitives. Converting a familiar LaTeX document to its plain TeX equivalent demonstrates concepts like box manipulation, glue, penalties, and token processing that are fundamental to understanding how the TeX engine works at its core.
Key Benefits of Converting LaTeX to Plain TeX:
- Full Control: Direct access to every TeX primitive for precise typesetting
- Minimal Dependencies: No packages or class files required
- Faster Compilation: Smaller format file means quicker processing
- Transparency: No hidden macro expansions or unexpected behavior
- Format Development: Foundation for building custom typesetting systems
- Education: Learn TeX internals by examining primitive-level code
- Portability: Works with any TeX engine without additional dependencies
Practical Examples
Example 1: Basic Document Structure
Input LaTeX file (document.tex):
\documentclass[12pt]{article}
\title{My Document}
\author{Jane Doe}
\begin{document}
\maketitle
\section{Introduction}
This is the first paragraph of the
introduction to our document.
\section{Methods}
We used \textbf{standard techniques}
and \textit{novel approaches}.
\end{document}
Output plain TeX file (document.tex):
\font\titlefont=cmr17
\font\authorfont=cmr12
\font\sectionfont=cmbx12
\font\bodyfont=cmr12
\bodyfont
\centerline{\titlefont My Document}
\smallskip
\centerline{\authorfont Jane Doe}
\bigskip
\noindent{\sectionfont 1\quad Introduction}
\medskip
This is the first paragraph of the
introduction to our document.
\bigskip
\noindent{\sectionfont 2\quad Methods}
\medskip
We used {\bf standard techniques}
and {\it novel approaches\/}.
\bye
Example 2: Mathematical Content
Input LaTeX file (math.tex):
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\section{Theorem}
The Euler identity states:
\begin{equation}
e^{i\pi} + 1 = 0
\end{equation}
The integral of a Gaussian:
\begin{equation}
\int_{-\infty}^{\infty} e^{-x^2} dx
= \sqrt{\pi}
\end{equation}
\end{document}
Output plain TeX file (math.tex):
\noindent{\bf 1\quad Theorem}
\medskip
The Euler identity states:
$$e^{i\pi} + 1 = 0 \eqno(1)$$
The integral of a Gaussian:
$$\int_{-\infty}^{\infty} e^{-x^2}\, dx
= \sqrt{\pi} \eqno(2)$$
\bye
Example 3: Lists and Formatting
Input LaTeX file (list.tex):
\documentclass{article}
\begin{document}
\section{Requirements}
The system requires:
\begin{itemize}
\item 8 GB of RAM
\item 50 GB disk space
\item Linux or macOS
\end{itemize}
Installation steps:
\begin{enumerate}
\item Download the archive
\item Extract files
\item Run the installer
\end{enumerate}
\end{document}
Output plain TeX file (list.tex):
\noindent{\bf 1\quad Requirements}
\medskip
The system requires:
\smallskip
\item{$\bullet$} 8 GB of RAM
\item{$\bullet$} 50 GB disk space
\item{$\bullet$} Linux or macOS
\smallskip
Installation steps:
\smallskip
\item{1.} Download the archive
\item{2.} Extract files
\item{3.} Run the installer
\bye
Frequently Asked Questions (FAQ)
Q: What is the difference between LaTeX and plain TeX?
A: LaTeX is a macro package that provides high-level commands (\section, \begin{itemize}, \textbf) for document structure. Plain TeX is a minimal set of macros that Donald Knuth defined on top of TeX's raw primitives. LaTeX automates many tasks (numbering, cross-references, float placement) that must be done manually in plain TeX. Think of LaTeX as a framework and plain TeX as the assembly language of typesetting.
Q: Do both formats use .tex file extension?
A: Yes, both LaTeX and plain TeX files typically use the .tex extension. The difference is how they are compiled: LaTeX files are processed with `latex` or `pdflatex`, while plain TeX files are processed with `tex` or `pdftex`. The content of the file itself determines which format it uses -- LaTeX files begin with \documentclass, while plain TeX files end with \bye.
Q: Will mathematical equations be preserved?
A: Yes, TeX's mathematical typesetting is the same in both LaTeX and plain TeX. The $ and $$ delimiters, along with commands like \frac, \sqrt, \int, and superscripts/subscripts work identically. LaTeX-specific math environments like equation and align are converted to plain TeX equivalents using $$ with manual equation numbering via \eqno.
Q: Can I use LaTeX packages in plain TeX?
A: Generally no. LaTeX packages depend on LaTeX's macro infrastructure (\newcommand, environments, etc.) which does not exist in plain TeX. Some functionality can be replicated using plain TeX macros or by loading specific low-level packages designed for plain TeX (like eplain). This is one reason the conversion exists -- to remove package dependencies.
Q: Is plain TeX still relevant today?
A: Plain TeX remains relevant for TeX engine developers, custom format creators, and typesetting specialists who need absolute control. ConTeXt, another major TeX format, shares the philosophy of direct TeX programming. Donald Knuth himself still uses plain TeX. For most academic authors, LaTeX is more practical, but understanding plain TeX provides deeper insight into how typesetting works.
Q: How does compilation speed compare?
A: Plain TeX compiles noticeably faster than LaTeX because the format file is much smaller (plain.fmt is roughly 50 KB vs. LaTeX's 1+ MB format file). For single documents, the difference is marginal (milliseconds). For batch processing thousands of documents in automated pipelines, the cumulative time savings can be significant.
Q: What tools can help with LaTeX-to-plain-TeX conversion?
A: Pandoc can convert LaTeX to plain TeX output. The `de-macro` utility expands LaTeX macros to their definitions. For manual conversion, running `latex` with tracing enabled (\tracingmacros=1) shows how each LaTeX command expands. TeX's \show and \meaning commands can reveal the primitive definitions of any macro.
Q: Should I convert my LaTeX papers to plain TeX?
A: For most users, no. LaTeX's automation, packages, and journal templates make it far more practical for academic writing. Convert to plain TeX only if you have specific technical requirements: building a custom format, optimizing a typesetting pipeline, learning TeX internals, or needing minimal-dependency documents. For standard academic publishing, LaTeX remains the right choice.