From 9008ef01381fa5d614e60f1f2766ae3f8dd4567f Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Tue, 16 Jan 2018 20:47:07 -0500 Subject: [PATCH] Add a yasnippet for an org homework header --- .emacs.d/init.el | 6 +++++- .emacs.d/snippets/org-mode/hwhead | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .emacs.d/snippets/org-mode/hwhead diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 5f228f6..e324d6f 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -176,7 +176,11 @@ (setq org-confirm-babel-evaluate nil) (add-to-list 'org-babel-load-languages '(dot . t)) - (add-to-list 'org-src-lang-modes '("dot" . graphviz-dot))) + (add-to-list 'org-src-lang-modes '("dot" . graphviz-dot)) + (defun org-insert-homework-header () + "" + (interactive) + (yas-expand-snippet (yas-lookup-snippet "Homework Header" 'org-mode)))) (use-package windmove :config diff --git a/.emacs.d/snippets/org-mode/hwhead b/.emacs.d/snippets/org-mode/hwhead new file mode 100644 index 0000000..ae8deee --- /dev/null +++ b/.emacs.d/snippets/org-mode/hwhead @@ -0,0 +1,17 @@ +# -*- mode: snippet -*- +# name: Homework Header +# key: hwhead +# -- + +#+Author: Adam Goldsmith +#+Title: ${1:title} +#+Date: `(format-time-string "%Y-%m-%d")` +#+LaTeX_HEADER: \newcommand{\class}{${2:class}} + +#+LATEX_CLASS_OPTIONS: [12pt] +#+OPTIONS: toc:nil num:nil ^:{} +#+LATEX_HEADER: \usepackage[margin=1in, nohead, nofoot]{geometry} +#+LATEX_HEADER: \makeatletter \def\@maketitle{{\noindent\@title} {\hfill\@author\unskip\strut\par} {\noindent\class\unskip\strut} {\hfill\@date\par \vspace{\baselineskip}}\makeatother} +#+LATEX_HEADER: \pagenumbering{gobble} + +$0 \ No newline at end of file