2

This question already has an answer here:

LaTeX and Plain TeX are formats for TeX and they ease creating document. But can we create documents using only TeX? I couldn't find any pure TeX sample.

marked as duplicate by Community Oct 27 '18 at 9:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

8

You can write simple documents using only TeX primitives:

\font\rm=ptmr7t
\font\bf=ptmb7t
\font\sl=ptmro7t
\rm
\hrule
\vskip 1in
\hbox to \hsize{\hss\bf A SHORT STORY\hss}
\vskip 6pt
\hbox to \hsize{\hss\sl by A. U. Thor\hss}
\vskip .5cm
Once upon a time, in a distant
  galaxy called \accent "7F O\accent "7F o\accent 24 c,
there lived a computer
named R.\penalty10000\ J. Drofnats.

Mr.\penalty10000\ Drofnats---or ``R. J.,'' as
he preferred to be called---%
was happiest when he was at work
typesetting beautiful documents.
\vskip 1in
\hrule
\vfill\penalty-10000
\end

enter image description here

It's however obvious that macros are essential, not only for making our lives better.

Using some canned set of macros helps in communication.


If you want no format, then you need to do more initializations, running the file with pdftex -ini -output-format=pdf

\catcode`\{=1 % left brace is begin-group character
\catcode`\}=2 % right brace is end-group character
\catcode`\$=3 % dollar sign is math shift
\catcode`\&=4 % ampersand is alignment tab
\catcode`\#=6 % hash mark is macro parameter character
\catcode`\^=7 \catcode`\^^K=7 % circumflex and uparrow are for superscripts
\catcode`\_=8 \catcode`\^^A=8 % underline and downarrow are for subscripts
\catcode`\^^I=10 % ascii tab is a blank space
\chardef\active=13 \catcode`\~=\active % tilde is active
\catcode`\^^L=\active \outer\def^^L{\par} % ascii form-feed is "\outer\par"

\pdfpagewidth=8.5in
\pdfpageheight=11in
\hsize=6.5in
\vsize=8.9in
\baselineskip=12pt

\font\rm=ptmr7t
\font\bf=ptmb7t
\font\sl=ptmro7t
\rm
\hrule
\vskip 1in
\hbox to \hsize{\hss\bf A SHORT STORY\hss}
\vskip 6pt
\hbox to \hsize{\hss\sl by A. U. Thor\hss}
\vskip .5cm
Once upon a time, in a distant
  galaxy called \accent "7F O\accent "7F o\accent 24 c,
there lived a computer
named R.\penalty10000\ J. Drofnats.

Mr.\penalty10000\ Drofnats---or ``R. J.,'' as
he preferred to be called---%
was happiest when he was at work
typesetting beautiful documents.
\vskip 1in
\hrule
\vfill\penalty-10000
\end
  • Is \break a TeX primitive? – John webner Oct 27 '18 at 16:28
  • @Johnwebner Oh, I missed that! – egreg Oct 27 '18 at 16:51
  • +1. On the other hand this also shows that macros are not essential, if one is not directly typing the .tex file but generating it from text written in some other format; i.e. if one is using TeX as just the typesetting tool and not as the complete user interface. – ShreevatsaR Oct 27 '18 at 16:51
  • @ShreevatsaR Some stuff would be very tricky without, for example anything which needs to know which page material appears on – Joseph Wright Oct 27 '18 at 16:54
  • @ShreevatsaR Try implementing a recursive action without macros. – egreg Oct 27 '18 at 16:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.