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