# Are there any (La)TeX Easter Eggs?

Given Donald Knuth's legendary sense of humor, one cannot help but suppose he would have succumbed to the temptation to add in a "special" command or two that did something unsuspected or unusual just for the fun of it. (And I don't just mean some cute or funny source code comments, but something that actually does something.)

And if not him, then surely someone in the community who has made an extension, document class, package or subversion of TeX, LaTeX, ConTeXt, or a helper program like an editor, etc., decided to have a little fun and throw in an Easter Egg.

Yet, at the moment, I cannot think of a single one. Does anyone know of any?

• I see this less as a question, and more as a call to arms for all package writers! But perhaps given the danger of incompatibility between packages and things of that sort, easter eggs would be more annoying than cute, if they led to inexplicable errors... – Seamus Jan 20 '11 at 13:20
• also, +1 for the knuth tag... – Seamus Jan 20 '11 at 13:23
• It's still January and you are already searching for easter eggs! Be patient! ;-) – Caramdir Jan 20 '11 at 15:38
• Just found this old post. What about TeX error messages (and some of their explanations in The TeXbook)? "If you get this error message, you know why, and you deserve no sympathy." (quoting from memory) – mbork Dec 28 '11 at 14:49
• @mbork The right quote is: If you have been so devious as to get this message, you will understand it, and you deserve no sympathy. Is there someone who has never had this error message? What can be the procedure to obtain it? – Jean Baldraque Oct 2 '12 at 16:06

This is not quite an answer, but I just wrote the following code, that redefines a command to turn its argument by a random angle

Namely, \easteregg\footnote declares all footnotes to rotate their text by a random amount (between -10 and +10 degrees).

\documentclass{article}
\usepackage{rotating}
\usepackage[first=-10,last=10]{lcg}
\makeatletter
\newcommand{\globalrand}{\rand\global\cr@nd\cr@nd}
\makeatother
\newcommand{\easteregg}[1]{%
\expandafter\let\csname old\string#1\endcsname#1%
\expandafter\def\expandafter#1\expandafter##\expandafter1\expandafter{%
\csname old\string#1\endcsname{\protect\globalrand\protect\turnbox{\value{rand}}{##1}\protect\phantom{##1}}}%
}

\easteregg\emph
\easteregg\section

\begin{document}

\section{Test}
\section{More test}
\section{Examples}

\emph{Some} \emph{emphasized} \emph{text},
\emph{with} \emph{random} \emph{directions}

\end{document}

• +1 for taking up the challenge, though as you point out it's not quite an answer... – frabjous Jan 20 '11 at 20:51

Given the limitations of the computers at the time TeX was coded, for example, memory space, I guess no one thought about useless commands that take memory space to serve as an easter egg.

But the meaning of the phrase Easter Egg' might have changed over the years. And there might be a different interpretation of the phrase for users and programmers. I think the most appropriate definition from the view point of the Stanford group can be found in the Hacker's Dictionary by Eric Raymond: A message hidden in the object code of a program as a joke, intended to be found by persons disassembling or browsing the code. Sometimes the intention is not to make a joke but to give credits.

In this sense TeX contains an easter egg.

But this kind of easter eggs is for a certain group of people and probably like a trick of a magician it should not be explained to others. I decided to give some clues but I ask you to find the solution yourself and to have the fun.

The WEB source of TeX contains

The most important output produced by a run of TeX is the device independent'' (DVI) file that specifies where characters and rules are to appear on printed pages. The form of these files was designed by David R. Fuchs in 1979.

and later

The i byte is followed by four or more bytes that are all equal to the decimal number 223 (i.e., '337 in octal). TeX puts out four to seven of these trailing bytes, until the total length of the file is a multiple of four bytes, since this works out best on machines that pack four bytes per word; but any number of 223's is allowed, as long as there are at least four of them. In effect, 223 is a sort of signature that is added at the very end.

Binary digits (or bits) are often combined to sequences of three or four to form the octal digits (base 8; digits are 0-7) or hex digits (base 16; digits are 0-9 and A-F), resp.

David Fuchs explains the first version of the DVI format in an TUGboat article and again he wrote:

... which is followed by at least 4 bytes containing the number $223_{10}$ (which is '337 octal).

So maybe the octal value is a clue. Use a calculator in programmer's mode or enter 223 to octal` in the Google search line to verify that his conversion is correct. He made a step in the right direction but one has to go twice as far to see the easter egg.

(Metafont has the same convention for GF files.)

• Nice hint, without giving it away :-) – ShreevatsaR May 22 '17 at 1:13

I'm not sure if this happened by accident, but I don't think so. If I type tex -v the version number is PI, TeX 3.1415926. This seems to me like an easter egg, then I ended up googling for latex easter eggs and found this question. Hoped for some more but seems like they are well hidden :D

PS: I use Ubuntu 14.04 and installed texmaker and with it Latex I guess, not so sure but everything has been working great so far.

• The TeX versioning scheme says than every new version is identified by adding a digit of PI. – Astrinus Dec 1 '16 at 15:57
• I'm not sure, this is an easter egg. It's just how Prof. Knuth decided to do version numbering with increasing digits or pi. – user36296 Dec 1 '16 at 15:57
• I mean cmon. This is insane^^ and totally and easter egg :D – Hakaishin Dec 1 '16 at 16:20