home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / packages / tex-complete.shar / README < prev    next >
Encoding:
Text File  |  1990-07-22  |  4.2 KB  |  141 lines

  1. TEX NAME COMPLETION:
  2.  
  3.     This package adds Emacs minibuffer name completion to cmutex.el
  4.     or the standard tex-mode.el.
  5.  
  6.     As a complement to the hairy key bindings for hairy LaTeX commands
  7.     in cmutex.el, here is a package that does not require you to learn
  8.     the key strokes for each command, but lets you enter the name of
  9.     the [La]TeX macro/environment with completion, avoiding dumb typos
  10.     that cost you a wasted TeX run.  This is very handy if you don't
  11.     remember the exact form of a command, font name, name for a
  12.     special symbol, and you don't have the manual or list of symbols
  13.     with you.
  14.  
  15.     A disadvantage is that is does not know anything about each
  16.     individual command (e.g., number of arguments).  But for these, we
  17.     have the specialized key bindings like 'C-c T' in cmutex.el.  They
  18.     are fine - if you can remember them... 
  19.  
  20.  
  21. CONTENTS: 
  22.  
  23.     There are 4 files:
  24.  
  25.     README            - this file
  26.  
  27.     tex-complete.el        - completion functions
  28.  
  29.     latex-names.el        - list of LaTeX macro names
  30.  
  31.     tex-names.el        - list of plain TeX macro names
  32.  
  33.  
  34. INSTALLATION: 
  35.  
  36.     Put all lisp files in a directory where Emacs can find them.  The
  37.     *-names files are loaded on the first use of the completion
  38.     commands.
  39.  
  40.     IF YOU USE THE STANDARD TEX MODE:
  41.  
  42.     Put the following lines into your ~/.emacs (note TeX-mode vs.
  43.     comint's tex-mode and the single key map for both modes): 
  44.  
  45.     (setq TeX-mode-hook 
  46.           '(lambda ()
  47.          (define-key TeX-mode-map
  48.            "\C-c\\" 'tex-insert-plain-command)))
  49.  
  50.     (setq LaTeX-mode-hook
  51.           '(lambda ()
  52.          (define-key TeX-mode-map
  53.            "\C-c\C-m" 'latex-make-environment)
  54.          (define-key TeX-mode-map
  55.            "\C-ci" 'latex-insert-begin)
  56.          (define-key TeX-mode-map
  57.            "\C-c\\" 'tex-insert-latex-command)))
  58.  
  59.     (load "tex-complete")
  60.  
  61.     IF YOU USE CMUTEX:
  62.  
  63.     Either arrange to load tex-complete *after* cmutex or put
  64.     cmutex-complete into cmutex.el, replacing the definitions of
  65.     latex-make-environment and latex-insert-begin.  Olin Shivers plans
  66.     to add a load hook to cmutex version 2.01, which makes this easy.
  67.  
  68.     If your version does not have this load hook already, simply add
  69.     the line
  70.  
  71.     (run-hooks 'cmutex-load-hook)
  72.  
  73.     at the very end of cmutex.el
  74.  
  75.     Then you can put the following in your ~/.emacs:
  76.  
  77.     (setq cmutex-load-hook '(lambda () (load "tex-complete")))
  78.  
  79.     ;; Bind the completion functions to appropriate keys 
  80.     ;; '\' may be even better than 'C-c \'
  81.  
  82.     (setq tex-mode-hook
  83.           '(lambda ()
  84.          (define-key tex-mode-map "\C-c\\"
  85.            'tex-insert-plain-command)))
  86.  
  87.     (setq latex-mode-hook
  88.           '(lambda ()
  89.          (define-key latex-mode-map "\C-c\\"
  90.            'tex-insert-latex-command)))
  91.  
  92.  
  93.  
  94. EXAMPLE
  95.  
  96.     Usage of name completion in an Emacs TeX/LaTeX buffer: 
  97.  
  98.     TeX:    Type 'C-\' and 'c e TAB RET' to insert '\centerline'
  99.         Type 'C-\' and 'h e TAB RET' to insert '\heartsuit'
  100.  
  101.     LaTeX:    Type 'C-\' and 'c e TAB RET' to insert '\centering'
  102.  
  103.         Type 'C-c C-m' and 'a b TAB RET' to make an
  104.         `abstract' environment
  105.  
  106.         Type 'C-c i' and 'a b TAB RET' to insert the beginning
  107.         of an `abstract' environment
  108.  
  109.  
  110. REMARKS:
  111.  
  112.     The macro names have been taken from the TeX sources of plain TeX
  113.     and LaTeX.  Macros defined in additional style files may be
  114.     missing.  In fact, I only added some letter commands.  If you
  115.     enlarge the list, please send me your version or the diffs.
  116.  
  117.     Even more useful would be a parser for .sty files to extract macro
  118.     and environment names intended to be visible outside.  This seems
  119.     impossible to me unless a standard syntax for declaring public
  120.     macros is used, e.g.
  121.  
  122.        %%!publiccommand{foo} % goes into list latex-<style>-commands
  123.        %%!publicenvironment{bar} % goes into list latex-<style>-environments
  124.  
  125.     Each .sty file would have an associated Emacs lisp variable
  126.     containing the public names, and by parsing the \documenstyle
  127.     options just these names would be loaded.  Comments about such a
  128.     declaration syntax (which could be useful for other [documentation]
  129.     purposes as well) are welcome.
  130.  
  131.  
  132. - Sebastian 20-Jun-1990 10:55
  133.  
  134. ---------------------------------------------------------------------
  135.     Sebastian Kremer,
  136.     Institute of Theoretical Physics, University of Cologne
  137.     F. R. of Germany
  138.     Internet: sk@thp.Uni-Koeln.DE
  139.     BITNET: AB027 at DK0RRZK0
  140.  
  141.