Ask Your Question

How to setup latex environment in Windows

Posted on: October 14, 2008

Must read notice: Geekish Post….Only for geeks šŸ˜€

Do you need to write your first thesis paper or do you want your publication published in a famous journal?

So LaTeX is for you. LaTeX is a document preparation system for high-quality typesetting based on Donald E. Knuth’s TeX typesetting language or certain extensions. It is most often used for medium-to-large technical or scientific documents but it can be used for almost any form of publishing.

Well, definitely *NIX systems have built-in latex support, but in windows you need to set it up for yourself. As few monthes ago I have started writting my first thesis paper using latex and for some reason I have used windows system, I need to setup latex environment in windows. Definitely a annoying, time consuming task, So I have decided to share it šŸ™‚

I am going to describe it step by step, please follow these steps as described, its important. I am assuming you have Windows XP or later versions and you have administrative privilege.

Step 1:: Setting Up Environment

  • Right-click on the “My computer” icon and choose Properties. Select the “Advanced” tab.Then click on “Environment Variables”.
  • Create a “user variable” called “DICTDIR” with value “c:\usr\local\lib“. [ To create a new user variable, just hit “New” under “User variables for <System User Name> or to edit an existing one just hit Edit ]
  • Create a “user variable” called “HOME” with value “c:\
  • Create a “System variable” under “System variables” called “Path” with the value c:\program files\emacs\bin;c:\program files\MiKTeX 2.7\miktex\bin;c:\program files\ghostgum\ghostview\gsview\;c:\usr\local\bin;c:\program files\ghostgum\gs\gs8.51\lib;c:\program files\ghostgum\gs\gs8.51\bin [There is a huge possibility that this variable is already there. In that case, just append the value]
  • A restart of your system may be required.
  • Run command prompt and type “set” to check if all these variables with their required values are set.

Step 2:: Required Software

Step 3::Installation

  • Put the .emacs file [you will get it after unzipping file] in C: [or your predefined HOME]
  • As Local TexMF Tree, create a directory named “Local TeX Files” in C: [or your predefined HOME]
  • Unzip to c:\program files\ . Rename the c:\program files\emacs-22.3 directory to c:\program files\emac. Run the file c:\program files\emacs\bin\addpm.exe.
  • Unzip to c:\program files\emacs\site-lisp.Ā  Rename c:\program files\emacs\site-lisp\auctex-11.85-e22 to c:\program files\emacs\site-lisp\auctex.
  • Run gs863w32.exe. Choose c:\program files\ghostgum\gs as installation directory. Accept everything else.
  • Run gsv49w32.exe. Choose c:\program files\ghostgum\ghostview as installation directory. Accept everything else.
  • Run basic-miktex-2.7.3164.exe. When prompted for “Path to installation folder”, choose c:\Program Files\MiKTeX 2.7. When prompted for “Create local TEXMF tree”, choose c:\Local TeX Files as “Path to root folder”. Accept everything else.

Step 4:: Opening Emacs in Latex Mode

  • Type M-x latex-mode. As soon as you hit “Enter” after writing the command, you will notice “Command” and “LaTeX” menus.

Step 5:: Compiling Latex Files in Emacs

  • Press C-c C-c <Return> to run latex.
  • Press C-c C-l to view results of the compilation
  • Press C-c C-c <Return> to run latex again
  • Press C-c C-c <Return> to run latex again, again
  • Press C-c C-c <Return> to run View. It will take a while to create fonts etc. the first time.
  • Press C-c C-c FILE <Return> <Return> to run dvips (Note that the command is FILE and not Dvips as one might expect)
  • Press C-c C-c Print <Return> <Return> to run GSview (Also somewhat misleading name)
  • If you want to print the document, do it from GSview.

A million dollar secret, when you asked to do the following, use your brain šŸ™‚

  • C-c C-c = Hold CTRL while pressing c twice
  • C-c C-l = Hold CTRL while pressing c, release c, While holding CTRL, press l (“ell”), release both
  • M-x = Hold ALT while pressing x

And last but not the least, download Basic Latex Commands. This pdf file will help you to learn basic latex commands.

So start writting your thesis šŸ™‚


4 Responses to "How to setup latex environment in Windows"

I’m using Windows XP, and I followed all the above steps. When I compile a latex file C-c C-c works properly, but when I try to view it C-c C-l I get “No process for this document”. So I think emacs cannot open the viewer. Do you have any ideas what I could do?



You need to make sure the file has a .tex extension on it so that emacs recognizes that it is a latex file.


@Lon, Sorry I was away from blogging for a long time, so couldn’t answer your question.

@Smalltime:, Thanks.

Great article, Thanks for your great information, the content is quiet interesting. I will be waiting for your next post.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


I am in Jaflong

Ask Your Question is my blog about sharing knowledge in technical subjects that float my boat.

More about me | Why this blog

So far I get

  • 13,198 hits
%d bloggers like this: