home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / gnu / emacs / help / 5348 < prev    next >
Encoding:
Text File  |  1993-01-12  |  4.3 KB  |  133 lines

  1. Xref: sparky gnu.emacs.help:5348 comp.text.tex:14889
  2. Path: sparky!uunet!dtix!darwin.sura.net!spool.mu.edu!agate!dog.ee.lbl.gov!network.ucsd.edu!sdcc12!sdcc15!am299bv
  3. From: am299bv@sdcc15.ucsd.edu (Ravinder Bhumbla)
  4. Newsgroups: gnu.emacs.help,comp.text.tex
  5. Subject: Re: Auc-tex: Previewing without running TeX first
  6. Message-ID: <43411@sdcc12.ucsd.edu>
  7. Date: 13 Jan 93 00:58:10 GMT
  8. References: <1ig0pbINNa7o@network.ucsd.edu> <1ing1mINNhab@network.ucsd.edu>
  9. Sender: news@sdcc12.ucsd.edu
  10. Reply-To: rbhumbla@ucsd.edu (Ravinder Bhumbla)
  11. Followup-To: gnu.emacs.help
  12. Organization: University of California, San Diego
  13. Lines: 116
  14. Nntp-Posting-Host: sdcc15.ucsd.edu
  15. In-reply-to: am299bv@sdcc15.ucsd.edu's message of 9 Jan 93 13:28:20
  16.  
  17. After my last posting about a way to preview the current buffer/master
  18. file in auc-tex without running TeX on the buffer first, I received
  19. two replies suggesting a more automatic way.  I tried the first one
  20. (which goes into the .emacs file) and not the second one (which is a
  21. patch to the tex-buf.el file) but they look very similar so either
  22. should work.
  23.  
  24. Ravi
  25. =-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=
  26.  
  27. --- suggestion 1 from: Kevin Humphreys ---
  28.  
  29. Try these in your .emacs...
  30. -----------
  31.  
  32. (setq LaTeX-mode-hook
  33.       (function
  34.        (lambda ()
  35.      (local-set-key "\C-c\C-p" 'my-TeX-preview)
  36.      (local-set-key "\C-c!" 'my-TeX-print)
  37. ;
  38. ; various other Auc-TeX specific bindings here.
  39. ;
  40. ) ))
  41.  
  42. (defun my-TeX-preview ()
  43.   (interactive)
  44.   (set-TeX-zap-file)
  45.   (TeX-preview)
  46. )
  47.  
  48. (defun my-TeX-print ()
  49.   (interactive)
  50.   (set-TeX-zap-file)
  51.   (TeX-print)
  52. )
  53.  
  54. (defun set-TeX-zap-file ()
  55.   (if (not TeX-zap-file)
  56.       (setq TeX-zap-file 
  57.         (substring buffer-file-name 0
  58.                (string-match ".[^.]*$" buffer-file-name)) ) )
  59. )
  60.  
  61. --- end of suggestion 1 ---
  62.  
  63. --- suggestion 2 from: Mark Utting <marku@cs.uq.oz.au> ---
  64.  
  65. A few months ago, I made the following patches to tex-buf.el to
  66. fix this problem (and similarly for printing before running TeX).
  67.  
  68. The version of tex-buf.el that I edited had the following header:
  69. ;;;* Last edited: Jul 22 14:28 1992 (krab)
  70. ;;;;;;;;;;;;;;;;;;;;;;;;;;; -*- Mode: Emacs-Lisp -*- ;;;;;;;;;;;;;;;;;;;;;;;;;;
  71. ;; 
  72. ;; tex-buf.el - Invoking TeX from an inferior shell
  73. ;; 
  74. ;; Copyright (C) 1991 Kresten Krab Thorup (krab@iesd.auc.dk).
  75. ;; 
  76. ;; This file is part of the AUC TeX package.
  77. ;; 
  78. ;; $Id: tex-buf.el,v 1.18 1992/09/09 20:55:42 amanda Exp $
  79. ;; Author          : Kresten Krab Thorup
  80. ;; Created On      : Thu May 30 23:57:16 1991
  81. ;; Last Modified By: Per Abrahamsen
  82.  
  83.  
  84. Here are the changes in diff -c format:
  85. *** tex-buf.orig.el     Thu Sep 10 06:55:42 1992
  86. --- tex-buf.el  Wed Oct 21 15:17:40 1992
  87. ***************
  88. *** 497,502 ****
  89. --- 497,509 ----
  90.            (buffer-file-name))
  91.         (setq TeX-original-file (buffer-file-name)))
  92.     
  93. +   ;; If TeX has not been run before, try previewing buffer-file-name
  94. +   ;;    (we should really check for a `%% Master:' clause too).
  95. +   (if (and (not TeX-zap-file)
  96. +          buffer-file-name)
  97. +       (setq TeX-zap-file (substring buffer-file-name 0
  98. +                               (string-match ".[^.]*$" buffer-file-name))))
  99.     (TeX-test-process)
  100.     
  101.   ;;; Find out what preview command to use
  102. ***************
  103. *** 536,541 ****
  104. --- 543,555 ----
  105.     
  106.     (TeX-test-process)
  107.     
  108. +   ;; If TeX has not been run before, try printing buffer-file-name
  109. +   ;;    (we should really check for a `%% Master:' clause too).
  110. +   (if (and (not TeX-zap-file)
  111. +            (buffer-file-name))
  112. +       (setq TeX-zap-file (substring (buffer-file-name) 0
  113. +                           (string-match ".[^.]*$" (buffer-file-name)))))
  114.     (let* (                             ; Ask for a printer
  115.          (tmp1 (if TeX-printer-name-alist
  116.                    (completing-read (concat "Printer: (default "
  117. ----------------------------------------------------------------------
  118.  
  119. Although these changes work on single file documents, they really
  120. should be extended to work on multi-file documents by searching for a
  121. %%Master: clause (this would best be done by reorganising some of the
  122. existing code to avoid duplication).  However, I hope that you will
  123. find them a useful starting point.  They are certainly better than
  124. having to type: ESC ESC (setq TeX-zap-file "filename") every time :-).
  125.  
  126. Mark.
  127.  
  128. --- end of second suggestion ---
  129. --
  130. Ravinder Bhumbla    rbhumbla@ucsd.edu    U. of California, San Diego
  131.