From 3d262f89e04a76a78667a4fc692ae71e540b7566 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 10 Jun 2020 00:05:16 +0200 Subject: Enable inline LaTeX previews in Orgmode --- gui/conf/init.el | 11 +++++++++++ gui/emacs.nix | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/gui/conf/init.el b/gui/conf/init.el index dfc886d..a88f253 100644 --- a/gui/conf/init.el +++ b/gui/conf/init.el @@ -36,6 +36,7 @@ (set-face-attribute 'fixed-pitch nil :family "Iosevka") (set-face-attribute 'variable-pitch nil :family "Source Sans Pro" :height 1.1) +(load-library "custom-runtime-env") (load-library "akr-theme") (use-package doom-modeline @@ -93,6 +94,15 @@ (add-hook 'org-mode-hook 'visual-line-mode) +(setq org-format-latex-options (plist-put org-format-latex-options :scale 1.5)) +(evil-leader/set-key + "p" 'org-latex-preview) + +(use-package org-fragtog + :ensure t + :config + (add-hook 'org-mode-hook 'org-fragtog-mode)) + (custom-theme-set-faces 'user '(org-level-1 ((t (:family "Source Serif Pro" :weight regular :height 1.4 )))) @@ -172,6 +182,7 @@ 'org-babel-load-languages '((python . t) (shell . t) + (latex . t) (C . t))) (setq org-confirm-babel-evaluate nil) diff --git a/gui/emacs.nix b/gui/emacs.nix index 57fac2a..008f6a7 100644 --- a/gui/emacs.nix +++ b/gui/emacs.nix @@ -14,6 +14,28 @@ mv akr-theme.el $out/share/emacs/site-lisp/ ''; }; + + custom-runtime-env-el = let + tex = pkgs.texlive.combine { + inherit (pkgs.texlive) scheme-small dvipng; + }; + in pkgs.writeTextFile { + name = "custom-runtime-env.el"; + text = '' + (setenv "PATH" (concat (getenv "PATH") ":${tex}/bin")) + (add-to-list 'exec-path "${tex}/bin") + ''; + }; + + custom-runtime-env = pkgs.stdenv.mkDerivation { + name = "emacs-custom-runtime-env"; + phases = [ "installPhase" ]; + + installPhase = '' + mkdir -p $out/share/emacs/site-lisp + cp ${custom-runtime-env-el} $out/share/emacs/site-lisp/custom-runtime-env.el + ''; + }; in { enable = true; @@ -21,6 +43,7 @@ pdf-tools ] ++ [ akr-color-theme + custom-runtime-env ]; }; -- cgit v1.2.3