annotate lisp/textmodes/org-export-latex.el @ 88016:921eddfa6d43

(server-buffer): New const. (server-log): New var. (server-log): Use them. (server-process-filter): (Try to) run the continuation in the same cwd as the client's.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 26 Jan 2008 21:54:44 +0000
parents b7acc6fad5a9
children 00b30bac18c2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1 ;;; org-export-latex.el --- LaTeX exporter for org-mode
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
2 ;;
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
3 ;; Copyright (c) 2007, 2008 Free Software Foundation, Inc.
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
4 ;;
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
5 ;; Emacs Lisp Archive Entry
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
6 ;; Filename: org-export-latex.el
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
7 ;; Version: 5.19
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
8 ;; Author: Bastien Guerry <bzg AT altern DOT org>
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
9 ;; Maintainer: Bastien Guerry <bzg AT altern DOT org>
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
10 ;; Keywords: org, wp, tex
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
11 ;; Description: Converts an org-mode buffer into LaTeX
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
12 ;; URL: http://www.cognition.ens.fr/~guerry/u/org-export-latex.el
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
13 ;;
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
14 ;; This file is part of GNU Emacs.
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
15 ;;
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
16 ;; GNU Emacs is free software; you can redistribute it and/or modify it
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
17 ;; under the terms of the GNU General Public License as published by the
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
18 ;; Free Software Foundation; either version 3, or (at your option) any
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
19 ;; later version.
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
20 ;;
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
21 ;; GNU Emacs is distributed in the hope that it will be useful, but
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
22 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
24 ;; General Public License for more details.
85749
5032dc6e8d82 Revert down-casing of copyright header.
Glenn Morris <rgm@gnu.org>
parents: 85554
diff changeset
25 ;;
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
26 ;; You should have received a copy of the GNU General Public License
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
27 ;; along with GNU Emacs; see the file COPYING. If not, write to the Free
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
28 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
29 ;; MA 02110-1301, USA.
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
30 ;;
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
31 ;;; Commentary:
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
32 ;;
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
33 ;; This library implements a LaTeX exporter for org-mode.
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
34 ;;
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
35 ;; Put this file into your load-path and the following into your ~/.emacs:
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
36 ;; (require 'org-export-latex)
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
37 ;;
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
38 ;; The interactive functions are similar to those of the HTML exporter:
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
39 ;;
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
40 ;; M-x `org-export-as-latex'
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
41 ;; M-x `org-export-as-latex-batch'
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
42 ;; M-x `org-export-as-latex-to-buffer'
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
43 ;; M-x `org-export-region-as-latex'
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
44 ;; M-x `org-replace-region-by-latex'
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
45 ;;
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
46 ;;; Code:
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
47
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
48 (eval-when-compile
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
49 (require 'cl))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
50
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
51 (require 'footnote)
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
52 (require 'org)
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
53
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
54 ;;; Variables:
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
55 (defvar org-export-latex-class nil)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
56 (defvar org-export-latex-header nil)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
57 (defvar org-export-latex-append-header nil)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
58 (defvar org-export-latex-options-plist nil)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
59 (defvar org-export-latex-todo-keywords-1 nil)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
60 (defvar org-export-latex-all-targets-re nil)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
61 (defvar org-export-latex-add-level 0)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
62 (defvar org-export-latex-sectioning "")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
63 (defvar org-export-latex-sectioning-depth 0)
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
64 (defvar org-export-latex-list-beginning-re
85554
5b20f92e9f29 Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents: 85156
diff changeset
65 "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) +?")
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
66
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
67 (defvar org-export-latex-special-string-regexps
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
68 '(org-ts-regexp
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
69 org-scheduled-string
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
70 org-deadline-string
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
71 org-clock-string)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
72 "A list of regexps to convert as special keywords.")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
73
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
74 (defvar latexp) ; dynamically scoped from org.el
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
75 (defvar re-quote) ; dynamically scoped from org.el
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
76 (defvar commentsp) ; dynamically scoped from org.el
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
77
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
78 ;;; User variables:
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
79
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
80 (defcustom org-export-latex-default-class "article"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
81 "The default LaTeX class."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
82 :group 'org-export-latex
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
83 :type '(string :tag "LaTeX class"))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
84
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
85 (defcustom org-export-latex-classes
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
86 '(("article"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
87 "\\documentclass[11pt,a4paper]{article}
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
88 \\usepackage[utf8]{inputenc}
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
89 \\usepackage[T1]{fontenc}
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
90 \\usepackage{hyperref}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
91 ("\\section{%s}" . "\\section*{%s}")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
92 ("\\subsection{%s}" . "\\subsection*{%s}")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
93 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
94 ("\\paragraph{%s}" . "\\paragraph*{%s}")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
95 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
96 ("report"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
97 "\\documentclass[11pt,a4paper]{report}
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
98 \\usepackage[utf8]{inputenc}
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
99 \\usepackage[T1]{fontenc}
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
100 \\usepackage{hyperref}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
101 ("\\part{%s}" . "\\part*{%s}")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
102 ("\\chapter{%s}" . "\\chapter*{%s}")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
103 ("\\section{%s}" . "\\section*{%s}")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
104 ("\\subsection{%s}" . "\\subsection*{%s}")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
105 ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
106 ("book"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
107 "\\documentclass[11pt,a4paper]{book}
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
108 \\usepackage[utf8]{inputenc}
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
109 \\usepackage[T1]{fontenc}
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
110 \\usepackage{hyperref}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
111 ("\\part{%s}" . "\\part*{%s}")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
112 ("\\chapter{%s}" . "\\chapter*{%s}")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
113 ("\\section{%s}" . "\\section*{%s}")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
114 ("\\subsection{%s}" . "\\subsection*{%s}")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
115 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
116 "Alist of LaTeX classes and associated header and structure.
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
117 If #+LaTeX_CLASS is set in the buffer, use its value and the
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
118 associated information. Here is the structure of each cell:
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
119
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
120 \(class-name
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
121 header-string
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
122 (unnumbered-section numbered-section\)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
123 ...\)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
124
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
125 A %s formatter is mandatory in each section string and will be
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
126 replaced by the title of the section."
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
127 :group 'org-export-latex
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
128 :type '(repeat
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
129 (list (string :tag "LaTeX class")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
130 (string :tag "LaTeX header")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
131 (cons :tag "Level 1"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
132 (string :tag "Numbered")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
133 (string :tag "Unnumbered"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
134 (cons :tag "Level 2"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
135 (string :tag "Numbered")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
136 (string :tag "Unnumbered"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
137 (cons :tag "Level 3"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
138 (string :tag "Numbered")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
139 (string :tag "Unnumbered"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
140 (cons :tag "Level 4"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
141 (string :tag "Numbered")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
142 (string :tag "Unnumbered"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
143 (cons :tag "Level 5"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
144 (string :tag "Numbered")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
145 (string :tag "Unnumbered")))))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
146
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
147 (defcustom org-export-latex-emphasis-alist
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
148 '(("*" "\\textbf{%s}" nil)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
149 ("/" "\\emph{%s}" nil)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
150 ("_" "\\underline{%s}" nil)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
151 ("+" "\\texttt{%s}" nil)
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
152 ("=" "\\texttt{%s}" nil)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
153 ("~" "\\texttt{%s}" t))
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
154 "Alist of LaTeX expressions to convert emphasis fontifiers.
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
155 Each element of the list is a list of three elements.
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
156 The first element is the character used as a marker for fontification.
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
157 The second element is a formatting string to wrap fontified text with.
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
158 The third element decides whether to protect converted text from other
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
159 conversions."
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
160 :group 'org-export-latex
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
161 :type 'alist)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
162
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
163 (defcustom org-export-latex-title-command "\\maketitle"
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
164 "The command used to insert the title just after \\begin{document}.
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
165 If this string contains the formatting specification \"%s\" then
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
166 it will be used as a formatting string, passing the title as an
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
167 argument."
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
168 :group 'org-export-latex
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
169 :type 'string)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
170
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
171 (defcustom org-export-latex-date-format
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
172 "%d %B %Y"
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
173 "Format string for \\date{...}."
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
174 :group 'org-export-latex
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
175 :type 'string)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
176
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
177 (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
178 "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
179 :group 'org-export-latex
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
180 :type 'boolean)
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
181
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
182 (defcustom org-export-latex-tables-column-borders nil
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
183 "When non-nil, group of columns are surrounded with borders,
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
184 XSeven if these borders are the outside borders of the table."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
185 :group 'org-export-latex
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
186 :type 'boolean)
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
187
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
188 (defcustom org-export-latex-packages-alist nil
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
189 "Alist of packages to be inserted in the header.
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
190 Each cell is of the forma \( \"option\" . \"package\" \)."
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
191 :group 'org-export-latex
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
192 :type 'alist)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
193
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
194 (defcustom org-export-latex-low-levels 'description
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
195 "How to convert sections below the current level of sectioning,
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
196 as specified by `org-export-headline-levels' or the value of \"H:\"
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
197 in Org's #+OPTION line.
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
198
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
199 This can be either nil (skip the sections), 'description (convert
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
200 the sections as descriptive lists) or a string to be used instead
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
201 of \\section{%s}. In this latter case, the %s stands here for the
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
202 inserted headline and is mandatory."
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
203 :group 'org-export-latex
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
204 :type '(choice (const :tag "Ignore" nil)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
205 (symbol :tag "Convert as descriptive list" description)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
206 (string :tag "Use a section string" :value "\\subparagraph{%s}")))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
207
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
208 (defcustom org-export-latex-remove-from-headlines
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
209 '(:todo t :priority t :tags t)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
210 "A plist of keywords to remove from headlines.
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
211 Non-nil means remove this keyword type from the headline.
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
212
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
213 Don't remove the keys, just change their values."
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
214 :type 'plist
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
215 :group 'org-export-latex)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
216
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
217 (defcustom org-export-latex-image-default-option "width=10em"
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
218 "Default option for images."
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
219 :group 'org-export-latex
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
220 :type 'string)
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
221
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
222 (defcustom org-export-latex-coding-system nil
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
223 "Coding system for the exported LaTex file."
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
224 :group 'org-export-latex
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
225 :type 'coding-system)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
226
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
227 (defcustom org-list-radio-list-templates
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
228 '((latex-mode "% BEGIN RECEIVE ORGLST %n
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
229 % END RECEIVE ORGLST %n
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
230 \\begin{comment}
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
231 #+ORGLST: SEND %n org-list-to-latex
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
232 | | |
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
233 \\end{comment}\n")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
234 (texinfo-mode "@c BEGIN RECEIVE ORGLST %n
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
235 @c END RECEIVE ORGLST %n
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
236 @ignore
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
237 #+ORGLST: SEND %n org-list-to-texinfo
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
238 | | |
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
239 @end ignore\n")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
240 (html-mode "<!-- BEGIN RECEIVE ORGLST %n -->
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
241 <!-- END RECEIVE ORGLST %n -->
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
242 <!--
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
243 #+ORGLST: SEND %n org-list-to-html
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
244 | | |
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
245 -->\n"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
246 "Templates for radio lists in different major modes.
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
247 All occurrences of %n in a template will be replaced with the name of the
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
248 list, obtained by prompting the user."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
249 :group 'org-plain-lists
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
250 :type '(repeat
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
251 (list (symbol :tag "Major mode")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
252 (string :tag "Format"))))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
253
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
254 ;;; Autoload functions:
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
255
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
256 ;;;###autoload
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
257 (defun org-export-as-latex-batch ()
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
258 "Call `org-export-as-latex', may be used in batch processing as
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
259 emacs --batch
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
260 --load=$HOME/lib/emacs/org.el
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
261 --eval \"(setq org-export-headline-levels 2)\"
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
262 --visit=MyFile --funcall org-export-as-latex-batch"
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
263 (org-export-as-latex org-export-headline-levels 'hidden))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
264
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
265 ;;;###autoload
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
266 (defun org-export-as-latex-to-buffer (arg)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
267 "Call `org-exort-as-latex` with output to a temporary buffer.
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
268 No file is created. The prefix ARG is passed through to `org-export-as-latex'."
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
269 (interactive "P")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
270 (org-export-as-latex arg nil nil "*Org LaTeX Export*")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
271 (switch-to-buffer-other-window "*Org LaTeX Export*"))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
272
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
273 ;;;###autoload
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
274 (defun org-replace-region-by-latex (beg end)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
275 "Replace the region from BEG to END with its LaTeX export.
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
276 It assumes the region has `org-mode' syntax, and then convert it to
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
277 LaTeX. This can be used in any buffer. For example, you could
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
278 write an itemized list in `org-mode' syntax in an LaTeX buffer and
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
279 then use this command to convert it."
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
280 (interactive "r")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
281 (let (reg latex buf)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
282 (save-window-excursion
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
283 (if (org-mode-p)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
284 (setq latex (org-export-region-as-latex
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
285 beg end t 'string))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
286 (setq reg (buffer-substring beg end)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
287 buf (get-buffer-create "*Org tmp*"))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
288 (save-excursion
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
289 (set-buffer buf)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
290 (erase-buffer)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
291 (insert reg)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
292 (org-mode)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
293 (setq latex (org-export-region-as-latex
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
294 (point-min) (point-max) t 'string)))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
295 (kill-buffer buf)))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
296 (delete-region beg end)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
297 (insert latex)))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
298
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
299 ;;;###autoload
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
300 (defun org-export-region-as-latex (beg end &optional body-only buffer)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
301 "Convert region from BEG to END in `org-mode' buffer to LaTeX.
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
302 If prefix arg BODY-ONLY is set, omit file header, footer, and table of
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
303 contents, and only produce the region of converted text, useful for
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
304 cut-and-paste operations.
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
305 If BUFFER is a buffer or a string, use/create that buffer as a target
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
306 of the converted LaTeX. If BUFFER is the symbol `string', return the
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
307 produced LaTeX as a string and leave not buffer behind. For example,
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
308 a Lisp program could call this function in the following way:
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
309
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
310 (setq latex (org-export-region-as-latex beg end t 'string))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
311
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
312 When called interactively, the output buffer is selected, and shown
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
313 in a window. A non-interactive call will only retunr the buffer."
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
314 (interactive "r\nP")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
315 (when (interactive-p)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
316 (setq buffer "*Org LaTeX Export*"))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
317 (let ((transient-mark-mode t) (zmacs-regions t)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
318 rtn)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
319 (goto-char end)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
320 (set-mark (point)) ;; to activate the region
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
321 (goto-char beg)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
322 (setq rtn (org-export-as-latex
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
323 nil nil nil
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
324 buffer body-only))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
325 (if (fboundp 'deactivate-mark) (deactivate-mark))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
326 (if (and (interactive-p) (bufferp rtn))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
327 (switch-to-buffer-other-window rtn)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
328 rtn)))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
329
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
330 ;;;###autoload
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
331 (defun org-export-as-latex (arg &optional hidden ext-plist
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
332 to-buffer body-only)
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
333 "Export current buffer to a LaTeX file.
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
334 If there is an active region, export only the region. The prefix
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
335 ARG specifies how many levels of the outline should become
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
336 headlines. The default is 3. Lower levels will be exported
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
337 depending on `org-export-latex-low-levels'. The default is to
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
338 convert them as description lists. When HIDDEN is non-nil, don't
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
339 display the LaTeX buffer. EXT-PLIST is a property list with
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
340 external parameters overriding org-mode's default settings, but
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
341 still inferior to file-local settings. When TO-BUFFER is
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
342 non-nil, create a buffer with that name and export to that
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
343 buffer. If TO-BUFFER is the symbol `string', don't leave any
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
344 buffer behind but just return the resulting LaTeX as a string.
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
345 When BODY-ONLY is set, don't produce the file header and footer,
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
346 simply return the content of \begin{document}...\end{document},
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
347 without even the \begin{document} and \end{document} commands."
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
348 (interactive "P")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
349 ;; Make sure we have a file name when we need it.
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
350 (when (and (not (or to-buffer body-only))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
351 (not buffer-file-name))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
352 (if (buffer-base-buffer)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
353 (org-set-local 'buffer-file-name
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
354 (with-current-buffer (buffer-base-buffer)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
355 buffer-file-name))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
356 (error "Need a file name to be able to export")))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
357
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
358 (message "Exporting to LaTeX...")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
359 (org-update-radio-target-regexp)
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
360 (org-export-latex-set-initial-vars ext-plist arg)
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
361 (let* ((wcf (current-window-configuration))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
362 (opt-plist org-export-latex-options-plist)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
363 (region-p (org-region-active-p))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
364 (subtree-p
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
365 (when region-p
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
366 (save-excursion
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
367 (goto-char (region-beginning))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
368 (and (org-at-heading-p)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
369 (>= (org-end-of-subtree t t) (region-end))))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
370 (title (or (and subtree-p (org-export-get-title-from-subtree))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
371 (plist-get opt-plist :title)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
372 (and (not
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
373 (plist-get opt-plist :skip-before-1st-heading))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
374 (org-export-grab-title-from-buffer))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
375 (file-name-sans-extension
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
376 (file-name-nondirectory buffer-file-name))))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
377 (filename (concat (file-name-as-directory
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
378 (org-export-directory :LaTeX ext-plist))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
379 (file-name-sans-extension
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
380 (file-name-nondirectory ;sans-extension
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
381 buffer-file-name)) ".tex"))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
382 (filename (if (equal (file-truename filename)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
383 (file-truename buffer-file-name))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
384 (concat filename ".tex")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
385 filename))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
386 (buffer (if to-buffer
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
387 (cond
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
388 ((eq to-buffer 'string) (get-buffer-create
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
389 "*Org LaTeX Export*"))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
390 (t (get-buffer-create to-buffer)))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
391 (find-file-noselect filename)))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
392 (odd org-odd-levels-only)
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
393 (header (org-export-latex-make-header title opt-plist))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
394 (skip (if subtree-p nil
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
395 ;; never skip first lines when exporting a subtree
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
396 (plist-get opt-plist :skip-before-1st-heading)))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
397 (text (plist-get opt-plist :text))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
398 (first-lines (if skip "" (org-export-latex-first-lines)))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
399 (coding-system (and (boundp 'buffer-file-coding-system)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
400 buffer-file-coding-system))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
401 (coding-system-for-write (or org-export-latex-coding-system
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
402 coding-system))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
403 (save-buffer-coding-system (or org-export-latex-coding-system
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
404 coding-system))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
405 (region (buffer-substring
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
406 (if region-p (region-beginning) (point-min))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
407 (if region-p (region-end) (point-max))))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
408 (string-for-export
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
409 (org-cleaned-string-for-export
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
410 region :emph-multiline t
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
411 :for-LaTeX t
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
412 :comments nil
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
413 :add-text (if (eq to-buffer 'string) nil text)
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
414 :skip-before-1st-heading skip
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
415 :LaTeX-fragments nil)))
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
416
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
417 (set-buffer buffer)
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
418 (erase-buffer)
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
419
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
420 (and (fboundp 'set-buffer-file-coding-system)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
421 (set-buffer-file-coding-system coding-system-for-write))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
422
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
423 ;; insert the header and initial document commands
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
424 (unless (or (eq to-buffer 'string) body-only)
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
425 (insert header))
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
426
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
427 ;; insert text found in #+TEXT
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
428 (when (and text (not (eq to-buffer 'string)))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
429 (insert (org-export-latex-content
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
430 text '(lists tables fixed-width keywords))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
431 "\n\n"))
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
432
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
433 ;; insert lines before the first headline
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
434 (unless (or skip (eq to-buffer 'string))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
435 (insert first-lines))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
436
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
437 ;; handle the case where the region does not begin with a section
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
438 (when region-p
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
439 (insert (with-temp-buffer
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
440 (insert string-for-export)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
441 (org-export-latex-first-lines))))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
442
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
443 ;; export the content of headlines
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
444 (org-export-latex-global
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
445 (with-temp-buffer
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
446 (insert string-for-export)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
447 (goto-char (point-min))
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
448 (when (re-search-forward "^\\(\\*+\\) " nil t)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
449 (let* ((asters (length (match-string 1)))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
450 (level (if odd (- asters 2) (- asters 1))))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
451 (setq org-export-latex-add-level
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
452 (if odd (1- (/ (1+ asters) 2)) (1- asters)))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
453 (org-export-latex-parse-global level odd)))))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
454
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
455 ;; finalization
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
456 (unless body-only (insert "\n\\end{document}"))
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
457 (or to-buffer (save-buffer))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
458 (goto-char (point-min))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
459 (message "Exporting to LaTeX...done")
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
460 (prog1
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
461 (if (eq to-buffer 'string)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
462 (prog1 (buffer-substring (point-min) (point-max))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
463 (kill-buffer (current-buffer)))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
464 (current-buffer))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
465 (set-window-configuration wcf))))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
466
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
467 ;;; Parsing functions:
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
468
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
469 (defun org-export-latex-parse-global (level odd)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
470 "Parse the current buffer recursively, starting at LEVEL.
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
471 If ODD is non-nil, assume the buffer only contains odd sections.
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
472 Return a list reflecting the document structure."
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
473 (save-excursion
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
474 (goto-char (point-min))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
475 (let* ((cnt 0) output
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
476 (depth org-export-latex-sectioning-depth))
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
477 (while (re-search-forward
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
478 (concat "^\\(\\(?:\\*\\)\\{"
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
479 (number-to-string (+ (if odd 2 1) level))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
480 "\\}\\) \\(.*\\)$")
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
481 ;; make sure that there is no upper heading
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
482 (when (> level 0)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
483 (save-excursion
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
484 (save-match-data
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
485 (re-search-forward
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
486 (concat "^\\(\\(?:\\*\\)\\{"
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
487 (number-to-string level)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
488 "\\}\\) \\(.*\\)$") nil t)))) t)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
489 (setq cnt (1+ cnt))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
490 (let* ((pos (match-beginning 0))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
491 (heading (match-string 2))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
492 (nlevel (if odd (/ (+ 3 level) 2) (1+ level))))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
493 (save-excursion
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
494 (narrow-to-region
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
495 (point)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
496 (save-match-data
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
497 (if (re-search-forward
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
498 (concat "^\\(\\(?:\\*\\)\\{"
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
499 (number-to-string (+ (if odd 2 1) level))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
500 "\\}\\) \\(.*\\)$") nil t)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
501 (match-beginning 0)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
502 (point-max))))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
503 (goto-char (point-min))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
504 (setq output
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
505 (append output
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
506 (list
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
507 (list
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
508 `(pos . ,pos)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
509 `(level . ,nlevel)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
510 `(occur . ,cnt)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
511 `(heading . ,heading)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
512 `(content . ,(org-export-latex-parse-content))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
513 `(subcontent . ,(org-export-latex-parse-subcontent
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
514 level odd)))))))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
515 (widen)))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
516 (list output))))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
517
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
518 (defun org-export-latex-parse-content ()
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
519 "Extract the content of a section."
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
520 (let ((beg (point))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
521 (end (if (re-search-forward "^\\(\\*\\)+ .*$" nil t)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
522 (progn (beginning-of-line) (point))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
523 (point-max))))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
524 (buffer-substring beg end)))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
525
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
526 (defun org-export-latex-parse-subcontent (level odd)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
527 "Extract the subcontent of a section at LEVEL.
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
528 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
529 (if (not (re-search-forward
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
530 (concat "^\\(\\(?:\\*\\)\\{"
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
531 (number-to-string (+ (if odd 4 2) level))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
532 "\\}\\) \\(.*\\)$")
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
533 nil t))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
534 nil ; subcontent is nil
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
535 (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
536
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
537 ;;; Rendering functions:
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
538 (defun org-export-latex-global (content)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
539 "Export CONTENT to LaTeX.
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
540 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
541 `org-export-latex-parse-global'."
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
542 (if (eq (car content) 'subcontent)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
543 (mapc 'org-export-latex-sub (cdr content))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
544 (org-export-latex-sub (car content))))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
545
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
546 (defun org-export-latex-sub (subcontent)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
547 "Export the list SUBCONTENT to LaTeX.
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
548 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
549 and its content."
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
550 (let ((num (plist-get org-export-latex-options-plist :section-numbers)))
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
551 (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
552
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
553 (defun org-export-latex-subcontent (subcontent num)
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
554 "Export each cell of SUBCONTENT to LaTeX."
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
555 (let ((heading (org-export-latex-fontify-headline
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
556 (cdr (assoc 'heading subcontent))))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
557 (level (- (cdr (assoc 'level subcontent))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
558 org-export-latex-add-level))
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
559 (occur (number-to-string (cdr (assoc 'occur subcontent))))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
560 (content (cdr (assoc 'content subcontent)))
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
561 (subcontent (cadr (assoc 'subcontent subcontent))))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
562 (cond
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
563 ;; Normal conversion
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
564 ((<= level org-export-latex-sectioning-depth)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
565 (let ((sec (nth (1- level) org-export-latex-sectioning)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
566 (insert (format (if num (car sec) (cdr sec)) heading) "\n"))
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
567 (insert (org-export-latex-content content))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
568 (cond ((stringp subcontent) (insert subcontent))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
569 ((listp subcontent) (org-export-latex-sub subcontent))))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
570 ;; At a level under the hl option: we can drop this subsection
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
571 ((> level org-export-latex-sectioning-depth)
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
572 (cond ((eq org-export-latex-low-levels 'description)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
573 (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
574 (insert (org-export-latex-content content))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
575 (cond ((stringp subcontent) (insert subcontent))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
576 ((listp subcontent) (org-export-latex-sub subcontent)))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
577 (insert "\\end{description}\n"))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
578 ((stringp org-export-latex-low-levels)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
579 (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
580 (insert (org-export-latex-content content))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
581 (cond ((stringp subcontent) (insert subcontent))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
582 ((listp subcontent) (org-export-latex-sub subcontent)))))))))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
583
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
584 ;;; Exporting internals:
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
585 (defun org-export-latex-set-initial-vars (ext-plist level)
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
586 "Store org local variables required for LaTeX export.
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
587 EXT-PLIST is an optional additional plist.
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
588 LEVEL indicates the default depth for export."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
589 (setq org-export-latex-todo-keywords-1 org-todo-keywords-1
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
590 org-export-latex-all-targets-re
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
591 (org-make-target-link-regexp (org-all-targets))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
592 org-export-latex-options-plist
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
593 (org-combine-plists (org-default-export-plist) ext-plist
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
594 (org-infile-export-plist))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
595 org-export-latex-class
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
596 (save-excursion
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
597 (goto-char (point-min))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
598 (if (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\([a-zA-Z]+\\)" nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
599 (assoc (match-string 1) org-export-latex-classes))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
600 (match-string 1)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
601 org-export-latex-default-class))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
602 org-export-latex-header
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
603 (cadr (assoc org-export-latex-class org-export-latex-classes))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
604 org-export-latex-sectioning
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
605 (cddr (assoc org-export-latex-class org-export-latex-classes))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
606 org-export-latex-sectioning-depth
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
607 (or level
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
608 (let ((hl-levels
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
609 (plist-get org-export-latex-options-plist :headline-levels))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
610 (sec-depth (length org-export-latex-sectioning)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
611 (if (> hl-levels sec-depth) sec-depth hl-levels)))))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
612
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
613 (defun org-export-latex-make-header (title opt-plist)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
614 "Make the LaTeX header and return it as a string.
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
615 TITLE is the current title from the buffer or region.
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
616 OPT-PLIST is the options plist for current buffer."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
617 (let ((toc (plist-get opt-plist :table-of-contents))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
618 (author (plist-get opt-plist :author)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
619 (concat
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
620 (if (plist-get opt-plist :time-stamp-file)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
621 (format-time-string "% Created %Y-%m-%d %a %H:%M\n"))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
622 ;; insert LaTeX custom header
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
623 org-export-latex-header
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
624 "\n"
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
625 ;; insert information on LaTeX packages
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
626 (when org-export-latex-packages-alist
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
627 (mapconcat (lambda(p)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
628 (if (equal "" (car p))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
629 (format "\\usepackage{%s}" (cadr p))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
630 (format "\\usepackage[%s]{%s}"
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
631 (car p) (cadr p))))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
632 org-export-latex-packages-alist "\n"))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
633 ;; insert additional commands in the header
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
634 org-export-latex-append-header
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
635 ;; insert the title
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
636 (format
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
637 "\n\n\\title{%s}\n"
85554
5b20f92e9f29 Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents: 85156
diff changeset
638 ;; convert the title
5b20f92e9f29 Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents: 85156
diff changeset
639 (org-export-latex-content
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
640 title '(lists tables fixed-width keywords)))
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
641 ;; insert author info
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
642 (if (plist-get opt-plist :author-info)
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
643 (format "\\author{%s}\n"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
644 (or author user-full-name))
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
645 (format "%%\\author{%s}\n"
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
646 (or author user-full-name)))
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
647 ;; insert the date
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
648 (format "\\date{%s}\n"
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
649 (format-time-string
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
650 (or (plist-get opt-plist :date)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
651 org-export-latex-date-format)))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
652 ;; beginning of the document
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
653 "\n\\begin{document}\n\n"
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
654 ;; insert the title command
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
655 (if (string-match "%s" org-export-latex-title-command)
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
656 (format org-export-latex-title-command title)
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
657 org-export-latex-title-command)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
658 "\n\n"
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
659 ;; table of contents
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
660 (when (and org-export-with-toc
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
661 (plist-get opt-plist :section-numbers))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
662 (cond ((numberp toc)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
663 (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\n"
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
664 (min toc (plist-get opt-plist :headline-levels))))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
665 (toc (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\n"
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
666 (plist-get opt-plist :headline-levels))))))))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
667
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
668 (defun org-export-latex-first-lines (&optional comments)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
669 "Export the first lines before first headline.
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
670 COMMENTS is either nil to replace them with the empty string or a
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
671 formatting string like %%%%s if we want to comment them out."
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
672 (save-excursion
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
673 (goto-char (point-min))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
674 (if (org-at-heading-p) (beginning-of-line 2))
85554
5b20f92e9f29 Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents: 85156
diff changeset
675 (let* ((pt (point))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
676 (end (if (and (re-search-forward "^\\* " nil t)
85554
5b20f92e9f29 Installed org-mode 5.13d
John Wiegley <johnw@newartisans.com>
parents: 85156
diff changeset
677 (not (eq pt (match-beginning 0))))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
678 (goto-char (match-beginning 0))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
679 (goto-char (point-max)))))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
680 (org-export-latex-content
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
681 (org-cleaned-string-for-export
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
682 (buffer-substring (point-min) end)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
683 :for-LaTeX t
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
684 :emph-multiline t
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
685 :add-text nil
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
686 :comments nil
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
687 :skip-before-1st-heading nil
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
688 :LaTeX-fragments nil)))))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
689
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
690 (defun org-export-latex-content (content &optional exclude-list)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
691 "Convert CONTENT string to LaTeX.
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
692 Don't perform conversions that are in EXCLUDE-LIST. Recognized
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
693 conversion types are: quotation-marks, emphasis, sub-superscript,
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
694 links, keywords, lists, tables, fixed-width"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
695 (with-temp-buffer
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
696 (insert content)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
697 (unless (memq 'quotation-marks exclude-list)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
698 (org-export-latex-quotation-marks))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
699 (unless (memq 'emphasis exclude-list)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
700 (when (plist-get org-export-latex-options-plist :emphasize)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
701 (org-export-latex-fontify)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
702 (unless (memq 'sub-superscript exclude-list)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
703 (org-export-latex-special-chars
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
704 (plist-get org-export-latex-options-plist :sub-superscript)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
705 (unless (memq 'links exclude-list)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
706 (org-export-latex-links))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
707 (unless (memq 'keywords exclude-list)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
708 (org-export-latex-keywords
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
709 (plist-get org-export-latex-options-plist :timestamps)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
710 (unless (memq 'lists exclude-list)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
711 (org-export-latex-lists))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
712 (unless (memq 'tables exclude-list)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
713 (org-export-latex-tables
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
714 (plist-get org-export-latex-options-plist :tables)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
715 (unless (memq 'fixed-width exclude-list)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
716 (org-export-latex-fixed-width
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
717 (plist-get org-export-latex-options-plist :fixed-width)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
718 ;; return string
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
719 (buffer-substring (point-min) (point-max))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
720
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
721 (defun org-export-latex-protect-string (s)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
722 "Prevent further conversion for string S by adding the
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
723 org-protect property."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
724 (add-text-properties 0 (length s) '(org-protected t) s) s)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
725
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
726 (defun org-export-latex-protect-char-in-string (char-list string)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
727 "Add org-protected text-property to char from CHAR-LIST in STRING."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
728 (with-temp-buffer
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
729 (save-match-data
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
730 (insert string)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
731 (goto-char (point-min))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
732 (while (re-search-forward (regexp-opt char-list) nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
733 (add-text-properties (match-beginning 0)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
734 (match-end 0) '(org-protected t)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
735 (buffer-string))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
736
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
737 (defun org-export-latex-keywords-maybe (remove-list)
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
738 "Maybe remove keywords depending on rules in REMOVE-LIST."
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
739 (goto-char (point-min))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
740 (let ((re-todo (mapconcat 'identity org-export-latex-todo-keywords-1 "\\|"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
741 (case-fold-search nil))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
742 ;; convert TODO keywords
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
743 (when (re-search-forward (concat "^\\(" re-todo "\\)") nil t)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
744 (if (plist-get remove-list :todo)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
745 (replace-match "")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
746 (replace-match (format "\\texttt{%s}" (match-string 1)) t t)))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
747 ;; convert priority string
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
748 (when (re-search-forward "\\[\\\\#.\\]" nil t)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
749 (if (plist-get remove-list :priority)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
750 (replace-match "")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
751 (replace-match (format "\\texttt{%s}" (match-string 0)) t t)))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
752 ;; convert tags
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
753 (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
754 (if (or (not org-export-with-tags)
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
755 (plist-get remove-list :tags))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
756 (replace-match "")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
757 (replace-match (format "\\texttt{%s}" (match-string 0)) t t)))))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
758
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
759 (defun org-export-latex-fontify-headline (string)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
760 "Fontify special words in string."
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
761 (with-temp-buffer
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
762 ;; FIXME: org-inside-LaTeX-fragment-p doesn't work when the $...$ is at
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
763 ;; the beginning of the buffer - inserting "\n" is safe here though.
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
764 (insert "\n" string)
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
765 (goto-char (point-min))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
766 (when (plist-get org-export-latex-options-plist :emphasize)
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
767 (org-export-latex-fontify))
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
768 (org-export-latex-special-chars
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
769 (plist-get org-export-latex-options-plist :sub-superscript))
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
770 (org-export-latex-keywords-maybe
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
771 org-export-latex-remove-from-headlines)
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
772 (org-export-latex-links)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
773 (org-trim (buffer-substring-no-properties (point-min) (point-max)))))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
774
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
775 (defun org-export-latex-quotation-marks ()
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
776 "Export question marks depending on language conventions."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
777 (let* ((lang (plist-get org-export-latex-options-plist :language))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
778 (quote-rpl (if (equal lang "fr")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
779 '(("\\(\\s-\\)\"" "«~")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
780 ("\\(\\S-\\)\"" "~»")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
781 ("\\(\\s-\\)'" "`"))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
782 '(("\\(\\s-\\)\"" "``")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
783 ("\\(\\S-\\)\"" "''")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
784 ("\\(\\s-\\)'" "`")))))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
785 (mapc (lambda(l) (goto-char (point-min))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
786 (while (re-search-forward (car l) nil t)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
787 (let ((rpl (concat (match-string 1) (cadr l))))
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
788 (org-export-latex-protect-string rpl)
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
789 (org-if-unprotected
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
790 (replace-match rpl t t))))) quote-rpl)))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
791
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
792 (defun org-export-latex-special-chars (sub-superscript)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
793 "Export special characters to LaTeX.
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
794 If SUB-SUPERSCRIPT is non-nil, convert \\ and ^.
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
795 See the `org-export-latex.el' code for a complete conversion table."
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
796 (goto-char (point-min))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
797 (mapc (lambda(c)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
798 (goto-char (point-min))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
799 (while (re-search-forward c nil t)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
800 ;; Put the point where to check for org-protected
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
801 (unless (or (get-text-property (match-beginning 2) 'org-protected)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
802 (org-at-table-p))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
803 (cond ((member (match-string 2) '("\\$" "$"))
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
804 (if (equal (match-string 2) "\\$")
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
805 (replace-match (concat (match-string 1) "$"
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
806 (match-string 3)) t t)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
807 (replace-match (concat (match-string 1) "\\$"
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
808 (match-string 3)) t t)))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
809 ((member (match-string 2) '("&" "%" "#"))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
810 (if (equal (match-string 1) "\\")
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
811 (replace-match (match-string 2) t t)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
812 (replace-match (concat (match-string 1) "\\"
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
813 (match-string 2)) t t)))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
814 ((equal (match-string 2) "...")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
815 (replace-match
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
816 (concat (match-string 1)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
817 (org-export-latex-protect-string "\\ldots{}")) t t))
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
818 ((equal (match-string 2) "~")
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
819 (cond ((equal (match-string 1) "\\") nil)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
820 ((eq 'org-link (get-text-property 0 'face (match-string 2)))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
821 (replace-match (concat (match-string 1) "\\~") t t))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
822 (t (replace-match
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
823 (org-export-latex-protect-string
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
824 (concat (match-string 1) "\\~{}")) t t))))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
825 ((member (match-string 2) '("{" "}"))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
826 (unless (save-match-data (org-inside-LaTeX-fragment-p))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
827 (if (equal (match-string 1) "\\")
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
828 (replace-match (match-string 2) t t)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
829 (replace-match (concat (match-string 1) "\\"
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
830 (match-string 2)) t t)))))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
831 (unless (save-match-data (org-inside-LaTeX-fragment-p))
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
832 (cond ((equal (match-string 2) "\\")
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
833 (replace-match (or (save-match-data
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
834 (org-export-latex-treat-backslash-char
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
835 (match-string 1)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
836 (match-string 3))) "") t t))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
837 ((member (match-string 2) '("_" "^"))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
838 (replace-match (or (save-match-data
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
839 (org-export-latex-treat-sub-super-char
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
840 sub-superscript
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
841 (match-string 1)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
842 (match-string 2)
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
843 (match-string 3))) "") t t)))))))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
844 '("^\\([^\n$]*?\\|^\\)\\(\\\\?\\$\\)\\([^\n$]*\\)$"
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
845 "\\([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
846 "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|[a-zA-Z&#%{}\"]+\\)"
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
847 "\\(.\\|^\\)\\(&\\)"
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
848 "\\(.\\|^\\)\\(#\\)"
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
849 "\\(.\\|^\\)\\(%\\)"
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
850 "\\(.\\|^\\)\\({\\)"
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
851 "\\(.\\|^\\)\\(}\\)"
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
852 "\\(.\\|^\\)\\(~\\)"
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
853 "\\(.\\|^\\)\\(\\.\\.\\.\\)"
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
854 ;; (?\< . "\\textless{}")
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
855 ;; (?\> . "\\textgreater{}")
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
856 )))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
857
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
858 (defun org-export-latex-treat-sub-super-char
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
859 (subsup string-before char string-after)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
860 "Convert the \"_\" and \"^\" characters to LaTeX.
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
861 SUBSUP corresponds to the ^: option in the #+OPTIONS line.
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
862 Convert CHAR depending on STRING-BEFORE and STRING-AFTER."
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
863 (cond ((equal string-before "\\")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
864 (concat string-before char string-after))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
865 ;; this is part of a math formula
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
866 ((and (string-match "\\S-+" string-before)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
867 (string-match "\\S-+" string-after))
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
868 (cond ((eq 'org-link (get-text-property 0 'face char))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
869 (concat string-before "\\" char string-after))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
870 ((save-match-data (org-inside-LaTeX-fragment-p))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
871 (if subsup
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
872 (cond ((eq 1 (length string-after))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
873 (concat string-before char string-after))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
874 ((string-match "[({]?\\([^)}]+\\)[)}]?" string-after)
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
875 (format "%s%s{%s}" string-before char
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
876 (match-string 1 string-after))))))
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
877 ((and subsup
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
878 (> (length string-after) 1)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
879 (string-match "[({]?\\([^)}]+\\)[)}]?" string-after))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
880 (format "$%s%s{%s}$" string-before char
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
881 (match-string 1 string-after)))
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
882 (subsup (concat "$" string-before char string-after "$"))
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
883 (t (org-export-latex-protect-string
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
884 (concat string-before "\\" char "{}" string-after)))))
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
885 (t (org-export-latex-protect-string
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
886 (concat string-before "\\" char "{}" string-after)))))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
887
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
888 (defun org-export-latex-treat-backslash-char (string-before string-after)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
889 "Convert the \"$\" special character to LaTeX.
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
890 The conversion is made depending of STRING-BEFORE and STRING-AFTER."
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
891 (cond ((member (list string-after) org-html-entities)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
892 ;; backslash is part of a special entity (like "\alpha")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
893 (concat string-before "$\\"
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
894 (or (cdar (member (list string-after) org-html-entities))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
895 string-after) "$"))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
896 ((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
897 (not (string-match "[ \t]\\'\\|^" string-before)))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
898 ;; backslash is inside a word
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
899 (org-export-latex-protect-string
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
900 (concat string-before "\\textbackslash{}" string-after)))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
901 ((not (or (equal string-after "")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
902 (string-match "^[ \t\n]" string-after)))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
903 ;; backslash might escape a character (like \#) or a user TeX
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
904 ;; macro (like \setcounter)
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
905 (org-export-latex-protect-string
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
906 (concat string-before "\\" string-after)))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
907 ((and (string-match "^[ \t\n]" string-after)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
908 (string-match "[ \t\n]\\'" string-before))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
909 ;; backslash is alone, convert it to $\backslash$
85153
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
910 (org-export-latex-protect-string
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
911 (concat string-before "\\textbackslash{}" string-after)))
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
912 (t (org-export-latex-protect-string
c3969e15712b Installed version 5.11b of org-mode
John Wiegley <johnw@newartisans.com>
parents: 84933
diff changeset
913 (concat string-before "\\textbackslash{}" string-after)))))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
914
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
915 (defun org-export-latex-keywords (timestamps)
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
916 "Convert special keywords to LaTeX.
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
917 Regexps are those from `org-export-latex-special-string-regexps'."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
918 (let ((rg org-export-latex-special-string-regexps) r)
84384
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
919 (while (setq r (pop rg))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
920 (goto-char (point-min))
a32093d94b4a Updated to org-mode 5.08
John Wiegley <johnw@newartisans.com>
parents: 83725
diff changeset
921 (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
922 (if (not timestamps)
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
923 (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
924 (replace-match ""))))))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
925
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
926 (defun org-export-latex-fixed-width (opt)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
927 "When OPT is non-nil convert fixed-width sections to LaTeX."
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
928 (goto-char (point-min))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
929 (while (re-search-forward "^[ \t]*:" nil t)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
930 (if opt
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
931 (progn (goto-char (match-beginning 0))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
932 (insert "\\begin{verbatim}\n")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
933 (while (looking-at "^\\([ \t]*\\):\\(.*\\)$")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
934 (replace-match (concat (match-string 1)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
935 (match-string 2)) t t)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
936 (forward-line))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
937 (insert "\\end{verbatim}\n\n"))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
938 (progn (goto-char (match-beginning 0))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
939 (while (looking-at "^\\([ \t]*\\):\\(.*\\)$")
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
940 (replace-match (concat "%" (match-string 1)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
941 (match-string 2)) t t)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
942 (forward-line))))))
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
943
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
944 (defun org-export-latex-tables (insert)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
945 "Convert tables to LaTeX and INSERT it."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
946 (goto-char (point-min))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
947 (while (re-search-forward "^\\([ \t]*\\)|" nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
948 ;; FIXME really need to save-excursion?
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
949 (save-excursion (org-table-align))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
950 (let* ((beg (org-table-begin))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
951 (end (org-table-end))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
952 (raw-table (buffer-substring-no-properties beg end))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
953 fnum fields line lines olines gr colgropen line-fmt align)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
954 (if org-export-latex-tables-verbatim
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
955 (let* ((tbl (concat "\\begin{verbatim}\n" raw-table
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
956 "\\end{verbatim}\n")))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
957 (apply 'delete-region (list beg end))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
958 (insert tbl))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
959 (progn
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
960 (setq lines (split-string raw-table "\n" t))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
961 (apply 'delete-region (list beg end))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
962 (when org-export-table-remove-special-lines
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
963 (setq lines (org-table-clean-before-export lines)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
964 ;; make a formatting string to reflect aligment
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
965 (setq olines lines)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
966 (while (and (not line-fmt) (setq line (pop olines)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
967 (unless (string-match "^[ \t]*|-" line)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
968 (setq fields (org-split-string line "[ \t]*|[ \t]*"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
969 (setq fnum (make-vector (length fields) 0))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
970 (setq line-fmt
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
971 (mapconcat
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
972 (lambda (x)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
973 (setq gr (pop org-table-colgroup-info))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
974 (format "%s%%s%s"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
975 (cond ((eq gr ':start)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
976 (prog1 (if colgropen "|" "")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
977 (setq colgropen t)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
978 ((eq gr ':startend)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
979 (prog1 (if colgropen "|" "|")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
980 (setq colgropen nil)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
981 (t ""))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
982 (if (memq gr '(:end :startend))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
983 (progn (setq colgropen nil) "|")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
984 "")))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
985 fnum ""))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
986 ;; fix double || in line-fmt
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
987 (setq line-fmt (replace-regexp-in-string "||" "|" line-fmt))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
988 ;; maybe remove the first and last "|"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
989 (when (and (not org-export-latex-tables-column-borders)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
990 (string-match "^\\(|\\)?\\(.+\\)|$" line-fmt))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
991 (setq line-fmt (match-string 2 line-fmt)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
992 ;; format alignment
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
993 (setq align (apply 'format
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
994 (cons line-fmt
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
995 (mapcar (lambda (x) (if x "r" "l"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
996 org-table-last-alignment))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
997 ;; prepare the table to send to orgtbl-to-latex
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
998 (setq lines
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
999 (mapcar
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1000 (lambda(elem)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1001 (or (and (string-match "[ \t]*|-+" elem) 'hline)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1002 (split-string (org-trim elem) "|" t)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1003 lines))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1004 (when insert
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1005 (insert (orgtbl-to-latex
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1006 lines `(:tstart ,(concat "\\begin{tabular}{" align "}")))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1007 "\n\n")))))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1008
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1009 (defun org-export-latex-fontify ()
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1010 "Convert fontification to LaTeX."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1011 (goto-char (point-min))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1012 (while (re-search-forward org-emph-re nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1013 ;; The match goes one char after the *string*
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1014 (let ((emph (assoc (match-string 3)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1015 org-export-latex-emphasis-alist))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1016 rpl)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1017 (unless (get-text-property (1- (point)) 'org-protected)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1018 (setq rpl (concat (match-string 1)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1019 (format (org-export-latex-protect-char-in-string
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1020 '("\\" "{" "}") (cadr emph))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1021 (match-string 4))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1022 (match-string 5)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1023 (if (caddr emph)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1024 (setq rpl (org-export-latex-protect-string rpl)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1025 (replace-match rpl t t)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1026 (backward-char)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1027
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1028 (defun org-export-latex-links ()
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1029 ;; Make sure to use the LaTeX hyperref and graphicx package
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1030 ;; or send some warnings.
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1031 "Convert links to LaTeX."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1032 (goto-char (point-min))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1033 (while (re-search-forward org-bracket-link-analytic-regexp nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1034 (org-if-unprotected
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1035 (goto-char (match-beginning 0))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1036 (let* ((re-radio org-export-latex-all-targets-re)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1037 (remove (list (match-beginning 0) (match-end 0)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1038 (type (match-string 2))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1039 (raw-path (match-string 3))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1040 (full-raw-path (concat (match-string 1) raw-path))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1041 (desc (match-string 5))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1042 imgp radiop
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1043 ;; define the path of the link
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1044 (path (cond
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1045 ((member type '("http" "https" "ftp"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1046 (concat type ":" raw-path))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1047 ((and re-radio (string-match re-radio raw-path))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1048 (setq radiop t))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1049 ((equal type "mailto")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1050 (concat type ":" raw-path))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1051 ((equal type "file")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1052 (if (and (or (org-file-image-p (expand-file-name raw-path))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1053 (string-match "\\.eps$" raw-path))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1054 (equal desc full-raw-path))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1055 (setq imgp t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1056 (progn (when (string-match "\\(.+\\)::.+" raw-path)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1057 (setq raw-path (match-string 1 raw-path)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1058 (if (file-exists-p raw-path)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1059 (concat type "://" (expand-file-name raw-path))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1060 (concat type "://" (org-export-directory
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1061 :LaTeX org-export-latex-options-plist)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1062 raw-path))))))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1063 ;; process with link inserting
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1064 (apply 'delete-region remove)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1065 (cond ((and imgp (plist-get org-export-latex-options-plist :inline-images))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1066 (insert (format "\\includegraphics[%s]{%s}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1067 ;; image option should be set be a comment line
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1068 org-export-latex-image-default-option
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1069 (expand-file-name raw-path))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1070 (radiop (insert (format "\\hyperref[%s]{%s}" raw-path desc)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1071 (path (insert (format "\\href{%s}{%s}" path desc)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1072 (t (insert "\\texttt{" desc "}")))))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1073
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1074 (defvar org-latex-entities) ; defined below
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1075
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1076 (defun org-export-latex-cleaned-string ()
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1077 "Clean stuff in the LaTeX export."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1078
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1079 ;; Preserve line breaks
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1080 (goto-char (point-min))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1081 (while (re-search-forward "\\\\\\\\" nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1082 (add-text-properties (match-beginning 0) (match-end 0)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1083 '(org-protected t)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1084
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1085 ;; Convert LaTeX to \LaTeX{}
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1086 (goto-char (point-min))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1087 (let ((case-fold-search nil) rpl)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1088 (while (re-search-forward "\\([^+_]\\)LaTeX" nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1089 (replace-match (org-export-latex-protect-string
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1090 (concat (match-string 1) "\\LaTeX{}")) t t)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1091
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1092 ;; Convert horizontal rules
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1093 (goto-char (point-min))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1094 (while (re-search-forward "^----+.$" nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1095 (replace-match (org-export-latex-protect-string "\\hrule") t t))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1096
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1097 ;; Protect LaTeX commands like \commad[...]{...} or \command{...}
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1098 (goto-char (point-min))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1099 (while (re-search-forward "\\\\[a-zA-Z]+\\(?:\\[.*\\]\\)?{.*}" nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1100 (add-text-properties (match-beginning 0) (match-end 0)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1101 '(org-protected t)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1102
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1103 ;; Protect LaTeX entities
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1104 (goto-char (point-min))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1105 (while (re-search-forward (regexp-opt org-latex-entities) nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1106 (add-text-properties (match-beginning 0) (match-end 0)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1107 '(org-protected t)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1108
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1109 ;; Replace radio links
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1110 (goto-char (point-min))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1111 (while (re-search-forward
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1112 (concat "<<<?" org-export-latex-all-targets-re
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1113 ">>>?\\((INVISIBLE)\\)?") nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1114 (replace-match
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1115 (org-export-latex-protect-string
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1116 (format "\\label{%s}%s"(match-string 1)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1117 (if (match-string 2) "" (match-string 1)))) t t))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1118
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1119 ;; Delete @<...> constructs
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1120 (goto-char (point-min))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1121 ;; Thanks to Daniel Clemente for this regexp
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1122 (while (re-search-forward "@<\\(?:[^\"\n]\\|\".*\"\\)*?>" nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1123 (replace-match ""))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1124
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1125 ;; When converting to LaTeX, replace footnotes
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1126 ;; FIXME: don't protect footnotes from conversion
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1127 (when (plist-get org-export-latex-options-plist :footnotes)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1128 (goto-char (point-min))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1129 (while (re-search-forward "\\[[0-9]+\\]" nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1130 (when (save-match-data
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1131 (save-excursion (beginning-of-line)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1132 (looking-at "[^:|#]")))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1133 (let ((foot-beg (match-beginning 0))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1134 (foot-end (match-end 0))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1135 (foot-prefix (match-string 0))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1136 footnote footnote-rpl)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1137 (save-excursion
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1138 (when (search-forward foot-prefix nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1139 (replace-match "")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1140 (let ((end (save-excursion
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1141 (if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1142 (match-beginning 0) (point-max)))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1143 (setq footnote (concat (org-trim (buffer-substring (point) end))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1144 " ")) ; prevent last } being part of a link
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1145 (delete-region (point) end))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1146 (goto-char foot-beg)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1147 (delete-region foot-beg foot-end)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1148 (unless (null footnote)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1149 (setq footnote-rpl (format "\\footnote{%s}" footnote))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1150 (add-text-properties 0 10 '(org-protected t) footnote-rpl)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1151 (add-text-properties (1- (length footnote-rpl))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1152 (length footnote-rpl)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1153 '(org-protected t) footnote-rpl)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1154 (insert footnote-rpl)))))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1155
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1156 ;; Replace footnote section tag for LaTeX
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1157 (goto-char (point-min))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1158 (while (re-search-forward
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1159 (concat "^" footnote-section-tag-regexp) nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1160 (replace-match ""))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1161
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1162 ;;; List handling:
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1163
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1164 (defun org-export-latex-lists ()
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1165 "Replace plain text lists in current buffer into LaTeX lists."
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1166 "Convert lists to LaTeX."
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1167 (goto-char (point-min))
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1168 (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
1169 (beginning-of-line)
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1170 (insert (org-list-to-latex (org-list-parse-list t)) "\n")))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1171
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1172 (defun org-list-parse-list (&optional delete)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1173 "Parse the list at point.
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1174 Return a list containing first level items as strings and
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1175 sublevels as a list of strings."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1176 (let ((start (org-list-item-begin))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1177 (end (org-list-end))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1178 output itemsep)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1179 (while (re-search-forward org-export-latex-list-beginning-re end t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1180 (setq itemsep (if (save-match-data
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1181 (string-match "^[0-9]" (match-string 2)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1182 "[0-9]+\\(?:\\.\\|)\\)" "[-+]"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1183 (let* ((indent1 (match-string 1))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1184 (nextitem (save-excursion
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1185 (save-match-data
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1186 (or (and (re-search-forward
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1187 (concat "^" indent1 itemsep " *?") end t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1188 (match-beginning 0)) end))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1189 (item (buffer-substring
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1190 (point)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1191 (or (and (re-search-forward
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1192 org-export-latex-list-beginning-re end t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1193 (goto-char (match-beginning 0)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1194 (goto-char end))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1195 (nextindent (match-string 1))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1196 (item (org-trim item))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1197 (item (if (string-match "^\\[.+\\]" item)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1198 (replace-match "\\\\texttt{\\&}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1199 t nil item) item)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1200 (push item output)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1201 (when (> (length nextindent)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1202 (length indent1))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1203 (narrow-to-region (point) nextitem)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1204 (push (org-list-parse-list) output)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1205 (widen))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1206 (when delete (delete-region start end))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1207 (setq output (nreverse output))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1208 (push (if (string-match "^\\[0" itemsep)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1209 'ordered 'unordered) output)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1210
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1211 (defun org-list-item-begin ()
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1212 "Find the beginning of the list item and return its position."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1213 (save-excursion
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1214 (if (not (or (looking-at org-export-latex-list-beginning-re)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1215 (re-search-backward
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1216 org-export-latex-list-beginning-re nil t)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1217 (progn (goto-char (point-min)) (point))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1218 (match-beginning 0))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1219
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1220 (defun org-list-end ()
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1221 "Find the end of the list and return its position."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1222 (save-excursion
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1223 (catch 'exit
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1224 (while (or (looking-at org-export-latex-list-beginning-re)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1225 (looking-at "^[ \t]+\\|^$"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1226 (if (eq (point) (point-max))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1227 (throw 'exit (point-max)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1228 (forward-line 1))) (point)))
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1229
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1230 (defun org-list-insert-radio-list ()
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1231 "Insert a radio list template appropriate for this major mode."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1232 (interactive)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1233 (let* ((e (assq major-mode org-list-radio-list-templates))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1234 (txt (nth 1 e))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1235 name pos)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1236 (unless e (error "No radio list setup defined for %s" major-mode))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1237 (setq name (read-string "List name: "))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1238 (while (string-match "%n" txt)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1239 (setq txt (replace-match name t t txt)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1240 (or (bolp) (insert "\n"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1241 (setq pos (point))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1242 (insert txt)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1243 (goto-char pos)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1244
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1245 (defun org-list-send-list (&optional maybe)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1246 "Send a tranformed version of this list to the receiver position.
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1247 With argument MAYBE, fail quietly if no transformation is defined for
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1248 this list."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1249 (interactive)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1250 (catch 'exit
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1251 (unless (org-at-item-p) (error "Not at a list"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1252 (save-excursion
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1253 (goto-char (org-list-item-begin))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1254 (beginning-of-line 0)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1255 (unless (looking-at "#\\+ORGLST: *SEND +\\([a-zA-Z0-9_]+\\) +\\([^ \t\r\n]+\\)\\( +.*\\)?")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1256 (if maybe
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1257 (throw 'exit nil)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1258 (error "Don't know how to transform this list"))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1259 (let* ((name (match-string 1))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1260 beg
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1261 (transform (intern (match-string 2)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1262 (txt (buffer-substring-no-properties
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1263 (org-list-item-begin)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1264 (org-list-end)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1265 (list (org-list-parse-list)))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1266 (unless (fboundp transform)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1267 (error "No such transformation function %s" transform))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1268 (setq txt (funcall transform list))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1269 ;; Find the insertion place
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1270 (save-excursion
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1271 (goto-char (point-min))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1272 (unless (re-search-forward
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1273 (concat "BEGIN RECEIVE ORGLST +" name "\\([ \t]\\|$\\)") nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1274 (error "Don't know where to insert translated list"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1275 (goto-char (match-beginning 0))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1276 (beginning-of-line 2)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1277 (setq beg (point))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1278 (unless (re-search-forward (concat "END RECEIVE ORGLST +" name) nil t)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1279 (error "Cannot find end of insertion region"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1280 (beginning-of-line 1)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1281 (delete-region beg (point))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1282 (goto-char beg)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1283 (insert txt "\n"))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1284 (message "List converted and installed at receiver location"))))
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1285
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1286 (defun org-list-to-generic (list params)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1287 "Convert a LIST parsed through `org-list-parse-list' to other formats.
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1288
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1289 Valid parameters are
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1290
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1291 :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
1292 :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
1293
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1294 :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
1295 :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
1296
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1297 :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
1298 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
1299
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1300 :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
1301 :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
1302 :isep String to separate items
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1303 :lsep String to separate sublists"
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1304 (interactive)
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1305 (let* ((p params) sublist
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1306 (splicep (plist-get p :splice))
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1307 (ostart (plist-get p :ostart))
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1308 (oend (plist-get p :oend))
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1309 (ustart (plist-get p :ustart))
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1310 (uend (plist-get p :uend))
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1311 (istart (plist-get p :istart))
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1312 (iend (plist-get p :iend))
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1313 (isep (plist-get p :isep))
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1314 (lsep (plist-get p :lsep)))
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1315 (let ((wrapper
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1316 (cond ((eq (car list) 'ordered)
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1317 (concat ostart "\n%s" oend "\n"))
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1318 ((eq (car list) 'unordered)
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1319 (concat ustart "\n%s" uend "\n"))))
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1320 rtn)
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1321 (while (setq sublist (pop list))
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1322 (cond ((symbolp sublist) nil)
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1323 ((stringp sublist)
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1324 (setq rtn (concat rtn istart sublist iend isep)))
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1325 (t
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1326 (setq rtn (concat rtn ;; previous list
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1327 lsep ;; list separator
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1328 (org-list-to-generic sublist p)
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1329 lsep ;; list separator
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1330 )))))
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1331 (format wrapper rtn))))
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1332
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1333 (defun org-list-to-latex (list)
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1334 "Convert LIST into a LaTeX list."
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1335 (org-list-to-generic
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1336 list '(:splicep nil :ostart "\\begin{enumerate}" :oend "\\end{enumerate}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1337 :ustart "\\begin{itemize}" :uend "\\end{itemize}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1338 :istart "\\item " :iend ""
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1339 :isep "\n" :lsep "\n")))
84933
d6e2d9d9924a 2007-09-26 Bastien Guerry <bzg@altern.org>
John Wiegley <johnw@newartisans.com>
parents: 84394
diff changeset
1340
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1341 (defun org-list-to-html (list)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1342 "Convert LIST into a HTML list."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1343 (org-list-to-generic
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1344 list '(:splicep nil :ostart "<ol>" :oend "</ol>"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1345 :ustart "<ul>" :uend "</ul>"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1346 :istart "<li>" :iend "</li>"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1347 :isep "\n" :lsep "\n")))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1348
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1349 (defun org-list-to-texinfo (list)
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1350 "Convert LIST into a Texinfo list."
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1351 (org-list-to-generic
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1352 list '(:splicep nil :ostart "@itemize @minus" :oend "@end itemize"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1353 :ustart "@enumerate" :uend "@end enumerate"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1354 :istart "@item\n" :iend ""
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1355 :isep "\n" :lsep "\n")))
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1356
87834
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1357 (defconst org-latex-entities
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1358 '("\\!"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1359 "\\'"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1360 "\\+"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1361 "\\,"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1362 "\\-"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1363 "\\:"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1364 "\\;"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1365 "\\<"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1366 "\\="
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1367 "\\>"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1368 "\\Huge"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1369 "\\LARGE"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1370 "\\Large"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1371 "\\Styles"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1372 "\\\\"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1373 "\\`"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1374 "\\addcontentsline"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1375 "\\address"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1376 "\\addtocontents"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1377 "\\addtocounter"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1378 "\\addtolength"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1379 "\\addvspace"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1380 "\\alph"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1381 "\\appendix"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1382 "\\arabic"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1383 "\\author"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1384 "\\begin{array}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1385 "\\begin{center}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1386 "\\begin{description}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1387 "\\begin{enumerate}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1388 "\\begin{eqnarray}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1389 "\\begin{equation}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1390 "\\begin{figure}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1391 "\\begin{flushleft}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1392 "\\begin{flushright}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1393 "\\begin{itemize}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1394 "\\begin{list}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1395 "\\begin{minipage}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1396 "\\begin{picture}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1397 "\\begin{quotation}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1398 "\\begin{quote}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1399 "\\begin{tabbing}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1400 "\\begin{table}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1401 "\\begin{tabular}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1402 "\\begin{thebibliography}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1403 "\\begin{theorem}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1404 "\\begin{titlepage}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1405 "\\begin{verbatim}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1406 "\\begin{verse}"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1407 "\\bf"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1408 "\\bf"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1409 "\\bibitem"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1410 "\\bigskip"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1411 "\\cdots"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1412 "\\centering"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1413 "\\circle"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1414 "\\cite"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1415 "\\cleardoublepage"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1416 "\\clearpage"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1417 "\\cline"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1418 "\\closing"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1419 "\\dashbox"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1420 "\\date"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1421 "\\ddots"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1422 "\\dotfill"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1423 "\\em"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1424 "\\fbox"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1425 "\\flushbottom"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1426 "\\fnsymbol"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1427 "\\footnote"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1428 "\\footnotemark"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1429 "\\footnotesize"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1430 "\\footnotetext"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1431 "\\frac"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1432 "\\frame"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1433 "\\framebox"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1434 "\\hfill"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1435 "\\hline"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1436 "\\hrulespace"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1437 "\\hspace"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1438 "\\huge"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1439 "\\hyphenation"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1440 "\\include"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1441 "\\includeonly"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1442 "\\indent"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1443 "\\input"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1444 "\\it"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1445 "\\kill"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1446 "\\label"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1447 "\\large"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1448 "\\ldots"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1449 "\\line"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1450 "\\linebreak"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1451 "\\linethickness"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1452 "\\listoffigures"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1453 "\\listoftables"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1454 "\\location"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1455 "\\makebox"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1456 "\\maketitle"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1457 "\\mark"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1458 "\\mbox"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1459 "\\medskip"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1460 "\\multicolumn"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1461 "\\multiput"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1462 "\\newcommand"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1463 "\\newcounter"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1464 "\\newenvironment"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1465 "\\newfont"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1466 "\\newlength"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1467 "\\newline"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1468 "\\newpage"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1469 "\\newsavebox"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1470 "\\newtheorem"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1471 "\\nocite"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1472 "\\nofiles"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1473 "\\noindent"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1474 "\\nolinebreak"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1475 "\\nopagebreak"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1476 "\\normalsize"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1477 "\\onecolumn"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1478 "\\opening"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1479 "\\oval"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1480 "\\overbrace"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1481 "\\overline"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1482 "\\pagebreak"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1483 "\\pagenumbering"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1484 "\\pageref"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1485 "\\pagestyle"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1486 "\\par"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1487 "\\parbox"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1488 "\\put"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1489 "\\raggedbottom"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1490 "\\raggedleft"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1491 "\\raggedright"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1492 "\\raisebox"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1493 "\\ref"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1494 "\\rm"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1495 "\\roman"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1496 "\\rule"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1497 "\\savebox"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1498 "\\sc"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1499 "\\scriptsize"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1500 "\\setcounter"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1501 "\\setlength"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1502 "\\settowidth"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1503 "\\sf"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1504 "\\shortstack"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1505 "\\signature"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1506 "\\sl"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1507 "\\small"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1508 "\\smallskip"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1509 "\\sqrt"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1510 "\\tableofcontents"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1511 "\\telephone"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1512 "\\thanks"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1513 "\\thispagestyle"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1514 "\\tiny"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1515 "\\title"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1516 "\\tt"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1517 "\\twocolumn"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1518 "\\typein"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1519 "\\typeout"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1520 "\\underbrace"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1521 "\\underline"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1522 "\\usebox"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1523 "\\usecounter"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1524 "\\value"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1525 "\\vdots"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1526 "\\vector"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1527 "\\verb"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1528 "\\vfill"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1529 "\\vline"
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1530 "\\vspace")
b7acc6fad5a9 (org-export-latex-cleaned-string): Fixed.
Carsten Dominik <dominik@science.uva.nl>
parents: 87665
diff changeset
1531 "A list of LaTeX commands to be protected when performing conversion.")
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1532
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1533 (provide 'org-export-latex)
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1534
84394
380656116258 * textmodes/org-export-latex.el: arch-tag restored.
Carsten Dominik <dominik@science.uva.nl>
parents: 84384
diff changeset
1535 ;; arch-tag: 23c2b87d-da04-4c2d-ad2d-1eb6487bc3ad
82752
b0315a14fb58 New file
Carsten Dominik <dominik@science.uva.nl>
parents:
diff changeset
1536 ;;; org-export-latex.el ends here