(Mathematical Toolset Series: TeX & LaTeX, Part 2 of 3)
LaTeX / TeX on Windows has had the rather unfortunate reputation of being difficult to install and use. But with the quality of today’s open source tools and references, this is no longer the case, and should not be a reason to deter you from trying it out.
This article takes you through the practical business of getting a LaTeX / TeX platform running on Windows, using free, open-source software. From downloading and installing, to providing reference materials and basic templates, this article should get you going quickly and provide a decent toolkit from which to build.
Note: All the steps in this article have been tested on Windows XP and Windows 7.
This is Part 2 in a series of three articles intended to give you all that you’ll need to begin working with LaTeX / TeX on Windows, using free, open-source software. If you’re not sure what LaTeX / TeX are, you may want to start with Part 1. If you have a preferred TeX platform already set-up and if you regularly use LaTeX, you may want to skip to Part 3.
Setting up LaTeX / TeX on Windows
LaTeX / TeX on Windows has had the rather unfortunate reputation of being difficult to install and use. But with the quality of today’s open source tools and references, this is no longer the case, and should not be a reason to deter you from trying it out.
Here’s a preview of the process.
- Step 1: You’ll obtain and install the various software tools that comprise a LaTeX / TeX platform. For this you’ll need a reasonable swift download connection to the internet. Unfortunately, a dial-up connection probably won’t cut the mustard.
- Step 2: There will be a minimal bit of configuration you’ll make, after which you’ll be ready for a test run!
- Step 3: Exercise your platform by producing your first PDF document using a basic template file. I’ve included a test file / basic template file that you can use to immediately get started, and to check that everything is working properly.
- Step 4: Collect the ready references materials you’ll need. I’ll point you to a collection of ready reference materials — the kind you can call up in a pinch to remind yourself of a particular command: short and sweet. Keep in mind: You’ll be using the very pleasant TeXnic Center for your document composition, so you’ll have before you most of the reminders that you’ll need, as well as their good reference material. I’ll also point you to the more full bodied references, the kind that are meant for a nice sit down read.
That’s it! So let’s get you started.
Step 1: Downloading and Installing the Components
1a. Download MiKTeX. This is the distribution of LaTeX / TeX that you’ll be using. The MiKTeX distribution has built into it the most common packages you’ll need, including AMS-TeX, BibTeX, as well as facilities for producing PDF, PostScript, or DVI document outputs. You won’t actually interact with MiKTeK — but it will provide all the required back-end facilities.
- Click the latest version under the Download sidebar on the left: MiKTeX 2.8 as of this writing.
- Scroll down and click the Download button next to “Basic MiKTeK 2.8″ Installer (or whatever is that latest version at the time you’re reading this.)
Be warned: MiKTeX is a LARGE download: 110 MB for the basic installation. You will need to have a fast internet connection: broadband or cable. On a reasonable internet connection with a nominal download speed of 750KB/sec, this takes about 3 minutes to download.1
- Run the MiKTeX Installer, noting the following recommended settings as you proceed:
- Accept the copying condition (nothing alarming here)
- Install for anyone… (less hassle if you have multiple user accounts on your machine)
- NOTE WHERE the software is being installed (you’ll need to know this to configure TeXnicCenter)
- Choose your preferred paper (e.g. A4 in UK, Letter in US)
- Install missing packages on the fly: Yes (easier if you’re new to MiKTeX)
- Start the install. It may take several minutes.
1b. Download GhostScript from here and GhostView as a 32-bit X86 Windows executable from here.
Ghostscript is an interpreter for the PostScript page description language used by laser printers. GSview is a graphical interface for Ghostscript that allows PostScript pages to be viewed or printed.
- Install both programs using their default settings.
- In particular, NOTE DOWN the path where the programs are being installed. You’ll need to know this to configure TeXnicCenter in Step 1d. If you keep the default settings (recommended), GhostScript and GhostView will be installed, respectively, to paths that look something like this:
- c:\Program Files\gs
- c:\Program Files\Ghostgum\gsview
1c. Downloading a free PDF Viewer that is better than Adobe Acrobat (Optional but Highly Recommended) You will need a PDF Viewer. Most computers have Adobe Acrobat Reader pre-installed. However, consider trying PDF Xchange Viewer. It is free, is much faster than Adobe’s Reader, and has a host of annotating, editing, and other features that you have to pay quite heavily for in Adobe’s non-free software.
- You can download PDF Xchange Viewer from here. Look on the right-hand side-bar, and choose the EXE installer option.
- Install PDF Xchange Viewer using the default installation settings EXCEPT on the LAST page of the installer:
- Important Note: on the last page of the installer you are asked whether you wish to install the Ask Search toolbar. Suggestion: Decline this. It is a “partner product” that is not in any way related to the PDF Viewer you want.
1d. Download TeXnicCenter from here. TeXnicCenter is a pleasant visually oriented environment, also called an IDE — Integrated Development Environment. You’ll almost certainly want to be composing your documents here, unless you are seasoned with the LaTeX toolchain and have strong reasons why the convenience of an integrated development environment is not preferable.
- Run the TeXnicCenter Installer, noting the following recommended settings as you proceed:
- Keep the default selections, including “Custom” package, which contains everything
- Under “Additional Tasks”, select the checkbox “Add TeXnicCenter to the Send menu”
Summary / Check
This completes the installation step. You should now have installed on your computer four (or optionally five) applications:
- MiKTeX (TeX/LaTeX distribution),
- GhostScript (PostScript and PDF engine),
- GhostView (Postscript viewer),
- (optionally), PDF Xchange Viewer (free, fast, feature rich PDF Viewer), and, finally,
- TeXnicCenter (LaTeX Document preparation environment).
Step Two: Configuring TeXnic Center
To give your new TeX editor setup a whirl:
- Fire up TeXnic Center (use the Desktop shortcut, or the Start menu).
- After a Startup Tip is shown, the Configuration Wizard will be brought up automatically. Go through the configuration step as follows:
- When prompted with: “Enter the full path of the directory where the executables (latex, tex, etc.) of your TeX distribution are located”, you should: Browse for the MiKTeX binaries folder. This will typically be at:
c:\Program Files\MiKTeX 2.8\miktex\bin\ - If you installed PDF Xchange Viewer in Step 1c. above, you may be prompted to enter additional optional settings for PDF viewing. You can ignore this and simply click Next.
- Armed with this information, TeXnicCenter will automatically create the main output profiles for you to create DVI, PS, and PDF documents.2
If everything has gone ok up to this point, great! You’re ready for Step 3.
Step Three: Typesetting and producing your first document
- In TeXnic Center, start a new document: File > New.
Copy and paste the following “Hello World!” code into your new LaTeX document and save it somewhere. (Or can download it from here.)
% A minimal test template for the LaTeX / Tex platform
\documentclass{article}
\begin{document}
Hello World! This is a test.A tribute to Leonhard Euler:
$$-e^{i \pi} = 1$$
\end{document}
- Choose the LaTeX => PDF output profile (Figure 1).
- You’re ready to build the document and to view the result. There are several ways to go about this. For now, let’s use the quickest way (assuming there are no problems3): Ctrl+Shift+F5 is the keyboard shortcut for Build and View. There is also a toolbar icon (Figure 2) and a menu command: Build > Build and View Output.
- You should see a PDF that looks something like this.
If everything’s gone right, you’re ready to strike out on your own. The test code above was minimal. You’ll need a template.
- Here’s the source code for the basic template (listed below), which is adequate for getting started with. When you compile it, you should get a PDF that looks like this.
The basic template code listing is below, for reference.
% Basic Template for using LaTeX
% Assad Ebrahim
% Aug 4, 2008
% ------------------------------\documentclass{article}
\title{Basic Template: Your Title Here}
\author{Your Name Here}
\date{\today}% For more advanced usage, you'll list packages and other document formatting commands here
\begin{document}
\maketitle
\tableofcontents
%\newpage % if you want the title page on its own% vvvvvvvvvvvvvvvvvvvvvvv Your Text starts below here vvvvvvvvvvvvvv
\section{A Basic Template}
Hello Mathematical World!Let's take a look at some simple \TeX.
\paragraph{A tribute to L. Euler}
The following displayed equation expresses a profound insight that unifies geometry, trigonometry, analysis, and complex variables.
$$-e^{i \pi} = 1.$$\paragraph{A question of class}
Let's illustrate the use of mathematical symbols and footnotes.Is $\pi^{\sqrt{2}}$ algebraic\footnote{A number is algebraic if it is the root of a polynomial with rational coefficients. Algebraic numbers include the rationals but also selected irrationals such as $\sqrt{2}, \sqrt[3]{2}$, and in general $\sqrt[n]{p}$ for any prime number $p$ and any positive integer $n$.} or transcendental\footnote{A number is transcendental if it is not algebraic, i.e. if it is irrational and is not the solution to any polynomial with rational coefficients. Examples are $\pi$ and $e$.}? (See the footnotes for an explanation.)
% ^^^^^^^^^^^^^^^^^^ Your Text ends above here ^^^^^^^^^^^^^^^^^^^^^^^^^^^
\end{document}
Step Four: Get your LaTeX reference sheets and resource links.
- 2 page LaTeX Reference Card / Cheat Sheet (PDF) (Thanks to Winston Chang)
- Symbols List (on the web)
- Listing of Mathematical Symbols (PDF)
- Short Guide to Math in LaTeX (using AMS-TeX) (PDF document)
- BibTeX entries reference sheet
Comprehensive References
Advanced Tippery
Here are a few places that offer valuable advanced tips, tricks, and exceedingly useful little routines, organized by category:
- Preserving Your Sanity and Your Time: Good Practises in Modular Document Development with LaTeX
- A number of advanced tips and tricks, including:
- Keeping your code inclusions OUT of LaTeX documents (Dynamically Including Program Listings)
- Rotating Tables and Figures to fit without cutting off the edge
- Typesetting Mathematics Easily with AMS-LATEX
- Text inside Mathematics Displays with AMS-LATEX and \text{ }
Getting Help
There are many things that one may want to do in LaTeX that are not obvious. Perhaps the quickest route to finding out is to run a Google Search.
If all else fails, there are communities where you can ask questions and have good hope of a swift and correct answer:
- Stack Overflow — LaTeX Topic This is a site where intelligent questions can get answers in less than a minute. There are hundreds of thousands of smart eyeballs trolling through the lists on Stack Overflow. You can ask a question without registering or becoming a member, so it’s easy to participate.4
Happy TeX-ing!
With this introduction, you are hopefully on your way to using LaTeX / TeX for your technical document preparations needs.
When you’re ready for more, I’d suggest reading the final article in this series and recommend using some sort of modular scheme for organizing the components of your LaTeX documents. The final article explains the modular approach to document development that may help to make your TeX-ing easier to manage and more efficient. Perhaps more importantly, you’ll find there a collection of modular templates to get you started.
Happy TeX-ing!
>> Continue reading: Part 1: LaTeX / TeX: Professional Grade Typesetting for Scientific Writing
>> Continue reading: Part 3: Thinking Modular in TeX
Footnotes
- A dial-up connection will probably not cut it. You can expect 2 hours or more, assuming an actual and uninterrupted download rate of 20KBps, a reasonable assumption for a typical modem. ↩
- For your reference:
- the DVI viewer is YAP. It is located in the MiKTeX folder, typically:
c:\Program Files\MiKTeX 2.8\miktex\bin\yap.exe - the PostScript viewer is GS View. It is located, typically:
c:\Program Files\Ghostgum\gsview\gsview32.exe - the PDF viewer should automatically be your currently installed PDF Viewer. (If you don’t have one, download Adobe’s Acrobat Reader from their website. Better yet, consider PDF Xchange Viewer, also free, much faster, and much more capable than Acrobat Reader.)
- the DVI viewer is YAP. It is located in the MiKTeX folder, typically:
- If there are problems, then go through the Build and View steps separately:
- To build: Use either the menu command Build > Build Output, or the toolbar icon (Figure 2), or the keyboard shortcut Ctrl+F7.
- In the Output Window, you should see the last line as shown — 0 Errors, 0 Bad Boxes, 1 Page.
If you see this, it means that there are no problems with the document, and 1 page of PDF output has been created. - Click the View toolbar icon (Figure 3), or the keyboard shortcut F5 to bring up the PDF output in your default PDF viewer.
- Although Stack Overflow is a site for questions on Programming, LaTeX is as much “programming” as HTML (both are mark-up languages). Certainly it shares much more in common with programming (and the programming community) than with “WYSIWYG” applications such as Microsoft Word or Sun’s Office Writer and their user communities. ↩
