yatex

changeset 458:1a891f775194 dev

'figure' and 'figcaption'
author HIROSE Yuuji <yuuji@gentei.org>
date Tue, 16 May 2017 08:30:04 +0859
parents 428584533eab
children 5709236dafb3
files yahtml.el yatex.el yatexadd.el
diffstat 3 files changed, 251 insertions(+), 245 deletions(-) [+]
line diff
     1.1 --- a/yahtml.el	Thu May 04 10:32:22 2017 +0859
     1.2 +++ b/yahtml.el	Tue May 16 08:30:04 2017 +0859
     1.3 @@ -1,9 +1,9 @@
     1.4  ;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*-
     1.5  ;;; (c) 1994-2017 by HIROSE Yuuji [yuuji(@)yatex.org]
     1.6 -;;; Last modified Thu Jan  5 17:45:36 2017 on firestorm
     1.7 +;;; Last modified Tue May 16 08:13:52 2017 on firestorm
     1.8  ;;; $Id$
     1.9  
    1.10 -(defconst yahtml-revision-number "1.79.2"
    1.11 +(defconst yahtml-revision-number "1.79.3"
    1.12    "Revision number of running yahtml.el")
    1.13  
    1.14  ;;; Commentary:
    1.15 @@ -444,7 +444,7 @@
    1.16      ("style") ("script") ("noscript") ("div") ("object") ("ins") ("del")
    1.17      ("option") ("datalist")
    1.18      ;;HTML5
    1.19 -    ("video") ("audio")
    1.20 +    ("video") ("audio") ("figure")
    1.21      ))
    1.22  
    1.23  (if yahtml-html4-strict
    1.24 @@ -476,7 +476,10 @@
    1.25    (append
    1.26     '(("dfn") ("em") ("cite") ("code") ("kbd") ("samp") ("caption")
    1.27       ("strong") ("var") ("b") ("i") ("tt") ("big") ("small")
    1.28 -     ("sup") ("sub") ("span") ("abbr") ("label"))
    1.29 +     ("sup") ("sub") ("span") ("abbr") ("label")
    1.30 +     ;; HTML5
    1.31 +     ("figcaption")
    1.32 +     )
    1.33     (if (not yahtml-html4-strict)
    1.34         '(("strike") ("s") ("u") ("font")))
    1.35     yahtml-env-table)
    1.36 @@ -1447,7 +1450,7 @@
    1.37  
    1.38  (defun yahtml:ol ()
    1.39    "Add-in function for <ol>"
    1.40 -  (setq yahtml-last-single-cmd "li")
    1.41 +  (setq yahtml-last-typeface-cmd "li")
    1.42    (let ((start (YaTeX-read-string-or-skip "start="))
    1.43  	(type (YaTeX-completing-read-or-skip
    1.44  	       "type=" '(("1") ("a") ("A") ("i") ("I")) nil t)))
    1.45 @@ -1455,11 +1458,11 @@
    1.46       (yahtml-make-optional-argument "start" start)
    1.47       (yahtml-make-optional-argument "type" type))))
    1.48  (defun yahtml:ul ()
    1.49 -  (setq yahtml-last-single-cmd "li") "")
    1.50 +  (setq yahtml-last-typeface-cmd "li") "")
    1.51  (defun yahtml:dl ()
    1.52 -  (setq yahtml-last-single-cmd "dt") "")
    1.53 +  (setq yahtml-last-typeface-cmd "dt") "")
    1.54  (defun yahtml:dt ()
    1.55 -  (setq yahtml-last-single-cmd "dd") "")
    1.56 +  (setq yahtml-last-typeface-cmd "dd") "")
    1.57  
    1.58  (defun yahtml:p ()
    1.59    (if yahtml-html4-strict nil
    1.60 @@ -1569,8 +1572,7 @@
    1.61  
    1.62  (defun yahtml:tr ()
    1.63    "Add-in function for `tr'"
    1.64 -  (setq ;yahtml-last-begend "td"		;; which do you prefer?
    1.65 -	yahtml-last-typeface-cmd "td")
    1.66 +  (setq yahtml-last-typeface-cmd "td")
    1.67    "")
    1.68  
    1.69  (defun yahtml:link ()
     2.1 --- a/yatex.el	Thu May 04 10:32:22 2017 +0859
     2.2 +++ b/yatex.el	Tue May 16 08:30:04 2017 +0859
     2.3 @@ -1,6 +1,6 @@
     2.4  ;;; yatex.el --- Yet Another tex-mode for emacs //野鳥// -*- coding: sjis -*-
     2.5  ;;; (c)1991-2017 by HIROSE Yuuji.[yuuji@yatex.org]
     2.6 -;;; Last modified Mon Mar  6 17:40:50 2017 on firestorm
     2.7 +;;; Last modified Tue May 16 08:08:28 2017 on firestorm
     2.8  ;;; $Id$
     2.9  ;;; The latest version of this software is always available at;
    2.10  ;;; http://www.yatex.org/
    2.11 @@ -8,7 +8,7 @@
    2.12  ;;; Code:
    2.13  (require 'comment)
    2.14  (require 'yatexlib)
    2.15 -(defconst YaTeX-revision-number "1.79.2"
    2.16 +(defconst YaTeX-revision-number "1.79.3"
    2.17    "Revision number of running yatex.el")
    2.18  
    2.19  ;---------- Local variables ----------
     3.1 --- a/yatexadd.el	Thu May 04 10:32:22 2017 +0859
     3.2 +++ b/yatexadd.el	Tue May 16 08:30:04 2017 +0859
     3.3 @@ -1,6 +1,6 @@
     3.4  ;;; yatexadd.el --- YaTeX add-in functions -*- coding: sjis -*-
     3.5  ;;; (c)1991-2017 by HIROSE Yuuji.[yuuji@yatex.org]
     3.6 -;;; Last modified Mon Mar  6 08:52:37 2017 on firestorm
     3.7 +;;; Last modified Tue Mar  7 09:30:50 2017 on firestorm
     3.8  ;;; $Id$
     3.9  
    3.10  ;;; Code:
    3.11 @@ -853,37 +853,39 @@
    3.12    "*ref補完で収集するセクショニングコマンドの下限レベル
    3.13  YaTeX-sectioning-levelの数値で指定.")
    3.14  
    3.15 -(defun YaTeX::ref-1 ()
    3.16 +(defun YaTeX::ref-1 (&optional nest-level)
    3.17    ;; Sub-function of YaTeX::ref() for recursive call
    3.18    ;; DO NOT CALL FROM OTHER FUNCTIONS but YaTeX:ref()
    3.19 -  (while (YaTeX-re-search-active-forward
    3.20 -	  regexp ;;counter
    3.21 -	  percent nil t)
    3.22 +  (setq nest-level (or nest-level 0))
    3.23 +  (let ((labelleader (substring "     " 0 nest-level))
    3.24 +	label)
    3.25 +    (while (YaTeX-re-search-active-forward
    3.26 +	    regexp ;;counter
    3.27 +	    percent nil t)
    3.28  					;(goto-char (match-beginning 0))
    3.29 -    (setq e0 (match-end 0))
    3.30 -    (cond
    3.31 -     ;; 
    3.32 -     ;;2005/10/21 Skip it if predicate function returns nil
    3.33 -     ((and predf
    3.34 -	   (let ((md (match-data)))
    3.35 -	     (prog1
    3.36 -		 (condition-case nil
    3.37 -		     (not (funcall predf))
    3.38 -		   (error nil))
    3.39 -	       (store-match-data md)))))
    3.40 -     ((YaTeX-literal-p) nil)
    3.41 -     ((YaTeX-match-string 1)
    3.42 -      ;;if standard counter commands found 
    3.43 -      (setq cmd (YaTeX-match-string 2)
    3.44 -	    m0 (match-beginning 0))
    3.45 -      (setq match-point (match-beginning 0))
    3.46 -      (or initl
    3.47 -	  (if (< p (point)) (setq initl lnum)))
    3.48 +      (setq e0 (match-end 0))
    3.49        (cond
    3.50 -       ;; In any case, variables e0 should be set
    3.51 -       ((and YaTeX-use-AMS-LaTeX
    3.52 -	     (string-match YaTeX::ref-nestable-counter-regexp cmd))
    3.53 -	(let (label)
    3.54 +       ;; 
    3.55 +       ;;2005/10/21 Skip it if predicate function returns nil
    3.56 +       ((and predf
    3.57 +	     (let ((md (match-data)))
    3.58 +	       (prog1
    3.59 +		   (condition-case nil
    3.60 +		       (not (funcall predf))
    3.61 +		     (error nil))
    3.62 +		 (store-match-data md)))))
    3.63 +       ((YaTeX-literal-p) nil)
    3.64 +       ((YaTeX-match-string 1)
    3.65 +	;;if standard counter commands found 
    3.66 +	(setq cmd (YaTeX-match-string 2)
    3.67 +	      m0 (match-beginning 0))
    3.68 +	(setq match-point (match-beginning 0))
    3.69 +	(or initl
    3.70 +	    (if (< p (point)) (setq initl lnum)))
    3.71 +	(cond
    3.72 +	 ;; In any case, variables e0 should be set
    3.73 +	 ((and YaTeX-use-AMS-LaTeX
    3.74 +	       (string-match YaTeX::ref-nestable-counter-regexp cmd))
    3.75  	  (skip-chars-forward "}")
    3.76  	  (setq label (buffer-substring
    3.77  		       (point) (min (+ 80 (point)) (point-max))))
    3.78 @@ -896,217 +898,219 @@
    3.79  	  (if (looking-at "\\\\label{\\([^}]+\\)}")
    3.80  	      (setq label (format "(labe:%s)" (YaTeX-match-string 1))
    3.81  		    e0 (match-end 1)))
    3.82 -	  (funcall output (format "--subequation--%s" label) e0 'eqn)))
    3.83 -       ((string-match mathenvs cmd) ;;if matches mathematical env
    3.84 -	(skip-chars-forward "}")
    3.85 -	(setq x (point)
    3.86 -	      envname (substring
    3.87 -		       cmd (match-beginning 0) (match-end 0)))
    3.88 -	(save-restriction
    3.89 -	  (narrow-to-region
    3.90 -	   m0
    3.91 -	   (save-excursion
    3.92 -	     (YaTeX-re-search-active-forward
    3.93 -	      (setq endrx (format "%send{%s}" YaTeX-ec-regexp
    3.94 -				  (regexp-quote envname)))
    3.95 -	      percent nil t)))
    3.96 -	  (catch 'scan
    3.97 -	    (while (YaTeX-re-search-active-forward
    3.98 -		    (concat
    3.99 -		     "\\\\end{\\(" (regexp-quote envname) "\\)"	;;(1)
   3.100 -		     "\\|\\\\\\(notag\\)"			;;2
   3.101 -		     (if (string-match
   3.102 -			  YaTeX::ref-mathenv-exp1-regexp  cmd)
   3.103 -			 "" "\\|\\(\\\\\\\\\\)$") ;;3
   3.104 -		     )
   3.105 -		    percent nil t)
   3.106 -	      (let*((quit (match-beginning 1))
   3.107 -		    (notag (match-beginning 2))
   3.108 -		    (newln (match-beginning 3))
   3.109 -		    (label ".......................") l2
   3.110 -		    (e (point)) (m0 (match-beginning 0))
   3.111 -		    (ln (YaTeX-string-width label)))
   3.112 -		(cond
   3.113 -		 (notag
   3.114 -		  (YaTeX-re-search-active-forward
   3.115 -		   "\\\\\\\\" percent nil 1)
   3.116 -		  (setq x (point)))	;use x as \label search bound
   3.117 -		 ((and newln		; `\\' found
   3.118 -		       (not (equal (YaTeX-inner-environment)
   3.119 -				   envname)))
   3.120 -		  (YaTeX-end-of-environment)
   3.121 -		  (goto-char (match-end 0)))
   3.122 -		 (t
   3.123 -		  (if (YaTeX-re-search-active-backward
   3.124 -		       YaTeX::ref-labeling-regexp
   3.125 -		       percent x t)
   3.126 -		      ;; if \label{x} in math-expression, display it
   3.127 -		      ;; because formula source is hard to recognize
   3.128 -		      (progn
   3.129 -			(goto-char (match-end 0))
   3.130 -			(setq l2 (format "\"label:%s\""
   3.131 -					 (buffer-substring
   3.132 -					  (1- (point))
   3.133 -					  (progn (forward-sexp -1)
   3.134 -						 (1+ (point))))))
   3.135 -			(setq label
   3.136 -			      (if (< (YaTeX-string-width l2) ln)
   3.137 -				  (concat
   3.138 -				   l2
   3.139 -				   (substring
   3.140 -				    label
   3.141 -				    0 (- ln (YaTeX-string-width l2))))
   3.142 -				l2))
   3.143 -			(goto-char e)))
   3.144 -		  (funcall output
   3.145 -			   (concat
   3.146 -			    label " "
   3.147 -			    (buffer-substring x m0))
   3.148 -			   x 'eqn)
   3.149 +	  (funcall output
   3.150 +		   (format "--subequation--%s%s" labelleader label)
   3.151 +		   e0 'eqn))
   3.152 +	 ((string-match mathenvs cmd) ;;if matches mathematical env
   3.153 +	  (skip-chars-forward "}")
   3.154 +	  (setq x (point)
   3.155 +		envname (substring
   3.156 +			 cmd (match-beginning 0) (match-end 0)))
   3.157 +	  (save-restriction
   3.158 +	    (narrow-to-region
   3.159 +	     m0
   3.160 +	     (save-excursion
   3.161 +	       (YaTeX-re-search-active-forward
   3.162 +		(setq endrx (format "%send{%s}" YaTeX-ec-regexp
   3.163 +				    (regexp-quote envname)))
   3.164 +		percent nil t)))
   3.165 +	    (catch 'scan
   3.166 +	      (while (YaTeX-re-search-active-forward
   3.167 +		      (concat
   3.168 +		       "\\\\end{\\(" (regexp-quote envname) "\\)" ;;(1)
   3.169 +		       "\\|\\\\\\(notag\\)"			  ;;2
   3.170 +		       (if (string-match
   3.171 +			    YaTeX::ref-mathenv-exp1-regexp  cmd)
   3.172 +			   "" "\\|\\(\\\\\\\\\\)$") ;;3
   3.173 +		       )
   3.174 +		      percent nil t)
   3.175 +		(let*((quit (match-beginning 1))
   3.176 +		      (notag (match-beginning 2))
   3.177 +		      (newln (match-beginning 3))
   3.178 +		      (label ".......................") l2
   3.179 +		      (e (point)) (m0 (match-beginning 0))
   3.180 +		      (ln (YaTeX-string-width label)))
   3.181  		  (cond
   3.182 -		   ((YaTeX-quick-in-environment-p
   3.183 -		     YaTeX-math-gathering-list)
   3.184 -		    ;; if here is inner split/cases/gathered env.,
   3.185 -		    ;; counter for here is only one.
   3.186 -		    ;; Go out this environment and,
   3.187 +		   (notag
   3.188 +		    (YaTeX-re-search-active-forward
   3.189 +		     "\\\\\\\\" percent nil 1)
   3.190 +		    (setq x (point)))	;use x as \label search bound
   3.191 +		   ((and newln		; `\\' found
   3.192 +			 (not (equal (YaTeX-inner-environment)
   3.193 +				     envname)))
   3.194  		    (YaTeX-end-of-environment)
   3.195 -		    ;; search next expression unit boundary.
   3.196 -		    (YaTeX-re-search-active-forward
   3.197 -		     (concat endrx "\\|\\\\begin{")
   3.198 -		     percent nil 1)
   3.199 -		    (end-of-line)))
   3.200 -		  (if quit (throw 'scan t)))))
   3.201 -	      (setq x (point)))))
   3.202 -	(setq e0 (point)))
   3.203 -       ((string-match enums cmd)
   3.204 +		    (goto-char (match-end 0)))
   3.205 +		   (t
   3.206 +		    (if (YaTeX-re-search-active-backward
   3.207 +			 YaTeX::ref-labeling-regexp
   3.208 +			 percent x t)
   3.209 +			;; if \label{x} in math-expression, display it
   3.210 +			;; because formula source is hard to recognize
   3.211 +			(progn
   3.212 +			  (goto-char (match-end 0))
   3.213 +			  (setq l2 (format "\"label:%s\""
   3.214 +					   (buffer-substring
   3.215 +					    (1- (point))
   3.216 +					    (progn (forward-sexp -1)
   3.217 +						   (1+ (point))))))
   3.218 +			  (setq label
   3.219 +				(if (< (YaTeX-string-width l2) ln)
   3.220 +				    (concat
   3.221 +				     l2
   3.222 +				     (substring
   3.223 +				      label
   3.224 +				      0 (- ln (YaTeX-string-width l2))))
   3.225 +				  l2))
   3.226 +			  (goto-char e)))
   3.227 +		    (funcall output
   3.228 +			     (concat
   3.229 +			      labelleader label " "
   3.230 +			      (buffer-substring x m0))
   3.231 +			     x 'eqn)
   3.232 +		    (cond
   3.233 +		     ((YaTeX-quick-in-environment-p
   3.234 +		       YaTeX-math-gathering-list)
   3.235 +		      ;; if here is inner split/cases/gathered env.,
   3.236 +		      ;; counter for here is only one.
   3.237 +		      ;; Go out this environment and,
   3.238 +		      (YaTeX-end-of-environment)
   3.239 +		      ;; search next expression unit boundary.
   3.240 +		      (YaTeX-re-search-active-forward
   3.241 +		       (concat endrx "\\|\\\\begin{")
   3.242 +		       percent nil 1)
   3.243 +		      (end-of-line)))
   3.244 +		    (if quit (throw 'scan t)))))
   3.245 +		(setq x (point)))))
   3.246 +	  (setq e0 (point)))
   3.247 +	 ((string-match enums cmd)
   3.248  					;(skip-chars-forward "} \t\n")
   3.249 -	(save-restriction
   3.250 -	  (narrow-to-region
   3.251 -	   (point)
   3.252 -	   (save-excursion
   3.253 -	     (YaTeX-goto-corresponding-environment nil t 'nonstop) (point)))
   3.254 -	  (forward-line 1)
   3.255 -	  (let ((b0 nil) mb0)
   3.256 -	    (while (not (eobp))
   3.257 -	      (setq x (and
   3.258 -		       (YaTeX-re-search-active-forward
   3.259 -			(concat YaTeX-ec-regexp "item\\s ")
   3.260 -			percent nil 1)
   3.261 -		       (match-beginning 0)))
   3.262 +	  (save-restriction
   3.263 +	    (narrow-to-region
   3.264 +	     (point)
   3.265 +	     (save-excursion
   3.266 +	       (YaTeX-goto-corresponding-environment nil t 'nonstop) (point)))
   3.267 +	    (forward-line 1)
   3.268 +	    (let ((b0 nil) mb0)
   3.269 +	      (while (not (eobp))
   3.270 +		(setq x (and
   3.271 +			 (YaTeX-re-search-active-forward
   3.272 +			  (concat YaTeX-ec-regexp "item\\s ")
   3.273 +			  percent nil 1)
   3.274 +			 (match-beginning 0)))
   3.275  
   3.276 -	      (if b0			;Inspect sentence after previous \item
   3.277 -		  (save-excursion
   3.278 -		    (save-restriction
   3.279 -		      (let ((md (match-data)))		;save-match-data 
   3.280 -			(unwind-protect
   3.281 -			    (progn
   3.282 -			      (narrow-to-region b0 (or x (point)))
   3.283 -			      (goto-char (point-min))
   3.284 -			      (let ((x x)) (YaTeX::ref-1))
   3.285 -			      (goto-char (point-max)))
   3.286 -			  (store-match-data md))))))
   3.287 -	      (if x			;Output THIS \item line
   3.288 -		  (funcall
   3.289 -		   output
   3.290 -		   (concat
   3.291 -		    existlabel
   3.292 +		(if b0		  ;Inspect sentence after previous \item
   3.293 +		    (save-excursion
   3.294 +		      (save-restriction
   3.295 +			(let ((md (match-data))) ;save-match-data 
   3.296 +			  (unwind-protect
   3.297 +			      (progn
   3.298 +				(narrow-to-region b0 (or x (point)))
   3.299 +				(goto-char (point-min))
   3.300 +				(let ((x x)) (YaTeX::ref-1 (1+ nest-level)))
   3.301 +				(goto-char (point-max)))
   3.302 +			    (store-match-data md))))))
   3.303 +		(if x			;Output THIS \item line
   3.304 +		    (funcall
   3.305 +		     output
   3.306 +		     (concat
   3.307 +		      labelleader existlabel
   3.308 +		      (buffer-substring
   3.309 +		       (match-beginning 0)
   3.310 +		       (if (re-search-forward itemsep nil 1)
   3.311 +			   (progn (goto-char (match-beginning 0))
   3.312 +				  (skip-chars-backward " \t")
   3.313 +				  (1- (point)))
   3.314 +			 (point-end-of-line))))
   3.315 +		     x 'item))
   3.316 +		(setq b0 (point))
   3.317 +		))
   3.318 +	    (setq e0 (point-max))))
   3.319 +	 ((string-match "bibitem" cmd)	;maybe generated by myself
   3.320 +	  (setq label "")
   3.321 +	  (skip-chars-forward " \t")
   3.322 +	  (if (looking-at "{")		;sure to be true!!
   3.323 +	      (forward-list 1))
   3.324 +	  (let ((list '(30 10 65))
   3.325 +		(delim ";") q lim len l str)
   3.326 +	    (save-excursion
   3.327 +	      (setq lim (if (re-search-forward itemsep nil 1)
   3.328 +			    (match-beginning 0) (point))))
   3.329 +	    (while list
   3.330 +	      (skip-chars-forward " \t\n\\")
   3.331 +	      (setq q (looking-at "[\"'{]")
   3.332 +		    len (car list)
   3.333 +		    str
   3.334  		    (buffer-substring
   3.335 -		     (match-beginning 0)
   3.336 -		     (if (re-search-forward itemsep nil 1)
   3.337 -			 (progn (goto-char (match-beginning 0))
   3.338 -				(skip-chars-backward " \t")
   3.339 -				(1- (point)))
   3.340 -		       (point-end-of-line))))
   3.341 -		   x 'item))
   3.342 -	      (setq b0 (point))
   3.343 -	      ))
   3.344 -	  (setq e0 (point-max))))
   3.345 -       ((string-match "bibitem" cmd)	;maybe generated by myself
   3.346 -	(setq label "")
   3.347 -	(skip-chars-forward " \t")
   3.348 -	(if (looking-at "{")		;sure to be true!!
   3.349 -	    (forward-list 1))
   3.350 -	(let ((list '(30 10 65))
   3.351 -	      (delim ";") q lim len l str)
   3.352 -	  (save-excursion
   3.353 -	    (setq lim (if (re-search-forward itemsep nil 1)
   3.354 -			  (match-beginning 0) (point))))
   3.355 +		     (point)
   3.356 +		     (progn
   3.357 +		       (if q (forward-sexp 1)
   3.358 +			 (search-forward delim lim 1)
   3.359 +			 (forward-char -1))
   3.360 +		       (point))))
   3.361 +	      (if (> (setq l (YaTeX-string-width str)) len)
   3.362 +		  (setq str (concat
   3.363 +			     (YaTeX-truncate-string-width
   3.364 +			      str (- len (if q 5 4)))
   3.365 +			     "... "
   3.366 +			     (if q (substring str -1)))))
   3.367 +	      (if (< (setq l (YaTeX-string-width str)) len)
   3.368 +		  (setq str (concat str (make-string (- len l) ? ))))
   3.369 +	      (if (looking-at delim) (goto-char (match-end 0)))
   3.370 +	      (setq label (concat label " " str)
   3.371 +		    list (cdr list)))
   3.372 +	    (funcall output labelleader label match-point 'bib)))
   3.373 +	 ;;else, simple section-type counter
   3.374 +	 ((= (char-after (1- (point))) ?{)
   3.375 +	  (setq label (buffer-substring
   3.376 +		       (match-beginning 0)
   3.377 +		       (progn (forward-char -1)
   3.378 +			      (forward-list 1)
   3.379 +			      (point))))
   3.380 +	  (funcall output labelleader label match-point
   3.381 +		   (if (string-match "caption" cmd) 'cap 'sec))
   3.382 +	  ;; Skip preceding label if exists
   3.383 +	  (if (YaTeX::ref-getset-label (current-buffer) match-point t)
   3.384 +	      (goto-char (get 'YaTeX::ref-getset-label 'foundpoint)))
   3.385 +	  (if (save-excursion
   3.386 +		(skip-chars-forward "\t \n")
   3.387 +		(looking-at YaTeX::ref-labeling-regexp))
   3.388 +	      (setq e0 (match-end 0))))
   3.389 +	 (t
   3.390 +	  (skip-chars-forward " \t")
   3.391 +	  (setq label (buffer-substring
   3.392 +		       (match-beginning 0)
   3.393 +		       (if (re-search-forward
   3.394 +			    itemsep
   3.395 +			    nil t)
   3.396 +			   (progn
   3.397 +			     (goto-char (match-beginning 0))
   3.398 +			     (skip-chars-backward " \t")
   3.399 +			     (1- (point)))
   3.400 +			 (point-end-of-line))))
   3.401 +	  (funcall output labelleader label match-point 'misc)
   3.402 +	  (if (save-excursion
   3.403 +		(skip-chars-forward "\t \n")
   3.404 +		(looking-at YaTeX::ref-labeling-regexp))
   3.405 +	      (setq e0 (match-end 0)))))
   3.406 +	) ;;put label buffer
   3.407 +       ;;
   3.408 +       ;; if user defined label found
   3.409 +       (t
   3.410 +	;; memorize line number and label into property
   3.411 +	(goto-char (match-beginning 0))
   3.412 +	(let ((list YaTeX::ref-labeling-regexp-alist)
   3.413 +	      (cache (symbol-plist 'YaTeX::ref-labeling-regexp)))
   3.414  	  (while list
   3.415 -	    (skip-chars-forward " \t\n\\")
   3.416 -	    (setq q (looking-at "[\"'{]")
   3.417 -		  len (car list)
   3.418 -		  str
   3.419 -		  (buffer-substring
   3.420 -		   (point)
   3.421 -		   (progn
   3.422 -		     (if q (forward-sexp 1)
   3.423 -		       (search-forward delim lim 1)
   3.424 -		       (forward-char -1))
   3.425 -		     (point))))
   3.426 -	    (if (> (setq l (YaTeX-string-width str)) len)
   3.427 -		(setq str (concat
   3.428 -			   (YaTeX-truncate-string-width
   3.429 -			    str (- len (if q 5 4)))
   3.430 -			   "... "
   3.431 -			   (if q (substring str -1)))))
   3.432 -	    (if (< (setq l (YaTeX-string-width str)) len)
   3.433 -		(setq str (concat str (make-string (- len l) ? ))))
   3.434 -	    (if (looking-at delim) (goto-char (match-end 0)))
   3.435 -	    (setq label (concat label " " str)
   3.436 -		  list (cdr list)))
   3.437 -	  (funcall output label match-point 'bib)))
   3.438 -       ;;else, simple section-type counter
   3.439 -       ((= (char-after (1- (point))) ?{)
   3.440 -	(setq label (buffer-substring
   3.441 -		     (match-beginning 0)
   3.442 -		     (progn (forward-char -1)
   3.443 -			    (forward-list 1)
   3.444 -			    (point))))
   3.445 -	(funcall output label match-point
   3.446 -		 (if (string-match "caption" cmd) 'cap 'sec))
   3.447 -	;; Skip preceding label if exists
   3.448 -	(if (YaTeX::ref-getset-label (current-buffer) match-point t)
   3.449 -	    (goto-char (get 'YaTeX::ref-getset-label 'foundpoint)))
   3.450 -	(if (save-excursion
   3.451 -	      (skip-chars-forward "\t \n")
   3.452 -	      (looking-at YaTeX::ref-labeling-regexp))
   3.453 -	    (setq e0 (match-end 0))))
   3.454 -       (t
   3.455 -	(skip-chars-forward " \t")
   3.456 -	(setq label (buffer-substring
   3.457 -		     (match-beginning 0)
   3.458 -		     (if (re-search-forward
   3.459 -			  itemsep
   3.460 -			  nil t)
   3.461 -			 (progn
   3.462 -			   (goto-char (match-beginning 0))
   3.463 -			   (skip-chars-backward " \t")
   3.464 -			   (1- (point)))
   3.465 -		       (point-end-of-line))))
   3.466 -	(funcall output label match-point 'misc)
   3.467 -	(if (save-excursion
   3.468 -	      (skip-chars-forward "\t \n")
   3.469 -	      (looking-at YaTeX::ref-labeling-regexp))
   3.470 -	    (setq e0 (match-end 0)))))
   3.471 -      ) ;;put label buffer
   3.472 -     ;;
   3.473 -     ;; if user defined label found
   3.474 -     (t
   3.475 -      ;; memorize line number and label into property
   3.476 -      (goto-char (match-beginning 0))
   3.477 -      (let ((list YaTeX::ref-labeling-regexp-alist)
   3.478 -	    (cache (symbol-plist 'YaTeX::ref-labeling-regexp)))
   3.479 -	(while list
   3.480 -	  (if (looking-at (car (car list)))
   3.481 -	      (progn
   3.482 -		(setq label (YaTeX-match-string 0))
   3.483 -		(put 'YaTeX::ref-labeling-regexp lnum
   3.484 -		     (YaTeX-match-string (cdr (car list))))
   3.485 -		(funcall output label 0) ;;0 is dummy, never used
   3.486 -		(setq list nil)))
   3.487 -	  (setq list (cdr list))))
   3.488 -      ))
   3.489 -    (goto-char e0)))
   3.490 +	    (if (looking-at (car (car list)))
   3.491 +		(progn
   3.492 +		  (setq label (YaTeX-match-string 0))
   3.493 +		  (put 'YaTeX::ref-labeling-regexp lnum
   3.494 +		       (YaTeX-match-string (cdr (car list))))
   3.495 +		  (funcall output labelleader label 0) ;;0 is dummy, never used
   3.496 +		  (setq list nil)))
   3.497 +	    (setq list (cdr list))))
   3.498 +	))
   3.499 +      (goto-char e0))))
   3.500  
   3.501  (defun YaTeX::ref (argp &optional labelcmd refcmd predf)
   3.502    (setplist 'YaTeX::ref-labeling-regexp nil) ;erase memory cache