comparison lisp/org/org-latex.el @ 104810:86b7fe7d1d8f

2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org-protocol.el (org-protocol-store-link) (org-protocol-remember, org-protocol-open-source): Add autoloads. * org-compat.el (org-float-time): New function. * org.el (org-clock-update-time-maybe) (org-sort-entries-or-items, org-do-sort) (org-evaluate-time-range, org-time-string-to-seconds) (org-closed-in-range): Use `org-float-time'. * org-timer.el (org-timer-start, org-timer-pause-or-continue) (org-timer-seconds): Use `org-float-time'. * org-clock.el (org-clock-get-clocked-time, org-clock-out) (org-clock-sum, org-dblock-write:clocktable) (org-clocktable-steps): Use `org-float-time'. * org-agenda.el (org-agenda-last-marker-time) (org-agenda-new-marker, org-diary): Use `org-float-time'. * org-compat.el (w32-focus-frame): Declare the w32-focus-frame function. * org-exp.el (org-get-file-contents): Only protect lines that really need it. * org-html.el (require): Require cl for compilation. * org.el: Avoid using `default-major-mode'. * org-plot.el (require): Require CL only at compile time. * org-exp.el (require): Require CL only at compile time. * org-agenda.el (org-agenda-quit): When the agenda window is dedicated, remove other windows before exiting, so that the frame really will be killed. * org-exp.el (org-export-handle-include-files): Reset START and END for each loop cycle. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-eval-in-calendar): Use `org-select-frame-set-input-focus'. * org-compat.el (org-select-frame-set-input-focus): New function. * org.el (org-update-statistics-cookies): New function. (org-mode-map): Bind `C-c #' to `org-update-statistics-cookies'. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org-src.el (org-edit-fixed-width-region): Set org-src-mode only after the local variables are set. * org-latex.el (org-export-latex-protect-amp): New function. (org-export-latex-links): Protect link ampersands in tables. * org-exp.el (org-export-select-backend-specific-text): Match in two steps, to avoid regexp problems. * org.el (org-offer-links-in-entry): Improve working with many and duplicate links. * org-agenda.el (org-agenda-show-1): Make more consistent with normal cycling. (org-agenda-cycle-show): Make more consistent with normal cycling. * org-gnus.el (org-gnus-store-link): Restore the linking to a website. 2009-09-02 Bastien Guerry <bzg@altern.org> * org-latex.el (org-export-latex-first-lines): Bugfix. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-modify-effort-estimate): Emit message about new effort. * org.el (org-set-effort): New function. (org-mode-map): New key for effort setting command. * org-agenda.el (org-agenda): Keep window setup when calling agenda from within agenda window. (org-agenda-mode-map): New keys for effort setting commands. (org-agenda-menu): Add effort setting commands to menu. (org-agenda-set-property, org-agenda-set-effort): New functions. * org-latex.el (org-export-latex-tables): Fix `org-table-last-alignment' and `org-table-last-column-widths' if the first column has been removed. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-remove-timestamp-with-keyword): Only remove in entry, not in subtree. * org-src.el (org-src-lang-modes): Add abbreviation elisp for emacs lisp. * org.el (org-open-at-point): When on headline, offer all strings in entry. * org-remember.el (org-remember-templates): Documentation fix. * org.el (org-move-subtree-down): Use `org-get-next-sibling' and `org-get-last-sibling' instead of the outline versions of these functions. (org-get-last-sibling): New function. (org-refile): Use `org-get-next-sibling' instead of the outline version of this function. (org-clean-visibility-after-subtree-move): Use `org-get-next-sibling' and `org-get-last-sibling' instead of the outline versions of these functions. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-prepare-agenda): When creating a new frame for the agenda, make the window dedicated. * org-agenda.el (org-agenda-mode-map): New keys for time motion. * org-table.el (org-table-align): Change the order of reinsertion and deletion, to avoid problems with overlays following the table. * org.el (org-parse-time-string): Better error message. (org-show-subtree): Use org-end-of-subtree. * org-macs.el (org-goto-line): New defsubst. * org.el (org-open-file, org-change-tag-in-region) (org-fast-tag-show-exit): Don't use `goto-line'. * org-table.el (org-table-align, org-table-insert-column) (org-table-delete-column, org-table-move-column) (org-table-sort-lines, org-table-copy-region) (org-table-paste-rectangle, org-table-wrap-region) (org-table-get-specials, org-table-rotate-recalc-marks) (org-table-get-range, org-table-recalculate) (org-table-edit-formulas, org-table-fedit-convert-buffer) (org-table-show-reference, org-table-highlight-rectangle): Don't use `goto-line'. * org-src.el (org-edit-src-code, org-edit-fixed-width-region) (org-edit-src-exit): Don't use `goto-line'. * org-macs.el (org-preserve-lc): Don't use `goto-line'. * org-list.el (org-renumber-ordered-list, org-fix-bullet-type): Don't use `goto-line'. * org-exp.el (org-export-number-lines): Don't use `goto-line'. * org-colview.el (org-columns, org-columns-redo) (org-agenda-columns): Don't use `goto-line'. * org-colview-xemacs.el (org-columns, org-agenda-columns): Don't use `goto-line'. * org-agenda.el (org-agenda-mode): Force visual line motion off. (org-agenda-add-entry-text-maxlines): Improve docstring. (org-agenda-start-with-entry-text-mode): New option. (org-agenda-entry-text-maxlines): New option. (org-agenda-entry-text-mode): New variable. (org-agenda-mode): Set initial value of `org-agenda-entry-text-mode'. (org-agenda-mode-map): Add the `E' key. (org-agenda-menu): Add entry text mode to the menu. (org-agenda-get-some-entry-text): Fix line count bug. (org-finalize-agenda): Apply entry text mode if appropriate. (org-agenda-entry-text-show-here): New function. (org-agenda-entry-text-show): New function. (org-agenda-entry-text-hide): New function. (org-agenda-view-mode-dispatch): Add entry text mode to the view key menu. (org-agenda-entry-text-mode): New command. (org-agenda-set-mode-name): Add entry text mode to the mode line string. (org-agenda-undo, org-agenda-get-restriction-and-command) (org-agenda-get-some-entry-text, org-agenda-redo): Don't use `goto-line'. 2009-09-02 Bernt Hansen <bernt@norang.ca> * org-clock.el (org-notify): Bugfix. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-open-link): Handle multiple links and check for after-string. * org-gnus.el (org-gnus-store-link): Simplify. * org.el (org-latex-regexps): Don't add extra empty lines for display formulas. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-get-some-entry-text): New function. (org-agenda-add-entry-text): Use `org-agenda-get-some-entry-text'. * org.el (org-cycle-separator-lines): Update docstring. (org-cycle-show-empty-lines): Handle negative values for `org-cycle-show-empty-lines'. * org-exp.el (org-export-protect-sub-super): New function. (org-export-normalize-links): Protect the url of plain links from supscript and superscript processing. * org-remember.el (org-remember-escaped-%): New function. (org-remember-apply-template): Use `org-remember-escaped-%' to detect escaped % signs. 2009-09-02 Bastien Guerry <bzg@altern.org> * org-timer.el (org-timer-set-timer): Use `org-notify' and play a sound when showing the notification. * org-clock.el (org-notify): New function. (org-clock-notify-once-if-expired): Use `org-notify'. * org-gnus.el (org-gnus-store-link): Handle `gnus-summary-mode' and `gnus-article-mode' separately. (gnus-summary-article-header): Fix the declare-function. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-format-source-code-or-example): Translate language. * org-src.el (org-src-lang-modes): New variable (org-edit-src-code): Translate language. * org-exp.el (org-export-format-source-code-or-example): Deal wit the new structure of the `org-export-latex-listings-langs' variable. * org-latex.el (org-export-latex-listings-langs): Change structure of the variable from plist to alist. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-in-commented-line): New function. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-hide-block-toggle): Make folded blocks searchable. 2009-09-02 Friedrich Delgado Friedrichs <friedel@nomaden.org> (tiny change) * org.el (org-flag-drawer): More useful error. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-remember-apply-template): Use org-icompleting-read. * org-publish.el (org-publish): Use org-icompleting-read. * org-colview.el (org-columns-edit-value, org-columns-new) (org-insert-columns-dblock): Use org-icompleting-read. * org-colview-xemacs.el (org-columns-edit-value) (org-columns-new, org-insert-columns-dblock): Use org-icompleting-read. * org-attach.el (org-attach-delete-one, org-attach-open): Use org-icompleting-read. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-hierarchical-todo-statistics): Improve docstring. (org-version): Return the version text. (org-org-menu): Add a menu entry for the new bug reporter. (org-submit-bug-report): New command. * org-list.el (org-hierarchical-checkbox-statistics): Improve docstring. * org.el (org-emphasis-regexp-components): Add "`" to set of pre-emphasis characters. * org-latex.el (org-export-latex-classes): Always include the soul package. (org-export-latex-emphasis-alist): Use \st for strikethough. * org-exp-blocks.el (org-export-blocks-preprocess): Use `indent-code-rigidly' to indent. * org-agenda.el (org-agenda-get-restriction-and-command): Remove properties only if MATCH really is a string. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-packages-alist): Fix customization type. * org.el (org-create-formula-image): Also use `org-export-latex-packages-alist'. * org-html.el (org-export-as-html): Fix bug in footnote regexp. (org-export-as-html): Format footnotes correctly. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-fast-tag-selection): Avoid text properties on tags in the alist. * org-agenda.el (org-agenda-get-restriction-and-command): Avoid text properties on the match element. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-set-regexps-and-options): Make sure the list of done keywords is not invalid. * org-exp.el (org-export-interpolate-newlines): New function. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-format-latex): Avoid nested overlays. * org-latex.el (org-export-latex-listings-langs): Add a few more languages. * org-exp.el (org-export-preprocess-apply-macros): Make sure to ignore newlines and space before the first macro argument. * org-latex.el (org-export-latex-tables): Remove save-excursion around `org-table-align'. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-export-html-special-string-regexps): Definition moved into org.el * org-exp.el (org-export-preprocess-apply-macros): Allow newlines in macro calls. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-listings) (org-export-latex-listings-langs): New options. * org-exp.el (org-export-format-source-code-or-example): Use listing package if requested by the user. 2009-09-02 Bastien Guerry <bzg@altern.org> * org.el (org-iswitchb): Fix bug when aborting the `org-iswitchb' command before actually switching to a buffer. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-get-file-contents): Only quote org lines when the markup is src or example. * org-agenda.el (org-agenda-skip-scheduled-if-deadline-is-shown): New option (org-agenda-get-day-entries): Remember deadline results and pass them on into the function getting the scheduling information. (org-agenda-get-scheduled): Accept deadline results as parameters and maybe skip some entries. (org-agenda-skip-scheduled-if-deadline-is-shown): New option. * org.el (org-insert-heading): When respecting content, do not convert current line to headline. * org-clock.el (org-clock-save-markers-for-cut-and-paste): Also cheeeeeck the hd marker (org-clock-in): Also set the hd marker. (org-clock-out): Also set the hd marker. (org-clock-cancel): Reset markers. * org.el (org-clock-hd-marker): New marker. * org-faces.el (org-agenda-clocking): New face. * org-agenda.el (org-agenda-mark-clocking-task): New function. (org-finalize-agenda): call `org-agenda-mark-clocking-task'. * org.el (org-modules): Add org-track.el. * org-agenda.el (org-agenda-bulk-marked-p): New function. (org-agenda-bulk-mark, org-agenda-bulk-unmark): Use `org-agenda-bulk-marked-p'. (org-agenda-bulk-toggle): New command. 2009-09-02 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-move-subtree-down): Hide subtree if it was folded, not just the body. * org-remember.el (org-remember-finalize): Avoid buffer-modified messages.
author Carsten Dominik <dominik@science.uva.nl>
date Wed, 02 Sep 2009 12:59:52 +0000
parents ac1a55cc2c38
children 2a8a3a69c1c7
comparison
equal deleted inserted replaced
104809:23afd425bd15 104810:86b7fe7d1d8f
2 ;; 2 ;;
3 ;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. 3 ;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
4 ;; 4 ;;
5 ;; Emacs Lisp Archive Entry 5 ;; Emacs Lisp Archive Entry
6 ;; Filename: org-latex.el 6 ;; Filename: org-latex.el
7 ;; Version: 6.29c 7 ;; Version: 6.30c
8 ;; Author: Bastien Guerry <bzg AT altern DOT org> 8 ;; Author: Bastien Guerry <bzg AT altern DOT org>
9 ;; Maintainer: Carsten Dominik <carsten.dominik AT gmail DOT com> 9 ;; Maintainer: Carsten Dominik <carsten.dominik AT gmail DOT com>
10 ;; Keywords: org, wp, tex 10 ;; Keywords: org, wp, tex
11 ;; Description: Converts an org-mode buffer into LaTeX 11 ;; Description: Converts an org-mode buffer into LaTeX
12 12
91 "\\documentclass[11pt]{article} 91 "\\documentclass[11pt]{article}
92 \\usepackage[utf8]{inputenc} 92 \\usepackage[utf8]{inputenc}
93 \\usepackage[T1]{fontenc} 93 \\usepackage[T1]{fontenc}
94 \\usepackage{graphicx} 94 \\usepackage{graphicx}
95 \\usepackage{longtable} 95 \\usepackage{longtable}
96 \\usepackage{soul}
96 \\usepackage{hyperref}" 97 \\usepackage{hyperref}"
97 ("\\section{%s}" . "\\section*{%s}") 98 ("\\section{%s}" . "\\section*{%s}")
98 ("\\subsection{%s}" . "\\subsection*{%s}") 99 ("\\subsection{%s}" . "\\subsection*{%s}")
99 ("\\subsubsection{%s}" . "\\subsubsection*{%s}") 100 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
100 ("\\paragraph{%s}" . "\\paragraph*{%s}") 101 ("\\paragraph{%s}" . "\\paragraph*{%s}")
103 "\\documentclass[11pt]{report} 104 "\\documentclass[11pt]{report}
104 \\usepackage[utf8]{inputenc} 105 \\usepackage[utf8]{inputenc}
105 \\usepackage[T1]{fontenc} 106 \\usepackage[T1]{fontenc}
106 \\usepackage{graphicx} 107 \\usepackage{graphicx}
107 \\usepackage{longtable} 108 \\usepackage{longtable}
109 \\usepackage{soul}
108 \\usepackage{hyperref}" 110 \\usepackage{hyperref}"
109 ("\\part{%s}" . "\\part*{%s}") 111 ("\\part{%s}" . "\\part*{%s}")
110 ("\\chapter{%s}" . "\\chapter*{%s}") 112 ("\\chapter{%s}" . "\\chapter*{%s}")
111 ("\\section{%s}" . "\\section*{%s}") 113 ("\\section{%s}" . "\\section*{%s}")
112 ("\\subsection{%s}" . "\\subsection*{%s}") 114 ("\\subsection{%s}" . "\\subsection*{%s}")
115 "\\documentclass[11pt]{book} 117 "\\documentclass[11pt]{book}
116 \\usepackage[utf8]{inputenc} 118 \\usepackage[utf8]{inputenc}
117 \\usepackage[T1]{fontenc} 119 \\usepackage[T1]{fontenc}
118 \\usepackage{graphicx} 120 \\usepackage{graphicx}
119 \\usepackage{longtable} 121 \\usepackage{longtable}
122 \\usepackage{soul}
120 \\usepackage{hyperref}" 123 \\usepackage{hyperref}"
121 ("\\part{%s}" . "\\part*{%s}") 124 ("\\part{%s}" . "\\part*{%s}")
122 ("\\chapter{%s}" . "\\chapter*{%s}") 125 ("\\chapter{%s}" . "\\chapter*{%s}")
123 ("\\section{%s}" . "\\section*{%s}") 126 ("\\section{%s}" . "\\section*{%s}")
124 ("\\subsection{%s}" . "\\subsection*{%s}") 127 ("\\subsection{%s}" . "\\subsection*{%s}")
164 167
165 (defcustom org-export-latex-emphasis-alist 168 (defcustom org-export-latex-emphasis-alist
166 '(("*" "\\textbf{%s}" nil) 169 '(("*" "\\textbf{%s}" nil)
167 ("/" "\\emph{%s}" nil) 170 ("/" "\\emph{%s}" nil)
168 ("_" "\\underline{%s}" nil) 171 ("_" "\\underline{%s}" nil)
169 ("+" "\\texttt{%s}" nil) 172 ("+" "\\st{%s}" nil)
170 ("=" "\\verb" t) 173 ("=" "\\verb" t)
171 ("~" "\\verb" t)) 174 ("~" "\\verb" t))
172 "Alist of LaTeX expressions to convert emphasis fontifiers. 175 "Alist of LaTeX expressions to convert emphasis fontifiers.
173 Each element of the list is a list of three elements. 176 Each element of the list is a list of three elements.
174 The first element is the character used as a marker for fontification. 177 The first element is the character used as a marker for fontification.
243 :group 'org-export-latex 246 :group 'org-export-latex
244 :type 'boolean) 247 :type 'boolean)
245 248
246 (defcustom org-export-latex-packages-alist nil 249 (defcustom org-export-latex-packages-alist nil
247 "Alist of packages to be inserted in the header. 250 "Alist of packages to be inserted in the header.
248 Each cell is of the forma \( \"option\" . \"package\" \)." 251 Each cell is of the format \( \"option\" . \"package\" \)."
249 :group 'org-export-latex 252 :group 'org-export-latex
250 :type 'alist) 253 :type '(repeat
254 (list
255 (string :tag "option")
256 (string :tag "package"))))
251 257
252 (defcustom org-export-latex-low-levels 'itemize 258 (defcustom org-export-latex-low-levels 'itemize
253 "How to convert sections below the current level of sectioning. 259 "How to convert sections below the current level of sectioning.
254 This is specified by the `org-export-headline-levels' option or the 260 This is specified by the `org-export-headline-levels' option or the
255 value of \"H:\" in Org's #+OPTION line. 261 value of \"H:\" in Org's #+OPTION line.
294 Defaults to \\begin{verbatim} and \\end{verbatim}." 300 Defaults to \\begin{verbatim} and \\end{verbatim}."
295 :group 'org-export-translation 301 :group 'org-export-translation
296 :group 'org-export-latex 302 :group 'org-export-latex
297 :type '(cons (string :tag "Open") 303 :type '(cons (string :tag "Open")
298 (string :tag "Close"))) 304 (string :tag "Close")))
305
306 (defcustom org-export-latex-listings nil
307 "Non-nil means, export source code using the listings package.
308 This package will fontify source code, possibly even with color.
309 If you want to use this, you also need to make LaTeX use the
310 listings package, and if you want to have color, the color
311 package. Just add these to `org-export-latex-packages-alist',
312 for example using customize, or with something like
313
314 (require 'org-latex)
315 (add-to-list 'org-export-latex-packages-alist '(\"\" \"listings\"))
316 (add-to-list 'org-export-latex-packages-alist '(\"\" \"color\"))"
317 :group 'org-export-latex
318 :type 'boolean)
319
320 (defcustom org-export-latex-listings-langs
321 '((emacs-lisp "Lisp") (lisp "Lisp")
322 (c "C") (cc "C++")
323 (fortran "fortran")
324 (perl "Perl") (cperl "Perl") (python "Python") (ruby "Ruby")
325 (html "HTML") (xml "XML")
326 (tex "TeX") (latex "TeX")
327 (shell-script "bash")
328 (gnuplot "Gnuplot")
329 (ocaml "Caml") (caml "Caml")
330 (sql "SQL"))
331 "Alist mapping languages to their listing language counterpart.
332 The key is a symbol, the major mode symbol without the \"-mode\".
333 The value is the string that should be inserted as the language parameter
334 for the listings package. If the mode name and the listings name are
335 the same, the language does not need an entry in this list - but it does not
336 hurt if it is present."
337 :group 'org-export-latex
338 :type '(repeat
339 (list
340 (symbol :tag "Major mode ")
341 (string :tag "Listings language"))))
299 342
300 (defcustom org-export-latex-remove-from-headlines 343 (defcustom org-export-latex-remove-from-headlines
301 '(:todo nil :priority nil :tags nil) 344 '(:todo nil :priority nil :tags nil)
302 "A plist of keywords to remove from headlines. OBSOLETE. 345 "A plist of keywords to remove from headlines. OBSOLETE.
303 Non-nil means remove this keyword type from the headline. 346 Non-nil means remove this keyword type from the headline.
958 "Export the first lines before first headline. 1001 "Export the first lines before first headline.
959 If BEG is non-nil, it is the beginning of the region. 1002 If BEG is non-nil, it is the beginning of the region.
960 If END is non-nil, it is the end of the region." 1003 If END is non-nil, it is the end of the region."
961 (save-excursion 1004 (save-excursion
962 (goto-char (or beg (point-min))) 1005 (goto-char (or beg (point-min)))
963 (let* ((pt (point)) 1006 (let* ((pt (point)))
964 (end (if (re-search-forward "^\\*+ " end t) 1007 (or end
965 (goto-char (match-beginning 0)) 1008 (and (re-search-forward "^\\*+ " end t)
966 (goto-char end)))) 1009 (setq end (match-beginning 0)))
1010 (setq end (point-max)))
967 (prog1 1011 (prog1
968 (org-export-latex-content 1012 (org-export-latex-content
969 (org-export-preprocess-string 1013 (org-export-preprocess-string
970 (buffer-substring pt end) 1014 (buffer-substring pt end)
971 :for-LaTeX t 1015 :for-LaTeX t
1274 (match-string 2)) t t) 1318 (match-string 2)) t t)
1275 (forward-line)))))) 1319 (forward-line))))))
1276 1320
1277 1321
1278 (defvar org-table-last-alignment) ; defined in org-table.el 1322 (defvar org-table-last-alignment) ; defined in org-table.el
1323 (defvar org-table-last-column-widths) ; defined in org-table.el
1279 (declare-function orgtbl-to-latex "org-table" (table params) t) 1324 (declare-function orgtbl-to-latex "org-table" (table params) t)
1280 (defun org-export-latex-tables (insert) 1325 (defun org-export-latex-tables (insert)
1281 "Convert tables to LaTeX and INSERT it." 1326 "Convert tables to LaTeX and INSERT it."
1282 (goto-char (point-min)) 1327 (goto-char (point-min))
1283 (while (re-search-forward "^\\([ \t]*\\)|" nil t) 1328 (while (re-search-forward "^\\([ \t]*\\)|" nil t)
1284 ;; FIXME really need to save-excursion? 1329 (org-table-align)
1285 (save-excursion (org-table-align))
1286 (let* ((beg (org-table-begin)) 1330 (let* ((beg (org-table-begin))
1287 (end (org-table-end)) 1331 (end (org-table-end))
1288 (raw-table (buffer-substring beg end)) 1332 (raw-table (buffer-substring beg end))
1333 (org-table-last-alignment (copy-sequence org-table-last-alignment))
1334 (org-table-last-column-widths (copy-sequence
1335 org-table-last-column-widths))
1289 fnum fields line lines olines gr colgropen line-fmt align 1336 fnum fields line lines olines gr colgropen line-fmt align
1290 caption label attr floatp longtblp) 1337 caption label attr floatp longtblp)
1291 (if org-export-latex-tables-verbatim 1338 (if org-export-latex-tables-verbatim
1292 (let* ((tbl (concat "\\begin{verbatim}\n" raw-table 1339 (let* ((tbl (concat "\\begin{verbatim}\n" raw-table
1293 "\\end{verbatim}\n"))) 1340 "\\end{verbatim}\n")))
1308 floatp (or caption label)) 1355 floatp (or caption label))
1309 (setq lines (org-split-string raw-table "\n")) 1356 (setq lines (org-split-string raw-table "\n"))
1310 (apply 'delete-region (list beg end)) 1357 (apply 'delete-region (list beg end))
1311 (when org-export-table-remove-special-lines 1358 (when org-export-table-remove-special-lines
1312 (setq lines (org-table-clean-before-export lines 'maybe-quoted))) 1359 (setq lines (org-table-clean-before-export lines 'maybe-quoted)))
1360 (when org-table-clean-did-remove-column
1361 (pop org-table-last-alignment)
1362 (pop org-table-last-column-widths))
1313 ;; make a formatting string to reflect aligment 1363 ;; make a formatting string to reflect aligment
1314 (setq olines lines) 1364 (setq olines lines)
1315 (while (and (not line-fmt) (setq line (pop olines))) 1365 (while (and (not line-fmt) (setq line (pop olines)))
1316 (unless (string-match "^[ \t]*|-" line) 1366 (unless (string-match "^[ \t]*|-" line)
1317 (setq fields (org-split-string line "[ \t]*|[ \t]*")) 1367 (setq fields (org-split-string line "[ \t]*|[ \t]*"))
1519 (radiop (insert (format "\\hyperref[%s]{%s}" 1569 (radiop (insert (format "\\hyperref[%s]{%s}"
1520 (org-solidify-link-text raw-path) desc))) 1570 (org-solidify-link-text raw-path) desc)))
1521 ((not type) 1571 ((not type)
1522 (insert (format "\\hyperref[%s]{%s}" 1572 (insert (format "\\hyperref[%s]{%s}"
1523 (org-remove-initial-hash 1573 (org-remove-initial-hash
1524 (org-solidify-link-text raw-path)) desc))) 1574 (org-solidify-link-text raw-path))
1525 (path (insert (format "\\href{%s}{%s}" path desc))) 1575 desc)))
1576 (path
1577 (when (org-at-table-p)
1578 ;; There is a strange problem when we have a link in a table,
1579 ;; ampersands then cause a problem. I think this must be
1580 ;; a LaTeX issue, but we here implement a work-around anyway.
1581 (setq path (org-export-latex-protect-amp path)
1582 desc (org-export-latex-protect-amp desc)))
1583 (insert (format "\\href{%s}{%s}" path desc)))
1526 (t (insert "\\texttt{" desc "}"))))))) 1584 (t (insert "\\texttt{" desc "}")))))))
1585
1586 (defun org-export-latex-protect-amp (s)
1587 (while (string-match "\\([^\\\\]\\)\\(&\\)" s)
1588 (setq s (replace-match (concat (match-string 1 s) "\\" (match-string 2 s))
1589 t t s)))
1590 s)
1527 1591
1528 (defun org-remove-initial-hash (s) 1592 (defun org-remove-initial-hash (s)
1529 (if (string-match "\\`#" s) 1593 (if (string-match "\\`#" s)
1530 (substring s 1) 1594 (substring s 1)
1531 s)) 1595 s))