diff --git a/docs/yatex.ref b/docs/yatex.ref index 155e0e6..2a91c6d 100644 --- a/docs/yatex.ref +++ b/docs/yatex.ref @@ -72,7 +72,9 @@ �E\begin{}, \end{}�̏� �Ή����� \end{},\begin{} �� �E%#BEGIN, %#END �̏� �Ή����� %#BEGIN, %#END �� - �E\include(only), \input �̏� �Ή�����t�@�C�� + �E\include(only), \input �̏� �Ή�����t�@�C���� + �E\ref, \label �̏� �Ή����� \label, \ref �� + �E\cite, \bibitem �̏� �Ή����� \bibitem, \cite �� �����C���t�@�C���փW�����v [prefix] ^ ���ʃE�B���h�E�� �V [prefix] 4^ diff --git a/docs/yatexe.tex b/docs/yatexe.tex index cf25f07..3c6d5a6 100644 --- a/docs/yatexe.tex +++ b/docs/yatexe.tex @@ -906,7 +906,7 @@ @cindex cursor jump @cindex prefix g - On a @code{\begin},@code{\end} line, the key stroke + Typing @table @kbd @item [prefix] g @@ -914,13 +914,26 @@ @end table @noindent +in a certain place move the cursor to the place corresponding to the +La@TeX{} command of last place. YaTeX recognize the followings as pairs +that have relation each other. + +@table +@item @code{\begin@{@}} <-> @code{\end@{@}} +@item @code{%#BEGIN} <-> @code{%#END} +@item @code{\label@{@}} <-> @code{\ref@{@}} +@item @code{\include(\input)} -> included file +@item @code{\bibitem@{@}} <-> @code{\cite@{@}} +@end table + + On a @code{\begin},@code{\end} line, typing @kbd{[prefix] g} moves the cursor to the corresponding @code{\end},@code{\begin} line, if -its partner really exists. It is also applicable to A @code{%#BEGIN} and -@code{%#END} pair. +its partner really exists. The movement on the line @code{%#BEGIN} and +@code{%#END} are the same. If you type @code{[prefix] g} on the line of @code{\include@{chap1@}}, -maybe in main text, YaTeX switches buffer to @file{chap1.tex}. On the -contrary, the key strokes +typically in the main text, YaTeX switches buffer to @file{chap1.tex}. +The key strokes below work to the contrary. Typing @table @kbd @item [prefix] ^ diff --git a/docs/yatexj.tex b/docs/yatexj.tex index feed9c1..197859c 100644 --- a/docs/yatexj.tex +++ b/docs/yatexj.tex @@ -77,7 +77,8 @@ @item �쒹�ɂȂ��K�C�h�t���������͊֐��̎�������(@file{yatexgen.el}) @item La@TeX{} �R�}���h�̍폜/�ύX(@kbd{C-c k}, @kbd{C-c c}) @item �t�@�C���ԁA@code{\begin}<->@code{\end}�ԁA - @code{\ref}<->@code{\label}�ԃW�����v(@kbd{C-c g}) + @code{\ref}<->@code{\label}�ԁA + @code{\cite}<->@code{\bibitem}�W�����v(@kbd{C-c g}) @item �ꊇ�R�����g�A�E�g/�A���R�����g�A�E�g (@kbd{C-c >}, @kbd{C-c <}, @kbd{C-c ,}, @kbd{C-c .}) @item �A�N�Z���g�L��/�����‹��p�R�}���h/�M���V�������̓��͎x�� @@ -978,7 +979,7 @@ @cindex �J�[�\���W�����v[�������邵����] @cindex prefix g - @code{\begin@{@}} �� @code{\end@{@}} �̍s�ɃJ�[�\�������킹�A + �������̂��낢��ȏꏊ�� @table @kbd @item [prefix] g @@ -986,9 +987,21 @@ @end table @noindent +���������Ƃɂ��A�J�[�\���ʒu��La@TeX{}�R�}���h�ɑΉ�����ꏊ�ɃW�����v +���܂��B�Ή��֌W�����݂���Ɖ��߂����R�}���h�ɂ͈ȉ��̂��̂�����܂��B + +@table +@item @code{\begin@{@}}����@code{\end@{@}} +@item @code{%#BEGIN}����@code{%#END} +@item @code{\label@{@}}����@code{\ref@{@}} +@item @code{\include(\input)}���Ή�����t�@�C�� +@item @code{\bibitem@{@}}����@code{\cite@{@}} +@end table + + @code{\begin@{@}} �� @code{\end@{@}} �̍s��@kbd{[prefix] g} ���������Ƃɂ��A�Ή�����@code{end/begin}�̍s�ɃW�����v���܂��B�������� ��������̂��Ȃ��ꍇ�̓G���[�ɂȂ�܂��B�܂�����́A�̈�Œ�̂��߂� -@code{%#BEGIN} �� @code{%#END} �̃y�A�ɑ΂��Ă��g���܂��B +@code{%#BEGIN} �� @code{%#END} �̃y�A�ɑ΂��Ă����l�ɓ��삵�܂��B @xref{%#�L�@} ���C���� .tex �t�@�C���� @code{\include{chap1}} �ȂǂɃJ�[�\�������킹�A @@ -1025,6 +1038,8 @@ ��L�̃R�}���h�͒ʏ��@kbd{[prefix]}�L�[�ł͂Ȃ�@kbd{META}�L�[���v���t�B�N �X�Ƃ��ċ@�\����̂ł����Ӊ������B + + @node Modifying/Deleting, Filling item, Cursor jump, Top @comment node-name, next, previous, up @chapter �ύX/�폜 diff --git a/help/YATEXHLP.jp b/help/YATEXHLP.jp index be45216..ab35f0c 100644 --- a/help/YATEXHLP.jp +++ b/help/YATEXHLP.jp @@ -1054,8 +1054,8 @@ bibitem \bibitem{NAME} \bibitem[LABEL]{NAME} \bibitem{NAME}�̏����ł́ANAME�ŎQ�Ƃ���A[1],[2] �̂悤�Ȍ`�ň��p�L���� -�o�͂����A\bibitem[LABEL]{NAME}�̏����ł́A\cite{LABEL}�ŎQ�Ƃ���A -[Knuth82] �̂悤�Ȉ��p�L�����o�͂����B +�o�͂����A\bibitem[LABEL]{NAME}�̏����ł́A\cite{NAME}�ŎQ�Ƃ���A +[LABEL] �̂悤�Ȉ��p�L�����o�͂����B footnote \footnote{NOTE} diff --git a/yatex.el b/yatex.el index 6a1ea19..8ae55e7 100644 --- a/yatex.el +++ b/yatex.el Binary files differ diff --git a/yatex.new b/yatex.new index 3dcc3c3..0e3a825 100644 --- a/yatex.new +++ b/yatex.new @@ -1,6 +1,11 @@ Yet Another tex-mode for Emacs yatex.el �e�o�[�W�����̕ύX�_�ɂ‚��āB +1.53 Emacs-19�ŐV�P��̍X�V�����܂������Ȃ������̂����x�����������B + ref/label�W�����v�ŕʂ̃o�b�t�@��ref/label�ɔ�ׂ�悤�ɂ����B + ref/label�W�����v�Ɠ��`����cite/bibitem�ԂŔ�ׂ�悤�ɂ����B + cite/bibitem�̃A�h�C���֐��̒lj��B + 1.52 �O���v���Z�X�p�e���|�����o�b�t�@����frame�ɂ��鎞�ɂ͌�frame�Ƀe ���|�����o�b�t�@��popup���Ȃ��悤�ɂ����B Hilightening �ɓƎ��̃^�O�𓱓����AreverseVideo ��ON/OFF�̎����� diff --git a/yatexadd.el b/yatexadd.el index f188214..3eabc1c 100644 --- a/yatexadd.el +++ b/yatexadd.el @@ -2,7 +2,7 @@ ;;; YaTeX add-in functions. ;;; yatexadd.el rev.9 ;;; (c )1991-1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] -;;; Last modified Mon Aug 22 14:19:39 1994 on figaro +;;; Last modified Mon Oct 31 12:55:54 1994 on pajero ;;; $Id$ ;;; @@ -246,6 +246,18 @@ nil ) +(defun YaTeX:cite () + (let ((comment (read-string "Comment for citation: "))) + (if (string= comment "") "" + (concat "[" comment "]"))) +) + +(defun YaTeX:bibitem () + (let ((label (read-string "Citation label: "))) + (if (string= label "") "" + (concat "[" label "]"))) +) + ;;; ;;Subroutine ;;; @@ -327,11 +339,12 @@ (goto-char (match-beginning 0)))) (message YaTeX-label-guide-msg)) ) -(defun YaTeX::ref (argp) +(defun YaTeX::ref (argp &optional labelcmd refcmd) (cond ((= argp 1) (save-excursion - (let ((lnum 0) e0 m1 e1 label label-list (buf (current-buffer)) + (let ((lnum 0) e0 label label-list (buf (current-buffer)) + (labelcmd (or labelcmd "label")) (refcmd (or refcmd "ref")) (p (point)) initl line) (goto-char (point-min)) (message "Collecting labels...") @@ -339,27 +352,31 @@ (YaTeX-showup-buffer YaTeX-label-buffer (function (lambda (x) (window-width x)))) (with-output-to-temp-buffer YaTeX-label-buffer - (while (re-search-forward "\\label{\\([^}]+\\)}" nil t) - (setq e0 (match-end 0) m1 (match-beginning 1) e1 (match-end 1)) - (if (search-backward - YaTeX-comment-prefix (point-beginning-of-line) t) nil - (setq label (buffer-substring m1 e1) - label-list (cons label label-list)) - (or initl - (if (< p (point)) (setq initl lnum))) - (beginning-of-line) - (skip-chars-forward " \t\n" nil) - (princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label - (buffer-substring (point) (point-end-of-line)))) - (setq lnum (1+ lnum)) - (message "Collecting \\label{}... %d" lnum)) + (while (YaTeX-re-search-active-forward + (concat "\\\\" labelcmd) + (regexp-quote YaTeX-comment-prefix) nil t) + (goto-char (match-beginning 0)) + (skip-chars-forward "^{") + (setq label + (buffer-substring + (1+ (point)) + (prog2 (forward-list 1) (setq e0 (1- (point))))) + label-list (cons label label-list)) + (or initl + (if (< p (point)) (setq initl lnum))) + (beginning-of-line) + (skip-chars-forward " \t\n" nil) + (princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label + (buffer-substring (point) (point-end-of-line)))) + (setq lnum (1+ lnum)) + (message "Collecting \\%s{}... %d" labelcmd lnum) (goto-char e0)) (princ YaTeX-label-menu-other) (princ YaTeX-label-menu-repeat) (princ YaTeX-label-menu-any) );with (goto-char p) - (message "Collecting labels...Done") + (message "Collecting %s...Done" labelcmd) (pop-to-buffer YaTeX-label-buffer) (YaTeX::label-setup-key-map) (setq truncate-lines t) @@ -379,12 +396,12 @@ (save-excursion (switch-to-buffer buf) (goto-char p) - (if (re-search-backward "\\\\ref{\\([^}]+\\)}" nil t) - (setq label (buffer-substring - (match-beginning 1) (match-end 1))) + (if (re-search-backward + (concat "\\\\" refcmd "{\\([^}]+\\)}") nil t) + (setq label (YaTeX-match-string 1)) (setq label "")))) ((>= line (+ lnum 2)) - (setq label (read-string "\\ref{???}: "))) + (setq label (read-string (format "\\%s{???}: " refcmd)))) (t (setq label (nth (- lnum line 1) label-list))))) (bury-buffer YaTeX-label-buffer))) label @@ -392,19 +409,33 @@ )) ) (fset 'YaTeX::pageref 'YaTeX::ref) +(defun YaTeX::cite (argp) + (cond + ((eq argp 1) + (YaTeX::ref argp "bibitem\\(\\[.*\\]\\)?" "cite")) + (t nil))) -(defun YaTeX-label-other () - (let ((lbuf "*YaTeX mode buffers*") (blist (buffer-list)) (lnum -1) buf rv +(defun YaTeX-yatex-buffer-list () + (save-excursion + (delq nil (mapcar (function (lambda (buf) + (set-buffer buf) + (if (eq major-mode 'yatex-mode) buf))) + (buffer-list)))) +) + +(defun YaTeX-select-other-yatex-buffer () + "Select buffer from all yatex-mode's buffers interactivelly." + (interactive) + (let ((lbuf "*YaTeX mode buffers*") (blist (YaTeX-yatex-buffer-list)) + (lnum -1) buf rv (ff "**find-file**")) (YaTeX-showup-buffer lbuf (function (lambda (x) 1))) ;;Select next window surely. (with-output-to-temp-buffer lbuf (while blist - (if (and (buffer-file-name (setq buf (car blist))) - (progn (set-buffer buf) (eq major-mode 'yatex-mode))) - (princ - (format "%c:{%s}\n" (+ (% (setq lnum (1+ lnum)) 26) ?A) - (buffer-name buf)))) + (princ + (format "%c:{%s}\n" (+ (% (setq lnum (1+ lnum)) 26) ?A) + (buffer-name (car blist)))) (setq blist (cdr blist))) (princ (format "':{%s}" ff))) (pop-to-buffer lbuf) @@ -421,14 +452,20 @@ (if (re-search-forward "{\\([^\\}]+\\)}" (point-end-of-line) t) (buffer-substring (match-beginning 1) (match-end 1)) nil))) (kill-buffer lbuf)) + (if (string= rv ff) + (progn + (call-interactively 'find-file) + (current-buffer)) + rv)) +) + +(defun YaTeX-label-other () + (let ((rv (YaTeX-select-other-yatex-buffer))) (cond ((null rv) "") - ((string= rv ff) - (call-interactively 'find-file) - (YaTeX::ref argp)) (t (set-buffer rv) - (YaTeX::ref argp))) + (YaTeX::ref argp labelcmd refcmd))) ) )