org-faq.org: "How to install MathJax on my server?"
[Worg.git] / org-faq.org
blobfe931c5523bd275fc587071ab9c48a43cc4acc49
1 #+STARTUP:   overview
2 #+OPTIONS:   H:2 num:t toc:t \n:nil @:t ::t |:t ^:t *:t TeX:t
3 #+EMAIL:     carsten.dominik@gmail.com
4 #+AUTHOR:    Worg people
5 #+LANGUAGE:  en
6 #+TITLE:     Org-mode Frequently Asked Questions
7 #+INFOJS_OPT: view:content toc:1 path:http://orgmode.org/worg/code/org-info-js/org-info.js tdepth:1 ftoc:t buttons:0 mouse:underline
8 #+OPTIONS:   H:3 num:nil toc:t \n:nil @:t ::t |:t ^:{} -:t f:t *:t TeX:t LaTeX:t skip:nil d:(HIDE) tags:not-in-toc
10 #+begin_html
11 <a href="/"><img src="http://orgmode.org/img/org-mode-unicorn.png" class="logo-link" /></a>
12 #+end_html
14 [[file:index.org][{Back to Worg's index}]]
16 * Welcome
17   :PROPERTIES:
18   :CUSTOM_ID: Welcome
19   :END:
21 Welcome to the Org-mode FAQ.
23 You can navigate the FAQ by clicking on any of the topics in the Table
24 of Contents.
26 If your browser supports JavaScript, you can...
28 - move through the topics by typing "=n=" (next) and "=p=" (previous).
30 - see an outline view of the FAQ by typing "=m=" or clicking "=toggle
31   view=" (above).
33 - search the FAQ by typing "=s=" (basic search) or "=o=" (occur tree).
35 - see a full list of navigation commands by typing "=?=" or clicking
36   "=Help=" (above).
38 * What is org-mode?
39   :PROPERTIES:
40   :CUSTOM_ID: What-is-org-mode
41   :END:
42 ** Can I implement a GTD workflow with Org-mode?
43    :PROPERTIES:
44    :CUSTOM_ID: GTD-workflow-with-Org-mode
45    :END:
47    Yes, you can.  Check for discussions and pointers [[http://orgmode.org/worg/org-gtd-etc.php][here]].
49 ** What is the difference between Org and TaskPaper?
50    :PROPERTIES:
51    :CUSTOM_ID: Org-and-TaskPaper
52    :END:
54   There is really no difference.  Org is as /simple/ as [[http://hogbaysoftware.com/products/taskpaper][TaskPaper]].  It
55   is just that, when using Org within Emacs, it lets you do many things
56   that you wouldn't be able to do with TaskPaper.  Yes, TaskPaper is
57   fiddle-proof and people using Emacs tends to like fiddling (which is
58   orthogonal to the idea of using todo-list efficiently), but this is
59   just a matter of discipline and common sense, not one of Org's design.
61   Read [[http://article.gmane.org/gmane.emacs.orgmode/6224][Carsten's enlightening statement]] on this.
62 ** What is the meaning of the Unicorn on Org's website?
63    :PROPERTIES:
64    :CUSTOM_ID: unicorn
65    :END:
67 The Unicorn is the logo of Org-mode because:
69 - Org-mode is the UNICs of ORgaNizers.
71 - Org-mode is an Emacs mode, so it makes sense to use an animal
72   similar or related to the gnu used for GNU Emacs.
74 - Org-mode is meant to show you the way, and an animal with two horns
75   can not do this very well, can it?
77 - Unicorn tears are said to reverse petrification, and wasn't this how
78   we all felt before getting to some degree of time and task
79   management?
81 - It will take forever to learn everything there is to know about a
82   unicorn.
84 - A unicorn is a fabulous creature.  Org-mode wants to be a fabulous
85   creation.
87 Using a unicorn was originally /Bastien Guerry's/ idea, his friend
88 /Christophe Bataillon/ designed the logo for us, and /Greg Newman/
89 gave it a refresh some time later.  Bastien writes why he chose a
90 unicorn:
92 #+BEGIN_QUOTE
93 The first reason is not linked to the animal, but to the sounding of the
94 word "Unicorn" - because Org gives you a /uni/que way of producing files
95 in several format (HTML, LaTeX, etc.)
97 The second reason is that a Unicorn doesn't really exist, it is just
98 something you can dream about, and make others believe it does exist.
99 Just like the perfect organizer.
100 #+END_QUOTE
102 There was a [[http://thread.gmane.org/gmane.emacs.orgmode/11641/focus%3D11641][thread about unicorns]] on the mailing list.  [[http://thread.gmane.org/gmane.emacs.orgmode/11641/focus%3D11641][Christopher
103 Suckling]] posted a link showing how to make a simple foldable unicorn
104 (very appropriate for an outlining program!).
106 [[http://article.gmane.org/gmane.emacs.orgmode/11735][Tim Burt]] made a very complicated one which is now a treasured
107 possession of the Org-mode author.
109 - Official logo: [[http://orgmode.org/img/org-mode-unicorn.png]]
110   This logo is available in a number of different formats including
111   Photoshop /.psd/ and scaleable vector graphics /.svg/ [[http://orgmode.org/img/][here]].
113 - An [[http://orgmode.org/img/nrocinu4.jpg][alternative version]] from Christophe Bataillon (c):
115 - [[http://article.gmane.org/gmane.emacs.orgmode/14293][Chris Randle]] made a [[http://orgmode.org/img/nrocinu.txt][text version]] using the logo and [[http://glassgiant.com][glassgiant.com]]:
117 - [[http://article.gmane.org/gmane.emacs.orgmode/14362][Stefan Vollmar]] made a [[http://orgmode.org/img/nrocinu.pdf][pdf version]] (here in [[http://orgmode.org/img/nrocinu_pdf.png][png]]) using "a simple
118   threshold technique".
120 - [[http://article.gmane.org/gmane.emacs.orgmode/11735/match%3D][Tim Burt]] made a folded Unicorn to match the spirit of Org - see the
121   whole set of pictures [[http://www.flickr.com/photos/tcburt/sets/72157614543357071/][on his flickr page]].
123 - Are unicorns real?  Answer [[http://article.gmane.org/gmane.emacs.orgmode/11687/match%3Drosslaird%2Bunicorn][here]] by Ross Laird.
125 * Mailing list
126 ** Why hasn't my email to the mailing list shown up yet?
127    :PROPERTIES:
128    :CUSTOM_ID: ml-post-delay
129    :END:
131 The org-mode mailing list is moderated. Thus, if you are not
132 subscribed to the mailing list, your mail will only appear on the list
133 after it has been approved by a moderator. To ensure that your mail
134 appears quickly, please [[http://lists.gnu.org/mailman/listinfo/emacs-orgmode][subscribe to the list]].
136 ** I read the mailing list through gmane. Should I subscribe?
137    :PROPERTIES:
138    :CUSTOM_ID: ml-subscription-and-gmane
139    :END:
141 The org-mode mailing list is available via nntp at [[http://dir.gmane.org/gmane.emacs.orgmode][Gmane]]. Many
142 participants in the list prefer read the list in a newsreader, such as
143 Gnus, instead of receiving emails. If you choose to read the list via
144 nntp, you can still [[http://lists.gnu.org/mailman/listinfo/emacs-orgmode][subscribe]] to the list and then opt not to receive
145 any emails on the mailman settings page (see the "Mail Delivery"
146 setting).
148 This will ensure that your messages to the list get through quickly,
149 reduce the work load of the mailing list moderators (who need to clear
150 every mail from non-members), and provide more accurate information
151 about the number of list readers.
153 * Keeping current
154   :PROPERTIES:
155   :CUSTOM_ID: Keeping-current
156   :END:
157 ** My Emacs ships with an older version Org-mode! How do I upgrade?
158    :PROPERTIES:
159    :CUSTOM_ID: updating-org
160    :END:
162 Org-mode develops quickly, which means that versions of Org-mode
163 shipped with Emacs are more or less out-of-date. If you'd like to
164 upgrade to the most recent version of org-mode, you have a number of
165 options.
167  1. Download the most recent release of org-mode ([[http://orgmode.org/org-7.3.zip][zip]] or [[http://orgmode.org/org-7.3.tar.gz][tarball]]) and
168     follow the [[http://orgmode.org/manual/Installation.html#Installation][installation instructions]] in the manual.
169  2. Clone and install the development git repository as [[#keeping-current-with-Org-mode-development][explained
170     here]]. If you don't want to run the bleeding edge, you can still
171     use git [[#using-stable-releases-only][to track the most recent stable releases]].
172  3. Install and updated org-mode automatically through the Emacs
173     Package Manager as [[#installing-via-elpa][explained in this FAQ]].
175 ** How do I keep current with bleeding edge development?
176    :PROPERTIES:
177    :CUSTOM_ID: keeping-current-with-Org-mode-development
178    :END:
180    Org mode is developed in [[http://en.wikipedia.org/wiki/Git_(software)][Git]]. You can keep up-to-date with Org-mode
181    developement by cloning Org mode repository and refreshing your
182    copy with latest changes whenever you wish. You only need to use
183    two Git commands (clone and pull.) Here are the steps in brief
184    (please customize locations to suit your setup):
186    1. Select a location to house the Org mode repository (approx. 40
187       MB; includes documentation, compiled elisp files and history
188       going all the way back to v4.12a)
190       : $ mkdir $HOME/elisp && cd $HOME/elisp
192    2. Clone the Org mode Git repository.
194       Recommended approach:
196       : $ git clone git://repo.or.cz/org-mode.git
198       Alternate approach if you are behind a firewall that allows only
199       HTTP (can be quite slow):
201       : $ git clone http://repo.or.cz/r/org-mode.git
203    3. Compile and install Org mode and build documentation.
205       : $ cd org-mode && make && make doc && make install
207       Please note that you can choose to /not/ compile at all and run
208       using source =.el= files only.  Compiled files speed things up.
210       Also note that running =make install= is necessary only if you'd
211       like to install org-mode system-wide.
213    4. This is where you configure Org mode with Emacs.  Please refer
214       to [[./org-tutorials/index.org][Org tutorials]].
216    5. Keeping up-to-date.
218       Cloning the repository is a one time activity.  From this point
219       onwards you only need to /pull/ the latest changes.
221       : $ cd $HOME/elisp/org-mode
223       and then
225       : $ git pull && make clean && make && make doc && make install
227    6. You should restart org mode to have the changes take effect (if
228       you are not rebooting Emacs.)  Also since the intention is to
229       "keep up" with Org mode, you should visit updated sections of
230       documentation for latest updates (use =git log=.)
232    7. As you use your repository over time it will accumulate loose objects.
233       You can reduce the total size of your git repository with
235       : $ git gc
237       which will consolidate loose git objects into pack files.  This
238       reduces the size of the repository and speeds up data access to
239       the objects.
241 ** How can I keep local changes and still track Org mode development?
242    :PROPERTIES:
243    :CUSTOM_ID: keeping-local-changes-current-with-Org-mode-development
244    :END:
246   Say you want to make minor changes to the Makefile to reflect your
247   location for =emacs=.
249   Create a local branch for your changes on top of origin/master as
250   follows:
252   : $ git checkout -b local origin/master
253   : $ git config branch.local.rebase true
254   : # Make your changes to the Makefile and create a new commit
255   : $ git add Makefile
256   : $ git commit -m 'My local Makefile configurations'
257   : # Update git to a newer version
258   : $ git pull
260   Now each time you pull new commits from the distribution repository
261   your local commits will be rewound and replayed on top of the new
262   origin/master.
264 -----------
266   You would normally work on your =local= branch which includes your
267   custom commits; there's no need to switch back to the =master=
268   branch.
270 -----------
272 Here is an example of dealing with conflict resolution during git pull.
274 If you get a conflict during a =git pull= you will need to edit the
275 file with the conflict to fix up the conflicting lines and then tell
276 git that you have resolved the conflict.
278 Conflict resolution goes something like this:
280 1. =git pull= fails with a conflict
281 2. edit the file
282 3. =git add= the file to mark the conflict resolved
283 4. =git rebase --continue=
284 5. lather, rinse, and repeat 2-4 as needed
286 For this example we have the following Makefile:
288 : #
289 : # Example Makefile
290 : #
292 : EMACS=emacs
294 : VERSION=V1.0
296 and we need to change the =EMACS=emacs= line to =EMACS=myemacs= to
297 make it work well on our system.
299 To do this we
301   - create a local branch for our work
303     : $ git checkout -b local origin/master
304     : $ git config branch.local.rebase true
306     This marks the branch so that all local commits on it are rebased
307     on top of any new commits we get in origin/master during a =git
308     pull= operation.
310   - Make our custom changes
312     Edit the makefile so it looks like this:
314     : #
315     : # Example Makefile
316     : #
317     :
318     : EMACS=myemacs
319     :
320     : VERSION=V1.0
322   - Create a commit with our custom changes
323     : $ git add Makefile
324     : $ git commit -m 'My local Makefile configurations'
326   - Later we do a =git pull= but that fails with conflicts.
328     : $ git pull
329     : remote: Counting objects: 5, done.
330     : ...
331     : Patch failed at 0001.
332     :
333     : When you have resolved this problem run "git rebase --continue".
334     : If you would prefer to skip this patch, instead run "git rebase --skip".
335     : To restore the original branch and stop rebasing run "git rebase --abort".
337   - Fix the conflict in your favourite editor
339     Conflict markers look like this:
341     : <<<<<<< HEAD:Makefile
342     : EMACS=emacs22
343     : =======
344     : EMACS=myemacs
345     : >>>>>>> Change emacs location:Makefile
347     This attempted =git pull= caused a conflict.  Fire up your
348     favourite editor and fix the conflict in the Makefile.  The
349     conflict markers are <<<<<<<<<< , ======= , and >>>>>>>>>>.  Fix
350     the Makefile appropriately and delete the conflict markers.  You
351     already edited these lines earlier so fixing it should be trivial.
353     In this case we changed =EMACS=emacs= to =EMACS=myemacs= and
354     upstream changed =EMACS=emacs= to =EMACS=emacs22=.  Just fix the
355     file and save it by deleting the conflict markers and keeping the
356     code you need (in this case the =EMACS=myemacs= line which we
357     originally modified.)
359   - Mark the file's conflict resolved
361     : $ git add Makefile
363     You use =git add= because you are adding new content to be tracked - you're not adding a file, but you are adding changes in content.
365   - Continue the rebase operation
367     : $ git rebase --continue
369     If any other conflicts arise you fix them the same way - edit the file, mark the conflict resolved, and continue.
371 At anytime during the rebase conflict resolution you can say "oops this is all wrong - put it back the way it was before I did a pull"
372 using
373 : $ git rebase --abort
375 ** How can I use a stable release version instead of the bleeding edge master?
376    :PROPERTIES:
377    :CUSTOM_ID: using-stable-releases-only
378    :END:
380 The master branch of the git repository always contains the bleeding
381 edge development code.  This is important for Org's fast development,
382 because code on master gets checked out by many people daily and we
383 quickly receive bug reports if something is wrong.  On rare occasions,
384 this code may not function perfectly for a limited time while we are
385 trying to fix things.
387 Not everyone like to use this bleeding-edge code and face the danger
388 to hit a surprising bug.
390 Therefore, from time to time, we make a release.  This typically
391 happens when the maintainers feel that
393 1. they have reached a good point in the development
394 2. the code has a feature set that should stay and be supported in the
395    future
397 Stable releases are used as the basis for [[http://orgmode.org/index.html#sec-3_3][alternative distributions]] of
398 Org, and they are also the code that gets merged into the Emacs
399 distribution. If you want to work only with stable releases, you can
400 always download [[http://orgmode.org/index.html#sec-3][them here]], but you can also also use the git
401 repository to keep automatically up-to-date with the most recent
402 stable releases (and save bandwidth!). Here's how to do so:
404 *** Run a specific stable release
406 In the repository, do
408 : $ git fetch --tags
409 : $ git tag
411 To see which release tags are available.  Let's say you decide to use
412 =release_7.01f=.
414 : $ git checkout release_7.01f
416 This set the working tree of the repository to the state of Org at the
417 moment of release 7.01f.  You can then run Org from the repository be
418 sure to use the stable release while development continues on the
419 master branch.
421 Later, when we release 7.02, you can switch to that using
423 : $ git fetch --tags                   # to get all the new stuff
424 : $ git tag
425 : $ git checkout release_7.02
427 *** Always run the most recent stable release
429 Alternatively, if you just want to always run whatever the latest
430 stable release is, you can do
432 : $ git checkout -b stable origin/maint
434 and then regularly update this branch by doing
436 : $ git pull
438 ** How can I install an up-to-date version of org-mode without "make" tools?
439    :PROPERTIES:
440    :CUSTOM_ID: installing-org-without-make-tools
441    :END:
443 If you are using org-mode on a computer that lacks developer tools for
444 compiling software, such as [[http://www.gnu.org/software/make/][GNU Make]], you will have to use a
445 *different* installation method than [[http://orgmode.org/manual/Installation.html#Installation][the one outlined in the manual]].
447 Please see [[http://article.gmane.org/gmane.emacs.orgmode/15264][this thread]] on the mailing list for several different ways
448 you can install a recent version of org-mode without using the
449 customary =make clean && make && make install=.
451 The result of that discussion is the file/function found in
452 [[http://orgmode.org/worg/org-hacks.php#compiling-org-without-make]].
454 ** I don't use git. Can I download bleeding edge .zip and .tar.gz archives?
456    Yes. You can download [[http://orgmode.org][org-latest.zip]] or [[http://orgmode.org/org-latest.tar.gz][org-latest.tar.gz]] of
457    Org-mode -- these archives are udpated every day at midnight.
459    Alternatively, you can download a [[http://repo.or.cz/w/org-mode.git/snapshot][tar.gz snapshot from repo.or.cz]].
461 ** How can I install Org-mode through Emacs' Package Manager?
462    :PROPERTIES:
463    :CUSTOM_ID: installing-via-elpa
464    :END:
466    Emacs 24 includes an automated package management tool ([[http://tromey.com/elpa/][ELPA]]) that
467    can be used to install and upgrade elisp packages such as Org-mode.
468    If you are running an older version of Emacs (23 or earlier), you
469    will have to install the package manager before using it to install
470    Org-mode. See [[#installing-elpa][this FAQ]] for more details.
472    Org-mode is distributed as an ELPA package from [[http://elpa.gnu.org/packages/][GNU Emacs Lisp
473    Package Archive]] as well as from [[http://orgmode.org/pkg/daily/][Org-mode Emacs Lisp Archive]].
474    
475    Steps for adding Org-mode as a package archive:
476    1. Add Org-mode as a package archive. This can be done in two ways.
477       1. Use =M-x customize-variable RET package-archives=
478       2. Add the following line to your =.emacs= and reload Emacs.
480          #+begin_src emacs-lisp
481            (add-to-list 'package-archives '("Org-mode" . "http://orgmode.org/pkg/daily/"))
482          #+end_src
483                 
484    2. Use the Emacs package manager's =M-x list-packages= to browse
485       and install the latest version.
487    3. If you get the following error "*Failed to download `Org-mode'
488       archive.*" in step 2, you can manually download the tarball and
489       install it. Refer [[Installing from ELPA-tar][this FAQ entry]] for more information.
491 ** How do I install Emacs package manager?
492    :PROPERTIES:
493    :CUSTOM_ID: installing-elpa
494    :END:
495    
496    If you are running Emacs-24 or find the command =M-x list-packages=
497    available you already have the package manager installed.
498    
499    Steps for installing package manager:
500    1. Download the latest package manager -
501       [[http://repo.or.cz/w/emacs.git/blob_plain/HEAD:/lisp/emacs-lisp/package.el][package.el]].
502    2. Add the following to your =.emacs= and reload Emacs.
503       #+begin_src emacs-lisp
504         ;; change "~/elisp/" as appropiate
505         (setq load-path (cons "~/elisp" load-path))
506         (require 'package)
507         (package-initialize)
508       #+end_src
509    
510 ** I don't see Org-mode as an installation option in Package Manager Menu?
511    :PROPERTIES:
512    :CUSTOM_ID: why-no-org-in-elpa
513    :END:
514    
515    Emacs Package Manager is a very recent addition to Emacs. Work is
516    under way to have have Org-mode seamlessly integrate with Emacs'
517    Package Manager. As a result, it will be some time before the
518    Org-mode packages are available and usable from either GNU or
519    Org-mode package archives.
520    
521    In the meanwhile, you can install Org-mode via package manager
522    through ELPA-compatible tar. Refer [[Installing from ELPA-tar][this FAQ entry]] for more information.
523    
524 ** How do I install Org-mode from a ELPA-compatible tarball?
525    :PROPERTIES:
526    :CUSTOM_ID: installing-from-elpa-tarball
527    :END:
528 # <<Installing from ELPA-tar>>
529    
530    Org-mode is distributed as an ELPA-compatible tar which can be used
531    in conjunction with Emacs' package manager.
532    
533    1. If you are already running Org-mode, note the current version
534       reported by M-x org-version.
535    2. Download the latest tarball from [[http://orgmode.org/pkg/daily/][Org-mode repo]].
536    3. Do =M-x package-install-file=. When prompted for =Package file
537       name=, point it to .tar file downloaded in step 2.
538       
539       You will now see Package Manager compiling the files and
540       installing it.
541    4. Reload emacs. This step is very important.
542    5. Note the version of the new installation using M-x
543       org-version. If the new and old versions are different, the
544       installation is done and you are all set to enjoy the updated
545       Org-mode. Otherwise skip to step 6.
546    6. Review you load-path using =C-h v load-path=. Most likely that
547       your old installation path takes precedence over the path chosen
548       by package manager (which is typically
549       =~/.emacs.d/elpa/...=). Fix this anamoly by moving
550       =(package-initialize)= line in .emacs to a more appropriate
551       location.
552       
553    - Additional Note on =org-install.el= :: Functionality of Org-mode's
554      =org-install.el= is supplanted by Package Manager's
555      =org-autoloads.el=. Since Package Manager autoloads Org-mode for
556      you, the following line =(require 'org-install)= in your =.emacs=
557      is no longer required and can be safely removed.
558      
559 ** Why would I use ELPA tarballs instead of the snapshot tarballs?
560    :PROPERTIES:
561    :CUSTOM_ID: why-elpa
562    :END:
563    
564    ELPA-tarballs automate much the process of upgrading org-mode. Much
565    of the following grunt work is done automatically by the Package
566    Manager:
567    
568    1. Downloading, compiling, and activating of org-mode (including
569       setting org-mode's =load-path= and autoloads).
570    2. Updating info files.
572 * Setup
573   :PROPERTIES:
574   :CUSTOM_ID: Setup
575   :END:
576 ** How can I quickly browse all Org options?
578 =M-x org-customize RET=
580 See also [[file:org-tutorials/org-customize.org][Carsten's Org customize tutorial]] and [[file:org-configs/org-customization-guide.org][this customization guide]]
581 for details.
583 ** Can I use the editing features of org-mode in other modes?
584    :PROPERTIES:
585    :CUSTOM_ID: use-editing-features-in-other-modes
586    :END:
588    Not really---but there are a few editing features you can use in
589    other modes.
591    - For tables there is =orgtbl-mode= which implements the table
592      editor as a minor mode. (To enable, type =M-x orgtbl-mode=)
593    - For ordered lists there is =orgstuct-mode= which allows for easy
594      list editing as a minor mode. (To enable, type =M-x
595      orgstruct-mode=)
597    You can activate these modes automatically by using hooks:
599    : (add-hook 'mail-mode-hook 'turn-on-orgtbl)
600    : (add-hook 'mail-mode-hook 'turn-on-orgstruct)
602    For footnotes, there is the function =org-footnote-action=, which
603    works in non-org buffers. This function is a powerful tool for
604    creating and sorting footnotes. To use it globally, you can add the
605    following keybinding to your =.emacs= file (requires Org 6.17 or
606    greater):
608    : (global-set-key (kbd "C-c f") 'org-footnote-action)
610    For other features you need to switch to Org-mode temporarily, or
611    prepare text in a different buffer.
613 ** Why isn't feature "X" working the way it is described in the manual?
614    :PROPERTIES:
615    :CUSTOM_ID: making-sure-org-mode-is-up-to-date
616    :END:
618 Org-mode develops very quickly. If you are using a version of Org-mode
619 that shipped with emacs, there is a good chance that it is somewhat
620 out of date.
622 Many of the users on the Org-mode mailing list are using either a
623 recent release of Org-mode or the
624 [[http://orgmode.org/index.html#sec-3.2][development version of
625 org-mode from the git repository]].
627 If some settings and features aren't working the way you expect, make
628 sure that the version of the manual you are consulting matches the
629 version of Org-mode you are using.
631    - You can check which version of Org-mode you are using by
632      selection =Org --> Documentation --> Show Version= in the Emacs
633      menu.
635    - The [[http://orgmode.org/manual/index.html][online manual]] at [[http://orgmode.org][orgmode.org]] corresponds to the most recent
636      release.
638    - The [[http://www.gnu.org/software/emacs/manual/html_node/org/index.html][manual]] at [[http://www.gnu.org][www.gnu.org]] corresponds to the version of Org-mode
639      released with the latest official Gnu Emacs release. Compared
640      with the manual at the orgmode.org, the manual at www.gnu.org is
641      somewhat out of date.
643 For instructions on how to stay current with Org-mode, consult [[keeping-current-with-Org-mode-development][this
644 FAQ]] or follow the instructions on [[http://orgmode.org][the official Org-mode site]].
646 ** Can I get the visibility-cycling features in outline-mode and outline-minor-mode?
647    :PROPERTIES:
648    :CUSTOM_ID: use-visibility-cycling-in-outline-mode
649    :END:
651    Yes, these functions are written in a way that they are independent of
652    the outline setup.  The following setup provides standard Org-mode
653    functionality in outline-mode on =TAB= and =S-TAB=.  For
654    outline-minor-mode, we use =C-TAB= instead of =TAB=,
655    because =TAB= usually has mode-specific tasks.
657 #+BEGIN_SRC emacs-lisp
658 (add-hook 'outline-minor-mode-hook
659   (lambda ()
660     (define-key outline-minor-mode-map [(control tab)] 'org-cycle)
661     (define-key outline-minor-mode-map [(shift tab)] 'org-global-cycle)))
662 (add-hook 'outline-mode-hook
663   (lambda ()
664     (define-key outline-mode-map [(tab)] 'org-cycle)
665     (define-key outline-mode-map [(shift tab)] 'org-global-cycle)))
666 #+END_SRC
668 Or check out /outline-magic.el/, which does this and also provides
669 promotion and demotion functionality.  /outline-magic.el/ is
670 available at [[http://www.astro.uva.nl/~dominik/Tools/outline-magic.el][Outline Magic]].
672 ** Can I save/restore the visibility state of an org-mode buffer?
673    :PROPERTIES:
674    :CUSTOM_ID: saving-visibility-state
675    :END:
677 Well, no---at least not automatically. You can, however, control the
678 visibility of an org-file or of individual trees by adding
679 instructions to your org file. See [[http://orgmode.org/manual/Visibility-cycling.html#Visibility-cycling][this section of the manual]] for more
680 information.
682 ** How can I keep track of changes in my Org files?
683    :PROPERTIES:
684    :CUSTOM_ID: track-of-changes-in-Org-files
685    :END:
687   Use git to track the history of the files, use a cronjob to check in
688   changes regularly.  Such a setup is described by Bernt Hansen
689   in [[http://article.gmane.org/gmane.emacs.orgmode/6233][this message]] on [[http://dir.gmane.org/gmane.emacs.orgmode][emacs-orgmode]].
691 ** Can I use Org-mode as the default mode for all README files?
692    :PROPERTIES:
693    :CUSTOM_ID: Org-mode-as-default-mode
694    :END:
696 Add the following to your .emacs file:
698 : (add-to-list 'auto-mode-alist '("README$" . org-mode))
700 You can even make it the default mode for any files with unspecified
701 mode using
703 : (setq default-major-mode 'org-mode)
705 ** Can I use ido.el for completing stuff in Org?
706    :PROPERTIES:
707    :CUSTOM_ID: ido-complete
708    :END:
710    Yes, you can.  If you are an ido user and ido-mode is active, the
711    following setting will make Org use =ido-completing-read= for most
712    of its completing prompts.
714 : (setq org-completion-use-ido t)
716 ** Should I use one big org file or multiple files?
717    :PROPERTIES:
718    :CUSTOM_ID: how-to-organize-org-mode-files
719    :END:
721 Org-mode is flexible enough to accomodate a variety of organizational
722 and time management schemes. Org's [[http://orgmode.org/manual/Document-Structure.html#Document-Structure][outline cycling and convenient
723 editing and navigation commands]] make it possible to maintain all of
724 your projects and notes in a single file. But org-mode's [[http://orgmode.org/manual/Hyperlinks.html#Hyperlinks][quick and
725 easy hyperlinks]], along with [[http://orgmode.org/manual/Refiling-notes.html#Refiling-notes][easy refiling of notes and todos]], also
726 make it a delight to maintain a private "wiki" consisting of multiple
727 files.
729 No matter how you organize your org files, org-mode's agenda commands
730 make it easy to search all your notes and gather together crucial data
731 in a single view.
733 Moreover, several org-mode settings can be configured either globally
734 in your =.emacs= file or locally (per file or per outline tree). See
735 the [[http://orgmode.org/manual/index.html#Top][manual]] for more details. For an example of local customizations
736 see [[limit-agenda-with-category-match][this FAQ]].
738 Here are a few ideas for organizing org-mode files:
740 - A single file for all your projects and notes.
741 - One file per project.
742 - One file per client.
743 - One file per area of responsibility or type of work (e.g.,
744   household, health, work, etc.).
745 - One file for projects, one for appointments, one for reference
746   material, one for someday/maybe items, etc.
747 - A wiki of hyperlinked files that grows and adapts to meet your
748   needs.
750 For more ideas, see some of the links on the [[file:org-tutorials/index.org][org-tutorial index]] or
751 [[file:org-gtd-etc.org][this page on org-mode and GTD]].
753 ** Why doesn't C-c a call the agenda? Why don't some org keybindings work?
754    :PROPERTIES:
755    :CUSTOM_ID: setting-global-keybindings
756    :END:
758 Org-mode has a few global keybindings that the user must set
759 explicitly in an =.emacs= file. These keybindings include the
760 customary shortcut for calling the agenda (=C-c a=). If nothing
761 happens when you type =C-c a=, then make sure that the following lines
762 are in your =.emacs= file:
764 #+BEGIN_SRC emacs-lisp
765 ;; The following lines are always needed.  Choose your own keys.
766 (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
767 (global-set-key "\C-cl" 'org-store-link)
768 (global-set-key "\C-ca" 'org-agenda)
769 (global-set-key "\C-cb" 'org-iswitchb)
770 #+END_SRC emacs-lisp
772 You may, of course, choose whatever keybindings work best for you
773 and do not conflict with other modes.
775 Please see [[http://orgmode.org/manual/Activation.html][this section of the manual]] if you have additional
776 questions.
778 ** Why aren't some of the variables I've customized having an effect?
779    :PROPERTIES:
780    :CUSTOM_ID: load-org-after-setting-variables
781    :END:
783 Some org variables have to be set before org.el is loaded or else they
784 will not work. (An example is the new variable
785 =org-enforce-todo-dependencies=.)
787 To make sure all your variables work you should not use =(require
788 'org)=. Instead use the following setting:
790 : (require 'org-install)
792 You should also make sure that you do not require any other =org-...=
793 files in your =.emacs= file before you have set your org variables,
794 since these will also cause org.el to be loaded. To be safe, load org
795 files *after* you have set your variables.
797 ** How can I make sure that timestamps appear in English?
798    :PROPERTIES:
799    :CUSTOM_ID: timestamps-and-system-time-locale
800    :END:
802 If your system's locale is not set to English, but you would like the
803 timestamps in your org-mode files to appear in English, you can set
804 the following variable:
806 #+begin_src emacs-lisp
807   (setq system-time-locale "C")
808 #+end_src
810 ** What does a minimal .emacs look like?
811    :PROPERTIES:
812    :CUSTOM_ID: minimal-emacs
813    :END:
815 Using a stripped down minimal .emacs files removes broken custom
816 settings as the cause of an issue and makes it easy to reproduce for
817 other people.  The example below has system-specific paths that you'll
818 need to change for your own use.
819 #+begin_src emacs-lisp
820   (add-to-list 'load-path (expand-file-name "~/git/org-mode/lisp"))
821   (add-to-list 'auto-mode-alist '("\\.\\(org\\  |org_archive\\|txt\\)$" . org-mode))
822   (setq org-agenda-files '("/tmp/test.org"))
823   (require 'org-install)
824   (require 'org-habit)
826   (global-set-key "\C-cl" 'org-store-link)
827   (global-set-key "\C-ca" 'org-agenda)
828   (global-set-key "\C-cb" 'org-iswitchb)
829 #+end_src
831 You can save the minimal .emacs file to ~/minimal.emacs, add suspect
832 configuration code to it, then start emacs something like this:
833 #+begin_src sh
834   emacs -Q -l ~/minimal.emacs
835 #+end_src
837 On OS X, starting emacs with minimal configuration might look
838 something like this:
839 #+begin_src sh
840   /Applications/emacs.app/Contents/MacOS/Emacs -Q -l ~/minimal.emacs
841 #+end_src sh
843 * Errors and general problems
844   :PROPERTIES:
845   :CUSTOM_ID: Errors
846   :END:
847 ** Opening Org files in Emacs leads to a crash
848    :PROPERTIES:
849    :CUSTOM_ID: Emacs-crashes-with-org-indent-mode
850    :END:
851    The only known case where Org-mode can crash Emacs is when you are
852    using =org-indent-mode= with Emacs 23.1 (in fact, any version of
853    Emacs before version 23.1.50.3).  Upgrade to Emacs 23.2 and the
854    problem should go away.
856 ** When I try to use Org-mode, I always get the error message =(wrong-type-argument keymapp nil)=
857    :PROPERTIES:
858    :CUSTOM_ID: wrong-type-argument-keymapp
859    :END:
861    This is a conflict with an outdated version of the /allout.el/, see
862    the [[http://orgmode.org/manual/Conflicts.html#Conflicts][Conflicts]] section in the manual
864 ** How can I control the application launched by Org-mode to open a certain file type like pdf, html....
865    :PROPERTIES:
866    :CUSTOM_ID: external-application-launched-to-open-file-link
867    :END:
869 If you want special control about how Org-mode opens files, see the
870 variables =org-file-apps=, =org-file-apps-defaults-gnu=,
871 =org-file-apps-defaults-macosx=, =org-file-apps-defaults-windowsnt=.
873 *However*, normally it is best to just use the mechanism the
874 operating-system provides:
876 *** GNU/Linux systems
877     You you have to check your mailcap settings, find the files:
879     : /etc/mailcap
880     :
881     : or
882     :
883     : $HOME/.mailcap
885 and modify them accordingly. Please read their manual entry.
887 *** Windows systems
888     + for html pages you may configure the =browse-url-= variables through
889       the Customize interface,
890     + the pdf files are automatically opened with Acrobat Reader (if it is
891       installed)
893 *** Mac OSX
894     Change the application responsible for this file type by selecting
895     such a file in the Finder, select =File->Get Info= from the menu
896     and select the application to open this file with.  Then, to
897     propagate the change to all files with the same extension, select
898     the =Change all= button.
900 ** Org-mode takes over the TAB key.  I also want to use YASnippet, is there a way to fix this conflict?
901    :PROPERTIES:
902    :CUSTOM_ID: YASnippet
903    :END:
905 [[http://code.google.com/p/yasnippet/][yasnippet]] is yet another snippet expansion system for Emacs.  It is
906 inspired by TextMate's templating syntax.
907 - watch the [[http://www.youtube.com/watch?v=vOj7btx3ATg][video on YouTube]]
908 - see the [[http://yasnippet.googlecode.com/svn/trunk/doc/index.html][intro and tutorial]]
910 *Note*: yasnippet is not compatible with =org-indent-mode= currently
911 there is no known way to use both successfully with =yas/trigger-key=
912 set to =TAB= (or =[tab]= etc...)
914 The way Org-mode binds the =TAB= key (binding to =[tab]= instead of
915 =\t=) overrules yasnippets' access to this key.  The following code
916 fixes this problem:
918 #+begin_src emacs-lisp
919 (add-hook 'org-mode-hook
920           (lambda ()
921             (org-set-local 'yas/trigger-key [tab])
922             (define-key yas/keymap [tab] 'yas/next-field-group)))
923 #+end_src
925 If the above code doesn't work (which it may not with later versions
926 of yasnippet).  Then try the following
928 #+begin_src emacs-lisp
929   (defun yas/org-very-safe-expand ()
930     (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
932   (add-hook 'org-mode-hook
933             (lambda ()
934               ;; yasnippet (using the new org-cycle hooks)
935               (make-variable-buffer-local 'yas/trigger-key)
936               (setq yas/trigger-key [tab])
937               (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
938               (define-key yas/keymap [tab] 'yas/next-field)))
939 #+end_src
941 Rick Moynihan maintains a [[http://github.com/RickMoynihan/yasnippet-org-mode][git repository]] (or [[http://github.com/eschulte/yasnippet-org-mode][Eric's fork of the same]])
942 with YASnippets for Org-mode.
944 ** Org-mode takes over the S-cursor keys.  I also want to use CUA-mode, is there a way to fix this conflict?
945    :PROPERTIES:
946    :CUSTOM_ID: CUA-mode
947    :END:
949 Yes, see the  [[http://orgmode.org/manual/Conflicts.html#Conflicts][Conflicts]] section of the manual.
951 ** Org-mode takes over the S-cursor keys.  I also want to use windmove.el, is there a way to fix this conflict?
952    :PROPERTIES:
953    :CUSTOM_ID: windmove.el
954    :END:
956 Yes, see the [[http://orgmode.org/manual/Conflicts.html#Conflicts][Conflicts]] section of the manual.
958 ** Org behaves strangely: some keys don't work, some features are missing, my settings have no effect, ...
959    :PROPERTIES:
960    :CUSTOM_ID: loaded-old-org
961    :END:
963 When this sort of things happen, it probably is because Emacs is
964 loading an old version of Org-mode instead of the one you expected.
965 Check it with =M-x org-version=.
967 This happens because Emacs loads first the system org-mode (the one
968 included with Emacs) before the one in your directory. Check the
969 =load-path= variable; you might see that your org-mode appears /after/
970 the system-wide path; this is bad.
972 You should add your directories to the =load-path= at the beginning:
974 :  (add-to-list 'load-path "~/.emacs.d/org-mode/lisp") (require 'org-install)
976 Function =add-to-list= adds at the beginning. Don't use =append=
977 because it appends at the end. Also be sure to use =(require
978 'org-install)= and not =(require 'org)=.
980 This wrong version loading may also happen if you have a byte-compiled
981 =org.elc= from an old version together with a new =org.el=. Since
982 Emacs prefers loading byte-compiled files (even if the =.el= is
983 newer), it will load the old Org-mode.
985 ** Why doesn't org-batch-agenda work under Win32?
986    :PROPERTIES:
987    :CUSTOM_ID: org-batch-agenda-under-win32
988    :END:
990 When I run the example batch files to print my agenda to the console
991 under Win32 I get the failure:
993 : End of file during parsing
995 and no agenda is printed.
997 The problem is the use of single quotes surrounding the eval in the
998 emacs command-line. This gets confused under Win32. All string
999 parameters with spaces must be surrounded in double quotes. This means
1000 that double quotes being passed to the eval must be escaped.
1002 Therefore, instead of the following:
1004 : <path to emacs>\emacs.exe -batch -l ~/_emacs_org \
1005 :     -eval '(org-batch-agenda "a")'
1007 you need to use the following:
1009 :  <path to emacs>\emacs.exe -batch -l ~/_emacs_org \
1010 :     -eval "(org-batch-agenda \"a\")"
1012 (all on one line, of course).
1014 ** Org agenda seems very slow
1015    :PROPERTIES:
1016    :CUSTOM_ID: slow-agenda
1017    :END:
1019 If it takes a long time to generate or refresh the agenda, you might
1020 want first check which version of org-mode you are using. There have
1021 been major optimizations of org-agenda since 6.21b, which was the
1022 version of org-mode released with Emacs 23. If you are using 6.21b or
1023 earlier (you can check with =M-x org-version=), then you might want to
1024 consider upgrading to a more recent version of org-mode.
1026 Here are some other ideas for speeding up the agenda:
1028 1. Use a one day agenda view (rather than a seven day view).
1030    =(setq org-agenda-ndays 1)=
1032 2. Archive inactive items to separate files.
1034    =C-c C-x C-s= (org-archive-subtree)
1036 3. Do not include the global todo list in your agenda view.
1038    (setq org-agenda-include-all-todo nil)
1040 4. Make sure that your org files are byte-compiled.
1042    I.e., make sure there are files ending in =.elc= in your org
1043    installation directory.
1045 5. Limit your agenda files (=org-agenda-files=) to files that have
1046    active todos and or projects. 
1048    If you have a number of older reference files---i.e., files you
1049    search only occasionally---in your agenda files list, consider
1050    removing them from your agenda files and adding them to
1051    =org-agenda-text-search-extra-files= instead. Similarly, you might
1052    consider searching some of your older reference files with =M-x
1053    grep= so that Org-mode does not have to load them into memory when
1054    the agenda is called.
1056 ** Visual-line-mode doesn't work well with org-mode
1057    :PROPERTIES:
1058    :CUSTOM_ID: visual-line-mode
1059    :END:
1061 Visual-line-mode "soft wraps" lines so that the visual edge of the
1062 buffer is considered a line break for purposes of navigation, even
1063 though there is no line break in reality.
1065 In older versions of org-mode, org-beginning-of-line and
1066 org-end-of-line do not work well with visual line mode. (The two
1067 commands disregard soft line breaks and move to the beginning and end
1068 of the hard line break.) A patch was introduces to fix this behavior
1069 in July of 2009. n
1071 If you are using an older version of org mode, you can:
1073 1. Add a hook to turn off visual line mode.
1075 2. Add the following to your =.emacs=:
1077 #+begin_src emacs-lisp
1079 (add-hook 'org-mode-hook
1080   (lambda ()
1081     (define-key org-mode-map "\C-a" 'move-beginning-of-line)
1082     (define-key org-mode-map "\C-e" 'move-end-of-line)))
1084 #+end_src
1085 * Faces and highlighting
1086   :PROPERTIES:
1087   :CUSTOM_ID: Faces
1088   :END:
1089 ** Org-mode has a lot of colors?  How can I change them?
1090    :PROPERTIES:
1091    :CUSTOM_ID: customizing-org-faces
1092    :END:
1094 This is a question that applies to Emacs as a whole, but it comes up
1095 quite frequently on the org-mode mailing list, so it is appropriate to
1096 discuss it here.
1098 If you would like to change the style of a face in org-mode (or any
1099 other Emacs mode), simply type =M-x customize-face [RET]= while the
1100 cursor is on the color/style you are interested in modifying. You will
1101 be given the opportunity to customize all the faces located at that
1102 point.
1104 If you would like an overview of all the faces in org-mode, you can
1105 type =C-u M-x list-faces-display [RET] org= and you will be shown all
1106 the faces defined by org-mode along with an illustration of their
1107 current settings.
1109 If you would like to customize org-faces and other aspects of
1110 org-appearance, type =M-x customize-group org-font-lock [RET]=.
1112 Finally, if you would like verbose information about the properties of
1113 the text under the cursor, you can type =C-u C-x ==.
1115 See the Worg page on [[file:org-tutorials/org-appearance.org][customizing Org appearance]] for further information.
1116 ** Why do I get a tiny font in column view when using emacs daemon?
1117    :PROPERTIES:
1118    :CUSTOM_ID: column-view-tiny-font
1119    :END:
1121 When using emacs in daemon mode (=emacs --daemon=), client frames
1122 sometimes override the column view face settings, resulting in very
1123 small fonts. Here is a fix:
1125 #+begin_src emacs-lisp
1126   (defun org-column-view-uses-fixed-width-face ()
1127   ;; copy from org-faces.el
1128   (when (fboundp 'set-face-attribute)
1129       ;; Make sure that a fixed-width face is used when we have a column
1130       ;; table.
1131       (set-face-attribute 'org-column nil
1132                           :height (face-attribute 'default :height)
1133                           :family (face-attribute 'default :family))))
1135    (when (and (fboundp 'daemonp) (daemonp))
1136     (add-hook 'org-mode-hook 'org-column-view-uses-fixed-width-face))
1137 #+end_src
1139 This fix was provided in the following mailing list post:
1141 http://article.gmane.org/gmane.emacs.orgmode/27560
1142 ** How can I stop the mouse cursor from highlighting lines in the agenda?
1143    :PROPERTIES:
1144    :CUSTOM_ID: ratpoison-for-agenda-highlighting
1145    :END:
1147 You can add the following to your =.emacs=:
1149 #+begin_src emacs-lisp
1150 (add-hook 'org-finalize-agenda-hook
1151     (lambda () (remove-text-properties
1152                (point-min) (point-max) '(mouse-face t))))
1153 #+end_src
1155 * Outline
1156   :PROPERTIES:
1157   :CUSTOM_ID: Outline
1158   :END:
1159 ** Can I have two windows on the same Org-mode file, with different outline visibilities?
1160    :PROPERTIES:
1161    :CUSTOM_ID: indirect-buffers
1162    :END:
1164    You may use /indirect buffers/ which do exactly this.  See the
1165    documentation on the command =make-indirect-buffer=.
1167    Org-mode has built-in commands that allow you create an indirect
1168    buffer from a subtree of an outline. To open a subtree in new
1169    window, type =C-c C-x b=. Any changes you make in the new window
1170    will be saved to the original file, but the visibility of both
1171    buffers will remain independent of one another.
1173    For multiple indirect buffers from the same file, you must use the
1174    prefix =C-u= when creating the second (or third) buffer. Otherwise
1175    the new indirect buffer will replace the old.
1177    You can also create an independent view of an outline subtree by
1178    typing =b= on an item in the agenda.
1180 ** Emacs outlines are unreadable.  Can I get rid of all those stars?
1181    :PROPERTIES:
1182    :CUSTOM_ID: Emacs-outlines-are-unreadable
1183    :END:
1185    See the section [[http://orgmode.org/manual/Clean-view.html#Clean-view][Clean outline view]] in the manual.
1186 ** C-k is killing whole subtrees!  I lost my work!
1187    :PROPERTIES:
1188    :CUSTOM_ID: C-k-is-killing-subtrees
1189    :END:
1191   =(setq org-special-ctrl-k t)= before losing your work.
1193 ** Why aren't commands working on regions?
1194    :PROPERTIES:
1195    :CUSTOM_ID: transient-mark-mode
1196    :END:
1198 Some org-mode commands, such as M-right and M-left for demoting or
1199 promoting headlines (see [[demote-multiple-headlines][this FAQ]]), can be applied to entire regions.
1200 These commands, however, will only work on active regions set with
1201 [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Transient-Mark.html#Transient-Mark][transient mark mode]]. Transient mark mode is enabled by default in
1202 Emacs 23. To enable it in earlier versions of emacs, put the following
1203 in your =.emacs= file:
1205 : (transient-mark-mode 1)
1207 Alternatively, you may turn off transient mark mode and use [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Momentary-Mark.html][a
1208 momentary mark]] (=C-<SPC> C-<SPC>=).
1210 ** Why is a blank line inserted after headlines and list items?
1211    :PROPERTIES:
1212    :ID:       2463F4D8-F686-4CF3-AA07-08976F8A4972
1213    :END:
1214    :PROPERTIES:
1215    :CUSTOM_ID: blank-line-after-headlines-and-list-items
1216    :END:
1218 In org-mode, typing =M-RET= at the end of a headline will create a new
1219 headline of the same level on a new line. The same is true for plain
1220 lists. By default org-mode uses context to determine if a blank line
1221 should be inserted after each headline or plain list item when =M-RET=
1222 is pressed. For instance, if a there is a blank line before a
1223 headline, then typing =M-RET= at the end of the line will insert a
1224 blank line before the new headline. For instance, hitting =M-RET=
1225 at the end of "Headline Two" below inserts a new headline without a
1226 blank line:
1228 : ** Headline One
1229 : ** Headline Two
1230 : **
1232 If there is a blank line between Headline One and Headline Two,
1233 however, the results will be as follows:
1235 : ** Headline One
1237 : ** Headline Two
1239 : **
1241 If you do not like the default behavior you can change it with the
1242 variable =org-blank-before-new-entry=. You can set headings and/or
1243 plain lists to auto (the default setting), t (always), or nil (never).
1245 ** How can I promote or demote multiple headlines at once?
1246    :PROPERTIES:
1247    :CUSTOM_ID: demote-multiple-headlines
1248    :END:
1250 If you have a long list of first level headlines that you'd like to
1251 demote to second level headlines, you can select the headlines as a
1252 region and then hit =M-<right>= to demote all the headlines at once.
1254 Note: =M-S-<right>= will not work on a selected region. Its use is to
1255 demote a single subtree (i.e., a headline and all sub-headlines).
1257 If M-<right> doesn't seem to work, make sure transient mark mode is
1258 enabled. See [[transient-mark-mode][this FAQ]].
1260 ** What's the deal with all the ellipses in my org outlines?
1261    :PROPERTIES:
1262    :CUSTOM_ID: org-ellipses
1263    :END:
1265 Org-mode uses ellipses to indicate folded (and thus hidden) text. Most
1266 commonly, ellispes occur at the end of headings with folded content:
1268 : * Heading ...
1270 Or, for instance, they may indicate closed drawers:
1272 : :PROPERTIES: ...
1274 Sometimes, as a result of editing and cycling an outline, ellipses may
1275 appear in unexpected places. You should *never* delete these ellipses,
1276 as you may accidentally delete hidden text. Instead, you can type =C-c
1277 C-r= (org-reveal) to display all hidden text in the vicinity. Or you
1278 may type =M-x RET show-all= to reveal all text in the org file.
1280 If you would prefer a symbol or face for indicating hidden text, you
1281 can customize the variable org-ellipses.
1283 ** How do I yank a subtree so it's indented according to the point's location?
1284    :PROPERTIES:
1285    :CUSTOM_ID: yank-indent-subtree
1286    :END:
1288 You can either use =C-c C-w= with a working [[http://orgmode.org/manual/Refiling-notes.html#Refiling-notes][refile-targets]] setup.
1290 Or set =org-yank-adjusted-subtrees= to =t= which will adjust the
1291 yanked headline's level correctly.
1293 Just use =C-k= and =C-y= as you would everywhere else in Emacs.
1295 ** Can I read org-mode outlines in vim?
1296    :PROPERTIES:
1297    :CUSTOM_ID: org-outlines-in-vim
1298    :END:
1300 Yes, there is a script that enables one to view and navigate folded
1301 outline/org files in vim (though without most of org-mode's
1302 functionality, of course).
1304   - [[http://www.vim.org/scripts/script.php?script_id%3D1266][Emacs outline mode - Imitates Emacsen : vim online]]
1306 For instructions on how to set it up, please see [[http://mid.gmane.org/EA275862-B97A-4BAC-B879-177FD07A2D56@gaillourdet.net][this mailing list
1307 post]].
1309 * Todos and Tags
1310   :PROPERTIES:
1311   :CUSTOM_ID: Todos-and-Tags
1312   :END:
1313 ** How can I cycle through the TODO keyword of an entry?
1314    :PROPERTIES:
1315    :CUSTOM_ID: cycle-TODO-keywords
1316    :END:
1318   =C-c C-t= or =S-<left/right>= is what you need.
1320 ** How do I track state changes for tasks in Org?
1321    :PROPERTIES:
1322    :CUSTOM_ID: track-state-changes-for-tasks
1323    :END:
1325   Take a look at the [[http://thread.gmane.org/gmane.emacs.orgmode/6082][post by Bernt Hansen]] for setting up TODO keyword
1326   states and logging timestamps for task state changes.
1328 ** Can I select the TODO keywords with a tag-like interface?
1329    :PROPERTIES:
1330    :CUSTOM_ID: select-TODO-keywords-with-tag-like-interface
1331    :END:
1333   Yes.  Use =(setq org-use-fast-todo-selection t)=
1335   If you want to set both your todos and your tags using a single
1336   interface, then check out the variable
1337   =org-fast-tag-selection-include-todo=.
1339   See [[http://orgmode.org/manual/Fast-access-to-TODO-states.html][this section of the manual]] for more details.
1341 ** How can I quickly set the tag of an entry?
1342    :PROPERTIES:
1343    :CUSTOM_ID: quickly-set-tag-of-entry
1344    :END:
1346    Use =C-c C-c= or =C-c C-q= on the headline. =C-c C-q= is useful for
1347    setting tabs in a [[http://orgmode.org/manual/Remember.html#Remember][remember]] buffer, since =C-c C-c= is the default
1348    keybinding for filing a note from the remember buffer.
1350    You can set tags even more quickly by setting one of the character
1351    shortcuts for [[http://orgmode.org/manual/Setting-tags.html#Setting-tags][fast tag selection]].
1353    To set tag shortcuts for all org buffers, put something like the
1354    following in your =.emacs= file (or create the same settings by
1355    typing =M-x customize-variable RET org-tag-alist=):
1357 : (setq org-tag-alist '(("computer" . ?c) ("office" . ?o) ("home" . ?h)))
1359    To set tag shortcuts for a single buffer, put something like the
1360    following at the top of your org file:
1362 : #+TAGS: computer(c) office(o) home(h)
1364 ** How can I change the colors of TODO keywords?
1366 You can use the variable org-todo-keyword-faces. Here are some sample
1367 settings:
1369 #+begin_src emacs-lisp
1370 (setq org-todo-keyword-faces
1371       '(
1372         ("TODO"  . (:foreground "firebrick2" :weight bold))
1373         ("WAITING"  . (:foreground "olivedrab" :weight bold))
1374         ("LATER"  . (:foreground "sienna" :weight bold))
1375         ("PROJECT"  . (:foreground "steelblue" :weight bold))
1376         ("DONE"  . (:foreground "forestgreen" :weight bold))
1377         ("MAYBE"  . (:foreground "dimgrey" :weight bold))
1378         ("CANCELED"  . shadow)
1379         ))
1380 #+end_src
1382 If you want to change the color of all active todos or all inactive
1383 todos, type:
1385 : M-x customize-face RET org-todo
1386 : M-x customize-face RET org-done
1388 You can also set values for each of these in your =.emacs= file:
1390 : (set-face-foreground 'org-todo "firebrick2")
1391 : (set-face-foreground 'org-done "forestgreen")
1393 * Hyperlinks
1394   :PROPERTIES:
1395   :CUSTOM_ID: Hyperlinks
1396   :END:
1397 ** Why do I have to confirm the execution of each shell/elisp link?
1398    :PROPERTIES:
1399    :CUSTOM_ID: confirm-shell/elisp-link
1400    :END:
1402    The confirmation is there to protect you from unwantingly execute
1403    potentially dangerous commands.  For example, imagine a link
1405    : [[shell:rm -rf ~/*][Google Search]]
1407    In an Org-mode buffer, this command would look like /Google Search/,
1408    but really it would remove your home directory.  If you wish, you can
1409    make it easier to respond to the query by setting
1411    : (setq org-confirm-shell-link-function 'y-or-n-p
1412    :       org-confirm-elisp-link-function 'y-or-n-p).
1414    Then a single keypress will be enough to confirm those links.  It is
1415    also possible to turn off this check entirely, but I strongly
1416    recommend against this.  Be warned.
1418 ** Can I use RET or TAB to follow a link?
1419    :PROPERTIES:
1420    :CUSTOM_ID: RET-or-TAB-to-follow-link
1421    :END:
1423    Yes, this is how:
1425    : (setq org-return-follows-link t)
1426    : (setq org-tab-follows-link t)
1428 ** Can I keep mouse-1 clicks from following a link?
1429    :PROPERTIES:
1430    :CUSTOM_ID: mouse-1-following-link
1431    :END:
1433    Activating links with =mouse-1= is a new feature in Emacs 22, to make
1434    link behavior similar to other applications like web browsers.  If
1435    you hold the mouse button down a bit longer, the cursor will be set
1436    without following the link.  If you cannot get used to this behavior,
1437    you can (as in Emacs 21) use =mouse-2= to follow links and turn off
1438    link activation for =mouse-1= with
1440    : (setq org-mouse-1-follows-link nil)
1442 ** How can I get completion of file names when creating a link?
1443    :PROPERTIES:
1444    :CUSTOM_ID: completion-of-file-links
1445    :END:
1447 You can use org-insert-link with a prefix argument:
1449 : C-u C-c C-l
1451 You will be greeted with prompt in the minibuffer that allows for file
1452 completion using your preferred Emacs method for finding files.
1454 ** How can I use invisible targets within lists?
1455    :PROPERTIES:
1456    :CUSTOM_ID: invisible-targets-in-lists
1457    :END:
1459 The usual way of turning radio links invisible is to comment them, but
1460 Org comments need to be at the beginning of the line, which breaks list
1461 indentation.  
1463 The workaround here is to add (INVISIBLE) after your <<target>>
1465 For example:
1467 : 11. <<target>>(INVISIBLE)
1468 :     Some text
1469 : 12. More text [[target][go to]]
1471 ** Org-mode is not opening mailto links in my default mail client
1472    :PROPERTIES:
1473    :CUSTOM_ID: mailto-links
1474    :END:
1476 You can customize the function org-mode uses to open mailto links by
1477 setting the variable =org-link-mailto-program=:
1479 =M-x customize-variable org-link-mailto-program=
1481 The default function called is =browse-url=, which opens a mail
1482 composition buffer within Emacs. The type of buffer opened by
1483 browse-url depends on the setting of the variable =mail-user-agent=.
1484 Thus, if you want to ensure that mailto links use Gnus to open a
1485 message buffer, you could add the following to your =.emacs=:
1487 #+begin_src elisp
1488 (setq mail-user-agent 'gnus-user-agent)
1489 #+end_src
1491 * Plain Lists
1492   :PROPERTIES:
1493   :CUSTOM_ID: Plain-Lists
1494   :END:
1495 ** How can I insert an empty line before each newly inserted headline, but not before each newly inserted plain-list item?
1496    :PROPERTIES:
1497    :CUSTOM_ID: empty-line-before-each-new-headline-but-not-item
1498    :END:
1500 : (setq org-blank-before-new-entry
1501 :       '((heading . t) (plain-list-item . nil))
1503 See also [[id:2463F4D8-F686-4CF3-AA07-08976F8A4972][Why is a blank line inserted after headlines and list items?]].
1505 ** How can I convert itemized lists to enumerated lists?
1506    :PROPERTIES:
1507    :CUSTOM_ID: convert-itemized-to-enumerated-lists
1508    :END:
1510    You can use =C-c -= or =S-<left>/<right>= to cycle through the various
1511    bullet headlines available for lists: =-, +, *, 1., 1)=.
1513    See [[http://orgmode.org/manual/Plain-lists.html#Plain-lists][this section of the manual]] for more information.
1515 ** How can I convert plain lists to headlines and vice versa?
1516    :PROPERTIES:
1517    :CUSTOM_ID: convert-plain-lists-to-headlines
1518    :END:
1520    To convert a plain list item or line to a headline, type =C-c *= on
1521    the headline. This will make the line a subheading of the current
1522    headline.
1524    To convert a headline to a plain list item, type =C-c -= while the
1525    cursor is on the headline.
1527    To convert a headline to an unadorned line of text, type =C-c *= on
1528    the headline.
1530    You can use query replace to accomplish the same things, as Bernt
1531    Hansen explains in [[http://article.gmane.org/gmane.emacs.orgmode/10148][this mailing list post]].
1533 ** Is there a good way to create a description list?
1534    :PROPERTIES:
1535    :CUSTOM_ID: description-lists
1536    :END:
1538   Yes, these are now built-in:
1540 #+BEGIN_EXAMPLE
1541 - item1 :: Description of this item 1
1542 - item2 :: Description of this item 2
1543 - item1 :: Description of this item 3
1544       also in multiple lines
1545 #+END_EXAMPLE
1547 * Tables
1548   :PROPERTIES:
1549   :CUSTOM_ID: Tables
1550   :END:
1551 ** How can I make table alignment work with Asian character sets
1552    :PROPERTIES:
1553    :CUSTOM_ID: table-alignment-asian-characters
1554    :END:
1556 When table alignment fails, it usually has to do with character sets
1557 where some characters have non-integer width.  Org will deal correctly
1558 with characters that are one or two or three ASCII characters wide,
1559 but not with characters that are, for example, 1.5 ASCII characters
1560 wide.  To make table alignment work you need to switch to a different
1561 character set.
1563 ** Can I plot data from a table?
1564    :PROPERTIES:
1565    :CUSTOM_ID: plotting-table-data
1566    :END:
1568    Yes, you can, using org-plot.el written by Eric Schulte and now
1569    bundled with Org.  See [[http://orgmode.org/manual/Org_002dPlot.html#Org-Plot][the manual section about this]].
1571    See also [[file:org-tutorials/org-plot.org][this excellent tutorial]] by Eric Schulte.
1573 ** How can I fill a table column with incremental numbers?
1574    :PROPERTIES:
1575    :CUSTOM_ID: fill-table-column-with-incremental-numbers
1576    :END:
1578 Here is how: Use a field formula to set the first value in the column:
1580 #+begin_src org
1581 ,| N   |   |
1582 ,|-----+---|
1583 ,| :=1 |   |
1584 ,|     |   |
1585 ,|     |   |
1586 ,|     |   |
1587 ,#+TBLFM: @2$1=1
1588 #+end_src
1590 Then define a column formula in the second field:
1592 #+begin_src org
1593 ,| N        |   |
1594 ,|----------+---|
1595 ,| 1        |   |
1596 ,| =@-1 + 1 |   |
1597 ,|          |   |
1598 ,|          |   |
1599 ,#+TBLFM: @2$1=1
1600 #+end_src
1602 After recomputing the table, the column will be filled with
1603 incremental numbers:
1605 #+begin_src org
1606 ,| N |   |
1607 ,|---+---|
1608 ,| 1 |   |
1609 ,| 2 |   |
1610 ,| 3 |   |
1611 ,| 4 |   |
1612 ,#+TBLFM: $1=@-1 + 1::@2$1=1
1613 #+end_src
1615 Note that you could use arbitrary starting values and column formulas.
1617 ** Why does my table column get filled with #ERROR?
1618    :PROPERTIES:
1619    :CUSTOM_ID: table-column-filled-with-ERROR
1620    :END:
1622    Org-mode tried to compute the column from other fields using a
1623    formula stored in the =#+TBLFM:= line just below the table, and
1624    the evaluation of the formula fails.  Fix the fields used in the
1625    formula, or fix the formula, or remove it!
1627 ** How can I stop the table editor from creating new lines?
1628    :PROPERTIES:
1629    :CUSTOM_ID: table-editor-creates-new-lines
1630    :END:
1632    When I am in the last column of a table and just above a horizontal
1633    line in the table, pressing TAB creates a new table line before the
1634    horizontal line.  To move to the line below the
1635    horizontal line instead, do this:
1637    Press =down= (to get on the separator line) and then =TAB=.
1638    Or configure the variable
1640    : (setq org-table-tab-jumps-over-hlines t)
1642 ** How can I get table fields starting with "="?
1643    :PROPERTIES:
1644    :CUSTOM_ID: table-fields-starting-with-=
1645    :END:
1647    With the setting
1649    : (setq org-table-formula-evaluate-inline nil)
1651    this will no longer happen.  You can still use formulas using the
1652    commands @<tt>C-c =@</tt> and @<tt>C-u C-c =@</tt>
1654 ** How can I change the indentation of an entire table without fixing every line by hand?
1655    :PROPERTIES:
1656    :CUSTOM_ID: change-indentation-entire-table
1657    :END:
1659    The indentation of a table is set by the first line.  So just fix the
1660    indentation of the first line and realign with =TAB=.
1662 ** In my huge table the realigning after each TAB takes too long.  What can I do?
1663    :PROPERTIES:
1664    :CUSTOM_ID: table-realigning-after-TAB-takes-long
1665    :END:
1667    Either split the table into several by inserting an empty line every
1668    100 lines or so.  Or turn off the automatic re-align with
1670    : (setq org-table-automatic-realign nil)
1672    After this the only way to realign a table is to press =C-c C-c=.  It
1673    will no longer happen automatically, removing the corresponding delays
1674    during editing.
1676 ** Recalculation of my table takes too long.  What can I do?
1677    :PROPERTIES:
1678    :CUSTOM_ID: Recalculation-of-my-table-takes-too-long
1679    :END:
1681    Nothing, really.  The spreadsheet in org is mostly done to make
1682    calculations possible, not so much to make them fast.  Since Org-mode
1683    is firmly committed to the ASCII format, nothing is stopping you from
1684    editing the table by hand.  Therefore, there is no internal
1685    representation of the data.  Each time Org-mode starts a computation,
1686    it must scan the table for special lines, find the fields etc.  This
1687    is slow.  Furthermore, Calc is slow compared to hardware
1688    computations.  To make this work with normal editing, recalculation
1689    is not happening automatically, or only for the current line, so that
1690    the long wait for a full table iteration only happens when you ask
1691    for it.
1693    So for really complex tables, moving to a "real" spreadsheet may
1694    still be the best option.
1696    That said, there are some ways to optimize things in Org-mode, and I
1697    have been thinking about moving a bit further down this line.
1698    However, for my applications this has so far not been an issue at
1699    all.  If you have a good case, you could try to convince me.
1701 ** =S-RET= in a table keeps increasing the copied numbers.  How can I stop this?
1702    :PROPERTIES:
1703    :CUSTOM_ID: S-RET-in-a-table-increases-copied-numbers
1704    :END:
1706    Well, it is /supposed/ to be a feature, to make it easy to create a
1707    column with increasing numbers.  If this gets into your way, turn it
1708    off with
1710    : (setq org-org-table-copy-increment nil)
1712 ** When I export tables to html, they don't have borders.
1713    :PROPERTIES:
1714    :CUSTOM_ID: table-borders-in-html-export
1715    :END:
1717 By default, org mode exports tables without borders.
1719 You can changed this by placing an =#+ATTR_HTML= line before the
1720 table:
1722 :  #+ATTR_HTML: border="2" rules="all" frame="all"
1724 See [[http://orgmode.org/manual/Tables-in-HTML-export.html#Tables-in-HTML-export][the manual]] for more details.
1726 ** Why does the Calc high precision (e. g. =p20=) not work like expected?
1727    :PROPERTIES:
1728    :CUSTOM_ID: table-high-precision
1729    :END:
1731 - *Short answer*
1733   Avoid
1734   : | 0.16666667000000 |
1735   : #+TBLFM: $1 = 1 / 2 * 3; p20 %.14f
1736   and use
1737   : | 0.16666666666667 |
1738   : #+TBLFM: $1 = 1 / 2 * 3; p20 f14
1740 - *Longer answer*
1742   It is important to distinguish between the precision of
1743   1) =p20=: Calc internal calculation (=calc-internal-prec=)
1744   2) =f14=: Calc float formatting, unlimited in precision (=calc-float-format=)
1745   3) =%.14f=: the =printf= reformatting, limited in precision
1747   See [[http://orgmode.org/manual/Formula-syntax-for-Calc.html#Formula-syntax-for-Calc][the Org manual]] (org-version 6.35 or newer) for more details.
1749   Use =C-h v org-calc-default-modes RET= to check the Org default settings
1750   which are used if no format specifiers are added to a table formula.
1751   The examples below have been made with the out_of_the_box Org defaults
1752   =calc-internal-prec = 12= and =calc-float-format = 8=.
1754   Remember the formula debugger, toggled with =C-c {=,
1755   to view the processing stages like:
1756   |   | formula debugger label | processing stage           |
1757   | / | <                      | <>                         |
1758   |---+------------------------+----------------------------|
1759   |   | Result:                | output of Calc             |
1760   |   | Format:                | reformatting with =printf= |
1762   Following are some examples to demonstrate
1763   the interaction of the three precisions.
1765   - *display precision limitations for Calc formulas*
1766     - limited by Calc internal calculation precision from Org default
1767       (here =p12=)
1768       : | 0.16666666666700 |
1769       : #+TBLFM: $1 = 1 / 2 * 3;     f14
1771       : | 0.1666666666670000000 |
1772       : #+TBLFM: $1 = 1 / 2 * 3;     f19
1774     - limited by Calc float format from Org default (here =f8=)
1775       : | 0.16666667 |
1776       : #+TBLFM: $1 = 1 / 2 * 3
1778       : | 0.16666667 |
1779       : #+TBLFM: $1 = 1 / 2 * 3; p20
1781       : | 0.16666667000000 |
1782       : #+TBLFM: $1 = 1 / 2 * 3;         %.14f
1784       : | 0.16666667000000 |
1785       : #+TBLFM: $1 = 1 / 2 * 3; p20     %.14f
1787     - limited by Calc float format specified
1788       : | 0.166667 |
1789       : #+TBLFM: $1 = 1 / 2 * 3;     f6
1791       : | 0.16666666666667 |
1792       : #+TBLFM: $1 = 1 / 2 * 3; p20 f14
1794       : | 0.1666666666666666667 |
1795       : #+TBLFM: $1 = 1 / 2 * 3; p20 f19
1797     - limited by =printf= conversion to Emacs Lisp float
1798       : | 0.1666666699999999900 | the inaccuracy is platform dependent |
1799       : #+TBLFM: $1 = 1 / 2 * 3;         %.19f
1801       : | 0.1666666699999999900 | the inaccuracy is platform dependent |
1802       : #+TBLFM: $1 = 1 / 2 * 3; p20     %.19f
1804       : | 0.1666666666666666600 | the inaccuracy is platform dependent |
1805       : #+TBLFM: $1 = 1 / 2 * 3; p20 f20 %.19f
1807     - limited by =printf= format specified
1808       : | 0.166667 |
1809       : #+TBLFM: $1 = 1 / 2 * 3;         %.6f
1811   - *display precision limitations for Emacs Lisp formulas*
1812     - limited by Emacs Lisp float
1813       : | 0.16666666666666666 |
1814       : #+TBLFM: $1 = '(/ 1.0 (* 2 3))
1816       : | 0.1666666666666666574 | the inaccuracy is platform dependent |
1817       : #+TBLFM: $1 = '(/ 1.0 (* 2 3)); %.19f
1819     - limited by =printf= format specified
1820       : | 0.16666666666667 |
1821       : #+TBLFM: $1 = '(/ 1.0 (* 2 3)); %.14f
1823 This FAQ entry is based on this [[http://thread.gmane.org/gmane.emacs.orgmode/22642][mailing list thread]]
1824 and is continued in the [[#table-float-fraction][next FAQ entry]].
1826 ** Which float format shows the fraction part also when the latter is zero?
1827    :PROPERTIES:
1828    :CUSTOM_ID: table-float-fraction
1829    :END:
1831 - *Short answer*
1833   Avoid
1834   : | 1 |
1835   : #+TBLFM: $1 = 1 + 0; f3
1836   and use
1837   : | 1.000 |
1838   : #+TBLFM: $1 = 1 + 0; %.3f
1840 - *Longer answer*
1842   For =f3= and =f-3= see =`d f' (`calc-fix-notation')= in [[http://www.delorie.com/gnu/docs/calc/calc.html#SEC_Top][the Calc manual]]
1843   in the section Mode Settings -> Display Modes -> Float Formats
1844   [[http://www.delorie.com/gnu/docs/calc/calc_163.html][found here as long as the section numbering is kept]].
1846   Remember the formula debugger, toggled with =C-c {=,
1847   to view the processing stages like:
1848   |   | formula debugger label | processing stage           |
1849   | / | <                      | <>                         |
1850   |---+------------------------+----------------------------|
1851   |   | Result:                | output of Calc             |
1852   |   | Format:                | reformatting with =printf= |
1854   Following are some examples to demonstrate different float formats.
1856   - normal precision
1857     : |----------------------+---------+-------+-------|
1858     : | number               |      f3 |   f-3 |  %.3f |
1859     : |----------------------+---------+-------+-------|
1860     : | 1 + 0                |       1 |     1 | 1.000 |
1861     : | 0 + 0                |       0 |     0 | 0.000 |
1862     : |----------------------+---------+-------+-------|
1863     : | 1 + 1 / 2 * 3 * 1000 |   1.000 | 1.000 | 1.000 |
1864     : | 0 + 1 / 2 * 3 * 1000 | 1.67e-4 | 0.000 | 0.000 |
1865     : |----------------------+---------+-------+-------|
1866     : | 1 + 1 / 2 * 3 *  100 |   1.002 | 1.002 | 1.002 |
1867     : | 0 + 1 / 2 * 3 *  100 |   0.002 | 0.002 | 0.002 |
1868     : |----------------------+---------+-------+-------|
1869     : #+TBLFM: $2 = $1; f3 :: $3 = $1; f-3 :: $4 = $1; %.3f
1871   - high precision
1872     : |----------------------+--------------------------+-----------------------|
1873     : | number               |                      f19 |                  f-19 |
1874     : |----------------------+--------------------------+-----------------------|
1875     : | 1 + 0                |                        1 |                     1 |
1876     : | 0 + 0                |                        0 |                     0 |
1877     : |----------------------+--------------------------+-----------------------|
1878     : | 1 + 1 / 2 * 3 * 1e19 |    1.0000000000000000000 | 1.0000000000000000000 |
1879     : | 0 + 1 / 2 * 3 * 1e19 | 1.666666666666666667e-20 | 0.0000000000000000000 |
1880     : |----------------------+--------------------------+-----------------------|
1881     : | 1 + 1 / 2 * 3 * 1e18 |    1.0000000000000000002 | 1.0000000000000000002 |
1882     : | 0 + 1 / 2 * 3 * 1e18 |    0.0000000000000000002 | 0.0000000000000000002 |
1883     : |----------------------+--------------------------+-----------------------|
1884     : #+TBLFM: $2 = $1; p20 f19 :: $3 = $1; p20 f-19
1886     The =printf= reformatting (=%.19f=) cannot be used with high precision,
1887     see the [[#table-high-precision][previous FAQ entry]].
1889 ** How can I center tables in LaTeX output?
1890    :PROPERTIES:
1891    :CATEGORY: centered-tables-in-latex
1892    :END:
1894 Set the `org-export-latex-tables-centered' to `t':
1896 : (defcustom org-export-latex-tables-centered t
1897 :   "When non-nil, tables are exported in a center environment."
1898 :   :group 'org-export-latex
1899 :   :type 'boolean)
1901 * Markup
1902   :PROPERTIES:
1903   :CUSTOM_ID: Footnotes
1904   :END:
1905 ** How can I get automatic renumbering of footnotes in org-mode?
1906    :PROPERTIES:
1907    :CUSTOM_ID:       footnote-auto-adjust
1908    :END:
1910 You can add the following line to your .emacs file:
1912 : (setq org-footnote-auto-adjust t)
1914 Or, if you prefer, you can turn this option on locally by placing the
1915 following line at the top of your org file:
1917 : #+STARTUP: fnadjust
1919 When auto-adjust is turned on, footnotes in the file with numerical
1920 labels will be renumbered whenever a new footnote is added. Meanwhile,
1921 all footnotes, including those with custom labels such
1922 =[fn:custom-label ]=, will be sorted in the order of their appearance
1923 in the text.
1925 This emulates the footnote behavior that many users may be familiar
1926 with from word-processing programs or from the footnote-mode included
1927 with emacs.
1929 If you do not turn on org-footnote-auto-adjust, you sort and/or
1930 renumber footnotes at any time by calling org-footnote-action with a
1931 prefix argument.
1933 ** Why isn't auto renumbering of footnotes turned on by default?
1934    :PROPERTIES:
1935    :CUSTOM_ID:       why-no-default-auto-adjust
1936    :END:
1938 Org mode has a very robust footnote mechanism allowing for a variety
1939 of types of footnotes. With some of the following footnote notations,
1940 auto-adjust may be either irrelevant or undesired:
1942  - Automatically numbered
1943  - Footnotes with custom labels
1944  - Inline footnotes
1946 In addition, org mode can be customized to place footnotes either at
1947 the end of a document or at the end of the outline heading in which
1948 they appear. Users who change this setting while editing a document
1949 may be disconcerted to find all of their footnotes rearranged
1950 automatically.
1952 ** I have auto-fill-mode set and org-mode is inserting unwanted comment markers!
1953    :PROPERTIES:
1954    :CUSTOM_ID: auto-fill-and-unwanted-comments
1955    :END:
1957 If the following occurs:
1959 #+begin_src org
1961 #+OPTIONS: toc:nil
1962 Some entered text.
1963 # More entered tex.
1965 #+end_src
1967 Make sure that the variable comment-start is nil.
1969 ** Are there any shortcuts for entering source blocks and comment lines?
1970    :PROPERTIES:
1971    :CUSTOM_ID: shortcuts-for-entering-source-blocks
1972    :END:
1974 Org mode has some [[http://orgmode.org/manual/Literal-examples.html#Literal-examples][very convenient markup]] for including literal blocks
1975 and lines of code in a file. (This is especially useful when exporting
1976 documents or using the contributed package [[file:org-contrib/babel/index.org][org-babel]] for executing
1977 blocks of code.)
1979 #+begin_src org
1980   ,#+begin_src perl
1981   ,  print "Hello, world!\n";
1982   ,#+end_src
1983 #+end_src
1985 It can be tiresome to enter the block comment lines manually. There
1986 are several possible shortcuts you can use to enter them:
1988 1) Built-in expansion
1990    - Org mode has a "secret" method of expanding source code blocks
1991      and comment lines.
1993    - If you type "<s" followed by =TAB= or =M-TAB=, a source block will
1994      magically appear.
1996    - For a full list of expansions, type =M-x describe-variable
1997      [RET] org-structure-template-alist=.
1999 2) [[http://orgmode.org/manual/Literal-examples.html#Literal-examples][Registers]]
2001    - Add the following line to your emacs file:
2003      =(set-register ?p "#+begin_src\n\n#+end_src perl")=
2005    - Then type =C-x r i p= to insert the source block. Please note: if
2006      you save another value to the register "p" with =C-x r s p=, it
2007      will overwrite the setting above for the current emacs session.
2009 3) [[http://orgmode.org/manual/Literal-examples.html#Literal-examples][Abbrevs]]
2011  - Activate the abbrev minor-mode in org-mode:
2013    + M-x abbrev-mode
2015    + /Permanently/:
2017        + =(add-hook 'org-mode-hook (lambda () (abbrev-mode 1)))=
2019  - In org-mode, type "sbp" (a sample abbreviation for a perl source
2020    block).
2022  - Immediately after "sbp" type =C-x a i l=.
2024  - Enter the expansion:
2026    - =#+begin_src perl[C-q C-j][C-q C-j]#+end_src=
2028    - Note: =C-q C-j= creates a new line in the minibuffer
2030  - Now, whenever, you type sbp followed by =SPACE= or =RET= in an
2031    org-mode buffer, the src block will magically appear.
2033  - To review your list of abbrevs, type =M-x edit-abbrevs=.
2035  - If you want more complex completion (like yasnippet) you can combine
2036    abbrev mode with [[http://www.emacswiki.org/emacs/SkeletonMode][skeletons]].
2038 4) [[http://code.google.com/p/yasnippet/][Yasnippet]]
2040  - Several org-mode users install yasnippet for convenient, complex
2041    expansion.
2043  - See Bernt Hansen's [[http://doc.norang.ca/org-mode.html#Yasnippets][org-mode setup]] for a good introduction to
2044    yasnippet.
2046 * Capture and remember
2047   :PROPERTIES:
2048   :CUSTOM_ID: Remember
2049   :END:
2050 ** Can I use a variable or a function inside the `org-capture-templates' variable?
2051    :PROPERTIES:
2052    :CUSTOM_ID: variable-inside-capture-templates
2053    :END:
2055 Yes.  Use [[http://www.gnu.org/s/emacs/manual/html_node/elisp/Backquote.html][backquotes]].
2057 E.g. if you have a variable called =org-test-file= and you want the
2058 variable =org-capture-templates= to "understand" (i.e. evaluate)
2059 =org-test-file= when Emacs evaluates the =(setq org-capture-templates
2060 [...])= expression, use backquotes like this:
2062 #+begin_src emacs-lisp
2063 (setq org-capture-templates
2064       `(("t" "Todo" entry (file+headline ,org-test-file "Tasks")
2065        "* TODO %?\n  %i\n  %a")
2066       ("b" "Buy" item (file+olp ,org-test-file "Stuff to Buy" "House")
2067        "")))
2068 #+end_src
2070 ** Can I use the remember buffer to clock a customer phone call?
2071    :PROPERTIES:
2072    :CUSTOM_ID: use-remember-buffer-to-clock-phone-call
2073    :END:
2075   Yes, you can.  Take a look at the [[http://thread.gmane.org/gmane.emacs.orgmode/5482][setup described by Bernt Hansen]]
2076   and check out (in the same thread) what Nick Docos had to fix to
2077   make Bernt's set-up work for him.
2078 ** Can I automatically start the clock when opening a remember template?
2079    :PROPERTIES:
2080    :CUSTOM_ID: start-clock-when-opening-remember-template
2081    :END:
2083    Yes, this is possible.  Use the following code and make sure that
2084    after executing it, `my-start-clock-if-needed' is in
2085    `remember-mode-hook' /after/ `org-remember-apply-template'.
2087    : (add-hook 'remember-mode-hook 'my-start-clock-if-needed 'append)
2088    : (defun my-start-clock-if-needed ()
2089    :   (save-excursion
2090    :     (goto-char (point-min))
2091    :     (when (re-search-forward " *CLOCK-IN *" nil t)
2092    :       (replace-match "")
2093    :       (org-clock-in))))
2095    Then, when a template contains the key string CLOCK-IN, the clock
2096    will be started.  Starting with Org-mode version 5.20, the clock will
2097    automatically be stopped when storing the remember buffer.
2099 * Searches
2100   :PROPERTIES:
2101   :CUSTOM_ID: Searches
2102   :END:
2103 ** Isearch does not find string hidden in links.  What can I do?
2104    :PROPERTIES:
2105    :CUSTOM_ID: isearch-in-links
2106    :END:
2108   M-x =visible-mode= will display the full link, making them searchable.
2110 ** How can I reduce the amount of context shown in sparse trees?
2111    :PROPERTIES:
2112    :CUSTOM_ID: context-in-sparse-trees
2113    :END:
2115    Take a look at the following variables:
2117    - =org-show-hierarchy-above=
2118    - =org-show-following-headline=
2119    - =org-show-siblings=
2120    - =org-show-entry-blow=
2122    which give command-dependent control over how much context is shown
2123    by a particular operation.
2125 ** How can I combine the results of two calls to =org-occur=?
2126    :PROPERTIES:
2127    :CUSTOM_ID: two-calls-to-org-occur
2128    :END:
2130    You can construct a regular expression that matches all targets you
2131    want.  Alternatively, use a =C-u= prefix with the second and any
2132    further calls to =org-occur= to keep the current visibility and
2133    highlighting in addition to the new ones.
2135 * Agenda
2136   :PROPERTIES:
2137   :CUSTOM_ID: Agenda
2138   :END:
2139 ** How can I change the advanced warning time for deadlines?
2140    :PROPERTIES:
2141    :CUSTOM_ID: warning-period-for-deadlines
2142    :END:
2143 ##<<warning-period-for-deadlines>>
2145 Deadline warnings appear in the daily agenda view a specified number
2146 of days before the deadline is due. The default setting is 14 days.
2147 You can change this with the variable =org-deadline-warning-days=.
2148 (See [[http://orgmode.org/manual/Deadlines-and-scheduling.html#Deadlines-and-scheduling][this section]] of the manual.)
2150 For instance,
2152 : (setq org-deadline-warning-days 30)
2154 would cause warnings for each deadline to appear 30 days in advance.
2156 Naturally, you might not want warnings for all of your deadlines to
2157 appear so far in advance. Thus, you can change the lead time for
2158 individual items as follows:
2160 : * TODO Get a gift for the party
2161 :   DEADLINE: <2009-01-16 Fri -2d>
2163 The "-2d" above changes the lead time for this deadline warning to two
2164 days in advance. You can also use "w" for weeks and "m" for months.
2165 ** How can I postpone a task until a certain date?
2166    :PROPERTIES:
2167    :CUSTOM_ID: deferring-tasks
2168    :END:
2170 The easiest way to postpone a task is to schedule it in the future.
2171 For instance, typing =C-c C-s +2w= on a headline will push a task two
2172 weeks into the future, so that it won't show up on the daily agenda
2173 until two weeks from now.
2175 If you'd like to prevent the task from showing up on your global todo
2176 list, you have a couple of options.
2178 1. You can set the variable =org-agenda-todo-ignore-scheduled= to =t=.
2179    This will exclude any scheduled items from your global list of
2180    active todos (=C-c a t=). (The variable
2181    =org-agenda-todo-ignore-with-date= will exclude both scheduled and
2182    deadline items from your todo list).
2183 2. You can remove the todo keyword from the item (C-c C-t <SPC>). The
2184    item will still appear on your agenda two weeks from today, but it
2185    won't show up on your todo lists.
2186 ** Can I send myself an email containing tasks or other agenda info?
2187    :PROPERTIES:
2188    :CUSTOM_ID: email-containing-tasks-or-other-agenda-info
2189    :END:
2191    Yes.  See [[http://article.gmane.org/gmane.emacs.orgmode/6112][this thread]] on the list.
2193 ** How can I limit the agenda view to my "work" tasks?
2194    :PROPERTIES:
2195    :CUSTOM_ID: limit-agenda-with-tag-filtering
2196    :END:
2198    It is often convenient to group org files into separate categories,
2199    such as "home" and "work" (or "personal" and "professional"). One
2200    of the main reasons for such classification is to create agenda
2201    views that are limited by type of work or area of responsibility.
2202    For instance, while at work, one may want to see only professional
2203    tasks; while away from work, one may want to see only personal
2204    tasks.
2206    One way to categorize files and tasks is to use a "#+FILETAGS"
2207    declaration at the top of each file, such as:
2209    : #+FILETAGS: work
2211    As long as org-use-tag-inheritance is turned on, the filetags will
2212    be inherited by all tasks in the file. A file can have multiple
2213    filetags. And, of course, tags can be added to individual headings.
2215    Tasks can be quickly filtered by tag from within the agenda by
2216    typing "/" and the name of the tag. The full key sequence to filter
2217    for work items in an agenda view would be:
2219    : C-c a a / work [or a tag shortcut]
2221 ** How can I limit the agenda view to a particular category?
2222    :PROPERTIES:
2223    :CUSTOM_ID: limit-agenda-with-category-match
2224    :END:
2226    Another way to filter agenda views by type of work is to use a
2227    "#+CATEGORY" declaration at the top of each file, such as:
2229    : #+CATEGORY: work
2231    Categories can also be added to individual headings within a file:
2233    : * Big project
2234    :   :PROPERTIES:
2235    :   :CATEGORY: work
2236    :   :END:
2238    All todos belonging to the category "work" can be found a with a
2239    simple tags-todo search:
2241    : C-c a M
2243    At the prompt, type:
2245    : CATEGORY="work"
2247    The same results can be achieved with custom agenda commands, such as:
2249 #+BEGIN_SRC emacs-lisp
2250 (setq org-agenda-custom-commands
2251       '(("h" tags-todo "CATEGORY=\"home\"")
2252         ("w" tags-todo "CATEGORY=\"work\"")
2253         ;; other custom agenda commands here
2254         ))
2255 #+END_SRC
2257 ** How can include all org files in a directory in my agenda?
2258    :PROPERTIES:
2259    :CUSTOM_ID: set-agenda-files-using-wildcards
2260    :END:
2262 You can simply include the directory (as one of the items) in the
2263 value of the variable org-agenda-files:
2265 : (setq org-agenda-files '("/my/special/path/org/"))
2267 There is another way of accomplishing the same end:
2269 : (setq org-agenda-files (file-expand-wildcards "/my/special/path/org/*.org"))
2271 ** Why aren't items disappearing from my agenda once they are marked done?
2272    :PROPERTIES:
2273    :CUSTOM_ID: removing-done-items-from-agenda
2274    :END:
2276 If items remain on your daily/weekly agenda after they are marked
2277 done, check the configuration of the following variables:
2279 : org-agenda-skip-scheduled-if-done
2280 : org-agenda-skip-deadline-if-done
2281 : org-agenda-skip-timestamp-if-done
2283 For instance, type:
2285 : M-x customize-variable RET org-agenda-skip-scheduled-if-done
2287 If this variable is turned off (=nil=), then scheduled items will
2288 remain on the agenda even after they are marked done.
2290 If the variable is turned on (=t=), then scheduled items will
2291 disappear from the agenda after they are marked done.
2293 If these settings seem not to behave the way you expect, then make
2294 sure you understand [[scheduled-vs-deadline-vs-timestamp][the
2295 difference between SCHEDULED, DEADLINE, and timestamps]].
2297 ** What is the difference between SCHEDULED, DEADLINE, and plain timestamps?
2298    :PROPERTIES:
2299    :CUSTOM_ID: scheduled-vs-deadline-vs-timestamp
2300    :END:
2302 1. SCHEDULED items (set with =C-c C-s=) will appear on your agenda on
2303    the day they are scheduled and on every day thereafter until they
2304    are done. Schedule a task if you want to be reminded to do
2305    something beginning on a certain day and until it is done.
2307    : ** TODO Scheduled item
2308    :    SCHEDULED: <2009-03-01 Sun>
2310 2. Items with a DEADLINE timestamp (set with =C-c C-d=) appear on your
2311    agenda in advance of the when they are due and remain on your
2312    agenda until they are done. Add a DEADLINE to an item if you want
2313    to make sure to complete it by a certain date. (The variable
2314    org-deadline-warning-days determines how far in advance items with
2315    deadlines will show up in the agenda. See [[warning-period-for-deadlines][this FAQ]] for more
2316    information.)
2318    : ** TODO Item with a deadline
2319    :    DEADLINE: <2009-01-20 Tue>
2321 3. An active timestamp (set with =C-c .=) will appear on your agenda
2322    only on the day it is scheduled. Use a timestamp for appointments
2323    or any reminders you want to show up only on a particular day.
2325    : ** TODO Item with an active timestamp
2326    : <2009-04-18 Sat>
2328 Note: items with inactive timestamps (set with C-c ! and marked by
2329 square brackets) will not show up in the agenda at all.
2331 ** Can I add files recursively to my list of agenda files?
2332    :PROPERTIES:
2333    :CUSTOM_ID: set-agenda-files-recursively
2334    :END:
2336 Yes, you can use the library "find-lisp."
2338 : (load-library "find-lisp")
2339 : (setq org-agenda-files (find-lisp-find-files "~/org" "\.org$"))
2341 This will add all files ending in =org= in the directory "~/org"
2342 and all of its subdirectories to your list of agenda files.
2344 See [[http://thread.gmane.org/gmane.emacs.orgmode/8992][this thread]] on the mailing list for more information.
2346 ** Why does an item appearing at the wrong time of day in my agenda?
2347    :PROPERTIES:
2348    :CUSTOM_ID: agenda-wrong-time-of-day
2349    :END:
2351 When preparing the agenda view, org-mode scans each relevant headline
2352 for a time designation. This approach is very nice for adding
2353 free-form timestamps to an item for scheduling. Thus, either of the
2354 following work would work to schedule an item at 10:00am:
2356 #+begin_src org
2357 ,** 10:00am Get dried ice at the magic store
2358 ,   SCHEDULED: <2009-05-27 Wed>
2359 #+end_src
2361 #+begin_src org
2362 ,** Get dried ice at the magic store
2363 ,   SCHEDULED: <2009-05-27 Wed 10:00>
2364 #+end_src
2366 To enable this flexibility, org-mode scans the entire headline for
2367 time of day notation. A potential problem can arise if you use
2368 inactive timestamps in the headline to note when an item was created.
2369 For example,
2371 #+begin_src org
2372 ,** Get dried ice at the magic store [2009-05-26 Tue 12:58]
2373 ,   SCHEDULED: <2009-05-27 Wed>
2374 #+end_src
2376 Org mode would interpret the time in the inactive timestamp as a
2377 time-of-day indicator and the entry would appear in your agenda at
2378 12:58.
2380 If you would like to turn off the time-of-day search, you can
2381 configure the variable =org-agenda-search-headline-for-time= (requires
2382 org-mode >= 6.24).
2384 ** How can I change the visibility of an item from the agenda?
2385    :PROPERTIES:
2386    :CUSTOM_ID: cycling-visibility-from-agenda
2387    :END:
2389 You can add a keybinding as follows:
2391 #+begin_src emacs-lisp
2392 (add-hook 'org-agenda-mode-hook
2393    (lambda ()
2394      (define-key org-agenda-mode-map " " 'org-agenda-cycle-show)))
2395 #+end_src
2397 Then, as you press SPACE on an item on the agenda, it will cycle the
2398 visibility of its original location.
2400 ** Is there any way to set org-mode so that tags don't appear in the agenda view?
2402 See the =org-agenda-remove-tags= variable.
2404 ** I work late at night! How can I extend my current day past midnight?
2405    :PROPERTIES:
2406    :CUSTOM_ID: org-extend-today-until
2407    :END:
2409 If you work past midnight, you may not want your daily agenda view to
2410 switch to the next day at 12 a.m. (the default). To extend your day,
2411 simply set the value of org-extend-today-until to a positive number
2412 corresponding to the number of hours you work past midnight. For
2413 example, the following setting will cause the current day to extend
2414 until 6 a.m.
2416 : (setq org-extend-today-until 6)
2418 * Appointments/Diary
2419   :PROPERTIES:
2420   :CUSTOM_ID: Appointments/Diary
2421   :END:
2422 ** Is it possible to include entries from org-mode files into my emacs diary?
2423    :PROPERTIES:
2424    :CUSTOM_ID: include-entries-from-org-mode-files-into-emacs-diary
2425    :END:
2427    Since the org-mode agenda is much more powerful and can contain the
2428    diary, you should think twice before deciding to do this.  If you
2429    insist, however, integrating Org-mode information into the diary is
2430    possible.  You need to turn on /fancy diary display/ by setting in
2431    .emacs:
2433    : (add-hook 'diary-display-hook 'diary-fancy-display)
2435    Then include the following line into your ~/diary file, in
2436    order to get the entries from all files listed in the variable
2437    =org-agenda-files=
2439    : &%%(org-diary)
2441    You may also select specific files with
2443    : &%%(org-diary) ~/path/to/some/org-file.org
2444    : &%%(org-diary) ~/path/to/another/org-file.org
2446    If you now launch the calendar and press @<tt>d@</tt> to display a
2447    diary, the headlines of entries containing a timestamp, date range,
2448    schedule, or deadline referring to the selected date will be listed.
2449    Just like Org-mode's agenda view, the diary for /today/ contains
2450    additional entries for overdue deadlines and scheduled items.  See
2451    also the documentation of the =org-diary= function.  Under XEmacs, it
2452    is not possible to jump back from the diary to the org, this works
2453    only in the agenda buffer.
2454 ** I want to add my Org scheduled/deadlined entries in my diary!
2455    :PROPERTIES:
2456    :CUSTOM_ID: add-Org-scheduled/deadlined-entries-to-diary!
2457    :END:
2459   Put this in your ~/.diary:
2461   : &%%(org-diary :scheduled :timestamp :deadline)
2463 ** How can I set up automatic reminders based on Org information?
2464    :PROPERTIES:
2465    :CUSTOM_ID: automatic-reminders
2466    :END:
2468   See [[http://article.gmane.org/gmane.emacs.orgmode/5271][this post]] by N. Dokos on the list.
2469 ** How can I make =appt= notice my Org appointments?
2470    :PROPERTIES:
2471    :CUSTOM_ID: appt-notice-my-Org-appointments
2472    :END:
2474   : M-x org-agenda-to-appt RET
2476 ** How can I create more complex appointments in my org-files?
2477    :PROPERTIES:
2478    :CUSTOM_ID: diary-sexp-in-org-files
2479    :END:
2481 Org-mode's active timestamps work very well for scheduling individual
2482 or recurring appointments, such as:
2484 #+begin_src org
2485   ,* 8:00am Dentist appointment <2009-01-16 Fri>
2486 #+end_src
2489 #+begin_src org
2490   ,* Vacation
2491   ,  <2009-03-20 Fri>--<2009-04-01 Wed>
2492 #+end_src
2496 #+begin_src org
2497   ,* Weekly meeting with boss
2498   ,  <2009-01-20 Tue 14:00 +1w>
2499 #+end_src
2501 Sometimes, however, you need to set up more complicated recurring
2502 appointments. Org-mode has built-in support for many of
2503 [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Sexp-Diary-Entries.html][the
2504 powerful sexp entries]] that work in [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Diary.html#Diary][Emacs diary]]. Let's say, for
2505 instance, that you teach a class that meets every Monday evening
2506 between February 16 and April 20, 2009. The way to enter this an
2507 org-mode file is:
2509 #+begin_src org
2510   ,** Class 7:00pm-9:00pm
2511   ,   <%%(and (= 1 (calendar-day-of-week date)) (diary-block 2 16 2009 4 20 2009))>
2512 #+end_src
2514 The expression above designates all Mondays that fall between February
2515 16 and April 20. How exactly does it work?
2517  - (and... :: Indicates that *both* of the conditions that follow have
2518           to be true.
2520    - (= 1 (calendar-day-of-week date)) :: Is the day of the week a
2521         Monday?
2523        - Note: the function calendar-day-of-week converts the date to the day of week
2524          expressed in numeric form, where 0 = Sunday, 1 = Monday, and so on.
2526    - (diary-block 2 16 2009 4 20 2009) :: Does the date fall between
2527         these two dates?
2529 You can make a sexp as complex as you like. If you wanted to omit a
2530 week because of holidays, for instance, you could add another
2531 condition to the sexp:
2533 #+begin_src org
2534   ,** Class 7:00pm-9:00pm
2535   ,   <%%(unless (diary-block 3 9 2009 3 13 2009) (and (= 1 (calendar-day-of-week date)) (diary-block 2 16 2009 4 20 2009)))>
2536 #+end_src
2538 The sexp above would omit Monday during the week of March 9, 2009. For
2539 another way to accomplish the same thing, see [[org-diary-class][this FAQ]].
2541 Another diary function commonly used for more complex scheduling is
2542 diary-float. For instance,
2544 #+begin_src org
2545   ,* Monthly meeting
2546   ,  <%%(diary-float t 3 3)>
2547 #+end_src
2549 ...would appear on the third Wednesday of every month.
2551 For more ideas on how to create diary special expressions, see [[http://www.emacswiki.org/cgi-bin/wiki/DiaryMode][this
2552 page on the Emacs wiki]].
2554 ** How can I schedule a weekly class that lasts for a limited period of time?
2555    :PROPERTIES:
2556    :CUSTOM_ID: org-diary-class
2557    :END:
2559 Org-mode offers a convenient diary sexp function for setting up a
2560 recurring appointment that lasts for a certain period of time, such as
2561 a class. It is called org-diary-class and it can be entered as
2562 follows:
2564 #+begin_src org
2565   ,** Class 7:00pm-9:00pm
2566   ,   <%%(org-diary-class 2 16 2009 4 20 2009 1 10)>
2567 #+end_src
2569 The function above schedules an appointment for every Monday (1)
2570 between February 16 and April 20, 2009, except for ISO week 10 (March
2571 1 to March 7).
2573 The function org-diary-class has the following format:
2575 : (org-diary-class M1 D1 Y1 M2 D2 Y2 DAYNAME &rest SKIP-WEEKS)
2577 M1/2, D1/2, and Y1/2 indicate the beginning and ending dates. Dayname
2578 takes the form of a number indicating the day of the week (0 = Sunday,
2579 1 = Monday, and so on...). In addition, one can add an optional
2580 argument SKIP-WEEKS to indicate weeks on the calendar that should be
2581 skipped. This argument should be expressed as an ISO week number. You
2582 can find the number by invoking emacs' built-in calendar (=M-x
2583 calendar=), navigating to the appropriate week, and typing =p c=
2584 (calendar-iso-print-date).
2586 Please note: the order of the month, day, and year arguments depends
2587 on the variables =calendar-date-style= and/or
2588 =european=calendar=style=. (See the documentation for these variables
2589 with C-h v or M-x describe variable.) For instance, the example above
2590 works if =calendar-date-style= is set to ='american=. If
2591 =calendar-date-style= is set to ='iso=, then the arguments to the
2592 org-diary-class sexp would have the following format:
2594 : (org-diary-class Y1 M1 D1 Y2 M2 D2 DAYNAME &rest SKIP-WEEKS)
2596 Here is an alternative method, shared by Paul Sexton on the org
2597 mailing list:
2599 Let's say you are taking night classes in Spanish. The class is every
2600 Wednesday evening at 7pm, starting on 18 August, and runs for 8 weeks.
2601 Org-mode's timestamps do not support limited occurrences of recurrent
2602 items -- you have to schedule the item with infinite recurrences, then
2603 delete it when it finishes.
2605 To schedule the Spanish classes, put the following in your =.emacs=:
2607 #+begin_src emacs-lisp
2608   (defun diary-limited-cyclic (recurrences interval m d y)
2609     "For use in emacs diary. Cyclic item with limited number of recurrences.
2610   Occurs every INTERVAL days, starting on YYYY-MM-DD, for a total of
2611   RECURRENCES occasions."
2612     (let ((startdate (calendar-absolute-from-gregorian (list m d y)))
2613           (today (calendar-absolute-from-gregorian date)))
2614       (and (not (minusp (- today startdate)))
2615            (zerop (% (- today startdate) interval))
2616            (< (floor (- today startdate) interval) recurrences))))
2617 #+end_src
2618 The item in the org file looks like this:
2620 #+begin_src org
2621   ,** 19:00-21:00 Spanish lessons
2622   ,   <%%(diary-limited-cyclic 8 7 8 18 2010)>
2623 #+end_src
2625 ** How can I set an event to occur every day except Saturday and Sunday?
2627 #+begin_src org
2628   ,** Daily meeting
2629   ,   <%%(memq (calendar-day-of-week date) '(1 2 3 4 5))>
2630 #+end_src
2632 ** How do I schedule events relative to Easter Sunday?
2634    Easter's date moves around from year to year according to a
2635    complicated set of criteria which I do not claim to understand.
2636    However the following code will allow you to schedule recurring
2637    events relative to Easter Sunday.
2639    Note: the function da-easter is from:
2640    http://github.com/soren/elisp/blob/master/da-kalender.el
2642    Put the following in your .emacs:
2644 #+begin_src emacs-lisp
2645   (defun da-easter (year)
2646     "Calculate the date for Easter Sunday in YEAR. Returns the date in the
2647   Gregorian calendar, ie (MM DD YY) format."
2648     (let* ((century (1+ (/ year 100)))
2649            (shifted-epact (% (+ 14 (* 11 (% year 19))
2650                                 (- (/ (* 3 century) 4))
2651                                 (/ (+ 5 (* 8 century)) 25)
2652                                 (* 30 century))
2653                              30))
2654            (adjusted-epact (if (or (= shifted-epact 0)
2655                                    (and (= shifted-epact 1)
2656                                         (< 10 (% year 19))))
2657                                (1+ shifted-epact)
2658                              shifted-epact))
2659            (paschal-moon (- (calendar-absolute-from-gregorian
2660                              (list 4 19 year))
2661                             adjusted-epact)))
2662       (calendar-dayname-on-or-before 0 (+ paschal-moon 7))))
2665   (defun da-easter-gregorian (year)
2666     (calendar-gregorian-from-absolute (da-easter year)))
2668   (defun calendar-days-from-easter ()
2669     "When used in a diary sexp, this function will calculate how many days
2670   are between the current date (DATE) and Easter Sunday."
2671     (- (calendar-absolute-from-gregorian date)
2672        (da-easter (calendar-extract-year date))))
2673 #+end_src
2675     Now we can schedule the public holidays associated with Easter as
2676     recurring events. Good Friday is 2 days before "Easter", Easter
2677     Monday is one day after.
2679 #+begin_src org
2680   ,* Good Friday
2681   ,  <%%(= -2 (calendar-days-from-easter))>
2683   ,* Easter Sunday
2684   ,  <%%(= 0 (calendar-days-from-easter))>
2686   ,* Easter Monday
2687   ,  <%%(= 1 (calendar-days-from-easter))>
2688 #+end_src
2689    [Source: Posted by Paul Sexton on Org-mode mailing list.]
2691 ** How to schedule public holiday that is "the nearest Monday to DATE"?
2693    In New Zealand each regional capital has an "Anniversary Day". The
2694    date of Auckland's anniversary day is "the nearest Monday to 29
2695    January".
2697    Put this in your =.emacs=:
2699 #+begin_src emacs-lisp
2700   (defun calendar-nearest-to (target-dayname target-day target-month)
2701     "Recurring event that occurs in the nearest TARGET-DAYNAME to
2702   the date TARGET-DAY, TARGET-MONTH each year."
2703     (interactive)
2704     (let* ((dayname (calendar-day-of-week date))
2705            (target-date (list target-month target-day (calendar-extract-year date)))
2706            (days-diff (abs (- (calendar-day-number date)
2707                               (calendar-day-number target-date)))))
2708       (and (= dayname target-dayname)
2709            (< days-diff 4))))
2710 #+end_src
2712    Now we can schedule Auckland Anniversary Day. The first argument,
2713    1, means Monday (days of the week are numbered starting with
2714    Sunday=0).
2716    [Source: Originally posted by Paul Sexton on Org-mode mailing list.]
2718 ** How to schedule public holiday on "the 4th Monday in October"?
2720    This does not require any additions to =.emacs=:
2722 #+begin_src org
2723   ,* Labour Day (NZ)
2724   ,  <%%(diary-float 10 1 4)>
2725 #+end_src
2727 * Export
2728   :PROPERTIES:
2729   :CUSTOM_ID: Export
2730   :END:
2731 ** Can I get TODO items exported to HTML as lists, rather than as headlines?
2732    :PROPERTIES:
2733    :CUSTOM_ID: export-TODO-items-as-lists
2734    :END:
2736    If you plan to use ASCII or HTML export, make sure things you want to
2737    be exported as item lists are level 4 at least, even if that does
2738    mean there is a level jump.  For example:
2740    : * Todays top priorities
2741    : **** TODO write a letter to xyz
2742    : **** TODO Finish the paper
2743    : **** Pick up kids at the school
2745    Alternatively, if you need a specific value for the heading/item
2746    transition in a particular file, use the =#+OPTIONS= line to
2747    configure the H switch.
2749    : #+OPTIONS:   H:2; ...
2751 ** Can I export only a single subtree?
2752    :PROPERTIES:
2753    :CUSTOM_ID: export-single-subtree
2754    :END:
2756 If you want to export a subtree, mark the subtree as region and then
2757 export. Marking can be done with =C-c @ C-x C-x=, for example.
2759 Alternatively, you can select option =1= in the org export dispatcher
2760 (e.g.., =C-c C-e 1 h= to export the current subtree to html).
2762 By default, the title of the exported file will be set to the heading
2763 of the subtree. You can, however, [[#export-options-for-subtree][customize the title and other export
2764 options]].
2766 ** How can I customize export options for a single subtree?
2767    :PROPERTIES:
2768    :CUSTOM_ID: export-options-for-subtree
2769    :END:
2771 You can set unique export options for a [[#export-single-subtree][single subtree]] by using
2772 properties. Relevant properties include:
2774  - EXPORT_TITLE
2775  - EXPORT_AUTHOR
2776  - EXPORT_DATE
2777  - EXPORT_FILE_NAME
2778  - EXPORT_OPTIONS (corresponds to the =#+OPTIONS:= [[http://orgmode.org/manual/Export-options.html#Export-options][configuration line]])
2780 ** How can I tell my calendar web application about appointments in my agenda files?
2782 Here is what you need to do:
2784 1. a script that calls Emacs in batch mode and produce a .ics file
2785 2. a script that uploads this .ics file somewhere on the web
2786 3. tell your webapp to fetch this .ics file on the web
2788 Here is the script I use for the first step:
2790 #+begin_src shell-script-mode
2791 #!/bin/bash
2793 /usr/local/bin/emacs --batch --eval \
2794 "(progn (load-file \"~/install/git/org-mode/org.el\") \
2795         (load-file \"~/elisp/config/org-batch-config.el\") \
2796         (setq org-combined-agenda-icalendar-file \"~/org/cal/org.ics\")
2797         (setq org-agenda-files (quote (\"~/org/bzg.org\"))))" \
2798     -f org-export-icalendar-combine-agenda-files
2799 #+end_src
2801 Depending on your configuration, you might change the load sequence.
2803 Here is the script I use for the second step:
2805 #+begin_src shell-script-mode
2806 #!/bin/bash
2807 /usr/bin/rsync -rtv ~/org/org.ics -e ssh me@my_server:/home/me/public_html/
2808 #+end_src
2810 Note: if you want to cron this rsync script, you will need to let
2811 =my_server= to know about your SSH public key.  Check [[http://troy.jdmz.net/rsync/index.html][this page]] as a
2812 starter.
2814 Now you can cron the two scripts above and your webapp will always be
2815 up to date with your Org agendas.
2817 Also see [[http://orgmode.org/org.html#Exporting-Agenda-Views][Exporting agenda views]] from Org manual.
2819 ** How can I get Mac OSX 10.3 iCal to import my Org-exported .ics files?
2820    :PROPERTIES:
2821    :CUSTOM_ID: iCal-import-ics-files-old
2822    :END:
2824    When using iCal under Apple MacOS X Tiger, you can create a new
2825    calendar /OrgMode/ (the default name for the calendar created by =C-c
2826    C-e c=, see the variables =org-icalendar-combined-name= and
2827    =org-combined-agenda-icalendar-file=).  Then set Org-mode to
2828    overwrite the corresponding file /~/Library/Calendars/OrgMode.ics/.
2829    You may even use AppleScript to make iCal re-read the calendar files
2830    each time a new version of /OrgMode.ics/ is produced.  Here is the
2831    setup needed for this:
2833    : (setq org-combined-agenda-icalendar-file
2834    :     "~/Library/Calendars/OrgMode.ics")
2835    : (add-hook 'org-after-save-iCalendar-file-hook
2836    :  (lambda ()
2837    :   (shell-command
2838    :    "osascript -e 'tell application \"iCal\" to reload calendars'")))
2840 ** How can I get Mac OSX 10.4 or later iCal to import my Org-exported .ics files?
2841    :PROPERTIES:
2842    :CUSTOM_ID: iCal-import-ics-files-new
2843    :END:
2845    For Mac OS X 10.4, you need to write the ics file to
2846    =/Library/WebServer/Documents/= and then subscribe iCalendar to
2847    =http: //localhost/orgmode.ics=
2849 ** How can I remove timestamps and todo keywords from my exported file?
2850    :PROPERTIES:
2851    :CUSTOM_ID: export-options-remove-timestamps
2852    :END:
2854 You can place an options line at the top of your org file:
2856 : #+OPTIONS: <:nil todo:nil
2858 There is a whole host of export options you can set with an in-buffer
2859 options or via global variables. See [[http://orgmode.org/manual/Export-options.html#Export-options][this section]] of the manual for a
2860 full list.
2862 ** How can I preserve faces when I export an agenda from the command line?
2863    :PROPERTIES:
2864    :CUSTOM_ID: preserving-faces-during-batch-export
2865    :END:
2867 Normally, when you export an org file or an agenda view from within
2868 emacs, htmlize will convert your face definitions to direct color css
2869 styles inlined into each =<span>= object, resulting in an HTML output
2870 that preserves the general look of your Org buffers and agenda views.
2872 Let's say you generate an export from the command line, such as the
2873 following:
2875 : emacs -batch -l ~/.emacs -eval '(org-batch-agenda "e")'
2879 : emacs -batch -l ~/.emacs -eval '(org-publish-all)'
2881 In such an instance, the exported HTML will contain only very basic
2882 color styles. The reason is that when Emacs is run in batch mode, it
2883 does not have a display and therefore only rudimentary face
2884 definitions.  If you'd like to use more complex styles, you'll have to
2885 make sure that the export process only assigns classes instead of
2886 direct color values.  This can be done by binding the variable
2887 =org-export-htmlize-output-style= to =css= for the duration of the
2888 export, for example with
2890 : emacs -batch -l ~/.emacs
2891 :   -eval '(let ((org-export-htmlize-generate-css (quote css)))
2892 :            (org-batch-agenda "e"))'
2894 Then you can use a style file to make these classes look any way you
2895 like.  To generate face definitions for a CSS file based on any faces
2896 you are currently using in Emacs, you can use the following command:
2898 : M-x org-export-htmlize-generate-css RET
2900 This will generate a =<style>...</style>= section, the content of
2901 which you can add to your style file.
2903 ** How can I avoid dark color background when exporting agenda to ps format?
2904    :PROPERTIES:
2905    :CUSTOM_ID: avoiding-dark-background-when-exporting-agenda
2906    :END:
2908 Add this to your .emacs and evaluate it.
2910 #+BEGIN_SRC emacs-lisp
2911   (setq org-agenda-exporter-settings
2912         '((ps-print-color-p 'black-white)))
2913 #+END_SRC
2915 ** How can I include e.g. an abstract in export to Latex and HTML?
2916    :PROPERTIES:
2917    :CUSTOM_ID: include-abstract-in-export-to-latex-and-html
2918    :END:
2920 Org does not currently have special markup for abstracts, but for
2921 export purposes, you can extend the block-level structural and
2922 semantic markup in Org with the contributed package [[file:org-contrib/org-special-blocks.org][org-special-blocks]]
2923 (by Chris Gray). To turn it on, put this in your =.emacs=:
2925 : (require 'org-special-blocks)
2927 Now, you can mark up the abstract of your article like this:
2929 : #+BEGIN_ABSTRACT
2930 : Falling apples were observed and compared with pears. Newton's laws
2931 : were confirmed at the 95% confidence level.
2932 : #+END_ABSTRACT 
2934 Exporting to Latex wraps this in a
2935 =\begin{abstract}....\end{abstract}= environment, which just works.
2937 HTML export wraps it in a ~<div class="abstract">...</div>~
2938 element. The HTML result won't look like anything special until you
2939 style it. Here is some sample CSS to get you started; put these in
2940 your document header:
2942 : #+STYLE: <style>.abstract {margin: 1em; padding: 1em; border: 1px solid black}
2943 : #+STYLE: .abstract:before {content: "Abstract: "; font-weight: bold}</style>
2945 Generally, =#+begin_foo= will work for any simple Latex =foo=
2946 environment not supported by existing Org markup.
2948 If you need to pass parameters, process the block content in some way,
2949 or support other exporters, you may want to consider whether you can
2950 customize it using Eric Schulte's [[file:org-contrib/org-exp-blocks.org][org-exp-blocks]] instead.
2952 ** How can I get colored source code when exporting to LaTeX?
2953    :PROPERTIES:
2954    :CUSTOM_ID: fontified_source_code_w_latex
2955    :END:
2957 As of Sun Aug 9 2009 the "current" version of Org-mode (see
2958 [[keeping-current-with-Org-mode-development]]) supports exporting
2959 source code to LaTeX using the listings package.
2961 To turn on listing export add the following to your Org-mode
2962 customization.
2963 #+begin_src emacs-lisp
2964   ;; requite org-latex so that the following variables are defined
2965   (require 'org-latex)
2967   ;; tell org to use listings
2968   (setq org-export-latex-listings t)
2970   ;; you must include the listings package
2971   (add-to-list 'org-export-latex-packages-alist '("" "listings"))
2973   ;; if you want colored source code then you need to include the color package
2974   (add-to-list 'org-export-latex-packages-alist '("" "color"))
2975 #+end_src
2977 The listings package will now be used to fontify source code in your
2978 LaTeX documents.  By default listings will not color any of your
2979 source code.  If you would like to set colors for keywords and
2980 comments in your latex documents you can do so using LaTeX directives
2981 like the following.
2982 #+begin_src latex
2983   \lstset{keywordstyle=\color{blue},
2984     commentstyle=\color{red},
2985     stringstyle=\color{green}
2986   }
2987 #+end_src
2989 of if you want to get even fancier with your colors you can try
2990 something like the following
2991 #+begin_src latex
2992 \definecolor{keywords}{RGB}{255,0,90}
2993 \definecolor{comments}{RGB}{60,179,113}
2994 \definecolor{fore}{RGB}{249,242,215}
2995 \definecolor{back}{RGB}{51,51,51}
2996 \lstset{
2997   basicstyle=\color{fore},
2998   keywordstyle=\color{keywords},
2999   commentstyle=\color{comments},
3000   backgroundcolor=\color{back}
3002 #+end_src
3004 For more complex listings use cases consult the [[ftp://ftp.tex.ac.uk/tex-archive/macros/latex/contrib/listings/listings.pdf][listings manual]].
3006 ** How can I export to Latex Beamer
3007    :PROPERTIES:
3008    :CUSTOM_ID: beamer
3009    :END:
3010 The latex [[http://latex-beamer.sourceforge.net/][Beamer Class]] is a useful class for generating slide shows.
3011 The following can be used to export Org-mode documents to LaTeX
3012 beamer.
3014 Add the following to your Emacs initialization file.
3015 #+begin_src emacs-lisp
3016   (unless (boundp 'org-export-latex-classes)
3017     (setq org-export-latex-classes nil))
3018   (add-to-list 'org-export-latex-classes
3019                '("beamer"
3020                  "\\documentclass[11pt]{beamer}\n\\usepackage[utf8]{inputenc}\n\\usepackage[T1]{fontenc}\n\\usepackage{hyperref}\n\\usepackage{verbatim}\n"
3021                  ("\\section{%s}" . "\\section*{%s}")
3022                  ("\\begin{frame}\\frametitle{%s}" "\\end{frame}"
3023                   "\\begin{frame}\\frametitle{%s}" "\\end{frame}")))
3024 #+end_src
3026 Then by placing
3027 : #+LaTeX_CLASS: beamer
3028 in the header of your Org-mode document it will automatically export
3029 to the Beamer document class on LaTeX export.  With the above
3030 configuration top-level headers will be mapped to sections in the
3031 Beamer document, second-level headers will be mapped to frames, and
3032 lower level headlines will be mapped to itemize objects.
3034 This above is adapted from an [[http://article.gmane.org/gmane.emacs.orgmode/15077/match=beamer+dokos][email by Nick Dokos]], and an [[http://article.gmane.org/gmane.emacs.orgmode/17767/match=beamer+dokos][email by
3035 Thomas Dye]].  For a much more complex Beamer setup see the [[http://article.gmane.org/gmane.emacs.orgmode/17767/match=beamer+dokos][email by
3036 Thomas Dye]].
3038 ** How can I use RefTeX in Org-mode files for LaTeX export and in Org-babel LaTeX code blocks?
3039    :PROPERTIES:
3040    :CUSTOM_ID: using-reftex-in-org-mode
3041    :END:
3043 [[http://www.gnu.org/software/auctex/reftex.html][RefTeX]] is an indispensable tool for the author of LaTeX documents.  It
3044 aids in creation of bibliographies, cross-references, indexes, and
3045 glossaries.  RefTeX understands the structure of multi-file LaTeX
3046 documents and is able to collect from them information about the
3047 location(s) of external data stores used in creation of the final
3048 document.  RefTeX was written by Carsten Dominik and is currently
3049 being maintained by the [[http://www.gnu.org/software/auctex/index.html][AucTeX]] project.
3051 *** Using RefTeX In Org-mode Files for LaTeX Export
3052 In Org-mode files for LaTeX export, the trick is to find a way to tell
3053 RefTeX the locations of external data stores.  One way is to set the
3054 variable, =reftex-default-bibliography=.  Add lines like these to
3055 .emacs:
3057 #+begin_src emacs-lisp
3058   (setq reftex-default-bibliography
3059         (quote
3060          ("default.bib" "other-default.bib")))
3061 #+end_src
3063 In practice, this is a limited solution and the
3064 typical user will want to pass this information on a per-file basis.
3065 Two solutions to this problem were posted on a blog, [[http://www.mfasold.net/blog/2009/02/using-emacs-org-mode-to-draft-papers/][Mario's
3066 Braindump]].
3068 The first solution, proposed by Mario, enables the RefTeX citation
3069 function in Org-mode.  Add these lines to .emacs:
3071 #+begin_src emacs-lisp
3072   (defun org-mode-reftex-setup ()
3073     (load-library "reftex")
3074     (and (buffer-file-name)
3075          (file-exists-p (buffer-file-name))
3076          (reftex-parse-all))
3077     (define-key org-mode-map (kbd "C-c )") 'reftex-citation))
3078   (add-hook 'org-mode-hook 'org-mode-reftex-setup)
3079 #+end_src
3081 Then add the following lines anywhere in the Org-mode file (Org-mode
3082 will recognize them as LaTeX commands):
3084 #+begin_src org
3085 \bibliographystyle{plain}
3086 \bibliography{BIB-NAME}
3087 #+end_src
3089 With this setup, =C-c )= will invoke =reftex-citation= which will
3090 insert a reference in the usual way:
3092 #+begin_src org
3093   ,* test reftex
3095   ,This is a citation \cite{tierney90}.
3097   ,\bibliographystyle{plain}
3098   ,\bibliography{tsd}
3099 #+end_src
3101 This Org-mode file will export the following LaTeX output:
3103 #+begin_src latex :exports code
3104   % Created 2010-03-22 Mon 14:34
3105   \documentclass[11pt,letter]{article}
3106   \usepackage[utf8]{inputenc}
3107   \usepackage[T1]{fontenc}
3108   \usepackage{hyperref}
3110   \title{test.org}
3111   \author{Tom Dye}
3112   \date{2010-03-22 Mon}
3114   \begin{document}
3116   \maketitle
3118   \setcounter{tocdepth}{3}
3119   \tableofcontents
3120   \vspace*{1cm}
3122   \section{test reftex}
3123   \label{sec-1}
3126   This is a citation \cite{tierney90}.
3128   \bibliographystyle{plain}
3129   \bibliography{tsd}
3131   \end{document}
3132 #+end_src
3135 A second solution, to activate the RefTeX minor mode on a per-file
3136 basis, was posted by Kevin Brubeck Unhammer in response to this idea.
3137 Add the following lines to .emacs:
3139 #+begin_src emacs-lisp
3140   (add-hook ‘org-mode-hook
3141              (lambda ()
3142                (if (member “WRITE” org-todo-keywords-1)
3143                    (org-mode-article-modes))))
3144 #+end_src
3146 where =org-mode-article-modes= is defined as follows:
3148 #+begin_src emacs-lisp
3149   (defun org-mode-article-modes ()
3150     (reftex-mode t)
3151     (bib-cite-minor-mode t)
3152     (and (buffer-file-name)
3153          (file-exists-p (buffer-file-name))
3154          (reftex-parse-all)))
3155 #+end_src
3157 Add the =\bibliographystyle{}= and =\bibliography{}= lines to the
3158 Org-mode file as before and define a TODO keyword, =WRITE=, perhaps
3159 like this:
3161 #+begin_src org
3162   ,#+TODO: TODO(t) STARTED(s) WRITE | DONE(d) DEFERRED(f)
3163 #+end_src
3165 With this setup, you insert a citation with =M-x reftex-citation RET=.
3167 *** Using RefTeX in Org-babel LaTeX Code Blocks
3169 In Org-babel LaTeX code blocks, the trick is to give RefTeX access to
3170 information in other Org-babel LaTeX code blocks.  If you use an Emacs
3171 starter kit where configuration information is held in Org-mode files,
3172 then the second solution is preferable because you won't be asked for
3173 a master file when Emacs is started.  For this reason, the second
3174 solution is modified for use with Org-babel latex code blocks.  No
3175 key-binding is needed here because Org-babel code blocks are edited
3176 within the usual AucTeX environment.
3178 Add the following lines to .emacs (adapted from  Kevin Brubeck Unhammer's [[http://www.mfasold.net/blog/2009/02/using-emacs-org-mode-to-draft-papers/][Reftex Setup]])
3179 #+begin_src emacs-lisp
3180   (defun org-mode-article-modes ()
3181     (reftex-mode t)
3182     (and (buffer-file-name)
3183          (file-exists-p (buffer-file-name))
3184          (reftex-parse-all)))
3186   (add-hook 'org-mode-hook
3187             (lambda ()
3188               (if (member "REFTEX" org-todo-keywords-1)
3189                   (org-mode-article-modes))))
3190 #+end_src
3192 Then add a line like the following line to the top of your org-mode file:
3194 #+begin_src org
3195   ,#+TODO: TODO(t) STARTED(s) | DONE(d) DEFERRED(f) REFTEX
3196 #+end_src
3198 When you open an org-mode file with a line like this, RefTeX will
3199 prompt for the master .tex file, which will be parsed in the usual
3200 way.  This means that the .tex file should already exist, perhaps by
3201 tangling the LaTeX preamble and postamble, before
3202 =org-mode-article-modes= is activated for the Org-mode file.
3204 ** Why is my exported PDF file almost unreadable?
3205    :PROPERTIES:
3206    :CUSTOM_ID: unreadable-pdfs
3207    :END:
3209 Some PDF viewers (earlier versions (< v6) of Acrobat Reader, Evince,
3210 possibly others) do not get along with Adobe Type3 fonts, producing
3211 almost unreadable screen output (printed output is OK). If you see
3212 this, first verify the fonts that your document uses: open it with
3213 Acrobat Reader or Evince, select "Properties" from the "File" menu and
3214 click on the "Fonts" tab; alternatively, you can use the pdffonts
3215 program (part of the xpdf-reader package) from the command line.  If
3216 that is indeed the problem, then either use a different viewer or
3217 install Type1 versions of the problematic fonts. For more details, see
3218 the "PDF export" section of [[./org-dependencies.org][org-dependencies]].
3220 ** Can I add attributes to a link or an image in HTML export?
3221    :PROPERTIES:
3222    :CUSTOM_ID: html-image-and-link-attributes
3223    :END:
3225 Yes.  Excerpt from [[http://orgmode.org/manual/Images-in-HTML-export.html#Images-in-HTML-export][Org's manual]]:
3227 If you need to add attributes to an inlined image, use a `#+ATTR_HTML'.
3228 In the example below we specify the `alt' and `title' attributes to
3229 support text viewers and accessibility, and align it to the right.
3231 :  #+CAPTION: A black cat stalking a spider
3232 :  #+ATTR_HTML: alt="cat/spider image" title="Action!" align="right"
3233 :  [[./img/a.jpg]]
3235 and you could use `http' addresses just as well.
3237 ** How can I export an org file to rtf, odt (Open Office), or doc (Word)?
3238    :PROPERTIES:
3239    :CUSTOM_ID: convert-to-open-office
3240    :END:
3242 While you cannot export directly from org to doc or odt, you can
3243 export to one of org-mode's supported export formats and then use an
3244 external tool or method to convert the exported file to doc or odt.
3245 While most of these methods work with simple documents, they may work
3246 more or less well when the document contains complex elements, such as
3247 footnotes, embedded images, math formulas, and so on. (Note, the lists
3248 below are by no means comprehensive).
3250 1. html -> odt/doc/rtf
3251    - open html in Open Office and save as odt/doc ([[http://permalink.gmane.org/gmane.emacs.orgmode/31482][see this post by
3252      Eric Fraga]])
3253    - [[http://www.artofsolving.com/opensource/pyodconverter][PyODConverter]]
3254    - [[http://johnmacfarlane.net/pandoc/][Pandoc]] (this works for LaTeX and docbook as well)
3255    - (Mac only) The [[http://developer.apple.com/library/mac/#DOCUMENTATION/Darwin/Reference/ManPages/man1/textutil.1.html][textutil]] utility bundled with OS X can convert
3256      from html to doc
3258 2. LaTeX -> odt/doc/rtf
3259    - [[http://latex2rtf.sourceforge.net/][LaTeX2rtf]] (works well with index, footnotes, and references)
3260    - [[http://www.tug.org/tex4ht/][TeX4ht]] (works with more complex latex elements, though can be
3261      difficult to install)
3262      - run =mk4ht oolatex file.tex=
3264 See [[http://permalink.gmane.org/gmane.emacs.orgmode/31168][this thread]] for further details.
3266 * MobileOrg
3268 ** Which versions of MobileOrg do exist
3269    :PROPERTIES:
3270    :CUSTOM_ID: mobileorg_versions
3271    :END:
3273 - MobileOrg for the iPhone/iPod Touch/iPad series of devices, by
3274   Richard Moreland.  Check out
3275   [[http://mobileorg.ncogni.to/][Richard's page]]
3276 - Matt Jones is developing a feature-equivalent application for
3277   Android, see
3278   [[http://wiki.github.com/matburt/mobileorg-android/][his project page]].
3280 ** What can I do if I don't want to use Dropbox.com
3281    :PROPERTIES:
3282    :CUSTOM_ID: mobileorg_webdav
3283    :END:
3285 Dropbox.com is the easiest way to connect between Emacs and MobileOrg,
3286 you can get a free account there.  If for some reason you cannot or do
3287 not want to use this path, you can use any webdav server.  On this
3288 webdav server you need to create a dedicated directory for the
3289 communication between Emacs and MobileOrg.  If you can mount that
3290 directory locally so that Emacs can directly write to it, just point
3291 to that directory using the variable =org-mobile-directory=.  Using
3292 the /tramp/ method, =org-mobile-directory= may point to a remote
3293 directory accessible through, for example, /ssh/ and /scp/:
3295 #+begin_src emacs-lisp
3296 (setq org-mobile-directory "/scpc:user@@remote.host:org/webdav/")
3297 #+end_src
3299 If Emacs cannot access the WebDAV directory directly using a /tramp/
3300 method, you can use a local directory for staging.  Other means must
3301 then be used to keep this directory in sync with the WebDAV directory.
3302 In the following example, files are staged in =~/stage/=, and Org-mode
3303 hooks take care of moving files to and from the WebDAV directory using
3304 /scp/.
3306 #+begin_src emacs-lisp
3307 (setq org-mobile-directory "~/stage/")
3308 (add-hook 'org-mobile-post-push-hook
3309   (lambda () (shell-command "scp -r ~/stage/* user@@wdhost:mobile/")))
3310 (add-hook 'org-mobile-pre-pull-hook
3311   (lambda () (shell-command "scp user@@wdhost:mobile/mobileorg.org ~/stage/ ")))
3312 (add-hook 'org-mobile-post-pull-hook
3313   (lambda () (shell-command "scp ~/stage/mobileorg.org user@@wdhost:mobile/")))
3314 #+end_src
3316 * Mathjax
3318 ** How to install MathJax on my server?
3320 Org uses MathJax as its default HTML display engine for equations.
3322 Org relies on the version of MathJax available from orgmode.org, but you
3323 might want to use another version and install MathJax on your own server.
3325 1. Download a [[http://sourceforge.net/projects/mathjax/files/][MathJax archive]].
3327 2. Upload it somewhere on your server (say http://me.org/mathjax/)
3329 3. Set the correct path in =org-export-html-mathjax-options= (i.e. replace
3330    http://orgmode.org/mathjax/MathJax.js by
3331    http://me.org/mathjax/MathJax.js)
3333 You can also get [[http://www.mathjax.org/resources/docs/?installation.html][MathJax from git or svn]] -- in this case, be careful not to
3334 forget to unzip the fonts.zip archive in the mathjax directory.
3336 * COMMENT HTML style specifications
3338 #+begin_src emacs-lisp
3339   (defun org-faq-make-target ()
3340     "Make hard target for current headline."
3341     (interactive)
3342     (if (not (org-on-heading-p))
3343         (error "Not on a headline"))
3344     (let ((h (org-trim (org-get-heading 'no-tags))))
3345       (if (string-match "[ \t]*\\?\\'" h)
3346           (setq h (replace-match "" t t h)))
3347       (while (string-match "[ \t]+" h)
3348         (setq h (replace-match "-" t t h)))
3349       (org-entry-put nil "CUSTOM_ID" h)))
3350 #+end_src