(TeX-add-style-hook "matyi" (lambda () ;; Run only the style hook for 'tcolorbox' (TeX-run-style-hooks "tcolorbox" "cleveref") ;; This is the library we want to use: (LaTeX-add-tcolorbox-tcbuselibraries "theorems") ;; Now load the library with the provided function: (LaTeX-tcolorbox-load-used-libraries) ;; These are the additional environments defined in 'matyi.sty': (LaTeX-add-tcolorbox-lib-theorems-newtcbtheorems "conj" "cor" "defn" "lem" "problem" "prop" "quest" "rem" "thm") ;; Add the envs to `LaTeX-label-alist': (let ((envs '(("conj" . "conj:") ("cor" . "cor:") ("defn" . "defn:") ("lem" . "lem:") ("problem" . "problem:") ("prop" . "prop:") ("quest" . "quest:") ("rem" . "rem:") ("thm" . "thm:")))) (dolist (env envs) (add-to-list 'LaTeX-label-alist env t))) ;; Also make them available to RefTeX: (when (fboundp 'reftex-add-label-environments) (reftex-add-label-environments '(("conj" ?c "conj:" "~\\cref{%s}" LaTeX-tcolorbox-lib-theorems-reftex-label-context-function nil) ("cor" ?C "cor:" "~\\cref{%s}" LaTeX-tcolorbox-lib-theorems-reftex-label-context-function nil) ("defn" ?d "defn:" "~\\cref{%s}" LaTeX-tcolorbox-lib-theorems-reftex-label-context-function (regexp "[Dd]efinitions?") nil) ("lem" ?l "lem:" "~\\cref{%s}" LaTeX-tcolorbox-lib-theorems-reftex-label-context-function (regexp "[Ll]emmas?") nil) ("problem" ?p "problem:" "~\\cref{%s}" LaTeX-tcolorbox-lib-theorems-reftex-label-context-function (regexp "[Pp]roblems?") nil) ("prop" ?P "prop:" "~\\cref{%s}" LaTeX-tcolorbox-lib-theorems-reftex-label-context-function nil) ("quest" ?q "quest:" "~\\cref{%s}" LaTeX-tcolorbox-lib-theorems-reftex-label-context-function nil) ("rem" ?r "rem:" "~\\cref{%s}" LaTeX-tcolorbox-lib-theorems-reftex-label-context-function nil) ("thm" ?T "thm:" "~\\cref{%s}" LaTeX-tcolorbox-lib-theorems-reftex-label-context-function (regexp "[Tt]heorems?") nil)))) ) :latex)