There’re some tips on the scheme way to customize your personal style of notes. I found it easier to work with in some situations but won’t advocate it over the .ts
file way in any sense. You decide how to organize your personal stuff.
It’s well known that TEXMACS_HOME_PATH/progs/my-init-buffer.scm
is evaluated when a buffer is being loaded. Suppose you wanna include in every NEW note files package smart-ref
and preview-ref
, assign some values like <assign|info-flag|detailed>
, and define some macros like <assign|ket|<macro|x||x<rangle>>>
. Here is how you can realize them in your my-init-buffer.scm
:
(define (my-style-list)
;; packages to include
'("preview-ref" "smart-ref"
))
(define (my-package-general)
;; some things to define in the preamble
'((assign "info-flag" "detailed")
))
(define (my-package-dirac)
;; some other things to be put in preamble, more organized
'((assign "bra" (macro "x" (concat "<langle>" (arg "x") "|")))
(assign "ket" (macro "x" (concat "|" (arg "x") "<rangle>")))
(assign "braket" (macro "x" "y"
(concat "<langle>" (arg "x") "|" (arg "y") "<rangle>")))
(assign "ketbra" (macro "x" "y"
(concat "|" (arg "x") "<rangle><langle>" (arg "y") "|")))
(assign "bok" (macro "left" "op" "right"
(concat "<langle>" (arg "left") "|" (arg "op") "|" (arg "right") "<rangle>")))))
(if (not (buffer-has-name? (current-buffer))) ; only execute when a buffer not linked to any file is created
(begin
(init-style "article") ; initial style to be `article'
(set-style-list (append (get-style-list) (my-style-list))) ; set the style list to include your prescribed packages
(with t (buffer-tree) ; put your stuff in the preamble
(tree-insert! t 0 `((hide-preamble (document
,@(my-package-general)
,@(my-package-dirac))))))
(buffer-pretend-saved (current-buffer))))