Chapter 1
Installing TEX and LATEX
TEX Live installs very easily on all modern desktop, laptop, and server platforms. You can get a copy of the DVD from your local TEX user group, or you can download the installation from CTAN in http://www.ctan.org/tex-archive/systems/
This course is based on using one of the following distributions of TEX from the TEX Collection DVD:
- TEX Live
for GNU/Linux, Unix, Mac OS X, and Microsoft Windows (this supersedes Thomas Esser's teTEX distribution which is no longer supported);
- proTEXt
for Microsoft Windows (by Thomas Feuerstack) which includes Christian Schenk's MiKTEX, the TEXMakerX editor, GhostScript, and GSView;
- MacTEX
for Apple Macs running OS X. MacTEX includes the TEXshop editor.
Other implementations of TEX can be downloaded from CTAN, but the above are the standard systems. LATEX is included with all distributions of TEX.
The TEX Collection DVD is issued annually by TUG in conjunction with many of the local TEX user groups around the world (see http://www.tug.org/lugs.html for addresses), and edited by Sebastian Rahtz, Karl Berry, Manfred Lotz, and the authors of the software mentioned above. These people give an enormous amount of their personal time and energy to building and distributing these systems, and they deserve the thanks and support of the user community for all they do.
There is also a selection of commercial distributions you can buy, as described in the sidebar ‘Credits’: they all process LATEX identically, but there are some differences in size, speed, packaging, installation, support, and extra software provided.
One final thing before we start: always check to see if there is a more recent version of the installation program online. See the item ‘Use the latest versions’ for more details.
1.1 Unix and GNU/Linux
Users of modern GNU/Linux systems don't even need the TEX Collection DVD, as TEX installation packages are available online, built into the package manager for your system.
If your system has a graphical package manager (e.g.
Ubuntu's Software Center or
Synaptic, see Figure 1.1), run it and install
texlive-full,
ghostscript, gv,
okular, kile (or
texmaker or emacs), and
jabref. Some of them may already be
installed on your system. Go and have a cup of coffee while
they automatically install all the necessary components.
The new Ubuntu Software Centre
only allows one package to be installed at a time, so you may
prefer to use a typed command (other Linux users may prefer
this approach anyway). The command name varies from
distribution to distribution; but two common ones are
yum and
apt: or
$ sudo apt-get install texlive-full
ghostscript gv okular kile texmaker emacs jabref
$ sudo yum install texlive-full ghostscript gv
okular kile texmaker emacs jabref
Unfortunately, the Okular PDF/DVI viewer is new and incomplete: it prematurely replaced two older and much better-designed viewers, kdvi and kpdf; fortunately, at the time of writing, it is still possible to download those from different repositories and install them manually.
Unix and GNU/Linux installers
I strongly recommend this method for all GNU/Linux users. You should only install from the TEX Collection DVD if you are using an older, hand-built, or commercial Unix system which has no package manager. Installing from the TEX Collection DVD for Unix requires root privileges and a good understanding of Unix systems management, and is beyond the scope of this book.
There is a minor drawback: the Linux repository versions of TEX are usually a year out of date, because of the volunteer effort required to put them together. For new users this should not be a concern, as updates do not affect core facilities. If there are very recent packages you badly need, you can install them separately.
If you do decide to switch to the TEX Live DVD, make sure you completely uninstall the texlive-full package first, otherwise your system will get hopelessly confused.
After installation, run
texconfig (see Figure 1.2) in a terminal window to adjust your
local settings. This is a console utility, so type texconfig to adjust your personal
settings, or sudo texconfig to
adjust them system-wide. In the utility, use the arrow keys to
go up and down the options, and the TAB key to jump to (and
switch between) the OK, Cancel, and other
‘buttons’ at the foot of the screen.
The spacebar or the Enter key selects a menu item or button.
Most settings are correct as installed, but you might want to
change one of the following:
-
the first option, DEST, lets you specify whether you normally want to print straight onto the printer, or ‘print’ into a file (to attach to email or upload somewhere);
-
the default paper size (the PAPER option), if the installed size is not your most common one (A4 or Letter);
-
the printer resolution (the MODE option), where you can adjust your printer settings; this allows you to fine-tune it for, say, a typesetter that you want to send output to instead of your own printer;
-
in the DVIPS option you can adjust your printer OFFSET (left and top margins), which is useful for older, less accurate printers.
You may also need the REHASH option later on. It is used to update TEX's fast-find database (see step 4) after adding new or updated packages.
If your printer is a conventional home or office ink-jet
or laser printer, and is not shown, the LaserJet5 setting
(600dpi) is probably a good bet. While still in the utility,
you can test the margin settings by running the
testpage.tex document through LATEX by
typing latex testpage and
responding to the questions about paper size and double-sided
printing. Print the resulting .dvi file
with the command and adjust the margins in
texconfig if necessary.
$ dvips -f
testpage | lpr
1.2 Apple Mac OS X
Double-click the
MacTeX-
package in the yyyy-DVD.mpkgmactex folder of the
TEX Collection DVD (replace the
yyyy with the year of your distribution
as shown on the DVD sleeve). Install the package in the normal
Mac way by dragging the package icon onto the hard disk
icon.
When it's finished, open your Applications folder in the Finder and go to the TEX subfolder and drag TEXshop out onto your Dock. TEXshop is the editor front-end to MacTEX which you use for writing your documents.
Remember for future reference that your TEX local
folder is ~/Library/texmf : this
is where you install LATEX add-on packages, fonts,
etc.
If you are going to use Adobe Acrobat Reader instead of Preview, make sure you clear the font cache and set the resolution to the system default (112dpi) otherwise you may get very weird displays.
1.3 Microsoft Windows
If your system has auto-run enabled, inserting the TEX Collection DVD should start the setup program automatically (see Figure 1.1). Click on the Open proTeXt button to start.
If you have auto-run turned off, insert the
DVD, go to the protext folder, and
double-click on the Setup.exe
program as shown in Figure 1.2.
If you have downloaded the ProTEXt installation from
the TEX Users Group web site, unzip it into a temporary
folder and run the Setup.exe program from
there (see Figure 1.3).
-
Make sure you have Adobe Acrobat Reader or a similar PDF reader installed;
-
In the ProTEXt setup window, select your language and click on the MiKTEXInstall button (see Figure 1.1)
-
Click in the box to accept the MiKTEX licence and click Next to continue (Figure 1.1)
-
Make sure the Complete MiKTEX option is selected and click Next to continue (Figure 1.1)
-
Choose a private installation or one that everyone who uses your computer can use, and click Next to continue (Figure 1.1)
-
Accept the installation folder that MikTEX suggests (unless you are an expert or have a special disk setup) and click Next to continue (Figure 1.1)
-
In the Options screen (Figure 1.1), select your paper size (A4 or US Letter), and whether or not you want extra packages to be downloaded and installed automatically (Yes or No) — on a laptop where a network connection is not always present, choose Ask first instead, then click Next to continue
-
Finally, accept the settings as shown in Figure 1.1 (or change them by clicking Back), and then click Start to start the installation process
-
During installation, MiKTEX will list the files it is installing and show a progress bar (Figure 1.1)
-
When it is all done, click Finish (Figure 1.1)
Two more things to do: install the TEXmakerX editor, and add a personal package folder for additional downloads.
-
Go back to the proTEXt setup window and click on the TEXmakerXInstall button (see Figure 1.1). The TEXmakerX installation program will start: click Next to continue (Figure 1.1)
-
Select the language to use during installation and click OK to continue (Figure 1.1)
-
Click Next in the following screen to continue (Figure 1.1)
-
Accept the installation folder that TEXmakerX suggests (unless you are an expert or have a special disk setup) and click Next to continue (Figure 1.1)
-
Also accept the suggested location for the TEXmakerX shortcut and click Next to continue (Figure 1.1)
-
Finally, accept the settings as shown in Figure 1.1 (or change them by clicking Back), and then click Install to start the installation process
-
When it is all done, click Finish (Figure 1.1)
Although MiKTEX will automatically download and install package updates and additional packages for you, there are times when you may want to add a new package by hand — perhaps a private package from your company or institution that MiKTEX would not know about, or even one you are writing yourself. To do this, you need a personal package folder (known as a Personal TEX Tree), and you need to tell MiKTEX where to find it.
-
Open My Computer or whatever folder-browser you use, and create a new subfolder called
texmfin theC:drive or some suitable place within your working area as in . It's not important where you put it (although you should choose a sensible and obvious place) but it should be calledtexmf(all lowercase) and nothing else. -
Click the Start or Windows button and run the MiKTEX Options (maintenance) program (it should be shown right there among your recent programs).
-
Click the Roots tab and the Add button, and navigate in the window to the place where you created the
texmffolder above (Figure 1.1) -
Lastly, click on the General tab and tell MiKTEX to update it along with its other folders by clicking the Refresh FNDB button (Figure 1.1)
You need to click on the Refresh FNDB button any time you make changes to the contents of your Personal TEX Tree (the
texmffolder), otherwise MiKTEX will not be able to find the files.
MiKTEX and TEXnicCenter
If you plan on using the TEXnicCenter editor, you need to make sure when you install MiKTEX, that you make a careful note of the folder you install MiKTEX into (usually something like
C:\Program Files\MiKTeX 2.9\...) because you will need that later, when you run TEXnicCenter for the first time after installation. It should be something likeC:\Program Files\MiKTeX 2.9\miktex\bin(or a later version number, if time has moved on since I wrote this). You need to know this, because TEXnicCenter won't guess it for you.
1.4 Picking an Editor
One of the best features of TEX-based systems like LATEX is that they don't force you to use any particular editor or viewer: you can pick one that you're comfortable with.
One of the worst features (for a beginner) is not understanding this: many new users have never seen flexible or adaptable software before, and may be unfamiliar with the idea that you don't have to do what you're told: you can pick and choose.
Nevertheless, I'm solving this by edict for beginners here: unless you already have a pet editor or viewer, just use the one shown below. In the case of ProTEXt (Windows) and MacTEX (Macs) the editor is the one that comes with the distribution. Unix and GNU/Linux users always get a choice.
1.5 Installation problems
It's always annoying when a program that's supposed to install painlessly causes trouble, and none the more so when everyone else seems to have been able to install it without problems. I've installed TEX hundreds of times and very rarely had any difficulties, but these are a few of the occasions when I did.
- Bad hard disks
If you are using Microsoft Windows, you should run a scan and defragmentation of your hard disk[s] before you start. It should take under an hour on a modern machine unless you have a very large disk, but it may need overnight on an older machine. Clean your DVD drive if it has been in heavy use. TEX is made up of a very large number of very small files, so there is a lot of disk activity during an installation. Microsoft Windows runs very slowly when installing a lot of small files, so be patient.
On any system, if you are installing a new hard disk for your typesetting work, you have the chance to reformat it beforehand. Pick the smallest granularity (cluster size) possible, usually 1024 bytes (1Kb). This minimises the space needed for systems with a very large number of very small files like TEX has, and may help improve the speed and reliability of the system.
- Windows Registry errors
This only affects Microsoft Windows users. The Registry is where Microsoft wants software companies to store details of all the programs you install. Unfortunately the Registry is grossly abused by marketing departments to try and foist undesirable links on you, the user. You will see this with many commercial programs, where a particular type of file you've been able to double-click on for years suddenly runs a different program. Some programs install obsolete or broken copies of program libraries (DLL files), overwriting ones which were working perfectly. Worse, the viruses, trojans, and worms which typically infect unprotected Windows systems can leave unwanted links to web pages, or change some of the ways in which Windows operates. The overall effect can be that the whole machine slows down, or that files which are expected to do one thing do another. The best solution is a thorough Registry clean-out, using one of the many free or commercial programs available for the purpose.
- Use the latest versions
Before installing, check the CTAN web site (subdirectories of http://tug.ctan.org/tex-archive/systems/ named after the systems
protext,mactex, etc. for an updated copy of the installation program. This is calledMacTeX-for Macs, andyyyy-DVD.mpkgSetup.exefor Microsoft Windows. Just occasionally a bug slips through onto the production DVD, and although it's always fixed and notified on comp.text.tex, that's a high-volume newsgroup and even the sharpest eyes may miss an announcement.Unix and GNU/Linux users will always get the latest repository copy from their system's package manager, but this may not be the absolute latest copy of TEX (see the tip ‘Unix and GNU/Linux installers’ for why). If you are installing on Unix manually from the TEX Collection DVD instead, check on CTAN for an updated version of the file
install-tl.sh.- Stick to the defaults
Unless you're a computer scientist or a software engineer, I very strongly suggest you never change or fiddle with the default directories for installation. I know some of them look odd, but they're that way for a purpose, especially when it comes to avoiding folder names with spaces in them, like the notorious
C:\Program Files. Although most modern systems cope happily with spaces in filenames and directory names when using a graphical user interface, they are always A Bad Idea, especially for programs which can be run from scripts (TEX is one). Spaces and other non-alphanumeric characters should therefore be avoided like the plague (they are forbidden in web addresses [URIs] for the same very good reason: the people who designed them knew the pitfalls). It may look snazzier to put the installation inMy Cute $tuff, but please don't: you'll just make it harder to find, harder to fix problems, and more embarrassing if you have to explain it to someone else trying to help you.- 64-bit Windows
The MiKTEX distribution for Windows is a 32-bit program but it should install correctly on 64-bit Windows 7 systems. For safety, close down all other programs before starting the installation.
- Locked systems
If you want to install proTEXt on a computer in a lab or other group environment where the disk storage is locked down, and where the Administrator is unwilling or unavailable to install it for you, there are a couple of choices:
Install it on a USB stick that you can unplug and carry with you. That way your LATEX installation is always with you. If you use it on another computer where the USB device mounts as a different disk letter, you will need to configure it so that it can ‘see’ where it is in the directory system.
If you cannot install it at all, because the Windows Registry is also locked, and the Administrator is unwilling or unable to install it for you, you may be able to install it in a virtual container (eg Windows XP as a virtual image inside Windows 7). It will be slow, and it may be missing some facilities like alternate character sets, but it will execute.
Bear in mind that shared systems in large companies, universities, and similar organisations do usually prohibit software being installed by the user (you) because of security issues over viruses, support, maintenance, and other factors. If you feel your institution needs a network installation of LATEX, ask your Administrator or IT Centre to contact the TEX Users Group or any local use group (see this appendix), who may be able to help.


























