An Open Source LaTeX / TeX Platform for Windows

(Mathematical Toolset Series: TeX & LaTeX, Part 2 of 3)

EDIT: 25.Oct.2015 – improved templates added.

You can get started with LaTeX / TeX on Windows within an hour. This article walks you through setting up a working platform, provides basic templates for you to produce your first PDF document, and points you to reference materials you may find useful as you advance. The instructions below have been tested against WinXP, Win7, and now Win8.

This is Part 2 of 3 in a series. If you’re not sure what LaTeX / TeX is, start with Part 1. If you have a preferred TeX platform already set-up, you may want to skip ahead to Part 3.

Setting up LaTeX / TeX on Windows

High quality, free versions of LaTeX / TeX are now reasonably easy to set up on Windows, so if you’ve never used LaTeX, it is worth trying out. For best results, set aside an hour and follow the instructions carefully.

Warning, this is one situation where it is worth going step by step. It will be easier to configure correctly the first time rather than troubleshoot problems later.

Overview

The final section provides a working template to produce a reasonable first PDF document as well as a collection of useful references — the kind you can call up in a pinch to remind yourself of a particular command or technique. Note, using TeXnic Center to compose your documents means many references will be readily to hand.

Let’s get started!

Step 1: Download & install MiKTex, GhostScript, GhostView, PDF Xchange (optional), and TeXnicCenter

1a. Install MiKTeX.

Download the latest version of MiKTeX from here. Choose from 32- or 64-bit versions. The Basic 32-bit version is fine for all machines. (If you want to be able to move your installation between machines by simply copying the directory, then you may want the Portable version.) Note that at 170MB, MiKTeX is a large download, this so may take several minutes. This article has been tested with MikTeX 2.9.

What is MiKTeX? In TeX terminology, MiKTeX is the TeX distribution that you’ll be using. Why MiKTeX? It is one of the comprehensive distributions of TeX, i.e. it has built into it the most common packages you’ll need including facilities for producing PDF, PostScript, or DVI document outputs and contains the most common packages such as AMS-TeX and BibTeX. Note, you won’t actually interact with MiKTeK. It is the foundation layer and provides all the required back-end facilities. Your interactions will typically be with TeXnic Center.

1. Run the MiKTeX Installer and follow along below:
2. Accept the copying condition (nothing alarming here)
3. Install for anyone… (less hassle if you have multiple user accounts on your machine)
4. NOTE WHERE the software is being installed (you’ll need to know this to configure TeXnicCenter)
If you keep the default settings (recommended), MikTeX will be installed to

• C:\Program Files (x86)\MiKTeX 2.9
5. Choose your preferred paper (e.g. A4 in UK, Letter in US)
6. Yes, install missing packages on the fly (easier if you’re new to MiKTeX)
7. Start the install. It may take several minutes.

1b. Install GhostScript & GhostView

Download GhostScript as a 32-bit Windows executable from here. GhostScript is an interpreter for the PostScript page description language used by laser printers.

Download GhostView as a 32-bit Windows executable from here. GhostView is a graphical interface for GhostScript that allows PostScript pages to be viewed or printed.

Note: if you want the 64-bit versions of the programs, go to each program’s downloads page: GhostScript, GhostView

1. Install both programs: first GhostScript (gs904w32), then GhostView (gsv50w32). Keep all default settings checked.
2. In particular, NOTE DOWN the paths where the programs are being installed. You’ll need to know these to configure TeXnicCenter in Step 1e. If you keep the default settings (recommended), GhostScript and GhostView will be installed, respectively, to paths like this:
• C:\Program Files (x86)\gs\gs9.04
• C:\Program Files (x86)\Ghostgum

1c. You will need a PDF Viewer. Most computers have Adobe Acrobat Reader pre-installed. However, I recommend the free PDF Xchange Viewer as it is (in my opinion) smaller, faster, and has better annotation/highlighting/editing functionality than the clunkier Adobe Acrobat reader.

1. You can download PDF Xchange Viewer from here. Look on the right-hand side-bar, and choose the EXE installer option.
2. Install PDF Xchange Viewer using the default installation settings EXCEPT on the LAST page of the installer:
3. 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 2.0 from here.(Again, you have a choice of 32- or 64-bit versions; 32-bit works for all machines.) TeXnicCenter is a visual editor (IDE) for composing your TeX documents.

1. Run the TeXnicCenter Installer, noting the following recommended settings as you proceed:
2. Keep the default selections, including installing the “Typical” package, which contains everything
3. (optional) Under “Additional Tasks”, select the checkbox “Add TeXnicCenter to the Send menu” — this makes it easier to right-click on a TeX file and open it up in TeXnicCenter…

Summary / Check
This completes the installation step. You should now have installed on your computer the following applications:

1. MiKTeX (TeX/LaTeX distribution),
2. GhostScript (PostScript and PDF engine),
3. GhostView (Postscript viewer),
4. (optionally), PDF Xchange Viewer (free, fast, feature rich PDF Viewer), and, finally,
5. TeXnicCenter (LaTeX Document preparation environment).

Step Two: Configuring TeXnic Center

Let’s setup your new TeX editor:

1. Fire up TeXnic Center (use the Desktop shortcut, or the Start menu).
2. After a Startup Tip is shown, the Configuration Wizard will be brought up automatically. Go through the configuration step as follows:
3. 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 (x86)\MiKTeX 2.9\miktex\bin

4. You may then be prompted for a DVI viewer: the DVI viewer is YAP. It is located in the MiKTeX folder, typically here:
c:\Program Files (x86)\MiKTeX 2.9\miktex\bin\yap.exe

5. There may also be a prompt for a PostScript viewer – choose GS View. It is typically located here:
c:\Program Files\Ghostgum\gsview\gsview32.exe

6. Finally, you may be asked for a PDF Viewer. Note: If you installed PDF Xchange Viewer in Step 1c. above, this should already be filled in. Otherwise, you should provide the installation location for your PDF Viewer.1 (If you are prompted to enter additional optional settings for PDF viewing, you can safely ignore these and just click Next.)

TeXnicCenter will now create the main output profiles for you to create DVI, PS, and PDF documents.

If everything has gone ok up to this point, you’re ready to start producing documents.

Step Three: Typesetting and producing your first document

1. In TeXnic Center, start a new document: File > New > File…

Copy and paste the following “Hello World!” code into your new LaTeX document and save it somewhere. (Or you can download it from here.)

% Minimal template for LaTeX / TeX \documentclass{article} \begin{document} Hello World! This is a test.

 

A remarkable equation of Leonhard Euler: $$-e^{i \pi} = 1$$ \end{document} 

2. Choose the LaTeX => PDF output profile from the drop-down control in the toolbar.
3. Save the file to a working directory of your choice. The final PDF will then be written to the same directory.
4. “Build” and “View” the document. The quickest way is with keyboard shortcut Ctrl+Shift+F5. You can also use the toolbar icon (Figure) or the Menu command: Build > Build and View Output. As the Build process is running, you’ll see a stream of commentary in the Output pane. What you care about is the result at the end of the process, hopefully:
LaTeX-Result: 0 Error(s), 0 Warning(s), 0 Bad Box(es), 1 Page(s)

The first time you use TeX, the Build and View step may take up to 30 seconds while TeXnicCenter loads up all of the modules that it needs. After this, the process should be quick.

Assuming there are no errors, you should see a PDF appear that looks like this.

Otherwise try doing the Build and View steps separately:

1. Build using the menu command Build > Build Output, the toolbar icon (Figure 2), or the keyboard shortcut Ctrl+F7.
2. Verify in the Output Window that the last line is shown with 0 Errors, 0 Bad Boxes, 1 Page. If you see this, it means that there were no problems in producing the document, and 1 page of PDF output has been created.
3. Click the View toolbar icon (Figure 3), or keyboard shortcut F5 to load PDF output file into your default PDF viewer.

If you’re using PDF Xchange Viwer, you’ll need to change the default PDF Viewer using the Menu command: Build > Define Output Profiles… > Viewer Tab. Set View project output to Command line argument and enter %bm.pdf. Set the Forward search command line argument and leave the box blank. Set the close option to Do not close. Click OK. Recompile (Ctrl+Shift+F5) and verify that a PDF pops up at the end of the compilation.

If it all works, give yourself a pat on the back. You’ve finished the configuration. The rest of the document will equip you with what you need to continue.

Working Template: A Richer Example

The test code given above was minimal. Once you have gotten this working, you’ll need a richer template to be able to produce basic documents.

A better template for writing mathematical documents in TeX, shown below, produces a PDF like this.

% Working Template for LaTeX / TeX (AKE, 4.Aug.2008) \documentclass[10pt, a4paper]{article} % == packages \usepackage{amssymb} % AMS maths symbology \usepackage{amsfonts} % math fonts, e.g. $\mathbb{Z}$ for integers \usepackage{amsmath} % \eqref, \binom, and more \usepackage{graphicx} % include graphics with \includegraphics{file.eps} \usepackage{wrapfig} % wrap following text around previous figure \usepackage[pass]{geometry} % allows changing margins within document \newgeometry{top=2.5cm,bottom=2.3cm,left=2.5cm,right=2.3cm} % better margins technical content

 % == definitions \newtheorem{theorem}{Theorem} \newtheorem{proposition}[theorem]{Proposition} \newtheorem{lemma}[theorem]{Lemma} \newtheorem{definition}[theorem]{Definition} \newtheorem{proof}[theorem]{Proof} \newcommand{\qed}{\ensuremath{_\blacksquare}} %for end of proof symbol \begin{document} \title{Mock Paper (or your title here)} \author{J.Doe (or your name here)} \date{August 4, 2008 (or /today)} \maketitle \tableofcontents %\newpage % uncomment to have title on its own page % === Put your document text below \section{Getting Started} Hello! Let's kick the tires on your \TeX installation. \paragraph{Bits and Pieces} With \TeX\ it's easy to use mathematical symbols. \paragraph{Example 1} This remarkable equation of Leonhard Euler, $$-e^{i \pi} = 1,$$ unifies geometry, trigonometry, analysis, and complex variables. \paragraph{Example 2} Is $\pi^{\sqrt{2}}$ algebraic or transcendental? 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$. 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$. 

% === End \end{document} 

Compiling this should give you a taste of what you can achieve using TeX.

With a little practice, it is remarkable what you can do, freeing up more time to work on your content and less time spent on formatting.

A collection of snippets may be useful.

LaTeX reference sheets and resource links.

Rapid References

Comprehensive References

Here are a few places that offer valuable advanced tips, tricks, and exceedingly useful little routines, organized by category:

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.2

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

1. If you don’t have a PDF Viewer, 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.
2. 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.

1 comment to An Open Source LaTeX / TeX Platform for Windows

• I’ve been exploring for a little bit for any high-quality articles or blog
posts in this sort of area . Exploring in Yahoo I eventually stumbled upon this
site. Studying this information I am happy to say that I came upon just
what I needed.