Math software for Windows

Installation and Usage Tips for
TeXnic Center (and Miktex)

Version of 14 March 2006. Watch this web page; it may grow a bit in the near future. I just started using TeXnic Center recently, and so I'm still learning about it. Here are some features that I probably will add to this page soon: (1) How to use forward search in multi-file projects (e.g., one file for each chapter). (2) How to use TeXnicCenter with pictures (as described in my web page about pictures in TeX). -- Please email to me if you have further suggestions for this page. -- ES

TeXnic Center is a fairly good program, but some parts of its documentation are a bit unclear; in some places the documentation is too abstract (i.e., with insufficiently many examples). I have done some experimenting to figure out some features; below are my resulting clarifications.


General comments about installation

Where the Miktex files go depends on which version of Miktex you've installed, and which version of Windows you are using. On most computers you'll find all the Miktex-related files under "C:\texmf", but on some computers you'll find the files under "C:\Program Files\MiKTeX".

You should install TexnicCenter after installing Miktex. TexnicCenter will find most of the Miktex files on its own, but it may need a little help and it may ask you a few questions. In particular:

Then, when you're setting up the profiles, you may need to adjust the settings for Yap. That's under the profile "LaTeX => DVI", in the "Viewer" section. The following commands seem to work. (To avoid typing errors, use copy-and-paste to copy them from this web page into TxC's blanks.)


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.