// -*- ASCII:EDT -*- // smartQuote2.edt // (schlicht 20020713) ///////////////////////// //============================================================================================ // This macro will insert quotes depending on the document's mode (and language). // Additionally, it's smarter than WinEdt's default "Smart Quote" macro. // To install it, follow these steps: // 1. go to Options | Menu Setup | Main Menu, double-click on "Shortcuts" // 2. at the end of the list, "Insert" a new "Macro" item called "Smart Double Quotes", // 3. the Macro field must contain: // [Assign("smartQuote","double"); Exe("%b\Macros\text\smartQuote2.edt");] // 4. Click in the "Shortcut" field and type the double quote character " . // Optionally: // 5.-8. Do the same for the single quote character (the "Macro" field must read: // [Assign("smartQuote","single"); Exe("%b\Macros\text\smartQuote2.edt");] // and the shortcut must be the single quote character ', of course). //============================================================================================ // The quotation style will be determined as follows: // 1. If a style for the document's mode is defined (e.g. "TeX", or "TeX:DE"), // take the corresponding quotes; // 2. else try whether a style is defined if we subtract submode(s) // (e.g., if the document's mode is "TeX:US:UNIX", it would be "TeX:US", if it were // "TeX:ES:Soft", it would be "TeX" with the default definitions). // 3. If it's a TeX document, the macro will also search the preamble of the document for // a line like //% !smartQuote:: "Inverse French" // or (the older version) //% smartQuote: Inverse French // (without the preceding "//"). // 4. If all fails, take default quotes. //============================================================================================ // Unlike "Smart Quote.edt", this macro will not simply toggle quotes, but will determine // whether opening or closing quotation marks are desired by looking at the preceding // character. // If you do not want this extra smartness, change "yes" to "no" in the next line: Assign("smartQuoteSmarter","yes"); // An opening quotation mark will be inserted if the preceding character is one of the following: Assign("smartQuoteChars"," ({[/~"); //============================================================================================ // You do not need to add a second shortcut to be able to insert a normal quotation // mark. Instead, typing the quotation mark *twice* will give you the default. Assign("smartQuoteUndo","default"); // This does not apply for quotes where the opening and closing quotes are typed at once // (see below), unless you uncomment the following line: //Assign("smartQuoteUndo","always"); // You can also turn off this feature completely by uncommenting the following line: //Assign("smartQuoteUndo","never"); //============================================================================================ // Here you can define the type of quotation marks for each document mode. // // The syntax of the definitions is as follows: // [|][|] // If you precede either of the pairs of square brackets with a `+', both quotes will be inserted // at once, and the caret will jump in the middle of them (just run "Macros | Execute Current Macro" // now, to see what I mean.) // The variables have to be called "smartQuote_" or "smartQuote_tex_