comparison lisp/org/org-latex.el @ 105341:2a8a3a69c1c7

2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-set-tags-to): New command. * org-latex.el (org-export-latex-set-initial-vars): Also check in the plist. * org.el (org-additional-option-like-keywords): Add LATEX_CLASS keyword. * org-exp.el (org-infile-export-plist): Add LATEX_CLASS keyword. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org-inlinetask.el (org-inlinetask-export): Option removed. (org-inlinetask-export-handler): Better export. * org-xoxo.el (org-export-xoxo-final-hook): New hook. (org-export-as-xoxo): Run the new hook. * org-html.el (org-export-html-final-hook): New hook. (org-export-as-html): Run the new hook. * org-docbook.el (org-export-docbook-final-hook): New hook. (org-export-as-docbook): Run the new hook. * org-ascii.el (org-export-ascii-final-hook): New hook. (org-export-as-ascii): Run the new hook. * org-latex.el (org-export-latex-treat-sub-super-char): Allow a space character as the character before the ^/_. (org-export-latex-final-hook): New hook. (org-export-as-latex): Run `org-export-latex-final-hook'. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org-macs.el (org-if-unprotected-at): Fix docstring. * org-agenda.el (org-agenda-change-all-lines): Handle invisible text in the prefix (if category is a link). * org-latex.el (org-export-latex-preprocess): Deal properly with empty lines in verse environments. * org.el (org-format-latex-header): Inline fullpage.sty. * org-footnote.el (org-footnote-create-definition): Reveal context to add a new footnote definition. * org.el (org-ctrl-c-ctrl-c): Pass prefix arg to org-table-recalculate when cursor is in TBLFM line. * org-list.el (org-renumber-ordered-list): Fix cursor position when bullet length has changed. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-format-latex): Mention `org-format-latex-options' in the docstring. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-agenda-get): New function. * org-agenda.el (org-agenda-post-command-hook): No longer move point away from end of line. (org-agenda-add-entry-text, org-agenda-collect-markers) (org-finalize-agenda, org-agenda-mark-clocking-task) (org-agenda-dim-blocked-tasks, org-agenda-entry-text-show-here) (org-agenda-entry-text-show, org-agenda-highlight-todo) (org-agenda-compare-effort, org-agenda-filter-apply) (org-agenda-later, org-agenda-change-time-span) (org-agenda-post-command-hook, org-agenda-show-priority) (org-agenda-show-tags, org-agenda-goto, org-agenda-kill) (org-agenda-archive, org-agenda-archive-to-archive-sibling) (org-remove-subtree-entries-from-agenda, org-agenda-refile) (org-agenda-open-link, org-agenda-copy-local-variable) (org-agenda-switch-to, org-agenda-check-no-diary) (org-agenda-tree-to-indirect-buffer, org-agenda-todo) (org-agenda-add-note, org-agenda-change-all-lines) (org-agenda-priority, org-agenda-set-tags) (org-agenda-set-property, org-agenda-set-effort) (org-agenda-toggle-archive-tag, org-agenda-date-later) (org-agenda-show-new-time, org-agenda-date-prompt) (org-agenda-schedule, org-agenda-deadline, org-agenda-action) (org-agenda-clock-in, org-agenda-bulk-mark) (org-agenda-bulk-unmark, org-agenda-show-the-flagging-note): Use `org-get-at-bol'. * org-colview.el (org-columns-display-here) (org-columns-edit-allowed, org-agenda-columns): Use `org-get-at-bol'. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-special-ctrl-a/e): Improve documentation and customize type. (org-end-of-line): Don't jump to after the ellipsis. (org-mode-map): Bind <home> and <end> as well. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-fontify-meta-lines-and-blocks): Treat lines with a space after #+ as comments. (org-open-at-point): Run `org-follow-link-hook' always. * org-latex.el (org-export-latex-emph-format): Use better commands to insert special characters in verbatim snippets. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org-faces.el (org-copy-face): New function. Use it to create various faces formerly created by using `copy-face'. * org-agenda.el (org-prepare-agenda): Don't officially mark this window dedicated. (org-agenda-quit): Kill the frame containing the agenda window if that frame was created for the agenda. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-date-prompt): Mark the changed time stamp in the agenda. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-prepare-agenda): Reset `org-drawers-for-agenda'. (org-prepare-agenda): Uniquify list of drawers. * org.el (org-complex-heading-regexp-format): New variable. (org-set-regexps-and-options): Define `org-complex-heading-regexp-format'. (org-drawers-for-agenda): New variable. (org-map-entries): Bind `org-drawers-for-agenda'. (org-prepare-agenda-buffers): Add to `org-drawers-for-agenda'. * org-remember.el (org-go-to-remember-target) (org-remember-handler): Use `org-complex-heading-regexp-format'. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-highlight-todo): Fix text property problem. * org.el (org-on-heading-p, org-at-heading-p): Make sure these are always with `invisible-ok'. (org-store-link): No error when there is nothing to link to in the agenda. * org-list.el (org-update-checkbox-count): Insert changed cookie before the old, to avoid problems with invisibility at the end of the line. (org-update-checkbox-count): Insert changed cookie before the old, to avoid problems with invisibility at the end of the line. * org.el (org-sort-entries-or-items): Include the final newline. (org-fontify-meta-lines-and-blocks): Add indented dynamic block lines for fontification. (org-dblock-start-re, org-dblock-end-re): Allow indentation. (org-prepare-dblock): Store the current indentation of the BEGIN line. (org-update-dblock): Apply the indentation of the begin line to the rest of the block. (org-ctrl-c-ctrl-c): Also find indented dblock lines. (org-startup-folded): New allowed value `showeverything'. (org-startup-options): Add STARTUP keyword `showeverything'. (org-set-startup-visibility): Respect value `showeverything' in org-startup-folded. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-closest-date): Fix issue with past preference. * org-archive.el (org-archive-set-tag) (org-archive-subtree-default): New commands. * org-clock.el (org-clock-clocktable-default-properties): New option. (org-clock-report): Use `org-clock-clocktable-default-properties'. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-iswitchb-completing-read): Fix typo. * org-crypt.el: New file. * org.el: Add an entry for org-crypt. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-menu): Reorganize the menu for more consistency. (org-batch-store-agenda-views): New function. (org-agenda-title-append): Define variable. (org-write-agenda): New export to Org files. (org-agenda-get-some-entry-text): New arguments INDENT and KEEP. (org-agenda): Allow to keep the restricted file list if a special variable is bound to t. (org-agenda): Define a special agenda view for working on flagged entries. (org-agenda-get-restriction-and-command): List the new agenda view. (org-agenda-show-the-flagging-note): New command. (org-agenda-mode-map): New key `?' for looking at the flagging note. * org.el (org-autoload): Autoload org-mobile.el. (org-org-menu): Add menu commands for MobileOrg in the Org menu. * org-mobile.el: New file. * org-id.el (org-id-get): Fix bug with forcing ID on an item. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (orgtbl-line-start-regexp): Match also TBLNAME statements. (org-table-get-remote-range): Match indented #+TBLNAME statements. * org.el (org-convert-to-odd-levels) (org-convert-to-oddeven-levels): Work also correctly if the file is in outline-mode. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-store-link): When in agenda buffer, link to referenced entry. (org-add-planning-info): Remove spaces at eol. * org-macs.el (org-with-point-at): Add a `lisp-indent-function' property. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-first-lines): Fix problem with LaTeX export of first line and selected subtree. * org.el (org-shifttab): Interpret arg differently when using only odd levels. 2009-10-01 Bastien Guerry <bzg@altern.org> * org.el (org-check-agenda-file): Use a more explicit message 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-remove-special-table-lines): Don't remove normal lines. 2009-10-01 Bastien Guerry <bzg@altern.org> * org.el (org-offer-links-in-entry): Don't use "Select link" as a prompt in the temporary window. * org-agenda.el (org-agenda-bulk-mark): Use a slightly soberer prefix for marked entries in the agenda view. 2009-10-01 Andreas Burtzlaff <andy13@gmx.net> (tiny change) * org.el (outline-end-of-subtree): Bugfix: advise this function in a way that prevents any trailing character from being displayed. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-menu): Fix bugs in the bulk action menu. * org-exp.el (org-export-remove-special-table-lines): Remove bad slow regexp match. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org-latex.el (org-export-latex-preprocess): Do not protect in the LaTeX header. * org-src.el (org-edit-src-save): Save window setup while saving. (org-edit-src-code): Use new buffer name construction scheme. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-entry-text-exclude-regexps): New variable. (org-agenda-entry-text-cleanup-hook): New hook. (org-agenda-get-some-entry-text): Remove matches of `org-agenda-entry-text-exclude-regexps' and run the hook `org-agenda-entry-text-cleanup-hook'. * org.el (org-offer-links-in-entry): New argument ZERO to implement a link with index zero. (org-cycle-show-empty-lines): Not keep empty line under header hidden. (org-iswitchb-completing-read): Bind `switchb-use-virtual-buffers' to nil for special completion. (org-store-link): Don't error before the first heading. * org-agenda.el (org-agenda-open-link): Pass the prefix to `org-offer-links-in-entry'. 2009-10-01 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-quit): Provide the window argument for `window-dedicated-p', Emacs 22 needs it. (org-format-agenda-item): If the category is a link, arrange for invisible text to replaced with spaces. (org-compile-prefix-format): Add the extra space. (org-prefix-category-length): New variable. * org-exp.el (org-export-cleanup-toc-line): Remove footnote references from TOC lines. * org.el (org-selected-window): New variable. * org-table.el (org-table-edit-formulas): Remember the selected window. (org-table-fedit-finish, org-table-fedit-abort): Select the window that was originally selected. * org-exp.el (org-export-preprocess-apply-macros): Scan the expansion of a macro for more macro definitions. * org-agenda.el (org-agenda-dim-blocked-tasks): Make sure the invisibility overlay starts on the newline.
author Carsten Dominik <dominik@science.uva.nl>
date Thu, 01 Oct 2009 07:59:53 +0000
parents 86b7fe7d1d8f
children 131bccfc4f5d
comparison
equal deleted inserted replaced
105340:118ad0cdd9a8 105341:2a8a3a69c1c7
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.30c 7 ;; Version: 6.31a
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
47 (require 'cl)) 47 (require 'cl))
48 48
49 (require 'footnote) 49 (require 'footnote)
50 (require 'org) 50 (require 'org)
51 (require 'org-exp) 51 (require 'org-exp)
52 (require 'org-macs)
52 53
53 ;;; Variables: 54 ;;; Variables:
54 (defvar org-export-latex-class nil) 55 (defvar org-export-latex-class nil)
55 (defvar org-export-latex-header nil) 56 (defvar org-export-latex-header nil)
56 (defvar org-export-latex-append-header nil) 57 (defvar org-export-latex-append-header nil)
407 408
408 ;;; Hooks 409 ;;; Hooks
409 410
410 (defvar org-export-latex-after-blockquotes-hook nil 411 (defvar org-export-latex-after-blockquotes-hook nil
411 "Hook run during LaTeX export, after blockquote, verse, center are done.") 412 "Hook run during LaTeX export, after blockquote, verse, center are done.")
413
414 (defvar org-export-latex-final-hook nil
415 "Hook run in the finalized LaTeX buffer.")
412 416
413 ;;; Autoload functions: 417 ;;; Autoload functions:
414 418
415 ;;;###autoload 419 ;;;###autoload
416 (defun org-export-as-latex-batch () 420 (defun org-export-as-latex-batch ()
660 (replace-match "")) 664 (replace-match ""))
661 (goto-char (point-min)) 665 (goto-char (point-min))
662 (and (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t) 666 (and (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t)
663 (replace-match "\\tableofcontents" t t))) 667 (replace-match "\\tableofcontents" t t)))
664 668
669 (run-hooks 'org-export-latex-final-hook)
665 (or to-buffer (save-buffer)) 670 (or to-buffer (save-buffer))
666 (goto-char (point-min)) 671 (goto-char (point-min))
667 (or (org-export-push-to-kill-ring "LaTeX") 672 (or (org-export-push-to-kill-ring "LaTeX")
668 (message "Exporting to LaTeX...done")) 673 (message "Exporting to LaTeX...done"))
669 (prog1 674 (prog1
921 (save-restriction 926 (save-restriction
922 (widen) 927 (widen)
923 (goto-char (point-min)) 928 (goto-char (point-min))
924 (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\([a-zA-Z]+\\)" nil t) 929 (and (re-search-forward "^#\\+LaTeX_CLASS:[ \t]*\\([a-zA-Z]+\\)" nil t)
925 (match-string 1)))) 930 (match-string 1))))
931 (plist-get org-export-latex-options-plist :latex-class)
926 org-export-latex-default-class) 932 org-export-latex-default-class)
927 org-export-latex-class 933 org-export-latex-class
928 (or (car (assoc org-export-latex-class org-export-latex-classes)) 934 (or (car (assoc org-export-latex-class org-export-latex-classes))
929 (error "No definition for class `%s' in `org-export-latex-classes'" 935 (error "No definition for class `%s' in `org-export-latex-classes'"
930 org-export-latex-class)) 936 org-export-latex-class))
1001 "Export the first lines before first headline. 1007 "Export the first lines before first headline.
1002 If BEG is non-nil, it is the beginning of the region. 1008 If BEG is non-nil, it is the beginning of the region.
1003 If END is non-nil, it is the end of the region." 1009 If END is non-nil, it is the end of the region."
1004 (save-excursion 1010 (save-excursion
1005 (goto-char (or beg (point-min))) 1011 (goto-char (or beg (point-min)))
1006 (let* ((pt (point))) 1012 (let* ((pt (point))
1007 (or end 1013 (end (if (re-search-forward "^\\*+ " end t)
1008 (and (re-search-forward "^\\*+ " end t) 1014 (goto-char (match-beginning 0))
1009 (setq end (match-beginning 0))) 1015 (goto-char (or end (point-max))))))
1010 (setq end (point-max)))
1011 (prog1 1016 (prog1
1012 (org-export-latex-content 1017 (org-export-latex-content
1013 (org-export-preprocess-string 1018 (org-export-preprocess-string
1014 (buffer-substring pt end) 1019 (buffer-substring pt end)
1015 :for-LaTeX t 1020 :for-LaTeX t
1231 "Convert the \"_\" and \"^\" characters to LaTeX. 1236 "Convert the \"_\" and \"^\" characters to LaTeX.
1232 SUBSUP corresponds to the ^: option in the #+OPTIONS line. 1237 SUBSUP corresponds to the ^: option in the #+OPTIONS line.
1233 Convert CHAR depending on STRING-BEFORE and STRING-AFTER." 1238 Convert CHAR depending on STRING-BEFORE and STRING-AFTER."
1234 (cond ((equal string-before "\\") 1239 (cond ((equal string-before "\\")
1235 (concat string-before char string-after)) 1240 (concat string-before char string-after))
1236 ;; this is part of a math formula 1241 ((and (string-match "\\S-+" string-after))
1237 ((and (string-match "\\S-+" string-before) 1242 ;; this is part of a math formula
1238 (string-match "\\S-+" string-after))
1239 (cond ((eq 'org-link (get-text-property 0 'face char)) 1243 (cond ((eq 'org-link (get-text-property 0 'face char))
1240 (concat string-before "\\" char string-after)) 1244 (concat string-before "\\" char string-after))
1241 ((save-match-data (org-inside-latex-math-p)) 1245 ((save-match-data (org-inside-latex-math-p))
1242 (if subsup 1246 (if subsup
1243 (cond ((eq 1 (length string-after)) 1247 (cond ((eq 1 (length string-after))
1478 (progn 1482 (progn
1479 (setq format (concat "\\verb" (substring ll i (1+ i)) 1483 (setq format (concat "\\verb" (substring ll i (1+ i))
1480 "%s" (substring ll i (1+ i)))) 1484 "%s" (substring ll i (1+ i))))
1481 (throw 'exit nil)))))) 1485 (throw 'exit nil))))))
1482 (let ((start 0) 1486 (let ((start 0)
1483 (trans '(("\\" . "\\backslash") 1487 (trans '(("\\" . "\\textbackslash{}")
1484 ("~" . "\\ensuremath{\\sim}") 1488 ("~" . "\\textasciitilde{}")
1485 ("^" . "\\ensuremath{\\wedge}"))) 1489 ("^" . "\\textasciicircum{}")))
1486 (rtn "") char) 1490 (rtn "") char)
1487 (while (string-match "[\\{}$%&_#~^]" string) 1491 (while (string-match "[\\{}$%&_#~^]" string)
1488 (setq char (match-string 0 string)) 1492 (setq char (match-string 0 string))
1489 (if (> (match-beginning 0) 0) 1493 (if (> (match-beginning 0) 0)
1490 (setq rtn (concat rtn (substring string 1494 (setq rtn (concat rtn (substring string
1549 ;; process with link inserting 1553 ;; process with link inserting
1550 (apply 'delete-region remove) 1554 (apply 'delete-region remove)
1551 (cond ((and imgp (plist-get org-export-latex-options-plist :inline-images)) 1555 (cond ((and imgp (plist-get org-export-latex-options-plist :inline-images))
1552 (insert 1556 (insert
1553 (concat 1557 (concat
1554 (if floatp "\\begin{figure}[htb]\n") 1558 (if floatp "\\begin{figure}[htb]\n\\centering\n")
1555 (format "\\centerline{\\includegraphics[%s]{%s}}\n" 1559 (format "\\includegraphics[%s]{%s}\n"
1556 attr 1560 attr
1557 (if (file-name-absolute-p raw-path) 1561 (if (file-name-absolute-p raw-path)
1558 (expand-file-name raw-path) 1562 (expand-file-name raw-path)
1559 raw-path)) 1563 raw-path))
1560 (if floatp 1564 (if floatp
1561 (format "\\caption{%s%s}\n" 1565 (format "\\caption{%s%s}\n"
1562 (if label (concat "\\label{" label "}") "") 1566 (if label (concat "\\label{" label "}") "")
1563 (or caption ""))) 1567 (or caption "")))
1564 (if floatp "\\end{figure}\n")))) 1568 (if floatp "\\end{figure}"))))
1565 (coderefp 1569 (coderefp
1566 (insert (format 1570 (insert (format
1567 (org-export-get-coderef-format path desc) 1571 (org-export-get-coderef-format path desc)
1568 (cdr (assoc path org-export-code-refs))))) 1572 (cdr (assoc path org-export-code-refs)))))
1569 (radiop (insert (format "\\hyperref[%s]{%s}" 1573 (radiop (insert (format "\\hyperref[%s]{%s}"
1660 (goto-char (match-end 1)) 1664 (goto-char (match-end 1))
1661 (org-replace-match-keep-properties 1665 (org-replace-match-keep-properties
1662 (org-export-latex-protect-string 1666 (org-export-latex-protect-string
1663 (concat "\\hspace*{1cm}" (match-string 2))) t t) 1667 (concat "\\hspace*{1cm}" (match-string 2))) t t)
1664 (beginning-of-line 1)) 1668 (beginning-of-line 1))
1665 (unless (looking-at ".*?[^ \t\n].*?\\\\\\\\[ \t]*$") 1669 (if (looking-at "[ \t]*$")
1666 (end-of-line 1) 1670 (insert "\\vspace*{1em}")
1667 (insert "\\\\")) 1671 (unless (looking-at ".*?[^ \t\n].*?\\\\\\\\[ \t]*$")
1672 (end-of-line 1)
1673 (insert "\\\\")))
1668 (beginning-of-line 2)) 1674 (beginning-of-line 2))
1669 (and (looking-at "[ \t]*ORG-VERSE-END.*") 1675 (and (looking-at "[ \t]*ORG-VERSE-END.*")
1670 (org-replace-match-keep-properties "\\end{verse}" t t))) 1676 (org-replace-match-keep-properties "\\end{verse}" t t)))
1671 1677
1672 ;; Convert center 1678 ;; Convert center
1689 (let ((re (concat "\\\\[a-zA-Z]+\\(?:" 1695 (let ((re (concat "\\\\[a-zA-Z]+\\(?:"
1690 "\\[.*\\]" 1696 "\\[.*\\]"
1691 "\\)?" 1697 "\\)?"
1692 (org-create-multibrace-regexp "{" "}" 3)))) 1698 (org-create-multibrace-regexp "{" "}" 3))))
1693 (while (re-search-forward re nil t) 1699 (while (re-search-forward re nil t)
1694 (add-text-properties (match-beginning 0) (match-end 0) 1700 (unless (save-excursion (goto-char (match-beginning 0))
1695 '(org-protected t)))) 1701 (equal (char-after (point-at-bol)) ?#))
1702 (add-text-properties (match-beginning 0) (match-end 0)
1703 '(org-protected t)))))
1696 1704
1697 ;; Protect LaTeX entities 1705 ;; Protect LaTeX entities
1698 (goto-char (point-min)) 1706 (goto-char (point-min))
1699 (let (a) 1707 (let (a)
1700 (while (re-search-forward org-latex-entities-regexp nil t) 1708 (while (re-search-forward org-latex-entities-regexp nil t)