WinEdt Macro Library  | LaTEX previous macro  | next macro



This macro allows the user to choose from several TEX scripts to be inserted.

The macro is called by an active string. It then checks in a particular folder (according to the name of the active string) all files in *.tex format. Those files have been previously put there by the user and contain useful patterns. The first script appears on the screen highlighted in yellow so that there is no possible confusion with the rest of the code. Then the macro waits for the user to:

  • press Right arrow key to display the next script
  • press Left arrow key to display the previous script
  • press Enter to insert the script in the current file and put the caret on the first bullet

If, when a script is displayed, the user clicks somewhere in the code or changes the current document, the macro stops to avoid unwanted actions.


  • Put the macro in %b\Macros\LaTeX\
  • Create a folder %b\Macros\LaTeX\Choice
  • In this folder Choice, put all the TEX scripts. More precisely, put them into different subfolders whose names are the same as the keywords. For example: I want all my preambles to be accessible with the keyword "pr" followed by the character "*" (the * is for the active string). In that case, I create a folder named "pr" in %b\Macros\LaTeX\Choice and put all my preambles in that folder (%b\Macros\LaTeX\Choice\pr). Attention: put them in .tex format (example: preamble1.tex; preamble2.tex). The names of the files don't matter (because the macro looks into the folder and automatically lists all the files in there).
  • Now, for the keywords. Continuing the last example, you would define an active string:
    • For WinEdt 5.6 or older go to Options | Settings:
      On Type:TeX
    • For WinEdt 6, open the file Active Strings.ini (in the Delimiters section) and add the following lines:



Macro contributed by Peter Laurence <>

WinEdt Macro Library  | LaTEX previous macro  | next macro