[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Can't preview latex fragment
From: |
Feng Shu |
Subject: |
Re: [O] Can't preview latex fragment |
Date: |
Sun, 19 May 2013 12:39:46 +0800 |
User-agent: |
Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.2 (gnu/linux) |
Nick Dokos <address@hidden> writes:
> Feng Shu <address@hidden> 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
http://repo.or.cz/w/org-mode.git/commit/b70e77343aa3daee9312c81c96ef5da217d7fda5
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-23 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 (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)))))
(setq plist (plist-put plist prop (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 ...)) 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 ((keyword
...)) (if (member keyword org-element-document-properties)
(org-element-parse-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 ((keyword
...)) (if (member keyword org-element-document-properties)
(org-element-parse-secondary-string value ...) value)))))))
(let ((prop (car cell))) (unless (plist-member plist prop) (setq plist
(plist-put plist prop (let ((value (eval ...))) (if (not (stringp value)) value
(let (...) (if ... ... value))))))))
(while --cl-dolist-temp-- (setq cell (car --cl-dolist-temp--)) (let ((prop
(car cell))) (unless (plist-member plist prop) (setq plist (plist-put plist
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 plist
prop) (setq plist (plist-put plist prop (let (...) (if ... value ...))))))
(setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))) (setq cell nil) plist)
(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 (plist-put plist prop
(let ... ...))))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))) (setq
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 (plist-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
(plist-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 plist
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 cell)))
(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-export--get-inbuffer-options (quote latex)))
(plist-get (org-combine-plists (org-export--get-global-options (quote latex))
(org-export--get-inbuffer-options (quote latex))) :latex-header)
(org-splice-latex-header org-format-latex-header
org-latex-default-packages-alist org-latex-packages-alist t (plist-get
(org-combine-plists (org-export--get-global-options (quote latex))
(org-export--get-inbuffer-options (quote latex))) :latex-header))
(org-latex-guess-inputenc (org-splice-latex-header org-format-latex-header
org-latex-default-packages-alist org-latex-packages-alist t (plist-get
(org-combine-plists (org-export--get-global-options (quote latex))
(org-export--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"
"\\definecolor{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-file-directory)) (texfilebase (make-temp-name (expand-file-name
"orgtex" tmpdir))) (texfile (concat texfilebase ".tex")) (pdffile (concat
texfilebase ".pdf")) (pngfile (concat texfilebase ".png")) (fnh (if (featurep
(quote xemacs)) (font-height (face-font (quote default))) (face-attribute
(quote default) :height nil))) (scale (or (plist-get options (if buffer :scale
:html-scale)) 1.0)) (dpi (number-to-string (* scale (floor (* 0.9 (if buffer
fnh 140)))))) (fg (or (plist-get options (if buffer :foreground
:html-foreground)) "black")) (bg (or (plist-get options (if buffer :background
:html-background)) "white"))) (if (eq fg (quote default)) (setq fg
(org-latex-color :foreground)) (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= bg "Transparent") "white" bg)))) (let
((latex-header (org-create-formula--latex-header))) (with-temp-file texfile
(insert latex-header) (insert "\n\\begin{document}\n" "\\definecolor{fg}{rgb}{"
fg "}\n" "\\definecolor{bg}{rgb}{" bg "}\n" "\n\\pagecolor{bg}\n"
"\n{\\color{fg}\n" string "\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-process "convert" nil nil nil "-density" "96" "-trim"
"-antialias" pdffile "-quality" "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 from %s" texfile) nil) (copy-file
pngfile tofile (quote replace)) (loop for e in (quote (".pdf" ".tex" ".aux"
".log" ".png")) do (if (file-exists-p (concat texfilebase e)) (delete-file
(concat texfilebase e)))) pngfile)))
org-create-formula-image-with-imagemagick(#("\\begin{displaymath}\ny =
\\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_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
= \\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_549a8489ed7305c81611b5ec3aa0b7541641ed51.png"
(:foreground default :background default :scale 1.2 :html-foreground "Black"
:html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$"
"\\(" "\\[")) forbuffer)
org-create-formula-image(#("\\begin{displaymath}\ny =
\\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_549a8489ed7305c81611b5ec3aa0b7541641ed51.png"
(:foreground default :background default :scale 1.2 :html-foreground "Black"
:html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$"
"\\(" "\\[")) forbuffer imagemagick)
(if (file-exists-p movefile) nil (org-create-formula-image txt movefile
optnew forbuffer processing-type))
(unless (file-exists-p movefile) (org-create-formula-image txt movefile
optnew 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
(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 (quote default)))) (when (eq bg (quote auto)) (setq bg
(face-attribute face :background nil (quote default)))) (setq 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" 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-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 (lambda (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 ...))) (overlay-put ov (quote
display) (list (quote image) :type (quote png) :file movefile :ascent (quote
center)))) (push ov org-latex-fragment-image-overlays) (goto-char end))
(delete-region beg end) (insert (org-add-props link (list (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-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-latex-as-mathml txt block-type prefix dir))) (t (error "Unknown
conversion type %s for LaTeX fragments" processing-type)))
(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) end
(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)) (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" 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-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 (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 ...))) (push ov
org-latex-fragment-image-overlays) (goto-char end)) (delete-region beg end)
(insert (org-add-props link (list (quote org-latex-src)
(replace-regexp-in-string "\"" "" txt) (quote org-latex-src-embed-type) (if
block-type ... ...)))))) ((eq processing-type (quote mathml)) (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-latex-as-mathml txt
block-type prefix dir))) (t (error "Unknown conversion type %s for LaTeX
fragments" processing-type))))
(if (and (or (not at) (equal (cdr at) (match-beginning n))) (or (not
overlays) (not (eq (get-char-property (match-beginning n) (quote
org-overlay-type)) (quote org-latex-overlay))))) (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 "\\(" ... "\\)"))))) ((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
(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 ...) (setq fg ...)) (when (eq bg ...) (setq bg ...)) (setq optnew
(copy-sequence opt)) (plist-put optnew :foreground fg) (plist-put optnew
:background bg)) (setq hash (sha1 (prin1-to-string ...)) 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 checkdir 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 (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-region beg end) (insert (org-add-props link (list ... ... ... ...)))))
((eq processing-type (quote mathml)) (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-latex-as-mathml 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
overlays) (not (eq (get-char-property (match-beginning n) (quote
org-overlay-type)) (quote org-latex-overlay))))) (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 (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)) (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" 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-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 (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 ...))) (push ov
org-latex-fragment-image-overlays) (goto-char end)) (delete-region beg end)
(insert (org-add-props link (list (quote org-latex-src)
(replace-regexp-in-string "\"" "" txt) (quote org-latex-src-embed-type) (if
block-type ... ...)))))) ((eq processing-type (quote mathml)) (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-latex-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 at)
(match-beginning n))) (or (not overlays) (not (eq (get-char-property
(match-beginning n) (quote org-overlay-type)) (quote org-latex-overlay)))))
(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 "\\(" ... "\\)"))))) ((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 (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 ...) (setq fg ...)) (when (eq bg ...) (setq bg ...)) (setq optnew
(copy-sequence opt)) (plist-put optnew :foreground fg) (plist-put optnew
:background bg)) (setq hash (sha1 (prin1-to-string ...)) 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 checkdir 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 (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-region beg end) (insert (org-add-props link (list ... ... ... ...)))))
((eq processing-type (quote mathml)) (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-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-excursion
(delete-region ... ...) (goto-char ...) (insert ...)))) ((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 ...) (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 checkdir 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-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 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))))))
(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 (quote verbatim))) ((eq processing-type (quote mathjax)) (setq
string (match-string n)) (when (member m ...) (save-excursion ... ... ...)))
((or (eq processing-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 (setq
checkdir t) (or ... ...)) (unless (file-exists-p movefile)
(org-create-formula-image txt movefile optnew 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 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)))))))
(when (member m matchers) (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-excursion (delete-region ... ...) (goto-char ...) (insert
...)))) ((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 ...) (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 checkdir 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-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 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))))))
(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 (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 processing-type
(quote mathjax)) (setq string (match-string n)) (when (member m ...)
(save-excursion ... ... ...))) ((or (eq processing-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 (setq checkdir t) (or ... ...)) (unless
(file-exists-p movefile) (org-create-formula-image txt movefile optnew
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
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)))))))
(let* ((prefixnodir (file-name-nondirectory prefix)) (absprefix
(expand-file-name prefix dir)) (todir (file-name-directory absprefix)) (opt
org-format-latex-options) (optnew org-format-latex-options) (matchers
(plist-get opt :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
(point-min)) (while (re-search-forward re nil t) (when (and (or (not at) (equal
... ...)) (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 beg end) (insert ...)) (t
(error "Unknown conversion type %s for LaTeX fragments" processing-type))))))))
org-format-latex("ltxpng/i-notes-study" "/home/feng/org/" overlays "Creating
image...%s" (#("\\begin{displaymath}" 0 19 (fontified t)) . 30719) forbuffer
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
(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) msg "Creating images for subtree...%s")) (t (if (setq at
(org-inside-LaTeX-fragment-p)) (goto-char (max (point-min) (- (cdr at) 2)))
(org-back-to-heading)) (setq beg (point) end (progn (outline-next-heading)
(point)) msg (if at "Creating image...%s" "Creating images for entry...%s"))))
(message msg "") (narrow-to-region beg end) (goto-char beg) (org-format-latex
(concat org-latex-preview-ltxpng-directory (file-name-sans-extension
(file-name-nondirectory buffer-file-name))) default-directory (quote overlays)
msg at (quote forbuffer) org-latex-create-formula-image-program) (message msg
"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
(point) 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-heading)
(point)) msg (if at "Creating image...%s" "Creating images for entry...%s"))))
(message msg "") (narrow-to-region beg end) (goto-char beg) (org-format-latex
(concat org-latex-preview-ltxpng-directory (file-name-sans-extension
(file-name-nondirectory buffer-file-name))) default-directory (quote overlays)
msg at (quote forbuffer) org-latex-create-formula-image-program) (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) msg
"Creating images for subtree...%s")) (t (if (setq at
(org-inside-LaTeX-fragment-p)) (goto-char (max ... ...)) (org-back-to-heading))
(setq beg (point) end (progn (outline-next-heading) (point)) msg (if at
"Creating image...%s" "Creating images for entry...%s")))) (message msg "")
(narrow-to-region beg end) (goto-char beg) (org-format-latex (concat
org-latex-preview-ltxpng-directory (file-name-sans-extension
(file-name-nondirectory buffer-file-name))) default-directory (quote overlays)
msg at (quote forbuffer) org-latex-create-formula-image-program) (message msg
"done. Use `C-c C-c' to remove images."))))
(progn (org-remove-latex-fragment-image-overlays) (save-excursion
(save-restriction (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 (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) (goto-char beg)
(org-format-latex (concat org-latex-preview-ltxpng-directory
(file-name-sans-extension (file-name-nondirectory buffer-file-name)))
default-directory (quote overlays) 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 subtree
...) (org-back-to-heading) (setq beg ... end ... msg "Creating images for
subtree...%s")) (t (if ... ... ...) (setq beg ... end ... msg ...))) (message
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-create-formula-image-program) (message msg "done. Use `C-c C-c' to
remove images."))))))
(when (display-graphic-p) (org-remove-latex-fragment-image-overlays)
(save-excursion (save-restriction (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 (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) (goto-char beg) (org-format-latex (concat
org-latex-preview-ltxpng-directory (file-name-sans-extension
(file-name-nondirectory buffer-file-name))) default-directory (quote overlays)
msg at (quote forbuffer) org-latex-create-formula-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 (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)))))
(setq plist (plist-put plist prop (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 ...)) 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 ((keyword
...)) (if (member keyword org-element-document-properties)
(org-element-parse-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 ((keyword
...)) (if (member keyword org-element-document-properties)
(org-element-parse-secondary-string value ...) value)))))))
(let ((prop (car cell))) (unless (plist-member plist prop) (setq plist
(plist-put plist prop (let ((value (eval ...))) (if (not (stringp value)) value
(let (...) (if ... ... value))))))))
(while --cl-dolist-temp-- (setq cell (car --cl-dolist-temp--)) (let ((prop
(car cell))) (unless (plist-member plist prop) (setq plist (plist-put plist
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 plist
prop) (setq plist (plist-put plist prop (let (...) (if ... value ...))))))
(setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))) (setq cell nil) plist)
(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 (plist-put plist prop
(let ... ...))))) (setq --cl-dolist-temp-- (cdr --cl-dolist-temp--))) (setq
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 (plist-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
(plist-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 plist
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 cell)))
(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-export--get-inbuffer-options (quote latex)))
(plist-get (org-combine-plists (org-export--get-global-options (quote latex))
(org-export--get-inbuffer-options (quote latex))) :latex-header)
(org-splice-latex-header org-format-latex-header
org-latex-default-packages-alist org-latex-packages-alist t (plist-get
(org-combine-plists (org-export--get-global-options (quote latex))
(org-export--get-inbuffer-options (quote latex))) :latex-header))
(org-latex-guess-inputenc (org-splice-latex-header org-format-latex-header
org-latex-default-packages-alist org-latex-packages-alist t (plist-get
(org-combine-plists (org-export--get-global-options (quote latex))
(org-export--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"
"\\definecolor{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-file-directory)) (texfilebase (make-temp-name (expand-file-name
"orgtex" tmpdir))) (texfile (concat texfilebase ".tex")) (pdffile (concat
texfilebase ".pdf")) (pngfile (concat texfilebase ".png")) (fnh (if (featurep
(quote xemacs)) (font-height (face-font (quote default))) (face-attribute
(quote default) :height nil))) (scale (or (plist-get options (if buffer :scale
:html-scale)) 1.0)) (dpi (number-to-string (* scale (floor (* 0.9 (if buffer
fnh 140)))))) (fg (or (plist-get options (if buffer :foreground
:html-foreground)) "black")) (bg (or (plist-get options (if buffer :background
:html-background)) "white"))) (if (eq fg (quote default)) (setq fg
(org-latex-color :foreground)) (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= bg "Transparent") "white" bg)))) (let
((latex-header (org-create-formula--latex-header))) (with-temp-file texfile
(insert latex-header) (insert "\n\\begin{document}\n" "\\definecolor{fg}{rgb}{"
fg "}\n" "\\definecolor{bg}{rgb}{" bg "}\n" "\n\\pagecolor{bg}\n"
"\n{\\color{fg}\n" string "\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-process "convert" nil nil nil "-density" "96" "-trim"
"-antialias" pdffile "-quality" "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 from %s" texfile) nil) (copy-file
pngfile tofile (quote replace)) (loop for e in (quote (".pdf" ".tex" ".aux"
".log" ".png")) do (if (file-exists-p (concat texfilebase e)) (delete-file
(concat texfilebase e)))) pngfile)))
org-create-formula-image-with-imagemagick(#("\\begin{displaymath}\ny
=\\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_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
=\\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_f377aad0eb76b23f13c94b859ac421c0039ab40b.png"
(:foreground default :background default :scale 1.2 :html-foreground "Black"
:html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$"
"\\(" "\\[")) forbuffer)
org-create-formula-image(#("\\begin{displaymath}\ny
=\\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_f377aad0eb76b23f13c94b859ac421c0039ab40b.png"
(:foreground default :background default :scale 1.2 :html-foreground "Black"
:html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$"
"\\(" "\\[")) forbuffer imagemagick)
(if (file-exists-p movefile) nil (org-create-formula-image txt movefile
optnew forbuffer processing-type))
(unless (file-exists-p movefile) (org-create-formula-image txt movefile
optnew 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
(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 (quote default)))) (when (eq bg (quote auto)) (setq bg
(face-attribute face :background nil (quote default)))) (setq 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" 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-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 (lambda (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 ...))) (overlay-put ov (quote
display) (list (quote image) :type (quote png) :file movefile :ascent (quote
center)))) (push ov org-latex-fragment-image-overlays) (goto-char end))
(delete-region beg end) (insert (org-add-props link (list (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-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-latex-as-mathml txt block-type prefix dir))) (t (error "Unknown
conversion type %s for LaTeX fragments" processing-type)))
(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) end
(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)) (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" 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-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 (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 ...))) (push ov
org-latex-fragment-image-overlays) (goto-char end)) (delete-region beg end)
(insert (org-add-props link (list (quote org-latex-src)
(replace-regexp-in-string "\"" "" txt) (quote org-latex-src-embed-type) (if
block-type ... ...)))))) ((eq processing-type (quote mathml)) (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-latex-as-mathml txt
block-type prefix dir))) (t (error "Unknown conversion type %s for LaTeX
fragments" processing-type))))
(if (and (or (not at) (equal (cdr at) (match-beginning n))) (or (not
overlays) (not (eq (get-char-property (match-beginning n) (quote
org-overlay-type)) (quote org-latex-overlay))))) (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 "\\(" ... "\\)"))))) ((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
(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 ...) (setq fg ...)) (when (eq bg ...) (setq bg ...)) (setq optnew
(copy-sequence opt)) (plist-put optnew :foreground fg) (plist-put optnew
:background bg)) (setq hash (sha1 (prin1-to-string ...)) 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 checkdir 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 (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-region beg end) (insert (org-add-props link (list ... ... ... ...)))))
((eq processing-type (quote mathml)) (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-latex-as-mathml 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
overlays) (not (eq (get-char-property (match-beginning n) (quote
org-overlay-type)) (quote org-latex-overlay))))) (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 (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)) (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" 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-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 (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 ...))) (push ov
org-latex-fragment-image-overlays) (goto-char end)) (delete-region beg end)
(insert (org-add-props link (list (quote org-latex-src)
(replace-regexp-in-string "\"" "" txt) (quote org-latex-src-embed-type) (if
block-type ... ...)))))) ((eq processing-type (quote mathml)) (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-latex-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 at)
(match-beginning n))) (or (not overlays) (not (eq (get-char-property
(match-beginning n) (quote org-overlay-type)) (quote org-latex-overlay)))))
(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 "\\(" ... "\\)"))))) ((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 (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 ...) (setq fg ...)) (when (eq bg ...) (setq bg ...)) (setq optnew
(copy-sequence opt)) (plist-put optnew :foreground fg) (plist-put optnew
:background bg)) (setq hash (sha1 (prin1-to-string ...)) 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 checkdir 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 (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-region beg end) (insert (org-add-props link (list ... ... ... ...)))))
((eq processing-type (quote mathml)) (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-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-excursion
(delete-region ... ...) (goto-char ...) (insert ...)))) ((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 ...) (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 checkdir 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-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 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))))))
(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 (quote verbatim))) ((eq processing-type (quote mathjax)) (setq
string (match-string n)) (when (member m ...) (save-excursion ... ... ...)))
((or (eq processing-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 (setq
checkdir t) (or ... ...)) (unless (file-exists-p movefile)
(org-create-formula-image txt movefile optnew 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 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)))))))
(when (member m matchers) (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-excursion (delete-region ... ...) (goto-char ...) (insert
...)))) ((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 ...) (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 checkdir 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-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 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))))))
(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 (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 processing-type
(quote mathjax)) (setq string (match-string n)) (when (member m ...)
(save-excursion ... ... ...))) ((or (eq processing-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 (setq checkdir t) (or ... ...)) (unless
(file-exists-p movefile) (org-create-formula-image txt movefile optnew
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
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)))))))
(let* ((prefixnodir (file-name-nondirectory prefix)) (absprefix
(expand-file-name prefix dir)) (todir (file-name-directory absprefix)) (opt
org-format-latex-options) (optnew org-format-latex-options) (matchers
(plist-get opt :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
(point-min)) (while (re-search-forward re nil t) (when (and (or (not at) (equal
... ...)) (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 beg end) (insert ...)) (t
(error "Unknown conversion type %s for LaTeX fragments" processing-type))))))))
org-format-latex("ltxpng/i-notes-study" "/home/feng/org/" overlays "Creating
image...%s" (#("\\begin{displaymath}" 0 19 (fontified t)) . 30719) forbuffer
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
(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) msg "Creating images for subtree...%s")) (t (if (setq at
(org-inside-LaTeX-fragment-p)) (goto-char (max (point-min) (- (cdr at) 2)))
(org-back-to-heading)) (setq beg (point) end (progn (outline-next-heading)
(point)) msg (if at "Creating image...%s" "Creating images for entry...%s"))))
(message msg "") (narrow-to-region beg end) (goto-char beg) (org-format-latex
(concat org-latex-preview-ltxpng-directory (file-name-sans-extension
(file-name-nondirectory buffer-file-name))) default-directory (quote overlays)
msg at (quote forbuffer) org-latex-create-formula-image-program) (message msg
"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
(point) 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-heading)
(point)) msg (if at "Creating image...%s" "Creating images for entry...%s"))))
(message msg "") (narrow-to-region beg end) (goto-char beg) (org-format-latex
(concat org-latex-preview-ltxpng-directory (file-name-sans-extension
(file-name-nondirectory buffer-file-name))) default-directory (quote overlays)
msg at (quote forbuffer) org-latex-create-formula-image-program) (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) msg
"Creating images for subtree...%s")) (t (if (setq at
(org-inside-LaTeX-fragment-p)) (goto-char (max ... ...)) (org-back-to-heading))
(setq beg (point) end (progn (outline-next-heading) (point)) msg (if at
"Creating image...%s" "Creating images for entry...%s")))) (message msg "")
(narrow-to-region beg end) (goto-char beg) (org-format-latex (concat
org-latex-preview-ltxpng-directory (file-name-sans-extension
(file-name-nondirectory buffer-file-name))) default-directory (quote overlays)
msg at (quote forbuffer) org-latex-create-formula-image-program) (message msg
"done. Use `C-c C-c' to remove images."))))
(progn (org-remove-latex-fragment-image-overlays) (save-excursion
(save-restriction (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 (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) (goto-char beg)
(org-format-latex (concat org-latex-preview-ltxpng-directory
(file-name-sans-extension (file-name-nondirectory buffer-file-name)))
default-directory (quote overlays) 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 subtree
...) (org-back-to-heading) (setq beg ... end ... msg "Creating images for
subtree...%s")) (t (if ... ... ...) (setq beg ... end ... msg ...))) (message
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-create-formula-image-program) (message msg "done. Use `C-c C-c' to
remove images."))))))
(when (display-graphic-p) (org-remove-latex-fragment-image-overlays)
(save-excursion (save-restriction (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 (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) (goto-char beg) (org-format-latex (concat
org-latex-preview-ltxpng-directory (file-name-sans-extension
(file-name-nondirectory buffer-file-name))) default-directory (quote overlays)
msg at (quote forbuffer) org-latex-create-formula-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
--