-
Notifications
You must be signed in to change notification settings - Fork 0
/
step04b-orgmode.el
226 lines (185 loc) · 7.45 KB
/
step04b-orgmode.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
;; Pretty fontification of source code blocks
;; needs to be defined before requiring Org (http://orgmode.org/worg/org-contrib/babel/examples/fontify-src-code-blocks.html)
(defface org-block-begin-line ;
'((t (:underline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF")))
"Face used for the line delimiting the begin of source blocks.")
(defface org-block-background
'((t (:background "#FFFFEA")))
"Face used for the source block background.")
(defface org-block-end-line
'((t (:overline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF")))
"Face used for the line delimiting the end of source blocks.")
;;; packages
;; IMPORTANT NOTE:
;; this org-plus-contrib seems necessary to obtain correct export
;; from orgmode to latex
;; i.e. #BEGIN_EXPORT latex do not export \begin{export}
;; and <l returns #BEGIN_EXPORT latex and not #BEGIN_LaTeX
;; I have met issue on windows when installing the package this is why it is put in the config
;; originally emacs-genome was using the following code:
;; (use-package org
;; :ensure org-plus-contrib ;; ensure org's devel
;; :pin org
;; :config
;; )
;; (add-to-list 'load-path (expand-file-name "packages/org-plus-contrib" path-emacs-config))
(use-package org)
(use-package org-agenda)
(use-package org-clock)
;;;; dynamic reference (e.g. citep:xx)
(use-package org-ref :ensure t)
;;;; figure labels
;; setting variable org-latex-prefer-user-labels
;; will mâle the exporter export
;; #+NAME: fig:1 and #+LABEL: fig:1
;; to \label{fig:1} instead of \label{orgparagraph1}
(setq org-latex-prefer-user-labels t)
;;;; export to latex
(use-package ox-latex)
;; https://emacs.stackexchange.com/questions/9492/is-it-possible-to-export-content-of-subtrees-without-their-headings/17677#17677
;; require to install org-plus-contrib first
;; (require 'package)
;; (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
;;(use-package org :ensure org-plus-contrib)
(use-package ox-extra)
(ox-extras-activate '(ignore-headlines))
;;;; export to beamer
(use-package ox-beamer)
;;;; export to markdown
(use-package ox-md)
;; (add-to-list 'load-path (expand-file-name "packages/orgmode-accessories" path-emacs-config))
;; (require 'ox-ravel)
;;; enable to execute languages in orgmode
(if(string-equal system-type "windows-nt")
(org-babel-do-load-languages
(quote org-babel-load-languages)
(quote ((emacs-lisp . t)
(dot . t)
(calc . t)
(ditaa . t)
(R . t)
(C . t)
(gnuplot . t)
(shell . t)
(ledger . t)
(org . t)
(picolisp . t)
(clojure . t)
(lilypond . t)
(plantuml . t)
(latex . t)
))
)
(org-babel-do-load-languages
(quote org-babel-load-languages)
(quote ((emacs-lisp . t)
(dot . t)
(calc . t)
(ditaa . t)
(R . t)
(C . t)
(gnuplot . t)
(shell . t)
(ledger . t)
(org . t)
(picolisp . t)
(clojure . t)
(lilypond . t)
(plantuml . t)
(latex . t)
))
)
)
;;; keywords
(setq org-todo-keyword-faces
'(
("TOBRING" . (:foreground "#cc0000" :background "#ffb3b3" :weight bold)) ;; red
("TOSEND" . (:foreground "#cc0000" :background "#ffb3b3" :weight bold)) ;; red
("TODO" . (:foreground "#cc0000" :background "#ffb3b3" :weight bold)) ;; red
("WAITING" . (:foreground "#666600" :background "#ffffcc" :weight bold)) ;; yellow
("INPROGRESS" . (:foreground "#cc3300" :background "#ffcc66" :weight bold)) ;; orange
("DELEGATED" . (:foreground "#66004d" :background "#ffccf2" :weight bold)) ;; purple
("INACTIVE" . (:foreground "#734d26" :background "#e6ccb3" :weight bold)) ;;brown
("SENT" . (:foreground "blue" :background "#6699ff" :weight bold)) ;; blue
("DONE" . (:foreground "#008000" :background "#99ff99" :weight bold)) ;; green
("TASK" . (:foreground "#000000" :background "#b3b3b3" :weight bold)) ;; black
("EVENT" . (:foreground "#000000" :background "#b3b3b3" :weight bold)) ;; black
("METTING" . (:foreground "#000000" :background "#b3b3b3" :weight bold)) ;; black
)
)
;; colors
;; https://www.w3schools.com/colors/colors_picker.asp
;; NOTE: the keywords needs to be written in org-todo-keywords to be active
(setq org-todo-keywords
'((sequence "TODO" "WAITING" "INPROGRESS" "DELEGATED" "INACTIVE" "DONE")
(sequence "TOBRING" "DONE")
(sequence "TOSEND" "SENT" "DONE")
(sequence "TASK")
(sequence "EVENT")
(sequence "MEETING")
))
(setq org-tags-exclude-from-inheritance '("prj")
org-stuck-projects '("+prj/DONE"
("TODO" "TASK") ()))
;;; manage tasks
;; If you want to keep track of stuck projects you should tag your
;; projects with :prj:, and define:
(setq org-tags-exclude-from-inheritance '("prj")
org-stuck-projects '("+prj/-MAYBE-DONE"
("TODO" "TASK") ()))
;; Define a tag that marks TASK entries as yours:
(setq org-sec-me user-full-name)
;; Finally, you add the special views to your org-agenda-custom-commands:
(setq org-agenda-custom-commands
'(("h" "Work todos" tags-todo
"-personal-doat={.+}-dowith={.+}/!-TASK"
((org-agenda-todo-ignore-scheduled t)))
("H" "All work todos" tags-todo "-personal/!-TASK-MAYBE"
((org-agenda-todo-ignore-scheduled nil)))
("A" "Work todos with doat or dowith" tags-todo
"-personal+doat={.+}|dowith={.+}/!-TASK"
((org-agenda-todo-ignore-scheduled nil)))
("j" "TODO dowith and TASK with"
((org-sec-with-view "TODO dowith")
(org-sec-where-view "TODO doat")
(org-sec-assigned-with-view "TASK with")
(org-sec-stuck-with-view "STUCK with")))
("J" "Interactive TODO dowith and TASK with"
((org-sec-who-view "TODO dowith"))))
)
;;; options
(setq org-babel-hash-show-time t)
(setq org-export-babel-evaluate t)
(add-to-list 'org-babel-default-header-args '(:eval . "never-export"))
(add-to-list 'org-babel-default-header-args '(:tangle . "yes"))
(add-to-list 'org-babel-tangle-lang-exts '("R" . "R"))
(setq org-export-allow-BIND t)
;; dont ask confirmation before executing block
(setq org-confirm-babel-evaluate nil)
;; highlight latex code in orgmode
(setq org-highlight-latex-and-related '(latex script entities))
;; syntax coloring in SRC blocks
(setq org-src-fontify-natively t)
;; tell org to use listings (instead of verbatim) for source code
(setq org-latex-listings t)
;; automatically indent lists and similar structures of Org buffers
(setq org-startup-indented t)
;; indent code blocks using TAB
(setq org-src-tab-acts-natively t)
;;; link with latex
;; https://github.com/jkitchin/org-ref/blob/master/org-ref.org (section latex export)
(setq org-latex-pdf-process (list "latexmk -shell-escape -bibtex -f -pdf %f"))
;; file that are automatically removed at the end of the compilation
;; do not remove .bbl because needed when submitting latex files to arXiv
;; do not remove .aux because needed when using the xr package to refer to external tex file
(setq org-latex-logfiles-extensions (quote ("bcf" "blg" "soc" "fdb_latexmk" "fff" "fls" "figlist" "idx" "lof" "nav" "out" "ptc" "run.xml")))
;; faithfull indentation of R code when exporting to latex
(setq org-src-preserve-indentation t)
;;; export *txt* as bold instead of alert
;; https://orgmode.org/worg/exporters/beamer/ox-beamer.html#export-filters
(defun my-beamer-bold (contents backend info)
(when (eq backend 'beamer)
(replace-regexp-in-string "\\`\\\\[A-Za-z0-9]+" "\\\\textbf" contents)))
(add-to-list 'org-export-filter-bold-functions 'my-beamer-bold)
;;; lisp
(org-babel-do-load-languages 'org-babel-load-languages '((lisp . t)))