yatex
changeset 163:a521e761f82c dev
New add-in function YaTeX::label automatically adds \ref{} string to kill-ring.
author | yuuji@gentei.org |
---|---|
date | Mon, 14 Feb 2011 12:40:00 +0900 |
parents | af550c574ae1 |
children | 59e47ed6b334 |
files | yatexadd.el |
diffstat | 1 files changed, 21 insertions(+), 1 deletions(-) [+] |
line diff
1.1 --- a/yatexadd.el Mon Dec 27 19:17:13 2010 +0900 1.2 +++ b/yatexadd.el Mon Feb 14 12:40:00 2011 +0900 1.3 @@ -2,7 +2,7 @@ 1.4 ;;; YaTeX add-in functions. 1.5 ;;; yatexadd.el rev.18 1.6 ;;; (c)1991-2006 by HIROSE Yuuji.[yuuji@yatex.org] 1.7 -;;; Last modified Thu Sep 9 09:08:19 2010 on firestorm 1.8 +;;; Last modified Mon Feb 14 12:32:10 2011 on firestorm 1.9 ;;; $Id$ 1.10 1.11 ;;; 1.12 @@ -1119,6 +1119,26 @@ 1.13 (bury-buffer YaTeX-label-buffer))) 1.14 label))))) 1.15 1.16 +(defun YaTeX::label (argp &optional refname) 1.17 + "Read label name and return it with copying \\ref{LABEL-NAME} to kill-ring." 1.18 + (cond 1.19 + ((= argp 1) 1.20 + (let*((dlab (if (boundp (intern-soft "old")) 1.21 + old ;if called via YaTeX-change-section (tricky...) 1.22 + (YaTeX::ref-default-label))) 1.23 + (label (read-string "New label name: " (cons dlab 1)))) 1.24 + (if (string< "" label) 1.25 + (let ((refstr (format "\\%s{%s}" (or refname "ref") label)) 1.26 + (key (key-description (where-is-internal 'yank nil t))) 1.27 + (msg 1.28 + (if YaTeX-japan 1.29 + "をkill-ringに入れました。yank(%s)で取り出せます。" 1.30 + " is stored into kill-ring. Paste it by yank(%s)."))) 1.31 + (kill-new refstr) 1.32 + (message (concat "`%s'" msg) refstr key))) 1.33 + label)))) 1.34 + 1.35 + 1.36 (fset 'YaTeX::pageref 'YaTeX::ref) 1.37 (defun YaTeX::tabref (argp) ; For the style file of IPSJ journal 1.38 (YaTeX::ref