Introducing TEX/LATEX
David Arnold
Friday, March 5, 1999
– Typeset by FoilTEX –
Installing a TEX/LATEX System on Your
Home or Office Machine
There are six easy steps:
1. Install GSView, a postscript previewer.
2. Install MiKTEX, a complete TEX/LATEX system.
3. Install WinEdt, a TEX/LATEX shell for Windows.
4. Configure dvips for your printer.
5. Configure MiKTEX to interact properly with
WinEdt.
6. Test your installation.
Introducing TEX/LATEX: David Arnold 1
Getting and Installing GSView
There are several ways to obtain GSView:
1. Download the file gsv27550.exe at
http://www.cs.wisc.edu/˜ghost/aladdin/get550.html.
2. Transfer the file from the sci-math server to your
office machine. The file is located in the directory
g:\ghost_ps.
3. Bring a zip disk to my office and I’ll place all of the
files you need on your zip disk.
Installing GSView is easy. Simply double-click the file
gsv27550.exe in the Explorer and click the Setup
button in the resulting dialog. After that, accept all
of the defaults (keep hitting the Next button). Click
the Exit button to conclude the installation.
Note: It’s best to install everything on your c:\ drive (the
default), especially if this is your first time installing a TEX
system.
Introducing TEX/LATEX: David Arnold 2
Getting and Installing MiKTEX
There are several ways to obtain MiKTEX:
1. Download the file complete.exe at
http://www.inx.de/˜cschenk/miktex/getting.html.
2. Transfer the file from the sci-math server to your
office machine. The file is located in the directory
g:\miktex.
3. Bring a zip disk to my office and I’ll place all of the
files you need on your zip disk.
Installing MiKTEX is easy. Simply double-click the file
complete.exe in the Explorer and accept all of the
defaults (keep hitting the Next button).
Note: It’s best to install everything on your c:\ drive (the
default), especially if this is your first time installing a TEX
system.
Introducing TEX/LATEX: David Arnold 3
Getting WinEdt
There are several ways to obtain WinEdt1:
1. Download the file winedt32.exe at
http://home.iSTAR.ca/˜winedt/download.html
2. Transfer the file from the sci-math server to your
office machine. The file is located in the directory
g:\winedt.
3. Bring a zip disk to my office and I’ll place all of the
files you need on your zip disk.
1
WinEdt is shareware. You can use it for a 30-day trial period. After that,
there is a $40 registration fee (worth every penny, in my opinion—a terrific
program!).
Introducing TEX/LATEX: David Arnold 4
Installing WinEdt
Installing WinEdt is a little trickier than the previous
installations.
1. Double-click the file winedt32.exe in the
Explorer. The file winedt32.exe is a
self-extracting zip file. Choose a folder, perhaps
c:\temp, where you want the files unzipped and
click the Unzip button. This will create a folder
called 144mb in c:\temp.
2. In the folder 144mb you will find another folder
called Disk1. In the folder Disk1 resides a file
called Setup.exe. Double-click the file
Setup.exe and accept all of the defaults (keep
hitting the Next button).
Note: It’s best to install everything on your c:\ drive (the
default). The default installation of WinEdt assumes that
MiKTEX is installed on the c: drive. If you decide to install either
program elsewhere, some further customization (tricky for new
users) is required.
Introducing TEX/LATEX: David Arnold 5
Configuring dvips
You need to configure dvips with settings matching
your personal printer.
1. Use WinEdt to open the file config.ps in
c:\texmf\dvips\config\local\.
2. Locate the lines in config.ps that read like this:
;;; METAFONT mode to be used when generating fonts.
M ljfour
3. These lines indicate that dvips is configured for the
HP4 printer. You need to change the driver to one
that recognizes your printer. Open the file
mfmodes in c:\texmf\miktex\config and locate
your printer. Take note of the printer driver and
the resolution. For example, if you see
Introducing TEX/LATEX: David Arnold 6
canonbjc
Canon BJC-600 (360dpi)
360
360
then your resolution is 360dpi (dots per inch) and
your printer driver’s name is canonbjc.
4. Change the line in (2) to
;;; METAFONT mode to be used when generating fonts.
M canonbjc
5. Next, you need to change the resolution. Note the
line in config.ps that reads
;;; Vertical and horizontal resolution.
D 600
Note the resolution found in (3) and make the
appropriate change.
;;; Vertical and horizontal resolution.
D 360
Introducing TEX/LATEX: David Arnold 7
6. Locate the line
;;; Uncomment these lines if you have PostScript
versions of the fonts.
and uncomment each of the four lines following
this one. Also, add the amsfonts.map. The final
result should look like this:
p +cmfonts.map
p +amsfonts.map
p +lafonts.map
p +cyrfonts.map
p +eufonts.map
7. Comment the a4 paper size and uncomment the
lettersize, if needed, like this:
;@ A4size 210mm 297mm
;@+ %%PaperSize: A4
@ letterSize 8.5in 11in
8. Save and close the file config.ps.
Introducing TEX/LATEX: David Arnold 8
Configure MiKTEX to Interact with
WinEdt
When TEX/LATEX finds an error, we want to return to
WinEdt at the line where the error was made.
1. Open miktex.ini in the folder
c:\texmf\miktex\config.
2. Under the [TeX] environment variable, you will find
a number of editors listed: notepad, emacs, etc.
One of them is WinEdt. The line containing
WinEdt needs to be uncommented so the that the
E of Editor is in the first column. Comment the
existing editor (probably notepad) in a manner
similar to the commenting method of the
remaining editors.
3. Save and close the file miktex.ini.
Introducing TEX/LATEX: David Arnold 9
Important Step
Reboot your
computer!
Introducing TEX/LATEX: David Arnold 10
Testing Your TEX Installation
It’s time to test your TEX installation.
1. Open WinEdt, and choose New Document from
the Project menu. Select TEX document.
2. Enter the following text, precisely as it appears
below!
Hello \TeX\ world!
\bye
Note: TEX is case-sensitive!
3. Save the file as hello.tex. You must type the file
extension, as in hello.tex
4. Select Set Main File from the Project menu.
5. Select TeX from the Accessories menu. If all is
well, you will receive no errors. Press any key to
Introducing TEX/LATEX: David Arnold 11
close the DOS box. The TEX compiler creates a
DVI (device independent) file, hello.dvi.
6. You need a previewer to view the file hello.dvi.
Select DVI Preview from the Accessories menu.
Your file should be displayed in the DVI previewer
YAP.
7. Return to WinEdt and select Menu Setup from the
Options menu. Double-click &Accessories in the
Items dialog. Single-click &DVIPS and check the
check-box Save Input File to Disk.
8. Select DVIPS from the Accesories menu. This
changes the DVI file (hello.dvi) to a postscript
file (hello.ps). If all is well, you will receive no
errors. Press any key to close the DOS box.
9. Select GSView from the Accessories menu. The file
hello.ps should open for viewing in GSView.
Introducing TEX/LATEX: David Arnold 12
Testing Your LATEX Installation
LATEX is a collection of TEX macros designed to ease
the writer’s task in creating fine documents. We must
structure our file hello.tex differently if we wish to
use LATEX.
1. In WinEdt, select New Document from the Project
menu. For the moment, refrain from selecting any
of the LATEX styles, and select TEX document.
2. Enter the following text.
\documentclass{article}
\begin{document}
Hello \LaTeX\ world!
\end{document}
Note: LATEX is case-sensitive!
This special format in the source file distinguishes
LATEX files from TEX files.
Introducing TEX/LATEX: David Arnold 13
3. Save the file as hello2.tex. You must type the
file extension, as in hello2.tex.
4. Select Set Main File from the Project menu.
5. Select LaTeX from the Accesories menu. If all is
well, you will receive no errors. Press any key to
close the DOS box. TEX has created the DVI
(device independent) file hello.dvi.
6. Select DVI Preview from the Accessories menu.
Your file should be displayed in the DVI previewer
YAP.
7. You may also return to WinEdt and create a
postscript file with DVIPS. Then you can view the
file in GSView.
Introducing TEX/LATEX: David Arnold 14
Adding Files to the MiKTEX Directory
Tree
Any time that you add a file to the MiKTEX directory
tree, you need to refresh the MiKTEX file database.
1. Download the file gentle.tex from
http://ctan.tug.org/ctan-search.html. It’s the link
A Gentle Introduction to TEX. Download it to the
directory c:\texmf\doc.
2. Open the file gentle.tex in WinEdt. Select Set
Main File from the Project menu, then TeX from
the Accessories menu. Note that MiKTEX cannot
find the file gentle.tex.
3. Click the Start button, select Programs, select
Miktex, select Maintenance, then select Refresh
Filename Database. Close the DOS box when the
refresh is complete.
Introducing TEX/LATEX: David Arnold 15
4. Select TeX from the Accessories menu. This time
there should be no errors.
5. Select DVI Preview from the Accessories menu.
This will open the file gentle.dvi in YAP.
Note that gentle.tex is a wonderful introduction to the TEX
typesetting system. You might want to print the file at a
later date for closer study.
Introducing TEX/LATEX: David Arnold 16
Spaces and Paragraphs
1. TEX and LATEX ignore spaces and newlines. In
WinEdt, add spaces and a new line to hello.tex,
as shown below, TEX the result, and preview.
Hello \TeX\
World!
\bye
2. You need to separate paragraphs in your source file
with a blank line to produce a new paragraph. In
WinEdt, click Wrap on the status bar to turn off
wrapping, make the following changes to
hello.tex, TEX the result, and preview.
Now is the time for all good
men to come
to the aid of their
country.
Now is the time for all good men to come
to the aid of their country.
\bye
Introducing TEX/LATEX: David Arnold 17
Changing Fonts
1. The following typefaces are available in TEX.
TEX switch sequence Sample of Typeface
\rm This is roman type
\bf This is boldface type
\it This is italic type
\sl This is slanted type
\tt This is typewriter type
\cal SOME SCRIPT LET T ERS
Experiment with them in hello.tex. For example,
add the following text to hello.tex (anywhere
before \bye), then TEX and preview.
If you change to \it italic \rm you must remember
to change back to roman. If you change to
\bf boldface and forget to change back to roman,
all of your remaining text will be boldface.
2. Grouping (curly braces) limits the scope of the
typeface. Add these lines to hello.tex.
\rm Grouping with curly braces limits the scope
of {\bf bold typeface}. This is the most
{\it efficient} way to change typefaces.
Introducing TEX/LATEX: David Arnold 18
Special Characters
TEX and LATEX reserve special characters for a number
of important uses.
Character Purpose Literal Output
\ Special symbols and instructions $\backslash$
{ Open group $\{$
} Close group $\}$
% Comments \%
& Tabs and table alignments \&
˜ Unbreakable space \˜{}
$ Starting or ending math text \$
ˆ Math superscripts \ˆ{}
Math subscripts \_{}
# Defining replacement symbols \#
Add the following to hello.tex, TEX the result, and
preview.
%This is a comment
Almost 100\% of the \$300 is {\bf gone}! If
$x_1ˆ2-2x_1=3$, then find the value of $x_1$
and use this result in exercise \#1.
Introducing TEX/LATEX: David Arnold 19
Mathematics in TEX
1. Inline mathematical expressions are enclosed in $. . . $. You
display mathematical expressions by including them in a
double $$. . . $$ pair. Add the following text to hello.tex,
TEX the result, and preview.
If $f$ is continuous on $[a,b]$, differentiable
on $(a,b)$, then there exists a $c$ in $(a,b)$
such that
$$
f’(c)={{f(b)-f(a)}\over {b-a}}.
$$
2. Remember, TEX ignores spaces and newlines in the source of
item #1, so you could just as easily type your source as
follows. Try it!
If $f$ is continuous on $[a,b]$, differentiable
on $(a,b)$, then there exists a $c$ in $(a,b)$
such that $$ f’(c)={{f(b)-f(a)}\over {b-a}}.$$
However, your source will become difficult to read unless you
adopt a source formatting strategy similar to that in item #1.
Introducing TEX/LATEX: David Arnold 20
Quote and Dashes
1. To surround a word or phrase in quotes, begin the quote by
striking two consecutive opening single quotes (located on
the key to the left of the key containing the numeral 1), then
end the quote by striking two consecutive ending single
quotes (located below the double quote near the Enter key).
Add the following to hello.tex, TEX, then preview.
‘‘Merrily we roll along,’’ cried the Mad Hatter.
2. There are several types of dashes in TEX/LATEX. Each has a
specific purpose.
Name TEX input TEX output
hyphen - -
en-dash -- –
em-dash --- –
minus sign $-$ −
Add the following to hello.tex, TEX, then preview.
My mother-in-law did exercises 11--22 in her
workbook---a thoroughly difficult assignment
---while it was $-20$ degrees outside.
Introducing TEX/LATEX: David Arnold 21