[comp.text.tex] xdvi in emacs

boris@math10.uni-bielefeld.de (Boris Hemkemeier) (05/16/91)

There is a nice feature in an X-window environment. If you are TeXing a
text in emacs using TeX-mode and its commands like `TeX-buffer', you can
get a preview with an emacs command. You have only to set the variable
`TeX-dvi-print-command' to "xdvi". Then C-c C-p (`TeX-print') will produce
a preview of the current buffer.

Boris
-- 

	Boris Hemkemeier:	boris@math10.uni-bielefeld.de

bob@MorningStar.Com (Bob Sutterfield) (05/21/91)

In article <1991May16.152416.17303@unibi.uni-bielefeld.de> boris@math10.uni-bielefeld.de (Boris Hemkemeier) writes:
   ...you can get a [document] preview [on your X] with an emacs
   command.  You have only to set the variable `TeX-dvi-print-command'
   to "xdvi"...

I prefer to have <whatever>-print-command actually put the document on
paper, and use compile-command for the previewer.

adrianho@barkley.berkeley.edu (Adrian J Ho) (05/21/91)

In article <BOB.91May20162839@volitans.MorningStar.Com> bob@MorningStar.Com (Bob Sutterfield) writes:
>I prefer to have <whatever>-print-command actually put the document on
>paper, and use compile-command for the previewer.

Why not have _both_?  All you have to do is edit tex-mode.el, copy the
code for (TeX-print) to, say, (TeX-preview), change all references to
TeX-dvi-print-command in the function to, say,
TeX-dvi-preview-command, and add the variable TeX-dvi-preview-command
in the same style as TeX-dvi-print-command.  You could even go as far
as binding a key sequence to TeX-preview -- look for the (define-key)
that binds TeX-print and Do The Right Thing.

If you really want to be thorough, change the help text for
(latex-mode) and (tex-mode) in loaddefs.el to include (TeX-preview).

Isn't Emacs _great_?  8-)

ppalmer@oskar.uchicago.edu (Patrick Palmer) (05/21/91)

In article <ADRIANHO.91May20162413@barkley.berkeley.edu> adrianho@barkley.berkeley.edu (Adrian J Ho) writes:
>In article <BOB.91May20162839@volitans.MorningStar.Com> bob@MorningStar.Com (Bob Sutterfield) writes:
>>I prefer to have <whatever>-print-command actually put the document on
>>paper, and use compile-command for the previewer.
>
>Why not have _both_?  All you have to do is edit tex-mode.el, copy the
>code for (TeX-print) to, say, (TeX-preview), change all references to
> ....
>Isn't Emacs _great_?  8-)

If you run xdvi from the TeX shell, can you run it in the background
so that you can let it stay active as you revise the file?  I don't
see how myself.  If not, isn't it easier to run xdvi from another
window so that you immediately see the revised .dvi file without
having to start xdvi again?  (That is one of the nice things about
xdvi - it knows when the dvi file changes and redisplays it
automatically.)  But, I don't understand the TeX shell, and am always
searching for enlightenment about it.

Pat Palmer (email: ppalmer@oskar.uchicago.edu)

kitagawa@will.ntt.jp (Masahiro Kitagawa) (05/21/91)

In article <ADRIANHO.91May20162413@barkley.berkeley.edu> adrianho@barkley.berkeley.edu (Adrian J Ho) writes:

 |Why not have _both_?  All you have to do is edit tex-mode.el,

cmutex.el already has both. Namely,

  (define-key keymap "\C-c\C-p" 'tex-print)
  (define-key keymap "\C-cP" 'tex-view-file)

 |Isn't Emacs _great_?  8-)

Yes, GNU Emacs is real GREAT !

*--- **** ***-- *--* *-* *-*
Masahiro Kitagawa			"Against all odds"
NTT Research Labs. Tokyo Japan
kitagawa@will.ntt.jp

grunwald@foobar.colorado.edu (Dirk Grunwald) (05/21/91)

>>>>> On 21 May 91 04:54:16 GMT, ppalmer@oskar.uchicago.edu (Patrick Palmer) said:

PP> having to start xdvi again?  (That is one of the nice things about
PP> xdvi - it knows when the dvi file changes and redisplays it
PP> automatically.)  But, I don't understand the TeX shell, and am always
--

doesn't this cause problems when the dvi file is only 1/2 finished?

krab@iesd.auc.dk (Kresten Krab Thorup) (05/23/91)

>>>>> On 21 May 91 00:24:13 GMT, adrianho@barkley.berkeley.edu (Adrian J Ho) said:

Adrian> In article <BOB.91May20162839@volitans.MorningStar.Com> bob@MorningStar.Com (Bob Sutterfield) writes:
>I prefer to have <whatever>-print-command actually put the document on
>paper, and use compile-command for the previewer.

Adrian> Why not have _both_?  All you have to do is edit tex-mode.el, copy the
Adrian> code for (TeX-print) to, say, (TeX-preview), change all references to
Adrian> TeX-dvi-print-command in the function to, say,
Adrian> TeX-dvi-preview-command, and add the variable TeX-dvi-preview-command
Adrian> in the same style as TeX-dvi-print-command.  You could even go as far
Adrian> as binding a key sequence to TeX-preview -- look for the (define-key)
Adrian> that binds TeX-print and Do The Right Thing.

Adrian> If you really want to be thorough, change the help text for
Adrian> (latex-mode) and (tex-mode) in loaddefs.el to include (TeX-preview).

If anyone is Interested, I've made a much enchanced LaTeX mode for
Emacs.  The features discussed here concerning the ability to run both
a printer driver and a previewer are there.  Also BibTeX and Makeindex
are bound to seperate keys.

But thats not all.  I've also made a parser, for the (La)TeX output,
so that the errors may be parsed.  That means, pressing C-c C-n
(TeX-next-error), will move the cursor to the file and position of the
given error.
	Using this feature all errormessages are documented - online.
I got most of this documentation from Leslie.

The distribution package comes with a minor-outline-mode, an
outlinemode that can run under LaTeX mode.

Other features:

	Intelligent macros for often used controlsequences like
	\section{ ... } and anvironments.

	Indentation by environments

Well.. You may pick it up by anonymous ftp to 

	iesd.auc.dk  : pub/emacs-lisp/auc-tex.shar 

the files are also available individually in the files:

	auc-tex.el
	outline-m.el
	minor-map.el

Happy LaTeX'in!

/Kresten

Adrian> Isn't Emacs _great_?  8-)

Sure.

kolb@kub.nl (Hans-Peter Kolb) (05/24/91)

In article <KRAB.91May23042639@cartan.iesd.auc.dk>, krab@iesd.auc.dk (Kresten Krab Thorup) writes:
|> If anyone is Interested, I've made a much enchanced LaTeX mode for
|> Emacs.  The features discussed here concerning the ability to run both
|> a printer driver and a previewer are there.  Also BibTeX and Makeindex
|> are bound to seperate keys.
|> 
|> But thats not all.  I've also made a parser, for the (La)TeX output,
|> so that the errors may be parsed.  That means, pressing C-c C-n
|> (TeX-next-error), will move the cursor to the file and position of the
|> given error.
|> 	Using this feature all errormessages are documented - online.
|> I got most of this documentation from Leslie.
|> 
|> The distribution package comes with a minor-outline-mode, an
|> outlinemode that can run under LaTeX mode.
|> 
|> Other features:
|> 
|> 	Intelligent macros for often used controlsequences like
|> 	\section{ ... } and anvironments.
|> 
|> 	Indentation by environments
|> 
|> Well.. You may pick it up by anonymous ftp to 
|> 
|> 	iesd.auc.dk  : pub/emacs-lisp/auc-tex.shar 
|> 

Sounds very interesting! But why, oh why did you base your mode on the
hopelessly outdated standard shell.el??? As you probably know, there is
a much more robust and external command interface, namely Olin Shrivers'
comint.el. I, for one, have decided not to go back to shell.el. And since
I'm too ignorant (and lazy) to change your AUC modes myself, I'll stick to
cmutex.el for the time being. Should, however, anyone hack the AUC modes
for the use of comint, and post the diffs, I'd be VERY grateful...

Comint.el (and the comint-based CMU-modes) is available through anonymous
ftp, e.g., from the elisp archive tut.cis.ohio-state.edu in the files
pub/gnu/emacs/elisp-archive/modes/cmushell* 

|> Happy LaTeX'in!

------------------------------------------------------------------------
 hans-peter kolb                                            kolb@kub.nl
 Computational Linguistics                          kolb@htikub5.bitnet
 Tilburg University (KUB)                                P.O.Box 90 153
 The Netherlands                                     NL-5000 LE Tilburg
------------------------------------------------------------------------

abraham@iesd.auc.dk (Per Abrahamsen) (05/25/91)

[ Followups directed to gnu.emacs.help ]

>>>>> On 24 May 91 11:13:43 GMT, kolb@kub.nl (Hans-Peter Kolb) said:

Kolb> Sounds very interesting! But why, oh why did you base your mode
Kolb> on the hopelessly outdated standard shell.el??? As you probably
Kolb> know, there is a much more robust and external command
Kolb> interface, namely Olin Shrivers' comint.el. I, for one, have
Kolb> decided not to go back to shell.el. And since I'm too ignorant
Kolb> (and lazy) to change your AUC modes myself, I'll stick to
Kolb> cmutex.el for the time being. Should, however, anyone hack the
Kolb> AUC modes for the use of comint, and post the diffs, I'd be VERY
Kolb> grateful...

Could you explain why the `external command interface' matters?

AUC-TeX only uses the shell for running the commands and displaying
their output.  Almost all interactions happens through the buffer with
the (La)TeX text, and are interpreted by AUC-TeX, not the shell.  What
would comint.el gain us?

bevemyr@sics.se (Johan Bevemyr) (05/29/91)

How about adding this to your .emacs ?

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; TeX stuff to get the ^c^d to run xdvi on the current dvi file.
;;
;;

(setq TeX-mode-hook
      '(lambda ()
	 (progn
	   (local-set-key "\C-c\C-d" 'TeX-xdvi-document)
	   (defun TeX-define-common-keys (keymap)
	     (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)
	     (define-key keymap "\C-c\C-d" 'TeX-xdvi-document)
	     ))))

(defun TeX-xdvi-document ()
  "Preview the .dvi file made by M-x TeX-region or M-x TeX-buffer."
  (interactive)
  (TeX-recenter-output-buffer nil)
  (send-string "TeX-shell"
	       (concat "xdvi" " " TeX-zap-file " &\n")))

krab@iesd.auc.dk (Kresten Krab Thorup) (05/29/91)

>>>>> On 29 May 91 09:26:47 GMT, bevemyr@sics.se (Johan Bevemyr) said:


Johan> How about adding this to your .emacs ?

Johan> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Johan> ;;
Johan> ;; TeX stuff to get the ^c^d to run xdvi on the current dvi file.
Johan> ;;
Johan> ;;

Johan> (setq TeX-mode-hook
Johan>       '(lambda ()
Johan> 	 (progn
Johan> 	   (local-set-key "\C-c\C-d" 'TeX-xdvi-document)
Johan> 	   (defun TeX-define-common-keys (keymap)
Johan> 	     (define-key keymap "\C-c\C-k" 'TeX-kill-job)
Johan> 	     (define-key keymap "\C-c\C-l" 'TeX-recenter-output-buffer)
Johan> 	     (define-key keymap "\C-c\C-q" 'TeX-show-print-queue)
Johan> 	     (define-key keymap "\C-c\C-p" 'TeX-print)
Johan> 	     (define-key keymap "\C-c\C-d" 'TeX-xdvi-document)
Johan> 	     ))))

Johan> (defun TeX-xdvi-document ()
Johan>   "Preview the .dvi file made by M-x TeX-region or M-x TeX-buffer."
Johan>   (interactive)
Johan>   (TeX-recenter-output-buffer nil)
Johan>   (send-string "TeX-shell"
Johan> 	       (concat "xdvi" " " TeX-zap-file " &\n")))


Is this a request to me ???

If so --- please mail it to auc-tex@iesd.auc.dk  --- with a little
more explanation...

thanks!

/Kresten (co-author of auc-tex)