The purpose of this article is to outline in concise form the steps required to install and configure a full LaTeX distribution from scratch up to the point of editing documents in LaTeX on a Windows PC. Furthermore, I will show you how to integrate the LaTeX editor with the PDF viewer to enable you to switch seamlessly between them while creating your documents.
The LaTeX editor employed here is the free open source TeXnicCenter editor which provides all the functionality you need to create, write, build, view and print your LaTeX documents.
Please ensure you have a PDF viewer already installed before commencing the steps below. This article will provide instructions on how to configure and integrate two PDF viewers with our LaTeX editor: the free open source PDF viewer Sumatra PDF and the freeware Adobe Acrobat Reader. You may install either one (or both if you wish).
This article provides instructions for the following platforms: Windows XP, Windows Vista and Windows 7.
- Download and run the free open source MiKTeX Net Installer setup-2.X.xxxx.exe from the MiKteX download page. The MiKTeX installation consists of two phases: the first phase will download the MiKTeX distribution to your PC, the second phase will perform the actual installation. Once the download operation has finished, the first phase is complete and you are ready to install MiKTeX. It is recommended to download the latest stable version. At the time of writing, the latest stable version is 2.9.
- To perform the second phase of the installation, start Windows Explorer and browse to the directory which contains the complete MiKTeX distribution (where you downloaded it). Look for a file named setup.exe. This is the MiKTeX Setup application. Run setup.exe by double-clicking its icon. When asked to select a repository folder, select the location of the downloaded MiKTeX distribution. Please be patient as the installation may take quite some time to complete.
- Update the MiKTeX Installation:
From the Start menu,- On Windows XP:
select Start | Programs | MiKTeX 2.X | Update - On Windows Vista or Windows 7:
select Start | Programs | MiKTeX 2.X | Maintenance (Admin) | Update (Admin)
- Select the option:
I want to get updated packages from a remote package repository
and the option:
Let me choose a remote package repository
and select the repository nearest you. - Follow the onscreen instructions.
- On Windows XP:
- Update the MiKTeX Package Manager:
From the Start menu,- On Windows XP:
select Start | Programs | MiKTeX 2.X | Settings - On Windows Vista or Windows 7:
select Start | Programs | MiKTeX 2.X | Maintenance (Admin) | Settings (Admin) - Select the option Refresh FNDB
- Select the option Update Formats
- Exit the application by clicking Ok.
- On Windows XP:
- Install TeXnicCenter:
- Download the latest version of TeXnicCenter from http://www.texniccenter.org
- Run the TeXnicCenter installer and follow the onscreen instructions.
- Configure TeXnicCenter’s initial settings:
- When running TeXnicCenter for the first time, follow the onscreen instructions.
- Close and rerun TeXnicCenter.
- Select Tools | Options | Editor Tab
Enable display line numbers
- If you are running Windows Vista or Windows 7:
- Configure the TeXnicCenter application to run as an administrator.
- Configure the TeXnicCenter application to run in compatibility mode: Windows XP SP3.
- If you will use Sumatra PDF as your PDF viewer, configure the Sumatra PDF application to run in compatibility mode: Windows XP SP3.
- A brief explanation of terminology concerning Integration features between TeXnicCenter and the PDF viewers is now required.
Several PDF viewers support the concept of Forward-Search and Inverse-Search.- What is Forward-Search?: When compiling (generating PDF output) your LaTeX source document in TeXnicCenter, Forward-Search enables the current editing location in the source latex file to be displayed and highlighted in the generated PDF. For example, if you are editing text that appears on page 8 of the PDF; after compiling the LaTeX source, the PDF viewer will open the document and jump directly to page 8 to display the text you have just edited. This is a great timesaver. The communication between the editor and PDF viewer often relies on the DDE protocol.
- What is Inverse-Search?: Inverse-Search is a synchronisation feature whereby doubling-clicking on a line in the PDF document will switch to the LaTeX editor and display the corresponding line in the document source. Again, another great timesaver.
- Adobe Reader and Adobe Acrobat:
Forward-Search and Inverse-Search may not work with adobe Reader version 8 or higher (i.e.: all recent versions). - Sumatra PDF Viewer:
Forward-Search and Inverse-Search function correctly using Sumatra PDF on Windows XP SP3, Windows Vista and Windows 7. This author’s preference is to use the Sumatra PDF viewer to view the document during the creation and editing phases, and only use Adobe Reader to view the final completed document to verify the final document version appears correctly when viewed with Adobe Reader.
Note 1: At present (TeXnicCenter v1.0 and Sumatra V1.3), forward search only works if the file name and entire file path do not contain spaces!
Note 2: Be aware that cutting and pasting the configuration information that appears in the subsequent steps from this webpage directly into the TeXnicCenter configuration panel may not work. The double-quotes (and single-quotes) are often misrepresented.
- To configure TeXnicCenter to view document output using Adobe Reader:
- Run TeXnicCenter.
- Select Build | Define Output Profiles | Viewer Tab
- Ensure the profile selected is LaTeX => PDF
For both View Project’s Output and Forward Search options, enter the following:- Enable DDE
- Command: [DocOpen(“%bm.pdf”)][FileOpen(“%bm.pdf”)]
- Server: acroview
- Topic: control
- For Close Document before running LaTeX:
- Enable DDE
- Command: [DocClose(“%bm.pdf”)]
- Server: acroview
- Topic: control
- To configure TeXnicCenter to view document output using Sumatra PDF:
The Sumatra PDF viewer integrates nicely with TeXnicCenter supporting both forward-search and inverse-search.- Run TeXnicCenter.
- Select Build | Define Output Profiles | (La)Tex Tab
- Select Add to add a new profile.
Enter the profile name: Latex => PDF (Sumatra)
- Select Add to add a new profile.
- Under the (La)TeX Tab
- Select the checkbox: Run (La)TeX compiler
- Path to the latex compiler:
C:\software\MiKTeX 2.8\miktex\bin\pdflatex.exe
Note: The path references may be different on your computer. - Command line arguments to pass to the compiler:
-interaction=nonstopmode “%pm” -synctex=-1
- Path to the latex compiler:
- Unselect the checkbox: Do not use BibTeX in this profile
- Path to BibTeX executable:
C:\software\MiKTeX 2.8\miktex\bin\bibtex.exe - Command lne arguments to pass to BibTeX:
“%bm”
- Path to BibTeX executable:
- Unselect the checkbox: MakeIndex
- Path to MakeIndex executable:
C:\software\MiKTeX 2.8\miktex
\bin\makeindex.exe
Note: The path should be on one line, I split the path here to ensure it displays clearly. There should be no space at the line break between miktex and \bin. - Command line arguments to pass to MakeIndex:
“%bm”
- Path to MakeIndex executable:
- Select the checkbox: Run (La)TeX compiler
- The Postprocessor tab may be left blank.
- Under the Viewer Tab:
- Path to executable:
C:\software\SumatraPDF\SumatraPDF.exe
-inverse-search “\”C:\software\TeXnicCenter\TEXCNTR.EXE\”
/ddecmd \”[goto(‘%f’,’%l’)]\””
Note: The path should be on one line, I split the path here to ensure it displays clearly. There should be a space inserted at the position of the line breaks:
- one space after SumatraPDF.EXE
- another space after TEXCNTR.EXE\“
- For View project’s output:
- Enable Command line argument
- Command: “%bm.pdf”
- For Forward Search:
- Enable DDE command:
- Command: [ForwardSearch(“%bm.pdf”,”%Wc”,%l,0)]
- Server: sumatra
- Topic: control
- For Close document before running (La)Tex
- Enable Do not close.
- Path to executable:
- Well Done! You are now ready to create beautifully typesetted PDF documents. Enjoy!