![]() |
PDF LaTeX by exampleCTJ Dodson © 2001 |
Traditionally, users of LaTeX created printable Postscript (ps) or just dvi output; nowadays, when you use a computer in a different place, you may not find available the necessary viewers for these. However, the free pdf viewers (see below) are usually already associated with a browser so it is convenient to use pdf output format and then you can include also hyperlinks, coloured text, graphics and even movies in your documents, electronic books, and CD/DVD media. Ghostview can convert Postscript graphics into PDF format for inclusion in articles. Acrobat Reader can rotate graphics, it has an automatic slideshow mode and the LaTeX slide format is very convenient for presentations by computer projection---or as printed OHP transparencies. However, the new beamer package (cf. below) provides better looking conference slides for computer projection.
In the case of a collection of course documents or a connected series of articles---possibly including some on remote computers, it is convenient to use web-based access to the archived resources, as is in operation with the page you are now reading. Accordingly, the working example of this page is an easily understood template that you can modify to provide access to your own archived materials; it has been designed using elementary raw HTML so it is easily portable. On the other hand, whereas professional web editing facilities (eg Frontpage, Netscape Composer) are very powerful, they use many hidden or at best obscure procedures and may bury necessary items in undeclared directories, so it is hard to create a stand-alone webpage. Using simple raw HTML is sufficient for most purposes---typically creating and updating a course homepage or carrying a connected set of documents for discussions and presentations at another institution where you are unsure of what is available on the PC you will have to use.
The result of pdflatex will create from artex.tex several files of which two are immediately important: artex.log, which contains information on any errors and artex.pdf which is the output. If artex.pdf is not how you want it, then resume editing artex.tex before again processing it with pdflatex. In WinEdt the errors will be highlighted for you.
Resolving errors in LaTeX code
If pdflatex
finds errors in the commands used in artex.tex, then it will write information
on these in artex.log but additionally it will give feedback in the DOS window
and this can help corrections. You can ask for more help about an error message
by entering h or you can ask pdflatex to do the best
it can by entering s after an error message. This
help is often cryptic but together with the output you can usually decide what
has gone wrong. Typical beginners' errors are omission of the preamble commands
\documentclass{article} one of the packages required
eg \usepackage{amsmath,amssymb,amsfonts}, or one of
the essential beginning \begin{document} and end
commands \end{document}. Other common errors are
omission of $ around mathematics or failure to end an
environment after once beginning it: \begin{eqnarray}
must eventually be followed by \end{eqnarray}. The
example artex.tex contains a selection of commonly used environments.
If you want to be adventurous, you can
include movies in pdf documents using the \includemovie command.

Basic Slideshow
example:
Open and edit plain text LaTeX source file slidex.tex As before, the source tex file is used to enter the LaTeX commands, but now
using documentclass{slides}. For slides, a much larger font is
automatically used so some care is needed with lengths of lines and expressions.
Also, graphics are included using just the picture environment.
To
use the example here you can download the necessary files:
Source: slidex.tex, graphics for
inclusion: 3dpdf.pdf contpdf.pdf
To process, run the command
pdflatex slidex
When you view slidex.pdf using Acrobat
Reader, from the toolbar View choose Single Page and select Thumbnails; then just pressing Enter or via a remote control you display the slideshow one
page at a time.
Each Chapter, Appendix and the Index is made as a *.tex file and is called in by the include command---thus ch1.tex is the name here of the file containing Chapter 1. The inclusion of any particular file can be suppressed by prefixing the line by a percent sign. Do not put an end{document} command at the end of chapter files; just one such command is needed at the end of the book. Note the tag used to make an index entry. You may need to consult Lamport's book for details of the procedure to make the index input file; LaTeX will create a pre-index by listing in the file bookex.idx all the tagged items in your input *.tex files, then you edit this into a theindex environment, as index.tex.
When you view bookex.pdf using Acrobat Reader, from the toolbar View choose Single Page and select Bookmarks; then just pressing Enter or via a remote control you display the book one page at a time. For use from a CDROM, the Bookmarks navigation bar at the left is convenient; note that the List of Contents is automatically hyperlinked.
Exercise: make hyperlinks from the index entries.
LaTeX to Powerpoint
You may wish to use
Powerpoint to make a slideshow using the Powerpoint editor but
for mathematical expressions the equation editor is rather primitive. A way
around this is provided by TexPoint a Powerpoint add-in that
enables the easy use of Latex symbols and formulas in Powerpoint presentations.
After you have installed TexPoint you can use the command
tex2bmp slid
to convert the LaTeX output of slid.tex (one formula
from slidex.tex) into the bitmap graphic slid.bmp which you
can copy and paste into PowerPoint or Word documents.
See the TeX User Group for more information on LaTeX and available augmentations.
To use the example here you can download the necessary files:
Source:
pdfbyex.htm, graphic for
inclusion: viviani.gif
When you open the file in Notepad and compare the text with what the browser presents from it, you will see how simple it is to write raw HTML code. It is important to use the plain text editing, not rich text and not Word or Wordpad, because the latter think they know what you want and slip in their own controls!
The HTML control commands are all wrapped in braces < > and are often natural abbreviations of the operations: eg HR is `horizontal rule' which gives a dividing line, Hn for n=1,2,3,4 gives headings of descending importance. B means bold and /B means end bold, I and /I begin and end italic, UL begins a list environment, LI precedes each item and /UL ends the list, BR gives a line break and P gives a new paragraph, HREF precedes a hyperlinked reference and a graphic file of a travelling triad on Viviani's curve was included at the top of this page using IMG SRC="viviani.gif".
The only oddly obscure part of HTML is the code for colours, for example #FFFF00 means yellow; so you may have to look up special colours in an HTML manual or go to the sourcecode of a document containing the colour you want and experiment---another way is to view a little text in your web browser Composer, use its editor to colour the text, then open the source file in Notepad and note the code used. It will be of the form: font color="#FF6666" for wrapping round red text and of the form: font color="black" for green text. From the top of this file you can deduce html code for the symbol © ; similar detective work on other html source files, which you can read through your browser toolbar `View' `Source' , can yield useful tricks.
Here are two more of my more complex HTML webpages for charitable organizations using embedded Java applets:
Burton in Lonsdale Village Hall
North Craven Historical Research Group
There you can look at the source code and see how I have used Java inserts for menus
and animated gif insertions.