lamme2024-scientific-project/setup.org

90 lines
2.5 KiB
Org Mode
Raw Normal View History

#+title: Standalone Emacs Config file for my report
* I can set a variable at startup!
Let's say I want this emacs-lisp code to be run at startup when I open my org file (say, for config purpose)
#+begin_src emacs-lisp :tangle yes
(setq lamme2024 "org powered")
#+end_src
To do so, add the following somewhere in your =report.org= file:
#+begin_src org
#+name: startup
#+begin_src emacs-lisp
(org-babel-load-file "./setup.org")
#+end_src
#+end_src
And add the following at the end of your =report.org= file:
#+begin_src org
# Local Variables:
# eval: (progn (org-babel-goto-named-src-block "startup") (org-babel-execute-src-block) (outline-hide-sublevels 1))
# End:
#+end_src
The next time you will open your file, you will be asked twice if org-babel should run the =startup= cell.
See: [[https://emacs.stackexchange.com/a/41456/41374]]
* Configure LaTeX template
#+begin_src emacs-lisp :tangle yes
(add-to-list 'org-latex-classes
'("lamme2024"
"\\documentclass{scrreprt}
[NO-DEFAULT-PACKAGES]
[EXTRA]
\\makeindex
\\makeglossaries "
;("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
#+end_src
#+RESULTS:
| lamme2024 | \documentclass{scrreprt} |
* Add latex: link for custom latex macro text wrapping
#+begin_src emacs-lisp
(org-add-link-type
"latex" nil
(lambda (path desc format)
(cond
((eq format 'html)
(format "<span class=\"%s\">%s</span>" path desc))
((eq format 'latex)
(format "\\%s{%s}" path desc)))))
#+end_src
#+begin_src emacs-lisp :tangle yes
(org-add-link-type
"latex" nil
(lambda (path desc format)
(cond
((eq format 'html)
(format "<span class=\"%s\">%s</span>" path desc))
((eq format 'latex)
(format "\\%s{%s}" path desc)))))
#+end_src
#+RESULTS:
: Created latex link.
* Extend org reference system
#+begin_src emacs-lisp :tangle yes
(require 'org-ref)
(require 'org-ref-refproc)
(add-hook 'org-export-before-parsing-hook #'org-ref-acronyms-before-parsing)
(add-hook 'org-export-before-parsing-hook #'org-ref-glossary-before-parsing)
#+end_src
#+RESULTS:
| org-ref-glossary-before-parsing | org-ref-acronyms-before-parsing | org-attach-expand-links |