Mercurial > emacs
comparison lisp/org/org-latex.el @ 105973:b7d8222914b4
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-clone-subtree-with-time-shift): Make it work at the
end of the buffer.
* org-mobile.el (org-mobile-write-checksums): Specify coding
system.
(org-mobile-timestamp-buffer): Keep local variable/mode line at
beginning of buffer.
* org-latex.el (org-latex-entities-regexp): Fix typo in regexp.
* org.el (org-block-todo-from-children-or-siblings-or-parent)
(org-block-todo-from-checkboxes): Do not block changes to a nil
TODO state.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org-habit.el (org-habit-parse-todo): Indicate which habit is
wrongly set up in the error messages.
* org-colview.el (org-columns-display-here): Don't try to
calculate values if the underlying property is not set.
(org-columns-string-to-number): Convert age strings back into
fractional days.
(org-agenda-colview-summarize): Handle extended summary types
properly.
* org-colview-xemacs.el (org-columns-display-here): Don't try to
calculate values if the underlying property is not set.
(org-columns-string-to-number): Convert age strings back into
fractional days.
(org-agenda-colview-summarize): Handle extended summary types
properly.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-export-format-drawer-function): New variable.
(org-export-format-drawer): New function.
(org-export-preprocess-string): Pass the backend as a parameter to
`org-export-remove-or-extract-drawers'.
(org-export-remove-or-extract-drawers): New parameter BACKEND.
* org-protocol.el (org-protocol-char-to-string): New defsubst.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-diary-entry-in-org-file): Add error
message when no block is selected.
* org-latex.el (org-export-latex-links): Check for protectedness
in the last matched character, not after the match.
* org-datetree.el (org-datetree-find-date-create): Respect
restriction when KEEP-RESTRICTION is set.
(org-datetree-file-entry-under): New function.
(org-datetree-cleanup): New command.
2009-11-13 Dan Davison <davison@stats.ox.ac.uk>
* org-src.el (org-edit-src-code): New optional argument context
allows calling functions to avoid altering the saved window
configuration.
(org-edit-src-exit): Do not restore window configuration when this
function is used in the context of saving the edit buffer.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-out, org-clock-cancel): Revert to
instances to switching to with-current-buffer, because these seem
to cause problems - no idea why.
* org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file):
Require diary-lib for (diary-date-display-form).
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-log-reschedule, org-log-redeadline): New options.
(org-log-note-headings): Add templates for rescheduling and
deadline changing.
(org-startup-options): Add in-buffer settings for logging changing
schedule and deadline time stamps.
(org-deadline, org-schedule): Check for existing date and arrange
for logging if the user requests it.
(org-add-log-note): Prepare proper note buffers for rescheduling
and deadline changes.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-diary-entry-in-org-file)
(org-agenda-add-entry-to-org-agenda-diary-file)
(org-agenda-insert-diary-make-new-entry): New functions.
(org-agenda-diary-entry): Call
`org-agenda-diary-entry-in-org-file' when appropriate.
* org.el (org-calendar-insert-diary-entry-key): New option.
(org-agenda-diary-file): New option.
("calendar"): Install our insertion function in the calendar.
* org-remember.el (org-datetree): Require.
(org-remember-templates): Add new positioning option.
(org-remember-reference-date): New variable.
(org-remember-apply-template): Store the reference date in a local
variable.
(org-remember-handler): Implement date tree positioning of entries.
* org-datetree.el: New file.
* org-latex.el (org-export-latex-preprocess): Protect targets in
verbatim emphasis.
* org-html.el (org-export-as-html): Protect targets in verbatim
emphasis.
* org-docbook.el (org-export-as-docbook): Protect targets in
verbatim emphasis.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-show-notification): Handle messages that
contain a percent character.
* org-remember.el (org-remember-apply-template): Turn of partial
completion.
* org-mobile.el (org-mobile-before-process-capture-hook): New hook.
(org-mobile-pull): Run `org-mobile-before-process-capture-hook'.
* org.el (org-indent-mode): Define variable already in org.el.
(org-unfontify-region): Remove line-prefix and wrap-prefix
properties only if org-indent-mode is active.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-icalendar.el (org-print-icalendar-entries): Save match data
around call to verify function.
(org-print-icalendar-entries): Add a call to the verification
function.
* org.el (org-speedbar-set-agenda-restriction): Remove unnecessary
save-restrivtion' form.
2009-11-13 Dan Davison <davison@stats.ox.ac.uk>
* org-exp.el (org-export-format-source-code-or-example): restrict
scope of preserve-indentp to the let binding.
(org-src): require org-src, since org-src-preserve-indentation is used.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-timer.el (org-timer-set-timer): Set variables
org-timer-timer[123] correctly.
* org-mobile.el (org-mobile-files-alist): Make it work when
`agenda-archives' is included in
`org-agenda-text-search-extra-files'.
(org-mobile-push): Restore agenda after mobile push.
2009-11-13 John Wiegley <jwiegley@gmail.com>
* org-clock.el (org-resolve-clocks-if-idle): Another fix to the
way the amount of idle time is presented in the minibuffer.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-icalendar.el (org-print-icalendar-entries): Use
org-icalendar-verify-function only if non-nil.
* org.el (org-refile): Refile to clock only if the prefix arg is
2.
(org-sparse-tree): Fix docstring to be in line with prompt.
(org-update-parent-todo-statistics): Call
`org-after-todo-statistics-hook' on each level.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-remember.el (org-remember-apply-template): Make sure the
buffer exists.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-tab-ind-state): New variable.
(org-cycle-level): New function.
(org-cycle-level-after-item/entry-creation): New option.
(org-flag-subtree): New function.
(org-hide-archived-subtrees): Call `org-flag-subtree'.
(org-set-effort): Indexed access.
* org-list.el (org-cycle-item-indentation): New function.
* org.el (org-refile): Make prefix argument 2 refile to current
clock.
(org-priority): Interpret action `remove' as call to remove the
priority cookie.
* org-remember.el (org-remember-apply-template): Don't depend on
buffer name being like file name.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-play-sound): Expand file in
org-clock-sound, to allow ~ for home.
* org-remember.el (org-remember-handler): Set
text-before-node-creation even if this already looks like a node,
because the string might be needed on non-org-mode target files.
* org-agenda.el (org-agenda-open-link): Make this work in agenda
clocktables.
(org-agenda-switch-to): Follow a link at point if
org-return-follows-link' is set and there is nothing else to do in
this line.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org-colview-xemacs.el: Add in changes from org-colview.el
2009-11-13 Dan Davison <davison@stats.ox.ac.uk>
* org-exp-blocks.el: Modify split separator regexp to avoid empty
strings.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org-colview.el (org-columns-new): Make this work with the new
operators.
(org-columns-store-format): Make this work with the new operators.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-src.el (org-src-preserve-indentation): Document that this
variable is also used during export.
* org-exp.el (org-export-format-source-code-or-example): Preserve
indentation if a block has a -i option, or if
`org-src-preserve-indentation' is set.
* org-exp-blocks.el (org-export-blocks-preprocess): Preserve
indentation if a block has a -i option, or if
`org-src-preserve-indentation' is set.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-mode-map): Define the new archiving keys.
(org-speed-commands-default): Define an archiving key in the speed
command map.
(org-org-menu): Improve the menu structure concerning archiving.
* org-archive.el (org-archive-subtree-default-with-confirmation):
New command.
* org-agenda.el (org-agenda-mode-map): Define the new archiving keys.
(org-agenda-menu): Add the new archiving commands to the menu.
(org-agenda-archive-default)
(org-agenda-archive-default-with-confirmation): New commands.
(org-agenda-archive, org-agenda-archive-to-archive-sibling): Just
call `org-agenda-archive-with'.
(org-agenda-archive-with): New function.
* org-table.el (org-table-convert-region): Inert spaces around "|"
to avoid line beginnings like "|-1" which will be mistaken as
hlines.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-offer-links-in-entry): Return nil if there are no
links, t if a link has been selected.
(org-open-at-point): Open attachment directory when called in the
headline and there are no links in the entry body.
(org-speed-commands-default): Add "o" for open-at-point as a speed
command.
* org-attach.el (org-attach-reveal): Optional prefix arg
IF-EXISTS, which avoids creating the attachment directory if it
does not yet exist.
* org-agenda.el (org-agenda, org-run-agenda-series): Evaluate
MATCH.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el ("abbrev"): Work with abbrev tables only after they have
been loaded.
* org-list.el (org-list-send-list): Fix bug related to match
data.
* org-latex.el (org-export-latex-fontify): Apply verbatim
emphasis.
(org-export-latex-make-header): Insert \obeylines if line breaks
should be preserved.
* org-exp.el (org-export-protect-verbatim): Add an
`org-verbatim-emph' property to such text.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-icalendar.el (org-icalendar-use-plain-timestamp): New option.
(org-print-icalendar-entries): Skip entries where the timestamp is
not a deadline and not scheduled, if the user requests that.
* org-latex.el (org-export-latex-quotation-marks): Allow a bracket
before an opening quote.
* org-archive.el (org-archive-subtree): Keep archive after
archiving something.
* org-id.el (org-id-update-id-locations): Add archive files if
that is required by `org-id-extra-files'.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-src.el (org-src-window-setup): New option.
(org-src-switch-to-buffer): New function.
(org-edit-src-exit): Add optional argument CONTEXT and use it to
restore window configuration.
(org-edit-src-code, org-edit-src-continue, org-edit-src-exit):
Call `org-src-switch-to-buffer'.
* org.el (org-default-properties): Add STYLE property.
(org-files-list): Use the function call to get the files.
(org-additional-option-like-keywords): Add SETUPFILE to completion
list.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-table.el (org-table-convert-region): Correctly interpret
quoting in csv import.
* org.el (org-icompleting-read): Make iswitchb completion work
with lists and tables.
* org-agenda.el (org-agenda-add-entry-text): Never add entry text
while pushing the mobile agenda.
2009-11-13 John Wiegley <jwiegley@gmail.com>
* org-clock.el
(org-clock-auto-clock-resolution): Now takes three values: nil, t
and `when-no-clock-is-running'.
(org-clock-in): Use `org-clock-auto-clock-resolution' to determine
whether or not to resolve Org buffers on clock in.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org-colview.el (org-format-time-period): Function to format
times in fractional days for display.
(org-columns-display-here): Add support for showing a calculated
value in place of the property.
(org-columns): Set `org-columns-time' to the current time so time
difference calculations will work.
(org-columns-time): Use to store the current time when column view
is displayed, so all time differences will use the same reference
point.
(org-columns-compile-map): There is now an extra position in each
entry specifying the function to use to calculate the displayed
value for the non-calculated properties in the column,
(org-columns-compute-all): Set `org-columns-time' to the current
time so time difference calculations will work.
(org-columns-compute): Handle column operators where the values
used are calculated from the underlying property.
(org-columns-number-to-string): Handle the 'age' column format
(org-columns-string-to-number): Correct the function name (was
org-column...). Add support for the 'age' column format.
(org-columns-compile-format): Support the additional parameter in
org-columns-compile-map.
2009-11-13 Bastien Guerry <bzg@altern.org>
* org.el (org-mode-hook): Turn `org-mode-hook' into a customizable
variable.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-has-been-used): New variable.
(org-clock-in): Set `org-clock-has-been-used'.
(org-clock-save): Save only if clock data has been used or created
during this session.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-persist): New value, to store only the
clock history.
(org-clock-save): Don't save the clock if only the history should
be stored.
(org-clock-load): Turn off John Wiegley's auto resolving mechanism
when restoring a saved clock.
2009-11-13 John Wiegley <jwiegley@gmail.com>
* org-clock.el (org-clock-display, org-clock-put-overlay): Use
`org-time-clock-use-fractional'.
* org.el (org-time-clocksum-use-fractional)
(org-time-clocksum-fractional-format): Two new customizable
variables which allow the user to select fractional times (1.25
instead of 1:25) in the `org-clock-display' report.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-ascii.el (org-export-ascii-table-keep-all-vertical-lines):
New option.
* org.el (org-tag-alist): Fix customization type.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-mobile.el (org-mobile-update-checksum-for-capture-file):
Make sure the regexp search can fail without throwing an error.
(org-mobile-apply): Save the inbox buffer after removing
successfully applied changes.
2009-11-13 John Wiegley <jwiegley@gmail.com>
* org-clock.el (org-resolve-clocks-if-idle): Fix to the way idle
time is reported after the user comes back (but before they
resolve time).
* org.el (org-get-repeat): Change so that this function can be
called with either `org-scheduled-string' or
`org-deadline-string'.
* org-clock.el (org-clock-auto-clock-resolution): Renamed
`org-clock-disable-clock-resolution', since negatives don't sound
good in customization variables.
(org-clock-in): Don't use the auto-resolution logic if the user is
clocking into a different task while an active clock is running.
This then allows the default behavior of clocking out of the open
task and then into the new task.
* org.el (org-modules): Made this variable more consistent, since
it was referring to Org, OrgMode and Org-mode, whereas the docs
for the variable always refer to Org-mode.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org.el (org-repeat-re): The changed org-repeat-re no longer
matched simple +2d type repeaters. Fix it so it does.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-latex.el (org-export-latex-preprocess): Protect the vspace
macro in the VERSE environment.
2009-11-13 John Wiegley <jwiegley@gmail.com>
* org-habit.el (org-habit-get-priority): A new function that
determines the relative priority of a habit, based on how long
past its scheduled date it is, and how near the deadline is.
* org-agenda.el (org-agenda-get-scheduled): Set habit priority
using `org-habit-get-priority'.
* org-habit.el (org-habit-build-graph): Start displaying colors
from the first scheduled date, if that date is earlier than the
first completion date.
* org-habit.el: Changed all "color" variables to faces, and made
them appropriate for light and dark backgrounds.
* org-habit.el (org-habit-duration-to-days): Made this function
more general.
(org-habit-parse-todo): Parse the new ".+N/N" style repeater.
* org-agenda.el (org-agenda-get-deadlines): Removed all mention of
habits, since they don't use DEADLINE anymore.
* org.el (org-repeat-re, org-display-custom-time)
(org-timestamp-change): Extended to support the new ".+N/N"
syntax, used for habits.
* org-clock.el (org-clock-resolve-clock): Fixed an incorrect
variable reference.
* org-agenda.el (org-agenda-set-mode-name): Show Habit in the
modeline when habits are being displayed (if that module is being
loaded).
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org-clock.el (org-x11-idle-seconds): Add a method to get the X11
idle time using the xscreensaver extension.
(org-user-idle-seconds): Use X11 idle time if available.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-next-line): New command.
(org-agenda-previous-line): New commands.
(org-agenda-show-and-scroll-up, org-agenda-show-scroll-down): New
commands.
(org-agenda-follow-mode): Do the follow immediately if the mode is
turned on here.
(previous-line, next-line): Replace keys with the corresponding
org functions.
(org-agenda-mode-map): Bind backspace and delete to the scrolling
command.
* org.el (org-icompleting-read): Turn off partial completion mode
for the duration of this completion round.
* org-latex.el (org-export-latex-fontify-headline): Protect TeX
macros in author lines and similar stuff.
* org.el (org-file-tags): Fix docstring.
(org-get-buffer-tags): Add the #+FILETAGS tags.
("ecb"): Maks ecb show context after jumping into an Org file.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org-agenda.el (org-finalize-agenda): Draw habit consistency
graphs after everything else in the buffer has been setup.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-mobile.el (org-mobile-apply): Count success and failure.
* org.el (org-indent-line-function): Fix regexp replace problem.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org-clock.el (org-clock-disable-clock-resolution): New
customization variable that disable automatic clock resolution on
clock in.
(org-clock-in): If `org-clock-disable-clock-resolution' is set, do
not automatically resolve anything. This is does not affect
idle-time resolution, however, if `org-clock-idle-time' is set.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org-habit.el: New file, which implements code to build a "habit
consistency graph".
* org-agenda.el (org-agenda-get-deadlines)
(org-agenda-get-scheduled): Display consistency graphs when
outputting habits into the agenda. The graphs are always relative
to the current time.
(org-format-agenda-item): Added new parameter `habitp', which
indicates whether we are formatting a habit or not. Do not
display "extra" leading information if habitp is true.
* org.el (org-repeat-re): Improved regexp to include .+ and ++
leaders for repeat strings.
(org-get-repeat): Now takes a string parameter `tagline', so the
caller can obtain the SCHEDULED repeat, or the DEADLINE repeat.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org-agenda.el (org-agenda-auto-exclude-function): New
customization variable for allowing the user to create an "auto
exclusion" filter for doing context-aware auto tag filtering.
(org-agenda-filter-by-tag): Changes to support the use of
`org-agenda-auto-exclude-function'. See the new manual addition,.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org.el (org-files-list): Don't attempt to return a file name for
Org buffers which have no associated file.
* org-agenda.el (org-agenda-do-action): Fixed a typo.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-mobile.el (org-mobile-locate-entry): Interpret files
relative to org-directory.
(org-mobile-inbox-for-pull): Document the best location for this
file.
(org-mobile-check-setup): Verify `org-directory'.
(org-mobile-create-index-file): Sort the files to be listed in
index.org.
2009-11-13 James TD Smith <ahktenzero@mohorovi.cc>
* org.el (org-fast-tag-selection): Add a way to display a
description for a tag group. This is done by adding a string to
either the startgroup or endgroup cell.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-resolve, org-resolve-clocks)
(org-emacs-idle-seconds): Use `org-float-time' instead of
`time-to-seconds'
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-sorting-strategy): Fix customization
type.
* org.el (org-pre-cycle-hook): Document that `empty' can also be
the value of ARG when doing local cycling.
2009-11-13 John Wiegley <johnw@newartisans.com>
* org-clock.el (org-clock-resolve-clock): If keeping or
subtracting time results in a clock out at a time in the past, and
if the resolution occurred due to idleness or invoking `M-x
org-resolve-clocks', remember that past moment in time. On the
next clock in, the user will be prompted to see if they want to
back-date their new clock to then.
(org-clock-resolve): Do not jump the user to the location of a
dangling clock if the resolution is occuring due to an idle
timeout. In that case there is typically only one dangling clock,
the active one, and there is no value gained by shuffling their
windows around to show it to them. Being prompted to resolve an
idle clock should be as inobtrusive as possible.
(org-resolve-clocks-if-idle): New function that resolves only the
currently active clock if the user has exceeded the time returned
by `org-user-idle-seconds', based on the value of
`org-clock-idle-time'.
(org-clock-in): If, after resolving clocks,
(org-clock-out): Cancel the `org-clock-idle-timer' on clock out.
* org-clock.el (org-clock-resolve-clock): New function that
resolves a clock to a specific time, closing or resuming as need
be, and possibly even starting a new clock.
(org-clock-resolve): New function used by `org-resolve-clocks'
that sets up for the call to `org-clock-resolve-clock'. It
determines the time to resolve to based on a single-character
selection from the user to either keep time, subtract away time or
cancel the clock.
(org-resolve-clocks): New user command which resolves dangling
clocks -- that is, open but not active -- anywhere in the file
list returned by `org-files-list'.
(org-clock-in): Automatically resolve dangling clocks whenever a
user clocks in.
(org-clock-cancel): If the user cancels the solely clock in a
LOGBOOK, remove the empty drawer.
* org-clock.el (org-clock-idle-time): New user customizable option
for detecting whether the user has left a clock idle. Note: it is
only used in this commit to test whether it's worthwhile to check
OS X to get the Mac user's current idle time. If the Emacs idle
time is less than the value, the user hasn't been away long enough
to be worth checking (a more expensive test than just getting
Emacs idle time).
(org-user-idle-seconds, org-mac-idle-seconds)
(org-emacs-idle-seconds): This three functions, in conjunction
with the user customization variable `org-clock-idle-time', return
the number of seconds (as a floating point) that the user has been
away from their Emacs (or, if running on OS X, their computer).
* org-clock.el (org-find-open-clocks): New function that returns a
list of all open clocks in the given FILE. Note that each clock
it returns is a cons cell of the format (MARKER . START-TIME).
This "clock" value is used by several of the new clock module
utility functions.
(org-is-active-clock): New inline function which tests whether the
given clock value is the same as the currently active clock.
Returns non-nil if this is the case.
(org-with-clock-position): New macro that evaluates FORMS with
point in the buffer and at the position of the given clock.
Changes to the current clock are global.
(org-with-clock): New macro that evaluates FORMS with point in the
buffer and at the position of the given clock. However, changes
to the current clock are local and have no effect on the user's
active clock. This allows, for example, far any clock to be
cancelled without cancelling the active clock.
(org-clock-clock-in): New inline function that switches the active
clock to the given clock. If either the argument RESUME, or the
global `org-clock-in-resume', are non-nil, it will resume a clock
that was previously left open.
(org-clock-clock-out): New inline function that clocks out the
given clock value without affecting the currently active clock.
(org-clock-clock-cancel): New inline function that cancels the
given clock value without affecting the currently active clock.
* org-clock.el (org-clock-in): Before creating
`org-clock-mode-line-timer', check to make sure an older timer is
not currently running.
(org-clock-out): Accept new third parameter `at-time', which
permits a clock to be clocked out at a specific time. Note that
no attempt is made to verify that the clock out time is later than
the clock in time.
* org.el (org-files-list): New utility function for returning a
list of all open org-mode buffers, plus all files used to build
the agenda buffer. Note that not all the files will necessarily
be visited by a buffer at time of call.
(org-entry-beginning-position): Like the function
`line-beginning-position', this inline function returns the
beginning position of the current heading/entry.
(org-entry-end-position): Like the function `line-end-position',
this inline function returns the end position of the current
heading/entry.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-list): Mark the all-todo items line as
a header line.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-inlinetask-remove-END-maybe): Declare function.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-agenda.el (org-agenda-filter-make-matcher): Allow to filter
entries that have no tags.
(org-agenda-search-view): New customize group.
(org-agenda-search-view-search-words-only): New option.
(org-search-view): Implement substring search.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-outline-level): Add doc string.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-inlinetask.el (org-inlinetask-export): Re-introduce
variable.
(org-inlinetask-export-handler): Only export inline task if the
user option calls for it.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-exp.el (org-export-handle-export-tags): Remove inlinetask
END if present.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-latex.el (org-export-latex-tables): Don't format in
protected regions.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-src.el (org-edit-src-code)
(org-edit-src-find-region-and-lang, org-edit-src-exit): Handle
macro editing.
* org-agenda.el (org-prefix-category-max-length): New variable.
(org-format-agenda-item): Use `org-prefix-category-max-length'.
(org-compile-prefix-format): Set `org-prefix-category-max-length'.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-mobile.el (org-mobile-create-index-file): Improve the
listing of tags and todo keywords.
* org-latex.el (org-export-latex-format-image): New function.
(org-export-latex-links): Use `org-export-latex-format-image'.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org-inlinetask.el (org-inlinetask-get-current-indentation)
(org-inlinetask-remove-terminator): New functions.
(org-inlinetask-export-handler): Terminate the description list.
* org-exp.el (org-export-select-backend-specific-text): Remove the
region markers.
* org-inlinetask.el (org-inlinetask-export-handler): fix bug for
tasks without content.
* org-clock.el: Make sure the clock-in target position does not
move to a different node by widening the buffer.
* org-html.el (org-export-html-format-image): Wrap image into
figure div only when there is a caption.
* org-archive.el (org-archive-mark-done): Change default value to
nil.
2009-11-13 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-context): Call `bobp', not `eobp'.
* org-clock.el (org-clock-cancel): Remove quotes from marker
variables.
* org.el (org-read-date-prefer-future): New allowed value `time'.
(org-read-date-analyze): Shift day to tomorrow depending on time
entered and value of `org-read-date-prefer-future'.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Fri, 13 Nov 2009 08:37:55 +0000 |
parents | 131bccfc4f5d |
children | b92e7ae35c75 |
comparison
equal
deleted
inserted
replaced
105972:371db60eff06 | 105973:b7d8222914b4 |
---|---|
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.31a | 7 ;; Version: 6.33 |
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 |
92 "\\documentclass[11pt]{article} | 92 "\\documentclass[11pt]{article} |
93 \\usepackage[utf8]{inputenc} | 93 \\usepackage[utf8]{inputenc} |
94 \\usepackage[T1]{fontenc} | 94 \\usepackage[T1]{fontenc} |
95 \\usepackage{graphicx} | 95 \\usepackage{graphicx} |
96 \\usepackage{longtable} | 96 \\usepackage{longtable} |
97 \\usepackage{float} | |
98 \\usepackage{wrapfig} | |
97 \\usepackage{soul} | 99 \\usepackage{soul} |
100 \\usepackage{amssymb} | |
98 \\usepackage{hyperref}" | 101 \\usepackage{hyperref}" |
99 ("\\section{%s}" . "\\section*{%s}") | 102 ("\\section{%s}" . "\\section*{%s}") |
100 ("\\subsection{%s}" . "\\subsection*{%s}") | 103 ("\\subsection{%s}" . "\\subsection*{%s}") |
101 ("\\subsubsection{%s}" . "\\subsubsection*{%s}") | 104 ("\\subsubsection{%s}" . "\\subsubsection*{%s}") |
102 ("\\paragraph{%s}" . "\\paragraph*{%s}") | 105 ("\\paragraph{%s}" . "\\paragraph*{%s}") |
105 "\\documentclass[11pt]{report} | 108 "\\documentclass[11pt]{report} |
106 \\usepackage[utf8]{inputenc} | 109 \\usepackage[utf8]{inputenc} |
107 \\usepackage[T1]{fontenc} | 110 \\usepackage[T1]{fontenc} |
108 \\usepackage{graphicx} | 111 \\usepackage{graphicx} |
109 \\usepackage{longtable} | 112 \\usepackage{longtable} |
113 \\usepackage{float} | |
114 \\usepackage{wrapfig} | |
110 \\usepackage{soul} | 115 \\usepackage{soul} |
116 \\usepackage{amssymb} | |
111 \\usepackage{hyperref}" | 117 \\usepackage{hyperref}" |
112 ("\\part{%s}" . "\\part*{%s}") | 118 ("\\part{%s}" . "\\part*{%s}") |
113 ("\\chapter{%s}" . "\\chapter*{%s}") | 119 ("\\chapter{%s}" . "\\chapter*{%s}") |
114 ("\\section{%s}" . "\\section*{%s}") | 120 ("\\section{%s}" . "\\section*{%s}") |
115 ("\\subsection{%s}" . "\\subsection*{%s}") | 121 ("\\subsection{%s}" . "\\subsection*{%s}") |
118 "\\documentclass[11pt]{book} | 124 "\\documentclass[11pt]{book} |
119 \\usepackage[utf8]{inputenc} | 125 \\usepackage[utf8]{inputenc} |
120 \\usepackage[T1]{fontenc} | 126 \\usepackage[T1]{fontenc} |
121 \\usepackage{graphicx} | 127 \\usepackage{graphicx} |
122 \\usepackage{longtable} | 128 \\usepackage{longtable} |
129 \\usepackage{float} | |
130 \\usepackage{wrapfig} | |
123 \\usepackage{soul} | 131 \\usepackage{soul} |
132 \\usepackage{amssymb} | |
124 \\usepackage{hyperref}" | 133 \\usepackage{hyperref}" |
125 ("\\part{%s}" . "\\part*{%s}") | 134 ("\\part{%s}" . "\\part*{%s}") |
126 ("\\chapter{%s}" . "\\chapter*{%s}") | 135 ("\\chapter{%s}" . "\\chapter*{%s}") |
127 ("\\section{%s}" . "\\section*{%s}") | 136 ("\\section{%s}" . "\\section*{%s}") |
128 ("\\subsection{%s}" . "\\subsection*{%s}") | 137 ("\\subsection{%s}" . "\\subsection*{%s}") |
175 ("~" "\\verb" t)) | 184 ("~" "\\verb" t)) |
176 "Alist of LaTeX expressions to convert emphasis fontifiers. | 185 "Alist of LaTeX expressions to convert emphasis fontifiers. |
177 Each element of the list is a list of three elements. | 186 Each element of the list is a list of three elements. |
178 The first element is the character used as a marker for fontification. | 187 The first element is the character used as a marker for fontification. |
179 The second element is a formatting string to wrap fontified text with. | 188 The second element is a formatting string to wrap fontified text with. |
180 If it is \"\\verb\", Org will automatically select a deimiter | 189 If it is \"\\verb\", Org will automatically select a delimiter |
181 character that is not in the string. | 190 character that is not in the string. |
182 The third element decides whether to protect converted text from other | 191 The third element decides whether to protect converted text from other |
183 conversions." | 192 conversions." |
184 :group 'org-export-latex | 193 :group 'org-export-latex |
185 :type 'alist) | 194 :type 'alist) |
267 the %s stands here for the inserted headline and is mandatory. | 276 the %s stands here for the inserted headline and is mandatory. |
268 | 277 |
269 It may also be a list of three string to define a user-defined environment | 278 It may also be a list of three string to define a user-defined environment |
270 that should be used. The first string should be the like | 279 that should be used. The first string should be the like |
271 \"\\begin{itemize}\", the second should be like \"\\item %s %s\" with up | 280 \"\\begin{itemize}\", the second should be like \"\\item %s %s\" with up |
272 to two occurrences of %s for the title and a lable, respectively. The third | 281 to two occurrences of %s for the title and a label, respectively. The third |
273 string should be like \"\\end{itemize\"." | 282 string should be like \"\\end{itemize\"." |
274 :group 'org-export-latex | 283 :group 'org-export-latex |
275 :type '(choice (const :tag "Ignore" nil) | 284 :type '(choice (const :tag "Ignore" nil) |
276 (const :tag "Convert as descriptive list" description) | 285 (const :tag "Convert as descriptive list" description) |
277 (const :tag "Convert as itemized list" itemize) | 286 (const :tag "Convert as itemized list" itemize) |
282 (string :tag "End") | 291 (string :tag "End") |
283 (string :tag "item")) | 292 (string :tag "item")) |
284 (string :tag "Use a section string" :value "\\subparagraph{%s}"))) | 293 (string :tag "Use a section string" :value "\\subparagraph{%s}"))) |
285 | 294 |
286 (defcustom org-export-latex-list-parameters | 295 (defcustom org-export-latex-list-parameters |
287 '(:cbon "\\texttt{[X]}" :cboff "\\texttt{[ ]}") | 296 '(:cbon "$\\boxtimes$" :cboff "$\\Box$") |
288 "Parameters for the LaTeX list exporter. | 297 "Parameters for the LaTeX list exporter. |
289 These parameters will be passed on to `org-list-to-latex', which in turn | 298 These parameters will be passed on to `org-list-to-latex', which in turn |
290 will pass them (combined with the LaTeX default list parameters) to | 299 will pass them (combined with the LaTeX default list parameters) to |
291 `org-list-to-generic'." | 300 `org-list-to-generic'." |
292 :group 'org-export-latex | 301 :group 'org-export-latex |
387 This is a list of strings, each of them will be given to the shell | 396 This is a list of strings, each of them will be given to the shell |
388 as a command. %s in the command will be replaced by the full file name, %b | 397 as a command. %s in the command will be replaced by the full file name, %b |
389 by the file base name (i.e. without extension). | 398 by the file base name (i.e. without extension). |
390 The reason why this is a list is that it usually takes several runs of | 399 The reason why this is a list is that it usually takes several runs of |
391 pdflatex, maybe mixed with a call to bibtex. Org does not have a clever | 400 pdflatex, maybe mixed with a call to bibtex. Org does not have a clever |
392 mechanism to detect whihc of these commands have to be run to get to a stable | 401 mechanism to detect which of these commands have to be run to get to a stable |
393 result, and it also does not do any error checking. | 402 result, and it also does not do any error checking. |
394 | 403 |
395 Alternatively, this may be a Lisp function that does the processing, so you | 404 Alternatively, this may be a Lisp function that does the processing, so you |
396 could use this to apply the machinery of AUCTeX or the Emacs LaTeX mode. | 405 could use this to apply the machinery of AUCTeX or the Emacs LaTeX mode. |
397 THis function should accept the file name as its single argument." | 406 This function should accept the file name as its single argument." |
398 :group 'org-export-latex | 407 :group 'org-export-latex |
399 :type '(choice (repeat :tag "Shell command sequence" | 408 :type '(choice (repeat :tag "Shell command sequence" |
400 (string :tag "Shell command")) | 409 (string :tag "Shell command")) |
401 (function))) | 410 (function))) |
402 | 411 |
479 (interactive "r\nP") | 488 (interactive "r\nP") |
480 (when (interactive-p) | 489 (when (interactive-p) |
481 (setq buffer "*Org LaTeX Export*")) | 490 (setq buffer "*Org LaTeX Export*")) |
482 (let ((transient-mark-mode t) (zmacs-regions t) | 491 (let ((transient-mark-mode t) (zmacs-regions t) |
483 ext-plist rtn) | 492 ext-plist rtn) |
484 (setq ext-plist (plist-put ext-plist :ignore-subree-p t)) | 493 (setq ext-plist (plist-put ext-plist :ignore-subtree-p t)) |
485 (goto-char end) | 494 (goto-char end) |
486 (set-mark (point)) ;; to activate the region | 495 (set-mark (point)) ;; to activate the region |
487 (goto-char beg) | 496 (goto-char beg) |
488 (setq rtn (org-export-as-latex | 497 (setq rtn (org-export-as-latex |
489 nil nil ext-plist | 498 nil nil ext-plist |
533 (opt-plist org-export-latex-options-plist) | 542 (opt-plist org-export-latex-options-plist) |
534 (region-p (org-region-active-p)) | 543 (region-p (org-region-active-p)) |
535 (rbeg (and region-p (region-beginning))) | 544 (rbeg (and region-p (region-beginning))) |
536 (rend (and region-p (region-end))) | 545 (rend (and region-p (region-end))) |
537 (subtree-p | 546 (subtree-p |
538 (if (plist-get opt-plist :ignore-subree-p) | 547 (if (plist-get opt-plist :ignore-subtree-p) |
539 nil | 548 nil |
540 (when region-p | 549 (when region-p |
541 (save-excursion | 550 (save-excursion |
542 (goto-char rbeg) | 551 (goto-char rbeg) |
543 (and (org-at-heading-p) | 552 (and (org-at-heading-p) |
975 (org-export-latex-content | 984 (org-export-latex-content |
976 title '(lists tables fixed-width keywords))) | 985 title '(lists tables fixed-width keywords))) |
977 ;; insert author info | 986 ;; insert author info |
978 (if (plist-get opt-plist :author-info) | 987 (if (plist-get opt-plist :author-info) |
979 (format "\\author{%s}\n" | 988 (format "\\author{%s}\n" |
980 (org-export-latex-fontify-headline (or author user-full-name)));???????????????????? | 989 (org-export-latex-fontify-headline (or author user-full-name))) |
981 (format "%%\\author{%s}\n" | 990 (format "%%\\author{%s}\n" |
982 (or author user-full-name))) | 991 (or author user-full-name))) |
983 ;; insert the date | 992 ;; insert the date |
984 (format "\\date{%s}\n" | 993 (format "\\date{%s}\n" |
985 (format-time-string | 994 (format-time-string |
998 (plist-get opt-plist :section-numbers)) | 1007 (plist-get opt-plist :section-numbers)) |
999 (cond ((numberp toc) | 1008 (cond ((numberp toc) |
1000 (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" | 1009 (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" |
1001 (min toc (plist-get opt-plist :headline-levels)))) | 1010 (min toc (plist-get opt-plist :headline-levels)))) |
1002 (toc (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" | 1011 (toc (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\\vspace*{1cm}\n" |
1003 (plist-get opt-plist :headline-levels)))))))) | 1012 (plist-get opt-plist :headline-levels))))) |
1013 (when (plist-get opt-plist :preserve-breaks) | |
1014 "\\obeylines\n")))) | |
1004 | 1015 |
1005 (defun org-export-latex-first-lines (opt-plist &optional beg end) | 1016 (defun org-export-latex-first-lines (opt-plist &optional beg end) |
1006 "Export the first lines before first headline. | 1017 "Export the first lines before first headline. |
1007 If BEG is non-nil, it is the beginning of the region. | 1018 If BEG is non-nil, it is the beginning of the region. |
1008 If END is non-nil, it is the end of the region." | 1019 If END is non-nil, it is the end of the region." |
1122 (with-temp-buffer | 1133 (with-temp-buffer |
1123 ;; FIXME: org-inside-LaTeX-fragment-p doesn't work when the $...$ is at | 1134 ;; FIXME: org-inside-LaTeX-fragment-p doesn't work when the $...$ is at |
1124 ;; the beginning of the buffer - inserting "\n" is safe here though. | 1135 ;; the beginning of the buffer - inserting "\n" is safe here though. |
1125 (insert "\n" string) | 1136 (insert "\n" string) |
1126 (goto-char (point-min)) | 1137 (goto-char (point-min)) |
1138 (let ((re (concat "\\\\[a-zA-Z]+\\(?:" | |
1139 "\\[.*\\]" | |
1140 "\\)?" | |
1141 (org-create-multibrace-regexp "{" "}" 3)))) | |
1142 (while (re-search-forward re nil t) | |
1143 (unless (save-excursion (goto-char (match-beginning 0)) | |
1144 (equal (char-after (point-at-bol)) ?#)) | |
1145 (add-text-properties (match-beginning 0) (match-end 0) | |
1146 '(org-protected t))))) | |
1127 (when (plist-get org-export-latex-options-plist :emphasize) | 1147 (when (plist-get org-export-latex-options-plist :emphasize) |
1128 (org-export-latex-fontify)) | 1148 (org-export-latex-fontify)) |
1129 (org-export-latex-keywords-maybe) | 1149 (org-export-latex-keywords-maybe) |
1130 (org-export-latex-special-chars | 1150 (org-export-latex-special-chars |
1131 (plist-get org-export-latex-options-plist :sub-superscript)) | 1151 (plist-get org-export-latex-options-plist :sub-superscript)) |
1149 (let* ((lang (plist-get org-export-latex-options-plist :language)) | 1169 (let* ((lang (plist-get org-export-latex-options-plist :language)) |
1150 (quote-rpl (if (equal lang "fr") | 1170 (quote-rpl (if (equal lang "fr") |
1151 '(("\\(\\s-\\)\"" "«~") | 1171 '(("\\(\\s-\\)\"" "«~") |
1152 ("\\(\\S-\\)\"" "~»") | 1172 ("\\(\\S-\\)\"" "~»") |
1153 ("\\(\\s-\\)'" "`")) | 1173 ("\\(\\s-\\)'" "`")) |
1154 '(("\\(\\s-\\|(\\)\"" "``") | 1174 '(("\\(\\s-\\|[[(]\\)\"" "``") |
1155 ("\\(\\S-\\)\"" "''") | 1175 ("\\(\\S-\\)\"" "''") |
1156 ("\\(\\s-\\|(\\)'" "`"))))) | 1176 ("\\(\\s-\\|(\\)'" "`"))))) |
1157 (mapc (lambda(l) (goto-char (point-min)) | 1177 (mapc (lambda(l) (goto-char (point-min)) |
1158 (while (re-search-forward (car l) nil t) | 1178 (while (re-search-forward (car l) nil t) |
1159 (let ((rpl (concat (match-string 1) (cadr l)))) | 1179 (let ((rpl (concat (match-string 1) |
1160 (org-export-latex-protect-string rpl) | 1180 (org-export-latex-protect-string |
1181 (copy-sequence (cadr l)))))) | |
1161 (org-if-unprotected-1 | 1182 (org-if-unprotected-1 |
1162 (replace-match rpl t t))))) quote-rpl))) | 1183 (replace-match rpl t t))))) quote-rpl))) |
1163 | 1184 |
1164 (defun org-export-latex-special-chars (sub-superscript) | 1185 (defun org-export-latex-special-chars (sub-superscript) |
1165 "Export special characters to LaTeX. | 1186 "Export special characters to LaTeX. |
1327 (declare-function orgtbl-to-latex "org-table" (table params) t) | 1348 (declare-function orgtbl-to-latex "org-table" (table params) t) |
1328 (defun org-export-latex-tables (insert) | 1349 (defun org-export-latex-tables (insert) |
1329 "Convert tables to LaTeX and INSERT it." | 1350 "Convert tables to LaTeX and INSERT it." |
1330 (goto-char (point-min)) | 1351 (goto-char (point-min)) |
1331 (while (re-search-forward "^\\([ \t]*\\)|" nil t) | 1352 (while (re-search-forward "^\\([ \t]*\\)|" nil t) |
1332 (org-table-align) | 1353 (org-if-unprotected-at (1- (point)) |
1333 (let* ((beg (org-table-begin)) | 1354 (org-table-align) |
1334 (end (org-table-end)) | 1355 (let* ((beg (org-table-begin)) |
1335 (raw-table (buffer-substring beg end)) | 1356 (end (org-table-end)) |
1336 (org-table-last-alignment (copy-sequence org-table-last-alignment)) | 1357 (raw-table (buffer-substring beg end)) |
1337 (org-table-last-column-widths (copy-sequence | 1358 (org-table-last-alignment (copy-sequence org-table-last-alignment)) |
1338 org-table-last-column-widths)) | 1359 (org-table-last-column-widths (copy-sequence |
1339 fnum fields line lines olines gr colgropen line-fmt align | 1360 org-table-last-column-widths)) |
1340 caption label attr floatp longtblp) | 1361 fnum fields line lines olines gr colgropen line-fmt align |
1341 (if org-export-latex-tables-verbatim | 1362 caption label attr floatp longtblp) |
1342 (let* ((tbl (concat "\\begin{verbatim}\n" raw-table | 1363 (if org-export-latex-tables-verbatim |
1343 "\\end{verbatim}\n"))) | 1364 (let* ((tbl (concat "\\begin{verbatim}\n" raw-table |
1344 (apply 'delete-region (list beg end)) | 1365 "\\end{verbatim}\n"))) |
1345 (insert (org-export-latex-protect-string tbl))) | 1366 (apply 'delete-region (list beg end)) |
1346 (progn | 1367 (insert (org-export-latex-protect-string tbl))) |
1347 (setq caption (org-find-text-property-in-string | 1368 (progn |
1348 'org-caption raw-table) | 1369 (setq caption (org-find-text-property-in-string |
1349 attr (org-find-text-property-in-string | 1370 'org-caption raw-table) |
1350 'org-attributes raw-table) | 1371 attr (org-find-text-property-in-string |
1351 label (org-find-text-property-in-string | 1372 'org-attributes raw-table) |
1352 'org-label raw-table) | 1373 label (org-find-text-property-in-string |
1353 longtblp (and attr (stringp attr) | 1374 'org-label raw-table) |
1354 (string-match "\\<longtable\\>" attr)) | 1375 longtblp (and attr (stringp attr) |
1355 align (and attr (stringp attr) | 1376 (string-match "\\<longtable\\>" attr)) |
1356 (string-match "\\<align=\\([^ \t\n\r,]+\\)" attr) | 1377 align (and attr (stringp attr) |
1357 (match-string 1 attr)) | 1378 (string-match "\\<align=\\([^ \t\n\r,]+\\)" attr) |
1358 floatp (or caption label)) | 1379 (match-string 1 attr)) |
1359 (setq lines (org-split-string raw-table "\n")) | 1380 floatp (or caption label)) |
1360 (apply 'delete-region (list beg end)) | 1381 (setq lines (org-split-string raw-table "\n")) |
1361 (when org-export-table-remove-special-lines | 1382 (apply 'delete-region (list beg end)) |
1362 (setq lines (org-table-clean-before-export lines 'maybe-quoted))) | 1383 (when org-export-table-remove-special-lines |
1363 (when org-table-clean-did-remove-column | 1384 (setq lines (org-table-clean-before-export lines 'maybe-quoted))) |
1385 (when org-table-clean-did-remove-column | |
1364 (pop org-table-last-alignment) | 1386 (pop org-table-last-alignment) |
1365 (pop org-table-last-column-widths)) | 1387 (pop org-table-last-column-widths)) |
1366 ;; make a formatting string to reflect aligment | 1388 ;; make a formatting string to reflect alignment |
1367 (setq olines lines) | 1389 (setq olines lines) |
1368 (while (and (not line-fmt) (setq line (pop olines))) | 1390 (while (and (not line-fmt) (setq line (pop olines))) |
1369 (unless (string-match "^[ \t]*|-" line) | 1391 (unless (string-match "^[ \t]*|-" line) |
1370 (setq fields (org-split-string line "[ \t]*|[ \t]*")) | 1392 (setq fields (org-split-string line "[ \t]*|[ \t]*")) |
1371 (setq fnum (make-vector (length fields) 0)) | 1393 (setq fnum (make-vector (length fields) 0)) |
1372 (setq line-fmt | 1394 (setq line-fmt |
1373 (mapconcat | 1395 (mapconcat |
1374 (lambda (x) | 1396 (lambda (x) |
1375 (setq gr (pop org-table-colgroup-info)) | 1397 (setq gr (pop org-table-colgroup-info)) |
1376 (format "%s%%s%s" | 1398 (format "%s%%s%s" |
1377 (cond ((eq gr :start) | 1399 (cond ((eq gr :start) |
1378 (prog1 (if colgropen "|" "|") | 1400 (prog1 (if colgropen "|" "|") |
1379 (setq colgropen t))) | 1401 (setq colgropen t))) |
1380 ((eq gr :startend) | 1402 ((eq gr :startend) |
1381 (prog1 (if colgropen "|" "|") | 1403 (prog1 (if colgropen "|" "|") |
1382 (setq colgropen nil))) | 1404 (setq colgropen nil))) |
1383 (t "")) | 1405 (t "")) |
1384 (if (memq gr '(:end :startend)) | 1406 (if (memq gr '(:end :startend)) |
1385 (progn (setq colgropen nil) "|") | 1407 (progn (setq colgropen nil) "|") |
1386 ""))) | 1408 ""))) |
1387 fnum "")))) | 1409 fnum "")))) |
1388 ;; fix double || in line-fmt | 1410 ;; fix double || in line-fmt |
1389 (setq line-fmt (replace-regexp-in-string "||" "|" line-fmt)) | 1411 (setq line-fmt (replace-regexp-in-string "||" "|" line-fmt)) |
1390 ;; maybe remove the first and last "|" | 1412 ;; maybe remove the first and last "|" |
1391 (when (and (not org-export-latex-tables-column-borders) | 1413 (when (and (not org-export-latex-tables-column-borders) |
1392 (string-match "^\\(|\\)?\\(.+\\)|$" line-fmt)) | 1414 (string-match "^\\(|\\)?\\(.+\\)|$" line-fmt)) |
1393 (setq line-fmt (match-string 2 line-fmt))) | 1415 (setq line-fmt (match-string 2 line-fmt))) |
1394 ;; format alignment | 1416 ;; format alignment |
1395 (unless align | 1417 (unless align |
1396 (setq align (apply 'format | 1418 (setq align (apply 'format |
1397 (cons line-fmt | 1419 (cons line-fmt |
1398 (mapcar (lambda (x) (if x "r" "l")) | 1420 (mapcar (lambda (x) (if x "r" "l")) |
1399 org-table-last-alignment))))) | 1421 org-table-last-alignment))))) |
1400 ;; prepare the table to send to orgtbl-to-latex | 1422 ;; prepare the table to send to orgtbl-to-latex |
1401 (setq lines | 1423 (setq lines |
1402 (mapcar | 1424 (mapcar |
1403 (lambda(elem) | 1425 (lambda(elem) |
1404 (or (and (string-match "[ \t]*|-+" elem) 'hline) | 1426 (or (and (string-match "[ \t]*|-+" elem) 'hline) |
1405 (org-split-string (org-trim elem) "|"))) | 1427 (org-split-string (org-trim elem) "|"))) |
1406 lines)) | 1428 lines)) |
1407 (when insert | 1429 (when insert |
1408 (insert (org-export-latex-protect-string | 1430 (insert (org-export-latex-protect-string |
1409 (concat | 1431 (concat |
1410 (if longtblp | 1432 (if longtblp |
1411 (concat "\\begin{longtable}{" align "}\n") | 1433 (concat "\\begin{longtable}{" align "}\n") |
1412 (if floatp "\\begin{table}[htb]\n")) | 1434 (if floatp "\\begin{table}[htb]\n")) |
1413 (if (or floatp longtblp) | 1435 (if (or floatp longtblp) |
1414 (format | 1436 (format |
1415 "\\caption{%s%s}" | 1437 "\\caption{%s%s}" |
1416 (if label (concat "\\\label{" label "}") "") | 1438 (if label (concat "\\\label{" label "}") "") |
1417 (or caption ""))) | 1439 (or caption ""))) |
1418 (if longtblp "\\\\\n" "\n") | 1440 (if longtblp "\\\\\n" "\n") |
1419 (if (and org-export-latex-tables-centered (not longtblp)) | 1441 (if (and org-export-latex-tables-centered (not longtblp)) |
1420 "\\begin{center}\n") | 1442 "\\begin{center}\n") |
1421 (if (not longtblp) (concat "\\begin{tabular}{" align "}\n")) | 1443 (if (not longtblp) (concat "\\begin{tabular}{" align "}\n")) |
1422 (orgtbl-to-latex | 1444 (orgtbl-to-latex |
1423 lines | 1445 lines |
1424 `(:tstart nil :tend nil | 1446 `(:tstart nil :tend nil |
1425 :hlend ,(if longtblp | 1447 :hlend ,(if longtblp |
1426 (format "\\\\ | 1448 (format "\\\\ |
1427 \\hline | 1449 \\hline |
1428 \\endhead | 1450 \\endhead |
1429 \\hline\\multicolumn{%d}{r}{Continued on next page}\\ | 1451 \\hline\\multicolumn{%d}{r}{Continued on next page}\\ |
1430 \\endfoot | 1452 \\endfoot |
1431 \\endlastfoot" (length org-table-last-alignment)) | 1453 \\endlastfoot" (length org-table-last-alignment)) |
1432 nil))) | 1454 nil))) |
1433 (if (not longtblp) (concat "\n\\end{tabular}")) | 1455 (if (not longtblp) (concat "\n\\end{tabular}")) |
1434 (if longtblp "\n" (if org-export-latex-tables-centered | 1456 (if longtblp "\n" (if org-export-latex-tables-centered |
1435 "\n\\end{center}\n" "\n")) | 1457 "\n\\end{center}\n" "\n")) |
1436 (if longtblp | 1458 (if longtblp |
1437 "\\end{longtable}" | 1459 "\\end{longtable}" |
1438 (if floatp "\\end{table}")))) | 1460 (if floatp "\\end{table}")))) |
1439 "\n\n"))))))) | 1461 "\n\n")))))))) |
1440 | 1462 |
1441 (defun org-export-latex-fontify () | 1463 (defun org-export-latex-fontify () |
1442 "Convert fontification to LaTeX." | 1464 "Convert fontification to LaTeX." |
1443 (goto-char (point-min)) | 1465 (goto-char (point-min)) |
1444 (while (re-search-forward org-emph-re nil t) | 1466 (while (re-search-forward org-emph-re nil t) |
1445 ;; The match goes one char after the *string* | 1467 ;; The match goes one char after the *string* |
1446 (let ((emph (assoc (match-string 3) | 1468 (let ((emph (assoc (match-string 3) |
1447 org-export-latex-emphasis-alist)) | 1469 org-export-latex-emphasis-alist)) |
1448 (beg (match-beginning 0)) | 1470 (beg (match-beginning 0)) |
1449 (end (match-end 0)) | 1471 (end (match-end 0)) |
1450 rpl) | 1472 rpl s) |
1451 (unless emph | 1473 (unless emph |
1452 (message "`org-export-latex-emphasis-alist' has no entry for formatting triggered by \"%s\"" | 1474 (message "`org-export-latex-emphasis-alist' has no entry for formatting triggered by \"%s\"" |
1453 (match-string 3))) | 1475 (match-string 3))) |
1454 (unless (or (get-text-property (1- (point)) 'org-protected) | 1476 (unless (or (and (get-text-property (- (point) 2) 'org-protected) |
1477 (not (get-text-property | |
1478 (- (point) 2) 'org-verbatim-emph))) | |
1455 (save-excursion | 1479 (save-excursion |
1456 (goto-char (match-beginning 1)) | 1480 (goto-char (match-beginning 1)) |
1457 (save-match-data | 1481 (save-match-data |
1458 (and (org-at-table-p) | 1482 (and (org-at-table-p) |
1459 (string-match | 1483 (string-match |
1460 "[|\n]" (buffer-substring beg end)))))) | 1484 "[|\n]" (buffer-substring beg end)))))) |
1485 (setq s (match-string 4)) | |
1461 (setq rpl (concat (match-string 1) | 1486 (setq rpl (concat (match-string 1) |
1462 (org-export-latex-emph-format (cadr emph) | 1487 (org-export-latex-emph-format (cadr emph) |
1463 (match-string 4)) | 1488 (match-string 4)) |
1464 (match-string 5))) | 1489 (match-string 5))) |
1465 (if (caddr emph) | 1490 (if (caddr emph) |
1466 (setq rpl (org-export-latex-protect-string rpl))) | 1491 (setq rpl (org-export-latex-protect-string rpl)) |
1492 (save-match-data | |
1493 (if (string-match "\\`.\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).\\'" rpl) | |
1494 (progn | |
1495 (add-text-properties (match-beginning 1) (match-end 1) | |
1496 '(org-protected t) rpl) | |
1497 (add-text-properties (match-beginning 3) (match-end 3) | |
1498 '(org-protected t) rpl))))) | |
1467 (replace-match rpl t t))) | 1499 (replace-match rpl t t))) |
1468 (backward-char))) | 1500 (backward-char))) |
1469 | 1501 |
1470 (defvar org-export-latex-use-verb nil) | 1502 (defvar org-export-latex-use-verb nil) |
1471 (defun org-export-latex-emph-format (format string) | 1503 (defun org-export-latex-emph-format (format string) |
1494 0 (match-beginning 0))))) | 1526 0 (match-beginning 0))))) |
1495 (setq string (substring string (1+ (match-beginning 0)))) | 1527 (setq string (substring string (1+ (match-beginning 0)))) |
1496 (setq char (or (cdr (assoc char trans)) (concat "\\" char)) | 1528 (setq char (or (cdr (assoc char trans)) (concat "\\" char)) |
1497 rtn (concat rtn char))) | 1529 rtn (concat rtn char))) |
1498 (setq string (concat rtn string) format "\\texttt{%s}"))))) | 1530 (setq string (concat rtn string) format "\\texttt{%s}"))))) |
1499 (setq string (org-export-latex-protect-string | 1531 (format format string)) |
1500 (format format string)))) | |
1501 | 1532 |
1502 (defun org-export-latex-links () | 1533 (defun org-export-latex-links () |
1503 ;; Make sure to use the LaTeX hyperref and graphicx package | 1534 ;; Make sure to use the LaTeX hyperref and graphicx package |
1504 ;; or send some warnings. | 1535 ;; or send some warnings. |
1505 "Convert links to LaTeX." | 1536 "Convert links to LaTeX." |
1506 (goto-char (point-min)) | 1537 (goto-char (point-min)) |
1507 (while (re-search-forward org-bracket-link-analytic-regexp++ nil t) | 1538 (while (re-search-forward org-bracket-link-analytic-regexp++ nil t) |
1508 (org-if-unprotected | 1539 (org-if-unprotected-1 |
1509 (goto-char (match-beginning 0)) | 1540 (goto-char (match-beginning 0)) |
1510 (let* ((re-radio org-export-latex-all-targets-re) | 1541 (let* ((re-radio org-export-latex-all-targets-re) |
1511 (remove (list (match-beginning 0) (match-end 0))) | 1542 (remove (list (match-beginning 0) (match-end 0))) |
1512 (raw-path (org-extract-attributes (match-string 3))) | 1543 (raw-path (org-extract-attributes (match-string 3))) |
1513 (full-raw-path (concat (match-string 1) raw-path)) | 1544 (full-raw-path (concat (match-string 1) raw-path)) |
1519 (coderefp (equal type "coderef")) | 1550 (coderefp (equal type "coderef")) |
1520 (caption (org-find-text-property-in-string 'org-caption raw-path)) | 1551 (caption (org-find-text-property-in-string 'org-caption raw-path)) |
1521 (attr (or (org-find-text-property-in-string 'org-attributes raw-path) | 1552 (attr (or (org-find-text-property-in-string 'org-attributes raw-path) |
1522 (plist-get org-export-latex-options-plist :latex-image-options))) | 1553 (plist-get org-export-latex-options-plist :latex-image-options))) |
1523 (label (org-find-text-property-in-string 'org-label raw-path)) | 1554 (label (org-find-text-property-in-string 'org-label raw-path)) |
1524 (floatp (or label caption)) | |
1525 imgp radiop | 1555 imgp radiop |
1526 ;; define the path of the link | 1556 ;; define the path of the link |
1527 (path (cond | 1557 (path (cond |
1528 ((member type '("coderef")) | 1558 ((member type '("coderef")) |
1529 raw-path) | 1559 raw-path) |
1549 (concat type "://" (org-export-directory | 1579 (concat type "://" (org-export-directory |
1550 :LaTeX org-export-latex-options-plist) | 1580 :LaTeX org-export-latex-options-plist) |
1551 raw-path)))))))) | 1581 raw-path)))))))) |
1552 ;; process with link inserting | 1582 ;; process with link inserting |
1553 (apply 'delete-region remove) | 1583 (apply 'delete-region remove) |
1554 (cond ((and imgp (plist-get org-export-latex-options-plist :inline-images)) | 1584 (cond ((and imgp |
1585 (plist-get org-export-latex-options-plist :inline-images)) | |
1586 ;; OK, we need to inline an image | |
1555 (insert | 1587 (insert |
1556 (concat | 1588 (org-export-latex-format-image raw-path caption label attr))) |
1557 (if floatp "\\begin{figure}[htb]\n\\centering\n") | |
1558 (format "\\includegraphics[%s]{%s}\n" | |
1559 attr | |
1560 (if (file-name-absolute-p raw-path) | |
1561 (expand-file-name raw-path) | |
1562 raw-path)) | |
1563 (if floatp | |
1564 (format "\\caption{%s%s}\n" | |
1565 (if label (concat "\\label{" label "}") "") | |
1566 (or caption ""))) | |
1567 (if floatp "\\end{figure}")))) | |
1568 (coderefp | 1589 (coderefp |
1569 (insert (format | 1590 (insert (format |
1570 (org-export-get-coderef-format path desc) | 1591 (org-export-get-coderef-format path desc) |
1571 (cdr (assoc path org-export-code-refs))))) | 1592 (cdr (assoc path org-export-code-refs))))) |
1572 (radiop (insert (format "\\hyperref[%s]{%s}" | 1593 (radiop (insert (format "\\hyperref[%s]{%s}" |
1584 (setq path (org-export-latex-protect-amp path) | 1605 (setq path (org-export-latex-protect-amp path) |
1585 desc (org-export-latex-protect-amp desc))) | 1606 desc (org-export-latex-protect-amp desc))) |
1586 (insert (format "\\href{%s}{%s}" path desc))) | 1607 (insert (format "\\href{%s}{%s}" path desc))) |
1587 (t (insert "\\texttt{" desc "}"))))))) | 1608 (t (insert "\\texttt{" desc "}"))))))) |
1588 | 1609 |
1610 | |
1611 (defun org-export-latex-format-image (path caption label attr) | |
1612 "Format the image element, depending on user settings." | |
1613 (let (floatp wrapp placement figenv) | |
1614 (setq floatp (or caption label)) | |
1615 (when (and attr (stringp attr)) | |
1616 (if (string-match "[ \t]*\\<wrap\\>" attr) | |
1617 (setq wrapp t floatp nil attr (replace-match "" t t attr))) | |
1618 (if (string-match "[ \t]*\\<float\\>" attr) | |
1619 (setq wrapp nil floatp t attr (replace-match "" t t attr)))) | |
1620 | |
1621 (setq placement | |
1622 (cond | |
1623 (wrapp "{l}{0.5\\textwidth}") | |
1624 (floatp "[htb]") | |
1625 (t ""))) | |
1626 | |
1627 (when (and attr (stringp attr) | |
1628 (string-match "[ \t]*\\<placement=\\(\\S-+\\)" attr)) | |
1629 (setq placement (match-string 1 attr) | |
1630 attr (replace-match "" t t attr))) | |
1631 (setq attr (and attr (org-trim attr))) | |
1632 (when (or (not attr) (= (length attr) 0)) | |
1633 (setq attr (cond (floatp "width=0.7\\textwidth") | |
1634 (wrapp "width=0.48\\textwidth") | |
1635 (t attr)))) | |
1636 (setq figenv | |
1637 (cond | |
1638 (wrapp "\\begin{wrapfigure}%placement | |
1639 \\centering | |
1640 \\includegraphics[%attr]{%path} | |
1641 \\caption{%labelcmd%caption} | |
1642 \\end{wrapfigure}") | |
1643 (floatp "\\begin{figure}%placement | |
1644 \\centering | |
1645 \\includegraphics[%attr]{%path} | |
1646 \\caption{%labelcmd%caption} | |
1647 \\end{figure}") | |
1648 (t "\\includegraphics[%attr]{%path}"))) | |
1649 | |
1650 (if (and (not label) (not caption) | |
1651 (string-match "^\\\\caption{.*\n" figenv)) | |
1652 (setq figenv (replace-match "" t t figenv))) | |
1653 (org-fill-template | |
1654 figenv | |
1655 (list (cons "path" | |
1656 (if (file-name-absolute-p path) | |
1657 (expand-file-name path) | |
1658 path)) | |
1659 (cons "attr" attr) | |
1660 (cons "labelcmd" (if label (format "\\label{%s}" | |
1661 label)"")) | |
1662 (cons "caption" (or caption "")) | |
1663 (cons "placement" (or placement "")))))) | |
1664 | |
1589 (defun org-export-latex-protect-amp (s) | 1665 (defun org-export-latex-protect-amp (s) |
1590 (while (string-match "\\([^\\\\]\\)\\(&\\)" s) | 1666 (while (string-match "\\([^\\\\]\\)\\(&\\)" s) |
1591 (setq s (replace-match (concat (match-string 1 s) "\\" (match-string 2 s)) | 1667 (setq s (replace-match (concat (match-string 1 s) "\\" (match-string 2 s)) |
1592 t t s))) | 1668 t t s))) |
1593 s) | 1669 s) |
1664 (org-replace-match-keep-properties | 1740 (org-replace-match-keep-properties |
1665 (org-export-latex-protect-string | 1741 (org-export-latex-protect-string |
1666 (concat "\\hspace*{1cm}" (match-string 2))) t t) | 1742 (concat "\\hspace*{1cm}" (match-string 2))) t t) |
1667 (beginning-of-line 1)) | 1743 (beginning-of-line 1)) |
1668 (if (looking-at "[ \t]*$") | 1744 (if (looking-at "[ \t]*$") |
1669 (insert "\\vspace*{1em}") | 1745 (insert (org-export-latex-protect-string "\\vspace*{1em}")) |
1670 (unless (looking-at ".*?[^ \t\n].*?\\\\\\\\[ \t]*$") | 1746 (unless (looking-at ".*?[^ \t\n].*?\\\\\\\\[ \t]*$") |
1671 (end-of-line 1) | 1747 (end-of-line 1) |
1672 (insert "\\\\"))) | 1748 (insert "\\\\"))) |
1673 (beginning-of-line 2)) | 1749 (beginning-of-line 2)) |
1674 (and (looking-at "[ \t]*ORG-VERSE-END.*") | 1750 (and (looking-at "[ \t]*ORG-VERSE-END.*") |
1714 ;; Replace radio links | 1790 ;; Replace radio links |
1715 (goto-char (point-min)) | 1791 (goto-char (point-min)) |
1716 (while (re-search-forward | 1792 (while (re-search-forward |
1717 (concat "<<<?" org-export-latex-all-targets-re | 1793 (concat "<<<?" org-export-latex-all-targets-re |
1718 ">>>?\\((INVISIBLE)\\)?") nil t) | 1794 ">>>?\\((INVISIBLE)\\)?") nil t) |
1719 (org-if-unprotected | 1795 (org-if-unprotected-at (+ (match-beginning 0) 2) |
1720 (replace-match | 1796 (replace-match |
1721 (org-export-latex-protect-string | 1797 (org-export-latex-protect-string |
1722 (format "\\label{%s}%s" (save-match-data (org-solidify-link-text | 1798 (format "\\label{%s}%s" (save-match-data (org-solidify-link-text |
1723 (match-string 1))) | 1799 (match-string 1))) |
1724 (if (match-string 2) "" (match-string 1)))) t t))) | 1800 (if (match-string 2) "" (match-string 1)))) t t))) |
1734 ;; FIXME: don't protect footnotes from conversion | 1810 ;; FIXME: don't protect footnotes from conversion |
1735 (when (plist-get org-export-latex-options-plist :footnotes) | 1811 (when (plist-get org-export-latex-options-plist :footnotes) |
1736 (goto-char (point-min)) | 1812 (goto-char (point-min)) |
1737 (while (re-search-forward "\\[\\([0-9]+\\)\\]" nil t) | 1813 (while (re-search-forward "\\[\\([0-9]+\\)\\]" nil t) |
1738 (org-if-unprotected | 1814 (org-if-unprotected |
1739 (when (save-match-data | 1815 (when (and (save-match-data |
1740 (save-excursion (beginning-of-line) | 1816 (save-excursion (beginning-of-line) |
1741 (looking-at "[^:|#]"))) | 1817 (looking-at "[^:|#]"))) |
1818 (not (org-in-verbatim-emphasis))) | |
1742 (let ((foot-beg (match-beginning 0)) | 1819 (let ((foot-beg (match-beginning 0)) |
1743 (foot-end (match-end 0)) | 1820 (foot-end (match-end 0)) |
1744 (foot-prefix (match-string 0)) | 1821 (foot-prefix (match-string 0)) |
1745 footnote footnote-rpl) | 1822 footnote footnote-rpl) |
1746 (save-excursion | 1823 (save-excursion |
1967 (let (names rest) | 2044 (let (names rest) |
1968 (dolist (x org-latex-entities) | 2045 (dolist (x org-latex-entities) |
1969 (when (consp x) | 2046 (when (consp x) |
1970 (add-to-list 'org-latex-entities-exceptions x) | 2047 (add-to-list 'org-latex-entities-exceptions x) |
1971 (setq x (car x))) | 2048 (setq x (car x))) |
1972 (if (string-match "[a-z][A-Z]$" x) | 2049 (if (string-match "[a-zA-Z]$" x) |
1973 (push x names) | 2050 (push x names) |
1974 (push x rest))) | 2051 (push x rest))) |
1975 (concat "\\(" (regexp-opt (nreverse names)) "\\>\\)" | 2052 (concat "\\(" (regexp-opt (nreverse names)) "\\>\\)" |
1976 "\\|\\(" (regexp-opt (nreverse rest)) "\\)"))) | 2053 "\\|\\(" (regexp-opt (nreverse rest)) "\\)"))) |
1977 | 2054 |