⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tex-mode.el

📁 早期freebsd实现
💻 EL
📖 第 1 页 / 共 2 页
字号:
;; TeX mode commands.;; Copyright (C) 1985, 1986 Free Software Foundation, Inc.;; Rewritten following contributions by William F. Schelter;; and Dick King (king@kestrel).;; Modified August 1986 by Stephen Gildea <mit-erl!gildea> and;; Michael Prange <mit-erl!prange> to add LaTeX support and enhance;; TeX-region.;; Added TeX-directory and reorganized somewhat  gildea 21 Nov 86;; This file is part of GNU Emacs.;; GNU Emacs is free software; you can redistribute it and/or modify;; it under the terms of the GNU General Public License as published by;; the Free Software Foundation; either version 1, or (at your option);; any later version.;; GNU Emacs is distributed in the hope that it will be useful,;; but WITHOUT ANY WARRANTY; without even the implied warranty of;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the;; GNU General Public License for more details.;; You should have received a copy of the GNU General Public License;; along with GNU Emacs; see the file COPYING.  If not, write to;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.;; Still to do:;;  Make TAB indent correctly for TeX code.  Then we can make linefeed;;  do something more useful.;;;;  Have spell understand TeX instead of assuming the entire world;;  uses nroff.;;;;  The code for finding matching $ needs to be fixed.(provide 'tex-mode)(defvar TeX-directory "/tmp/"  "*Directory in which to run TeX subjob.  Temporary files arecreated in this directory.")(defvar TeX-dvi-print-command "lpr -d"  "*Command string used by \\[TeX-print] to print a .dvi file.")(defvar TeX-show-queue-command "lpq"  "*Command string used by \\[TeX-show-print-queue] to show the print queuethat \\[TeX-print] put your job on.")(defvar TeX-default-mode 'plain-TeX-mode  "*Mode to enter for a new file when it can't be determined whetherthe file is plain TeX or LaTeX or what.")(defvar TeX-command nil  "The command to run TeX on a file.  The name of the file will be appendedto this string, separated by a space.")(defvar TeX-trailer nil  "String appended after the end of a region sent to TeX by \\[TeX-region].")(defvar TeX-start-of-header nil  "String used by \\[TeX-region] to delimit the start of the file's header.")(defvar TeX-end-of-header nil  "String used by \\[TeX-region] to delimit the end of the file's header.")(defvar TeX-shell-cd-command "cd"  "Command to give to shell running TeX to change directory.  The value ofTeX-directory will be appended to this, separated by a space.")(defvar TeX-zap-file nil  "Temporary file name used for text being sent as input to TeX.Should be a simple file name with no extension or directory specification.")(defvar TeX-mode-syntax-table nil  "Syntax table used while in TeX mode.")(defun TeX-define-common-keys (keymap)  "Define the keys that we want defined both in TeX-modeand in the TeX-shell."  (define-key keymap "\C-c\C-k" 'TeX-kill-job)  (define-key keymap "\C-c\C-l" 'TeX-recenter-output-buffer)  (define-key keymap "\C-c\C-q" 'TeX-show-print-queue)  (define-key keymap "\C-c\C-p" 'TeX-print)  )(defvar TeX-mode-map nil "Keymap for TeX mode")(if TeX-mode-map     nil  (setq TeX-mode-map (make-sparse-keymap))  (TeX-define-common-keys TeX-mode-map)  (define-key TeX-mode-map "\"" 'TeX-insert-quote)  (define-key TeX-mode-map "\n" 'TeX-terminate-paragraph)  (define-key TeX-mode-map "\e}" 'up-list)  (define-key TeX-mode-map "\e{" 'TeX-insert-braces)  (define-key TeX-mode-map "\C-c\C-r" 'TeX-region)  (define-key TeX-mode-map "\C-c\C-b" 'TeX-buffer)  (define-key TeX-mode-map "\C-c\C-f" 'TeX-close-LaTeX-block)  )(defvar TeX-shell-map nil  "Keymap for the TeX shell.  A shell-mode-map with a few additions");(fset 'TeX-mode 'tex-mode) 		;in loaddefs.;;; This would be a lot simpler if we just used a regexp search,;;; but then it would be too slow.(defun tex-mode ()  "Major mode for editing files of input for TeX or LaTeX.Trys to intuit whether this file is for plain TeX or LaTeX andcalls plain-tex-mode or latex-mode.  If it cannot be determined\(e.g., there are no commands in the file), the value ofTeX-default-mode is used."  (interactive)  (let (mode slash comment)    (save-excursion      (goto-char (point-min))      (while (and (setq slash (search-forward "\\" nil t))		  (setq comment (let ((search-end (point)))				  (save-excursion				    (beginning-of-line)				    (search-forward "%" search-end t))))))      (if (and slash (not comment))	  (setq mode (if (looking-at "documentstyle")			 'latex-mode		       'plain-tex-mode))))    (if mode (funcall mode)      (funcall TeX-default-mode))))(fset 'plain-TeX-mode 'plain-tex-mode)(fset 'LaTeX-mode 'latex-mode)(defun plain-tex-mode ()  "Major mode for editing files of input for plain TeX.Makes $ and } display the characters they match.Makes \" insert `` when it seems to be the beginning of a quotation,and '' when it appears to be the end; it inserts \" only after a \\.Use \\[TeX-region] to run TeX on the current region, plus a \"header\"copied from the top of the file (containing macro definitions, etc.),running TeX under a special subshell.  \\[TeX-buffer] does the whole buffer.\\[TeX-print] prints the .dvi file made by either of these.Use \\[validate-TeX-buffer] to check buffer for paragraphs containingmismatched $'s or braces.Special commands:\\{TeX-mode-map}Mode variables:TeX-directory	Directory in which to create temporary files for TeX jobs	run by \\[TeX-region] or \\[TeX-buffer].TeX-dvi-print-command	Command string used by \\[TeX-print] to print a .dvi file.TeX-show-queue-command	Command string used by \\[TeX-show-print-queue] to show the print	queue that \\[TeX-print] put your job on.Entering plain-TeX mode calls the value of text-mode-hook,then the value of TeX-mode-hook, and then the valueof plain-TeX-mode-hook."  (interactive)  (TeX-common-initialization)  (setq mode-name "TeX")  (setq major-mode 'plain-TeX-mode)  (setq TeX-command "tex")  (setq TeX-start-of-header "%**start of header")  (setq TeX-end-of-header "%**end of header")  (setq TeX-trailer "\\bye\n")  (run-hooks 'text-mode-hook 'TeX-mode-hook 'plain-TeX-mode-hook))(defun latex-mode ()  "Major mode for editing files of input for LaTeX.Makes $ and } display the characters they match.Makes \" insert `` when it seems to be the beginning of a quotation,and '' when it appears to be the end; it inserts \" only after a \\.Use \\[TeX-region] to run LaTeX on the current region, plus the preamblecopied from the top of the file (containing \\documentstyle, etc.),running LaTeX under a special subshell.  \\[TeX-buffer] does the whole buffer.\\[TeX-print] prints the .dvi file made by either of these.Use \\[validate-TeX-buffer] to check buffer for paragraphs containingmismatched $'s or braces.Special commands:\\{TeX-mode-map}Mode variables:TeX-directory	Directory in which to create temporary files for TeX jobs	run by \\[TeX-region] or \\[TeX-buffer].TeX-dvi-print-command	Command string used by \\[TeX-print] to print a .dvi file.TeX-show-queue-command	Command string used by \\[TeX-show-print-queue] to show the print	queue that \\[TeX-print] put your job on.Entering LaTeX mode calls the value of text-mode-hook,then the value of TeX-mode-hook, and then the valueof LaTeX-mode-hook."  (interactive)  (TeX-common-initialization)  (setq mode-name "LaTeX")  (setq major-mode 'LaTeX-mode)  (setq TeX-command "latex")  (setq TeX-start-of-header "\\documentstyle")  (setq TeX-end-of-header "\\begin{document}")  (setq TeX-trailer "\\end{document}\n")  (run-hooks 'text-mode-hook 'TeX-mode-hook 'LaTeX-mode-hook))(defun TeX-common-initialization ()  (kill-all-local-variables)  (use-local-map TeX-mode-map)  (setq local-abbrev-table text-mode-abbrev-table)  (if (null TeX-mode-syntax-table)      (progn	(setq TeX-mode-syntax-table (make-syntax-table))	(set-syntax-table TeX-mode-syntax-table)	(modify-syntax-entry ?\\ ".")	(modify-syntax-entry ?\f ">")	(modify-syntax-entry ?\n ">")	(modify-syntax-entry ?$ "$$")	(modify-syntax-entry ?% "<")	(modify-syntax-entry ?\" ".")	(modify-syntax-entry ?& ".")	(modify-syntax-entry ?_ ".")	(modify-syntax-entry ?@ "_")	(modify-syntax-entry ?~ " ")	(modify-syntax-entry ?' "w"))    (set-syntax-table TeX-mode-syntax-table))  (make-local-variable 'paragraph-start)  (setq paragraph-start "^[ \t]*$\\|^[\f\\\\%]")  (make-local-variable 'paragraph-separate)  (setq paragraph-separate paragraph-start)  (make-local-variable 'comment-start)  (setq comment-start "%")  (make-local-variable 'comment-start-skip)  (setq comment-start-skip "\\(\\(^\\|[^\\]\\)\\(\\\\\\\\\\)*\\)\\(%+ *\\)")  (make-local-variable 'comment-indent-hook)  (setq comment-indent-hook 'TeX-comment-indent)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -