(require 'tex-site)
(require 'latex)
(require 'reftex)
(require 'reftex-vars)
(require 'latex-units)
(require 'font-latex)
(require 'latex-toolbar)
(remove-alist 'auto-mode-alist "\\.\\(?:sty\\|cls\\|bbl\\)\\'")
(remove-alist 'auto-mode-alist "\\.[tT]e[xX]\\'")
(remove-alist 'auto-mode-alist "\\.ltx\\'")
(add-to-list 'auto-mode-alist '("\\.\\(?:sty\\|cls\\|bbl\\)\\'" . LaTeX-mode))
(add-to-list 'auto-mode-alist '("\\.[tT]e[xX]\\'" . LaTeX-mode))
(add-to-list 'auto-mode-alist '("\\.ltx\\'" . LaTeX-mode))
(add-to-list 'auto-mode-alist '("\\.drv\\'" . LaTeX-mode))
(add-to-list 'auto-mode-alist '("\\.dtx\\'" . doctex-mode))
(defvar ispell-extra-args)
(defvar LaTeX-mode-map)
(defvar TeX-shell)
(setq
LaTeX-float nil
TeX-arg-cite-note-p t
TeX-arg-footnote-number-p t
TeX-arg-item-label-p nil
TeX-auto-parse-length 999999999
TeX-auto-private
(file-name-as-directory
(expand-file-name "documents/TeXauto" (getenv "HOME")))
TeX-auto-save t
TeX-debug-bad-boxes nil
TeX-macro-private
(file-name-as-directory
(expand-file-name "documents/TeX" (getenv "HOME")))
TeX-outline-extra nil
TeX-parse-self t
TeX-printer-default "Single Colour"
TeX-printer-list
'(("Duplex Colour" "dvips -f %s|lpr -PDuplex_Colour" "lpq -PDuplex_Colour")
("Single Colour" "dvips -f %s|lpr -PSingle_Colour" "lpq -PSingle_Colour")
("Duplex Grey" "dvips -f %s|lpr -PDuplex_Grey" "lpq -PDuplex_Grey")
("Single Grey" "dvips -f %s|lpr -PSingle_Grey" "lpq -PSingle_Grey")
("Photo" "dvips -f %s|lpr -PPhoto" "lpq -PPhoto")
("DL Envelope" "dvips -f %s|lpr -PDL_Envelope" "lpq -PDL_Envelope")))
(setq-default LaTeX-default-options "a4paper,12pt")
(setq-default TeX-master t)
(setq TeX-view-style '(("^a5$" "xdvi -thorough %d -paper a5")
("^landscape$" "xdvi -thorough %d -paper a4r -s 4")
("." "xdvi -thorough %d")))
(defun sds-word-count (start end)
"Count lines/words/characters from START to END.
Replacement for count-lines-region."
(interactive "r")
(let ((ost (syntax-table))
(nst (copy-syntax-table)))
(modify-syntax-entry ?_ "w" nst)
(modify-syntax-entry ?- "w" nst)
(save-excursion
(save-restriction
(narrow-to-region start end)
(goto-char (min start end))
(unwind-protect
(progn (set-syntax-table nst)
(message
"Region (%d to %d) has: %d lines; %d words; %d characters."
start end (count-lines start end)
(string-to-number (how-many "\\<"))
(- end start)))
(set-syntax-table ost))))))
(autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
(autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
(autoload 'reftex-citation "reftex-cite" "Make citation" nil)
(setq
reftex-default-label-alist-entries
'(Sideways AMSTeX amsmath endnotes fancybox floatfig longtable
picinpar rotating sidecap subfigure supertab wrapfig LaTeX)
reftex-enable-partial-scans t
reftex-extra-bindings t
reftex-guess-label-type t
reftex-initialize-temporary-buffers t
reftex-insert-label-flags '(t t)
reftex-keep-temporary-buffers t
reftex-label-alist
'((nil ?s nil nil nil ("Capital" "Cap." "Section" "Part") -3)
(nil ?e nil nil nil ("Equation" "Eq.") -3)
(nil ?t nil nil nil ("Table") -3)
(nil ?f nil nil nil ("Figure" "Illustration" "Ill.") -3)
(nil ?n nil nil nil ("Comment") -3)
(nil ?i nil nil nil ("Point") -3))
reftex-label-menu-flags '(t t t t t t t t)
reftex-plug-into-AUCTeX t
reftex-save-parse-info t
reftex-toc-follow-mode t
reftex-toc-include-labels t
reftex-use-multiple-selection-buffers t
reftex-vref-is-default t)
(define-key reftex-mode-map [(shift button=)]
'reftex-mouse-view-crossref)
(setq reftex-index-macros '(("\\ix{*}" "idx" ?x "" nil nil)
("\\nindex{*}" "name" ?n "" nil nil)
index))
(defun return-created-string ()
"Return a \"Created:\" string."
(let ((time (current-time-string)))
(concat "Created at: "
(substring time 0 20)
(nth 1 (current-time-zone))
" "
(substring time -4) " ")))
(defun sy-LaTeX-toolbar ()
(interactive)
(set-specifier left-toolbar-width (cons (current-buffer) 32))
(latex-toolbar-install))
(defun sy-LaTeX-mode-hook ()
(turn-on-auto-fill)
(setq TeX-shell "/bin/zsh")
(make-local-variable 'ispell-extra-args)
(push "-t" ispell-extra-args)
(turn-on-reftex)
(add-to-list 'TeX-command-list
'("xpdf" "xpdf %s.pdf" TeX-run-silent t nil))
(add-to-list 'TeX-command-list
'("gv" "gv %s.ps" TeX-run-silent t nil))
(add-to-list 'TeX-command-list
'("pdflatex" "pdflatex -interaction=nonstopmode %t"
TeX-run-command nil t))
(when (device-on-window-system-p)
(outl-mouse-minor-mode 1)
(local-set-key [(super hyper t)] #'sy-LaTeX-toolbar)))
(add-hook 'LaTeX-mode-hook #'sy-LaTeX-mode-hook 'append)
(setq LaTeX-section-hook
'(LaTeX-section-heading
LaTeX-section-title
LaTeX-section-toc
LaTeX-section-section
LaTeX-section-label))
(eval-after-load 'tex-info
(progn
(delq 'texinfo-mode TeX-modes)
(defalias 'texinfo-mode #'ignore)
(require 'texinfo)))
(set-face-parent 'texinfo-heading-face 'font-lock-function-name-face)
(setq texinfo-font-lock-keywords
`(("@\\([a-zA-Z]+\\|[^ \t\n]\\)" 1 font-lock-keyword-face) ("^\\*\\([^\n:]*\\)" 1 font-lock-function-name-face t) ("@\\(emph\\|i\\|sc\\){\\([^}]+\\)" 2 'italic)
("@\\(strong\\|b\\){\\([^}]+\\)" 2 'bold)
("@\\(kbd\\|key\\|url\\|uref\\){\\([^}]+\\)" 2 font-lock-string-face)
("@\\(file\\|email\\){\\([^}]+\\)" 2 font-lock-string-face keep)
("@\\(samp\\|code\\|var\\|math\\|env\\|command\\|option\\){\\([^}]+\\)"
2 font-lock-variable-name-face keep)
("@\\(cite\\|x?ref\\|pxref\\|dfn\\|inforef\\){\\([^}]+\\)"
2 font-lock-reference-face) ("@\\(anchor\\){\\([^}]+\\)" 2 font-lock-type-face)
("@\\(dmn\\|acronym\\|value\\){\\([^}]+\\)" 2 font-lock-builtin-face)
("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-keyword-face keep)
(,(concat "^@\\(" (regexp-opt (mapcar 'car texinfo-section-list) t)
"\\)\\(.*\n\\)") 3 texinfo-heading-face t)
("@c\\(omment\\)? \\(.*$\\)" 2 font-lock-comment-face)
("@node \\(.*$\\)" 1 font-lock-warning-face)
("^@[cfvkpt]index \\(.*$\\)" 1 font-lock-variable-name-face)))
(defun sy-texinfo-menu ()
(easy-menu-add texinfo-mode-menu))
(add-hook 'texinfo-mode-hook #'sy-texinfo-menu)
(add-hook 'texinfo-mode-hook #'font-lock-mode)
(message "LaTeX initialised")
Copyright © 2020 Steve Youngs
Verbatim copying and distribution is permitted in any medium,
providing this notice is preserved.
Last modified: Wed Apr 15 18:12:55 AEST 2020