Org Ecosystem
Patterns for Org-mode document creation, GTD workflow, literate programming with Babel, and export/publishing.
Syntax Fundamentals
Headings and Properties
* Top-level heading
** Second-level heading
*** Third-level heading
* Task
:PROPERTIES:
:CATEGORY: work
:EFFORT: 2h
:END:
Timestamps
<2024-01-15 Mon>- active (shows in agenda)[2024-01-15 Mon]- inactive<2024-01-15 Mon +1w>- repeating weekly<2024-01-15 Mon .+1d>- restart from completion
Markup
*bold*/italic/_underline_=verbatim=~code~+strikethrough+
Links
[[https://orgmode.org][Org website]]- external[[file:./other.org][Local file]]- file link[[*Heading][Internal link]]- heading link[[id:unique-id][ID link]]- stable cross-file reference
Tables
| Name | Qty | Price | Total |
|-------+-----+-------+-------|
| Item1 | 2 | 10.0 | 20.0 |
#+TBLFM: $4=$2*$3
GTD Workflow
TODO States
#+TODO: TODO(t) NEXT(n) WAITING(w@/!) | DONE(d!) CANCELLED(c@)
@prompts for note,!records timestamp,|separates active/done
Capture Templates
(setq org-capture-templates
'(("t" "Todo" entry (file+headline "~/org/inbox.org" "Tasks")
"* TODO %?\n %i\n %a")
("n" "Note" entry (file "~/org/notes.org")
"* %? :note:\n %U\n %i")))
%?cursor,%iregion,%aannotation,%Uinactive timestamp
Clocking
:LOGBOOK:
CLOCK: [2024-01-15 Mon 10:00]--[2024-01-15 Mon 12:30] => 2:30
:END:
C-c C-x C-iclock in,C-c C-x C-oclock out
Babel (Literate Programming)
Code Blocks
#+NAME: example-block
#+BEGIN_SRC python :results output :exports both
print("Hello from Python")
#+END_SRC
Header Arguments
:results- value, output, silent, table:exports- code, results, both, none:var- variable binding:session- persistent session:tangle- extract to file:noweb- reference expansion
Tangling
#+BEGIN_SRC python :tangle ./script.py :shebang "#!/usr/bin/env python3"
def main():
print("Generated from org file")
#+END_SRC
C-c C-v tto tangle
Noweb References
#+NAME: imports
#+BEGIN_SRC python :noweb-ref imports
import os
#+END_SRC
#+BEGIN_SRC python :tangle ./program.py :noweb yes
<<imports>>
#+END_SRC
Export
Document Header
#+TITLE: Document Title
#+AUTHOR: Author Name
#+OPTIONS: toc:2 num:t author:t
Export Backends
- HTML:
C-c C-e h h - PDF via LaTeX:
C-c C-e l p - Beamer slides:
C-c C-e l b - Markdown:
C-c C-e m m
Selective Export
* Exported heading
* Not exported :noexport:
#+BEGIN_EXPORT html
<div class="custom">Raw HTML</div>
#+END_EXPORT
Best Practices
Critical:
- One file per major project or area
- Keep inbox.org for captures, refile regularly
- Consistent TODO state workflow across files
High:
- Add SCHEDULED/DEADLINE to time-sensitive tasks
- Use tags for context (@home, @work) not categories
- Archive completed subtrees periodically
Anti-Patterns
| Avoid | Instead |
|---|---|
| Single giant file | Split by project/topic |
| Deep nesting (>4 levels) | Flatten or split files |
| Never refiling captures | Daily/weekly inbox processing |
| Hardcoded paths | Use relative paths or org-directory |
| Babel side effects | Use :results silent, document clearly |
Constraints
Must:
- Use appropriate heading levels (don't skip)
- Close all drawers and blocks properly
- Use relative paths for portability
Avoid:
- Excessive nesting beyond 4-5 levels
- Side effects in babel without documentation
Converted and distributed by TomeVault — claim your Tome and manage your conversions.