Math software for Windows

Installation and Usage Tips for
Miktex and TeXnicCenter

Version of 17 Aug 2008.


General comments about installation

Miktex and TeXnicCenter (hereafter abbreviated TxC) were designed by different people, but normally they interact together pretty well. You should install Miktex first. It will ask you whether you use Letter or A4 paper for your printing. You can always change that later, but it will be easier for you if you get it right the first time. (In case you don't know the terminology, here it is: "Letter" size is the paper used in the USA, size 8.5 by 14 inches. "A4" paper is the size used in much of Europe, size 210 × 297 mm.)

Then check where its files have been installed. If you're using a recent installation, you'll probably find all its files in the directory C:\Program Files\MiKTeX 2.7 and its various subdirectories. In particular, most of its executables are in the directory

C:\Program Files\MiKTeX 2.7\miktex\bin.
Verify that. If that is not the case on your computer, figure out what is the correct answer, so that you'll be prepared for the questions below.

Next, I would recommend that you install Ghostscript (first) and Gsview (second). These are discussed on another page. After you've installed these, check where Gsview is installed on your computer; you'll need that information in a few minutes. On my computer, it is located at "C:\Program Files\Ghostgum\gsview\gsview32.exe".

Next, install TxC. (I don't know about your computer, but on mine, TxC installed properly and then the computer crashed. However, when I restarted the computer, everything was okay, including TxC.) The following instructions are for TxC version 1b7.50, which installs more easily than earlier versions. The first time you run TxC, it will run its Configuration Wizard, to set itself up. It will ask you a few questions. Following are some answers.

Next, turn on the spellchecker if you want to use it. In TxC, go to "Tools" "Options" "Spelling" and check the box labeled "Check spelling while typing." It will complain initially because you don't already have a personal dictionary, and then it will create one; that's where you'll be storing words of your own that aren't in the standard dictionary. (For instance, how to spell your own name, and the name of your most frequent coauthors.) Additional dictionaries are available, as you'll see in the same display as the "Check spelling" box that you just checked. I have not tried the spellchecker yet, so I can't tell you if it's very good.

Next, adjust Yap's settings. Go to "Start" "Programs" "Miktex 2.7" "Previewer" to start up Yap (which stands for "Yet another previewer," but in my opinion this previewer is much better than any other DVI previewer that I've ever seen). Now, in Yap, go to "View" "Options ..." "Inverse DVI Search". You should see, among the options, "TeXnicCenter (autodetected)". Click on that line, and you should see something about TEXCNTR.EXE copied automatically into the box that is labeled "Command line." Now click on "OK." To see what this accomplishes, read my discussion of forward and inverse search. I consider those searches to be incredibly helpful, and I've never seen any other DVI previewer that can do both of them.


Refreshing the filename database

Any time that you add some files that you want Miktex to be able to find, you have to update the filename database. Some examples of this are given below. The easiest way to update the filename database is to go to "Start" "Programs" "Miktex" "Miktex options" and then click on the button that says "Refresh now".


Personal configuration file

(This is really a Miktex issue, but it does affect TexnicCenter too.) You will find some of Miktex's configuration settings in the file "C:\texmf\miktex\config\miktex.ini". That is a textfile, which can be edited with a texteditor such as Notepad (not with a formatted editor such as Word or Wordperfect). However, here is another method that is recommended instead:

Find the directory "C:\localtexmf\miktex\config", and in it put a copy of miktex.ini. Edit the lines you want to edit, and delete all the other lines.

Here's why: (1) Whenever you run Miktex, it will first look in the texmf version for basic configuration, and then look in the localtexmf version for further settings or resettings. Thus, you still get the effect you want. (2) When it comes time to update your copy of Miktex (perhaps once a year or so), the texmf version will get overwritten with a new version, but your localtexmf version will be preserved the way you want it.

After you create the local config file, you'll need to refresh the filename database, so that Miktex knows it's there. (See remarks earlier on this page.)


Fine-tuning the automatic error handling

One of TxC's really great features is its automatic error handling. If you click on the appropriate arrow buttons near the top of the TxC window, TxC will look through your most recent log file and then take you to "next error", "previous error", "next warning", etc. This makes it much easier to find and fix your errors.

I will now describe a defect that I found in this error handling, and a solution that I eventually discovered. Here is a typical line from my log file:

LaTeX Warning: Reference `is.choice.true' on page 183 undefined on input line 8
7.

The warning refers to a minor, easily-correct problem on line 87 of my source file. Unfortunately, the default configuration setting had my log outputs something like 78 columns wide. That's one column too short for this particular message; the number "87" got cut off in the middle; the "7" appears on the next line. TeXnicCenter ignored the "7", and looked for the error on line "8". That's not so helpful to me. Even worse were some other warning messages, where the entire line number got cut off and sent to the next line of output; in these cases, TeXnicCenter simply took me to line 1 of the source file. Not what I wanted.

Here's how to fix it:

First, edit the "C:\localtexmf\miktex\config\miktex.ini" file (mentioned earlier on this web page). Add this line to it:

max_print_line=200
(Then refresh the filename database.)

But now you won't be able to read the output window, because its display lines will be too long! To fix that, we still have to make another alteration. In TeXnicCenter, go to "Tools" "Options..." "Text Format". Get the "Window" set to "Output". Then change the font to something very narrow -- for instance, I changed mine to "Arial Narrow" size 10.


Brightening the colors

The syntax color highlighting is helpful, but it is more helpful if you brighten the colors. I think the best way to do this is not by changing the colors themselves, but by changing the display font to boldface. See illustration: Go into "Tools" "Customize..." "Text Format". Get the "Window" set to "Editor". Then, in the section labeled "Font", click on "Change". Experiment with the fonts until you find something you like. With most fonts, changing to boldface has little visible effect, but I found that the fonts "Terminal" and "Fixedsys" have markedly brighter colors when you use boldface. Currently, I'm using "Lucida Console", boldface, size 12 points. You may want to experiment with a few fonts to see what looks good to you. (I emphasize that this is the font used in the editor's display, NOT the font used in your output.)

You can also change the color scheme itself if you wish; the appropriate box is right below the fonts box. I haven't changed mine, but perhaps you have some specialized reason for wanting to change yours.


Configuring Windows DDE for TxC

I have set up my computer so that when I double-click on a TeX file, TeXnic Center starts up and loads the TeX file -- or, if TeXic Center is already running, the already-running instance loads that TeX file (as opposed to starting a new instance). I installed this command in Windows using the usual procedure, which is indicated in the picture below:

In Windows Explorer, click "View" -- "Folder Options" -- "File Types". Look at the list of filetypes. If Tex isn't listed there, click "New type..." and fill in the basics (and choose an icon that you like, too -- I like lions because that's what Knuth used when he first created Tex). If Tex is listed there, select it and click "Edit..." (or in some versions of Windows, click "Advanced").

Then, under "Actions", click "New...". Type "TeXnic Center" (or "Txc", or whatever you like) for the "Action". For "Application used to perform action", type exactly what I have typed:

"C:\Program Files\TeXnicCenter\TEXCNTR.EXE" /ddecmd "[open('%1')]"

(To avoid typograpical errors, don't retype it; just use copy-and-paste.) Finally, click "OK", "OK", "OK".



(I was tempted to use the little "Use DDE" box that you see in the picture. I experimented extensively with it but couldn't get it to work with TxC. If you get it to work, let me know. The procedure I've described above does work, at least on my computer.)


Adding tools to TxC

In TeXnic Center, under "Tools", you'll see "Windows Explorer". That was included in the default setup as an example. You can add whatever tools you like under "Windows Explorer" (and you can also remove "Windows Explorer" if you don't want it there). But adding tools is a little tricky; you have to get the commands just right. Here are some of the tools that I've found useful to add to TxC: Here is the procedure, illustrated at right. In TeXnic Center, click on "Tools" -- "Customize..." -- "Tools". Click on the leftmost icon (circled in my illustration). That creates a box into which you can type whatever you like, for the label that will appear on the tool list. That part doesn't have to be typed exactly right. But then fill in the three boxes below it; those must be typed exactly. Here is what to fill in. (Don't retype it -- to avoid typographical errors, just copy-and-paste from the table below.)


    4Spell
Command: C:\Program Files\4Spell\4spell.exe
Arguments: "%pc"
Initial directory: "C:\Program Files\4Spell\"

    new Yap this project
Command: C:\texmf\miktex\bin\yap.exe
Arguments: -s %l"%Wc" "%bm.dvi"
Initial directory: %dc

    new Yap this file
Command: C:\texmf\miktex\bin\yap.exe
Arguments: -s %l"%pc" "%bc.dvi"
Initial directory: %dc

    dvipdfm this project
Command: C:\texmf\miktex\bin\dvipdfm.exe
Arguments: "%bm.dvi"
Initial directory: %dm

    dvipdfm this file
Command: C:\texmf\miktex\bin\dvipdfm.exe
Arguments: %bc.dvi
Initial directory: %dc

    dos box in this file's directory
Command: cmd.exe
Arguments:  
Initial directory: %dc


Changing TxC's button bars

To change the button bars in TeXnic Center, go to "Tools" -- "Customize..." -- "Toolbars". Checking or unchecking the boxes will change which buttonbars are showing; experiment with this a little to see how it works. Clicking "New..." will create a new buttonbar. Also, you can move buttons from one toolbar onto another, or delete a button altogether by dragging it away from the toolbars. Don't worry about deletions; you can always reset a button bar latter if you wish. While you're new to the program, you may want to use large buttons (go to "Tools" -- "Customize..." -- "Options", and check the "Large Icons" box); later you can switch to small buttons. Here are some techniques that I like to use; you might like some of them:


Change the output profiles

To get to these, go to "Build" -- "Define Output Profiles...". I found that the default profiles, built into TxC, worked pretty well for me; I only had one minor change (you may have more): I'm working on a book (which uses makeindex but not bibtex) and also on many small documents for my students (using neither makeindex nor bibtex). I got tired of all the error messages about "bib file not found". So I checked "Do not use Bibtex in this profile." Then I used "Copy" to duplicate the "LaTeX => DVI" profile, and then I renamed the profiles: One is named "LaTeX => DVI book long" and the other is named "LaTeX => DVI simple short". In the latter, I also checked "Do not use Makeindex in this profile".


Configuring Windows DDE for TxC

TeXnicCenter can hold several files at once; that is convenient for some kinds of editing. I have set up my computer so that when I double-click on a TeX file, TeXnic Center starts up and loads the TeX file -- or, if TeXic Center is already running, the already-running instance loads that TeX file (as opposed to starting a new instance).

Setting things up that way is a little tricky. The setup procedure starts in the usual fashion (outlined in my discussion of file associations for Windows programs):

In Windows Explorer, click "View" -- "Folder Options" -- "File Types". Look at the list of filetypes. If Tex isn't listed there, click "New type..." and fill in the basics (and choose an icon that you like, too -- I like lions because that's what Knuth used when he first created Tex). If Tex is listed there, select it and click "Edit..." (or in some versions of Windows, click "Advanced"). Then, under "Actions", click "New...". Type "TeXnic Center" (or "Txc", or whatever you like) for the "Action".

Now comes the tricky part. If you do things in the usual fashion, under "Application used to perform action" you would type

"C:\Program Files\TeXnicCenter\TEXCNTR.EXE" "%1"

but that does not have the desired effect. If you do that, each time you double click on a TeX file you'll start up a new instance of TeXnicCenter, even if one is already running.

One remedy is to instead type under "Application used to perform action" the following code:

"C:\Program Files\TeXnicCenter\TEXCNTR.EXE" /ddecmd "[open('%1')]"

Note the single quotes around the %1. Here is another method that also works: Fill the "Application used" box in the usual fashion, but then check the box labeled "Use DDE". This makes more boxes appear. Now, in the box labeled "DDE Message", type

[open("%1")]

Note that this time the %1 is surrounded by double quotes. See picture below.