Newsgroups: comp.sys.next.software Path: sparky!uunet!UB.com!pacbell.com!decwrl!ads.com!bvrotney From: bvrotney@ADS.COM (Bill Vrotney) Subject: Re: TeX backslash ( on the NeXT In-Reply-To: reid@utstat.toronto.edu's message of Tue, 26 Jan 1993 18:26:34 GMT Message-ID: <1993Jan27.080245.333@ads.com> Sender: usenet@ads.com (USENET News) Organization: Advanced Decision Systems, Mtn. View, CA (415) 960-7300 Distribution: comp.sys.next.software Date: Wed, 27 Jan 1993 08:02:45 GMT Lines: 133

In article <C1H4KB.M8y@utstat.toronto.edu> reid@utstat.toronto.edu (Nancy Reid) writes:

> Newsgroups: comp.sys.next.software > Path: ads.com!ames!saimiri.primate.wisc.edu!usenet.coe.montana.edu!rpi!utcsri!utgpu!utstat!reid > From: reid@utstat.toronto.edu (Nancy Reid) > Organization: U of Toronto Statistics > Distribution: comp.sys.next.software > Date: Tue, 26 Jan 1993 18:26:34 GMT > Lines: 3 > > Is there a way to redefine keys on the NeXT keyboard so that the > backslash character ( is in a more convenient place, thus making > TeX and LateX files much easier to type?

I have done this one better. If you like to use EMACS I have generated a function and keybindings for TeX mode so that you can insert any TeX commands command> (that the user specifies in a table) with a single keystroke. With this you will never have to enter a in TeX again. This same function will also insert various TeX brackets depending on its argument. An argument of 0 would insert the command> by itself. For example

largetext C-cC-c l

would result in

largetext

where as

ESC 0 C-cC-c l

would result in

Hitting C-cC-c RET would display the table of command keys. I placed the elisp code below for anyone who wants it.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Define commands for inserting TeX bracketed commands. ; (you can add to or modify this table).

(defconst ct:*TeX-brackets* '((?

"em")(?

"bf") (?' "tt") (?. "item" ?

)(? = "verbatim")(?/"index")(?;&#x361"noindent")(?0"document")(?1"section"?{)(?2"subsection"?{)(?3"subsubsection"?{)(?d"description")(?e"enumerate")(?i"itemize")(?l"large")(?n"normalsize")(?p"samepage")(?q"quote")(?r"rm")(?s"small")(?t"tabular")(?v"vspace"?{)))

(defunct : TeX - bracket(arg)"GivenaselectioncharacterbracketspreviouswordwiththeTeXcommandassociatedwiththeselectioninthevariablect : *TeX - brackets*.IfARG = nbracketspreviousnwords(- nbracketsnextnwords).IfARG = 1bracketsregion.IfARG = 0justinsertstheTeXcommand.IfARG = CNTL - UbracketsregionwithbeginandendTeXcommands."(interactive"P")(message"Enterselectioncharacter(RETURNgivesselections) : ")(let*((selection(read - char))(bracket - spec(if (eqselection?)&#x30A;nil (cdr(assocselectionct : *TeX - brackets*))))(special - bracket(if (= (lengthbracket - spec)2)(nth1bracket - spec)))(left - bracket(char - to - string(ifspecial - bracketspecial - bracket?{)))(right - bracket(cond ((string = left - bracket"[")"]")((string = left - bracket"")"")))(TeX - word (carbracket - spec))(new - line"$\displaystyle \n$")(begin - insert(cond ((consparg)(concat"
begin"left - bracketTeX - wordright - bracketnew - line))((and (numberparg)(= arg0))(concat"
"TeX - word ))(special - bracket(concat"
"TeX - wordleft - bracket))(t(concatleft - bracket"
"TeX - word""))))(end - insert(if (consparg)(concat"
end"left - bracketTeX - wordright - bracketnew - line)right - bracket)))(if (notarg)(setqarg1)(if (and (numberparg)(= arg1))(setqargnil )))(ifbracket - spec(cond ((and (numberparg)(= arg0))(insertbegin - insert))(t(let(beginend )(cond ((listparg)(setqbegin(region - beginning))(setqend (region - end )))(t(if ( < arg0)(setqbegin(point))(setqend (point)))(backward - wordarg)(if ( < arg0)(setqend (point))(setqbegin(point)))))(goto - charbegin)(insertbegin - insert)(goto - char(+ end (lengthbegin - insert)))(insertend - insert))))(ct : show - TeX - brackets))))

(defunct : show - TeX - brackets()(with - output - to - temp - buffer"*TeX - bracket - selections*"(buffer - flush - undostandard - output)(let((n0))(mapcar'(lambda(bracket - spec)(terpri)(princ(char - to - string(carbracket - spec)))(princ" = ")(princ(car(cdrbracket - spec))))ct : *TeX - brackets*))))

(define - keyTeX - mode - map"$\displaystyle \C$ - c$\displaystyle \C$ - c"'ct : TeX - bracket)

- - BillVrotneyBAH/AdvancedDecisionSystems