forked from mirrors/org-mode
ox-latex: Fix insertion of line breaks at invalid locations
* lisp/ox-latex.el (org-latex-clean-invalid-line-breaks): New function. Reported-by: Takeshi Teshima <takeshi.diadochos@gmail.com> <http://permalink.gmane.org/gmane.emacs.orgmode/111313>
This commit is contained in:
parent
1fbc7a424f
commit
35e90ced24
|
@ -100,8 +100,10 @@
|
||||||
(if a (org-latex-export-to-pdf t s v b)
|
(if a (org-latex-export-to-pdf t s v b)
|
||||||
(org-open-file (org-latex-export-to-pdf nil s v b)))))))
|
(org-open-file (org-latex-export-to-pdf nil s v b)))))))
|
||||||
:filters-alist '((:filter-options . org-latex-math-block-options-filter)
|
:filters-alist '((:filter-options . org-latex-math-block-options-filter)
|
||||||
|
(:filter-paragraph . org-latex-clean-invalid-line-breaks)
|
||||||
(:filter-parse-tree org-latex-math-block-tree-filter
|
(:filter-parse-tree org-latex-math-block-tree-filter
|
||||||
org-latex-matrices-tree-filter))
|
org-latex-matrices-tree-filter)
|
||||||
|
(:filter-verse-block . org-latex-clean-invalid-line-breaks))
|
||||||
:options-alist
|
:options-alist
|
||||||
'((:latex-class "LATEX_CLASS" nil org-latex-default-class t)
|
'((:latex-class "LATEX_CLASS" nil org-latex-default-class t)
|
||||||
(:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
|
(:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
|
||||||
|
@ -1621,6 +1623,25 @@ INFO is a plist used as a communication channel."
|
||||||
(member (or compiler "") org-latex-compilers)
|
(member (or compiler "") org-latex-compilers)
|
||||||
(format org-latex-compiler-file-string compiler))))
|
(format org-latex-compiler-file-string compiler))))
|
||||||
|
|
||||||
|
|
||||||
|
;;; Filters
|
||||||
|
|
||||||
|
(defun org-latex-matrices-tree-filter (tree _backend info)
|
||||||
|
(org-latex--wrap-latex-matrices tree info))
|
||||||
|
|
||||||
|
(defun org-latex-math-block-tree-filter (tree _backend info)
|
||||||
|
(org-latex--wrap-latex-math-block tree info))
|
||||||
|
|
||||||
|
(defun org-latex-math-block-options-filter (info _backend)
|
||||||
|
(dolist (prop '(:author :date :title) info)
|
||||||
|
(plist-put info prop
|
||||||
|
(org-latex--wrap-latex-math-block (plist-get info prop) info))))
|
||||||
|
|
||||||
|
(defun org-latex-clean-invalid-line-breaks (data _backend _info)
|
||||||
|
(replace-regexp-in-string
|
||||||
|
"\\(\\end{[A-Za-z0-9*]+}\\|^\\)[ \t]*\\\\\\\\[ \t]*$" "\\1"
|
||||||
|
data))
|
||||||
|
|
||||||
|
|
||||||
;;; Template
|
;;; Template
|
||||||
|
|
||||||
|
@ -2683,8 +2704,6 @@ channel."
|
||||||
(t "\\[\n%s\\]"))
|
(t "\\[\n%s\\]"))
|
||||||
contents))
|
contents))
|
||||||
|
|
||||||
(defun org-latex-matrices-tree-filter (tree _backend info)
|
|
||||||
(org-latex--wrap-latex-matrices tree info))
|
|
||||||
|
|
||||||
;;;; Pseudo Object: LaTeX Math Block
|
;;;; Pseudo Object: LaTeX Math Block
|
||||||
|
|
||||||
|
@ -2742,14 +2761,6 @@ containing export options. Modify DATA by side-effect and return it."
|
||||||
;; Return updated DATA.
|
;; Return updated DATA.
|
||||||
data))
|
data))
|
||||||
|
|
||||||
(defun org-latex-math-block-tree-filter (tree _backend info)
|
|
||||||
(org-latex--wrap-latex-math-block tree info))
|
|
||||||
|
|
||||||
(defun org-latex-math-block-options-filter (info _backend)
|
|
||||||
(dolist (prop '(:author :date :title) info)
|
|
||||||
(plist-put info prop
|
|
||||||
(org-latex--wrap-latex-math-block (plist-get info prop) info))))
|
|
||||||
|
|
||||||
(defun org-latex-math-block (_math-block contents _info)
|
(defun org-latex-math-block (_math-block contents _info)
|
||||||
"Transcode a MATH-BLOCK object from Org to LaTeX.
|
"Transcode a MATH-BLOCK object from Org to LaTeX.
|
||||||
CONTENTS is a string. INFO is a plist used as a communication
|
CONTENTS is a string. INFO is a plist used as a communication
|
||||||
|
|
Loading…
Reference in a new issue