Add documentation for generating PDFs.

This commit is contained in:
Reily Siegel 2022-12-03 19:08:19 -05:00
parent 3c9294fa44
commit 095d7bbf75
Signed by untrusted user: 1114
GPG Key ID: 508A5AD0A50F88AF
5 changed files with 44 additions and 21 deletions

View File

@ -3,24 +3,4 @@
((org-mode ((org-mode
. .
((eval . (progn ((eval . (load-file "startup.el")))))
(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 "<<tag:\\([0-9]+\\)>>" string pos)
(setq tag (max tag
(string-to-number (match-string 1 string)))
pos (match-end 0)))
(insert "<<tag:" (number-to-string (1+ tag)) ">>")))))))))

3
Makefile Normal file
View File

@ -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

9
README.org Normal file
View File

@ -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.

6
manifest.scm Normal file
View File

@ -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"))

25
startup.el Normal file
View File

@ -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 "<<tag:\\([0-9]+\\)>>" string pos)
(setq tag (max tag
(string-to-number (match-string 1 string)))
pos (match-end 0)))
(insert "<<tag:" (number-to-string (1+ tag)) ">>")))))