Lesson One


In this section we run through the the principles of writing and printing of a simple TeX document. If it seems like an awful lot of work, remember that writing and printing your first document it the hardest part: the learning curve is initially steep, but flattens off quickly.

Traditionally, using TeX (and associated utilities) is a command-line-based activity, be you using a Unix or a Windows machine. Graphical shells to exist for TeX, especially for Windows (and Macintosh). We assume a command-line-based system here.

The complete procedure is:

  1. Using your favourite text editor (GNU-emacs!) create a file, called <myfile>.tex by default.
  2. Compile the source (from you file) to produce a .dvi file (dvi stands for device-independent).
  3. Convert the .dvi file to a format suitable for printing --- often postscript.
You can view the DVI file directly, without printing by using a DVI-viewer, such as xdvi or kdvi on Solaris or Linux, or WinDVI on Windows; you can also view the postscript (without having to print) by using ghostview (on Linux, Solaris and Windows). At more length:

TeX Source File

Create a TeX source file by using your favourite text editor, such as (GNU) emacs, joe, pico or vi on Solaris and Linux, or Notepad on Windows.

An Example
Here is an example. Feel free to simply copy and paste this.


If you modify the above example, or create your own, do not be surprised if TeX gets upset and reports errors (see the section on Errors).

Compilation

Compile your TeX source file, <myfile>.tex to produce a DVI file, <myfile>.dvi, by using the tex command:
    prompt> tex <myfile>.tex
If successful you will see some messages from TeX, like this:

    prompt> tex simple_example.tex
    This is TeX, Version 3.14159 (Web2C 7.3.1)
    (simple_example.tex [1] )
    Output written on simple_example.dvi (1 page, 1884 bytes).
    Transcript written on simple_example.log.
    prompt> 
...and you will get a DVI file. It's possible that you will make a mistake and get an error message, such as this:
 
    tex simple_example.tex
    This is TeX, Version 3.14159 (Web2C 7.3.1)
    (simple_example.tex
    ! Undefined control sequence.
    l.15 `\ttbackslas
                '.  The first two macros, for example,
    ? 
which says that TeX does not recognise the macro \ttbackslas (the "h" is missing from the end). In this case quit from TeX by typing a "q" (and hitting "return"). Then follow the strategy given below in the section on Errors.

Printing

One usually obtains hard-copy from a TeX document by converting the DVI file to a postscript file (<myfile>.ps) and sending the postscript file to a printer. The conversion is commonly done by using a utility called dvips, e.g:

      prompt<GT> dvips simple_example.dvi
      This is dvips(k) 5.86 Copyright 1999 Radical Eye Software 
          (www.radicaleye.com)
      ' TeX output 2000.06.16:1028' -> simple_example.ps
      <texc.pro>. [1] 
      prompt<GT> 
This will produce a postscript (.ps) file. This can be sent to your printer in the usual way.

For more on dvips see below.




About this document:

Produced from the SGML: /home/isd/public_html/_tex/_reml_grp/tex_lesson_one.reml_lib
On: 4/12/2002 at 12:51:20
Options: reml2 -i noindex -l long -o html -p multiple