\sectiontitle{Producing Simple Documents using Plain \TeX} \label{pl-text} \subsectiontitle{Producing Ordinary Text using Plain \TeX} To produce a simple document using Plain \TeX\ one should create a \TeX\ input file. The input file should end with the \verb?\bye? command, in order to tell \TeX\ when the end of the file has been reached. If one merely wishes to type in ordinary text, without complicated mathematical formulae or special effects such as font changes, then one merely has to type it in as it is, leaving a completely blank line between successive paragraphs. You do not have to worry about paragraph indentation: \TeX\ will automatically indent all paragraphs with the exception of the first paragraph of a new section (unless you take special action to override the conventions adopted by \TeX) For example, suppose that we wish to create a document containing the following paragraphs: \begin{quotation} \small \noindent If one merely wishes to type in ordinary text, without complicated mathematical formulae or special effects such as font changes, then one merely has to type it in as it is, leaving a completely blank line between successive paragraphs. You do not have to worry about paragraph indentation: all paragraphs will be indented with the exception of the first paragraph of a new section. One must take care to distinguish between the `left quote' and the `right quote' on the computer terminal. Also, one should use two `single quote' characters in succession if one requires ``double quotes''. One should never use the (undirected) `double quote' character on the computer terminal, since the computer is unable to tell whether it is a `left quote' or a `right quote'. One also has to take care with dashes: a single dash is used for hyphenation, whereas three dashes in succession are required to produce a dash of the sort used for punctuation---such as the one used in this sentence. \end{quotation} To create this document using Plain \TeX\ we use the following input file: \begin{quote} \begin{verbatim} If one merely wishes to type in ordinary text, without complicated mathematical formulae or special effects such as font changes, then one merely has to type it in as it is, leaving a completely blank line between successive paragraphs. You do not have to worry about paragraph indentation: all paragraphs will be indented with the exception of the first paragraph of a new section. One must take care to distinguish between the `left quote' and the `right quote' on the computer terminal. Also, one should use two `single quote' characters in succession if one requires ``double quotes''. One should never use the (undirected) `double quote' character on the computer terminal, since the computer is unable to tell whether it is a `left quote' or a `right quote'. One also has to take care with dashes: a single dash is used for hyphenation, whereas three dashes in succession are required to produce a dash of the sort used for punctuation---such as the one used in this sentence. \bye \end{verbatim} \end{quote} Having created the input file, one then has to run it through the \TeX\ program and then print it out the resulting output file (known as a `DVI' file). \subsectiontitle{Blank Spaces and Carriage Returns in the Input File} \TeX\ treats the carriage return at the end of a line as though it were a blank space. Similarly \TeX\ treats tab characters as blank spaces. Moreover, \TeX\ regards a sequence of blank spaces as though it were a single space, and similarly it will ignore blank spaces at the beginning or end of a line in the input file. Thus, for example, if we type \begin{quote} \begin{verbatim} This is a silly example of a file with many spaces. This is the beginning of a new paragraph. \end{verbatim} \end{quote} then we obtain \begin{quotation} \small This is a silly example of a file with many spaces. This is the beginning of a new paragraph. \end{quotation} It follows immediately from this that one will obtain the same results whether one types one space or two spaces after a full stop: \TeX\ does not distinguish between the two cases. Any spaces which follow a control sequence will be ignored by \TeX. \begin{quotation} \footnotesize If you really need a blank space in the final document following whatever is produced by the control sequence, then you must precede this blank by a {\it backslash} \verb?\?. Thus in order to obtain the sentence \begin{quotation} \TeX\ is a very powerful computer typesetting program. \end{quotation} we must type \begin{quote} \begin{verbatim} \TeX\ is a very powerful computer typesetting program. \end{verbatim} \end{quote} (Here the control sequence \verb?\TeX? is used to produce the \TeX\ logo.) In general, preceding a blank space by a backslash forces \TeX\ to include the blank space in the final document. \end{quotation} \subsectiontitle{Quotation Marks} Single left and right quotation marks are produced by \verb?`? and \verb?'? respectively. Double left and right quotation marks are produced by \verb?``? and \verb?''? respectively. Thus \begin{quotation} \small ``What did you do yesterday?'' he asked. \end{quotation} is produced by typing \begin{quote} \begin{verbatim} ``What did you do yesterday?'' he asked. \end{verbatim} \end{quote} You should never use the character \verb?"? to produce quotation marks. This is because \TeX\ has no way of knowing whether you want a left quote or a right quote if you do this. \begin{quotation} \footnotesize You can use the control sequences \verb?\lq? and \verb?\rq? in place of \verb?`? and \verb?'?. This is useful if your keyboard does not have a \verb?`? character. \end{quotation} \begin{quotation} \footnotesize Sometimes you need two quotation marks following one another, as in \begin{quotation} ``I regard computer typesetting as being reasonably `straightforward'\thinspace'' he said. \end{quotation} The way to do this is to use the control sequence \verb?\thinspace? between the quotation marks. Thus one would type \begin{quote} \begin{verbatim} ``I regard computer typesetting as being reasonably `straightforward'\,'' he said. \end{verbatim} \end{quote} However this problem arises very rarely. \end{quotation} \def\beginsection#1\par{\bigskip{\bf #1}\nobreak \smallskip\vskip-\parskip\noindent} \subsectiontitle{Section Headings in Plain \TeX} The control sequence \verb?\beginsection? is used in Plain \TeX\ to produce a section heading, printed in a boldface typestyle. This control sequence should be followed by the title of the section, and this should then be followed by a blank line. Thus if we type \begin{quote} \begin{verbatim} \beginsection Section Headings In this section, we describe how to obtain section headings, printed in a boldface font. \end{verbatim} \end{quote} then we obtain \begin{quotation} \small \beginsection Section Headings In this section, we describe how to obtain section headings, printed in a boldface font. \end{quotation} \subsectiontitle{Dashes} \TeX\ allows you to produce dashes of various length. Typing \verb?-? by itself produces a hyphen, as in `double-quote'. Typing \verb?--? produces a dash suitable for denoting a range of numbers, as in the phrase `on pages 155--159', produced by typing \begin{quote} \begin{verbatim} on pages 155--159. \end{verbatim} \end{quote} Finally, typing \verb?---? produces a punctuation dash---this is a dash such as the one in this sentence. \subsectiontitle{Changing Fonts} Fonts are changed using the control sequences \verb?\rm?, \verb?\sl?, \verb?\it?, \verb?\tt? and \verb?\bf?. \begin{quote} \begin{tabular}{ll} \verb?\rm? changes to the normal ``roman'' font: & \rm Roman\\ \verb?\sl? changes to a slanted roman font: & \sl Slanted\\ \verb?\it? changes to an italic font: & \it Italic\\ \verb?\tt? changes to an ``typewriter'' font: & \tt Typewriter\\ \verb?\bf? changes to a boldface font: & \bf Boldface \end{tabular} \end{quote} It is best to use the special characters \verb?{? and \verb?}? when changing fonts. One encloses the text whose font is to be changed within these curly brackets and places the font-changing control sequence immediately after the opening bracket~\verb?{?. Thus the text \begin{quotation} \small In this sentence we have {\it italicized\/} a few words, set others in {\sl slanting type\/} or {\bf boldface type}, and typeset others using a {\tt `typewriter' font in which all the letters have a fixed width}. \end{quotation} is produced by typing \begin{quote} \begin{verbatim} In this sentence we have {\it italicized\/} a few words, set others in {\sl slanting type\/} or {\bf boldface type}, and typeset others using a {\tt `typewriter' font in which all the letters have a fixed width}. \end{verbatim} \end{quote} \begin{quotation} \footnotesize The control sequence \verb?\/? produces the so-called {\it italic correction}. The use of this is recommended when changing back from an {\it italic\/} or {\sl slanted\/} font into a {\rm roman} or {\bf boldface} font, in order to produce extra space to compensate for the way in which some {\it italic\/} and {\sl slanted\/} letters lean into the following blank space. However this italic correction should not be used before a comma or a full stop. \end{quotation} \subsectiontitle{Accents and other Symbols used in Text} There are a variety of control sequences for producing accents. For example, the control sequence \verb?\'{o}? produces an acute accent on the letter~\verb?o?. Thus typing \begin{quote} \begin{verbatim} Se\'{a}n \'{O} Cinn\'{e}ide. \end{verbatim} \end{quote} produces \begin{quotation} \small Se\'{a}n \'{O} Cinn\'{e}ide. \end{quotation} Similarly we use the control sequence \verb?\`? to produce the grave accent in `alg\`{e}bre' and we use \verb?\"? to produce the umlaut in `Universit\"{a}t'. A list of the accents provided by \TeX\ is given in Appendix~\ref{pl-txtcs}. The control sequences \verb?\i? and \verb?\j? produce dotless $i$ and $j$. These are required when placing an accent on the letter. Thus \={\i} is produced by typing \verb?\={\i}?. There are also control sequences for ligatures and other special symbols used within text. These are listed in Appendix~\ref{pl-txtcs}. \subsectiontitle{Special Characters} The characters \begin{quote} \begin{verbatim} # $ % & \ ^ _ { } ~ \end{verbatim} \end{quote} have special purposes within \TeX. Thus they cannot be produced in the final document simply by typing them directly. On the rare occasions when one needs to use the special characters \begin{quote} \#\ \$\ \%\ \&\ \_\ \{\ \} \end{quote} in the final document, they can be produced by typing the control sequences \begin{quote} \begin{verbatim} \# \$ \% \& \_ \{ \} \end{verbatim} \end{quote} respectively. However, somewhat more ingenuity is required to produce \verb?\?, \verb?^? and \verb?~?.