TeX Books

Learn TeX Programming with Free Books

TeX Books

TeX is a system for typesetting documents. It’s a powerful low-level markup and programming language that creates professional quality typeset text. The system was developed by Donald Knuth at Stanford University with the purpose of enabling anyone to generate high-quality books, and to develop a system that yields the same results whatever computer is used.

TeX has many strengths including its portability, flexibility, and the fact that it is free software. But being free would mean little if TeX was not highly proficient at typesetting professional looking mathematical and scientific text, complex documents, and handling multiple languages. TeX produces results equal in quality and appearance to those produced by the finest traditional typesetting systems.

TeX remains popular in academia, especially in mathematics, computer science, economics, engineering, physics, statistics, and quantitative psychology. At the time that TeX was released, it offered some innovative features.

Implementations of TeX exist for a wide variety of operating systems.

We publish a series covering the best open source programming books for other popular languages. Read them here.

TeX by Topic

TeX by Topic

By Victor Eijkhout (307 pages)

TeX by Topic – a TeXnician’s Reference is a manual designed to help the reader master the TeX typesetting language. It’s a companion to tutorial guides on the system. The book provides original, practical ideas, and is an invaluable information source that will give the TeX user the essential insight needed to solve TeX problems, write LaTeX macros, and other customizations of TeX.

It includes a thorough cross reference system.

This book provides a wealth of information on:

  • The Structure of the TeX Processor – a global picture of the way TeX operates
  • Category Codes and Internal States – describes how TeX reads its input and how the category codes of characters influence the reading behaviour
  • Characters – treats character codes, and the commands that have access to them
  • Fonts – describes how fonts are identified to TeX, and what attributes a font can have
  • Boxes – treats box registers, aspects of boxes, and the way their components are placed relative to each other
  • Horizontal and Vertical Mode – looks at the horizontal and vertical modes, the kinds of objects that can occur in the corresponding lists, and the commands that are exclusive for one mode or the other
  • Numbers – covers integers and their denotations, conversions, allocation and use of \count registers, and arithmetic with integers
  • Dimensions and Glue – treats all technical concepts related to dimensions and glue, and explains how the badness of stretching or shrinking a certain amount is calculated
  • Rules and Leaders – explains how rules and leaders work, and how they interact with modes
  • Grouping – what sort of actions can be local, and how groups are formed
  • Macros – explains how TeX macros work
  • Expansion – explains the commands connected with expansion with examples
  • Conditionals – an inventory of the large repertoire of conditionals
  • Token Lists – the only type of data structure in TeX
  • Baseline Distances – treats the computation of interline glue
  • Paragraph Start – explains the sequence of actions and how TeX’s decisions can be altered
  • Paragraph End – explains the mechanism, and the role of \par
  • Paragraph Shape – discusses the parameters and commands that influence the shape of a paragraph
  • Line Breaking – treats line breaking and the concept of ‘badness’ that TeX uses to decide how to break a paragraph into lines, or where to break a page
  • Spacing – explains the rules by which TeX calculates interword space
  • Characters in Math Mode – explains the concept of math codes, and shows how TeX implements variable size delimiters
  • Fonts in Formulas – discusses how font families are organised, and how TeX determines from what families characters should be chosen
  • Mathematics Typesetting – looks at TeX’s two math modes and four styles
  • Display Math – explains how surrounding white space is calculated
  • Alignment – looks at the general alignment mechanism for making tables
  • Page Shape – treats some of the parameters that determine the size of the page and how it appears on paper
  • Page Breaking – examines the ‘page builder’
  • Output Routines – performs the final stages of page processing
  • Insertions – TeX’s way of handling floating information
  • File Input and Output – discusses the ways in which TeX can read from and write to external files
  • Allocation – treats the synonym and allocation commands, and discusses guidelines for macro writers regarding allocation
  • Running TeX – treats the run modes of TeX and other commands associated with the job being processed
  • TeX and the Outside World – dvi files, formats, IniTeX, font and format families, Computer Modern typefaces, and web
  • Errors, Catastrophes and Help
  • The Grammar of TeX
  • Glossary of TeX Primitives
  • Tables

TeX by Topic has been released by the author under the GNU Free Documentation License, Version 1.2 or any later version.

TeX for the Impatient

TeX for the Impatient

By Paul W. Abrahams with Karl Berry, Kathryn A. Hargreaves (393 pages)

TeX for the Impatient is a handbook that arose from the need to help technical writers learn TeX more quickly and once having learned it, to find fast answers to common questions. The book contains tutorial and reference information on all features of both plain and primitive TeX.

Clear, concise, and accessible, this book is organized for easy retrieval of information, thoroughly indexed, and carefully designed for learning by example. The book is targeted at scientists, mathematicians, and technical typists.

The book covers the following topics:

  • Using TeX – shows how to prepare an input file, and how TeX works
  • Examples – entering simple text, indentation, fonts and special characters, interline spacing, and more
  • Concepts
  • Commands for composing paragraphs – including characters and accents, selecting fonts, uppercase and lowercase, interword spacing, centering and justifying lines and more
  • Commands for composing pages – such as page breaks, page layout, insertions, and more
  • Commands for horizontal and vertical modes – producing space, manipulating boxes, retrieving the last item from a list, rules and leaders, and alignments
  • Commands for composing math formulas – simple parts of formulas, superscripts and subscripts, compound symbols, equation numbers, constructing math symbols, producing spaces and more
  • Commands for composing general operations – converting information to tokens, macros, registers, input and output, and more
  • Tips and techniques – such as correcting bad page breaks and line breaks, avoiding excess space around a display and after a paragraph, drawing lines and more
  • Making sense of error messages
  • A compendium of useful macros
  • Capsule summary of commands

This book is released under the GNU Free Documentation License, Version 1.3 or any later version.

Making TeX Work

Making TeX Work

By Norman Walsh (522 pages)

Making TeX Work provides comprehensive coverage of how to build, run, and use TeX to best advantage on your platform.

This book teaches the reader:

  • How to assemble the software you need to build and install TeX on all common platforms: UNIX, DOS, Macintosh, and VMS
  • How to get TeX and its associated tools from public domain and commercial sources (a complete buyer’s guide)
  • How to select and use the tools that let you incorporate graphics into your documents and create bibliographies, indices, and other complex document elements
  • How to install and use fonts to best advantage, including PostScript and TrueType fonts and LaTeX’s New Font Selection Scheme (NFSS)

Making TeX Work has been out of print for years. The publisher has released the book under the GNU Free Documentation License.

A Gentle Introduction to TeX

A Gentle Introduction to TeX

By Michael Doob (97 pages)

A Gentle Introduction to TeX is billed as a manual for self-study. The purpose of this manual is to start from the very beginning and to move towards these more complicated situations. No previous knowledge of TeX is assumed by the author. By proceeding a section at a time, greater varieties of text can be produced.

The contents of the book:

  • Getting Started
  • Characters requiring special input such as { } % &, accents, typesetting letters from languages other than English, quotes, different fonts
  • Make text have different shapes or sizes – examines units, page shape, paragraph shape, line shape, footnotes, headlines and footlines, overfull and underfull boxes
  • Groups
  • Provides the basic for creating beautiful typeset mathematics – symbols, fractions, subscripts and superscripts, roots, lines, delimiters and more
  • Aligning text – tabbing environment, horizontal alignment environment
  • Create new control words
  • Debugging – looks at some typical errors and the messages generated
  • Topics that allow TeX to be used with more flexibility or efficiency
  • List of the control words used in this book

The book is published under a free license.

Getting Started with Plain TeX

Getting Started with Plain TeX

By D. R. Wilkins (40 pages)

This is an introductory text to the world of TeX.

Chapters explore:

  • Introduction to Plain TeX
  • Producing Simple Documents using Plain TeX
  • Mathematical Formulae using Plain TeX
  • Further Features of Plain TeX

No license is specified.

The Computer Science of TeX and LaTeX

The Computer Science of TeX and LaTeX

By Victor Eijkhout (234 pages)

The Computer Science of TeX and LaTeX uses the TeX and LaTeX system to provide an introduction to a number of computer science topics. This book is based on the lecture notes of a course taught at the University of Tennessee in the fall of 2004. This is a `topics’ course in computer science, using TeX and LaTeX as motivation and examples.

The contents of the book covers:

  • The use of LaTeX for document preparation, LaTeX style file programming, and TeX programming.
  • Learn the basic of language theory and parsing, and apply this to parsing TeX and LaTeX
  • Looks at dynamic programming, TeX paragraph breaking, TeX’s line breaking algorithm, nondetermininistic polynomial time (NP) completeness, basics, complexity classes, NP-completeness, page breaking, TeX’s page breaking algorithm, theory of page breaking
  • Fonts, explores Bezier curves, Parametric curves, piecewise curves, curve plotting with gnuplot, raster graphics, rasterizing type, anti-aliasing
  • TeX’s macro language – this is an unfinished chapter
  • Character encoding including ISO 10646, Unicode, UTF-8, font encoding, aesthetics, the fontenc package, and more
  • Software engineering
  • Literate programming

The book is released under a Creative Commons Attribution 3.0 Unported (CC BY 3.0) license.

The TeXbook is a definitive guide to TeX. While you can view the complete source of Knuth’s TeX book, it should not be pro­cessed without the author’s per­mis­sion.


Ada, Awk, Assembly, Bash, C, C++, C#, Clojure, CoffeeScript, ECMAScript, Erlang, Forth, Fortran, Go, Haskell, HTML, Java, JavaScript, LaTeX, Lisp, Logo, Lua, OCaml, Pascal, Perl, PHP, Prolog, Python, R, Ruby, Rust, Scala, Scheme, Scratch, SQL, Swift, TeX, VimL

Leave a Reply