From mboxrd@z Thu Jan 1 00:00:00 1970 From: Feng Shu Subject: Re: Can't preview latex fragment Date: Sun, 19 May 2013 12:39:46 +0800 Message-ID: <87mwrr4m7h.fsf@news.tumashu-localhost.org> References: <87a9nrye4t.fsf@news.tumashu-localhost.org> <8761yf3arl.fsf@pierrot.dokosmarshall.org> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:46153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdvQa-0000dg-Sg for emacs-orgmode@gnu.org; Sun, 19 May 2013 00:41:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UdvQP-0001O7-Kx for emacs-orgmode@gnu.org; Sun, 19 May 2013 00:41:00 -0400 Received: from mail-da0-x233.google.com ([2607:f8b0:400e:c00::233]:43724) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UdvQO-0001Nv-Rb for emacs-orgmode@gnu.org; Sun, 19 May 2013 00:40:49 -0400 Received: by mail-da0-f51.google.com with SMTP id h15so3189325dan.38 for ; Sat, 18 May 2013 21:40:48 -0700 (PDT) Received: from tumashu ([110.97.95.216]) by mx.google.com with ESMTPSA id wi6sm18174852pbc.22.2013.05.18.21.40.43 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 18 May 2013 21:40:46 -0700 (PDT) Received: from feng by tumashu with local (Exim 4.80) (envelope-from ) id 1UdvPP-0002ra-42 for emacs-orgmode@gnu.org; Sun, 19 May 2013 12:39:47 +0800 In-Reply-To: <8761yf3arl.fsf@pierrot.dokosmarshall.org> (Nick Dokos's message of "Sat, 18 May 2013 23:32:14 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Nick Dokos writes: > Feng Shu writes: > >> The error is like this: >> >> Creating image...1 >> let: Symbol's value as variable is void: org-export--default-title > > You need to provide more information: at a minimum, emacs and org > version and above all a backtrace. See section 1.4, "Feedback", in the > org manual on how to produce a useful backtrace. An example org file > exhibiting the problem might also be needed (and it is always a good > idea to provide one). Thanks for your information! I find the problem is related this commit=20 http://repo.or.cz/w/org-mode.git/commit/b70e77343aa3daee9312c81c96ef5da217d= 7fda5 when I revert this commit, it work! emacs: GNU Emacs 24.2.1 (i486-pc-linux-gnu, GTK+ Version 3.4.2)of 2013-01-2= 3 on biber, modified by Debian org: the newest git snapshot #+begin_example Debugger entered--Lisp error: (void-variable org-export--default-title) eval(org-export--default-title) (let ((value (eval (nth 3 cell)))) (if (not (stringp value)) value (let (= (keyword (nth 1 cell))) (if (member keyword org-element-document-properties= ) (org-element-parse-secondary-string value (org-element-restriction (quote= keyword))) value)))) (plist-put plist prop (let ((value (eval (nth 3 cell)))) (if (not (string= p value)) value (let ((keyword (nth 1 cell))) (if (member keyword org-eleme= nt-document-properties) (org-element-parse-secondary-string value (org-elem= ent-restriction (quote keyword))) value))))) (setq plist (plist-put plist prop (let ((value (eval (nth 3 cell)))) (if = (not (stringp value)) value (let ((keyword (nth 1 cell))) (if (member keywo= rd org-element-document-properties) (org-element-parse-secondary-string val= ue (org-element-restriction ...)) value)))))) (if (plist-member plist prop) nil (setq plist (plist-put plist prop (let = ((value (eval (nth 3 cell)))) (if (not (stringp value)) value (let ((keywor= d ...)) (if (member keyword org-element-document-properties) (org-element-p= arse-secondary-string value ...) value))))))) (unless (plist-member plist prop) (setq plist (plist-put plist prop (let = ((value (eval (nth 3 cell)))) (if (not (stringp value)) value (let ((keywor= d ...)) (if (member keyword org-element-document-properties) (org-element-p= arse-secondary-string value ...) value))))))) (let ((prop (car cell))) (unless (plist-member plist prop) (setq plist (p= list-put plist prop (let ((value (eval ...))) (if (not (stringp value)) val= ue (let (...) (if ... ... value)))))))) (while --cl-dolist-temp-- (setq cell (car --cl-dolist-temp--)) (let ((pro= p (car cell))) (unless (plist-member plist prop) (setq plist (plist-put pli= st prop (let ((value ...)) (if (not ...) value (let ... ...))))))) (setq --= cl-dolist-temp-- (cdr --cl-dolist-temp--))) (let ((--cl-dolist-temp-- all) cell) (while --cl-dolist-temp-- (setq cell= (car --cl-dolist-temp--)) (let ((prop (car cell))) (unless (plist-member p= list prop) (setq plist (plist-put plist prop (let (...) (if ... value ...))= )))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))) (setq cell nil) pl= ist) (catch (quote --cl-block-nil--) (let ((--cl-dolist-temp-- all) cell) (whi= le --cl-dolist-temp-- (setq cell (car --cl-dolist-temp--)) (let ((prop (car= cell))) (unless (plist-member plist prop) (setq plist (plist-put plist pro= p (let ... ...))))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))) (se= tq cell nil) plist)) (cl-block-wrapper (catch (quote --cl-block-nil--) (let ((--cl-dolist-temp= -- all) cell) (while --cl-dolist-temp-- (setq cell (car --cl-dolist-temp--)= ) (let ((prop (car cell))) (unless (plist-member plist prop) (setq plist (p= list-put plist prop ...)))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp-= -))) (setq cell nil) plist))) (block nil (let ((--cl-dolist-temp-- all) cell) (while --cl-dolist-temp--= (setq cell (car --cl-dolist-temp--)) (let ((prop (car cell))) (unless (pli= st-member plist prop) (setq plist (plist-put plist prop (let ... ...))))) (= setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))) (setq cell nil) plist)) (dolist (cell all plist) (let ((prop (car cell))) (unless (plist-member p= list prop) (setq plist (plist-put plist prop (let ((value ...)) (if (not ..= .) value (let ... ...)))))))) (let (plist (all (append (and backend (org-export-backend-options backend= )) org-export-options-alist))) (dolist (cell all plist) (let ((prop (car ce= ll))) (unless (plist-member plist prop) (setq plist (plist-put plist prop (= let (...) (if ... value ...)))))))) org-export--get-global-options(latex) (org-combine-plists (org-export--get-global-options (quote latex)) (org-e= xport--get-inbuffer-options (quote latex))) (plist-get (org-combine-plists (org-export--get-global-options (quote lat= ex)) (org-export--get-inbuffer-options (quote latex))) :latex-header) (org-splice-latex-header org-format-latex-header org-latex-default-packag= es-alist org-latex-packages-alist t (plist-get (org-combine-plists (org-exp= ort--get-global-options (quote latex)) (org-export--get-inbuffer-options (q= uote latex))) :latex-header)) (org-latex-guess-inputenc (org-splice-latex-header org-format-latex-heade= r org-latex-default-packages-alist org-latex-packages-alist t (plist-get (o= rg-combine-plists (org-export--get-global-options (quote latex)) (org-expor= t--get-inbuffer-options (quote latex))) :latex-header))) org-create-formula--latex-header() (let ((latex-header (org-create-formula--latex-header))) (with-temp-file = texfile (insert latex-header) (insert "\n\\begin{document}\n" "\\definecolo= r{fg}{rgb}{" fg "}\n" "\\definecolor{bg}{rgb}{" bg "}\n" "\n\\pagecolor{bg}= \n" "\n{\\color{fg}\n" string "\n}\n" "\n\\end{document}\n"))) (let* ((tmpdir (if (featurep (quote xemacs)) (temp-directory) temporary-f= ile-directory)) (texfilebase (make-temp-name (expand-file-name "orgtex" tmp= dir))) (texfile (concat texfilebase ".tex")) (pdffile (concat texfilebase "= .pdf")) (pngfile (concat texfilebase ".png")) (fnh (if (featurep (quote xem= acs)) (font-height (face-font (quote default))) (face-attribute (quote defa= ult) :height nil))) (scale (or (plist-get options (if buffer :scale :html-s= cale)) 1.0)) (dpi (number-to-string (* scale (floor (* 0.9 (if buffer fnh 1= 40)))))) (fg (or (plist-get options (if buffer :foreground :html-foreground= )) "black")) (bg (or (plist-get options (if buffer :background :html-backgr= ound)) "white"))) (if (eq fg (quote default)) (setq fg (org-latex-color :fo= reground)) (setq fg (org-latex-color-format fg))) (if (eq bg (quote default= )) (setq bg (org-latex-color :background)) (setq bg (org-latex-color-format= (if (string=3D bg "Transparent") "white" bg)))) (let ((latex-header (org-c= reate-formula--latex-header))) (with-temp-file texfile (insert latex-header= ) (insert "\n\\begin{document}\n" "\\definecolor{fg}{rgb}{" fg "}\n" "\\def= inecolor{bg}{rgb}{" bg "}\n" "\n\\pagecolor{bg}\n" "\n{\\color{fg}\n" strin= g "\n}\n" "\n\\end{document}\n"))) (org-latex-compile texfile t) (if (not (= file-exists-p pdffile)) (progn (message "Failed to create pdf file from %s"= texfile) nil) (condition-case nil (if (featurep (quote xemacs)) (call-proc= ess "convert" nil nil nil "-density" "96" "-trim" "-antialias" pdffile "-qu= ality" "100" pngfile) (call-process "convert" nil nil nil "-density" dpi "-= trim" "-antialias" pdffile "-quality" "100" pngfile)) (error nil)) (if (not= (file-exists-p pngfile)) (if org-format-latex-signal-error (error "Failed = to create png file from %s" texfile) (message "Failed to create png file fr= om %s" texfile) nil) (copy-file pngfile tofile (quote replace)) (loop for e= in (quote (".pdf" ".tex" ".aux" ".log" ".png")) do (if (file-exists-p (con= cat texfilebase e)) (delete-file (concat texfilebase e)))) pngfile))) org-create-formula-image-with-imagemagick(#("\\begin{displaymath}\ny =3D = \\beta_{0}+\\beta_{1}x_{1} + \\delta_{2}x_{1} + \\delta_{3}x_{3}\n\\end{dis= playmath}" 0 20 (fontified t) 20 85 (fontified t) 85 102 (fontified t)) "/h= ome/feng/org/ltxpng/i-notes-study_549a8489ed7305c81611b5ec3aa0b7541641ed51.= png" (:foreground default :background default :scale 1.2 :html-foreground "= Black" :html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$= 1" "$" "$$" "\\(" "\\[")) forbuffer) funcall(org-create-formula-image-with-imagemagick #("\\begin{displaymath}= \ny =3D \\beta_{0}+\\beta_{1}x_{1} + \\delta_{2}x_{1} + \\delta_{3}x_{3}\n\= \end{displaymath}" 0 20 (fontified t) 20 85 (fontified t) 85 102 (fontified= t)) "/home/feng/org/ltxpng/i-notes-study_549a8489ed7305c81611b5ec3aa0b7541= 641ed51.png" (:foreground default :background default :scale 1.2 :html-fore= ground "Black" :html-background "Transparent" :html-scale 1.0 :matchers ("b= egin" "$1" "$" "$$" "\\(" "\\[")) forbuffer) org-create-formula-image(#("\\begin{displaymath}\ny =3D \\beta_{0}+\\beta= _{1}x_{1} + \\delta_{2}x_{1} + \\delta_{3}x_{3}\n\\end{displaymath}" 0 20 (= fontified t) 20 85 (fontified t) 85 102 (fontified t)) "/home/feng/org/ltxp= ng/i-notes-study_549a8489ed7305c81611b5ec3aa0b7541641ed51.png" (:foreground= default :background default :scale 1.2 :html-foreground "Black" :html-back= ground "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\("= "\\[")) forbuffer imagemagick) (if (file-exists-p movefile) nil (org-create-formula-image txt movefile o= ptnew forbuffer processing-type)) (unless (file-exists-p movefile) (org-create-formula-image txt movefile o= ptnew forbuffer processing-type)) (cond ((eq processing-type (quote verbatim))) ((eq processing-type (quote= mathjax)) (setq string (match-string n)) (when (member m (quote ("$" "$1")= )) (save-excursion (delete-region (match-beginning n) (match-end n)) (goto-= char (match-beginning n)) (insert (concat "\\(" (substring string 1 -1) "\\= )"))))) ((or (eq processing-type (quote dvipng)) (eq processing-type (quote= imagemagick))) (setq txt (match-string n) beg (match-beginning n) end (mat= ch-end n) cnt (1+ cnt)) (let ((face (face-at-point)) (fg (plist-get opt :fo= reground)) (bg (plist-get opt :background)) print-length print-level) (when= forbuffer (goto-char beg) (when (eq fg (quote auto)) (setq fg (face-attrib= ute face :foreground nil (quote default)))) (when (eq bg (quote auto)) (set= q bg (face-attribute face :background nil (quote default)))) (setq optnew (= copy-sequence opt)) (plist-put optnew :foreground fg) (plist-put optnew :ba= ckground bg)) (setq hash (sha1 (prin1-to-string (list org-format-latex-head= er org-latex-default-packages-alist org-latex-packages-alist org-format-lat= ex-options forbuffer txt fg bg))) linkfile (format "%s_%s.png" prefix hash)= movefile (format "%s_%s.png" absprefix hash))) (setq link (concat block "[= [file:" linkfile "]]" block)) (if msg (message msg cnt)) (goto-char beg) (u= nless checkdir (setq checkdir t) (or (file-directory-p todir) (make-directo= ry todir t))) (unless (file-exists-p movefile) (org-create-formula-image tx= t movefile optnew forbuffer processing-type)) (if overlays (progn (mapc (la= mbda (o) (if (eq ... ...) (delete-overlay o))) (overlays-in beg end)) (setq= ov (make-overlay beg end)) (overlay-put ov (quote org-overlay-type) (quote= org-latex-overlay)) (if (featurep (quote xemacs)) (progn (overlay-put ov (= quote invisible) t) (overlay-put ov (quote end-glyph) (make-glyph ...))) (o= verlay-put ov (quote display) (list (quote image) :type (quote png) :file m= ovefile :ascent (quote center)))) (push ov org-latex-fragment-image-overlay= s) (goto-char end)) (delete-region beg end) (insert (org-add-props link (li= st (quote org-latex-src) (replace-regexp-in-string "\"" "" txt) (quote org-= latex-src-embed-type) (if block-type (quote paragraph) (quote character))))= ))) ((eq processing-type (quote mathml)) (unless (save-match-data (org-form= at-latex-mathml-available-p)) (user-error "LaTeX to MathML converter not co= nfigured")) (setq txt (match-string n) beg (match-beginning n) end (match-e= nd n) cnt (1+ cnt)) (if msg (message msg cnt)) (goto-char beg) (delete-regi= on beg end) (insert (org-format-latex-as-mathml txt block-type prefix dir))= ) (t (error "Unknown conversion type %s for LaTeX fragments" processing-typ= e))) (progn (cond ((eq processing-type (quote verbatim))) ((eq processing-type= (quote mathjax)) (setq string (match-string n)) (when (member m (quote ("$= " "$1"))) (save-excursion (delete-region (match-beginning n) (match-end n))= (goto-char (match-beginning n)) (insert (concat "\\(" (substring string 1 = -1) "\\)"))))) ((or (eq processing-type (quote dvipng)) (eq processing-type= (quote imagemagick))) (setq txt (match-string n) beg (match-beginning n) e= nd (match-end n) cnt (1+ cnt)) (let ((face (face-at-point)) (fg (plist-get = opt :foreground)) (bg (plist-get opt :background)) print-length print-level= ) (when forbuffer (goto-char beg) (when (eq fg (quote auto)) (setq fg (face= -attribute face :foreground nil ...))) (when (eq bg (quote auto)) (setq bg = (face-attribute face :background nil ...))) (setq optnew (copy-sequence opt= )) (plist-put optnew :foreground fg) (plist-put optnew :background bg)) (se= tq hash (sha1 (prin1-to-string (list org-format-latex-header org-latex-defa= ult-packages-alist org-latex-packages-alist org-format-latex-options forbuf= fer txt fg bg))) linkfile (format "%s_%s.png" prefix hash) movefile (format= "%s_%s.png" absprefix hash))) (setq link (concat block "[[file:" linkfile = "]]" block)) (if msg (message msg cnt)) (goto-char beg) (unless checkdir (s= etq checkdir t) (or (file-directory-p todir) (make-directory todir t))) (un= less (file-exists-p movefile) (org-create-formula-image txt movefile optnew= forbuffer processing-type)) (if overlays (progn (mapc (lambda (o) (if ... = ...)) (overlays-in beg end)) (setq ov (make-overlay beg end)) (overlay-put = ov (quote org-overlay-type) (quote org-latex-overlay)) (if (featurep (quote= xemacs)) (progn (overlay-put ov ... t) (overlay-put ov ... ...)) (overlay-= put ov (quote display) (list ... :type ... :file movefile :ascent ...))) (p= ush ov org-latex-fragment-image-overlays) (goto-char end)) (delete-region b= eg end) (insert (org-add-props link (list (quote org-latex-src) (replace-re= gexp-in-string "\"" "" txt) (quote org-latex-src-embed-type) (if block-type= ... ...)))))) ((eq processing-type (quote mathml)) (unless (save-match-dat= a (org-format-latex-mathml-available-p)) (user-error "LaTeX to MathML conve= rter not configured")) (setq txt (match-string n) beg (match-beginning n) e= nd (match-end n) cnt (1+ cnt)) (if msg (message msg cnt)) (goto-char beg) (= delete-region beg end) (insert (org-format-latex-as-mathml txt block-type p= refix dir))) (t (error "Unknown conversion type %s for LaTeX fragments" pro= cessing-type)))) (if (and (or (not at) (equal (cdr at) (match-beginning n))) (or (not over= lays) (not (eq (get-char-property (match-beginning n) (quote org-overlay-ty= pe)) (quote org-latex-overlay))))) (progn (cond ((eq processing-type (quote= verbatim))) ((eq processing-type (quote mathjax)) (setq string (match-stri= ng n)) (when (member m (quote ("$" "$1"))) (save-excursion (delete-region (= match-beginning n) (match-end n)) (goto-char (match-beginning n)) (insert (= concat "\\(" ... "\\)"))))) ((or (eq processing-type (quote dvipng)) (eq pr= ocessing-type (quote imagemagick))) (setq txt (match-string n) beg (match-b= eginning n) end (match-end n) cnt (1+ cnt)) (let ((face (face-at-point)) (f= g (plist-get opt :foreground)) (bg (plist-get opt :background)) print-lengt= h print-level) (when forbuffer (goto-char beg) (when (eq fg ...) (setq fg .= ..)) (when (eq bg ...) (setq bg ...)) (setq optnew (copy-sequence opt)) (pl= ist-put optnew :foreground fg) (plist-put optnew :background bg)) (setq has= h (sha1 (prin1-to-string ...)) linkfile (format "%s_%s.png" prefix hash) mo= vefile (format "%s_%s.png" absprefix hash))) (setq link (concat block "[[fi= le:" linkfile "]]" block)) (if msg (message msg cnt)) (goto-char beg) (unle= ss checkdir (setq checkdir t) (or (file-directory-p todir) (make-directory = todir t))) (unless (file-exists-p movefile) (org-create-formula-image txt m= ovefile optnew forbuffer processing-type)) (if overlays (progn (mapc (lambd= a ... ...) (overlays-in beg end)) (setq ov (make-overlay beg end)) (overlay= -put ov (quote org-overlay-type) (quote org-latex-overlay)) (if (featurep .= ..) (progn ... ...) (overlay-put ov ... ...)) (push ov org-latex-fragment-i= mage-overlays) (goto-char end)) (delete-region beg end) (insert (org-add-pr= ops link (list ... ... ... ...))))) ((eq processing-type (quote mathml)) (u= nless (save-match-data (org-format-latex-mathml-available-p)) (user-error "= LaTeX to MathML converter not configured")) (setq txt (match-string n) beg = (match-beginning n) end (match-end n) cnt (1+ cnt)) (if msg (message msg cn= t)) (goto-char beg) (delete-region beg end) (insert (org-format-latex-as-ma= thml txt block-type prefix dir))) (t (error "Unknown conversion type %s for= LaTeX fragments" processing-type))))) (when (and (or (not at) (equal (cdr at) (match-beginning n))) (or (not ov= erlays) (not (eq (get-char-property (match-beginning n) (quote org-overlay-= type)) (quote org-latex-overlay))))) (cond ((eq processing-type (quote verb= atim))) ((eq processing-type (quote mathjax)) (setq string (match-string n)= ) (when (member m (quote ("$" "$1"))) (save-excursion (delete-region (match= -beginning n) (match-end n)) (goto-char (match-beginning n)) (insert (conca= t "\\(" (substring string 1 -1) "\\)"))))) ((or (eq processing-type (quote = dvipng)) (eq processing-type (quote imagemagick))) (setq txt (match-string = n) beg (match-beginning n) end (match-end n) cnt (1+ cnt)) (let ((face (fac= e-at-point)) (fg (plist-get opt :foreground)) (bg (plist-get opt :backgroun= d)) print-length print-level) (when forbuffer (goto-char beg) (when (eq fg = (quote auto)) (setq fg (face-attribute face :foreground nil ...))) (when (e= q bg (quote auto)) (setq bg (face-attribute face :background nil ...))) (se= tq optnew (copy-sequence opt)) (plist-put optnew :foreground fg) (plist-put= optnew :background bg)) (setq hash (sha1 (prin1-to-string (list org-format= -latex-header org-latex-default-packages-alist org-latex-packages-alist org= -format-latex-options forbuffer txt fg bg))) linkfile (format "%s_%s.png" p= refix hash) movefile (format "%s_%s.png" absprefix hash))) (setq link (conc= at block "[[file:" linkfile "]]" block)) (if msg (message msg cnt)) (goto-c= har beg) (unless checkdir (setq checkdir t) (or (file-directory-p todir) (m= ake-directory todir t))) (unless (file-exists-p movefile) (org-create-formu= la-image txt movefile optnew forbuffer processing-type)) (if overlays (prog= n (mapc (lambda (o) (if ... ...)) (overlays-in beg end)) (setq ov (make-ove= rlay beg end)) (overlay-put ov (quote org-overlay-type) (quote org-latex-ov= erlay)) (if (featurep (quote xemacs)) (progn (overlay-put ov ... t) (overla= y-put ov ... ...)) (overlay-put ov (quote display) (list ... :type ... :fil= e movefile :ascent ...))) (push ov org-latex-fragment-image-overlays) (goto= -char end)) (delete-region beg end) (insert (org-add-props link (list (quot= e org-latex-src) (replace-regexp-in-string "\"" "" txt) (quote org-latex-sr= c-embed-type) (if block-type ... ...)))))) ((eq processing-type (quote math= ml)) (unless (save-match-data (org-format-latex-mathml-available-p)) (user-= error "LaTeX to MathML converter not configured")) (setq txt (match-string = n) beg (match-beginning n) end (match-end n) cnt (1+ cnt)) (if msg (message= msg cnt)) (goto-char beg) (delete-region beg end) (insert (org-format-late= x-as-mathml txt block-type prefix dir))) (t (error "Unknown conversion type= %s for LaTeX fragments" processing-type)))) (while (re-search-forward re nil t) (when (and (or (not at) (equal (cdr a= t) (match-beginning n))) (or (not overlays) (not (eq (get-char-property (ma= tch-beginning n) (quote org-overlay-type)) (quote org-latex-overlay))))) (c= ond ((eq processing-type (quote verbatim))) ((eq processing-type (quote mat= hjax)) (setq string (match-string n)) (when (member m (quote ("$" "$1"))) (= save-excursion (delete-region (match-beginning n) (match-end n)) (goto-char= (match-beginning n)) (insert (concat "\\(" ... "\\)"))))) ((or (eq process= ing-type (quote dvipng)) (eq processing-type (quote imagemagick))) (setq tx= t (match-string n) beg (match-beginning n) end (match-end n) cnt (1+ cnt)) = (let ((face (face-at-point)) (fg (plist-get opt :foreground)) (bg (plist-ge= t opt :background)) print-length print-level) (when forbuffer (goto-char be= g) (when (eq fg ...) (setq fg ...)) (when (eq bg ...) (setq bg ...)) (setq = optnew (copy-sequence opt)) (plist-put optnew :foreground fg) (plist-put op= tnew :background bg)) (setq hash (sha1 (prin1-to-string ...)) linkfile (for= mat "%s_%s.png" prefix hash) movefile (format "%s_%s.png" absprefix hash)))= (setq link (concat block "[[file:" linkfile "]]" block)) (if msg (message = msg cnt)) (goto-char beg) (unless checkdir (setq checkdir t) (or (file-dire= ctory-p todir) (make-directory todir t))) (unless (file-exists-p movefile) = (org-create-formula-image txt movefile optnew forbuffer processing-type)) (= if overlays (progn (mapc (lambda ... ...) (overlays-in beg end)) (setq ov (= make-overlay beg end)) (overlay-put ov (quote org-overlay-type) (quote org-= latex-overlay)) (if (featurep ...) (progn ... ...) (overlay-put ov ... ...)= ) (push ov org-latex-fragment-image-overlays) (goto-char end)) (delete-regi= on beg end) (insert (org-add-props link (list ... ... ... ...))))) ((eq pro= cessing-type (quote mathml)) (unless (save-match-data (org-format-latex-mat= hml-available-p)) (user-error "LaTeX to MathML converter not configured")) = (setq txt (match-string n) beg (match-beginning n) end (match-end n) cnt (1= + cnt)) (if msg (message msg cnt)) (goto-char beg) (delete-region beg end) = (insert (org-format-latex-as-mathml txt block-type prefix dir))) (t (error = "Unknown conversion type %s for LaTeX fragments" processing-type))))) (progn (goto-char (point-min)) (while (re-search-forward re nil t) (when = (and (or (not at) (equal (cdr at) (match-beginning n))) (or (not overlays) = (not (eq (get-char-property ... ...) (quote org-latex-overlay))))) (cond ((= eq processing-type (quote verbatim))) ((eq processing-type (quote mathjax))= (setq string (match-string n)) (when (member m (quote ...)) (save-excursio= n (delete-region ... ...) (goto-char ...) (insert ...)))) ((or (eq processi= ng-type (quote dvipng)) (eq processing-type (quote imagemagick))) (setq txt= (match-string n) beg (match-beginning n) end (match-end n) cnt (1+ cnt)) (= let ((face ...) (fg ...) (bg ...) print-length print-level) (when forbuffer= (goto-char beg) (when ... ...) (when ... ...) (setq optnew ...) (plist-put= optnew :foreground fg) (plist-put optnew :background bg)) (setq hash (sha1= ...) linkfile (format "%s_%s.png" prefix hash) movefile (format "%s_%s.png= " absprefix hash))) (setq link (concat block "[[file:" linkfile "]]" block)= ) (if msg (message msg cnt)) (goto-char beg) (unless checkdir (setq checkdi= r t) (or (file-directory-p todir) (make-directory todir t))) (unless (file-= exists-p movefile) (org-create-formula-image txt movefile optnew forbuffer = processing-type)) (if overlays (progn (mapc ... ...) (setq ov ...) (overlay= -put ov ... ...) (if ... ... ...) (push ov org-latex-fragment-image-overlay= s) (goto-char end)) (delete-region beg end) (insert (org-add-props link ...= )))) ((eq processing-type (quote mathml)) (unless (save-match-data (org-for= mat-latex-mathml-available-p)) (user-error "LaTeX to MathML converter not c= onfigured")) (setq txt (match-string n) beg (match-beginning n) end (match-= end n) cnt (1+ cnt)) (if msg (message msg cnt)) (goto-char beg) (delete-reg= ion beg end) (insert (org-format-latex-as-mathml txt block-type prefix dir)= )) (t (error "Unknown conversion type %s for LaTeX fragments" processing-ty= pe)))))) (if (member m matchers) (progn (goto-char (point-min)) (while (re-search-= forward re nil t) (when (and (or (not at) (equal (cdr at) (match-beginning = n))) (or (not overlays) (not (eq ... ...)))) (cond ((eq processing-type (qu= ote verbatim))) ((eq processing-type (quote mathjax)) (setq string (match-s= tring n)) (when (member m ...) (save-excursion ... ... ...))) ((or (eq proc= essing-type ...) (eq processing-type ...)) (setq txt (match-string n) beg (= match-beginning n) end (match-end n) cnt (1+ cnt)) (let (... ... ... print-= length print-level) (when forbuffer ... ... ... ... ... ...) (setq hash ...= linkfile ... movefile ...)) (setq link (concat block "[[file:" linkfile "]= ]" block)) (if msg (message msg cnt)) (goto-char beg) (unless checkdir (set= q checkdir t) (or ... ...)) (unless (file-exists-p movefile) (org-create-fo= rmula-image txt movefile optnew forbuffer processing-type)) (if overlays (p= rogn ... ... ... ... ... ...) (delete-region beg end) (insert ...))) ((eq p= rocessing-type (quote mathml)) (unless (save-match-data ...) (user-error "L= aTeX to MathML converter not configured")) (setq txt (match-string n) beg (= match-beginning n) end (match-end n) cnt (1+ cnt)) (if msg (message msg cnt= )) (goto-char beg) (delete-region beg end) (insert (org-format-latex-as-mat= hml txt block-type prefix dir))) (t (error "Unknown conversion type %s for = LaTeX fragments" processing-type))))))) (when (member m matchers) (goto-char (point-min)) (while (re-search-forwa= rd re nil t) (when (and (or (not at) (equal (cdr at) (match-beginning n))) = (or (not overlays) (not (eq (get-char-property ... ...) (quote org-latex-ov= erlay))))) (cond ((eq processing-type (quote verbatim))) ((eq processing-ty= pe (quote mathjax)) (setq string (match-string n)) (when (member m (quote .= ..)) (save-excursion (delete-region ... ...) (goto-char ...) (insert ...)))= ) ((or (eq processing-type (quote dvipng)) (eq processing-type (quote image= magick))) (setq txt (match-string n) beg (match-beginning n) end (match-end= n) cnt (1+ cnt)) (let ((face ...) (fg ...) (bg ...) print-length print-lev= el) (when forbuffer (goto-char beg) (when ... ...) (when ... ...) (setq opt= new ...) (plist-put optnew :foreground fg) (plist-put optnew :background bg= )) (setq hash (sha1 ...) linkfile (format "%s_%s.png" prefix hash) movefile= (format "%s_%s.png" absprefix hash))) (setq link (concat block "[[file:" l= inkfile "]]" block)) (if msg (message msg cnt)) (goto-char beg) (unless che= ckdir (setq checkdir t) (or (file-directory-p todir) (make-directory todir = t))) (unless (file-exists-p movefile) (org-create-formula-image txt movefil= e optnew forbuffer processing-type)) (if overlays (progn (mapc ... ...) (se= tq ov ...) (overlay-put ov ... ...) (if ... ... ...) (push ov org-latex-fra= gment-image-overlays) (goto-char end)) (delete-region beg end) (insert (org= -add-props link ...)))) ((eq processing-type (quote mathml)) (unless (save-= match-data (org-format-latex-mathml-available-p)) (user-error "LaTeX to Mat= hML converter not configured")) (setq txt (match-string n) beg (match-begin= ning n) end (match-end n) cnt (1+ cnt)) (if msg (message msg cnt)) (goto-ch= ar beg) (delete-region beg end) (insert (org-format-latex-as-mathml txt blo= ck-type prefix dir))) (t (error "Unknown conversion type %s for LaTeX fragm= ents" processing-type)))))) (while (setq e (pop re-list)) (setq m (car e) re (nth 1 e) n (nth 2 e) bl= ock-type (nth 3 e) block (if block-type "\n\n" "")) (when (member m matcher= s) (goto-char (point-min)) (while (re-search-forward re nil t) (when (and (= or (not at) (equal (cdr at) (match-beginning n))) (or (not overlays) (not (= eq ... ...)))) (cond ((eq processing-type (quote verbatim))) ((eq processin= g-type (quote mathjax)) (setq string (match-string n)) (when (member m ...)= (save-excursion ... ... ...))) ((or (eq processing-type ...) (eq processin= g-type ...)) (setq txt (match-string n) beg (match-beginning n) end (match-= end n) cnt (1+ cnt)) (let (... ... ... print-length print-level) (when forb= uffer ... ... ... ... ... ...) (setq hash ... linkfile ... movefile ...)) (= setq link (concat block "[[file:" linkfile "]]" block)) (if msg (message ms= g cnt)) (goto-char beg) (unless checkdir (setq checkdir t) (or ... ...)) (u= nless (file-exists-p movefile) (org-create-formula-image txt movefile optne= w forbuffer processing-type)) (if overlays (progn ... ... ... ... ... ...) = (delete-region beg end) (insert ...))) ((eq processing-type (quote mathml))= (unless (save-match-data ...) (user-error "LaTeX to MathML converter not c= onfigured")) (setq txt (match-string n) beg (match-beginning n) end (match-= end n) cnt (1+ cnt)) (if msg (message msg cnt)) (goto-char beg) (delete-reg= ion beg end) (insert (org-format-latex-as-mathml txt block-type prefix dir)= )) (t (error "Unknown conversion type %s for LaTeX fragments" processing-ty= pe))))))) (let* ((prefixnodir (file-name-nondirectory prefix)) (absprefix (expand-f= ile-name prefix dir)) (todir (file-name-directory absprefix)) (opt org-form= at-latex-options) (optnew org-format-latex-options) (matchers (plist-get op= t :matchers)) (re-list org-latex-regexps) (cnt 0) txt hash link beg end re = e checkdir string m n block-type block linkfile movefile ov) (while (setq e= (pop re-list)) (setq m (car e) re (nth 1 e) n (nth 2 e) block-type (nth 3 = e) block (if block-type "\n\n" "")) (when (member m matchers) (goto-char (p= oint-min)) (while (re-search-forward re nil t) (when (and (or (not at) (equ= al ... ...)) (or (not overlays) (not ...))) (cond ((eq processing-type ...)= ) ((eq processing-type ...) (setq string ...) (when ... ...)) ((or ... ...)= (setq txt ... beg ... end ... cnt ...) (let ... ... ...) (setq link ...) (= if msg ...) (goto-char beg) (unless checkdir ... ...) (unless ... ...) (if = overlays ... ... ...)) ((eq processing-type ...) (unless ... ...) (setq txt= ... beg ... end ... cnt ...) (if msg ...) (goto-char beg) (delete-region b= eg end) (insert ...)) (t (error "Unknown conversion type %s for LaTeX fragm= ents" processing-type)))))))) org-format-latex("ltxpng/i-notes-study" "/home/feng/org/" overlays "Creat= ing image...%s" (#("\\begin{displaymath}" 0 19 (fontified t)) . 30719) forb= uffer imagemagick) (let (beg end at msg) (cond ((or (equal subtree (quote (16))) (not (save-= excursion (re-search-backward org-outline-regexp-bol nil t)))) (setq beg (p= oint-min) end (point-max) msg "Creating images for buffer...%s")) ((equal s= ubtree (quote (4))) (org-back-to-heading) (setq beg (point) end (org-end-of= -subtree t) msg "Creating images for subtree...%s")) (t (if (setq at (org-i= nside-LaTeX-fragment-p)) (goto-char (max (point-min) (- (cdr at) 2))) (org-= back-to-heading)) (setq beg (point) end (progn (outline-next-heading) (poin= t)) msg (if at "Creating image...%s" "Creating images for entry...%s")))) (= message msg "") (narrow-to-region beg end) (goto-char beg) (org-format-late= x (concat org-latex-preview-ltxpng-directory (file-name-sans-extension (fil= e-name-nondirectory buffer-file-name))) default-directory (quote overlays) = msg at (quote forbuffer) org-latex-create-formula-image-program) (message m= sg "done. Use `C-c C-c' to remove images.")) (save-restriction (let (beg end at msg) (cond ((or (equal subtree (quote = (16))) (not (save-excursion (re-search-backward org-outline-regexp-bol nil = t)))) (setq beg (point-min) end (point-max) msg "Creating images for buffer= ...%s")) ((equal subtree (quote (4))) (org-back-to-heading) (setq beg (poin= t) end (org-end-of-subtree t) msg "Creating images for subtree...%s")) (t (= if (setq at (org-inside-LaTeX-fragment-p)) (goto-char (max (point-min) (- .= .. 2))) (org-back-to-heading)) (setq beg (point) end (progn (outline-next-h= eading) (point)) msg (if at "Creating image...%s" "Creating images for entr= y...%s")))) (message msg "") (narrow-to-region beg end) (goto-char beg) (or= g-format-latex (concat org-latex-preview-ltxpng-directory (file-name-sans-e= xtension (file-name-nondirectory buffer-file-name))) default-directory (quo= te overlays) msg at (quote forbuffer) org-latex-create-formula-image-progra= m) (message msg "done. Use `C-c C-c' to remove images."))) (save-excursion (save-restriction (let (beg end at msg) (cond ((or (equal= subtree (quote ...)) (not (save-excursion ...))) (setq beg (point-min) end= (point-max) msg "Creating images for buffer...%s")) ((equal subtree (quote= (4))) (org-back-to-heading) (setq beg (point) end (org-end-of-subtree t) m= sg "Creating images for subtree...%s")) (t (if (setq at (org-inside-LaTeX-f= ragment-p)) (goto-char (max ... ...)) (org-back-to-heading)) (setq beg (poi= nt) end (progn (outline-next-heading) (point)) msg (if at "Creating image..= .%s" "Creating images for entry...%s")))) (message msg "") (narrow-to-regio= n beg end) (goto-char beg) (org-format-latex (concat org-latex-preview-ltxp= ng-directory (file-name-sans-extension (file-name-nondirectory buffer-file-= name))) default-directory (quote overlays) msg at (quote forbuffer) org-lat= ex-create-formula-image-program) (message msg "done. Use `C-c C-c' to remo= ve images.")))) (progn (org-remove-latex-fragment-image-overlays) (save-excursion (save-r= estriction (let (beg end at msg) (cond ((or (equal subtree ...) (not ...)) = (setq beg (point-min) end (point-max) msg "Creating images for buffer...%s"= )) ((equal subtree (quote ...)) (org-back-to-heading) (setq beg (point) end= (org-end-of-subtree t) msg "Creating images for subtree...%s")) (t (if (se= tq at ...) (goto-char ...) (org-back-to-heading)) (setq beg (point) end (pr= ogn ... ...) msg (if at "Creating image...%s" "Creating images for entry...= %s")))) (message msg "") (narrow-to-region beg end) (goto-char beg) (org-fo= rmat-latex (concat org-latex-preview-ltxpng-directory (file-name-sans-exten= sion (file-name-nondirectory buffer-file-name))) default-directory (quote o= verlays) msg at (quote forbuffer) org-latex-create-formula-image-program) (= message msg "done. Use `C-c C-c' to remove images."))))) (if (display-graphic-p) (progn (org-remove-latex-fragment-image-overlays)= (save-excursion (save-restriction (let (beg end at msg) (cond ((or ... ...= ) (setq beg ... end ... msg "Creating images for buffer...%s")) ((equal sub= tree ...) (org-back-to-heading) (setq beg ... end ... msg "Creating images = for subtree...%s")) (t (if ... ... ...) (setq beg ... end ... msg ...))) (m= essage msg "") (narrow-to-region beg end) (goto-char beg) (org-format-latex= (concat org-latex-preview-ltxpng-directory (file-name-sans-extension ...))= default-directory (quote overlays) msg at (quote forbuffer) org-latex-crea= te-formula-image-program) (message msg "done. Use `C-c C-c' to remove imag= es.")))))) (when (display-graphic-p) (org-remove-latex-fragment-image-overlays) (sav= e-excursion (save-restriction (let (beg end at msg) (cond ((or (equal subtr= ee ...) (not ...)) (setq beg (point-min) end (point-max) msg "Creating imag= es for buffer...%s")) ((equal subtree (quote ...)) (org-back-to-heading) (s= etq beg (point) end (org-end-of-subtree t) msg "Creating images for subtree= ...%s")) (t (if (setq at ...) (goto-char ...) (org-back-to-heading)) (setq = beg (point) end (progn ... ...) msg (if at "Creating image...%s" "Creating = images for entry...%s")))) (message msg "") (narrow-to-region beg end) (got= o-char beg) (org-format-latex (concat org-latex-preview-ltxpng-directory (f= ile-name-sans-extension (file-name-nondirectory buffer-file-name))) default= -directory (quote overlays) msg at (quote forbuffer) org-latex-create-formu= la-image-program) (message msg "done. Use `C-c C-c' to remove images."))))) org-preview-latex-fragment(nil) call-interactively(org-preview-latex-fragment nil nil) recursive-edit() debug(error (void-variable org-export--default-title)) eval(org-export--default-title) (let ((value (eval (nth 3 cell)))) (if (not (stringp value)) value (let (= (keyword (nth 1 cell))) (if (member keyword org-element-document-properties= ) (org-element-parse-secondary-string value (org-element-restriction (quote= keyword))) value)))) (plist-put plist prop (let ((value (eval (nth 3 cell)))) (if (not (string= p value)) value (let ((keyword (nth 1 cell))) (if (member keyword org-eleme= nt-document-properties) (org-element-parse-secondary-string value (org-elem= ent-restriction (quote keyword))) value))))) (setq plist (plist-put plist prop (let ((value (eval (nth 3 cell)))) (if = (not (stringp value)) value (let ((keyword (nth 1 cell))) (if (member keywo= rd org-element-document-properties) (org-element-parse-secondary-string val= ue (org-element-restriction ...)) value)))))) (if (plist-member plist prop) nil (setq plist (plist-put plist prop (let = ((value (eval (nth 3 cell)))) (if (not (stringp value)) value (let ((keywor= d ...)) (if (member keyword org-element-document-properties) (org-element-p= arse-secondary-string value ...) value))))))) (unless (plist-member plist prop) (setq plist (plist-put plist prop (let = ((value (eval (nth 3 cell)))) (if (not (stringp value)) value (let ((keywor= d ...)) (if (member keyword org-element-document-properties) (org-element-p= arse-secondary-string value ...) value))))))) (let ((prop (car cell))) (unless (plist-member plist prop) (setq plist (p= list-put plist prop (let ((value (eval ...))) (if (not (stringp value)) val= ue (let (...) (if ... ... value)))))))) (while --cl-dolist-temp-- (setq cell (car --cl-dolist-temp--)) (let ((pro= p (car cell))) (unless (plist-member plist prop) (setq plist (plist-put pli= st prop (let ((value ...)) (if (not ...) value (let ... ...))))))) (setq --= cl-dolist-temp-- (cdr --cl-dolist-temp--))) (let ((--cl-dolist-temp-- all) cell) (while --cl-dolist-temp-- (setq cell= (car --cl-dolist-temp--)) (let ((prop (car cell))) (unless (plist-member p= list prop) (setq plist (plist-put plist prop (let (...) (if ... value ...))= )))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))) (setq cell nil) pl= ist) (catch (quote --cl-block-nil--) (let ((--cl-dolist-temp-- all) cell) (whi= le --cl-dolist-temp-- (setq cell (car --cl-dolist-temp--)) (let ((prop (car= cell))) (unless (plist-member plist prop) (setq plist (plist-put plist pro= p (let ... ...))))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))) (se= tq cell nil) plist)) (cl-block-wrapper (catch (quote --cl-block-nil--) (let ((--cl-dolist-temp= -- all) cell) (while --cl-dolist-temp-- (setq cell (car --cl-dolist-temp--)= ) (let ((prop (car cell))) (unless (plist-member plist prop) (setq plist (p= list-put plist prop ...)))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp-= -))) (setq cell nil) plist))) (block nil (let ((--cl-dolist-temp-- all) cell) (while --cl-dolist-temp--= (setq cell (car --cl-dolist-temp--)) (let ((prop (car cell))) (unless (pli= st-member plist prop) (setq plist (plist-put plist prop (let ... ...))))) (= setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))) (setq cell nil) plist)) (dolist (cell all plist) (let ((prop (car cell))) (unless (plist-member p= list prop) (setq plist (plist-put plist prop (let ((value ...)) (if (not ..= .) value (let ... ...)))))))) (let (plist (all (append (and backend (org-export-backend-options backend= )) org-export-options-alist))) (dolist (cell all plist) (let ((prop (car ce= ll))) (unless (plist-member plist prop) (setq plist (plist-put plist prop (= let (...) (if ... value ...)))))))) org-export--get-global-options(latex) (org-combine-plists (org-export--get-global-options (quote latex)) (org-e= xport--get-inbuffer-options (quote latex))) (plist-get (org-combine-plists (org-export--get-global-options (quote lat= ex)) (org-export--get-inbuffer-options (quote latex))) :latex-header) (org-splice-latex-header org-format-latex-header org-latex-default-packag= es-alist org-latex-packages-alist t (plist-get (org-combine-plists (org-exp= ort--get-global-options (quote latex)) (org-export--get-inbuffer-options (q= uote latex))) :latex-header)) (org-latex-guess-inputenc (org-splice-latex-header org-format-latex-heade= r org-latex-default-packages-alist org-latex-packages-alist t (plist-get (o= rg-combine-plists (org-export--get-global-options (quote latex)) (org-expor= t--get-inbuffer-options (quote latex))) :latex-header))) org-create-formula--latex-header() (let ((latex-header (org-create-formula--latex-header))) (with-temp-file = texfile (insert latex-header) (insert "\n\\begin{document}\n" "\\definecolo= r{fg}{rgb}{" fg "}\n" "\\definecolor{bg}{rgb}{" bg "}\n" "\n\\pagecolor{bg}= \n" "\n{\\color{fg}\n" string "\n}\n" "\n\\end{document}\n"))) (let* ((tmpdir (if (featurep (quote xemacs)) (temp-directory) temporary-f= ile-directory)) (texfilebase (make-temp-name (expand-file-name "orgtex" tmp= dir))) (texfile (concat texfilebase ".tex")) (pdffile (concat texfilebase "= .pdf")) (pngfile (concat texfilebase ".png")) (fnh (if (featurep (quote xem= acs)) (font-height (face-font (quote default))) (face-attribute (quote defa= ult) :height nil))) (scale (or (plist-get options (if buffer :scale :html-s= cale)) 1.0)) (dpi (number-to-string (* scale (floor (* 0.9 (if buffer fnh 1= 40)))))) (fg (or (plist-get options (if buffer :foreground :html-foreground= )) "black")) (bg (or (plist-get options (if buffer :background :html-backgr= ound)) "white"))) (if (eq fg (quote default)) (setq fg (org-latex-color :fo= reground)) (setq fg (org-latex-color-format fg))) (if (eq bg (quote default= )) (setq bg (org-latex-color :background)) (setq bg (org-latex-color-format= (if (string=3D bg "Transparent") "white" bg)))) (let ((latex-header (org-c= reate-formula--latex-header))) (with-temp-file texfile (insert latex-header= ) (insert "\n\\begin{document}\n" "\\definecolor{fg}{rgb}{" fg "}\n" "\\def= inecolor{bg}{rgb}{" bg "}\n" "\n\\pagecolor{bg}\n" "\n{\\color{fg}\n" strin= g "\n}\n" "\n\\end{document}\n"))) (org-latex-compile texfile t) (if (not (= file-exists-p pdffile)) (progn (message "Failed to create pdf file from %s"= texfile) nil) (condition-case nil (if (featurep (quote xemacs)) (call-proc= ess "convert" nil nil nil "-density" "96" "-trim" "-antialias" pdffile "-qu= ality" "100" pngfile) (call-process "convert" nil nil nil "-density" dpi "-= trim" "-antialias" pdffile "-quality" "100" pngfile)) (error nil)) (if (not= (file-exists-p pngfile)) (if org-format-latex-signal-error (error "Failed = to create png file from %s" texfile) (message "Failed to create png file fr= om %s" texfile) nil) (copy-file pngfile tofile (quote replace)) (loop for e= in (quote (".pdf" ".tex" ".aux" ".log" ".png")) do (if (file-exists-p (con= cat texfilebase e)) (delete-file (concat texfilebase e)))) pngfile))) org-create-formula-image-with-imagemagick(#("\\begin{displaymath}\ny =3D= \\beta_{0}+\\beta_{1}x_{1} + \\delta_{2}x_{1} + \\delta_{3}x_{3}\n\\end{dis= playmath}" 0 20 (fontified t) 20 85 (fontified t) 85 102 (fontified t)) "/h= ome/feng/org/ltxpng/i-notes-study_f377aad0eb76b23f13c94b859ac421c0039ab40b.= png" (:foreground default :background default :scale 1.2 :html-foreground "= Black" :html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$= 1" "$" "$$" "\\(" "\\[")) forbuffer) funcall(org-create-formula-image-with-imagemagick #("\\begin{displaymath}= \ny =3D\\beta_{0}+\\beta_{1}x_{1} + \\delta_{2}x_{1} + \\delta_{3}x_{3}\n\= \end{displaymath}" 0 20 (fontified t) 20 85 (fontified t) 85 102 (fontified= t)) "/home/feng/org/ltxpng/i-notes-study_f377aad0eb76b23f13c94b859ac421c00= 39ab40b.png" (:foreground default :background default :scale 1.2 :html-fore= ground "Black" :html-background "Transparent" :html-scale 1.0 :matchers ("b= egin" "$1" "$" "$$" "\\(" "\\[")) forbuffer) org-create-formula-image(#("\\begin{displaymath}\ny =3D\\beta_{0}+\\beta= _{1}x_{1} + \\delta_{2}x_{1} + \\delta_{3}x_{3}\n\\end{displaymath}" 0 20 (= fontified t) 20 85 (fontified t) 85 102 (fontified t)) "/home/feng/org/ltxp= ng/i-notes-study_f377aad0eb76b23f13c94b859ac421c0039ab40b.png" (:foreground= default :background default :scale 1.2 :html-foreground "Black" :html-back= ground "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\("= "\\[")) forbuffer imagemagick) (if (file-exists-p movefile) nil (org-create-formula-image txt movefile o= ptnew forbuffer processing-type)) (unless (file-exists-p movefile) (org-create-formula-image txt movefile o= ptnew forbuffer processing-type)) (cond ((eq processing-type (quote verbatim))) ((eq processing-type (quote= mathjax)) (setq string (match-string n)) (when (member m (quote ("$" "$1")= )) (save-excursion (delete-region (match-beginning n) (match-end n)) (goto-= char (match-beginning n)) (insert (concat "\\(" (substring string 1 -1) "\\= )"))))) ((or (eq processing-type (quote dvipng)) (eq processing-type (quote= imagemagick))) (setq txt (match-string n) beg (match-beginning n) end (mat= ch-end n) cnt (1+ cnt)) (let ((face (face-at-point)) (fg (plist-get opt :fo= reground)) (bg (plist-get opt :background)) print-length print-level) (when= forbuffer (goto-char beg) (when (eq fg (quote auto)) (setq fg (face-attrib= ute face :foreground nil (quote default)))) (when (eq bg (quote auto)) (set= q bg (face-attribute face :background nil (quote default)))) (setq optnew (= copy-sequence opt)) (plist-put optnew :foreground fg) (plist-put optnew :ba= ckground bg)) (setq hash (sha1 (prin1-to-string (list org-format-latex-head= er org-latex-default-packages-alist org-latex-packages-alist org-format-lat= ex-options forbuffer txt fg bg))) linkfile (format "%s_%s.png" prefix hash)= movefile (format "%s_%s.png" absprefix hash))) (setq link (concat block "[= [file:" linkfile "]]" block)) (if msg (message msg cnt)) (goto-char beg) (u= nless checkdir (setq checkdir t) (or (file-directory-p todir) (make-directo= ry todir t))) (unless (file-exists-p movefile) (org-create-formula-image tx= t movefile optnew forbuffer processing-type)) (if overlays (progn (mapc (la= mbda (o) (if (eq ... ...) (delete-overlay o))) (overlays-in beg end)) (setq= ov (make-overlay beg end)) (overlay-put ov (quote org-overlay-type) (quote= org-latex-overlay)) (if (featurep (quote xemacs)) (progn (overlay-put ov (= quote invisible) t) (overlay-put ov (quote end-glyph) (make-glyph ...))) (o= verlay-put ov (quote display) (list (quote image) :type (quote png) :file m= ovefile :ascent (quote center)))) (push ov org-latex-fragment-image-overlay= s) (goto-char end)) (delete-region beg end) (insert (org-add-props link (li= st (quote org-latex-src) (replace-regexp-in-string "\"" "" txt) (quote org-= latex-src-embed-type) (if block-type (quote paragraph) (quote character))))= ))) ((eq processing-type (quote mathml)) (unless (save-match-data (org-form= at-latex-mathml-available-p)) (user-error "LaTeX to MathML converter not co= nfigured")) (setq txt (match-string n) beg (match-beginning n) end (match-e= nd n) cnt (1+ cnt)) (if msg (message msg cnt)) (goto-char beg) (delete-regi= on beg end) (insert (org-format-latex-as-mathml txt block-type prefix dir))= ) (t (error "Unknown conversion type %s for LaTeX fragments" processing-typ= e))) (progn (cond ((eq processing-type (quote verbatim))) ((eq processing-type= (quote mathjax)) (setq string (match-string n)) (when (member m (quote ("$= " "$1"))) (save-excursion (delete-region (match-beginning n) (match-end n))= (goto-char (match-beginning n)) (insert (concat "\\(" (substring string 1 = -1) "\\)"))))) ((or (eq processing-type (quote dvipng)) (eq processing-type= (quote imagemagick))) (setq txt (match-string n) beg (match-beginning n) e= nd (match-end n) cnt (1+ cnt)) (let ((face (face-at-point)) (fg (plist-get = opt :foreground)) (bg (plist-get opt :background)) print-length print-level= ) (when forbuffer (goto-char beg) (when (eq fg (quote auto)) (setq fg (face= -attribute face :foreground nil ...))) (when (eq bg (quote auto)) (setq bg = (face-attribute face :background nil ...))) (setq optnew (copy-sequence opt= )) (plist-put optnew :foreground fg) (plist-put optnew :background bg)) (se= tq hash (sha1 (prin1-to-string (list org-format-latex-header org-latex-defa= ult-packages-alist org-latex-packages-alist org-format-latex-options forbuf= fer txt fg bg))) linkfile (format "%s_%s.png" prefix hash) movefile (format= "%s_%s.png" absprefix hash))) (setq link (concat block "[[file:" linkfile = "]]" block)) (if msg (message msg cnt)) (goto-char beg) (unless checkdir (s= etq checkdir t) (or (file-directory-p todir) (make-directory todir t))) (un= less (file-exists-p movefile) (org-create-formula-image txt movefile optnew= forbuffer processing-type)) (if overlays (progn (mapc (lambda (o) (if ... = ...)) (overlays-in beg end)) (setq ov (make-overlay beg end)) (overlay-put = ov (quote org-overlay-type) (quote org-latex-overlay)) (if (featurep (quote= xemacs)) (progn (overlay-put ov ... t) (overlay-put ov ... ...)) (overlay-= put ov (quote display) (list ... :type ... :file movefile :ascent ...))) (p= ush ov org-latex-fragment-image-overlays) (goto-char end)) (delete-region b= eg end) (insert (org-add-props link (list (quote org-latex-src) (replace-re= gexp-in-string "\"" "" txt) (quote org-latex-src-embed-type) (if block-type= ... ...)))))) ((eq processing-type (quote mathml)) (unless (save-match-dat= a (org-format-latex-mathml-available-p)) (user-error "LaTeX to MathML conve= rter not configured")) (setq txt (match-string n) beg (match-beginning n) e= nd (match-end n) cnt (1+ cnt)) (if msg (message msg cnt)) (goto-char beg) (= delete-region beg end) (insert (org-format-latex-as-mathml txt block-type p= refix dir))) (t (error "Unknown conversion type %s for LaTeX fragments" pro= cessing-type)))) (if (and (or (not at) (equal (cdr at) (match-beginning n))) (or (not over= lays) (not (eq (get-char-property (match-beginning n) (quote org-overlay-ty= pe)) (quote org-latex-overlay))))) (progn (cond ((eq processing-type (quote= verbatim))) ((eq processing-type (quote mathjax)) (setq string (match-stri= ng n)) (when (member m (quote ("$" "$1"))) (save-excursion (delete-region (= match-beginning n) (match-end n)) (goto-char (match-beginning n)) (insert (= concat "\\(" ... "\\)"))))) ((or (eq processing-type (quote dvipng)) (eq pr= ocessing-type (quote imagemagick))) (setq txt (match-string n) beg (match-b= eginning n) end (match-end n) cnt (1+ cnt)) (let ((face (face-at-point)) (f= g (plist-get opt :foreground)) (bg (plist-get opt :background)) print-lengt= h print-level) (when forbuffer (goto-char beg) (when (eq fg ...) (setq fg .= ..)) (when (eq bg ...) (setq bg ...)) (setq optnew (copy-sequence opt)) (pl= ist-put optnew :foreground fg) (plist-put optnew :background bg)) (setq has= h (sha1 (prin1-to-string ...)) linkfile (format "%s_%s.png" prefix hash) mo= vefile (format "%s_%s.png" absprefix hash))) (setq link (concat block "[[fi= le:" linkfile "]]" block)) (if msg (message msg cnt)) (goto-char beg) (unle= ss checkdir (setq checkdir t) (or (file-directory-p todir) (make-directory = todir t))) (unless (file-exists-p movefile) (org-create-formula-image txt m= ovefile optnew forbuffer processing-type)) (if overlays (progn (mapc (lambd= a ... ...) (overlays-in beg end)) (setq ov (make-overlay beg end)) (overlay= -put ov (quote org-overlay-type) (quote org-latex-overlay)) (if (featurep .= ..) (progn ... ...) (overlay-put ov ... ...)) (push ov org-latex-fragment-i= mage-overlays) (goto-char end)) (delete-region beg end) (insert (org-add-pr= ops link (list ... ... ... ...))))) ((eq processing-type (quote mathml)) (u= nless (save-match-data (org-format-latex-mathml-available-p)) (user-error "= LaTeX to MathML converter not configured")) (setq txt (match-string n) beg = (match-beginning n) end (match-end n) cnt (1+ cnt)) (if msg (message msg cn= t)) (goto-char beg) (delete-region beg end) (insert (org-format-latex-as-ma= thml txt block-type prefix dir))) (t (error "Unknown conversion type %s for= LaTeX fragments" processing-type))))) (when (and (or (not at) (equal (cdr at) (match-beginning n))) (or (not ov= erlays) (not (eq (get-char-property (match-beginning n) (quote org-overlay-= type)) (quote org-latex-overlay))))) (cond ((eq processing-type (quote verb= atim))) ((eq processing-type (quote mathjax)) (setq string (match-string n)= ) (when (member m (quote ("$" "$1"))) (save-excursion (delete-region (match= -beginning n) (match-end n)) (goto-char (match-beginning n)) (insert (conca= t "\\(" (substring string 1 -1) "\\)"))))) ((or (eq processing-type (quote = dvipng)) (eq processing-type (quote imagemagick))) (setq txt (match-string = n) beg (match-beginning n) end (match-end n) cnt (1+ cnt)) (let ((face (fac= e-at-point)) (fg (plist-get opt :foreground)) (bg (plist-get opt :backgroun= d)) print-length print-level) (when forbuffer (goto-char beg) (when (eq fg = (quote auto)) (setq fg (face-attribute face :foreground nil ...))) (when (e= q bg (quote auto)) (setq bg (face-attribute face :background nil ...))) (se= tq optnew (copy-sequence opt)) (plist-put optnew :foreground fg) (plist-put= optnew :background bg)) (setq hash (sha1 (prin1-to-string (list org-format= -latex-header org-latex-default-packages-alist org-latex-packages-alist org= -format-latex-options forbuffer txt fg bg))) linkfile (format "%s_%s.png" p= refix hash) movefile (format "%s_%s.png" absprefix hash))) (setq link (conc= at block "[[file:" linkfile "]]" block)) (if msg (message msg cnt)) (goto-c= har beg) (unless checkdir (setq checkdir t) (or (file-directory-p todir) (m= ake-directory todir t))) (unless (file-exists-p movefile) (org-create-formu= la-image txt movefile optnew forbuffer processing-type)) (if overlays (prog= n (mapc (lambda (o) (if ... ...)) (overlays-in beg end)) (setq ov (make-ove= rlay beg end)) (overlay-put ov (quote org-overlay-type) (quote org-latex-ov= erlay)) (if (featurep (quote xemacs)) (progn (overlay-put ov ... t) (overla= y-put ov ... ...)) (overlay-put ov (quote display) (list ... :type ... :fil= e movefile :ascent ...))) (push ov org-latex-fragment-image-overlays) (goto= -char end)) (delete-region beg end) (insert (org-add-props link (list (quot= e org-latex-src) (replace-regexp-in-string "\"" "" txt) (quote org-latex-sr= c-embed-type) (if block-type ... ...)))))) ((eq processing-type (quote math= ml)) (unless (save-match-data (org-format-latex-mathml-available-p)) (user-= error "LaTeX to MathML converter not configured")) (setq txt (match-string = n) beg (match-beginning n) end (match-end n) cnt (1+ cnt)) (if msg (message= msg cnt)) (goto-char beg) (delete-region beg end) (insert (org-format-late= x-as-mathml txt block-type prefix dir))) (t (error "Unknown conversion type= %s for LaTeX fragments" processing-type)))) (while (re-search-forward re nil t) (when (and (or (not at) (equal (cdr a= t) (match-beginning n))) (or (not overlays) (not (eq (get-char-property (ma= tch-beginning n) (quote org-overlay-type)) (quote org-latex-overlay))))) (c= ond ((eq processing-type (quote verbatim))) ((eq processing-type (quote mat= hjax)) (setq string (match-string n)) (when (member m (quote ("$" "$1"))) (= save-excursion (delete-region (match-beginning n) (match-end n)) (goto-char= (match-beginning n)) (insert (concat "\\(" ... "\\)"))))) ((or (eq process= ing-type (quote dvipng)) (eq processing-type (quote imagemagick))) (setq tx= t (match-string n) beg (match-beginning n) end (match-end n) cnt (1+ cnt)) = (let ((face (face-at-point)) (fg (plist-get opt :foreground)) (bg (plist-ge= t opt :background)) print-length print-level) (when forbuffer (goto-char be= g) (when (eq fg ...) (setq fg ...)) (when (eq bg ...) (setq bg ...)) (setq = optnew (copy-sequence opt)) (plist-put optnew :foreground fg) (plist-put op= tnew :background bg)) (setq hash (sha1 (prin1-to-string ...)) linkfile (for= mat "%s_%s.png" prefix hash) movefile (format "%s_%s.png" absprefix hash)))= (setq link (concat block "[[file:" linkfile "]]" block)) (if msg (message = msg cnt)) (goto-char beg) (unless checkdir (setq checkdir t) (or (file-dire= ctory-p todir) (make-directory todir t))) (unless (file-exists-p movefile) = (org-create-formula-image txt movefile optnew forbuffer processing-type)) (= if overlays (progn (mapc (lambda ... ...) (overlays-in beg end)) (setq ov (= make-overlay beg end)) (overlay-put ov (quote org-overlay-type) (quote org-= latex-overlay)) (if (featurep ...) (progn ... ...) (overlay-put ov ... ...)= ) (push ov org-latex-fragment-image-overlays) (goto-char end)) (delete-regi= on beg end) (insert (org-add-props link (list ... ... ... ...))))) ((eq pro= cessing-type (quote mathml)) (unless (save-match-data (org-format-latex-mat= hml-available-p)) (user-error "LaTeX to MathML converter not configured")) = (setq txt (match-string n) beg (match-beginning n) end (match-end n) cnt (1= + cnt)) (if msg (message msg cnt)) (goto-char beg) (delete-region beg end) = (insert (org-format-latex-as-mathml txt block-type prefix dir))) (t (error = "Unknown conversion type %s for LaTeX fragments" processing-type))))) (progn (goto-char (point-min)) (while (re-search-forward re nil t) (when = (and (or (not at) (equal (cdr at) (match-beginning n))) (or (not overlays) = (not (eq (get-char-property ... ...) (quote org-latex-overlay))))) (cond ((= eq processing-type (quote verbatim))) ((eq processing-type (quote mathjax))= (setq string (match-string n)) (when (member m (quote ...)) (save-excursio= n (delete-region ... ...) (goto-char ...) (insert ...)))) ((or (eq processi= ng-type (quote dvipng)) (eq processing-type (quote imagemagick))) (setq txt= (match-string n) beg (match-beginning n) end (match-end n) cnt (1+ cnt)) (= let ((face ...) (fg ...) (bg ...) print-length print-level) (when forbuffer= (goto-char beg) (when ... ...) (when ... ...) (setq optnew ...) (plist-put= optnew :foreground fg) (plist-put optnew :background bg)) (setq hash (sha1= ...) linkfile (format "%s_%s.png" prefix hash) movefile (format "%s_%s.png= " absprefix hash))) (setq link (concat block "[[file:" linkfile "]]" block)= ) (if msg (message msg cnt)) (goto-char beg) (unless checkdir (setq checkdi= r t) (or (file-directory-p todir) (make-directory todir t))) (unless (file-= exists-p movefile) (org-create-formula-image txt movefile optnew forbuffer = processing-type)) (if overlays (progn (mapc ... ...) (setq ov ...) (overlay= -put ov ... ...) (if ... ... ...) (push ov org-latex-fragment-image-overlay= s) (goto-char end)) (delete-region beg end) (insert (org-add-props link ...= )))) ((eq processing-type (quote mathml)) (unless (save-match-data (org-for= mat-latex-mathml-available-p)) (user-error "LaTeX to MathML converter not c= onfigured")) (setq txt (match-string n) beg (match-beginning n) end (match-= end n) cnt (1+ cnt)) (if msg (message msg cnt)) (goto-char beg) (delete-reg= ion beg end) (insert (org-format-latex-as-mathml txt block-type prefix dir)= )) (t (error "Unknown conversion type %s for LaTeX fragments" processing-ty= pe)))))) (if (member m matchers) (progn (goto-char (point-min)) (while (re-search-= forward re nil t) (when (and (or (not at) (equal (cdr at) (match-beginning = n))) (or (not overlays) (not (eq ... ...)))) (cond ((eq processing-type (qu= ote verbatim))) ((eq processing-type (quote mathjax)) (setq string (match-s= tring n)) (when (member m ...) (save-excursion ... ... ...))) ((or (eq proc= essing-type ...) (eq processing-type ...)) (setq txt (match-string n) beg (= match-beginning n) end (match-end n) cnt (1+ cnt)) (let (... ... ... print-= length print-level) (when forbuffer ... ... ... ... ... ...) (setq hash ...= linkfile ... movefile ...)) (setq link (concat block "[[file:" linkfile "]= ]" block)) (if msg (message msg cnt)) (goto-char beg) (unless checkdir (set= q checkdir t) (or ... ...)) (unless (file-exists-p movefile) (org-create-fo= rmula-image txt movefile optnew forbuffer processing-type)) (if overlays (p= rogn ... ... ... ... ... ...) (delete-region beg end) (insert ...))) ((eq p= rocessing-type (quote mathml)) (unless (save-match-data ...) (user-error "L= aTeX to MathML converter not configured")) (setq txt (match-string n) beg (= match-beginning n) end (match-end n) cnt (1+ cnt)) (if msg (message msg cnt= )) (goto-char beg) (delete-region beg end) (insert (org-format-latex-as-mat= hml txt block-type prefix dir))) (t (error "Unknown conversion type %s for = LaTeX fragments" processing-type))))))) (when (member m matchers) (goto-char (point-min)) (while (re-search-forwa= rd re nil t) (when (and (or (not at) (equal (cdr at) (match-beginning n))) = (or (not overlays) (not (eq (get-char-property ... ...) (quote org-latex-ov= erlay))))) (cond ((eq processing-type (quote verbatim))) ((eq processing-ty= pe (quote mathjax)) (setq string (match-string n)) (when (member m (quote .= ..)) (save-excursion (delete-region ... ...) (goto-char ...) (insert ...)))= ) ((or (eq processing-type (quote dvipng)) (eq processing-type (quote image= magick))) (setq txt (match-string n) beg (match-beginning n) end (match-end= n) cnt (1+ cnt)) (let ((face ...) (fg ...) (bg ...) print-length print-lev= el) (when forbuffer (goto-char beg) (when ... ...) (when ... ...) (setq opt= new ...) (plist-put optnew :foreground fg) (plist-put optnew :background bg= )) (setq hash (sha1 ...) linkfile (format "%s_%s.png" prefix hash) movefile= (format "%s_%s.png" absprefix hash))) (setq link (concat block "[[file:" l= inkfile "]]" block)) (if msg (message msg cnt)) (goto-char beg) (unless che= ckdir (setq checkdir t) (or (file-directory-p todir) (make-directory todir = t))) (unless (file-exists-p movefile) (org-create-formula-image txt movefil= e optnew forbuffer processing-type)) (if overlays (progn (mapc ... ...) (se= tq ov ...) (overlay-put ov ... ...) (if ... ... ...) (push ov org-latex-fra= gment-image-overlays) (goto-char end)) (delete-region beg end) (insert (org= -add-props link ...)))) ((eq processing-type (quote mathml)) (unless (save-= match-data (org-format-latex-mathml-available-p)) (user-error "LaTeX to Mat= hML converter not configured")) (setq txt (match-string n) beg (match-begin= ning n) end (match-end n) cnt (1+ cnt)) (if msg (message msg cnt)) (goto-ch= ar beg) (delete-region beg end) (insert (org-format-latex-as-mathml txt blo= ck-type prefix dir))) (t (error "Unknown conversion type %s for LaTeX fragm= ents" processing-type)))))) (while (setq e (pop re-list)) (setq m (car e) re (nth 1 e) n (nth 2 e) bl= ock-type (nth 3 e) block (if block-type "\n\n" "")) (when (member m matcher= s) (goto-char (point-min)) (while (re-search-forward re nil t) (when (and (= or (not at) (equal (cdr at) (match-beginning n))) (or (not overlays) (not (= eq ... ...)))) (cond ((eq processing-type (quote verbatim))) ((eq processin= g-type (quote mathjax)) (setq string (match-string n)) (when (member m ...)= (save-excursion ... ... ...))) ((or (eq processing-type ...) (eq processin= g-type ...)) (setq txt (match-string n) beg (match-beginning n) end (match-= end n) cnt (1+ cnt)) (let (... ... ... print-length print-level) (when forb= uffer ... ... ... ... ... ...) (setq hash ... linkfile ... movefile ...)) (= setq link (concat block "[[file:" linkfile "]]" block)) (if msg (message ms= g cnt)) (goto-char beg) (unless checkdir (setq checkdir t) (or ... ...)) (u= nless (file-exists-p movefile) (org-create-formula-image txt movefile optne= w forbuffer processing-type)) (if overlays (progn ... ... ... ... ... ...) = (delete-region beg end) (insert ...))) ((eq processing-type (quote mathml))= (unless (save-match-data ...) (user-error "LaTeX to MathML converter not c= onfigured")) (setq txt (match-string n) beg (match-beginning n) end (match-= end n) cnt (1+ cnt)) (if msg (message msg cnt)) (goto-char beg) (delete-reg= ion beg end) (insert (org-format-latex-as-mathml txt block-type prefix dir)= )) (t (error "Unknown conversion type %s for LaTeX fragments" processing-ty= pe))))))) (let* ((prefixnodir (file-name-nondirectory prefix)) (absprefix (expand-f= ile-name prefix dir)) (todir (file-name-directory absprefix)) (opt org-form= at-latex-options) (optnew org-format-latex-options) (matchers (plist-get op= t :matchers)) (re-list org-latex-regexps) (cnt 0) txt hash link beg end re = e checkdir string m n block-type block linkfile movefile ov) (while (setq e= (pop re-list)) (setq m (car e) re (nth 1 e) n (nth 2 e) block-type (nth 3 = e) block (if block-type "\n\n" "")) (when (member m matchers) (goto-char (p= oint-min)) (while (re-search-forward re nil t) (when (and (or (not at) (equ= al ... ...)) (or (not overlays) (not ...))) (cond ((eq processing-type ...)= ) ((eq processing-type ...) (setq string ...) (when ... ...)) ((or ... ...)= (setq txt ... beg ... end ... cnt ...) (let ... ... ...) (setq link ...) (= if msg ...) (goto-char beg) (unless checkdir ... ...) (unless ... ...) (if = overlays ... ... ...)) ((eq processing-type ...) (unless ... ...) (setq txt= ... beg ... end ... cnt ...) (if msg ...) (goto-char beg) (delete-region b= eg end) (insert ...)) (t (error "Unknown conversion type %s for LaTeX fragm= ents" processing-type)))))))) org-format-latex("ltxpng/i-notes-study" "/home/feng/org/" overlays "Creat= ing image...%s" (#("\\begin{displaymath}" 0 19 (fontified t)) . 30719) forb= uffer imagemagick) (let (beg end at msg) (cond ((or (equal subtree (quote (16))) (not (save-= excursion (re-search-backward org-outline-regexp-bol nil t)))) (setq beg (p= oint-min) end (point-max) msg "Creating images for buffer...%s")) ((equal s= ubtree (quote (4))) (org-back-to-heading) (setq beg (point) end (org-end-of= -subtree t) msg "Creating images for subtree...%s")) (t (if (setq at (org-i= nside-LaTeX-fragment-p)) (goto-char (max (point-min) (- (cdr at) 2))) (org-= back-to-heading)) (setq beg (point) end (progn (outline-next-heading) (poin= t)) msg (if at "Creating image...%s" "Creating images for entry...%s")))) (= message msg "") (narrow-to-region beg end) (goto-char beg) (org-format-late= x (concat org-latex-preview-ltxpng-directory (file-name-sans-extension (fil= e-name-nondirectory buffer-file-name))) default-directory (quote overlays) = msg at (quote forbuffer) org-latex-create-formula-image-program) (message m= sg "done. Use `C-c C-c' to remove images.")) (save-restriction (let (beg end at msg) (cond ((or (equal subtree (quote = (16))) (not (save-excursion (re-search-backward org-outline-regexp-bol nil = t)))) (setq beg (point-min) end (point-max) msg "Creating images for buffer= ...%s")) ((equal subtree (quote (4))) (org-back-to-heading) (setq beg (poin= t) end (org-end-of-subtree t) msg "Creating images for subtree...%s")) (t (= if (setq at (org-inside-LaTeX-fragment-p)) (goto-char (max (point-min) (- .= .. 2))) (org-back-to-heading)) (setq beg (point) end (progn (outline-next-h= eading) (point)) msg (if at "Creating image...%s" "Creating images for entr= y...%s")))) (message msg "") (narrow-to-region beg end) (goto-char beg) (or= g-format-latex (concat org-latex-preview-ltxpng-directory (file-name-sans-e= xtension (file-name-nondirectory buffer-file-name))) default-directory (quo= te overlays) msg at (quote forbuffer) org-latex-create-formula-image-progra= m) (message msg "done. Use `C-c C-c' to remove images."))) (save-excursion (save-restriction (let (beg end at msg) (cond ((or (equal= subtree (quote ...)) (not (save-excursion ...))) (setq beg (point-min) end= (point-max) msg "Creating images for buffer...%s")) ((equal subtree (quote= (4))) (org-back-to-heading) (setq beg (point) end (org-end-of-subtree t) m= sg "Creating images for subtree...%s")) (t (if (setq at (org-inside-LaTeX-f= ragment-p)) (goto-char (max ... ...)) (org-back-to-heading)) (setq beg (poi= nt) end (progn (outline-next-heading) (point)) msg (if at "Creating image..= .%s" "Creating images for entry...%s")))) (message msg "") (narrow-to-regio= n beg end) (goto-char beg) (org-format-latex (concat org-latex-preview-ltxp= ng-directory (file-name-sans-extension (file-name-nondirectory buffer-file-= name))) default-directory (quote overlays) msg at (quote forbuffer) org-lat= ex-create-formula-image-program) (message msg "done. Use `C-c C-c' to remo= ve images.")))) (progn (org-remove-latex-fragment-image-overlays) (save-excursion (save-r= estriction (let (beg end at msg) (cond ((or (equal subtree ...) (not ...)) = (setq beg (point-min) end (point-max) msg "Creating images for buffer...%s"= )) ((equal subtree (quote ...)) (org-back-to-heading) (setq beg (point) end= (org-end-of-subtree t) msg "Creating images for subtree...%s")) (t (if (se= tq at ...) (goto-char ...) (org-back-to-heading)) (setq beg (point) end (pr= ogn ... ...) msg (if at "Creating image...%s" "Creating images for entry...= %s")))) (message msg "") (narrow-to-region beg end) (goto-char beg) (org-fo= rmat-latex (concat org-latex-preview-ltxpng-directory (file-name-sans-exten= sion (file-name-nondirectory buffer-file-name))) default-directory (quote o= verlays) msg at (quote forbuffer) org-latex-create-formula-image-program) (= message msg "done. Use `C-c C-c' to remove images."))))) (if (display-graphic-p) (progn (org-remove-latex-fragment-image-overlays)= (save-excursion (save-restriction (let (beg end at msg) (cond ((or ... ...= ) (setq beg ... end ... msg "Creating images for buffer...%s")) ((equal sub= tree ...) (org-back-to-heading) (setq beg ... end ... msg "Creating images = for subtree...%s")) (t (if ... ... ...) (setq beg ... end ... msg ...))) (m= essage msg "") (narrow-to-region beg end) (goto-char beg) (org-format-latex= (concat org-latex-preview-ltxpng-directory (file-name-sans-extension ...))= default-directory (quote overlays) msg at (quote forbuffer) org-latex-crea= te-formula-image-program) (message msg "done. Use `C-c C-c' to remove imag= es.")))))) (when (display-graphic-p) (org-remove-latex-fragment-image-overlays) (sav= e-excursion (save-restriction (let (beg end at msg) (cond ((or (equal subtr= ee ...) (not ...)) (setq beg (point-min) end (point-max) msg "Creating imag= es for buffer...%s")) ((equal subtree (quote ...)) (org-back-to-heading) (s= etq beg (point) end (org-end-of-subtree t) msg "Creating images for subtree= ...%s")) (t (if (setq at ...) (goto-char ...) (org-back-to-heading)) (setq = beg (point) end (progn ... ...) msg (if at "Creating image...%s" "Creating = images for entry...%s")))) (message msg "") (narrow-to-region beg end) (got= o-char beg) (org-format-latex (concat org-latex-preview-ltxpng-directory (f= ile-name-sans-extension (file-name-nondirectory buffer-file-name))) default= -directory (quote overlays) msg at (quote forbuffer) org-latex-create-formu= la-image-program) (message msg "done. Use `C-c C-c' to remove images."))))) org-preview-latex-fragment(nil) call-interactively(org-preview-latex-fragment nil nil) #+end_example --=20