# Jeromy Anglim's Blog: Psychology and Statistics

## Wednesday, April 21, 2010

### WinEdt 6.0 for LaTeX: Features, Configuration, and Resources

This post discusses my experience with WinEdt 6.0 as a text editor for writing documents in LaTeX. In this post I outline: (a) Why I have chosen to use WinEdt; (b) The role of WinEdt in my workflow; (c) Various customisations of WinEdt which I have found useful; (d) links to additional resources for getting the most out of WinEdt.

### Overview

I've recently been examining a number of text editors for writing LaTeX documents in a Windows Environment. These include TeXnicCenter (v1.0), Texlipse for Eclipse, and Notepad++. I read a discussion on Stack Overflow discussing the Best LaTeX editor for Windows. Each editor that I tried had good features. Each was free. However, as I tried to get the configuration I wanted, I frequently felt that I was having to implement a lot of custom configurations. Also, while these programs had many great features, there were always features missing. I did not feel that I would be truly comfortable working with these editors for extended periods of time on complex documents.

As a side point, Emacs/Xemacs and Vi/vim are also meant to be very good for editing LaTeX documents. I think the text editing shortcut keys in these programs are superior to those on Windows. In particular, I would like to never have to let my fingers leave the home keys in order to edit text. I can also see the benefit of having a single text editor that you use for all programming, emailing, and document creation tasks. It's also great to have an open source text editor supported by a huge community of technical users. However, the shortcut keys used in these programs are completely different to those used in other Windows programs. When working with both Windows programs and editors like Emacs, there is a negative transfer which disrupts automaticity. Thus, until I'm willing to adopt Linux, I'm not inclined to learn these editors.

In particular I wanted usability. I wanted to be able to navigate my document comfortably. I wanted the display to reinforce the document structure. I wanted the program to support my workflow organising my task related comments. I wanted to be able to easily compile and debug my LaTeX source in a comfortable way. I wanted intelligent defaults with the option to customise if a default annoyed me. I wanted the program to have thought about usability issues that I hadn't thought about.

I'm currently using WinEdt 6.0. It looks like it will be the editor for me. It has been designed with someone like me in the mind: A researcher who wants to write technical documents. It's not free, but it's not expensive.

### Features that I like

In particular there were several Features in WinEdt that I liked at first glance:
• Tree View can be customised
• Automatically display your current location in TOC
• Colour coding that aids usability
• Intelligent defaults
• Options to customise almost anything
• Easy configuration interface with MikTeX
• One click build process for LaTeX documents
• Intuitive default shortcut keys and intuitive alt menu letters
• Ctrl+Up and Ctrl+Down navigates between paragraphs.
The remainder of this post discusses: configuration, features, and set up ideas.

### Configuration

The following sets out a few alterations to the default WinEdt 6.0 configuration that I have found useful.

#### Configuring Inverse Search with Yap

WinEdt includes documentation on how to configure Inverse search in Yap.

#### Configuring with JabRef

In JabRef, I changed the following:
Preferences - External Programs - WinEdt: I had to change the default file location.
Once this was set, Ctrl+L sends the selected citation to WinEdt and returns focus to WinEdt.

#### Changing Settings

The method of changing settings in WinEdt 6.0 differs from most Windows programs. The configuration is based on a large number of *.ini files. Ini files are arranged categorically.
To make changes:
(1) edit the ini file,
(2) save the ini file, and
(3) then click the "load current script" button.

The options are reasonably self-documenting. In particular:
0 = No or Off or False
1 = Yes or On or True

You can backup and restore your settings. This is particularly useful if you corrupt your ini files.

#### Spelling

I needed to customise Australian spelling. This meant enabling a number of dictionaries (e.g., "colour", "ise", "yse", "centre") and disabling the corresponding American spellings.

#### Dual Monitor Issues

Some dialog boxes default to the top-left of the primary monitor (e.g., Forward Search, spelling). I have a dual monitor setup where the main monitor I work on is the secondary monitor. My Start Menu is displayed vertically from top-left to bottom-left of my primary monitor. When several dialog boxes display, they are obscured by the Start Menu. I still have not resolved this issue for several dialog boxes. However, for some dialog boxes, settings like the following work:
Incremental Search:
LOCKED_POSITION=0


#### Word Wrapping

Word wrapping is an important topic. It's also a matter of personal preference. WinEdt provides many options for word wrapping. Wrapping can be turned off and on each document by clicking on the status bar. I'm still thinking about the best configuration for this.

A freedom of writing in HTML and LaTeX is that you can arrange you have greater freedom in how text is arranged on the page. The following command does a reasonable job of creating new lines at the end of each sentence. Find: "[.] " Replace: ".<" Regular Expressions enabled

#### Disable Sound Effects

I work in an office. Thus, dings and dongs are unwanted.
Sound Effects:
DISABLE_SOUND_EFFECTS=1


#### Auto Saving

My main aim was to customise the setting to ensure frequent auto-saving (e.g., at least every 5 minutes). I like my backup files in a separate folder as opposed to cluttering the primary folder.

backup.ini BACKUP_FILENAME="c:\temp\%n%t.bak"

AutoSave.ini AUTO_SAVE_FILENAME="c:\temp\%n%t.sav"

#### Error Processing in LaTeX

When in draft stages of preparing large document, I find warnings related to "overfull and underfull boxes" to be distracting. Thus, I disabled their bookmarked Inclusion in the Error log. They are still shown in the log, but clicking "Next" or "Previous" does not go to them.
TYPE="Type II:  ?...<From>--<To>"
WARNING=0
ENABLED=0
FILTER="TeX"
TRIGGER="Overfull \"
TRIGGER="Underfull \"


#### Fonts and such

I modified the display of HTML (Font Schemes - Fonts.ini). I prefer a fixed-width font for writing HTML, such as "Courier New". I also modified the TAB_LENGTH to 4 instead of 8.
FONT_SCHEME="HTML Documents"
MODE="HTML|HHC;XWE"
USE_IN_DIALOGS=1 // Use in Spelling or Complete Dialogs...
FONT_NAME="Courier New"
FONT_SIZE=10
FONT_BOLD=0
FONT_ITALIC=0
FONT_CHARSET=1
EXTRA_LINE_SPACING=1
EXTRA_CHAR_SPACING=0
TAB_LENGTH=4
FREE_CARET=0


#### Display

As far as I can tell, all the standard toolbar buttons are available through menus. And the combination of the Alt Key and appropriate keyboard accelerators is quicker than using the mouse. Thus, I right clicked around the toolbars to hide toolbars. This has the benefit of creating additional space to view text.

### Getting Things Done

#### Getting a sense of Context

The importance of context When working with large documents it is important to have a sense of context. I want to know where I am in the hierarchical structure of a document. In projects with multiple files, I want to know which file I am in.

The following two commands are great for providing context:
Project - Auto-Select TOC Branch
Project - Auto-Select Tree Files

##### Basic Cursor Movement
Between Paragraphs
Ctrl+Up and Ctrl+Down: Move cursor between paragraphs (a nice feature for a coding editor).
##### Standard Windows Editing Keys
Most standard text editing keys work like you would expect, if you have grown up in a Windows world. e.g., Ctrl+Delete; Ctrl+Backspace; PageUp; PageDown; Ctrl+Left; Ctrl+Right
##### Tree View
Tree View provides: Files, TOC, Bibliography, and Labels The mouse can be used to select objects (note my frustration at the absence of keyboard navigation). There's also a slight problem with keeping the tree current (particularly the TOC). It can be manually refreshed by:
(a) clicking the "Build Tree" button; or
(b) opening the main file of the project, which in a single file project should already be opened, and selecting Project - Set Main File (Alt, p, e)

#### Navigating Between Files

##### Open File
Ctrl+O Brings Up an Open File Box. It tends to be in the folder of the main project file. The file name of the tex file can then be entered.
##### Next and Previous Window
Ctrl+Comma and Ctrl+Shift+Comma move to the next or previous open document based on the order of the tabs (tab-order). This is in contrast to MDI-order which is based on the order that the windows have bene last accessed. When opening a document, the new tab is added after the tab for the current open document. Tabs can be rearranged using drag and drop. By opening a set of documents for a project in a particular order (e.g., main, preamble, chapter1, chapter2, chapter3, etc.) the tab-order shortcut keys can be used to navigate through the files that make up the sections of your document. The tree view also provides a tool to open and close all files in a project or at a given heading level.
##### Open Input and include documents
Double click on an input or include command to go to the file referenced by the command. Double clicking hyperlinks in HTML files open the link in the default web browser.
##### Global Mark and Global Return
Ctrl+F10 sets a mark in an open document. Ctrl+Shift+F10 returns the cursor to this mark. This works even if you are working in a document other than the marked document. Thus, it is useful when editing multiple documents.
##### Bookmarks
The "Search - Bookmarks" sub-menu lists a number of options for working with bookmarks. They appear to be only effective within a file. If you want to use bookmarks to navigate between files, you need to use the Global Mark option. Up to 9 separate bookmarks can be set using Ctrl+Shift+1, Ctrl+Shift+2, etc to set the bookmark, and Ctrl+1, Ctrl+2, etc to go to the bookmark.

When should you use bookmarks? If you are writing at line X, but need to check something in line Y:
(1) bookmark line X, Ctrl+Shift+1
(2) go to line Y,
(3) bookmark line Y Ctrl+Shift+2
(4) check whatever you wanted to check in line Y
If you then need to check line Y again, Ctrl+2 Macros for navigation I would like to be able to navigate the outline in the Tree View using keyboard short cuts. It seems that the macro language might be the best course of action. Tree and Gather Macro Interfaces are provided. Scroll Lock Navigation In "editor.ini", the following setting turns the cursor keys into a tool to navigate when Scroll Lock is activated. ENABLE_SCROLL_LOCK_KEY=1

#### Customised Tree View

##### Paragraph descriptions in Outline
When I write LaTeX documents, I often write what I call paragraph descriptions above each paragraph. Paragraph descriptions are typically less than the length of a line and state summarise the contents of the paragraph. They are useful for highlighting and checking the structural flow of a document. I incorporate them in latex using a custom command that does not print in the PDF. The syntax that I use for the command is \pd{Text describing title} A particular appealing feature of WinEdt is that these paragraph descriptions can be added to the Table of Contents Outline. To enable this I Added the following option. It is a copy of the "\paragraph" item with a couple of changes (e.g., level is deeper)
  ITEM="\pd{?}"
MODE="TeX"
CASE_SENSITIVE=1
BEGINNING_OF_LINE_ONLY=1
CURRENT_DOCUMENT_ONLY=1
ALL_OPENED_DOCUMENTS=0
COMPLETE_PROJECT_TREE=1
ICON="Paragraph"
LEVEL=26
CAPTION="%?"
BALANCED="{}\"
MAX_LINE_SPAN=3
ON_CTRL_CLICK="GlobalMark;TreeTrack(2);"
ON_CTRL_DBL_CLICK="Relax;"
ON_CLICK="TreeTrack(2,1);"
ON_DBL_CLICK="TreeTrack(2,2);"
ACTION="Find"
IMAGE="Find"
MACRO="TreeTrack(2);"
SUBSTITUTION="\label{*}"
SUB_FIND="\\label\{*\}"
SUB_REPLACE=""
SUB_REG_EX=1
SUB_CASE_SENSITIVE=1
SUBSTITUTION="  "
SUB_FIND=" +{ }"
SUB_REPLACE=" "
SUB_REG_EX=1
SUB_CASE_SENSITIVE=1
SUBSTITUTION="\ldots"
SUB_FIND="\ldots"
SUB_REPLACE="..."
SUB_REG_EX=0
SUB_CASE_SENSITIVE=1

There are many further possibilities for customisation. includegraphics: I also added a level value to the \includegraphics command in the tree.

#### Spelling

I disabled:
Confirm Deletion

When first starting with a new text editor, there are lots of words that I use that are not spelling mistakes. Thus, the following steps can be applied to a word incorrectly classified as a spelling error:
Ctrl+Enter, Alt+A, or
Right Mouse Click, Alt+A

#### Customising Gather

In my workflow, I have a number of custom commands where it would be useful if these could be incorporated into the gather functionality. \todo{...} I use the todo command from the todo package to list tasks that in the document. Navigating this list is useful way of working through a todo list.
PAGE="todo"
// Change Mode from TeX to ? to disable this item
PAGE_MODE="TeX|DTX;INS;STY"
PAGE_SORTED=0
PAGE_CASE_SENSITIVE=1
PAGE_BEFORE_BUILD="Relax;"
PAGE_AFTER_BUILD="Relax;"
PAGE_ON_ACTIVATE="GlobalMark;"
PAGE_ON_SHOW="GlobalMark;"
PAGE_ON_ENTER="GDIKillFocus;"
PAGE_ON_CANCEL="GlobalReturn;GDIKillFocus;"

ITEM="\todo{?}"
MODE="TeX"
CASE_SENSITIVE=1
BEGINNING_OF_LINE_ONLY=0
CURRENT_DOCUMENT_ONLY=1
ALL_OPENED_DOCUMENTS=0
COMPLETE_PROJECT_TREE=1
RETURN_AT_EOF=0
ICON="ArrowOrange"
LEVEL=0
CAPTION="%!?"
MAX_LINE_SPAN=2
ON_CLICK="GDITrack;"
ON_DBL_CLICK="GDIKillFocus;"
ACTION="Find"
IMAGE="Find"
MACRO="GDITrack;"


#### Word Counts

Document - Word Count (Alt, D, W) can be used to estimate the number of words in a *.tex file. If you select text

Excluding text from word count If you have custom commands that you use often that do not print text, you may wish to exclude them from word counts. For example, I use the \todo command to store tasks that need to be done. I use my own \pd command to store a non-printing paragraph descriptions. I use my own \OUTPUT command to indicate where I need to insert a specific table, figure, or results text. These commands and their contents can be excluded from word counts by editing the WordCount.ini file (Options - Options - Formatting - Word Count). The built-in examples make it pretty clear what needs to be done to add additional tags.
WORD_COUNT_SET="TeX"
...
SKIP="\pd{?}"
SKIP="\todo{?}"
SKIP="\OUTPUT{?}"


Other word count options Note that the word count option does not work for multi-file projects. Other options exist for word count calculation: The main challenge with word counts in both MS Word, in LaTeX, and in PDFs is that many word count limits imposed in academic writing exclude various forms of content. For example, the word count for a thesis might exclude: references, tables, figures, appendices, headers, footers.

#### LaTeX Build Profiles

Configuring various LaTeX build options is really easy with WinEdt. Under Options - Execution Modes, I have the following options selected:
Process Flow: Wait for execution to finish; Start Viewer; Forward search; No interaction [Apply to All]
I generally use TeXify to automatically determine how many times the document needs to be built.

#### Using Template Text

WinEdt can facilitate the insertion of template text. For example, there is a template for inserting a figure. The template use a character that looks like "*" for information that needs to be replaced by the user. Next Bullet (Ctrl+Space) and Previous Bullet (Ctrl+Shift+Space) can be used to navigate between bullets.

You can even create your own templates using Ctrl+Alt+Space and whatever surrounding template text is required. You may want to create a set of common templates and store it in a separate file.

### Problems with WinEdt 6.0

The following represents frustrations that I have experienced with WinEdt 6.0. WinEdt has many customisation options. Thus, in some cases, perceived problems may represent my lack of knowledge about how to configure WinEdt to operate in the way that I wish.

There are some commands which do not appear to be accessible to the keyboard, including: TOC View, File View, Gather View, Toolbar Buttons, Find in Files, LaTeX Error View. I find this very frustrating. These are fundamental navigational tools that are frequently used. They should not require the mouse. There may be workarounds using macros.

#### The placement of some dialog boxes

Some dialog boxes are not well-placed if you use a dual monitor configuration and work principally on your second monitor. Hopefully this will be corrected in future versions.

### Resources

#### Using Macros

WinEdt provides good support for macros. Here is an Introductory guide to marcos Programs that interest me:

#### www.winedt.org

There are a great set of resources on http://www.winedt.org/. These are a few things that have interested me that I haven't yet tried.
##### Plug-ins

Additional Configuration ideas for LaTeX and WinEdt

1. Thanks you, as a new WinEdt user this is very helpful.

2. I have a question. I tried compiling a tex file made with Texmaker with Winedt but it is showing errors as undefined control sequence.
The file is running with Texmaker and Texworks. The file has a lot of formulas.

Does the tex file need to be modified when run with different Latex editors?

Thanks for the blog entries. They are very useful.

3. @Anonymous
Thanks for the comment. I'm not sure. Ultimately WinEdt is not latex. It is a text editor.
Thus, to the extent that you are using the same underlying latex commands, you shouldn't need to change anything.