WinEdtWinEdt Macro: Select Text to first SPACE

Information and discussion about WinEdt, a commercial integrated LaTeX environment for Windows
Post Reply
Dzaic
Posts: 1
Joined: Wed Jun 15, 2016 2:08 pm

WinEdt Macro: Select Text to first SPACE

Post by Dzaic »

Hello

First I would like to apologize for my english.

I would like to learn the makro language included in WinEdt. For this purpose I have choosen an "easy" task:

- Replace the text to the left of the cursor by \ac{TEXT} if the characters ".-" are entered.

So far, so good. I have added the following Active String

Code: Select all

STRING=".-"
  ENABLED=1
  MODE_FILTER="TeX"
  MACRO="[Exe('%b\Macros\Active Strings\Acronym.edt');]"


My current status of the file Acronym.edt is as follows:

Code: Select all

// -*- ASCII:EDT -*-
// Active String for \ac{}

Backspace(2);
SelWordLeft(1);
UpperCase;
InsText('\ac{%S}');
My problem is, that I don't know, how to expand the selection to the first space-character to the left of the cursur.

Example:

ab.- expands well do \ac{AB}, but ba-aa expands to ba-\ac{AA} instead of \ac{BA-AA}.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
Post Reply