Wer nicht fragt, bleibt dumm...

 WinEdt FAQ

## WinEdt FAQ

2005-11-14

This "FAQ" is growing slowly; you can help to extend it by answering questions that you think are frequently asked and sending them (the questions AND the answers) to me: or to .

Tip You can download a printable version of the WinEdt FAQ [pdf; 198 KB]

1. General questions
1.1. What is WinEdt?
1.2. What is WinEdt.org?
1.3. How do you pronounce WinEdt?
1.4. A message keeps popping up telling me to register. Is WinEdt not free?
2. TeX
2.1. My LaTeX (dvips, Ghostview, etc.) button doesn't work!
2.2. Where do I get a TeX system?
2.3. How do I do ... with TeX, LaTeX, BibTeX or MakeIndex?
3. Configuration
3.1. WinEdt Startup and Profiles
3.1.1. Is there a Command Line Switch to start WinEdt with a document and with the caret on a specific line?
3.1.2. How can I set up WinEdt to open only the file that I double click?
3.1.3. What is it all about with %B and %b and how can I check their values?
3.1.4. Can I start WinEdt with the profile of another user?
3.2. Editing
3.2.1. What does WinEdt do with my lines?
3.2.2. I have wrapping on: how can I configure WinEdt for accepting more than 67 characters per line?
3.2.3. I want to prevent certain lines from being wrapped.
3.2.4. Is there any option to comment (insert %) large parts of a TeX file automatically?
3.2.5. I'm editing a table exported from another program and I need to append \\ at the end of each line. Is there a simple way to perform this?
3.2.6. When I typed \cite{} or \ref{} I used to get a popup list of all bibliography items resp. all labels. This doesn't work anymore.
3.2.7. Doubleclicking on Graphical in \section{Graphical User Interface} selects the whole content between the braces. I just want the word itself being highlighted.
3.2.8. I want a list of common spelling mistakes to be automatically corrected. Can I configure the wanted corrections somewhere?
3.2.9. The Gather Interface does not show any (or not all) items.
3.2.10. Project Tree (in TeX mode) seems to be able to gather information from included/inputted files only if those commands are at the beginning of a new line.
3.2.11. Is it possible to do a word count for a complete TeX project and not only for the current document?
3.3. Modes and Submodes
3.3.1. What are so called submodes good for?
3.3.2. What is the deal with the -*- TeX:FR -*- comment that is supposed to set the submode of the current document?
3.3.3. Which Convention for Submode Definition should be used?
3.4. Dictionaries
3.4.1. How can I disable Spell Checking?
3.4.2. Mode dependant Dictionary
3.4.3. When I want to browse some dictionary from the dictionary manager, the selected dictionary doesn't open.
3.5. User Interface
3.5.1. I want to add a new menu item to the Accessories Menu. How do I do that?
3.5.2. How can I install a shortcut to a macro
3.5.3. How can I add a button to the toolbar?
3.5.4. How can I add a custom document format (a template) to DocumentNew Document?
3.5.5. The shortcuts I defined for a popup menu don't work.
3.5.6. Why are buttons sometimes clickable, sometimes not?
3.5.7. The toolbar buttons are enabled all of the time (i.e., they do not grey out when files at my E: drive are not present).
3.5.8. Some Shortcuts in WinEdt are broken, what happened?
3.5.9. I have upgraded to WinEdt 5.4 [20050317] from previous build and CtrlAltE no longer pops up the insert environment.
3.5.10. How can I replace the command associated to the ps2pdf button to execute Acrobat Distiller?
3.6.1. How can I quickly run an external (DOS) program?
3.6.2. How can I write a macro, that runs an external (DOS) program?
3.7. Project Files, File Handling
3.7.1. What is the difference between quitting and closing a project?
3.7.2. If I run the Open... or Save as... commands from the File menu I would like WinEdt to open up the dialog box in the folder of the file currently being edited.
3.7.3. When opening a file, how can I force WinEdt to always choose the .tex file-type?
3.8. Highlighting
3.8.1. Can I define my own colours for highlighting?
3.8.2. I would like to have comments highlighted ...
4. Text Manipulation
4.1. Text Manipulation with RegEx
4.1.1. What are Regular Expressions?
4.1.2. How can I extract Hard Returns in paragraphs, but keep the paragraph separation (a single empty line between them)?
4.1.3. I want to search with a Regular Expression that can span over more than one line. This does not seem to work with "*".
4.1.4. My macro (or Regular Expression) doesn't work as expected. I think I found a bug.
4.2. Text Manipulation with Macros
4.2.1. What is a macro?
4.2.2. How do I run a macro?
4.2.3. How can I quickly run a macro?
4.2.4. WinEdt hang up while executing a macro, have I to kill the program using the Task Manager?
4.2.5. The register I want to change always seems to contain an old value. What's happening?
4.2.6. How can I duplicate a line?
4.2.7. How can I change a text line by line (cyclically)?
5. Resources
5.1. Where can I get more help?
5.2. How do I subscribe to the WinEdt mailing list?
5.3. How do I unsubscribe from the WinEdt mailing list?
5.4. Is there an archive for the WinEdt Mailing List?
5.5. Are that all frequently asked questions?

### 1. General questions

1.1. What is WinEdt?
1.2. What is WinEdt.org?
1.3. How do you pronounce WinEdt?
1.4. A message keeps popping up telling me to register. Is WinEdt not free?
1.1.

What is WinEdt?

WinEdt is a powerful, extremely flexible and versatile native editor and shell for MS Windows with a strong predisposition towards the creation of [La]TeX documents (and much more!)...

1.2.

What is WinEdt.org?

WinEdt.org is a place, where users of WinEdt can share everything concerning WinEdt. This includes macros (WinEdt Macro Library), modes, menus and shortcut schemes (Modes and Menus), help (this FAQ and tutorials), and whatever you can think of and want to contribute. WinEdt.org is run by volunteers. That is, it lives off contributions. To learn more about contributing, read this.

1.3.

How do you pronounce WinEdt?

We need it. ;-)

1.4.

A message keeps popping up telling me to register. Is WinEdt not free?

or if this for some reason fails replace %$('Acro-Bin'); with full path to acrodist.exe enclosed in double quotes, eg.: "C:\Program Files\Adobe\Acrobat 6.0\acrodist.exe" Change parameters from -sOutputFile="%N.pdf" -c save pop -f "%N.ps" to "%N.ps" and switches from -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -r600 -dCompatibilityLevel=1.4 to empty or something like /N /Q /V with  /V - start viewer /N - run in a new Window /Q - close Console Window after finished Decide if you want to run it in detached mode or else simply disable all fancy execution options for this accessory... No need to modify the macro. You should not use any switches for paper size unless you change the macro so that it will pass switches that distiller understands (defaults are for ghostscript) as you can see in the complicated macro. In WinEdt 5.3 you'll find the following comment in ps2pdf.edt:  // Use Acrobat's Distiller (if available) // Omit the /V to avoid viewing newly created .pdf files // Run('acrodist.exe /N /Q /V "%N.ps"',"%P",0,1,"PS -> PDF ...",1,1); // Exit; Remove the comments // and possibly enter full path for acrodist.exe in double quotes:  Run('"C:\Program Files\Adobe\Acrobat 6.0\acrodist.exe" /N /Q /V "%N.ps"',"%P",0,1,"PS -> PDF ...",1,1); #### 3.6. Access to external programs 3.6.1. How can I quickly run an external (DOS) program? 3.6.2. How can I write a macro, that runs an external (DOS) program? 3.6.1. How can I quickly run an external (DOS) program? WinEdt offers you two menu items that can assist at command line executions: • With Accessories | Windows Accessories | Command Prompt WinEdt opens a Command Prompt at your current path (usually %p or %P) inheriting all environment settings of WinEdt • With Accessories | Run... a small dialog opens, inviting you to specify a Command Line (keeping a small history of the latest command executions) and an optional Startup Folder. For example:  Command Line makeindex -s nomencl.ist -o "%N.gls" "%N.glo" Startup Folder %P (or any other path) corresponds to macro call: Run('makeindex -s nomencl.ist -o "%N.gls" "%N.glo"','%P',0,1); 3.6.2. How can I write a macro, that runs an external (DOS) program? Everything that is working on the command line (eg. perl script with parameter switches and options), can be run with Run():  Run("script.pl --verbose foo.glo > foo.err"); If you need to set the current path, simply specify the second parameter of the Run() macro. If you want to replace filenames dynamically with current (main) file name, you can make use of %n or %N (postulating %N being something like "foo.ext"). In this case make sure to use quotes around the input file's name (%N may expand to a string containing whitespaces):  Run('script.pl --verbose "%N".glo > "%N".err','mypath'); More sophisticated execution modes are available with WinExe(). Check the macro manual at Help | Macro Manual for a complete explanation of further parameters that can be declared. If you want to tie such a macro together with a menu item or a shortcut see also adding menu item or installing shortcut respectively. #### 3.7. Project Files, File Handling 3.7.1. What is the difference between quitting and closing a project? 3.7.2. If I run the Open... or Save as... commands from the File menu I would like WinEdt to open up the dialog box in the folder of the file currently being edited. 3.7.3. When opening a file, how can I force WinEdt to always choose the .tex file-type? 3.7.1. What is the difference between quitting and closing a project? Both methods close all opened documents and the project file and set the current project to <temporary project>. Quitting does not save the current state of the project and removes the project from the list of recent projects (unless it was a default project). It will not prompt about saving changes to the project (but it prompts with a warning to this subject). It can be used if you are definitely done with that project... It cleans up the Recent Files List and the Project Tree as well, leaving WinEdt in a virgin state, as if you had started the program with -V switch. Whereas Closing the project just closes all the files contained in your project. If you want to happen more here, you can modify the event handler that is executed when closing a project:  Exe('%b\Macros\Events\Prj-Close.edt'); It is left to this event handler to take care of cleanup, if desired. By default it does not clean anything (but it can be changed), look for the following line:  DeleteTree(1, $$0000); Usage of DeleteTree(UseFlag: 0..1, Flag:$$0000..$$1111); • UseFlag: 0..1  0 delete the tree (as before) 1 use flags to select the tasks • Binary Flags from left to right $$0000..$\$1111:

 Clear Gather Control Delete the Tree Clear File List Remove persistent Main File

3.7.2.

If I run the Open... or Save as... commands from the File menu I would like WinEdt to open up the dialog box in the folder of the file currently being edited.

WinEdt starts the common Open and Save As dialogs in the current folder. By default, the folder is reset to the last opened document and can be set explicitly by Ctrl-Shift-H command (SetFolder() to the path of the current document). The menu item is either in Project or Document menu (depending on your version of WinEdt).

I find this handy since it allows more control (when I use Save As command I usually want to save the file to a different folder). If you want your asked behavior by default, you have to delete the current Open and Save As Menu Items (because they are defined as commands) and then replace them by macro items:

 SetFolder('%p');CMD('Open...');

respectively

 SetFolder('%p');CMD('Save As...');

3.7.3.

When opening a file, how can I force WinEdt to always choose the .tex file-type?

If you don't want the “Default” mode (*.*) to show up as default in the file open dialog, reverse the lines Default and TeX in the edit control inside the Preferences | Modes Dialog. This changes the order of file extension items in the file open dialog.



#### 3.8. Highlighting

3.8.1. Can I define my own colours for highlighting?
3.8.2. I would like to have comments highlighted ...
3.8.1.

Can I define my own colours for highlighting?

Yes. You find the dialog Colors and Syntax Highlighting under Options | Highlighting. In the first tabbed pane Selections and Colors choose the 5th button , which opens a new dialog, where you can change any of the 16 colours. Note that highlighting can look weird if you choose completely different colours. You can always return to the default colours.

In Version 5.3 of WinEdt go to Options | Preferences | Colors and open the context popup menu ( on Colors). Then choose Change Colors to redefine the colours.

3.8.2.

I would like to have comments highlighted ...

Expanded Question: I have a document mode that uses "!" as a comment character. I would like to have the comments highlighted and therefor I copied the TeX Comment Switch, changed the "%" to a "!" and changed "TeX" to "MyMode" . But it doesn't work. What else do I need to do?

Answer: You have to define a Filter Set ["!"] and use it as a Start Switch (from the drop-down list). Changing "%" to "!" in the name does nothing and Filter Sets have to be defined in the Filter Sets Tab Page before they can be properly assigned and used in switches...

A good introduction to this subject can be found in Syntax Highlighting in WinEdt [pdf; 59 KB]

### 4. Text Manipulation

4.1. Text Manipulation with RegEx
4.1.1. What are Regular Expressions?
4.1.2. How can I extract Hard Returns in paragraphs, but keep the paragraph separation (a single empty line between them)?
4.1.3. I want to search with a Regular Expression that can span over more than one line. This does not seem to work with "*".
4.1.4. My macro (or Regular Expression) doesn't work as expected. I think I found a bug.
4.2. Text Manipulation with Macros
4.2.1. What is a macro?
4.2.2. How do I run a macro?
4.2.3. How can I quickly run a macro?
4.2.4. WinEdt hang up while executing a macro, have I to kill the program using the Task Manager?
4.2.5. The register I want to change always seems to contain an old value. What's happening?
4.2.6. How can I duplicate a line?
4.2.7. How can I change a text line by line (cyclically)?

#### 4.1. Text Manipulation with RegEx

4.1.1. What are Regular Expressions?
4.1.2. How can I extract Hard Returns in paragraphs, but keep the paragraph separation (a single empty line between them)?
4.1.3. I want to search with a Regular Expression that can span over more than one line. This does not seem to work with "*".
4.1.4. My macro (or Regular Expression) doesn't work as expected. I think I found a bug.
4.1.1.

What are Regular Expressions?

Regular expressions are constructs that look like comic-book expletives but can be wondrously powerful tools. Using Regular Expressions you can find (and replace) text that matches a certain pattern. Some characters have a special meaning: F.i. the character ? stands for "any (single) character". So, if you wanted to find all four-letter words that begin and end with "t" (tart, text, tilt etc.) you would search for t??t.

You can also tag expressions to reuse them. F.i., if you wanted to change all "\urls" into "\hrefs" , you would search for \\url\{$$0*$$\} and replace them with \\href\{mailto:\0\}\{\0\}. Note that the special characters (like "{" , "}" and "\" ) have to be escaped by a "\" to keep their literal meaning.

The file %B\Doc\RegEx.txt will tell you more about WinEdt's regular expressions.

4.1.2.

How can I extract Hard Returns in paragraphs, but keep the paragraph separation (a single empty line between them)?

Easiest is to use Search | Replace (Ctrl-R) with checked:

  Find: "~<>~>"
Replace with: " "

or possibly

  Find: "~<>~{>| }"

if you want to prevent (backward) formatting of indented lines.

4.1.3.

I want to search with a Regular Expression that can span over more than one line. This does not seem to work with "*".

That's right. The Regular Expression "*", which stands for any string of arbitrary length, does not span over line breaks.

If you are using WinEdt 5.3 you can use the expression "**", which allows line breaks. If you are using an earlier version, you can use something along the lines of the following Regular Expression, which will find LaTeX environments:

\\begin\{*\}@{>|^{\\end\{*\}}}\\end\{*\}

This code will fail on nested environments, as it will stop at the first possible match for \\end\{*\}. For these, the expression gets more complicated (I've replaced \\begin\{*\} and \\end\{*\} with begin resp. end to make it somewhat more readable):

begin@{>|{begin*end}|^{end}}end

will find a maximum number of two nested environments (as long as the inner environment starts and ends on the same line);

begin@{>|{begin@{>|{begin*end}|^{end}}*end}|^{end}}end

will find a maximum number of three nested environments;

begin@{>|{begin@{>|{begin@{>|{begin*end}|^{end}}*end}|^{end}}*end}|^{end}}end

will find a maximum number of four nested environments, and so on.

Of course these expressions will find all environments which are nested in a smaller degree, too. Environments which contain more than the maximum number, will not be matched correctly.

4.1.4.

My macro (or Regular Expression) doesn't work as expected. I think I found a bug.

You may be right. But it might already be known. Check in the list of bugs. If you don't find it there, construct a minimal test macro which shows the behaviour you think is wrong, and send it (preferably) to the WinEdt mailing list or to WinEdt's support (if you do the latter, please CC to ). If it turns out that you've really found a bug, it will probably be fixed in the next release.

#### 4.2. Text Manipulation with Macros

4.2.1. What is a macro?
4.2.2. How do I run a macro?
4.2.3. How can I quickly run a macro?
4.2.4. WinEdt hang up while executing a macro, have I to kill the program using the Task Manager?
4.2.5. The register I want to change always seems to contain an old value. What's happening?
4.2.6. How can I duplicate a line?
4.2.7. How can I change a text line by line (cyclically)?
4.2.1.

What is a macro?

A macro is a script that contains a number of editing or other commands, which are executed in WinEdt. You can use macros f.i. for repeated editing tasks like typing 168 lines of a LaTeX table. An easy way to learn what a macro is, is the Macro Recorder (Macros | Recorder...), which lets you record and play macros.

You are probably using macros already: F.i. most of the Insert commands are macros, and a lot of responses to Active Strings are macros. Do you type "\textit{...}" ? Don't! Press ALT-CTRL-F followed by ALT-I instead. So whenever you find yourself typing the same things again and again, use a macro!

In the WinEdt Macro Library you find a lot of more advanced macros, that can make your life with WinEdt (and life in general) much easier.

4.2.2.

How do I run a macro?

Go to Macros | Execute Macro... and browse for the macro file. If you want to run a macro more often, read the next question, too.

4.2.3.

How can I quickly run a macro?

You have two possibilities, if you want to run a macro frequently:

• Define a new Menu Item (either in a main menu or in a popup menu). This is done in Options | Menu Setup. Insert a macro item and define it as

[Exe("%B\path\to\your\macro.edt");]

• You can then assign a keyboard shortcut (see installing a shortcut) to it, or even a Toolbar Item. Or you can define the macro as response to an Active String (in Options | Settings | Active Strings).

To learn more, read the instructions from the WinEdt Macro Library, and the files Menu.txt and Toolbar.txt in WinEdt's Doc folder.

4.2.4.

WinEdt hang up while executing a macro, have I to kill the program using the Task Manager?

Instead of using the Task Manager to kill WinEdt when it is executing a macro code that is too slow or possibly contains an infinite loop, the following applies:

Press and hold the keys Shift-ESC until the status line displays a message Canceled!!!. You may have to do this a few times to exit nested loops, but in principle it is possible to cancel all such actions using this shortcut.

4.2.5.

The register I want to change always seems to contain an old value. What's happening?

You're probably experiencing WinEdt's string expansion rules. With this macro code:

  LetReg(1,"Test");
IfStr("%!1","Test","=",>
"LetReg(1,'It works.'); Prompt('%!1');">
);

you will be prompted: "Test" and not, as expected, "It works" , because the whole string

  "LetReg(1,'It works.'); Prompt('%!1');"

will be expanded at once, i.e. before the register is changed. Therefore %!1 does not contain the new value. To prevent the register from being expanded you have two possibilities:

• Either double the character "%" , i.e.

 "LetReg(1,'It works.'); Prompt('%%!1');"
• You have to double the registers for each expansion level. or, better in most cases, put a "!" in front of the string:

 !"LetReg(1,'It works.'); Prompt('%!1');"

4.2.6.

How can I duplicate a line?

WinEdt has a macro language that allows you to define your own actions and assign them to the keys you prefer. You could use the following (easy readable, straight forward step by step thinking) macro to duplicate a line:

  SetInsert(1);
CMD("Go To Beginning Of Line");
CMD("Select To End Of Line");
CMD("Copy");
CMD("Char Right");
NewLine;
CMD("Paste");
RestoreInsert;

You can save this content to a file named dupl.edt in for example %b\macros. Then you have to set up a menu entry that executes Exe("%b\macros\dupl.edt"); and assign it to a key combination (see installing a shortcut for instructions).

But the macro above is much to long. The WinEdt register %L holds already the content of the current line. So the following line will do the job:

 CMD("Go To Beginning Of Line");Ins('%L%\');

Note that "%\" has the same meaning as "\n" in C, namely a new line.

 CMD('Go To End Of Line');Ins('%\%L');

does the same job, but leaves you at the end of the second line. These macros are that short, that you probably don't need to save them in a extra macro file.

Of course, with wrapping on, the new line gets ... well, wrapped! This can be avoided by using InsText instead of Ins, which prevents any reformatting of the inserted text:

 CMD("Go To Beginning Of Line");InsText('%L%\');

4.2.7.

How can I change a text line by line (cyclically)?

Suppose the the following problem:

You want to use the filenames gathered in the tree of a project. You can store the filenames with GetTree(6); in register 6. The problem is that an asterisk is inserted before the filenames and you would like to get rid of them.

The following macro does the job. Register 6 keeps input and result.

GetTree(6);
LetRegNum(9,-1);
SetOK(1);
Loop(! >
FindInString("%!6", "<\*", 8, 9, 1001,%!9+1); >
IfOK(!' >
ReplaceInString("%!6", "<", %!8, %!9, 1, 6); >
',' >
Stop; >
'); >
);
End;
 Initialize resume index in register 9 The Loop macro allows you to deal with jobs, that have to be executed cyclically. As it is executed at least once, it works similar to a Repeat/Until instruction. Notice the ">" characters at the end of the lines (inside the loop). They instruct WinEdt to concatenate the lines into one single line while parsing the loop-argument. The break is set by Stop - usually in combination with a testing environment like IfOK Searching takes place in register 6, replacing too. Use of Regular Expression and Resume Index "<" : BOL; "\*" : escape the special meaning of "*" in the regular expression ) take "<\*@{ }" instead of "<\*" if you want discard the whitespace too (indentation) start searching at index %!9+1 and store the result in register 9 again. Regular Expressions (second last parameter) are activated to insert a new Beginning of Line with ">" . You can of course use anything else, for example ";" as token separator.

### 5. Resources

5.1. Where can I get more help?
5.2. How do I subscribe to the WinEdt mailing list?
5.3. How do I unsubscribe from the WinEdt mailing list?
5.4. Is there an archive for the WinEdt Mailing List?
5.5. Are that all frequently asked questions?
5.1.

Where can I get more help?

You can ask on WinEdt's Mailing List. Or, if you prefer that, you can directly contact the WinEdt Team .

If you have a question that is not directly related to WinEdt but rather to TeX, LaTeX and friends, you can search one of the TeX FAQs:

subscribe to a classical mailing list (only one known to me so far)

• comp.text.tex
• de.comp.text.tex
• fr.comp.text.tex

If you aren't able to register to newsgroups (because of firewalls,...), you may give http://groups-beta.google.com a try. This site displays with a delay of some hours the current content of specific newsgroups (in thread style) and you can google for a certain subject within a specific group. Take a look at comp.text.tex.

5.2.

How do I subscribe to the WinEdt mailing list?

Send an empty message to . Make sure that the return address in your e-mail is correct. On subscribing you will be sent instructions on how to remove yourself from the list, should you so wish.

5.3.

How do I unsubscribe from the WinEdt mailing list?

Send an empty message to . Do not send your request to the mailing list! This will have no effect except for annoying the subscribers.

5.4.

Is there an archive for the WinEdt Mailing List?

Yes. As of February 13, 2002, the messages on the Mailing List are archived on http://groups.yahoo.com/group/WinEdt.

5.5.

Are that all frequently asked questions?

Not at all. But WinEdt.org is the work of volunteers and our time is limited.

If you miss a question, and you know the answer, it would be great if you write it down and send it to me: , so that I can include it.

Feel free to notify me of mistakes, or to suggest improvements.