1 ;;; org-latex.el --- LaTeX exporter for org-mode
3 ;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
5 ;; Emacs Lisp Archive Entry
6 ;; Filename: org-latex.el
8 ;; Author: Bastien Guerry <bzg AT altern DOT org>
9 ;; Maintainer: Carsten Dominik <carsten.dominik AT gmail DOT com>
10 ;; Keywords: org, wp, tex
11 ;; Description: Converts an org-mode buffer into LaTeX
13 ;; This file is part of GNU Emacs.
15 ;; GNU Emacs is free software: you can redistribute it and/or modify
16 ;; it under the terms of the GNU General Public License as published by
17 ;; the Free Software Foundation, either version 3 of the License, or
18 ;; (at your option) any later version.
20 ;; GNU Emacs is distributed in the hope that it will be useful,
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;; GNU General Public License for more details.
25 ;; You should have received a copy of the GNU General Public License
26 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
30 ;; This library implements a LaTeX exporter for org-mode.
32 ;; It is part of Org and will be autoloaded
34 ;; The interactive functions are similar to those of the HTML exporter:
36 ;; M-x `org-export-as-latex'
37 ;; M-x `org-export-as-pdf'
38 ;; M-x `org-export-as-pdf-and-open'
39 ;; M-x `org-export-as-latex-batch'
40 ;; M-x `org-export-as-latex-to-buffer'
41 ;; M-x `org-export-region-as-latex'
42 ;; M-x `org-replace-region-by-latex'
55 (defvar org-export-latex-class nil
)
56 (defvar org-export-latex-header nil
)
57 (defvar org-export-latex-append-header nil
)
58 (defvar org-export-latex-options-plist nil
)
59 (defvar org-export-latex-todo-keywords-1 nil
)
60 (defvar org-export-latex-complex-heading-re nil
)
61 (defvar org-export-latex-not-done-keywords nil
)
62 (defvar org-export-latex-done-keywords nil
)
63 (defvar org-export-latex-display-custom-times nil
)
64 (defvar org-export-latex-all-targets-re nil
)
65 (defvar org-export-latex-add-level
0)
66 (defvar org-export-latex-sectioning
"")
67 (defvar org-export-latex-sectioning-depth
0)
68 (defvar org-export-latex-special-keyword-regexp
69 (concat "\\<\\(" org-scheduled-string
"\\|"
70 org-deadline-string
"\\|"
71 org-closed-string
"\\)")
72 "Regexp matching special time planning keywords plus the time after it.")
74 (defvar latexp
) ; dynamically scoped from org.el
75 (defvar re-quote
) ; dynamically scoped from org.el
76 (defvar commentsp
) ; dynamically scoped from org.el
80 (defgroup org-export-latex nil
81 "Options for exporting Org-mode files to LaTeX."
82 :tag
"Org Export LaTeX"
85 (defcustom org-export-latex-default-class
"article"
86 "The default LaTeX class."
87 :group
'org-export-latex
88 :type
'(string :tag
"LaTeX class"))
90 (defcustom org-export-latex-classes
92 "\\documentclass[11pt]{article}
93 \\usepackage[utf8]{inputenc}
94 \\usepackage[T1]{fontenc}
95 \\usepackage{graphicx}
96 \\usepackage{longtable}
100 \\usepackage{hyperref}"
101 ("\\section{%s}" .
"\\section*{%s}")
102 ("\\subsection{%s}" .
"\\subsection*{%s}")
103 ("\\subsubsection{%s}" .
"\\subsubsection*{%s}")
104 ("\\paragraph{%s}" .
"\\paragraph*{%s}")
105 ("\\subparagraph{%s}" .
"\\subparagraph*{%s}"))
107 "\\documentclass[11pt]{report}
108 \\usepackage[utf8]{inputenc}
109 \\usepackage[T1]{fontenc}
110 \\usepackage{graphicx}
111 \\usepackage{longtable}
113 \\usepackage{wrapfig}
115 \\usepackage{hyperref}"
116 ("\\part{%s}" .
"\\part*{%s}")
117 ("\\chapter{%s}" .
"\\chapter*{%s}")
118 ("\\section{%s}" .
"\\section*{%s}")
119 ("\\subsection{%s}" .
"\\subsection*{%s}")
120 ("\\subsubsection{%s}" .
"\\subsubsection*{%s}"))
122 "\\documentclass[11pt]{book}
123 \\usepackage[utf8]{inputenc}
124 \\usepackage[T1]{fontenc}
125 \\usepackage{graphicx}
126 \\usepackage{longtable}
128 \\usepackage{wrapfig}
130 \\usepackage{hyperref}"
131 ("\\part{%s}" .
"\\part*{%s}")
132 ("\\chapter{%s}" .
"\\chapter*{%s}")
133 ("\\section{%s}" .
"\\section*{%s}")
134 ("\\subsection{%s}" .
"\\subsection*{%s}")
135 ("\\subsubsection{%s}" .
"\\subsubsection*{%s}")))
136 "Alist of LaTeX classes and associated header and structure.
137 If #+LaTeX_CLASS is set in the buffer, use its value and the
138 associated information. Here is the structure of each cell:
142 (numbered-section . unnumbered-section\)
145 A %s formatter is mandatory in each section string and will be
146 replaced by the title of the section.
148 Instead of a cons cell (numbered . unnumbered), you can also provide a list
151 (numbered-open numbered-close)
155 (numbered-open numbered-close unnumbered-open unnumbered-close)
157 providing opening and closing strings for an environment that should
158 represent the document section. The opening clause should have a %s
159 to represent the section title."
160 :group
'org-export-latex
162 (list (string :tag
"LaTeX class")
163 (string :tag
"LaTeX header")
164 (repeat :tag
"Levels" :inline t
167 (string :tag
"numbered")
168 (string :tag
"unnumbered)"))
169 (list :tag
"Environment"
170 (string :tag
"Opening (numbered) ")
171 (string :tag
"Closing (numbered) ")
172 (string :tag
"Opening (unnumbered)")
173 (string :tag
"Closing (unnumbered)")))))))
175 (defcustom org-export-latex-emphasis-alist
176 '(("*" "\\textbf{%s}" nil
)
177 ("/" "\\emph{%s}" nil
)
178 ("_" "\\underline{%s}" nil
)
182 "Alist of LaTeX expressions to convert emphasis fontifiers.
183 Each element of the list is a list of three elements.
184 The first element is the character used as a marker for fontification.
185 The second element is a formatting string to wrap fontified text with.
186 If it is \"\\verb\", Org will automatically select a deimiter
187 character that is not in the string.
188 The third element decides whether to protect converted text from other
190 :group
'org-export-latex
193 (defcustom org-export-latex-title-command
"\\maketitle"
194 "The command used to insert the title just after \\begin{document}.
195 If this string contains the formatting specification \"%s\" then
196 it will be used as a formatting string, passing the title as an
198 :group
'org-export-latex
201 (defcustom org-export-latex-import-inbuffer-stuff nil
202 "Non-nil means define TeX macros for Org's inbuffer definitions.
203 For example \orgTITLE for #+TITLE."
204 :group
'org-export-latex
207 (defcustom org-export-latex-date-format
209 "Format string for \\date{...}."
210 :group
'org-export-latex
213 (defcustom org-export-latex-todo-keyword-markup
"\\textbf{%s}"
214 "Markup for TODO keywords, as a printf format.
215 This can be a single format for all keywords, a cons cell with separate
216 formats for not-done and done states, or an association list with setup
217 for individual keywords. If a keyword shows up for which there is no
218 markup defined, the first one in the association list will be used."
219 :group
'org-export-latex
221 (string :tag
"Default")
222 (cons :tag
"Distinguish undone and done"
223 (string :tag
"Not-DONE states")
224 (string :tag
"DONE states"))
225 (repeat :tag
"Per keyword markup"
227 (string :tag
"Keyword")
228 (string :tag
"Markup")))))
230 (defcustom org-export-latex-timestamp-markup
"\\textit{%s}"
231 "A printf format string to be applied to time stamps."
232 :group
'org-export-latex
235 (defcustom org-export-latex-timestamp-keyword-markup
"\\texttt{%s}"
236 "A printf format string to be applied to time stamps."
237 :group
'org-export-latex
240 (defcustom org-export-latex-tables-verbatim nil
241 "When non-nil, tables are exported verbatim."
242 :group
'org-export-latex
245 (defcustom org-export-latex-tables-centered t
246 "When non-nil, tables are exported in a center environment."
247 :group
'org-export-latex
250 (defcustom org-export-latex-tables-column-borders nil
251 "When non-nil, grouping columns can cause outer vertical lines in tables.
252 When nil, grouping causes only separation lines between groups."
253 :group
'org-export-latex
256 (defcustom org-export-latex-packages-alist nil
257 "Alist of packages to be inserted in the header.
258 Each cell is of the format \( \"option\" . \"package\" \)."
259 :group
'org-export-latex
262 (string :tag
"option")
263 (string :tag
"package"))))
265 (defcustom org-export-latex-low-levels
'itemize
266 "How to convert sections below the current level of sectioning.
267 This is specified by the `org-export-headline-levels' option or the
268 value of \"H:\" in Org's #+OPTION line.
270 This can be either nil (skip the sections), `description', `itemize',
271 or `enumerate' (convert the sections as the corresponding list type), or
272 a string to be used instead of \\section{%s}. In this latter case,
273 the %s stands here for the inserted headline and is mandatory.
275 It may also be a list of three string to define a user-defined environment
276 that should be used. The first string should be the like
277 \"\\begin{itemize}\", the second should be like \"\\item %s %s\" with up
278 to two occurrences of %s for the title and a lable, respectively. The third
279 string should be like \"\\end{itemize\"."
280 :group
'org-export-latex
281 :type
'(choice (const :tag
"Ignore" nil
)
282 (const :tag
"Convert as descriptive list" description
)
283 (const :tag
"Convert as itemized list" itemize
)
284 (const :tag
"Convert as enumerated list" enumerate
)
285 (list :tag
"User-defined environment"
286 :value
("\\begin{itemize}" "\\end{itemize}" "\\item %s")
287 (string :tag
"Start")
289 (string :tag
"item"))
290 (string :tag
"Use a section string" :value
"\\subparagraph{%s}")))
292 (defcustom org-export-latex-list-parameters
293 '(:cbon
"\\texttt{[X]}" :cboff
"\\texttt{[ ]}")
294 "Parameters for the LaTeX list exporter.
295 These parameters will be passed on to `org-list-to-latex', which in turn
296 will pass them (combined with the LaTeX default list parameters) to
297 `org-list-to-generic'."
298 :group
'org-export-latex
301 (defcustom org-export-latex-verbatim-wrap
302 '("\\begin{verbatim}\n" .
"\\end{verbatim}\n")
303 "Environment to be wrapped around a fixed-width section in LaTeX export.
304 This is a cons with two strings, to be added before and after the
307 Defaults to \\begin{verbatim} and \\end{verbatim}."
308 :group
'org-export-translation
309 :group
'org-export-latex
310 :type
'(cons (string :tag
"Open")
311 (string :tag
"Close")))
313 (defcustom org-export-latex-listings nil
314 "Non-nil means, export source code using the listings package.
315 This package will fontify source code, possibly even with color.
316 If you want to use this, you also need to make LaTeX use the
317 listings package, and if you want to have color, the color
318 package. Just add these to `org-export-latex-packages-alist',
319 for example using customize, or with something like
322 (add-to-list 'org-export-latex-packages-alist '(\"\" \"listings\"))
323 (add-to-list 'org-export-latex-packages-alist '(\"\" \"color\"))"
324 :group
'org-export-latex
327 (defcustom org-export-latex-listings-langs
328 '((emacs-lisp "Lisp") (lisp "Lisp")
331 (perl "Perl") (cperl "Perl") (python "Python") (ruby "Ruby")
332 (html "HTML") (xml "XML")
333 (tex "TeX") (latex "TeX")
334 (shell-script "bash")
336 (ocaml "Caml") (caml "Caml")
338 "Alist mapping languages to their listing language counterpart.
339 The key is a symbol, the major mode symbol without the \"-mode\".
340 The value is the string that should be inserted as the language parameter
341 for the listings package. If the mode name and the listings name are
342 the same, the language does not need an entry in this list - but it does not
343 hurt if it is present."
344 :group
'org-export-latex
347 (symbol :tag
"Major mode ")
348 (string :tag
"Listings language"))))
350 (defcustom org-export-latex-remove-from-headlines
351 '(:todo nil
:priority nil
:tags nil
)
352 "A plist of keywords to remove from headlines. OBSOLETE.
353 Non-nil means remove this keyword type from the headline.
355 Don't remove the keys, just change their values.
357 Obsolete, this variable is no longer used. Use the separate
358 variables `org-export-with-todo-keywords', `org-export-with-priority',
359 and `org-export-with-tags' instead."
361 :group
'org-export-latex
)
363 (defcustom org-export-latex-image-default-option
"width=10em"
364 "Default option for images."
365 :group
'org-export-latex
368 (defcustom org-export-latex-inline-image-extensions
369 '("pdf" "jpeg" "jpg" "png" "ps" "eps")
370 "Extensions of image files that can be inlined into LaTeX.
371 Note that the image extension *actually* allowed depend on the way the
372 LaTeX file is processed. When used with pdflatex, pdf, jpg and png images
373 are OK. When processing through dvi to Postscript, only ps and eps are
374 allowed. The default we use here encompasses both."
375 :group
'org-export-latex
376 :type
'(repeat (string :tag
"Extension")))
378 (defcustom org-export-latex-coding-system nil
379 "Coding system for the exported LaTex file."
380 :group
'org-export-latex
381 :type
'coding-system
)
383 (defgroup org-export-pdf nil
384 "Options for exporting Org-mode files to PDF, via LaTeX."
385 :tag
"Org Export LaTeX"
386 :group
'org-export-latex
389 (defcustom org-latex-to-pdf-process
390 '("pdflatex -interaction nonstopmode %s"
391 "pdflatex -interaction nonstopmode %s")
392 "Commands to process a LaTeX file to a PDF file.
393 This is a list of strings, each of them will be given to the shell
394 as a command. %s in the command will be replaced by the full file name, %b
395 by the file base name (i.e. without extension).
396 The reason why this is a list is that it usually takes several runs of
397 pdflatex, maybe mixed with a call to bibtex. Org does not have a clever
398 mechanism to detect whihc of these commands have to be run to get to a stable
399 result, and it also does not do any error checking.
401 Alternatively, this may be a Lisp function that does the processing, so you
402 could use this to apply the machinery of AUCTeX or the Emacs LaTeX mode.
403 THis function should accept the file name as its single argument."
404 :group
'org-export-latex
405 :type
'(choice (repeat :tag
"Shell command sequence"
406 (string :tag
"Shell command"))
409 (defcustom org-export-pdf-remove-logfiles t
410 "Non-nil means, remove the logfiles produced by PDF production.
411 These are the .aux, .log, .out, and .toc files."
412 :group
'org-export-pdf
417 (defvar org-export-latex-after-blockquotes-hook nil
418 "Hook run during LaTeX export, after blockquote, verse, center are done.")
420 (defvar org-export-latex-final-hook nil
421 "Hook run in the finalized LaTeX buffer.")
423 ;;; Autoload functions:
426 (defun org-export-as-latex-batch ()
427 "Call `org-export-as-latex', may be used in batch processing.
431 --load=$HOME/lib/emacs/org.el
432 --eval \"(setq org-export-headline-levels 2)\"
433 --visit=MyFile --funcall org-export-as-latex-batch"
434 (org-export-as-latex org-export-headline-levels
'hidden
))
437 (defun org-export-as-latex-to-buffer (arg)
438 "Call `org-export-as-latex` with output to a temporary buffer.
439 No file is created. The prefix ARG is passed through to `org-export-as-latex'."
441 (org-export-as-latex arg nil nil
"*Org LaTeX Export*")
442 (when org-export-show-temporary-export-buffer
443 (switch-to-buffer-other-window "*Org LaTeX Export*")))
446 (defun org-replace-region-by-latex (beg end
)
447 "Replace the region from BEG to END with its LaTeX export.
448 It assumes the region has `org-mode' syntax, and then convert it to
449 LaTeX. This can be used in any buffer. For example, you could
450 write an itemized list in `org-mode' syntax in an LaTeX buffer and
451 then use this command to convert it."
454 (save-window-excursion
456 (setq latex
(org-export-region-as-latex
458 (setq reg
(buffer-substring beg end
)
459 buf
(get-buffer-create "*Org tmp*"))
465 (setq latex
(org-export-region-as-latex
466 (point-min) (point-max) t
'string
)))
468 (delete-region beg end
)
472 (defun org-export-region-as-latex (beg end
&optional body-only buffer
)
473 "Convert region from BEG to END in `org-mode' buffer to LaTeX.
474 If prefix arg BODY-ONLY is set, omit file header, footer, and table of
475 contents, and only produce the region of converted text, useful for
476 cut-and-paste operations.
477 If BUFFER is a buffer or a string, use/create that buffer as a target
478 of the converted LaTeX. If BUFFER is the symbol `string', return the
479 produced LaTeX as a string and leave no buffer behind. For example,
480 a Lisp program could call this function in the following way:
482 (setq latex (org-export-region-as-latex beg end t 'string))
484 When called interactively, the output buffer is selected, and shown
485 in a window. A non-interactive call will only return the buffer."
487 (when (interactive-p)
488 (setq buffer
"*Org LaTeX Export*"))
489 (let ((transient-mark-mode t
) (zmacs-regions t
)
491 (setq ext-plist
(plist-put ext-plist
:ignore-subree-p t
))
493 (set-mark (point)) ;; to activate the region
495 (setq rtn
(org-export-as-latex
498 (if (fboundp 'deactivate-mark
) (deactivate-mark))
499 (if (and (interactive-p) (bufferp rtn
))
500 (switch-to-buffer-other-window rtn
)
504 (defun org-export-as-latex (arg &optional hidden ext-plist
505 to-buffer body-only pub-dir
)
506 "Export current buffer to a LaTeX file.
507 If there is an active region, export only the region. The prefix
508 ARG specifies how many levels of the outline should become
509 headlines. The default is 3. Lower levels will be exported
510 depending on `org-export-latex-low-levels'. The default is to
511 convert them as description lists.
512 HIDDEN is obsolete and does nothing.
513 EXT-PLIST is a property list with
514 external parameters overriding org-mode's default settings, but
515 still inferior to file-local settings. When TO-BUFFER is
516 non-nil, create a buffer with that name and export to that
517 buffer. If TO-BUFFER is the symbol `string', don't leave any
518 buffer behind but just return the resulting LaTeX as a string.
519 When BODY-ONLY is set, don't produce the file header and footer,
520 simply return the content of \begin{document}...\end{document},
521 without even the \begin{document} and \end{document} commands.
522 when PUB-DIR is set, use this as the publishing directory."
524 ;; Make sure we have a file name when we need it.
525 (when (and (not (or to-buffer body-only
))
526 (not buffer-file-name
))
527 (if (buffer-base-buffer)
528 (org-set-local 'buffer-file-name
529 (with-current-buffer (buffer-base-buffer)
531 (error "Need a file name to be able to export")))
533 (message "Exporting to LaTeX...")
535 (remove-text-properties (point-min) (point-max)
536 '(:org-license-to-kill nil
)))
537 (org-update-radio-target-regexp)
538 (org-export-latex-set-initial-vars ext-plist arg
)
539 (let* ((wcf (current-window-configuration))
540 (opt-plist org-export-latex-options-plist
)
541 (region-p (org-region-active-p))
542 (rbeg (and region-p
(region-beginning)))
543 (rend (and region-p
(region-end)))
545 (if (plist-get opt-plist
:ignore-subree-p
)
550 (and (org-at-heading-p)
551 (>= (org-end-of-subtree t t
) rend
))))))
552 (opt-plist (setq org-export-opt-plist
554 (org-export-add-subtree-options opt-plist rbeg
)
556 ;; Make sure the variable contains the updated values.
557 (org-export-latex-options-plist opt-plist
)
558 (title (or (and subtree-p
(org-export-get-title-from-subtree))
559 (plist-get opt-plist
:title
)
561 (plist-get opt-plist
:skip-before-1st-heading
))
562 (org-export-grab-title-from-buffer))
563 (file-name-sans-extension
564 (file-name-nondirectory buffer-file-name
))))
565 (filename (concat (file-name-as-directory
567 (org-export-directory :LaTeX ext-plist
)))
568 (file-name-sans-extension
570 (org-entry-get rbeg
"EXPORT_FILE_NAME" t
))
571 (file-name-nondirectory ;sans-extension
574 (filename (if (equal (file-truename filename
)
575 (file-truename buffer-file-name
))
576 (concat filename
".tex")
578 (buffer (if to-buffer
580 ((eq to-buffer
'string
) (get-buffer-create
581 "*Org LaTeX Export*"))
582 (t (get-buffer-create to-buffer
)))
583 (find-file-noselect filename
)))
584 (odd org-odd-levels-only
)
585 (header (org-export-latex-make-header title opt-plist
))
586 (skip (cond (subtree-p nil
)
588 (t (plist-get opt-plist
:skip-before-1st-heading
))))
589 (text (plist-get opt-plist
:text
))
590 (org-export-preprocess-hook
592 `(lambda () (org-set-local 'org-complex-heading-regexp
593 ,org-export-latex-complex-heading-re
))
594 org-export-preprocess-hook
))
595 (first-lines (if skip
"" (org-export-latex-first-lines
602 (if region-p rend
))))
603 (coding-system (and (boundp 'buffer-file-coding-system
)
604 buffer-file-coding-system
))
605 (coding-system-for-write (or org-export-latex-coding-system
607 (save-buffer-coding-system (or org-export-latex-coding-system
609 (region (buffer-substring
610 (if region-p
(region-beginning) (point-min))
611 (if region-p
(region-end) (point-max))))
613 (org-export-preprocess-string
618 :tags
(plist-get opt-plist
:tags
)
619 :priority
(plist-get opt-plist
:priority
)
620 :footnotes
(plist-get opt-plist
:footnotes
)
621 :timestamps
(plist-get opt-plist
:timestamps
)
622 :todo-keywords
(plist-get opt-plist
:todo-keywords
)
623 :add-text
(if (eq to-buffer
'string
) nil text
)
624 :skip-before-1st-heading skip
625 :select-tags
(plist-get opt-plist
:select-tags
)
626 :exclude-tags
(plist-get opt-plist
:exclude-tags
)
627 :LaTeX-fragments nil
)))
631 (org-install-letbind)
633 (and (fboundp 'set-buffer-file-coding-system
)
634 (set-buffer-file-coding-system coding-system-for-write
))
636 ;; insert the header and initial document commands
637 (unless (or (eq to-buffer
'string
) body-only
)
640 ;; insert text found in #+TEXT
641 (when (and text
(not (eq to-buffer
'string
)))
642 (insert (org-export-latex-content
643 text
'(lists tables fixed-width keywords
))
646 ;; insert lines before the first headline
648 (insert first-lines
))
650 ;; export the content of headlines
651 (org-export-latex-global
653 (insert string-for-export
)
654 (goto-char (point-min))
655 (when (re-search-forward "^\\(\\*+\\) " nil t
)
656 (let* ((asters (length (match-string 1)))
657 (level (if odd
(- asters
2) (- asters
1))))
658 (setq org-export-latex-add-level
659 (if odd
(1- (/ (1+ asters
) 2)) (1- asters
)))
660 (org-export-latex-parse-global level odd
)))))
663 (unless body-only
(insert "\n\\end{document}"))
665 ;; Relocate the table of contents
666 (goto-char (point-min))
667 (when (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t
)
668 (goto-char (point-min))
669 (while (re-search-forward "\\\\tableofcontents\\>[ \t]*\n?" nil t
)
671 (goto-char (point-min))
672 (and (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t
)
673 (replace-match "\\tableofcontents" t t
)))
675 (run-hooks 'org-export-latex-final-hook
)
676 (or to-buffer
(save-buffer))
677 (goto-char (point-min))
678 (or (org-export-push-to-kill-ring "LaTeX")
679 (message "Exporting to LaTeX...done"))
681 (if (eq to-buffer
'string
)
682 (prog1 (buffer-substring (point-min) (point-max))
683 (kill-buffer (current-buffer)))
685 (set-window-configuration wcf
))))
688 (defun org-export-as-pdf (arg &optional hidden ext-plist
689 to-buffer body-only pub-dir
)
690 "Export as LaTeX, then process through to PDF."
692 (message "Exporting to PDF...")
693 (let* ((wconfig (current-window-configuration))
694 (lbuf (org-export-as-latex arg hidden ext-plist
695 to-buffer body-only pub-dir
))
696 (file (buffer-file-name lbuf
))
697 (base (file-name-sans-extension (buffer-file-name lbuf
)))
698 (pdffile (concat base
".pdf"))
699 (cmds org-latex-to-pdf-process
)
700 (outbuf (get-buffer-create "*Org PDF LaTeX Output*"))
701 (bibtex-p (with-current-buffer lbuf
703 (goto-char (point-min))
704 (re-search-forward "\\\\bibliography{" nil t
))))
706 (with-current-buffer outbuf
(erase-buffer))
707 (and (file-exists-p pdffile
) (delete-file pdffile
))
708 (message "Processing LaTeX file...")
709 (if (and cmds
(symbolp cmds
))
712 (setq cmd
(pop cmds
))
713 (while (string-match "%b" cmd
)
714 (setq cmd
(replace-match
716 (shell-quote-argument base
))
718 (while (string-match "%s" cmd
)
719 (setq cmd
(replace-match
721 (shell-quote-argument file
))
723 (shell-command cmd outbuf outbuf
)))
724 (message "Processing LaTeX file...done")
725 (if (not (file-exists-p pdffile
))
726 (error "PDF file was not produced")
727 (set-window-configuration wconfig
)
728 (when org-export-pdf-remove-logfiles
729 (dolist (ext '("aux" "log" "out" "toc"))
730 (setq file
(concat base
"." ext
))
731 (and (file-exists-p file
) (delete-file file
))))
732 (message "Exporting to PDF...done")
736 (defun org-export-as-pdf-and-open (arg)
737 "Export as LaTeX, then process through to PDF, and open."
739 (let ((pdffile (org-export-as-pdf arg
)))
741 (org-open-file pdffile
)
742 (error "PDF file was not produced"))))
744 ;;; Parsing functions:
746 (defun org-export-latex-parse-global (level odd
)
747 "Parse the current buffer recursively, starting at LEVEL.
748 If ODD is non-nil, assume the buffer only contains odd sections.
749 Return a list reflecting the document structure."
751 (goto-char (point-min))
752 (let* ((cnt 0) output
753 (depth org-export-latex-sectioning-depth
))
754 (while (re-search-forward
755 (concat "^\\(\\(?:\\*\\)\\{"
756 (number-to-string (+ (if odd
2 1) level
))
758 ;; make sure that there is no upper heading
763 (concat "^\\(\\(?:\\*\\)\\{"
764 (number-to-string level
)
765 "\\}\\) \\(.*\\)$") nil t
)))) t
)
767 (let* ((pos (match-beginning 0))
768 (heading (match-string 2))
769 (nlevel (if odd
(/ (+ 3 level
) 2) (1+ level
))))
774 (if (re-search-forward
775 (concat "^\\(\\(?:\\*\\)\\{"
776 (number-to-string (+ (if odd
2 1) level
))
777 "\\}\\) \\(.*\\)$") nil t
)
780 (goto-char (point-min))
788 `(heading .
,heading
)
789 `(content .
,(org-export-latex-parse-content))
790 `(subcontent .
,(org-export-latex-parse-subcontent
795 (defun org-export-latex-parse-content ()
796 "Extract the content of a section."
798 (end (if (re-search-forward "^\\(\\*\\)+ .*$" nil t
)
799 (progn (beginning-of-line) (point))
801 (buffer-substring beg end
)))
803 (defun org-export-latex-parse-subcontent (level odd
)
804 "Extract the subcontent of a section at LEVEL.
805 If ODD Is non-nil, assume subcontent only contains odd sections."
806 (if (not (re-search-forward
807 (concat "^\\(\\(?:\\*\\)\\{"
808 (number-to-string (+ (if odd
4 2) level
))
811 nil
; subcontent is nil
812 (org-export-latex-parse-global (+ (if odd
2 1) level
) odd
)))
814 ;;; Rendering functions:
815 (defun org-export-latex-global (content)
816 "Export CONTENT to LaTeX.
817 CONTENT is an element of the list produced by
818 `org-export-latex-parse-global'."
819 (if (eq (car content
) 'subcontent
)
820 (mapc 'org-export-latex-sub
(cdr content
))
821 (org-export-latex-sub (car content
))))
823 (defun org-export-latex-sub (subcontent)
824 "Export the list SUBCONTENT to LaTeX.
825 SUBCONTENT is an alist containing information about the headline
827 (let ((num (plist-get org-export-latex-options-plist
:section-numbers
)))
828 (mapc (lambda(x) (org-export-latex-subcontent x num
)) subcontent
)))
830 (defun org-export-latex-subcontent (subcontent num
)
831 "Export each cell of SUBCONTENT to LaTeX.
832 If NUM, export sections as numerical sections."
833 (let* ((heading (org-export-latex-fontify-headline
834 (cdr (assoc 'heading subcontent
))))
835 (level (- (cdr (assoc 'level subcontent
))
836 org-export-latex-add-level
))
837 (occur (number-to-string (cdr (assoc 'occur subcontent
))))
838 (content (cdr (assoc 'content subcontent
)))
839 (subcontent (cadr (assoc 'subcontent subcontent
)))
840 (label (org-get-text-property-any 0 'target heading
))
841 (label-list (cons label
(cdr (assoc label
842 org-export-target-aliases
)))))
845 ((<= level org-export-latex-sectioning-depth
)
846 (let* ((sec (nth (1- level
) org-export-latex-sectioning
))
848 (if (consp (cdr sec
))
849 (setq start
(nth (if num
0 2) sec
)
850 end
(nth (if num
1 3) sec
))
851 (setq start
(if num
(car sec
) (cdr sec
))))
852 (insert (format start heading
) "\n")
854 (insert (mapconcat (lambda (l) (format "\\label{%s}" l
))
855 label-list
"\n") "\n"))
856 (insert (org-export-latex-content content
))
857 (cond ((stringp subcontent
) (insert subcontent
))
858 ((listp subcontent
) (org-export-latex-sub subcontent
)))
859 (if end
(insert end
"\n"))))
860 ;; At a level under the hl option: we can drop this subsection
861 ((> level org-export-latex-sectioning-depth
)
862 (cond ((eq org-export-latex-low-levels
'description
)
863 (if (string-match "% ends low level$"
864 (buffer-substring (point-at-bol 0) (point)))
865 (delete-region (point-at-bol 0) (point))
866 (insert "\\begin{description}\n"))
867 (insert (format "\n\\item[%s]%s~\n\n"
869 (if label
(format "\\label{%s}" label
) "")))
870 (insert (org-export-latex-content content
))
871 (cond ((stringp subcontent
) (insert subcontent
))
872 ((listp subcontent
) (org-export-latex-sub subcontent
)))
873 (insert "\\end{description} % ends low level\n"))
874 ((memq org-export-latex-low-levels
'(itemize enumerate
))
875 (if (string-match "% ends low level$"
876 (buffer-substring (point-at-bol 0) (point)))
877 (delete-region (point-at-bol 0) (point))
878 (insert (format "\\begin{%s}\n"
879 (symbol-name org-export-latex-low-levels
))))
880 (insert (format "\n\\item %s\\\\\n%s\n"
882 (if label
(format "\\label{%s}" label
) "")))
883 (insert (org-export-latex-content content
))
884 (cond ((stringp subcontent
) (insert subcontent
))
885 ((listp subcontent
) (org-export-latex-sub subcontent
)))
886 (insert (format "\\end{%s} %% ends low level\n"
887 (symbol-name org-export-latex-low-levels
))))
889 ((listp org-export-latex-low-levels
)
890 (if (string-match "% ends low level$"
891 (buffer-substring (point-at-bol 0) (point)))
892 (delete-region (point-at-bol 0) (point))
893 (insert (car org-export-latex-low-levels
) "\n"))
894 (insert (format (nth 2 org-export-latex-low-levels
)
896 (if label
(format "\\label{%s}" label
) "")))
897 (insert (org-export-latex-content content
))
898 (cond ((stringp subcontent
) (insert subcontent
))
899 ((listp subcontent
) (org-export-latex-sub subcontent
)))
900 (insert (nth 1 org-export-latex-low-levels
)
901 " %% ends low level\n"))
903 ((stringp org-export-latex-low-levels
)
904 (insert (format org-export-latex-low-levels heading
) "\n")
905 (when label
(insert (format "\\label{%s}\n" label
)))
906 (insert (org-export-latex-content content
))
907 (cond ((stringp subcontent
) (insert subcontent
))
908 ((listp subcontent
) (org-export-latex-sub subcontent
)))))))))
910 ;;; Exporting internals:
911 (defun org-export-latex-set-initial-vars (ext-plist level
)
912 "Store org local variables required for LaTeX export.
913 EXT-PLIST is an optional additional plist.
914 LEVEL indicates the default depth for export."
915 (setq org-export-latex-todo-keywords-1 org-todo-keywords-1
916 org-export-latex-done-keywords org-done-keywords
917 org-export-latex-not-done-keywords org-not-done-keywords
918 org-export-latex-complex-heading-re org-complex-heading-regexp
919 org-export-latex-display-custom-times org-display-custom-times
920 org-export-latex-all-targets-re
921 (org-make-target-link-regexp (org-all-targets))
922 org-export-latex-options-plist
923 (org-combine-plists (org-default-export-plist) ext-plist
924 (org-infile-export-plist))
925 org-export-latex-class
926 (or (and (org-region-active-p)
928 (goto-char (region-beginning))
929 (and (looking-at org-complex-heading-regexp
)
930 (org-entry-get nil
"LaTeX_CLASS" 'selective
))))
934 (goto-char (point-min))
935 (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\([a-zA-Z]+\\)" nil t
)
937 (plist-get org-export-latex-options-plist
:latex-class
)
938 org-export-latex-default-class
)
939 org-export-latex-class
940 (or (car (assoc org-export-latex-class org-export-latex-classes
))
941 (error "No definition for class `%s' in `org-export-latex-classes'"
942 org-export-latex-class
))
943 org-export-latex-header
944 (cadr (assoc org-export-latex-class org-export-latex-classes
))
945 org-export-latex-sectioning
946 (cddr (assoc org-export-latex-class org-export-latex-classes
))
947 org-export-latex-sectioning-depth
950 (plist-get org-export-latex-options-plist
:headline-levels
))
951 (sec-depth (length org-export-latex-sectioning
)))
952 (if (> hl-levels sec-depth
) sec-depth hl-levels
)))))
954 (defun org-export-latex-make-header (title opt-plist
)
955 "Make the LaTeX header and return it as a string.
956 TITLE is the current title from the buffer or region.
957 OPT-PLIST is the options plist for current buffer."
958 (let ((toc (plist-get opt-plist
:table-of-contents
))
959 (author (plist-get opt-plist
:author
)))
961 (if (plist-get opt-plist
:time-stamp-file
)
962 (format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
963 ;; insert LaTeX custom header
964 (org-export-apply-macros-in-string org-export-latex-header
)
966 ;; insert information on LaTeX packages
967 (when org-export-latex-packages-alist
968 (mapconcat (lambda(p)
969 (if (equal "" (car p
))
970 (format "\\usepackage{%s}" (cadr p
))
971 (format "\\usepackage[%s]{%s}"
973 org-export-latex-packages-alist
"\n"))
974 ;; insert additional commands in the header
975 (org-export-apply-macros-in-string
976 (plist-get opt-plist
:latex-header-extra
))
977 (org-export-apply-macros-in-string org-export-latex-append-header
)
982 (org-export-latex-content
983 title
'(lists tables fixed-width keywords
)))
984 ;; insert author info
985 (if (plist-get opt-plist
:author-info
)
986 (format "\\author{%s}\n"
987 (org-export-latex-fontify-headline (or author user-full-name
)))
988 (format "%%\\author{%s}\n"
989 (or author user-full-name
)))
991 (format "\\date{%s}\n"
993 (or (plist-get opt-plist
:date
)
994 org-export-latex-date-format
)))
995 ;; beginning of the document
996 "\n\\begin{document}\n\n"
997 ;; insert the title command
998 (when (string-match "\\S-" title
)
999 (if (string-match "%s" org-export-latex-title-command
)
1000 (format org-export-latex-title-command title
)
1001 org-export-latex-title-command
))
1003 ;; table of contents
1004 (when (and org-export-with-toc
1005 (plist-get opt-plist
:section-numbers
))
1006 (cond ((numberp toc
)
1007 (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n"
1008 (min toc
(plist-get opt-plist
:headline-levels
))))
1009 (toc (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n"
1010 (plist-get opt-plist
:headline-levels
)))))
1011 (when (plist-get opt-plist
:preserve-breaks
)
1014 (defun org-export-latex-first-lines (opt-plist &optional beg end
)
1015 "Export the first lines before first headline.
1016 If BEG is non-nil, it is the beginning of the region.
1017 If END is non-nil, it is the end of the region."
1019 (goto-char (or beg
(point-min)))
1021 (end (if (re-search-forward "^\\*+ " end t
)
1022 (goto-char (match-beginning 0))
1023 (goto-char (or end
(point-max))))))
1025 (org-export-latex-content
1026 (org-export-preprocess-string
1027 (buffer-substring pt end
)
1032 :skip-before-1st-heading nil
1033 :LaTeX-fragments nil
1034 :timestamps
(plist-get opt-plist
:timestamps
)
1035 :footnotes
(plist-get opt-plist
:footnotes
)))
1037 (add-text-properties pt
(max pt
(1- end
))
1038 '(:org-license-to-kill t
)))))))
1040 (defvar org-export-latex-header-defs nil
1041 "The header definitions that might be used in the LaTeX body.")
1042 (defvar org-export-latex-header-defs-re nil
1043 "The header definitions that might be used in the LaTeX body.")
1045 (defun org-export-latex-content (content &optional exclude-list
)
1046 "Convert CONTENT string to LaTeX.
1047 Don't perform conversions that are in EXCLUDE-LIST. Recognized
1048 conversion types are: quotation-marks, emphasis, sub-superscript,
1049 links, keywords, lists, tables, fixed-width"
1052 (unless (memq 'timestamps exclude-list
)
1053 (org-export-latex-time-stamps))
1054 (unless (memq 'quotation-marks exclude-list
)
1055 (org-export-latex-quotation-marks))
1056 (unless (memq 'emphasis exclude-list
)
1057 (when (plist-get org-export-latex-options-plist
:emphasize
)
1058 (org-export-latex-fontify)))
1059 (unless (memq 'sub-superscript exclude-list
)
1060 (org-export-latex-special-chars
1061 (plist-get org-export-latex-options-plist
:sub-superscript
)))
1062 (unless (memq 'links exclude-list
)
1063 (org-export-latex-links))
1064 (unless (memq 'keywords exclude-list
)
1065 (org-export-latex-keywords))
1066 (unless (memq 'lists exclude-list
)
1067 (org-export-latex-lists))
1068 (unless (memq 'tables exclude-list
)
1069 (org-export-latex-tables
1070 (plist-get org-export-latex-options-plist
:tables
)))
1071 (unless (memq 'fixed-width exclude-list
)
1072 (org-export-latex-fixed-width
1073 (plist-get org-export-latex-options-plist
:fixed-width
)))
1075 (buffer-substring (point-min) (point-max))))
1077 (defun org-export-latex-protect-string (s)
1078 "Add the org-protected property to string S."
1079 (add-text-properties 0 (length s
) '(org-protected t
) s
) s
)
1081 (defun org-export-latex-protect-char-in-string (char-list string
)
1082 "Add org-protected text-property to char from CHAR-LIST in STRING."
1086 (goto-char (point-min))
1087 (while (re-search-forward (regexp-opt char-list
) nil t
)
1088 (add-text-properties (match-beginning 0)
1089 (match-end 0) '(org-protected t
)))
1092 (defun org-export-latex-keywords-maybe (&optional remove-list
)
1093 "Maybe remove keywords depending on rules in REMOVE-LIST."
1094 (goto-char (point-min))
1095 (let ((re-todo (mapconcat 'identity org-export-latex-todo-keywords-1
"\\|"))
1096 (case-fold-search nil
)
1097 (todo-markup org-export-latex-todo-keyword-markup
)
1099 ;; convert TODO keywords
1100 (when (re-search-forward (concat "^\\(" re-todo
"\\)") nil t
)
1101 (if (plist-get remove-list
:todo
)
1104 ((stringp todo-markup
) todo-markup
)
1105 ((and (consp todo-markup
) (stringp (car todo-markup
)))
1106 (if (member (match-string 1) org-export-latex-done-keywords
)
1107 (cdr todo-markup
) (car todo-markup
)))
1108 (t (cdr (or (assoc (match-string 1) todo-markup
)
1109 (car todo-markup
))))))
1110 (replace-match (format fmt
(match-string 1)) t t
)))
1111 ;; convert priority string
1112 (when (re-search-forward "\\[\\\\#.\\]" nil t
)
1113 (if (plist-get remove-list
:priority
)
1115 (replace-match (format "\\textbf{%s}" (match-string 0)) t t
)))
1117 (when (re-search-forward "\\(:[a-zA-Z0-9_@]+\\)+:" nil t
)
1118 (if (or (not org-export-with-tags
)
1119 (plist-get remove-list
:tags
))
1122 (org-export-latex-protect-string
1123 (format "\\textbf{%s}"
1125 (replace-regexp-in-string
1126 "_" "\\\\_" (match-string 0)))))
1129 (defun org-export-latex-fontify-headline (string)
1130 "Fontify special words in STRING."
1132 ;; FIXME: org-inside-LaTeX-fragment-p doesn't work when the $...$ is at
1133 ;; the beginning of the buffer - inserting "\n" is safe here though.
1134 (insert "\n" string
)
1135 (goto-char (point-min))
1136 (let ((re (concat "\\\\[a-zA-Z]+\\(?:"
1139 (org-create-multibrace-regexp "{" "}" 3))))
1140 (while (re-search-forward re nil t
)
1141 (unless (save-excursion (goto-char (match-beginning 0))
1142 (equal (char-after (point-at-bol)) ?
#))
1143 (add-text-properties (match-beginning 0) (match-end 0)
1144 '(org-protected t
)))))
1145 (when (plist-get org-export-latex-options-plist
:emphasize
)
1146 (org-export-latex-fontify))
1147 (org-export-latex-keywords-maybe)
1148 (org-export-latex-special-chars
1149 (plist-get org-export-latex-options-plist
:sub-superscript
))
1150 (org-export-latex-links)
1151 (org-trim (buffer-string))))
1153 (defun org-export-latex-time-stamps ()
1154 "Format time stamps."
1155 (goto-char (point-min))
1156 (let ((org-display-custom-times org-export-latex-display-custom-times
))
1157 (while (re-search-forward org-ts-regexp-both nil t
)
1158 (org-if-unprotected-at (1- (point))
1160 (org-export-latex-protect-string
1161 (format org-export-latex-timestamp-markup
1162 (substring (org-translate-time (match-string 0)) 1 -
1)))
1165 (defun org-export-latex-quotation-marks ()
1166 "Export quotation marks depending on language conventions."
1167 (let* ((lang (plist-get org-export-latex-options-plist
:language
))
1168 (quote-rpl (if (equal lang
"fr")
1169 '(("\\(\\s-\\)\"" "«~")
1170 ("\\(\\S-\\)\"" "~»")
1171 ("\\(\\s-\\)'" "`"))
1172 '(("\\(\\s-\\|[[(]\\)\"" "``")
1173 ("\\(\\S-\\)\"" "''")
1174 ("\\(\\s-\\|(\\)'" "`")))))
1175 (mapc (lambda(l) (goto-char (point-min))
1176 (while (re-search-forward (car l
) nil t
)
1177 (let ((rpl (concat (match-string 1)
1178 (org-export-latex-protect-string
1179 (copy-sequence (cadr l
))))))
1180 (org-if-unprotected-1
1181 (replace-match rpl t t
))))) quote-rpl
)))
1183 (defun org-export-latex-special-chars (sub-superscript)
1184 "Export special characters to LaTeX.
1185 If SUB-SUPERSCRIPT is non-nil, convert \\ and ^.
1186 See the `org-export-latex.el' code for a complete conversion table."
1187 (goto-char (point-min))
1189 (goto-char (point-min))
1190 (while (re-search-forward c nil t
)
1191 ;; Put the point where to check for org-protected
1192 (unless (get-text-property (match-beginning 2) 'org-protected
)
1193 (cond ((member (match-string 2) '("\\$" "$"))
1194 (if (equal (match-string 2) "\\$")
1196 (replace-match "\\$" t t
)))
1197 ((member (match-string 2) '("&" "%" "#"))
1198 (if (equal (match-string 1) "\\")
1199 (replace-match (match-string 2) t t
)
1200 (replace-match (concat (match-string 1) "\\"
1201 (match-string 2)) t t
)))
1202 ((equal (match-string 2) "...")
1204 (concat (match-string 1)
1205 (org-export-latex-protect-string "\\ldots{}")) t t
))
1206 ((equal (match-string 2) "~")
1207 (cond ((equal (match-string 1) "\\") nil
)
1208 ((eq 'org-link
(get-text-property 0 'face
(match-string 2)))
1209 (replace-match (concat (match-string 1) "\\~") t t
))
1211 (org-export-latex-protect-string
1212 (concat (match-string 1) "\\~{}")) t t
))))
1213 ((member (match-string 2) '("{" "}"))
1214 (unless (save-match-data (org-inside-latex-math-p))
1215 (if (equal (match-string 1) "\\")
1216 (replace-match (match-string 2) t t
)
1217 (replace-match (concat (match-string 1) "\\"
1218 (match-string 2)) t t
)))))
1219 (unless (save-match-data (org-inside-latex-math-p))
1220 (cond ((equal (match-string 2) "\\")
1221 (replace-match (or (save-match-data
1222 (org-export-latex-treat-backslash-char
1224 (or (match-string 3) "")))
1226 ((member (match-string 2) '("_" "^"))
1227 (replace-match (or (save-match-data
1228 (org-export-latex-treat-sub-super-char
1232 (match-string 3))) "") t t
)
1233 (backward-char 1)))))))
1234 '(;"^\\([^\n$]*?\\|^\\)\\(\\\\?\\$\\)\\([^\n$]*\\)$"
1235 "\\(\\(\\\\?\\$\\)\\)"
1236 "\\([a-za-z0-9]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\({[^{}]+}\\|[a-za-z0-9]+\\|[ \t\n]\\|[:punct:]\\|)\\|{[a-za-z0-9]+}\\|([a-za-z0-9]+)\\)"
1237 "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|[a-zA-Z&#%{}\"]+\\)"
1238 "\\(.\\|^\\)\\(&\\)"
1239 "\\(.\\|^\\)\\(#\\)"
1240 "\\(.\\|^\\)\\(%\\)"
1241 "\\(.\\|^\\)\\({\\)"
1242 "\\(.\\|^\\)\\(}\\)"
1243 "\\(.\\|^\\)\\(~\\)"
1244 "\\(.\\|^\\)\\(\\.\\.\\.\\)"
1245 ;; (?\< . "\\textless{}")
1246 ;; (?\> . "\\textgreater{}")
1249 (defun org-inside-latex-math-p ()
1250 (get-text-property (point) 'org-latex-math
))
1252 (defun org-export-latex-treat-sub-super-char
1253 (subsup char string-before string-after
)
1254 "Convert the \"_\" and \"^\" characters to LaTeX.
1255 SUBSUP corresponds to the ^: option in the #+OPTIONS line.
1256 Convert CHAR depending on STRING-BEFORE and STRING-AFTER."
1257 (cond ((equal string-before
"\\")
1258 (concat string-before char string-after
))
1259 ((and (string-match "\\S-+" string-after
))
1260 ;; this is part of a math formula
1261 (cond ((eq 'org-link
(get-text-property 0 'face char
))
1262 (concat string-before
"\\" char string-after
))
1263 ((save-match-data (org-inside-latex-math-p))
1265 (cond ((eq 1 (length string-after
))
1266 (concat string-before char string-after
))
1267 ((string-match "[({]?\\([^)}]+\\)[)}]?" string-after
)
1268 (format "%s%s{%s}" string-before char
1269 (match-string 1 string-after
))))))
1270 ((and (> (length string-after
) 1)
1272 (and (equal subsup
'{}) (eq (string-to-char string-after
) ?\
{)))
1273 (string-match "[({]?\\([^)}]+\\)[)}]?" string-after
))
1274 (org-export-latex-protect-string
1275 (format "%s$%s{%s}$" string-before char
1276 (if (and (> (match-end 1) (1+ (match-beginning 1)))
1277 (not (equal (substring string-after
0 2) "{\\")))
1278 (concat "\\mathrm{" (match-string 1 string-after
) "}")
1279 (match-string 1 string-after
)))))
1280 ((eq subsup t
) (concat string-before
"$" char string-after
"$"))
1281 (t (org-export-latex-protect-string
1282 (concat string-before
"\\" char
"{}" string-after
)))))
1283 (t (org-export-latex-protect-string
1284 (concat string-before
"\\" char
"{}" string-after
)))))
1286 (defun org-export-latex-treat-backslash-char (string-before string-after
)
1287 "Convert the \"$\" special character to LaTeX.
1288 The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1289 (cond ((member (list string-after
) org-html-entities
)
1290 ;; backslash is part of a special entity (like "\alpha")
1291 (concat string-before
"$\\"
1292 (or (cdar (member (list string-after
) org-html-entities
))
1294 ((and (not (string-match "^[ \n\t]" string-after
))
1295 (not (string-match "[ \t]\\'\\|^" string-before
)))
1296 ;; backslash is inside a word
1297 (org-export-latex-protect-string
1298 (concat string-before
"\\textbackslash{}" string-after
)))
1299 ((not (or (equal string-after
"")
1300 (string-match "^[ \t\n]" string-after
)))
1301 ;; backslash might escape a character (like \#) or a user TeX
1302 ;; macro (like \setcounter)
1303 (org-export-latex-protect-string
1304 (concat string-before
"\\" string-after
)))
1305 ((and (string-match "^[ \t\n]" string-after
)
1306 (string-match "[ \t\n]\\'" string-before
))
1307 ;; backslash is alone, convert it to $\backslash$
1308 (org-export-latex-protect-string
1309 (concat string-before
"\\textbackslash{}" string-after
)))
1310 (t (org-export-latex-protect-string
1311 (concat string-before
"\\textbackslash{}" string-after
)))))
1313 (defun org-export-latex-keywords ()
1314 "Convert special keywords to LaTeX."
1315 (goto-char (point-min))
1316 (while (re-search-forward org-export-latex-special-keyword-regexp nil t
)
1317 (replace-match (format org-export-latex-timestamp-keyword-markup
1318 (match-string 0)) t t
)
1320 (beginning-of-line 1)
1321 (unless (looking-at ".*\\\\newline[ \t]*$")
1323 (insert "\\newline")))))
1325 (defun org-export-latex-fixed-width (opt)
1326 "When OPT is non-nil convert fixed-width sections to LaTeX."
1327 (goto-char (point-min))
1328 (while (re-search-forward "^[ \t]*:\\([ \t]\\|$\\)" nil t
)
1330 (progn (goto-char (match-beginning 0))
1331 (insert "\\begin{verbatim}\n")
1332 (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$")
1333 (replace-match (concat (match-string 1)
1334 (match-string 2)) t t
)
1336 (insert "\\end{verbatim}\n\n"))
1337 (progn (goto-char (match-beginning 0))
1338 (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$")
1339 (replace-match (concat "%" (match-string 1)
1340 (match-string 2)) t t
)
1344 (defvar org-table-last-alignment
) ; defined in org-table.el
1345 (defvar org-table-last-column-widths
) ; defined in org-table.el
1346 (declare-function orgtbl-to-latex
"org-table" (table params
) t
)
1347 (defun org-export-latex-tables (insert)
1348 "Convert tables to LaTeX and INSERT it."
1349 (goto-char (point-min))
1350 (while (re-search-forward "^\\([ \t]*\\)|" nil t
)
1351 (org-if-unprotected-at (1- (point))
1353 (let* ((beg (org-table-begin))
1354 (end (org-table-end))
1355 (raw-table (buffer-substring beg end
))
1356 (org-table-last-alignment (copy-sequence org-table-last-alignment
))
1357 (org-table-last-column-widths (copy-sequence
1358 org-table-last-column-widths
))
1359 fnum fields line lines olines gr colgropen line-fmt align
1360 caption label attr floatp longtblp
)
1361 (if org-export-latex-tables-verbatim
1362 (let* ((tbl (concat "\\begin{verbatim}\n" raw-table
1363 "\\end{verbatim}\n")))
1364 (apply 'delete-region
(list beg end
))
1365 (insert (org-export-latex-protect-string tbl
)))
1367 (setq caption
(org-find-text-property-in-string
1368 'org-caption raw-table
)
1369 attr
(org-find-text-property-in-string
1370 'org-attributes raw-table
)
1371 label
(org-find-text-property-in-string
1372 'org-label raw-table
)
1373 longtblp
(and attr
(stringp attr
)
1374 (string-match "\\<longtable\\>" attr
))
1375 align
(and attr
(stringp attr
)
1376 (string-match "\\<align=\\([^ \t\n\r,]+\\)" attr
)
1377 (match-string 1 attr
))
1378 floatp
(or caption label
))
1379 (setq lines
(org-split-string raw-table
"\n"))
1380 (apply 'delete-region
(list beg end
))
1381 (when org-export-table-remove-special-lines
1382 (setq lines
(org-table-clean-before-export lines
'maybe-quoted
)))
1383 (when org-table-clean-did-remove-column
1384 (pop org-table-last-alignment
)
1385 (pop org-table-last-column-widths
))
1386 ;; make a formatting string to reflect aligment
1388 (while (and (not line-fmt
) (setq line
(pop olines
)))
1389 (unless (string-match "^[ \t]*|-" line
)
1390 (setq fields
(org-split-string line
"[ \t]*|[ \t]*"))
1391 (setq fnum
(make-vector (length fields
) 0))
1395 (setq gr
(pop org-table-colgroup-info
))
1397 (cond ((eq gr
:start
)
1398 (prog1 (if colgropen
"|" "|")
1399 (setq colgropen t
)))
1401 (prog1 (if colgropen
"|" "|")
1402 (setq colgropen nil
)))
1404 (if (memq gr
'(:end
:startend
))
1405 (progn (setq colgropen nil
) "|")
1408 ;; fix double || in line-fmt
1409 (setq line-fmt
(replace-regexp-in-string "||" "|" line-fmt
))
1410 ;; maybe remove the first and last "|"
1411 (when (and (not org-export-latex-tables-column-borders
)
1412 (string-match "^\\(|\\)?\\(.+\\)|$" line-fmt
))
1413 (setq line-fmt
(match-string 2 line-fmt
)))
1416 (setq align
(apply 'format
1418 (mapcar (lambda (x) (if x
"r" "l"))
1419 org-table-last-alignment
)))))
1420 ;; prepare the table to send to orgtbl-to-latex
1424 (or (and (string-match "[ \t]*|-+" elem
) 'hline
)
1425 (org-split-string (org-trim elem
) "|")))
1428 (insert (org-export-latex-protect-string
1431 (concat "\\begin{longtable}{" align
"}\n")
1432 (if floatp
"\\begin{table}[htb]\n"))
1433 (if (or floatp longtblp
)
1436 (if label
(concat "\\\label{" label
"}") "")
1438 (if longtblp
"\\\\\n" "\n")
1439 (if (and org-export-latex-tables-centered
(not longtblp
))
1440 "\\begin{center}\n")
1441 (if (not longtblp
) (concat "\\begin{tabular}{" align
"}\n"))
1444 `(:tstart nil
:tend nil
1445 :hlend
,(if longtblp
1449 \\hline\\multicolumn{%d}{r}{Continued on next page}\\
1451 \\endlastfoot" (length org-table-last-alignment
))
1453 (if (not longtblp
) (concat "\n\\end{tabular}"))
1454 (if longtblp
"\n" (if org-export-latex-tables-centered
1455 "\n\\end{center}\n" "\n"))
1458 (if floatp
"\\end{table}"))))
1461 (defun org-export-latex-fontify ()
1462 "Convert fontification to LaTeX."
1463 (goto-char (point-min))
1464 (while (re-search-forward org-emph-re nil t
)
1465 ;; The match goes one char after the *string*
1466 (let ((emph (assoc (match-string 3)
1467 org-export-latex-emphasis-alist
))
1468 (beg (match-beginning 0))
1472 (message "`org-export-latex-emphasis-alist' has no entry for formatting triggered by \"%s\""
1474 (unless (or (and (get-text-property (- (point) 2) 'org-protected
)
1475 (not (get-text-property
1476 (- (point) 2) 'org-verbatim-emph
)))
1478 (goto-char (match-beginning 1))
1480 (and (org-at-table-p)
1482 "[|\n]" (buffer-substring beg end
))))))
1483 (setq rpl
(concat (match-string 1)
1484 (org-export-latex-emph-format (cadr emph
)
1488 (setq rpl
(org-export-latex-protect-string rpl
)))
1489 (replace-match rpl t t
)))
1492 (defvar org-export-latex-use-verb nil
)
1493 (defun org-export-latex-emph-format (format string
)
1494 "Format an emphasis string and handle the \\verb special case."
1495 (when (equal format
"\\verb")
1497 (if org-export-latex-use-verb
1498 (let ((ll "~,./?;':\"|!@#%^&-_=+abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ<>()[]{}"))
1500 (loop for i from
0 to
(1- (length ll
)) do
1501 (if (not (string-match (regexp-quote (substring ll i
(1+ i
)))
1504 (setq format
(concat "\\verb" (substring ll i
(1+ i
))
1505 "%s" (substring ll i
(1+ i
))))
1506 (throw 'exit nil
))))))
1508 (trans '(("\\" .
"\\textbackslash{}")
1509 ("~" .
"\\textasciitilde{}")
1510 ("^" .
"\\textasciicircum{}")))
1512 (while (string-match "[\\{}$%&_#~^]" string
)
1513 (setq char
(match-string 0 string
))
1514 (if (> (match-beginning 0) 0)
1515 (setq rtn
(concat rtn
(substring string
1516 0 (match-beginning 0)))))
1517 (setq string
(substring string
(1+ (match-beginning 0))))
1518 (setq char
(or (cdr (assoc char trans
)) (concat "\\" char
))
1519 rtn
(concat rtn char
)))
1520 (setq string
(concat rtn string
) format
"\\texttt{%s}")))))
1521 (setq string
(org-export-latex-protect-string
1522 (format format string
))))
1524 (defun org-export-latex-links ()
1525 ;; Make sure to use the LaTeX hyperref and graphicx package
1526 ;; or send some warnings.
1527 "Convert links to LaTeX."
1528 (goto-char (point-min))
1529 (while (re-search-forward org-bracket-link-analytic-regexp
++ nil t
)
1531 (goto-char (match-beginning 0))
1532 (let* ((re-radio org-export-latex-all-targets-re
)
1533 (remove (list (match-beginning 0) (match-end 0)))
1534 (raw-path (org-extract-attributes (match-string 3)))
1535 (full-raw-path (concat (match-string 1) raw-path
))
1536 (desc (match-string 5))
1537 (type (or (match-string 2)
1538 (if (or (file-name-absolute-p raw-path
)
1539 (string-match "^\\.\\.?/" raw-path
))
1541 (coderefp (equal type
"coderef"))
1542 (caption (org-find-text-property-in-string 'org-caption raw-path
))
1543 (attr (or (org-find-text-property-in-string 'org-attributes raw-path
)
1544 (plist-get org-export-latex-options-plist
:latex-image-options
)))
1545 (label (org-find-text-property-in-string 'org-label raw-path
))
1547 ;; define the path of the link
1549 ((member type
'("coderef"))
1551 ((member type
'("http" "https" "ftp"))
1552 (concat type
":" raw-path
))
1553 ((and re-radio
(string-match re-radio raw-path
))
1555 ((equal type
"mailto")
1556 (concat type
":" raw-path
))
1557 ((equal type
"file")
1558 (if (and (org-file-image-p
1561 org-export-latex-inline-image-extensions
)
1562 (or (get-text-property 0 'org-no-description
1564 (equal desc full-raw-path
)))
1566 (progn (when (string-match "\\(.+\\)::.+" raw-path
)
1567 (setq raw-path
(match-string 1 raw-path
)))
1568 (if (file-exists-p raw-path
)
1569 (concat type
"://" (expand-file-name raw-path
))
1570 (concat type
"://" (org-export-directory
1571 :LaTeX org-export-latex-options-plist
)
1573 ;; process with link inserting
1574 (apply 'delete-region remove
)
1576 (plist-get org-export-latex-options-plist
:inline-images
))
1577 ;; OK, we need to inline an image
1579 (org-export-latex-format-image raw-path caption label attr
)))
1582 (org-export-get-coderef-format path desc
)
1583 (cdr (assoc path org-export-code-refs
)))))
1584 (radiop (insert (format "\\hyperref[%s]{%s}"
1585 (org-solidify-link-text raw-path
) desc
)))
1587 (insert (format "\\hyperref[%s]{%s}"
1588 (org-remove-initial-hash
1589 (org-solidify-link-text raw-path
))
1592 (when (org-at-table-p)
1593 ;; There is a strange problem when we have a link in a table,
1594 ;; ampersands then cause a problem. I think this must be
1595 ;; a LaTeX issue, but we here implement a work-around anyway.
1596 (setq path
(org-export-latex-protect-amp path
)
1597 desc
(org-export-latex-protect-amp desc
)))
1598 (insert (format "\\href{%s}{%s}" path desc
)))
1599 (t (insert "\\texttt{" desc
"}")))))))
1602 (defun org-export-latex-format-image (path caption label attr
)
1603 "Format the image element, depending on user settings."
1604 (let (floatp wrapp placement figenv
)
1605 (setq floatp
(or caption label
))
1606 (when (and attr
(stringp attr
))
1607 (if (string-match "[ \t]*\\<wrap\\>" attr
)
1608 (setq wrapp t floatp nil attr
(replace-match "" t t attr
)))
1609 (if (string-match "[ \t]*\\<float\\>" attr
)
1610 (setq wrapp nil floatp t attr
(replace-match "" t t attr
))))
1614 (wrapp "{l}{0.5\\textwidth}")
1618 (when (and attr
(stringp attr
)
1619 (string-match "[ \t]*\\<placement=\\(\\S-+\\)" attr
))
1620 (setq placement
(match-string 1 attr
)
1621 attr
(replace-match "" t t attr
)))
1622 (setq attr
(and attr
(org-trim attr
)))
1623 (when (or (not attr
) (= (length attr
) 0))
1624 (setq attr
(cond (floatp "width=0.7\\textwidth")
1625 (wrapp "width=0.48\\textwidth")
1629 (wrapp "\\begin{wrapfigure}%placement
1631 \\includegraphics[%attr]{%path}
1632 \\caption{%labelcmd%caption}
1634 (floatp "\\begin{figure}%placement
1636 \\includegraphics[%attr]{%path}
1637 \\caption{%labelcmd%caption}
1639 (t "\\includegraphics[%attr]{%path}")))
1641 (if (and (not label
) (not caption
)
1642 (string-match "^\\\\caption{.*\n" figenv
))
1643 (setq figenv
(replace-match "" t t figenv
)))
1647 (if (file-name-absolute-p path
)
1648 (expand-file-name path
)
1651 (cons "labelcmd" (if label
(format "\\label{%s}"
1653 (cons "caption" (or caption
""))
1654 (cons "placement" (or placement
""))))))
1656 (defun org-export-latex-protect-amp (s)
1657 (while (string-match "\\([^\\\\]\\)\\(&\\)" s
)
1658 (setq s
(replace-match (concat (match-string 1 s
) "\\" (match-string 2 s
))
1662 (defun org-remove-initial-hash (s)
1663 (if (string-match "\\`#" s
)
1666 (defvar org-latex-entities
) ; defined below
1667 (defvar org-latex-entities-regexp
) ; defined below
1668 (defvar org-latex-entities-exceptions
) ; defined below
1670 (defun org-export-latex-preprocess (parameters)
1671 "Clean stuff in the LaTeX export."
1672 ;; Preserve line breaks
1673 (goto-char (point-min))
1674 (while (re-search-forward "\\\\\\\\" nil t
)
1675 (add-text-properties (match-beginning 0) (match-end 0)
1676 '(org-protected t
)))
1678 ;; Preserve latex environments
1679 (goto-char (point-min))
1680 (while (re-search-forward "^[ \t]*\\\\begin{\\([a-zA-Z]+\\*?\\)}" nil t
)
1681 (let* ((start (progn (beginning-of-line) (point)))
1682 (end (and (re-search-forward
1683 (concat "^[ \t]*\\\\end{"
1684 (regexp-quote (match-string 1))
1688 (add-text-properties start end
'(org-protected t
))
1689 (goto-char (point-at-eol)))))
1691 ;; Preserve math snippets
1693 (let* ((matchers (plist-get org-format-latex-options
:matchers
))
1694 (re-list org-latex-regexps
)
1695 beg end re e m n block off
)
1696 ;; Check the different regular expressions
1697 (while (setq e
(pop re-list
))
1698 (setq m
(car e
) re
(nth 1 e
) n
(nth 2 e
)
1699 block
(if (nth 3 e
) "\n\n" ""))
1700 (setq off
(if (member m
'("$" "$1")) 1 0))
1701 (when (and (member m matchers
) (not (equal m
"begin")))
1702 (goto-char (point-min))
1703 (while (re-search-forward re nil t
)
1704 (setq beg
(+ (match-beginning 0) off
) end
(- (match-end 0) 0))
1705 (add-text-properties beg end
'(org-protected t org-latex-math t
))))))
1707 ;; Convert LaTeX to \LaTeX{}
1708 (goto-char (point-min))
1709 (let ((case-fold-search nil
))
1710 (while (re-search-forward "\\([^+_]\\)LaTeX" nil t
)
1712 (replace-match (org-export-latex-protect-string
1713 (concat (match-string 1) "\\LaTeX{}")) t t
))))
1715 ;; Convert blockquotes
1716 (goto-char (point-min))
1717 (while (search-forward "ORG-BLOCKQUOTE-START" nil t
)
1718 (org-replace-match-keep-properties "\\begin{quote}" t t
))
1719 (goto-char (point-min))
1720 (while (search-forward "ORG-BLOCKQUOTE-END" nil t
)
1721 (org-replace-match-keep-properties "\\end{quote}" t t
))
1724 (goto-char (point-min))
1725 (while (search-forward "ORG-VERSE-START" nil t
)
1726 (org-replace-match-keep-properties "\\begin{verse}" t t
)
1727 (beginning-of-line 2)
1728 (while (and (not (looking-at "[ \t]*ORG-VERSE-END.*")) (not (eobp)))
1729 (when (looking-at "\\([ \t]+\\)\\([^ \t\n]\\)")
1730 (goto-char (match-end 1))
1731 (org-replace-match-keep-properties
1732 (org-export-latex-protect-string
1733 (concat "\\hspace*{1cm}" (match-string 2))) t t
)
1734 (beginning-of-line 1))
1735 (if (looking-at "[ \t]*$")
1736 (insert (org-export-latex-protect-string "\\vspace*{1em}"))
1737 (unless (looking-at ".*?[^ \t\n].*?\\\\\\\\[ \t]*$")
1740 (beginning-of-line 2))
1741 (and (looking-at "[ \t]*ORG-VERSE-END.*")
1742 (org-replace-match-keep-properties "\\end{verse}" t t
)))
1745 (goto-char (point-min))
1746 (while (search-forward "ORG-CENTER-START" nil t
)
1747 (org-replace-match-keep-properties "\\begin{center}" t t
))
1748 (goto-char (point-min))
1749 (while (search-forward "ORG-CENTER-END" nil t
)
1750 (org-replace-match-keep-properties "\\end{center}" t t
))
1752 (run-hooks 'org-export-latex-after-blockquotes-hook
)
1754 ;; Convert horizontal rules
1755 (goto-char (point-min))
1756 (while (re-search-forward "^----+.$" nil t
)
1758 (replace-match (org-export-latex-protect-string "\\hrule") t t
)))
1760 ;; Protect LaTeX commands like \command[...]{...} or \command{...}
1761 (let ((re (concat "\\\\[a-zA-Z]+\\(?:"
1764 (org-create-multibrace-regexp "{" "}" 3))))
1765 (while (re-search-forward re nil t
)
1766 (unless (save-excursion (goto-char (match-beginning 0))
1767 (equal (char-after (point-at-bol)) ?
#))
1768 (add-text-properties (match-beginning 0) (match-end 0)
1769 '(org-protected t
)))))
1771 ;; Protect LaTeX entities
1772 (goto-char (point-min))
1774 (while (re-search-forward org-latex-entities-regexp nil t
)
1775 (if (setq a
(assoc (match-string 0) org-latex-entities-exceptions
))
1776 (replace-match (org-add-props (nth 1 a
) nil
'org-protected t
)
1778 (add-text-properties (match-beginning 0) (match-end 0)
1779 '(org-protected t
)))))
1781 ;; Replace radio links
1782 (goto-char (point-min))
1783 (while (re-search-forward
1784 (concat "<<<?" org-export-latex-all-targets-re
1785 ">>>?\\((INVISIBLE)\\)?") nil t
)
1788 (org-export-latex-protect-string
1789 (format "\\label{%s}%s" (save-match-data (org-solidify-link-text
1791 (if (match-string 2) "" (match-string 1)))) t t
)))
1793 ;; Delete @<...> constructs
1794 ;; Thanks to Daniel Clemente for this regexp
1795 (goto-char (point-min))
1796 (while (re-search-forward "@<\\(?:[^\"\n]\\|\".*\"\\)*?>" nil t
)
1798 (replace-match "")))
1800 ;; When converting to LaTeX, replace footnotes
1801 ;; FIXME: don't protect footnotes from conversion
1802 (when (plist-get org-export-latex-options-plist
:footnotes
)
1803 (goto-char (point-min))
1804 (while (re-search-forward "\\[\\([0-9]+\\)\\]" nil t
)
1806 (when (and (save-match-data
1807 (save-excursion (beginning-of-line)
1808 (looking-at "[^:|#]")))
1809 (not (org-in-verbatim-emphasis)))
1810 (let ((foot-beg (match-beginning 0))
1811 (foot-end (match-end 0))
1812 (foot-prefix (match-string 0))
1813 footnote footnote-rpl
)
1815 (if (not (re-search-forward (concat "^" (regexp-quote foot-prefix
))
1817 (replace-match "$^{\\1}$")
1819 (let ((end (save-excursion
1820 (if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t
)
1821 (match-beginning 0) (point-max)))))
1822 (setq footnote
(concat (org-trim (buffer-substring (point) end
))
1823 " ")) ; prevent last } being part of a link
1824 (delete-region (point) end
))
1825 (goto-char foot-beg
)
1826 (delete-region foot-beg foot-end
)
1827 (unless (null footnote
)
1828 (setq footnote-rpl
(format "\\footnote{%s}" footnote
))
1829 (add-text-properties 0 10 '(org-protected t
) footnote-rpl
)
1830 (add-text-properties (1- (length footnote-rpl
))
1831 (length footnote-rpl
)
1832 '(org-protected t
) footnote-rpl
)
1833 (insert footnote-rpl
)))
1836 ;; Remove footnote section tag for LaTeX
1837 (goto-char (point-min))
1838 (while (re-search-forward
1839 (concat "^" footnote-section-tag-regexp
) nil t
)
1841 (replace-match "")))))
1845 (defun org-export-latex-lists ()
1846 "Convert plain text lists in current buffer into LaTeX lists."
1847 (goto-char (point-min))
1848 (while (re-search-forward org-list-beginning-re nil t
)
1851 (insert (org-list-to-latex (org-list-parse-list t
)
1852 org-export-latex-list-parameters
))
1855 (defconst org-latex-entities
1884 "\\begin{description}"
1885 "\\begin{enumerate}"
1889 "\\begin{flushleft}"
1890 "\\begin{flushright}"
1895 "\\begin{quotation}"
1900 "\\begin{thebibliography}"
1902 "\\begin{titlepage}"
2030 "A list of LaTeX commands to be protected when performing conversion.")
2032 (defvar org-latex-entities-exceptions nil
)
2034 (defconst org-latex-entities-regexp
2036 (dolist (x org-latex-entities
)
2038 (add-to-list 'org-latex-entities-exceptions x
)
2040 (if (string-match "[a-z][A-Z]$" x
)
2043 (concat "\\(" (regexp-opt (nreverse names
)) "\\>\\)"
2044 "\\|\\(" (regexp-opt (nreverse rest
)) "\\)")))
2046 (provide 'org-export-latex
)
2047 (provide 'org-latex
)
2049 ;; arch-tag: 23c2b87d-da04-4c2d-ad2d-1eb6487bc3ad
2051 ;;; org-latex.el ends here