Last active
April 19, 2019 15:37
-
-
Save mahito1594/966aead817a675a51e97e6d4b9ed6c07 to your computer and use it in GitHub Desktop.
My Emacs configure for YaTeX-mode, see http://mtino1594.hatenablog.com/entry/2019/04/07/200000
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa" . "https://melpa.org/packages/") t) | |
(package-initialize) | |
(unless package-archive-contents (package-refresh-contents)) | |
(unless (package-installed-p 'use-package) | |
(package-install 'use-package)) | |
(require 'use-package) | |
(use-package company | |
:ensure t | |
:hook (after-init . global-company-mode)) | |
(use-package flycheck | |
:ensure t | |
:hook (after-init . global-flycheck-mode)) | |
(use-package yatex | |
:ensure t | |
:preface | |
(defvar my-YaTeX-section-alist | |
'(("part" . 0) | |
("chapter" . 1) | |
("section" . 2) | |
("subsection" . 3) | |
("subsubsection" . 4) | |
("paragraph" . 5) | |
("subparagraph" . 6))) | |
(defvar my-YaTeX-metasection-list | |
'("documentclass" | |
"begin{document}" "end{document}" | |
"frontmatter" "mainmatter" "appendix" "backmatter")) | |
(defvar my-YaTeX-outline-regexp | |
(concat (regexp-quote "\\") | |
(regexp-opt (append my-YaTeX-metasection-list | |
(mapcar #'car my-YaTeX-section-alist)) | |
t))) | |
(defvar my-YaTeX-outline-promotion-headings | |
'("\\chapter" "\\section" "\\subsection" | |
"\\subsubsection" "\\paragraph" "\\subparagraph")) | |
(defun my-YaTeX-outline-level () | |
(if (looking-at my-YaTeX-outline-regexp) | |
(1+ (or (cdr (assoc (match-string 1) my-YaTeX-section-alist)) -1)) | |
1000)) | |
(defun my-YaTeX-with-outline () | |
(outline-minor-mode 1) | |
(setq-local outline-regexp my-YaTeX-outline-regexp) | |
(setq-local outline-level #'my-YaTeX-outline-level) | |
(setq-local outline-promotion-headings my-YaTeX-outline-promotion-headings)) | |
:init | |
(setq YaTeX-inhibit-prefix-letter t) | |
:mode (("\\.tex\\'" . yatex-mode) | |
("\\.sty\\'" . yatex-mode) | |
("\\.ltx\\'" . yatex-mode)) | |
:hook (yatex-mode . my-YaTeX-with-outline) | |
:defer t | |
:config | |
(setq YaTeX-kanji-code 4) ; 1 => SJIS, 2 => JIS, 3 => EUC, 4 => UTF8 | |
(setq YaTeX-use-AMS-LaTeX t) | |
(setq tex-command "latexmk")) | |
(use-package company-math | |
:ensure t | |
:demand t | |
:after (company yatex) | |
:config | |
(push 'company-math-symbols-latex company-backends) | |
(push 'company-latex-commands company-backends)) | |
(use-package flycheck-yatex | |
:ensure nil | |
;; Asume that you download flycheck-yatex in | |
;; `~/.emacs.d/site-lisp/'. | |
:load-path "site-lisp/flycheck-yatex" | |
:demand t | |
:after (flycheck yatex)) | |
(use-package reftex | |
:ensure nil | |
:hook (yatex-mode . reftex-mode) | |
:bind (:map reftex-mode-map | |
("C-c )" . nil) | |
("C-c (" . reftex-reference)) | |
:defer t | |
:custom | |
(reftex-ref-style-default-list '("Cleveref") "Use cref/Cref as default")) | |
(use-package outline-magic | |
:ensure t | |
:bind (:map outline-minor-mode-map | |
("C-<tab>" . outline-cycle) | |
("M-<left>" . outline-promote) | |
("M-<right>" . outline-demote) | |
("M-<up>" . outline-move-subtree-up) | |
("M-<down>" . outline-move-subtree-down)) | |
:demand t | |
:after (outline)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment