← Back to Library
Wikipedia Deep Dive

LaTeX

Based on Wikipedia: LaTeX

In 1984, a computer scientist at Stanford Research Institute accidentally created one of the most important pieces of software in academia. Leslie Lamport was just trying to write some macros for his own documents. With a little extra effort, he thought, he could make something others might use too. He had no idea he was laying the foundation for how millions of scientists, mathematicians, and scholars would write for the next four decades.

The software was LaTeX—pronounced "lah-tech" or "lay-tech," rhyming with "blech" or with Bertolt Brecht's name. Never "lay-tecks," though language being what it is, some people say it anyway.

The Problem LaTeX Solved

To understand why LaTeX matters, you need to understand what came before it. In the late 1970s, a legendary computer scientist named Donald Knuth grew so frustrated with how his mathematics books were being typeset that he spent nearly a decade creating his own typesetting system called TeX. The name comes from the Greek word τέχνη (techne), meaning skill, art, or technique—the same root as "technology." Knuth insisted it should be pronounced with a guttural "ch" sound, like in the Scottish word "loch" or the German "Bach."

TeX was revolutionary. It could render mathematical equations with extraordinary beauty and precision. But it was also extraordinarily complex—a low-level system where authors had to specify every detail of formatting.

This is where Lamport came in. He built LaTeX as a layer on top of TeX, providing what programmers call "high-level abstractions." Instead of worrying about the exact spacing around a chapter heading, an author could simply write \chapter{Introduction} and let the system handle the details.

Separating Content from Presentation

LaTeX embodies a philosophy that has become central to modern computing: the separation of content from presentation. When you write a LaTeX document, you don't tell the system "make this text 14-point bold and put 12 points of space below it." Instead, you say "this is a section heading" and let a style definition somewhere else determine what section headings look like.

This might sound familiar if you've used Cascading Style Sheets on the web. CSS works on exactly the same principle—you mark up your content semantically (this is a heading, this is a quote, this is emphasized text) and define the visual appearance separately. LaTeX was doing this in the 1980s, more than a decade before CSS existed.

The benefits are profound. Change a single line in your style definition, and every section heading in a 500-page document updates automatically. Submit the same document to different academic journals, each with their own formatting requirements, simply by swapping out the style file. Focus entirely on what you're saying without constantly being distracted by how it looks.

How It Actually Works

Working with LaTeX feels more like programming than word processing. You create a plain text file—something like thesis.tex—and fill it with a mixture of your actual content and special commands that describe the document's structure.

A simple document might begin with \documentclass{article}, then \begin{document}, followed by your title, author, and sections marked with commands like \section{Introduction}. You don't see the final result while you're typing. Instead, you write your document, then "compile" it—just like compiling a computer program—and the system produces a beautifully formatted output file, typically a PDF.

This write-compile-preview cycle is fundamentally different from What-You-See-Is-What-You-Get word processors like Microsoft Word or Google Docs. In those programs, you see something very close to the final result as you type. In LaTeX, you're working with the source code of your document.

Modern LaTeX editors have softened this distinction considerably. Many now show a live preview beside your source code, updating in real time as you type. Some online editors blur the line even further, letting you click on elements in the preview to edit them directly. But the underlying philosophy remains: content and formatting are logically separate, even when they're displayed side by side.

Mathematics: Where LaTeX Shines

LaTeX has become so dominant in mathematics and physics that it's hard to find a scientific paper in these fields that wasn't written with it. The reason is simple: nothing else comes close for typesetting complex equations.

Consider trying to write a paper on quantum mechanics in Microsoft Word. You'd spend more time wrestling with the equation editor than thinking about physics. In LaTeX, you simply type a line of code, and out comes Schrödinger's equation, rendered with the same elegance you'd see in a professional physics textbook.

The mathematical notation is so clean and expressive that it has leaked beyond LaTeX itself. When mathematicians communicate online—in forums, chat rooms, or even emails—they often write LaTeX notation directly, trusting that their correspondents will understand the symbols even without seeing them rendered.

Tools like MathJax and KaTeX have made it possible to display LaTeX mathematics directly in web browsers. Wikipedia uses this technology to render all its mathematical formulas. Khan Academy built KaTeX specifically because they needed something fast enough to render equations in real time as students typed.

The Ecosystem

One of LaTeX's greatest strengths is its extensibility. The base system handles common document types well, but thousands of add-on packages extend its capabilities into specialized domains.

Writing chemistry? The Chemfig package lets you draw molecular structures. Creating presentation slides? Beamer gives you PowerPoint-like capabilities with LaTeX's typographic quality. Need to include intricate diagrams? TikZ provides a complete graphics programming language. Writing in Arabic, Chinese, or Devanagari? There are packages for that too.

This extensibility comes from LaTeX's foundation as a macro language. At its core, everything in LaTeX—every command, every environment—is ultimately defined in terms of simpler commands. Users can define their own macros, building up higher and higher levels of abstraction. A physicist writing many papers might define a shortcut command for frequently used equations.

The Output Pipeline

When you compile a LaTeX document, several things can happen behind the scenes. The traditional output format was something called DVI (Device Independent), which would then be converted to PostScript for printing. But since around 2000, most LaTeX users have worked with a variant called pdfLaTeX, which outputs directly to PDF.

More recent developments have addressed some of LaTeX's historical limitations. The original TeX system was designed in an era before Unicode—the universal standard for representing text in any language. This made working with non-Latin scripts awkward at best. XeLaTeX and LuaLaTeX are modern extensions that fully support Unicode and can use any font installed on your computer, not just the traditional TeX fonts.

LuaLaTeX goes even further, embedding a complete scripting language called Lua inside the typesetting engine. This lets sophisticated users program complex behaviors that would be impossible with LaTeX's macro system alone.

Beyond PDF: Converting to Other Formats

Not everyone wants a PDF. Sometimes you need HTML for a website, ePub for an e-reader, or Word format for a collaborator who refuses to learn LaTeX. A small industry of conversion tools has grown up to address this need.

Pandoc has become particularly influential here. Describing itself as a "universal document converter," Pandoc can transform LaTeX documents into dozens of formats: HTML, ePub, Word documents, OpenDocument files, even MediaWiki markup for Wikipedia editing. It's become an essential tool for academics who write in LaTeX but need to submit to publishers requiring other formats.

Other tools focus on specific output formats. LaTeXML, developed at the National Institute of Standards and Technology, specializes in converting LaTeX to XML-based formats and produces particularly high-quality HTML5 with proper mathematical markup. HeVeA (a pun on "heavy" and the French word for "Hevea," the rubber tree) takes a different approach, written in a language called OCaml and targeting HTML5 specifically.

The License and Community

LaTeX is free software—you can download and use it without paying anyone. But its license, called the LaTeX Project Public License (LPPL), has an interesting quirk that has caused some controversy in the free software community.

The license requires that if you modify a LaTeX file and distribute your modifications, you must give your version a different filename. You can't just edit, say, article.cls and distribute your modified version under the same name.

This might seem like an odd restriction, but it exists to prevent a particular kind of chaos. In LaTeX, documents depend on style files, which depend on packages, which depend on other packages. If people could silently modify shared files, a document that worked perfectly on one computer might produce garbage on another, with no obvious indication of what went wrong. The filename requirement ensures that incompatible versions can't masquerade as each other.

This restriction makes the LPPL incompatible with the GNU General Public License (GPL), the most famous free software license. Some free software purists object to this. The practical impact, however, is minimal—LaTeX remains freely available on every major operating system.

The Long Road to LaTeX3

The LaTeX we use today is technically called LaTeX2e, released in 1994. It replaced an earlier version called LaTeX 2.09. Even as LaTeX2e was being released, a team was already working on a more ambitious successor called LaTeX3.

That project has had one of the longest development timelines in software history. Started in 1989, LaTeX3 was originally planned as a completely separate system with a cleaner syntax, better hyperlink support, a new user interface, and modern font handling. Decades passed. LaTeX2e kept getting incremental updates while LaTeX3 remained perpetually "in development."

Eventually, the LaTeX team changed their approach. Rather than releasing LaTeX3 as a separate system, they began integrating its features into LaTeX2e. Since 2018, many LaTeX3 capabilities have become available as a programming layer within the existing system. The dream of a clean break never materialized, but the incremental improvements continue.

Alternatives and Competitors

LaTeX isn't the only option for sophisticated document preparation. Several alternatives offer different tradeoffs.

LyX provides a visual interface on top of LaTeX. You see something closer to What-You-See-Is-What-You-Get editing, but behind the scenes, LyX generates LaTeX code. This gives you LaTeX's typographic quality with a more familiar editing experience, though purists sometimes sniff at the loss of direct control.

TeXmacs (unrelated to LaTeX despite the similar name) takes a different approach entirely. It's a WYSIWYG editor with its own typesetting engine, offering similar capabilities to LaTeX but with a completely different underlying technology. Some users find it more intuitive; others miss the LaTeX ecosystem.

Commercial implementations of TeX also exist, offering extras like additional typefaces and technical support. For most users, though, the free distributions—MiKTeX on Windows, MacTeX on macOS, TeX Live on Linux—are more than sufficient.

Where LaTeX Lives Today

Walk into any mathematics or physics department at any university in the world, and you'll find LaTeX. It's how students write their theses, how professors write their papers, how journals publish their articles. In these fields, knowing LaTeX is as fundamental as knowing how to use email.

But LaTeX has spread far beyond its mathematical origins. Linguists appreciate its ability to handle complex multilingual documents—mixing Arabic with Greek with Chinese in ways that would crash a typical word processor. Philosophers use it. Some law journals require it. Computer scientists adopted it early and never left.

The system's longevity is remarkable. Software from the 1980s rarely survives in active use, yet LaTeX documents written decades ago still compile perfectly today. A physicist can take a paper written in 1990 and produce a beautiful PDF in 2024. Try opening a 1990 Word document in modern Microsoft Office and see what happens.

An Accidental Revolution

Remember Leslie Lamport, tinkering with macros at Stanford Research Institute? When an editor at Addison-Wesley convinced him to write a user manual, Lamport was skeptical that anyone would pay money for it.

That manual sold hundreds of thousands of copies. The software it described went on to shape how an entire civilization communicates its most complex ideas.

In 1989, at a meeting at Stanford, Lamport handed maintenance of LaTeX over to Frank Mittelbach and his collaborators. The torch passed to a new generation of stewards, who have maintained and developed it ever since. Mittelbach, Chris Rowley, and Rainer Schöpf became the LaTeX3 team, inheriting responsibility for software that millions depend on but few outside academia have heard of.

LaTeX remains what it has always been: a tool for people who care deeply about how their documents look and who are willing to invest some effort to get there. It rewards that investment with output of extraordinary quality—documents that look like they were prepared by professional typesetters, because in a sense they were. The typesetter just happens to be a piece of software written by a computer scientist who thought his colleagues might find it useful.

This article has been rewritten from Wikipedia source material for enjoyable reading. Content may have been condensed, restructured, or simplified.