|
LaTeX environment
[Back]
Use this macro after you have typed the name
of a LaTeX enviroment, it will insert \begin{} and \end{}:
c = $cursor
backward_word()
select($cursor, c)
s = get_selection()
delete_selection()
insert_string("\\begin{"s"}\n")
c = $cursor
insert_string("\\end{"s"}")
set_cursor_pos(c)
Alternatively, these smart indent macros insert a corresponding \end{}
after you type a \begin{}:
No initialization macro
Newline macro:
return -1
Type-in macro:
if ($2 == "}")
{
start_env = search("{", $1, "regex", "backward")
start_cmd = search("begin", start_env, "regex", "backward")
if (start_env != $search_end)
return
env = get_range(start_env + 1, $1)
newline()
insert_string("\\end{" env "}\n")
set_cursor_pos($1)
}
[Back]
Released on Wed, 21 Nov 2001
by
C. Denat
|
|