在 AUCTeX 中,我希望LaTeX-environment
and/or的行为LaTeX-insert-item
能够创建多个项目每一个调用时标示为活动状态。
答案1
如果我理解了你想要什么,下面的代码应该可以解决问题:
(defadvice LaTeX-env-item
(around LaTeX-env-item-region activate)
"When there is an active region, wrap the environment around it.
Insert \\item macros at the beginning of every non empty line of the region."
(let ((beg (min (point) (mark)))
(if (< (point) (mark))
(exchange-point-and-mark))
(save-excursion
(while (re-search-backward "^\\(.+\\)$" beg t)
(replace-match "\\\\item \\1" t nil)
(beginning-of-line 1))))
ad-do-it
;; Remove the extra \item.
(re-search-forward "\\\\item " (save-excursion (end-of-line)) t)
(replace-match ""))
这适用于所有插入的环境,LaTeX-env-item
即默认情况下enumerate
、、、和。itemize
trivlist
description
theindex