yatex

changeset 338:c731bc210af1 dev

Image inspection should be done in parent-file's directory
author HIROSE Yuuji <yuuji@gentei.org>
date Thu, 18 Dec 2014 17:30:56 +0900
parents f0d62ddd0490
children 9c39aa8a50e9
files yatexadd.el
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line diff
     1.1 --- a/yatexadd.el	Thu Dec 18 12:02:37 2014 +0900
     1.2 +++ b/yatexadd.el	Thu Dec 18 17:30:56 2014 +0900
     1.3 @@ -1,7 +1,7 @@
     1.4  ;;; yatexadd.el --- YaTeX add-in functions
     1.5  ;;; yatexadd.el rev.21
     1.6  ;;; (c)1991-2014 by HIROSE Yuuji.[yuuji@yatex.org]
     1.7 -;;; Last modified Thu Dec 18 11:52:36 2014 on firestorm
     1.8 +;;; Last modified Thu Dec 18 17:28:29 2014 on firestorm
     1.9  ;;; $Id$
    1.10  
    1.11  ;;; Code:
    1.12 @@ -1943,19 +1943,23 @@
    1.13  (defun YaTeX::includegraphics (argp &optional file doclip)
    1.14    "Add-in for \\includegraphics"
    1.15    (let ((imgfile (or file (YaTeX::include argp "Image File: ")))
    1.16 +	(imgfilepath
    1.17 +	 (save-excursion
    1.18 +	   (YaTeX-visit-main t)
    1.19 +	   (expand-file-name imgfile default-directory)))
    1.20  	(case-fold-search t) info bb noupdate needclose c)
    1.21      (and (string-match "\\.\\(jpe?g\\|png\\|gif\\|bmp\\|pdf\\)$" imgfile)
    1.22 -	 (file-exists-p imgfile)
    1.23 +	 (file-exists-p imgfilepath)
    1.24  	 (or (fboundp 'yahtml-get-image-info)
    1.25  	     (progn
    1.26  	       (load "yahtml" t) (featurep 'yahtml))) ;(require 'yahtml nil t)
    1.27  	 (if (string-match "\\.pdf" imgfile)
    1.28  	     (and
    1.29 -	      (setq info (YaTeX::get-boundingbox imgfile))
    1.30 +	      (setq info (YaTeX::get-boundingbox imgfilepath))
    1.31  	      (stringp info)
    1.32  	      (string< "" info)
    1.33  	      (setq bb (format "bb=%s" info)))
    1.34 -	   (setq info (yahtml-get-image-info imgfile))
    1.35 +	   (setq info (yahtml-get-image-info imgfilepath))
    1.36  	   (car info)			;if has width value
    1.37  	   (car (cdr info))		;if has height value
    1.38  	   (setq bb (format "bb=%d %d %d %d" 0 0 (car info) (car (cdr info)))))