Gentle Reader: I am super weird, I know. You thought that using LaTeX made you weird. Well, I only know and use TeX. Plain TeX. It’s a full Turing complete programming language for people who know what they’re doing. Why exactly would you want someone else’s macros? I’m sure there’s a reason. But you won’t find anything about that here. TeX. Plain TeX.

Sample Document

Here is a good example of using straight TeX. This is a regular old-school paper format letter. It shows how to parameterize various fields which can be extremely handy for automatically generated documents. For example, I’ve made automatically generated invoices like this. This particular example is composed to show a diverse range of TeX topics.

The letter head is called in from another TeX script. That script calls the letter head graphics with \epsfbox{ ./xedlh/letterhead.eps }. Note that this encapsulated PostScript file is actually a program I wrote in PostScript.

%% Chris X Edwards - Illustrative Generic TeX Letter
%% 2018-02-01
%% Formatted for plain TeX
%% Requires file: xedlh/letterhead.tex
%% Letter to show how to use TeX.

%% start macro and font definitions -----------------------------------
\def\Xdate{\rightline{\ifcase\month\or January\or February\or March\or April\or
May\or June\or July\or August\or September\or October\or November\or
December\fi \space\number\day, \number\year}}

\def\Xtoname#1{\leftline{#1}}
\def\Xtotitle#1{\leftline{#1}}
\def\Xtocompany#1{\leftline{#1}}
\def\XtoaddressA#1{\leftline{#1}}
\def\XtoaddressB#1{\leftline{#1}}
\def\Xgreeting#1{\noindent Dear #1:}
\def\Xclose{\noindent Sincerely, \vskip 30pt }
\def\Xcxe{\leftline{Chris X Edwards {\tt <myemail AT xed.ch>}}}
\def\Xurl#1{\leftline{{\tt #1}}}
%% end macro definitions ---------------------------------------------

\nopagenumbers

%% establish integrated letterhead
\input ./xedlh/letterhead.tex

%% Format setup
\vskip 10pt
\parskip=12pt
\parindent=0pt

%Date
\Xdate
%Inside address
\Xtoname{Donald E. Knuth}
\Xtotitle{Professor Emeritus}
\Xtocompany{Stanford University}
\XtoaddressA{353 Serra Mall}
\XtoaddressB{Stanford, CA 94305}

%Greeting
\Xgreeting{Professor Knuth}

%--start Body

Let's take a look at some commonly used features of \TeX \dots

Some people appreciate the far-reaching, 1--4 varieties in fact,
emphasis on correct dashes---though $-$1 for me because I'm not
fussy.

Knuth loves ligatures like the word `suffice'. Look closely at the
`ffi'.

Here are some fun words---r\'esum\'e, h\^otel, re\"entry, \AA ngstrom, Gau\ss, \~nand\'u.

If you've seen it in a text book, it's available: \S \P \ddag \dag  {\it \$}

Math mode ones go in dollar signs like this: $\star$ $\pm$

Chapter 16 and 17 and 26 tell us about math mode. Double dollars start
a math section. For example, the formula for the volume of a cone
$${1\over3} \pi \rho^2 h$$ is interesting.

I think {\bf bold face is cool}! Of course I wouldn't use it {\it
exclusively} since italic is fine too. \TeX\ even has the concept of
{\sl slanted text} which is not quite italic. Of course this is a nerd thing so
there will be {\tt bits\_of\_code} rendered in "teletype". Note that
the underscores there were escaped because usually they mean something
like the $x$ and $y$ here $$\sqrt {P_x^2+P_y^2}$$

Knuth says, ``One should not get too carried away by the
prospect of font switching unless there is a good reason.''
Which was an example of fancy `quotes'.

Can you imagine popular typesetting programs worrying about the
wavelength of light? Well, Knuth does!

``Since the wavelength of visible light is approximately 100sp, rounding
errors of a few sp make no difference to the eye. However, \TeX\ does
all of its arithmetic very carefully so that identical results will be
obtained on different computers.''

In my opinion this fastidious attention to \it correct \rm and \it
repeatable \rm output is what makes \TeX\ so admirable.

%--end Body

%Close
%\Xclose
Bye,

%Signature
\Xcxe
\Xurl{http://www.xed.ch/help/tex.html}

%% End of letter
\bye

TeX Demo Letter

Building

To use TeX, you have to compile the document into dvi (device independent) format. This is the normal output of the tex command. From the dvi you can create a pdf with dvipdf.

#!/bin/bash

[[ -z "$1" ]] && echo "Supply TeX file root name." && exit

D=$1
echo "Converting ${D}.tex to dvi..."
tex ${D}.tex
echo "Converting dvi to PDF..."
dvipdf ${D}.dvi ${D}.pdf
echo "Removing dvi and log file..."
rm ${D}.dvi ${D}.log

echo "Display PDF..."
xpdf ${D}.pdf