diff --git a/.dir-locals.el b/.dir-locals.el index 5ea85dc..193d84a 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -3,24 +3,4 @@ ((org-mode . - ((eval . (progn - (require 'ox-latex) - (setq-local - org-latex-classes - '(("chapter-code" - "\\documentclass{chapter-code}" - ("\\chapter{%s}" . "\\chapter*{%s}") - ("\\section{%s}" . "\\section*{%s}")))))) - (eval . (keymap-local-set - "C-c C-t" - (lambda nil - (interactive) - (save-match-data - (let ((string (buffer-string)) - (pos 0) - (tag 0)) - (while (string-match "<>" string pos) - (setq tag (max tag - (string-to-number (match-string 1 string))) - pos (match-end 0))) - (insert "<>"))))))))) + ((eval . (load-file "startup.el"))))) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b8fcde3 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +all: pdf remove-tex +pdf: ; emacs code.org --batch -l startup.el -f org-latex-export-to-pdf +remove-tex: ; rm code.tex diff --git a/README.org b/README.org new file mode 100644 index 0000000..48ea87b --- /dev/null +++ b/README.org @@ -0,0 +1,9 @@ +#+TITLE: Chapter Code of Regulations + +* Generating PDFs +A PDF can be generated using the following command: +#+begin_src bash +guix shell -m manifest.scm -- make +#+end_src +Assuming that [[https://guix.gnu.org/][GNU Guix]] is installed, this command will handle downloading all +dependencies, generating a pdf, and cleaning up temporary files. diff --git a/manifest.scm b/manifest.scm new file mode 100644 index 0000000..cdfd137 --- /dev/null +++ b/manifest.scm @@ -0,0 +1,6 @@ +;; What follows is a "manifest" equivalent to the command line you gave. +;; You can store it in a file that you may then pass to any 'guix' command +;; that accepts a '--manifest' (or '-m') option. + +(specifications->manifest + (list "emacs-next" "texlive" "make" "git")) diff --git a/startup.el b/startup.el new file mode 100644 index 0000000..1b139ac --- /dev/null +++ b/startup.el @@ -0,0 +1,25 @@ +(require 'ox-latex) +(setq-local + org-latex-classes + '(("chapter-code" + "\\documentclass{chapter-code}" + ("\\chapter{%s}" . "\\chapter*{%s}") + ("\\section{%s}" . "\\section*{%s}")))) + +(setopt org-latex-hyperref-template " +\\hypersetup{\n pdfauthor={%a},\n pdftitle={%t},\n pdfkeywords={%k}, + pdfsubject={%d},\n pdfcreator={%c},\n pdflang={%L},\n colorlinks=true}\n") + +(keymap-local-set + "C-c t" + (lambda nil + (interactive) + (save-match-data + (let ((string (buffer-string)) + (pos 0) + (tag 0)) + (while (string-match "<>" string pos) + (setq tag (max tag + (string-to-number (match-string 1 string))) + pos (match-end 0))) + (insert "<>")))))