Jeromy Anglim's Blog: Psychology and Statistics


Friday, March 19, 2010

TeXnicCenter Customisations

Over the last few weeks I've been exploring text editors for writing LaTeX documents. I wrote these notes when I was using TeXnicCenter (version 1.0). I have since switched to using WinEdt for writing LaTeX documents. If you do any substantial writing in LaTeX and you are choosing between free TeXnicCenter and shareware WinEdt, buy WinEdt. I'm planning a post soon on WinEdt. Nonetheless, I thought I'd post these rather rough notes I made while playing around with TeXnicCenter in case they are of interest.

Shortcut Keys

I added the following keyboard customisations to the default set. The keys were chosen with the aim of (1) being consistent with other programs, and (2) not conflicting with existing shortcut keys.

  • Find Next: Ctrl+PageDown
  • Find Previous: Ctrl+PageDown
  • Navigation Items - Go to: Ctrl+Shift+D
  • Window - Close: Ctrl+Shift+W
  • Find in Files: Ctrl+Shift+F
  • Select Output Profile: F12
  • Tools - Windows Explorer: Ctrl+Shift+E

Document navigation

The following are some strategies that can be used to facilitate document navigation in TeXnicCenter.

Structure, Objects, Files
Press one of the following keys, then navigate to the target, and press Ctrl+Shift+D (requires prior shortcut).
  • Activate Structure: Ctrl+G
  • Activate Objects: Ctrl+U
  • Activate Files: Ctrl+D
Incremental Search
1. Ctrl+I
2. Get to target by typing identifying letters or combine semi-identifying letters with additional Ctrl+I or Ctrl+Shift+I
3. Enter
4. To remove selection: Movement key or Ctrl+I Enter

Variant on Incremental Search
1. Highlight Text
2. Ctrl+F Esc
3. Find Next or Find Previous (F3 and Shift+F3; or Ctrl+PageUp and Ctrl+PageDown with my modified short cut keys)

Getting an overview

Structure View

TeXnicCenter has Structure View. It shows heading titles down to the subsubsection level. It shows tables and figures in floats and separated equations. Ctrl+G activates Structure View. Double clicking or using a shortcut can take you to the corresponding location in tex source. Left, Right, Up, and Down serve navigational purposes

One frustrating element is that pressing Ctrl+G when in tex source, does not take you to the corresponding location in the Structure View. Thus, if you are trying to get a sense of where you are in the structure, you need to navigate to the location.

A second frustration is that you can't control how the Structure View is displayed. It is not possible to expand all headings. It is not possible to show a given depth. It is not possible to add custom tags.

Note: I've since discovered that WinEdt supports these features.

Spelling

To download a dictionary in a language other than US English (i.e., Australian English)
  1. Download a dictionary from from: Open Office
  2. Copy unzipped dictionary files into the "Language" folder of your TeXnicCenter Installation. e.g., "C:\Program Files\TeXnicCenter\Language".
I also set up a custom dictionary in a suitable location.

Working on two files

It is sometimes useful to be able to work on two *.tex files at the same time. For example, I may be in Chapter 2 citing a reference in Appendix C. Thus, I'll have both chapter2.tex and appendix3.tex open. I achieve this effect by:

1. While in one of the files (e.g., chapter2.tex): Window - Close all but Active
2. Window - Open the other desired File (e.g., appendix3.tex)
3. Window - Tile Vertically

Window Layout

On a 24 inch monitor I have the left two-thirds of the monitor with TeXnicCenter and the right one-third of the monitor with Yap.

Work Flow:

When learning to write in LaTeX, it is important to make repetitive tasks efficient.

Edit-Build-Check-Edit Cycle:
1. Build Output: Ctrl+F5 in TeXnicCenter:
2. Show LaTeX source in TeXnicCenter using Inverse Search: E-Key in Yap or Double click on document;
It can be useful to show source links so that it is clear where the cursor will go when you activate inverse search. (in Yap: Options - User Interface - Show source links). Double clicking on one of the circles overlaid by Yap tends to return the cursor to a specific expected location.3.

Return Focus to TeXnicCenter
Several options exist:
(a) Close Yap (q)
(b) Use mouse to select TeXnicCenter
(c) Alt+Tab
(d) Use an AutoHotKey Script: I set up a script using AutoHotKey that toggles between TeXnicCenter and Yap.
; Script toggles focus between Yap and TeXnicCenter
;Script assumes both are open
;and that only one copy is open
#1:: ;Windows+1 is a shortcut key
if WinActive, TeXnicCenter
WinActivate, Yap
else
WinActivate, TeXnicCenter