# In what ways can TeX be used beyond document production?

Most people use TeX and its many varieties to create printed documents, such as reports, books, flyer's, etc. Occasionally, I have found software that uses TeX markup for other purposes, for e.g., the flashcard software, Anki can use TeX to render on-screen flash cards.

• Beyond producing typical printed documents, what other applications does TeX have?
• Are there any other software programs which use TeX for other purposes?
-
Is "procrastination" a valid answer? –  lockstep Apr 24 '12 at 5:12
I once saw a movie where some machine was "programmed in LaTeX". One person said "show us the code of the machine" and then some LaTeX (or plain TeX?) code was visible. Too bad I don't remember the name of the movie / the machine they programmed with LaTeX :) –  topskip Apr 24 '12 at 7:14
@PatrickGundlach: \@gobble{\ALLHUMANS} ? –  Martin Scharrer Apr 24 '12 at 7:46
@PatrickGundlach: Stealth, one of the biggest flops in cinema history. The AI is supposedly programmed in TeX - maybe Omega? –  Martin Schröder Apr 24 '12 at 8:45
@MartinSchröder awesome, that was it!! Thanks –  topskip Apr 24 '12 at 9:03

I would say TikZ (and the other graphics languages too) is something that is used for more than just TeX and print.

Getting the output as a standalone file is not very complex and when that is in place you can start using all the great features from TikZ.

-

Back in the day, it used to be the #1 means to provide math formulas for PowerPoint presentations. I don't know what the math capabilities of PowerPoint are nowadays.

-
If you're curious, this video provides an introduction. As far as I am aware (as a Linux+OO.org user), the equation editor is the same throughout all of Office now. –  new123456 Apr 24 '12 at 21:35

Beyond printed media, TeX has taken to the web via MathJax. For an example of its usage, see Math.SE and EE.SE.

-
Mathjax is a javascript library that parses LaTeX and MathML syntax and displays the result nicely even on browsers that do not support MathML. So the relation with TeX is just that it parses LaTeX syntax. MathML does not have any relation with TeX the program or TeX's math syntax. –  Aditya Apr 24 '12 at 12:14
Don't forget Physics.SE –  User 17670 Feb 17 '13 at 16:31

One, very incredible solution to an ICFP contest was created by Steve Hicks.

He did an amazing job by coding a Mars rover guidance bot.

He has shared his code and written about it in the above link.

This clearly shows that TeX is not just for typesetting (although it clearly is best at that!).

-

The docstrip program distributed with LaTeX does not typeset anything, it is used to extract source code (while evaluating boolean guards) from documented sources, and to optionally install them in specified locations.

Another such program distributed with LaTeX is latexbug. latex latexbug interacts with the user to create a draft email of a bug report with several fields filled in accurately with information such as the latex version being used, it is of course written in LaTeX.

makebst is an interactive program written in TeX that queries the user on the desired properties of the bibliography style and then produces a custom bibtex style file to meet the requested specification.

basix is an interpreter for the BASIC language written in TeX.

TeX can also of course solve sudoko.

One other one I forgot to mention xmltex is a namespace aware XML parser written in TeX. It can be used for typesetting documents, but also other things. Its default behaviour is not to typeset anything and just to echo the parse tree to the log file.

-

Where I work we generate data dictionaries, automated test reports and pretty much every data that is meant to be read by a user as TeX documents, because, unlike HTLM, it supports table of contents, proper formating, etc.

-
I believe that "automated document" is still a "document". I think that many many people do it (including me). –  yo' Apr 25 '12 at 9:04

Let's not forget the amazing reverxii.tex from our great friend Bruno Le Floch. From the documentation:

reverxii - Playing Reversi, in the spirit of xii.tex

The file reverxii.tex is a 938 character long TeX program which lets you play Reversi against your favorite typesetting engine.

Play by running

tex reverxii.tex


in the command line. This will also produce a record of your game as reverxii.dvi.

Typeset the documentation by running

pdflatex reverxii.tex


This is work in progress, all suggestions/comments/bug reports are welcome!

Hats off to Bruno! :)

-
The whole idea of embracing the interactive possibilities of TeX is really exciting. I could imagine having a single TeX file and upon compiling, the user is asked about papersize, layout and language! –  Henrik Hansen Apr 24 '12 at 14:28
@HenrikHansen That's essentially exactly how makebst works, oh no one has mentioned makebst, I'll add it to my answer –  David Carlisle Apr 24 '12 at 14:54

Some "crazy" people use TeX as a afm file parser and converter to "virtual fonts". Really impressive. It's called fontinst.

The reason fontinst is so portable is simply that it is written in TEX, exploiting those features of the language which does other things than typesetting.

-

The sudokubundle provides three packages related to Sudoku:

1. printsudoko which prints a given puzzle;
2. solvesudoku which attempts to solve a given puzzle;
3. createsudoku which (randomly) creates and prints a puzzle that solvesudoku can solve.

There are other packages for playing other games, such as Bruno Le Floch's reverxii for Reversi, and for printing games like chess and bridge.

-

It could be used as part of faxing a movie.

I had a friend who took a (very) short mpeg file, base 64 encoded it, printed it, faxed it, scanned the faxes using OCR software, then decoded the resulting text via a base 64 decoder back into an mpeg file which could be played.

TeX could be used to create the most OCR readable document possible. I don't know how well TeX handles binary files, but you might be able to write the base 64 encoder as well (I don't think that there's a whole lot of logic there).

-
Faxing a movie... wow... is your friend a masochist? –  LarsH Apr 25 '12 at 3:38

With the beamer and impressive packages, it's used for presentations, as I've learned :)

-

After scanning a book 2-up, you can use pdfpages and ifthen to split the pages in two and reassemble 1-up.

-

Some people don't realize that TeX can do math. I read years ago (maybe 2007?) on comp.text.tex that someone was using TeX for the business end of a billing system.

I can't find that post though. Does anyone else remember it?

-
I wouldn't advise that. You only have 31-bit integers; emulating floating points or BCD with that is slow. –  Martin Schröder Jan 29 '13 at 11:46