pic support

This commit is contained in:
tavo-wasd 2024-07-03 12:38:11 -06:00
parent a1b5817889
commit 0e265a3794

View file

@ -223,6 +223,17 @@
(add-hook 'org-mode-hook
(lambda ()
(local-set-key (kbd "C-c e") 'insert-latex-equation)))
(defun org-babel-execute:pic (body params)
(let* ((tmpfile (org-babel-temp-file "pic-" ".png"))
(quoted-text (replace-regexp-in-string "'" "'\\\\''" body))
(body-with-v (replace-regexp-in-string "\\\\v" "VERTICAL" quoted-text))
(cmd (concat "echo '" body-with-v "' | preconv | sed \'s/VERTICAL/\\\\v/g\' | pic2graph -density 200 > " tmpfile)))
(shell-command cmd)
tmpfile))
(require 'ob)
(add-to-list 'org-babel-tangle-lang-exts '("pic" . "pic"))
;; ---
;; --- Keybinds ---