Mercurial > emacs
annotate lisp/textmodes/org-export-latex.el @ 87665:b9e8ab94c460
Add 2008 to copyright years.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 09 Jan 2008 04:26:53 +0000 |
parents | 86f143f19d08 |
children | b7acc6fad5a9 |
rev | line source |
---|---|
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1 ;;; org-export-latex.el --- LaTeX exporter for org-mode |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
2 ;; |
87665 | 3 ;; Copyright (C) 2007, 2008 Free Software Foundation, Inc. |
82752 | 4 ;; |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
5 ;; Emacs Lisp Archive Entry |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
6 ;; Filename: org-export-latex.el |
85554
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
7 ;; Version: 5.12 |
82752 | 8 ;; Author: Bastien Guerry <bzg AT altern DOT org> |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
9 ;; Maintainer: Bastien Guerry <bzg AT altern DOT org> |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
10 ;; Keywords: org, wp, tex |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
11 ;; Description: Converts an org-mode buffer into LaTeX |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
12 ;; URL: http://www.cognition.ens.fr/~guerry/u/org-export-latex.el |
82752 | 13 ;; |
14 ;; This file is part of GNU Emacs. | |
15 ;; | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
16 ;; GNU Emacs is free software; you can redistribute it and/or modify it |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
17 ;; under the terms of the GNU General Public License as published by the |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
18 ;; Free Software Foundation; either version 3, or (at your option) any |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
19 ;; later version. |
82752 | 20 ;; |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
21 ;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
22 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
23 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
24 ;; more details. |
85749
5032dc6e8d82
Revert down-casing of copyright header.
Glenn Morris <rgm@gnu.org>
parents:
85554
diff
changeset
|
25 ;; |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
26 ;; You should have received a copy of the GNU General Public License along |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
27 ;; with GNU Emacs; see the file COPYING. If not, write to the Free Software |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
28 ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
29 ;; 02110-1301, USA. |
82752 | 30 ;; |
31 ;;; Commentary: | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
32 ;; |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
33 ;; This library implements a LaTeX exporter for org-mode. |
82752 | 34 ;; |
35 ;; Put this file into your load-path and the following into your ~/.emacs: | |
36 ;; (require 'org-export-latex) | |
37 ;; | |
38 ;; The interactive functions are similar to those of the HTML exporter: | |
39 ;; | |
40 ;; M-x `org-export-as-latex' | |
41 ;; M-x `org-export-as-latex-batch' | |
42 ;; M-x `org-export-as-latex-to-buffer' | |
43 ;; M-x `org-export-region-as-latex' | |
44 ;; M-x `org-replace-region-by-latex' | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
45 ;; |
82752 | 46 ;;; Code: |
47 | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
48 (eval-when-compile |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
49 (require 'cl)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
50 |
82752 | 51 (require 'footnote) |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
52 (require 'org) |
82752 | 53 |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
54 ;;; Variables: |
82752 | 55 (defvar org-latex-options-plist nil) |
56 (defvar org-latex-todo-keywords-1 nil) | |
57 (defvar org-latex-all-targets-regexp nil) | |
58 (defvar org-latex-add-level 0) | |
59 (defvar org-latex-sectioning-depth 0) | |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
60 (defvar org-export-latex-list-beginning-re |
85554
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
61 "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) +?") |
82752 | 62 |
63 (defvar org-latex-special-string-regexps | |
64 '(org-ts-regexp | |
65 org-scheduled-string | |
66 org-deadline-string | |
67 org-clock-string) | |
68 "A list of regexps to convert as special keywords.") | |
69 | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
70 (defvar latexp) ; dynamically scoped from org.el |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
71 (defvar re-quote) ; dynamically scoped from org.el |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
72 (defvar commentsp) ; dynamically scoped from org.el |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
73 |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
74 ;;; Custom variables: |
82752 | 75 (defcustom org-export-latex-sectioning-alist |
76 '((1 "\\section{%s}" "\\section*{%s}") | |
77 (2 "\\subsection{%s}" "\\subsection*{%s}") | |
78 (3 "\\subsubsection{%s}" "\\subsubsection*{%s}") | |
79 (4 "\\paragraph{%s}" "\\paragraph*{%s}") | |
80 (5 "\\subparagraph{%s}" "\\subparagraph*{%s}")) | |
81 "Alist of LaTeX commands for inserting sections. | |
82 Here is the structure of each cell: | |
83 | |
84 \(level unnumbered-section numbered-section\) | |
85 | |
86 The %s formatter will be replaced by the title of the section." | |
87 :group 'org-export-latex | |
88 :type 'alist) | |
89 | |
90 (defcustom org-export-latex-emphasis-alist | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
91 '(("*" "\\textbf{%s}" nil) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
92 ("/" "\\emph{%s}" nil) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
93 ("_" "\\underline{%s}" nil) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
94 ("+" "\\texttt{%s}" nil) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
95 ("=" "\\texttt{%s}" nil)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
96 "Alist of LaTeX expressions to convert emphasis fontifiers. |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
97 Each element of the list is a list of three elements. |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
98 The first element is the character used as a marker for fontification. |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
99 The second element is a formatting string to wrap fontified text with. |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
100 The third element decides whether to protect converted text from other |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
101 conversions." |
82752 | 102 :group 'org-export-latex |
103 :type 'alist) | |
104 | |
105 (defcustom org-export-latex-preamble | |
106 "\\documentclass[11pt,a4paper]{article} | |
107 \\usepackage[utf8]{inputenc} | |
108 \\usepackage[T1]{fontenc} | |
109 \\usepackage{hyperref}" | |
110 "Preamble to be inserted at the very beginning of the LaTeX export." | |
111 :group 'org-export-latex | |
112 :type 'string) | |
113 | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
114 (defcustom org-export-latex-title-command "\\maketitle" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
115 "The command used to insert the title just after \\begin{document}. |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
116 If this string contains the formatting specification \"%s\" then |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
117 it will be used as a formatting string, passing the title as an |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
118 argument." |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
119 :group 'org-export-latex |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
120 :type 'string) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
121 |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
122 (defcustom org-export-latex-date-format |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
123 "%d %B %Y" |
82752 | 124 "Format string for \\date{...}." |
125 :group 'org-export-latex | |
126 :type 'string) | |
127 | |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
128 (defcustom org-export-latex-tables-verbatim nil |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
129 "When non-nil, export tables as verbatim." |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
130 :group 'org-export-latex |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
131 :type 'boolean) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
132 |
82752 | 133 (defcustom org-export-latex-packages-alist nil |
134 "Alist of packages to be inserted in the preamble. | |
135 Each cell is of the forma \( option . package \). | |
136 | |
137 For example: | |
138 | |
139 \(setq org-export-latex-packages-alist | |
140 '((\"french\" \"babel\"))" | |
141 :group 'org-export-latex | |
142 :type 'alist) | |
143 | |
144 (defcustom org-export-latex-low-levels 'description | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
145 "How to convert sections below the current level of sectioning, |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
146 as specified by `org-export-headline-levels' or the value of \"H:\" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
147 in Org's #+OPTION line. |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
148 |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
149 This can be either nil (skip the sections), 'description (convert |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
150 the sections as descriptive lists) or a string to be used instead |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
151 of \\section{%s}. In this latter case, the %s stands here for the |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
152 inserted headline and is mandatory." |
82752 | 153 :group 'org-export-latex |
154 :type '(choice (const :tag "Ignore" nil) | |
155 (symbol :tag "Convert as descriptive list" description) | |
156 (string :tag "Use a section string" :value "\\subparagraph{%s}"))) | |
157 | |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
158 (defcustom org-export-latex-remove-from-headlines |
82752 | 159 '(:todo t :priority t :tags t) |
160 "A plist of keywords to remove from headlines. | |
161 Non-nil means remove this keyword type from the headline. | |
162 | |
163 Don't remove the keys, just change their values." | |
164 :type 'plist | |
165 :group 'org-export-latex) | |
166 | |
167 (defcustom org-export-latex-image-default-option "width=10em" | |
168 "Default option for images." | |
169 :group 'org-export-latex | |
170 :type '(string)) | |
171 | |
172 (defcustom org-export-latex-coding-system nil | |
173 "Coding system for the exported LaTex file." | |
174 :group 'org-export-latex | |
175 :type 'coding-system) | |
176 | |
177 ;; FIXME Do we want this one? | |
178 ;; (defun org-export-as-latex-and-open (arg) ...) | |
179 | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
180 ;;; Autoload functions: |
82752 | 181 ;;;###autoload |
182 (defun org-export-as-latex-batch () | |
183 "Call `org-export-as-latex', may be used in batch processing as | |
184 emacs --batch | |
185 --load=$HOME/lib/emacs/org.el | |
186 --eval \"(setq org-export-headline-levels 2)\" | |
187 --visit=MyFile --funcall org-export-as-latex-batch" | |
188 (org-export-as-latex org-export-headline-levels 'hidden)) | |
189 | |
190 ;;;###autoload | |
191 (defun org-export-as-latex-to-buffer (arg) | |
192 "Call `org-exort-as-latex` with output to a temporary buffer. | |
193 No file is created. The prefix ARG is passed through to `org-export-as-latex'." | |
194 (interactive "P") | |
195 (org-export-as-latex arg nil nil "*Org LaTeX Export*") | |
196 (switch-to-buffer-other-window "*Org LaTeX Export*")) | |
197 | |
198 ;;;###autoload | |
199 (defun org-replace-region-by-latex (beg end) | |
200 "Replace the region from BEG to END with its LaTeX export. | |
201 It assumes the region has `org-mode' syntax, and then convert it to | |
202 LaTeX. This can be used in any buffer. For example, you could | |
203 write an itemized list in `org-mode' syntax in an LaTeX buffer and | |
204 then use this command to convert it." | |
205 (interactive "r") | |
206 (let (reg latex buf) | |
207 (save-window-excursion | |
208 (if (org-mode-p) | |
209 (setq latex (org-export-region-as-latex | |
210 beg end t 'string)) | |
211 (setq reg (buffer-substring beg end) | |
212 buf (get-buffer-create "*Org tmp*")) | |
213 (save-excursion | |
214 (set-buffer buf) | |
215 (erase-buffer) | |
216 (insert reg) | |
217 (org-mode) | |
218 (setq latex (org-export-region-as-latex | |
219 (point-min) (point-max) t 'string))) | |
220 (kill-buffer buf))) | |
221 (delete-region beg end) | |
222 (insert latex))) | |
223 | |
224 ;;;###autoload | |
225 (defun org-export-region-as-latex (beg end &optional body-only buffer) | |
226 "Convert region from BEG to END in `org-mode' buffer to LaTeX. | |
227 If prefix arg BODY-ONLY is set, omit file header, footer, and table of | |
228 contents, and only produce the region of converted text, useful for | |
229 cut-and-paste operations. | |
230 If BUFFER is a buffer or a string, use/create that buffer as a target | |
231 of the converted LaTeX. If BUFFER is the symbol `string', return the | |
232 produced LaTeX as a string and leave not buffer behind. For example, | |
233 a Lisp program could call this function in the following way: | |
234 | |
235 (setq latex (org-export-region-as-latex beg end t 'string)) | |
236 | |
237 When called interactively, the output buffer is selected, and shown | |
238 in a window. A non-interactive call will only retunr the buffer." | |
239 (interactive "r\nP") | |
240 (when (interactive-p) | |
241 (setq buffer "*Org LaTeX Export*")) | |
242 (let ((transient-mark-mode t) (zmacs-regions t) | |
243 rtn) | |
244 (goto-char end) | |
245 (set-mark (point)) ;; to activate the region | |
246 (goto-char beg) | |
247 (setq rtn (org-export-as-latex | |
248 nil nil nil | |
249 buffer body-only)) | |
250 (if (fboundp 'deactivate-mark) (deactivate-mark)) | |
251 (if (and (interactive-p) (bufferp rtn)) | |
252 (switch-to-buffer-other-window rtn) | |
253 rtn))) | |
254 | |
255 ;;;###autoload | |
256 (defun org-export-as-latex (arg &optional hidden ext-plist | |
257 to-buffer body-only) | |
258 "Export current buffer to a LaTeX file." | |
259 (interactive "P") | |
260 ;; Make sure we have a file name when we need it. | |
261 (when (and (not (or to-buffer body-only)) | |
262 (not buffer-file-name)) | |
263 (if (buffer-base-buffer) | |
264 (org-set-local 'buffer-file-name | |
265 (with-current-buffer (buffer-base-buffer) | |
266 buffer-file-name)) | |
267 (error "Need a file name to be able to export"))) | |
268 | |
269 (message "Exporting to LaTeX...") | |
270 (org-update-radio-target-regexp) | |
271 (org-export-latex-set-initial-vars ext-plist) | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
272 (let* ((wcf (current-window-configuration)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
273 (opt-plist org-latex-options-plist) |
82752 | 274 (filename (concat (file-name-as-directory |
275 (org-export-directory :LaTeX ext-plist)) | |
276 (file-name-sans-extension | |
277 (file-name-nondirectory ;sans-extension | |
278 buffer-file-name)) ".tex")) | |
279 (filename (if (equal (file-truename filename) | |
280 (file-truename buffer-file-name)) | |
281 (concat filename ".tex") | |
282 filename)) | |
283 (buffer (if to-buffer | |
284 (cond | |
285 ((eq to-buffer 'string) (get-buffer-create | |
286 "*Org LaTeX Export*")) | |
287 (t (get-buffer-create to-buffer))) | |
288 (find-file-noselect filename))) | |
289 (region-p (org-region-active-p)) | |
290 (odd org-odd-levels-only) | |
291 (preamble (org-export-latex-make-preamble opt-plist)) | |
292 (skip (plist-get opt-plist :skip-before-1st-heading)) | |
293 (text (plist-get opt-plist :text)) | |
294 (first-lines (if skip "" (org-export-latex-first-lines))) | |
295 (coding-system (and (boundp 'buffer-file-coding-system) | |
296 buffer-file-coding-system)) | |
297 (coding-system-for-write (or org-export-latex-coding-system | |
298 coding-system)) | |
299 (save-buffer-coding-system (or org-export-latex-coding-system | |
300 coding-system)) | |
301 (region (buffer-substring | |
302 (if region-p (region-beginning) (point-min)) | |
303 (if region-p (region-end) (point-max)))) | |
304 (string-for-export | |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
305 (org-cleaned-string-for-export |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
306 region :emph-multiline t |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
307 :for-LaTeX t |
82752 | 308 :comments nil |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
309 :add-text (if (eq to-buffer 'string) nil text) |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
310 :skip-before-1st-heading skip |
82752 | 311 :LaTeX-fragments nil))) |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
312 |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
313 (set-buffer buffer) |
82752 | 314 (erase-buffer) |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
315 |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
316 (and (fboundp 'set-buffer-file-coding-system) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
317 (set-buffer-file-coding-system coding-system-for-write)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
318 |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
319 ;; insert the preamble and initial document commands |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
320 (unless (or (eq to-buffer 'string) body-only) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
321 (insert preamble)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
322 |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
323 ;; insert text found in #+TEXT |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
324 (when (and text (not (eq to-buffer 'string))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
325 (insert (org-export-latex-content text) "\n\n")) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
326 |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
327 ;; insert lines before the first headline |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
328 (unless (or skip (eq to-buffer 'string)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
329 (insert first-lines)) |
82752 | 330 |
331 ;; handle the case where the region does not begin with a section | |
332 (when region-p | |
333 (insert (with-temp-buffer | |
334 (insert string-for-export) | |
335 (org-export-latex-first-lines)))) | |
336 | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
337 ;; export the content of headlines |
82752 | 338 (org-export-latex-global |
339 (with-temp-buffer | |
340 (insert string-for-export) | |
341 (goto-char (point-min)) | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
342 (when (re-search-forward "^\\(\\*+\\) " nil t) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
343 (let* ((asters (length (match-string 1))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
344 (level (if odd (- asters 2) (- asters 1)))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
345 (setq org-latex-add-level |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
346 (if odd (1- (/ (1+ asters) 2)) (1- asters))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
347 (org-export-latex-parse-global level odd))))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
348 |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
349 ;; finalization |
82752 | 350 (unless body-only (insert "\n\\end{document}")) |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
351 (or to-buffer (save-buffer)) |
82752 | 352 (goto-char (point-min)) |
353 (message "Exporting to LaTeX...done") | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
354 (prog1 |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
355 (if (eq to-buffer 'string) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
356 (prog1 (buffer-substring (point-min) (point-max)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
357 (kill-buffer (current-buffer))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
358 (current-buffer)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
359 (set-window-configuration wcf)))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
360 |
82752 | 361 |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
362 ;;; Parsing functions: |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
363 (defun org-export-latex-parse-global (level odd) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
364 "Parse the current buffer recursively, starting at LEVEL. |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
365 If ODD is non-nil, assume the buffer only contains odd sections. |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
366 Return A list reflecting the document structure." |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
367 (save-excursion |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
368 (goto-char (point-min)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
369 (let* ((cnt 0) output |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
370 (depth org-latex-sectioning-depth)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
371 (while (re-search-forward |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
372 (concat "^\\(\\(?:\\*\\)\\{" |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
373 (number-to-string (+ (if odd 2 1) level)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
374 "\\}\\) \\(.*\\)$") |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
375 ;; make sure that there is no upper heading |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
376 (when (> level 0) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
377 (save-excursion |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
378 (save-match-data |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
379 (re-search-forward |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
380 (concat "^\\(\\(?:\\*\\)\\{" |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
381 (number-to-string level) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
382 "\\}\\) \\(.*\\)$") nil t)))) t) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
383 (setq cnt (1+ cnt)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
384 (let* ((pos (match-beginning 0)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
385 (heading (match-string 2)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
386 (nlevel (if odd (/ (+ 3 level) 2) (1+ level)))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
387 (save-excursion |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
388 (narrow-to-region |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
389 (point) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
390 (save-match-data |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
391 (if (re-search-forward |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
392 (concat "^\\(\\(?:\\*\\)\\{" |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
393 (number-to-string (+ (if odd 2 1) level)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
394 "\\}\\) \\(.*\\)$") nil t) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
395 (match-beginning 0) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
396 (point-max)))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
397 (goto-char (point-min)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
398 (setq output |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
399 (append output |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
400 (list |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
401 (list |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
402 `(pos . ,pos) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
403 `(level . ,nlevel) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
404 `(occur . ,cnt) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
405 `(heading . ,heading) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
406 `(content . ,(org-export-latex-parse-content)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
407 `(subcontent . ,(org-export-latex-parse-subcontent |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
408 level odd))))))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
409 (widen))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
410 (list output)))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
411 |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
412 (defun org-export-latex-parse-list (&optional delete) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
413 "Parse the list at point. |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
414 Return a list containing first level items as strings and |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
415 sublevels as list of strings." |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
416 (let ((start (point)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
417 ;; Find the end of the list |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
418 (end (save-excursion |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
419 (catch 'exit |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
420 (while (or (looking-at org-export-latex-list-beginning-re) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
421 (looking-at "^[ \t]+\\|^$")) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
422 (if (eq (point) (point-max)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
423 (throw 'exit (point-max))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
424 (forward-line 1))) (point))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
425 output itemsep) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
426 (while (re-search-forward org-export-latex-list-beginning-re end t) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
427 (setq itemsep (if (save-match-data |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
428 (string-match "^[0-9]" (match-string 2))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
429 "[0-9]+\\(?:\\.\\|)\\)" "[-+]")) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
430 (let* ((indent1 (match-string 1)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
431 (nextitem (save-excursion |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
432 (save-match-data |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
433 (or (and (re-search-forward |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
434 (concat "^" indent1 itemsep " *?") end t) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
435 (match-beginning 0)) end)))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
436 (item (buffer-substring |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
437 (point) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
438 (or (and (re-search-forward |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
439 org-export-latex-list-beginning-re end t) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
440 (goto-char (match-beginning 0))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
441 (goto-char end)))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
442 (nextindent (match-string 1)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
443 (item (org-trim item)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
444 (item (if (string-match "^\\[.+\\]" item) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
445 (replace-match "\\\\texttt{\\&}" |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
446 t nil item) item))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
447 (push item output) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
448 (when (> (length nextindent) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
449 (length indent1)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
450 (narrow-to-region (point) nextitem) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
451 (push (org-export-latex-parse-list) output) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
452 (widen)))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
453 (when delete (delete-region start end)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
454 (setq output (nreverse output)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
455 (push (if (string-match "^\\[0" itemsep) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
456 'ordered 'unordered) output))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
457 |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
458 (defun org-export-latex-parse-content () |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
459 "Extract the content of a section." |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
460 (let ((beg (point)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
461 (end (if (re-search-forward "^\\(\\*\\)+ .*$" nil t) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
462 (progn (beginning-of-line) (point)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
463 (point-max)))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
464 (buffer-substring beg end))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
465 |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
466 (defun org-export-latex-parse-subcontent (level odd) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
467 "Extract the subcontent of a section at LEVEL. |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
468 If ODD Is non-nil, assume subcontent only contains odd sections." |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
469 (if (not (re-search-forward |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
470 (concat "^\\(\\(?:\\*\\)\\{" |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
471 (number-to-string (+ (if odd 4 2) level)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
472 "\\}\\) \\(.*\\)$") |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
473 nil t)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
474 nil ; subcontent is nil |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
475 (org-export-latex-parse-global (+ (if odd 2 1) level) odd))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
476 |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
477 ;;; Rendering functions: |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
478 (defun org-export-latex-global (content) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
479 "Export CONTENT to LaTeX. |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
480 CONTENT is an element of the list produced by |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
481 `org-export-latex-parse-global'." |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
482 (if (eq (car content) 'subcontent) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
483 (mapc 'org-export-latex-sub (cdr content)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
484 (org-export-latex-sub (car content)))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
485 |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
486 (defun org-export-latex-sub (subcontent) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
487 "Export the list SUBCONTENT to LaTeX. |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
488 SUBCONTENT is an alist containing information about the headline |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
489 and its content." |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
490 (let ((num (plist-get org-latex-options-plist :section-numbers))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
491 (mapc (lambda(x) (org-export-latex-subcontent x num)) subcontent))) |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
492 |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
493 (defun org-export-latex-subcontent (subcontent num) |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
494 "Export each cell of SUBCONTENT to LaTeX." |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
495 (let ((heading (org-export-latex-fontify-headline |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
496 (cdr (assoc 'heading subcontent)))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
497 (level (- (cdr (assoc 'level subcontent)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
498 org-latex-add-level)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
499 (occur (number-to-string (cdr (assoc 'occur subcontent)))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
500 (content (cdr (assoc 'content subcontent))) |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
501 (subcontent (cadr (assoc 'subcontent subcontent)))) |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
502 (cond |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
503 ;; Normal conversion |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
504 ((<= level org-latex-sectioning-depth) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
505 (let ((sec (assoc level org-export-latex-sectioning-alist))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
506 (insert (format (if num (cadr sec) (caddr sec)) heading) "\n")) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
507 (insert (org-export-latex-content content)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
508 (cond ((stringp subcontent) (insert subcontent)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
509 ((listp subcontent) (org-export-latex-sub subcontent)))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
510 ;; At a level under the hl option: we can drop this subsection |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
511 ((> level org-latex-sectioning-depth) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
512 (cond ((eq org-export-latex-low-levels 'description) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
513 (insert (format "\\begin{description}\n\n\\item[%s]\n\n" heading)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
514 (insert (org-export-latex-content content)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
515 (cond ((stringp subcontent) (insert subcontent)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
516 ((listp subcontent) (org-export-latex-sub subcontent))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
517 (insert "\\end{description}\n")) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
518 ((stringp org-export-latex-low-levels) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
519 (insert (format org-export-latex-low-levels heading) "\n") |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
520 (insert (org-export-latex-content content)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
521 (cond ((stringp subcontent) (insert subcontent)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
522 ((listp subcontent) (org-export-latex-sub subcontent))))))))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
523 |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
524 |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
525 ;;; Exporting internals: |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
526 (defun org-export-latex-protect-string (string) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
527 "Prevent further conversion for STRING by adding the |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
528 org-protect property." |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
529 (add-text-properties |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
530 0 (length string) '(org-protected t) string) string) |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
531 |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
532 (defun org-export-latex-protect-char-in-string (char-list string) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
533 "Add org-protected text-property to char from CHAR-LIST in STRING." |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
534 (with-temp-buffer |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
535 (save-match-data |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
536 (insert string) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
537 (goto-char (point-min)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
538 (while (re-search-forward (regexp-opt char-list) nil t) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
539 (add-text-properties (match-beginning 0) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
540 (match-end 0) '(org-protected t))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
541 (buffer-string)))) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
542 |
82752 | 543 (defun org-export-latex-set-initial-vars (ext-plist) |
544 "Store org local variables required for LaTeX export. | |
545 EXT-PLIST is an optional additional plist." | |
546 (setq org-latex-todo-keywords-1 org-todo-keywords-1 | |
547 org-latex-all-targets-regexp | |
548 (org-make-target-link-regexp (org-all-targets)) | |
549 org-latex-options-plist | |
550 (org-combine-plists (org-default-export-plist) ext-plist | |
551 (org-infile-export-plist)) | |
552 org-latex-sectioning-depth | |
553 (let ((hl-levels (plist-get org-latex-options-plist :headline-levels)) | |
554 (sec-depth (length org-export-latex-sectioning-alist))) | |
555 ;; Fall back on org-export-latex-sectioning-alist length if | |
556 ;; headline-levels goes beyond it | |
557 (if (> hl-levels sec-depth) sec-depth hl-levels)))) | |
558 | |
559 (defun org-export-latex-make-preamble (opt-plist) | |
560 "Make the LaTeX preamble and return it as a string. | |
561 Argument OPT-PLIST is the options plist for current buffer." | |
562 (let ((toc (plist-get opt-plist :table-of-contents))) | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
563 (concat |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
564 (if (plist-get opt-plist :time-stamp-file) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
565 (format-time-string "% Created %Y-%m-%d %a %H:%M\n")) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
566 |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
567 ;; insert LaTeX custom preamble |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
568 org-export-latex-preamble "\n" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
569 |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
570 ;; insert information on LaTeX packages |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
571 (when org-export-latex-packages-alist |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
572 (mapconcat (lambda(p) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
573 (if (equal "" (car p)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
574 (format "\\usepackage{%s}" (cadr p)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
575 (format "\\usepackage[%s]{%s}" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
576 (car p) (cadr p)))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
577 org-export-latex-packages-alist "\n")) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
578 |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
579 ;; insert the title |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
580 (format |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
581 "\\title{%s}\n" |
85554
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
582 ;; convert the title |
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
583 (org-export-latex-content |
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
584 (or (plist-get opt-plist :title) |
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
585 (and (not |
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
586 (plist-get opt-plist :skip-before-1st-heading)) |
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
587 (org-export-grab-title-from-buffer)) |
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
588 (and buffer-file-name |
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
589 (file-name-sans-extension |
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
590 (file-name-nondirectory buffer-file-name))) |
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
591 "UNTITLED"))) |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
592 |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
593 ;; insert author info |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
594 (if (plist-get opt-plist :author-info) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
595 (format "\\author{%s}\n" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
596 (or (plist-get opt-plist :author) user-full-name)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
597 (format "%%\\author{%s}\n" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
598 (or (plist-get opt-plist :author) user-full-name))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
599 |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
600 ;; insert the date |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
601 (format "\\date{%s}\n" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
602 (format-time-string |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
603 (or (plist-get opt-plist :date) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
604 org-export-latex-date-format))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
605 |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
606 ;; beginning of the document |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
607 "\n\\begin{document}\n\n" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
608 |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
609 ;; insert the title command |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
610 (if (string-match "%s" org-export-latex-title-command) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
611 (format org-export-latex-title-command |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
612 (plist-get opt-plist :title)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
613 org-export-latex-title-command) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
614 "\n\n" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
615 |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
616 ;; table of contents |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
617 (when (and org-export-with-toc |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
618 (plist-get opt-plist :section-numbers)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
619 (cond ((numberp toc) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
620 (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\n" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
621 (min toc (plist-get opt-plist :headline-levels)))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
622 (toc (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\n" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
623 (plist-get opt-plist :headline-levels)))))))) |
82752 | 624 |
625 (defun org-export-latex-first-lines (&optional comments) | |
626 "Export the first lines before first headline. | |
627 COMMENTS is either nil to replace them with the empty string or a | |
628 formatting string like %%%%s if we want to comment them out." | |
629 (save-excursion | |
630 (goto-char (point-min)) | |
85554
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
631 (let* ((pt (point)) |
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
632 (end (if (and (re-search-forward "^\\*" nil t) |
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
633 (not (eq pt (match-beginning 0)))) |
82752 | 634 (goto-char (match-beginning 0)) |
635 (goto-char (point-max))))) | |
636 (org-export-latex-content | |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
637 (org-cleaned-string-for-export |
82752 | 638 (buffer-substring (point-min) end) |
639 :for-LaTeX t | |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
640 :emph-multiline t |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
641 :add-text nil |
82752 | 642 :comments nil |
643 :skip-before-1st-heading nil | |
644 :LaTeX-fragments nil))))) | |
645 | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
646 (defun org-export-latex-keywords-maybe (remove-list) |
82752 | 647 "Maybe remove keywords depending on rules in REMOVE-LIST." |
648 (goto-char (point-min)) | |
649 (let ((re-todo (mapconcat 'identity org-latex-todo-keywords-1 "\\|"))) | |
650 ;; convert TODO keywords | |
651 (when (re-search-forward (concat "^\\(" re-todo "\\)") nil t) | |
652 (if (plist-get remove-list :todo) | |
653 (replace-match "") | |
654 (replace-match (format "\\texttt{%s}" (match-string 1)) t t))) | |
655 ;; convert priority string | |
656 (when (re-search-forward "\\[\\\\#.\\]" nil t) | |
657 (if (plist-get remove-list :priority) | |
658 (replace-match "") | |
659 (replace-match (format "\\texttt{%s}" (match-string 0)) t t))) | |
660 ;; convert tags | |
661 (when (re-search-forward "\\(:[a-zA-Z0-9]+\\)+:" nil t) | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
662 (if (or (not org-export-with-tags) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
663 (plist-get remove-list :tags)) |
82752 | 664 (replace-match "") |
665 (replace-match (format "\\texttt{%s}" (match-string 0)) t t))))) | |
666 | |
667 (defun org-export-latex-fontify-headline (headline) | |
668 "Fontify special words in a HEADLINE." | |
669 (with-temp-buffer | |
670 ;; FIXME: org-inside-LaTeX-fragment-p doesn't work when the $...$ is at | |
671 ;; the beginning of the buffer - inserting "\n" is safe here though. | |
672 (insert "\n" headline) | |
673 (goto-char (point-min)) | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
674 (when (plist-get org-latex-options-plist :emphasize) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
675 (org-export-latex-fontify)) |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
676 (org-export-latex-special-chars |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
677 (plist-get org-latex-options-plist :sub-superscript)) |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
678 (org-export-latex-keywords-maybe |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
679 org-export-latex-remove-from-headlines) |
82752 | 680 (org-export-latex-links) |
681 (org-trim (buffer-substring-no-properties (point-min) (point-max))))) | |
682 | |
683 (defun org-export-latex-content (content) | |
684 "Convert CONTENT string to LaTeX." | |
685 (with-temp-buffer | |
686 (insert content) | |
687 (org-export-latex-quotation-marks) | |
688 (when (plist-get org-latex-options-plist :emphasize) | |
689 (org-export-latex-fontify)) | |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
690 (org-export-latex-special-chars |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
691 (plist-get org-latex-options-plist :sub-superscript)) |
82752 | 692 (org-export-latex-links) |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
693 (org-export-latex-keywords |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
694 (plist-get org-latex-options-plist :timestamps)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
695 (org-export-latex-lists) |
82752 | 696 (org-export-latex-tables |
697 (plist-get org-latex-options-plist :tables)) | |
698 (org-export-latex-fixed-width | |
699 (plist-get org-latex-options-plist :fixed-width)) | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
700 ;; return string |
82752 | 701 (buffer-substring (point-min) (point-max)))) |
702 | |
703 (defun org-export-latex-quotation-marks () | |
704 "Export question marks depending on language conventions. | |
705 Local definition of the language overrides | |
706 `org-export-latex-quotation-marks-convention' which overrides | |
707 `org-export-default-language'." | |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
708 (let* ((lang (plist-get org-latex-options-plist :language)) |
82752 | 709 (quote-rpl (if (equal lang "fr") |
710 '(("\\(\\s-\\)\"" "«~") | |
711 ("\\(\\S-\\)\"" "~»") | |
712 ("\\(\\s-\\)'" "`")) | |
713 '(("\\(\\s-\\)\"" "``") | |
714 ("\\(\\S-\\)\"" "''") | |
715 ("\\(\\s-\\)'" "`"))))) | |
716 (mapc (lambda(l) (goto-char (point-min)) | |
717 (while (re-search-forward (car l) nil t) | |
718 (let ((rpl (concat (match-string 1) (cadr l)))) | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
719 (org-export-latex-protect-string rpl) |
82752 | 720 (org-if-unprotected |
721 (replace-match rpl t t))))) quote-rpl))) | |
722 | |
723 ;; | chars/string in Org | normal environment | math environment | | |
724 ;; |-----------------------+-----------------------+-----------------------| | |
725 ;; | & # % $ | \& \# \% \$ | \& \# \% \$ | | |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
726 ;; | { } _ ^ \ | \{ \} \_ \^ \\ | { } _ ^ \ | |
82752 | 727 ;; |-----------------------+-----------------------+-----------------------| |
728 ;; | a_b and a^b | $a_b$ and $a^b$ | a_b and a^b | | |
729 ;; | a_abc and a_{abc} | $a_a$bc and $a_{abc}$ | a_abc and a_{abc} | | |
730 ;; | \tau and \mu | $\tau$ and $\mu$ | \tau and \mu | | |
731 ;; |-----------------------+-----------------------+-----------------------| | |
732 ;; | \_ \^ | \_ \^ | \_ \^ | | |
733 ;; | \(a=\mu\mbox{m}\) | \(a=\mu\mbox{m}\) | \(a=\mu\mbox{m}\) | | |
734 ;; | \[\beta^2-a=0\] | \[\beta^2-a=0\] | \[\beta^2-a=0\] | | |
735 ;; | $x=22\tau$ | $x=22\tau$ | $x=22\tau$ | | |
736 ;; | $$\alpha=\sqrt{a^3}$$ | $$\alpha=\sqrt{a^3}$$ | $$\alpha=\sqrt{a^3}$$ | | |
737 | |
738 (defun org-export-latex-special-chars (sub-superscript) | |
739 "Export special characters to LaTeX. | |
740 If SUB-SUPERSCRIPT is non-nil, convert \\ and ^. | |
741 See the `org-export-latex.el' code for a complete conversion table." | |
742 (goto-char (point-min)) | |
743 (mapc (lambda(c) | |
744 (goto-char (point-min)) | |
745 (while (re-search-forward c nil t) | |
746 ;; Put the point where to check for org-protected | |
747 (unless (get-text-property (match-beginning 2) 'org-protected) | |
748 (cond ((member (match-string 2) '("\\$" "$")) | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
749 (if (equal (match-string 2) "\\$") |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
750 (replace-match (concat (match-string 1) "$" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
751 (match-string 3)) t t) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
752 (replace-match (concat (match-string 1) "\\$" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
753 (match-string 3)) t t))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
754 ((member (match-string 2) '("&" "%" "#")) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
755 (if (equal (match-string 1) "\\") |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
756 (replace-match (match-string 2) t t) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
757 (replace-match (concat (match-string 1) "\\" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
758 (match-string 2)) t t))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
759 ((equal (match-string 2) "~") |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
760 (cond ((equal (match-string 1) "\\") nil) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
761 ((eq 'org-link (get-text-property 0 'face (match-string 2))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
762 (replace-match (concat (match-string 1) "\\~") t t)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
763 (t (replace-match |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
764 (org-export-latex-protect-string |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
765 (concat (match-string 1) "\\~{}")) t t)))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
766 ((member (match-string 2) '("{" "}")) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
767 (unless (save-match-data (org-inside-LaTeX-fragment-p)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
768 (if (equal (match-string 1) "\\") |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
769 (replace-match (match-string 2) t t) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
770 (replace-match (concat (match-string 1) "\\" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
771 (match-string 2)) t t))))) |
82752 | 772 (unless (save-match-data (org-inside-LaTeX-fragment-p)) |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
773 (cond ((equal (match-string 2) "\\") |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
774 (replace-match (or (save-match-data |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
775 (org-export-latex-treat-backslash-char |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
776 (match-string 1) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
777 (match-string 3))) "") t t)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
778 ((member (match-string 2) '("_" "^")) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
779 (replace-match (or (save-match-data |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
780 (org-export-latex-treat-sub-super-char |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
781 sub-superscript |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
782 (match-string 1) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
783 (match-string 2) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
784 (match-string 3))) "") t t))))))) |
82752 | 785 '("^\\([^\n$]*?\\|^\\)\\(\\\\?\\$\\)\\([^\n$]*\\)$" |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
786 "\\([a-za-z0-9]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\([a-za-z0-9]+\\|[ \t\n]\\|[:punct:]\\|{[a-za-z0-9]+}\\|([a-za-z0-9]+)\\)" |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
787 "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|[a-zA-Z&#%{}\"]+\\)" |
82752 | 788 "\\(.\\|^\\)\\(&\\)" |
789 "\\(.\\|^\\)\\(#\\)" | |
790 "\\(.\\|^\\)\\(%\\)" | |
791 "\\(.\\|^\\)\\({\\)" | |
792 "\\(.\\|^\\)\\(}\\)" | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
793 "\\(.\\|^\\)\\(~\\)" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
794 ;; (?\< . "\\textless{}") |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
795 ;; (?\> . "\\textgreater{}") |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
796 ))) |
82752 | 797 |
798 (defun org-export-latex-treat-sub-super-char | |
799 (subsup string-before char string-after) | |
800 "Convert the \"_\" and \"^\" characters to LaTeX. | |
801 SUBSUP corresponds to the ^: option in the #+OPTIONS line. | |
802 Convert CHAR depending on STRING-BEFORE and STRING-AFTER." | |
803 (cond ((equal string-before "\\") | |
804 (concat string-before char string-after)) | |
805 ;; this is part of a math formula | |
806 ((and (string-match "\\S-+" string-before) | |
807 (string-match "\\S-+" string-after)) | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
808 (cond ((eq 'org-link (get-text-property 0 'face char)) |
82752 | 809 (concat string-before "\\" char string-after)) |
810 ((save-match-data (org-inside-LaTeX-fragment-p)) | |
811 (if subsup | |
812 (cond ((eq 1 (length string-after)) | |
813 (concat string-before char string-after)) | |
814 ((string-match "[({]?\\([^)}]+\\)[)}]?" string-after) | |
815 (format "%s%s{%s}" string-before char | |
816 (match-string 1 string-after)))))) | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
817 ((and subsup |
82752 | 818 (> (length string-after) 1) |
819 (string-match "[({]?\\([^)}]+\\)[)}]?" string-after)) | |
820 (format "$%s%s{%s}$" string-before char | |
821 (match-string 1 string-after))) | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
822 (subsup (concat "$" string-before char string-after "$")) |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
823 (t (org-export-latex-protect-string |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
824 (concat string-before "\\" char "{}" string-after))))) |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
825 (t (org-export-latex-protect-string |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
826 (concat string-before "\\" char "{}" string-after))))) |
82752 | 827 |
828 (defun org-export-latex-treat-backslash-char (string-before string-after) | |
829 "Convert the \"$\" special character to LaTeX. | |
830 The conversion is made depending of STRING-BEFORE and STRING-AFTER." | |
831 (cond ((member (list string-after) org-html-entities) | |
832 ;; backslash is part of a special entity (like "\alpha") | |
833 (concat string-before "$\\" | |
834 (or (cdar (member (list string-after) org-html-entities)) | |
835 string-after) "$")) | |
836 ((and (not (string-match "^[ \n\t]" string-after)) | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
837 (not (string-match "[ \t]\\'\\|^" string-before))) |
82752 | 838 ;; backslash is inside a word |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
839 (org-export-latex-protect-string |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
840 (concat string-before "\\textbackslash{}" string-after))) |
82752 | 841 ((not (or (equal string-after "") |
842 (string-match "^[ \t\n]" string-after))) | |
843 ;; backslash might escape a character (like \#) or a user TeX | |
844 ;; macro (like \setcounter) | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
845 (org-export-latex-protect-string |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
846 (concat string-before "\\" string-after))) |
82752 | 847 ((and (string-match "^[ \t\n]" string-after) |
848 (string-match "[ \t\n]\\'" string-before)) | |
849 ;; backslash is alone, convert it to $\backslash$ | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
850 (org-export-latex-protect-string |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
851 (concat string-before "\\textbackslash{}" string-after))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
852 (t (org-export-latex-protect-string |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
853 (concat string-before "\\textbackslash{}" string-after))))) |
82752 | 854 |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
855 (defun org-export-latex-keywords (timestamps) |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
856 "Convert special keywords to LaTeX. |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
857 Regexps are those from `org-latex-special-string-regexps'." |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
858 (let ((rg org-latex-special-string-regexps) r) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
859 (while (setq r (pop rg)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
860 (goto-char (point-min)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
861 (while (re-search-forward (eval r) nil t) |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
862 (if (not timestamps) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
863 (replace-match (format "\\\\texttt{%s}" (match-string 0)) t) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
864 (replace-match "")))))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
865 |
82752 | 866 (defun org-export-latex-fixed-width (opt) |
867 "When OPT is non-nil convert fixed-width sections to LaTeX." | |
868 (goto-char (point-min)) | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
869 ;; FIXME the search shouldn't be performed on already converted text |
82752 | 870 (while (re-search-forward "^[ \t]*:" nil t) |
871 (if opt | |
872 (progn (goto-char (match-beginning 0)) | |
873 (insert "\\begin{verbatim}\n") | |
874 (while (looking-at "^\\([ \t]*\\):\\(.*\\)$") | |
875 (replace-match (concat (match-string 1) | |
876 (match-string 2)) t t) | |
877 (forward-line)) | |
878 (insert "\\end{verbatim}\n\n")) | |
879 (progn (goto-char (match-beginning 0)) | |
880 (while (looking-at "^\\([ \t]*\\):\\(.*\\)$") | |
881 (replace-match (concat "%" (match-string 1) | |
882 (match-string 2)) t t) | |
883 (forward-line)))))) | |
884 | |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
885 (defun org-export-latex-lists () |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
886 "Convert lists to LaTeX." |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
887 (goto-char (point-min)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
888 (while (re-search-forward org-export-latex-list-beginning-re nil t) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
889 (beginning-of-line) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
890 (org-export-list-to-latex |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
891 (org-export-latex-parse-list t)))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
892 |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
893 (defun org-export-list-to-generic (list params) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
894 "Convert a LIST parsed through `org-export-latex-parse-list' to other formats. |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
895 |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
896 Valid parameters are |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
897 |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
898 :ustart String to start an unordered list |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
899 :uend String to end an unordered list |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
900 |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
901 :ostart String to start an ordered list |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
902 :oend String to end an ordered list |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
903 |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
904 :splice When set to t, return only list body lines, don't wrap |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
905 them into :[u/o]start and :[u/o]end. Default is nil. |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
906 |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
907 :istart String to start a list item |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
908 :iend String to end a list item |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
909 :isep String to separate items |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
910 :lsep String to separate sublists" |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
911 (interactive) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
912 (let* ((p params) sublist |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
913 (splicep (plist-get p :splice)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
914 (ostart (plist-get p :ostart)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
915 (oend (plist-get p :oend)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
916 (ustart (plist-get p :ustart)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
917 (uend (plist-get p :uend)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
918 (istart (plist-get p :istart)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
919 (iend (plist-get p :iend)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
920 (isep (plist-get p :isep)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
921 (lsep (plist-get p :lsep))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
922 (let ((wrapper |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
923 (cond ((eq (car list) 'ordered) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
924 (concat ostart "\n%s" oend "\n")) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
925 ((eq (car list) 'unordered) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
926 (concat ustart "\n%s" uend "\n")))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
927 rtn) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
928 (while (setq sublist (pop list)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
929 (cond ((symbolp sublist) nil) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
930 ((stringp sublist) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
931 (setq rtn (concat rtn istart sublist iend isep))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
932 (t |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
933 (setq rtn (concat rtn ;; previous list |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
934 lsep ;; list separator |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
935 (org-export-list-to-generic sublist p) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
936 lsep ;; list separator |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
937 ))))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
938 (format wrapper rtn)))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
939 |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
940 (defun org-export-list-to-latex (list) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
941 "Convert LIST into a LaTeX list." |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
942 (insert |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
943 (org-export-list-to-generic |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
944 list '(:splicep nil :ostart "\\begin{enumerate}" :oend "\\end{enumerate}" |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
945 :ustart "\\begin{itemize}" :uend "\\end{itemize}" |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
946 :istart "\\item " :iend "" |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
947 :isep "\n" :lsep "\n")) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
948 ;; Add a trailing \n after list conversion |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
949 "\n")) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
950 |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
951 ;; FIXME Use org-export-highlight-first-table-line ? |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
952 (defun org-export-latex-tables (insert) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
953 "Convert tables to LaTeX and INSERT it." |
82752 | 954 (goto-char (point-min)) |
955 (while (re-search-forward "^\\([ \t]*\\)|" nil t) | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
956 ;; FIXME really need to save-excursion? |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
957 (save-excursion (org-table-align)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
958 (let* ((beg (org-table-begin)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
959 (end (org-table-end)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
960 (raw-table (buffer-substring-no-properties beg end)) |
85554
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
961 fnum fields line lines olines gr colgropen line-fmt align) |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
962 (if org-export-latex-tables-verbatim |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
963 (let* ((tbl (concat "\\begin{verbatim}\n" raw-table |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
964 "\\end{verbatim}\n"))) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
965 (apply 'delete-region (list beg end)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
966 (insert tbl)) |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
967 (progn |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
968 (setq lines (split-string raw-table "\n" t)) |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
969 (apply 'delete-region (list beg end)) |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
970 (when org-export-table-remove-special-lines |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
971 (setq lines (org-table-clean-before-export lines))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
972 ;; make a formatting string to reflect aligment |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
973 (setq olines lines) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
974 (while (and (not line-fmt) (setq line (pop olines))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
975 (unless (string-match "^[ \t]*|-" line) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
976 (setq fields (org-split-string line "[ \t]*|[ \t]*")) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
977 (setq fnum (make-vector (length fields) 0)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
978 (setq line-fmt |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
979 (mapconcat |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
980 (lambda (x) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
981 (setq gr (pop org-table-colgroup-info)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
982 (format "%s%%s%s" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
983 (cond ((eq gr ':start) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
984 (prog1 (if colgropen "|" "") |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
985 (setq colgropen t))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
986 ((eq gr ':startend) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
987 (prog1 (if colgropen "|" "|") |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
988 (setq colgropen nil))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
989 (t "")) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
990 (if (memq gr '(:end :startend)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
991 (progn (setq colgropen nil) "|") |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
992 ""))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
993 fnum "")))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
994 ;; maybe remove the first and last "|" |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
995 (when (string-match "^\\(|\\)?\\(.+\\)|$" line-fmt) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
996 (setq line-fmt (match-string 2 line-fmt))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
997 ;; format alignment |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
998 (setq align (apply 'format |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
999 (cons line-fmt |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1000 (mapcar (lambda (x) (if x "r" "l")) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1001 org-table-last-alignment)))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1002 ;; prepare the table to send to orgtbl-to-latex |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1003 (setq lines |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1004 (mapcar |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1005 (lambda(elem) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1006 (or (and (string-match "[ \t]*|-+" elem) 'hline) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1007 (split-string (org-trim elem) "|" t))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1008 lines)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1009 (when insert |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1010 (insert (orgtbl-to-latex |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1011 lines `(:tstart ,(concat "\\begin{tabular}{" align "}"))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1012 "\n\n"))))))) |
82752 | 1013 |
1014 (defun org-export-latex-fontify () | |
1015 "Convert fontification to LaTeX." | |
1016 (goto-char (point-min)) | |
1017 (while (re-search-forward org-emph-re nil t) | |
1018 ;; The match goes one char after the *string* | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1019 (let ((emph (assoc (match-string 3) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1020 org-export-latex-emphasis-alist)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1021 rpl) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1022 (unless (get-text-property (1- (point)) 'org-protected) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1023 (setq rpl (concat (match-string 1) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1024 (format (org-export-latex-protect-char-in-string |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1025 '("\\" "{" "}") (cadr emph)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1026 (match-string 4)) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1027 (match-string 5))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1028 (if (caddr emph) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1029 (setq rpl (org-export-latex-protect-string rpl))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1030 (replace-match rpl t t))) |
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1031 (backward-char))) |
82752 | 1032 |
1033 (defun org-export-latex-links () | |
1034 ;; Make sure to use the LaTeX hyperref and graphicx package | |
1035 ;; or send some warnings. | |
1036 "Convert links to LaTeX." | |
1037 (goto-char (point-min)) | |
1038 (while (re-search-forward org-bracket-link-analytic-regexp nil t) | |
1039 (org-if-unprotected | |
1040 (goto-char (match-beginning 0)) | |
1041 (let* ((re-radio org-latex-all-targets-regexp) | |
1042 (remove (list (match-beginning 0) (match-end 0))) | |
1043 (type (match-string 2)) | |
1044 (raw-path (match-string 3)) | |
1045 (full-raw-path (concat (match-string 1) raw-path)) | |
1046 (desc (match-string 5)) | |
1047 imgp radiop | |
1048 ;; define the path of the link | |
1049 (path (cond | |
1050 ((member type '("http" "https" "ftp")) | |
1051 (concat type ":" raw-path)) | |
1052 ((and re-radio (string-match re-radio raw-path)) | |
1053 (setq radiop t)) | |
1054 ((equal type "mailto") | |
1055 (concat type ":" raw-path)) | |
1056 ((equal type "file") | |
1057 (if (and (or (org-file-image-p (expand-file-name raw-path)) | |
1058 (string-match "\\.eps$" raw-path)) | |
1059 (equal desc full-raw-path)) | |
1060 (setq imgp t) | |
1061 (progn (when (string-match "\\(.+\\)::.+" raw-path) | |
1062 (setq raw-path (match-string 1 raw-path))) | |
1063 (if (file-exists-p raw-path) | |
1064 (concat type "://" (expand-file-name raw-path)) | |
1065 (concat type "://" (org-export-directory | |
1066 :LaTeX org-latex-options-plist) | |
1067 raw-path)))))))) | |
1068 ;; process with link inserting | |
1069 (apply 'delete-region remove) | |
1070 (cond ((and imgp (plist-get org-latex-options-plist :inline-images)) | |
1071 (insert (format "\\includegraphics[%s]{%s}" | |
1072 ;; image option should be set be a comment line | |
1073 org-export-latex-image-default-option | |
1074 (expand-file-name raw-path)))) | |
1075 ;; FIXME: what about caption? image properties? | |
1076 (radiop (insert (format "\\hyperref[%s]{%s}" raw-path desc))) | |
1077 (path (insert (format "\\href{%s}{%s}" path desc))) | |
1078 (t (insert "\\texttt{" desc "}"))))))) | |
1079 | |
86879
86f143f19d08
* textmodes/org-export-latex.el (org-export-latex-cleaned-string):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85749
diff
changeset
|
1080 (defun org-export-latex-cleaned-string (&optional commentsp) |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
1081 ;; FIXME remove commentsp call in org.el and here |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
1082 "Clean stuff in the LaTeX export." |
82752 | 1083 |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1084 ;; Preserve line breaks |
82752 | 1085 (goto-char (point-min)) |
1086 (while (re-search-forward "\\\\\\\\" nil t) | |
1087 (add-text-properties (match-beginning 0) (match-end 0) | |
1088 '(org-protected t))) | |
1089 | |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
1090 ;; Convert LaTeX to \LaTeX{} |
82752 | 1091 (goto-char (point-min)) |
1092 (let ((case-fold-search nil) rpl) | |
1093 (while (re-search-forward "\\([^+_]\\)LaTeX" nil t) | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1094 (replace-match (org-export-latex-protect-string |
82752 | 1095 (concat (match-string 1) "\\LaTeX{}")) t t))) |
1096 | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1097 ;; Convert horizontal rules |
82752 | 1098 (goto-char (point-min)) |
1099 (while (re-search-forward "^----+.$" nil t) | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1100 (replace-match (org-export-latex-protect-string "\\hrule") t t)) |
82752 | 1101 |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1102 ;; Protect LaTeX \commands{...} |
82752 | 1103 (goto-char (point-min)) |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1104 (while (re-search-forward "\\\\[a-zA-Z]+\\(?:\\[.*\\]\\)?{.*}" nil t) |
82752 | 1105 (add-text-properties (match-beginning 0) (match-end 0) |
1106 '(org-protected t))) | |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
1107 |
82752 | 1108 ;; Replace radio links |
1109 (goto-char (point-min)) | |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
1110 (while (re-search-forward |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
1111 (concat "<<<?" org-latex-all-targets-regexp |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
1112 ">>>?\\((INVISIBLE)\\)?") nil t) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
1113 (replace-match |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1114 (org-export-latex-protect-string |
84933
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
1115 (format "\\label{%s}%s"(match-string 1) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
1116 (if (match-string 2) "" (match-string 1)))) t t)) |
d6e2d9d9924a
2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents:
84394
diff
changeset
|
1117 |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1118 ;; Delete @<...> constructs |
82752 | 1119 (goto-char (point-min)) |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1120 ;; Thanks to Daniel Clemente for this regexp |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1121 (while (re-search-forward "@<\\(?:[^\"\n]\\|\".*\"\\)*?>" nil t) |
82752 | 1122 (replace-match "")) |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1123 |
82752 | 1124 ;; When converting to LaTeX, replace footnotes |
1125 ;; FIXME: don't protect footnotes from conversion | |
1126 (when (plist-get org-latex-options-plist :footnotes) | |
1127 (goto-char (point-min)) | |
1128 (while (re-search-forward "\\[[0-9]+\\]" nil t) | |
1129 (when (save-match-data | |
1130 (save-excursion (beginning-of-line) | |
85153
c3969e15712b
Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents:
84933
diff
changeset
|
1131 (looking-at "[^:|#]"))) |
82752 | 1132 (let ((foot-beg (match-beginning 0)) |
1133 (foot-end (match-end 0)) | |
1134 (foot-prefix (match-string 0)) | |
1135 footnote footnote-rpl) | |
1136 (when (and (re-search-forward (regexp-quote foot-prefix) nil t)) | |
1137 (replace-match "") | |
1138 (let ((end (save-excursion | |
85554
5b20f92e9f29
Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents:
85156
diff
changeset
|
1139 (if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t) |
82752 | 1140 (match-beginning 0) (point-max))))) |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1141 (setq footnote |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1142 (concat |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1143 (org-trim (buffer-substring (point) end)) |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1144 ;; FIXME stupid workaround for cases where |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1145 ;; `org-bracket-link-analytic-regexp' matches |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1146 ;; }. as part of the link. |
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1147 " ")) |
82752 | 1148 (delete-region (point) end))) |
1149 (goto-char foot-beg) | |
1150 (delete-region foot-beg foot-end) | |
1151 (setq footnote-rpl (format "\\footnote{%s}" footnote)) | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1152 (add-text-properties 0 10 '(org-protected t) footnote-rpl) |
82752 | 1153 (add-text-properties (1- (length footnote-rpl)) |
1154 (length footnote-rpl) | |
1155 '(org-protected t) footnote-rpl) | |
1156 (insert footnote-rpl)))) | |
1157 | |
1158 ;; Replace footnote section tag for LaTeX | |
1159 (goto-char (point-min)) | |
1160 (while (re-search-forward | |
1161 (concat "^" footnote-section-tag-regexp) nil t) | |
84384
a32093d94b4a
Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents:
83725
diff
changeset
|
1162 (replace-match "")))) |
82752 | 1163 |
1164 (provide 'org-export-latex) | |
1165 | |
84394
380656116258
* textmodes/org-export-latex.el: arch-tag restored.
Carsten Dominik <dominik@science.uva.nl>
parents:
84384
diff
changeset
|
1166 ;; arch-tag: 23c2b87d-da04-4c2d-ad2d-1eb6487bc3ad |
82752 | 1167 ;;; org-export-latex.el ends here |