Skip to content

Instantly share code, notes, and snippets.

@ajchemist
Last active November 21, 2018 06:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajchemist/6885302 to your computer and use it in GitHub Desktop.
Save ajchemist/6885302 to your computer and use it in GitHub Desktop.
ox-latex-lisp-macro
(eval-after-load "ox-latex"
'(eval `(progn
(let ((latex-div-struct
'(("\\book{%s}" . "\\book*{%s}")
("\\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}"))))
,@(mapcar #'(lambda (class)
`(mapc #'(lambda (level)
(add-to-list 'org-latex-classes
`(,(concat ,class "-" level) ;class-name
,(concat "\\documentclass{" ,class "}\n" ;header-str
"[NO-DEFAULT-PACKAGES]\n[PACKAGES]\n[EXTRA]")
,@(memql
(assoc-string
(concat "\\" level "{%s}")
latex-div-struct)
latex-div-struct)))) '("part" "chapter" "section")))
'("memoir" "oblivoir")))) t))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment