From b0e455ac126562bcae72a3ab569e77328777d20f Mon Sep 17 00:00:00 2001 From: J S Date: Fri, 27 Oct 2023 08:25:36 -0400 Subject: [PATCH] feat[ox-hugo]: Added settings specific to ox-hugo I added ox-hugo back in. Adjusted latex processor to lualatex. Created resume templat from mcdowellcv. Added anki-editor package --- config.el | 128 +++++++++++++++++-------------- config.org | 213 ++++++++++++++++++++++++++++++---------------------- init.el | 2 +- packages.el | 2 + 4 files changed, 196 insertions(+), 149 deletions(-) diff --git a/config.el b/config.el index 36fd659..b724f40 100644 --- a/config.el +++ b/config.el @@ -236,7 +236,7 @@ If nil it defaults to `split-string-default-separators', normally (after! org-mode (setq org-log-done 'time) (setq org-archive-location "~/org/archive.org") - (add-to-list 'org-tags-exclude-from-inheritance 'hastodos) + (add-to-list 'org-tags-exclude-from-inheritance "hastodos") (setq org-hide-emphasis-markers nil)) (setq org-directory "~/org/") @@ -248,36 +248,67 @@ If nil it defaults to `split-string-default-separators', normally ;; Show images after evaluating code blocks. (add-hook 'org-babel-after-execute-hook 'org-display-inline-images) +(use-package! org-drill + :defer nil + ) + + (map! :leader + :desc "Start org-drill" + "d d" #'org-drill-directory) + + (map! :leader + :desc "Start org-drill in cram mode" + "d c" #'org-drill-cram) + +(use-package! ob-lilypond) +(setq ly-arrange-mode t) + +(use-package! org-edna) +(org-edna-mode) + +(use-package org-habit + :custom + (org-habit-graph-column 1) + (org-habit-preceding-days 10) + (org-habit-following-days 1) + (org-habit-show-habits-only-for-today nil)) + +(use-package! org-heatmap + :after (org) + :config + (org-heatmap-mode)) + +(setq templates/post-capture-props "#+date: [%<%Y-%m-%d %a>]\n#+lastmod:\n#+categories[]:\n#+tags[]:\n#+images[]: ") +(setq templates/post-capture-title "#+TITLE: ${title}\n") +(setq templates/post-capture-template (concat templates/post-capture-title templates/post-capture-props)) + +(setq org-preview-latex-image-directory (concat org-directory (file-name-as-directory "images/latexsnip"))) + +(setq org-hugo-base-dir (concat org-directory (file-name-as-directory "website"))) +(setq org-hugo-default-section-directory "posts") + (after! org ;; Import ox-latex to get org-latex-classes and other funcitonality ;; for exporting to LaTeX from org (use-package! ox-latex :init - ;; code here will run immediately :config - ;; code here will run after the package is loaded - (setq org-latex-pdf-process - '("pdflatex -interaction nonstopmode -output-directory %o %f" - "bibtex %b" - "pdflatex -interaction nonstopmode -output-directory %o %f" - "pdflatex -interaction nonstopmode -output-directory %o %f")) + (setq org-latex-with-hyperref nil) ;; stop org adding hypersetup{author..} to latex export ;; (setq org-latex-prefer-user-labels t) - - ;; deleted unwanted file extensions after latexMK (setq org-latex-logfiles-extensions (quote ("lof" "lot" "tex~" "aux" "idx" "log" "out" "toc" "nav" "snm" "vrb" "dvi" "fdb_latexmk" "blg" "brf" "fls" "entoc" "ps" "spl" "bbl" "xmpi" "run.xml" "bcf" "acn" "acr" "alg" "glg" "gls" "ist"))) (unless (boundp 'org-latex-classes) (setq org-latex-classes nil)))) -(setq org-latex-to-pdf-process - '("xelatex -interaction nonstopmode %f" - "xelatex -interaction nonstopmode %f")) ;; for multiple passes +(after! ox-latex + (setq org-latex-pdf-process + '("lualatex --output-directory=/home/user/Documents -shell-escape -interaction nonstopmode %f" + "lualatex --output-directory=/home/user/Documents -shell-escape -interaction nonstopmode %f")) + ) (setq-default org-html-with-latex `dvisvgm) -(setq org-latex-pdf-process - '("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f")) @@ -301,7 +332,7 @@ If nil it defaults to `split-string-default-separators', normally \\usepackage{marvosym} \\usepackage{wasysym} \\usepackage{amssymb} - \\usepackage{hyperref} + \\usepackage[hidelinks]{hyperref} \\usepackage{mathpazo} \\usepackage{color} \\usepackage{enumerate} @@ -337,7 +368,7 @@ If nil it defaults to `split-string-default-separators', normally \\usepackage{marvosym} \\usepackage{wasysym} \\usepackage{amssymb} - \\usepackage{hyperref} + \\usepackage[hidelinks]{hyperref} \\usepackage{mathpazo} \\usepackage{color} \\usepackage{enumerate} @@ -401,38 +432,6 @@ If nil it defaults to `split-string-default-separators', normally :desc "Export to html and diplay with eww" "r E" #'org-export-and-open-eww) -(use-package! org-drill - :defer nil - ) - - (map! :leader - :desc "Start org-drill" - "d d" #'org-drill-directory) - - (map! :leader - :desc "Start org-drill in cram mode" - "d c" #'org-drill-cram) - -(use-package! ob-lilypond) -(setq ly-arrange-mode t) - -(use-package! org-edna) -(org-edna-mode) - -(use-package org-habit - :custom - (org-habit-graph-column 1) - (org-habit-preceding-days 10) - (org-habit-following-days 1) - (org-habit-show-habits-only-for-today nil)) - -(use-package! org-heatmap - :after (org) - :config - (org-heatmap-mode)) - -(setq org-hugo-base-dir "~/org/website/") - (use-package! citar :ensure t :demand t @@ -468,7 +467,9 @@ If nil it defaults to `split-string-default-separators', normally (add-to-list 'org-latex-classes '("student-turabian" - "\\documentclass{turabian-researchpaper}" + "\\documentclass{turabian-researchpaper} +[NO-DEFAULT-PACKAGES] +[NO-PACKAGES]" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") @@ -486,7 +487,6 @@ If nil it defaults to `split-string-default-separators', normally ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) ;; org-latex-compilers = ("pdflatex" "xelatex" "lualatex"), which are the possible values for %latex -(setq org-latex-pdf-process '("LC_ALL=en_US.UTF-8 latexmk -f -pdf -%latex -shell-escape -interaction=nonstopmode -output-directory=%o %f" )) (use-package! engrave-faces) (setq org-latex-listings 'engraved) @@ -499,7 +499,7 @@ If nil it defaults to `split-string-default-separators', normally :ensure t :custom (setq org-roam-capture-templates - '( + `( ("d" "default" plain "%?" :target (file+head "%<%Y%m%d-%H%M%S>.org" "#+TITLE: ${title}\n#+HTML_HEAD: \n") @@ -524,10 +524,9 @@ If nil it defaults to `split-string-default-separators', normally "#+TITLE: ${title}\n#+FILETAGS: :secure:noexport:\n#+HTML_HEAD: \n\n\n* No Export Below This Line") :unnarrowed t) - ("w" "website" plain "%?" - :target (file+head "website/org/%<%Y%m%d-%H%M%S>.org" - "#+TITLE: ${title}\n") - :unnarrowed t)))) + ("w" "website post" plain "%?" + :target (file+head "~/org/website/content/posts/${title}.org" ,templates/post-capture-template) + :unnarrowed t)))) (after! org-roam (map! :leader (:prefix ("r" . "roam") @@ -685,6 +684,21 @@ Adding up values for one key is supported." ("\\cvsection{%s}" . "\\cvsection*{%s}") ("\\cvevent{%s}" . "\\cvevent*{%s}"))) +(add-to-list 'org-latex-classes + '("mcdowellcv" + "\\documentclass[]{mcdowellcv} + \\usepackage{amsmath} + \\usepackage[]{multicol} + [NO-DEFAULT-PACKAGES] + [NO-PACKAGES]" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}") + ("\\cvsection{%s}" . "\\cvsection*{%s}") + ("\\cvevent{%s}" . "\\cvevent*{%s}"))) + (map! :n "g j" #'evil-next-visual-line) (map! :n "g k" #'evil-previous-visual-line) @@ -692,8 +706,6 @@ Adding up values for one key is supported." (setq company-idle-delay nil)) (setq company-idle-delay nil) -(require 'zmq) - (use-package! exec-path-from-shell) (after! exec-path-from-shell (dolist (var '("SSH_AUTH_SOCK" "SSH_AGENT_PID" "GPG_AGENT_INFO")) diff --git a/config.org b/config.org index 60e3c0f..73b1016 100644 --- a/config.org +++ b/config.org @@ -87,6 +87,7 @@ I like to have a shortcut for calc as well, for simpler calculations "C" #'calc) #+END_SRC * Beancount +** FavaGTK :outdated: I want to launch favagtk more easily. Let's do that here: #+BEGIN_SRC emacs-lisp (defun fava () @@ -342,7 +343,7 @@ If nil it defaults to `split-string-default-separators', normally (after! org-mode (setq org-log-done 'time) (setq org-archive-location "~/org/archive.org") - (add-to-list 'org-tags-exclude-from-inheritance 'hastodos) + (add-to-list 'org-tags-exclude-from-inheritance "hastodos") (setq org-hide-emphasis-markers nil)) (setq org-directory "~/org/") @@ -402,25 +403,82 @@ We want to show images when loading a file, and also after evaluating code block ;; Show images after evaluating code blocks. (add-hook 'org-babel-after-execute-hook 'org-display-inline-images) #+END_SRC +** Org-drill +Set some good keybinds for quick access: +#+BEGIN_SRC emacs-lisp +(use-package! org-drill + :defer nil + ) + + (map! :leader + :desc "Start org-drill" + "d d" #'org-drill-directory) + + (map! :leader + :desc "Start org-drill in cram mode" + "d c" #'org-drill-cram) +#+END_SRC +** ob-lilypond +#+BEGIN_SRC emacs-lisp +(use-package! ob-lilypond) +(setq ly-arrange-mode t) +#+END_SRC +** org-edna +Edna allows better dependency handling for todos and the like. + +#+BEGIN_SRC emacs-lisp +(use-package! org-edna) +(org-edna-mode) +#+END_SRC +** Org-habit +#+BEGIN_SRC emacs-lisp + + (use-package org-habit + :custom + (org-habit-graph-column 1) + (org-habit-preceding-days 10) + (org-habit-following-days 1) + (org-habit-show-habits-only-for-today nil)) + + (use-package! org-heatmap + :after (org) + :config + (org-heatmap-mode)) +#+END_SRC + + +* Website +** Capture template +#+BEGIN_SRC emacs-lisp +(setq templates/post-capture-props "#+date: [%<%Y-%m-%d %a>]\n#+lastmod:\n#+categories[]:\n#+tags[]:\n#+images[]: ") +(setq templates/post-capture-title "#+TITLE: ${title}\n") +(setq templates/post-capture-template (concat templates/post-capture-title templates/post-capture-props)) +#+END_SRC +** Images +#+BEGIN_SRC emacs-lisp +(setq org-preview-latex-image-directory (concat org-directory (file-name-as-directory "images/latexsnip"))) +#+END_SRC +** Hugo base directory +#+BEGIN_SRC emacs-lisp +(setq org-hugo-base-dir (concat org-directory (file-name-as-directory "website"))) +(setq org-hugo-default-section-directory "posts") +#+END_SRC + +* Crafting a Writing Environment +For writing I like to automate as much as possible. +This means creating an environment that does citations and such /for/ me. ** Export settings +*** Ox-latex #+BEGIN_SRC emacs-lisp (after! org ;; Import ox-latex to get org-latex-classes and other funcitonality ;; for exporting to LaTeX from org (use-package! ox-latex :init - ;; code here will run immediately :config - ;; code here will run after the package is loaded - (setq org-latex-pdf-process - '("pdflatex -interaction nonstopmode -output-directory %o %f" - "bibtex %b" - "pdflatex -interaction nonstopmode -output-directory %o %f" - "pdflatex -interaction nonstopmode -output-directory %o %f")) + (setq org-latex-with-hyperref nil) ;; stop org adding hypersetup{author..} to latex export ;; (setq org-latex-prefer-user-labels t) - - ;; deleted unwanted file extensions after latexMK (setq org-latex-logfiles-extensions (quote ("lof" "lot" "tex~" "aux" "idx" "log" "out" "toc" "nav" "snm" "vrb" "dvi" "fdb_latexmk" "blg" "brf" "fls" "entoc" "ps" "spl" "bbl" "xmpi" "run.xml" "bcf" "acn" "acr" "alg" "glg" "gls" "ist"))) @@ -428,14 +486,23 @@ We want to show images when loading a file, and also after evaluating code block (setq org-latex-classes nil)))) #+END_SRC +*** Lualatex as PDF Processor +I've found that lualatex does a good job processing PDFs. $hi$ #+BEGIN_SRC emacs-lisp -(setq org-latex-to-pdf-process - '("xelatex -interaction nonstopmode %f" - "xelatex -interaction nonstopmode %f")) ;; for multiple passes +(after! ox-latex + (setq org-latex-pdf-process + '("lualatex --output-directory=/home/user/Documents -shell-escape -interaction nonstopmode %f" + "lualatex --output-directory=/home/user/Documents -shell-escape -interaction nonstopmode %f")) + ) +#+END_SRC + +$x + 1 = 3$ +#+RESULTS: +: luamagick + +#+BEGIN_SRC emacs-lisp (setq-default org-html-with-latex `dvisvgm) -(setq org-latex-pdf-process - '("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f")) @@ -459,7 +526,7 @@ We want to show images when loading a file, and also after evaluating code block \\usepackage{marvosym} \\usepackage{wasysym} \\usepackage{amssymb} - \\usepackage{hyperref} + \\usepackage[hidelinks]{hyperref} \\usepackage{mathpazo} \\usepackage{color} \\usepackage{enumerate} @@ -495,7 +562,7 @@ We want to show images when loading a file, and also after evaluating code block \\usepackage{marvosym} \\usepackage{wasysym} \\usepackage{amssymb} - \\usepackage{hyperref} + \\usepackage[hidelinks]{hyperref} \\usepackage{mathpazo} \\usepackage{color} \\usepackage{enumerate} @@ -526,6 +593,10 @@ We want to show images when loading a file, and also after evaluating code block ("\\subsection{%s}" . "\\subsection*{%s}"))) #+END_SRC + +#+RESULTS: +| mcdowellcv | \documentclass[]{mcdowellcv} | + *** Fixing dvipng image handling #+BEGIN_SRC emacs-lisp @@ -571,59 +642,6 @@ We'll want a handy shortcut for this. #+RESULTS: : /home/user/.config/doom/ -** Org-drill -Set some good keybinds for quick access: -#+BEGIN_SRC emacs-lisp -(use-package! org-drill - :defer nil - ) - - (map! :leader - :desc "Start org-drill" - "d d" #'org-drill-directory) - - (map! :leader - :desc "Start org-drill in cram mode" - "d c" #'org-drill-cram) -#+END_SRC -** ob-lilypond -#+BEGIN_SRC emacs-lisp -(use-package! ob-lilypond) -(setq ly-arrange-mode t) -#+END_SRC -** org-edna -Edna allows better dependency handling for todos and the like. - -#+BEGIN_SRC emacs-lisp -(use-package! org-edna) -(org-edna-mode) -#+END_SRC -** Org-habit -#+BEGIN_SRC emacs-lisp - - (use-package org-habit - :custom - (org-habit-graph-column 1) - (org-habit-preceding-days 10) - (org-habit-following-days 1) - (org-habit-show-habits-only-for-today nil)) - - (use-package! org-heatmap - :after (org) - :config - (org-heatmap-mode)) -#+END_SRC - - - -* Ox-hugo -#+BEGIN_SRC emacs-lisp -(setq org-hugo-base-dir "~/org/website/") -#+END_SRC - -* Crafting a Writing Environment -For writing I like to automate as much as possible. -This means creating an environment that does citations and such /for/ me. ** Automatic Citations with *citar* and *org-cite* Citar is a sweet little package for managing citations. Right here we'll set it up We want a general bibliography file, a styles directory, and a default set of styles. @@ -668,7 +686,9 @@ Let's use a package or two to set a decent document class: (add-to-list 'org-latex-classes '("student-turabian" - "\\documentclass{turabian-researchpaper}" + "\\documentclass{turabian-researchpaper} +[NO-DEFAULT-PACKAGES] +[NO-PACKAGES]" ("\\section{%s}" . "\\section*{%s}") ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") @@ -686,7 +706,6 @@ Let's use a package or two to set a decent document class: ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) ;; org-latex-compilers = ("pdflatex" "xelatex" "lualatex"), which are the possible values for %latex -(setq org-latex-pdf-process '("LC_ALL=en_US.UTF-8 latexmk -f -pdf -%latex -shell-escape -interaction=nonstopmode -output-directory=%o %f" )) #+END_SRC *** Engraving Faces @@ -708,7 +727,7 @@ Org-roam enables features essential to a Zettelkasten such as inter-ID linking. :ensure t :custom (setq org-roam-capture-templates - '( + `( ("d" "default" plain "%?" :target (file+head "%<%Y%m%d-%H%M%S>.org" "#+TITLE: ${title}\n#+HTML_HEAD: \n") @@ -717,15 +736,15 @@ Org-roam enables features essential to a Zettelkasten such as inter-ID linking. ("s" "school" plain "%?" :target (file+head "%<%Y%m%d-%H%M%S>.org" "#+TITLE: ${title} -#+LATEX_CLASS: student-apa7 -#+LATEX_OPTIONS: stu,hidelinks -#+LATEX_HEADER: \\course{} -#+LATEX_HEADER:\\authorsnames{Judah Sotomayor} -#+LATEX_HEADER: \\authorsaffiliations{} -#+LATEX_HEADER: \\professor{} -#+LATEX_HEADER: \\usepackage{times} -#+LATEX_HEADER: \\duedate{} -#+OPTIONS: toc:nil\n") +,#+LATEX_CLASS: student-apa7 +,#+LATEX_OPTIONS: stu,hidelinks +,#+LATEX_HEADER: \\course{} +,#+LATEX_HEADER:\\authorsnames{Judah Sotomayor} +,#+LATEX_HEADER: \\authorsaffiliations{} +,#+LATEX_HEADER: \\professor{} +,#+LATEX_HEADER: \\usepackage{times} +,#+LATEX_HEADER: \\duedate{} +,#+OPTIONS: toc:nil\n") :unnarrowed t) ("c" "encrypted" plain "%?" @@ -733,10 +752,9 @@ Org-roam enables features essential to a Zettelkasten such as inter-ID linking. "#+TITLE: ${title}\n#+FILETAGS: :secure:noexport:\n#+HTML_HEAD: \n\n\n* No Export Below This Line") :unnarrowed t) - ("w" "website" plain "%?" - :target (file+head "website/org/%<%Y%m%d-%H%M%S>.org" - "#+TITLE: ${title}\n") - :unnarrowed t)))) + ("w" "website post" plain "%?" + :target (file+head "~/org/website/content/posts/${title}.org" ,templates/post-capture-template) + :unnarrowed t)))) #+END_SRC *** Keybinds @@ -920,6 +938,25 @@ I want to be able to ignore headings on export. ("\\cvsection{%s}" . "\\cvsection*{%s}") ("\\cvevent{%s}" . "\\cvevent*{%s}"))) #+END_SRC +*** McDowell Resume Template +This template is supposed to be the standard. +#+BEGIN_SRC emacs-lisp +(add-to-list 'org-latex-classes + '("mcdowellcv" + "\\documentclass[]{mcdowellcv} + \\usepackage{amsmath} + \\usepackage[]{multicol} + [NO-DEFAULT-PACKAGES] + [NO-PACKAGES]" + ("\\section{%s}" . "\\section*{%s}") + ("\\subsection{%s}" . "\\subsection*{%s}") + ("\\subsubsection{%s}" . "\\subsubsection*{%s}") + ("\\paragraph{%s}" . "\\paragraph*{%s}") + ("\\subparagraph{%s}" . "\\subparagraph*{%s}") + ("\\cvsection{%s}" . "\\cvsection*{%s}") + ("\\cvevent{%s}" . "\\cvevent*{%s}"))) + +#+END_SRC ** Better EViL keybinds *** Remapping =g-j/k= #+BEGIN_SRC emacs-lisp @@ -938,10 +975,6 @@ I want VIM-like autocompletion, where =C-x o= and friends gives me my autocomple -* Test -#+BEGIN_SRC emacs-lisp -(require 'zmq) -#+END_SRC * Initializing shell environment variables #+BEGIN_SRC emacs-lisp (use-package! exec-path-from-shell) diff --git a/init.el b/init.el index f7e2a85..858e9cd 100644 --- a/init.el +++ b/init.el @@ -148,7 +148,7 @@ (latex +lsp +cdlatex +fold) ; writing papers in Emacs has never been so fun ;;lean ; for folks with too much to prove ;;ledger ; be audit you can be - ;;lua ; one-based indices? one-based indices + lua ; one-based indices? one-based indices markdown ; writing docs for people to ignore ;;nim ; python + lisp at the speed of c ;;nix ; I hereby declare "nix geht mehr!" diff --git a/packages.el b/packages.el index a8f7448..5c208ca 100644 --- a/packages.el +++ b/packages.el @@ -77,3 +77,5 @@ :recipe (:host github :type git :repo "aspiers/org-heatmap")) (package! exec-path-from-shell) +(package! anki-editor) +(package! calfw)