[OS X TeX] Flashmode for Emacs : Whizzytex + Enrico Franconi's Carbon Enhanced Emacs + TeXniscope
Philipp Mathey
pmathey at uwo.ca
Sun Apr 10 23:36:03 EDT 2005
For the sake of completeness :
0. First of all, the author of whizzytex is Didier Remy.
See the whizzytex web page http://pauillac.inria.fr/whizzytex/
There you will find , among other things, a user manual for
whizzytex.
I believe Didier Remy once asked whether someone would be willing to
port whizzytex to MacOsX, with apparently no response. This would make
the seemingly complicated manual installation ( at least for
TeXniscope) obsolete and replace it by something more user-friendly.
------------------------------------------------------------------------
-----------------------------------------------------
1. It may not be necessary to include the "%; whizzy ...." - line at
the beginning of the tex source.
2. In the whizzytex installation instructions, whizzytex was set up so
that the 'slicing mode' is set to 'paragraph'. This is what the
'paragraph' in "%; whizzy paragraph ..." does. However, there are
numerous other slicing modes besides 'paragraph' : They include
'document' ( the flashmode applies to the whole document), 'section' (
the flashmode applies to the current section) , 'subsection',
'chapter', 'subsubsection' , 'none' . You can change the slicing mode
from 'paragraph' to 'section', for example, either via the emacs menu
or by modifying the first line to
%; whizzy section ....
3. Note also that the modification
> Open ~/whizzytex .el ( say in emacs) and edit it as follows :
>
> - In line 221 you should have
> (defvar whizzy-paragraph-regexp "\n *\n *\n *\n *\n"
>
is , of course, only necessary if you want to use slicing mode
'paragraph' and are not satisfied with the default two empty lines
separating 'paragraphs' in the emacs buffer.
4. It may be also be possible to add something like
(setq whizzy-paragraph-regexp "....") to the .emacs file instead of
editing the whizzytex.el file.
5. Perhaps one may set the default slicing mode in the .emacs file
rather than in the
%; whizzy line. But even if that's not possible, one may always change
it via the emacs menu
(loading the emacs minor mode "whizzytex" will add a new entry "whizzy"
to the emacs menu).
On 7-Apr-05, at 3:13 PM, Philipp Mathey wrote:
> (Joseph Slater asked me to put my original post and the correction
> into a single document.
> I rewrote it and added a few ---- lines to make it more readable )
>
>
> -----------------------------------------------------------------------
> ---------------------------------------------------------
> Hello,
>
> I thought it might be of interest to some if I described my current
> setup : I am using Gerben Wierda's teTeX together with Enrico
> Franconi's Carbon Enhanced Emacs. The emacs major mode I am using is
> UltraTeX ( it provides a so-called lightning completion mode on latex
> commands and other useful features). UltraTeX is probably intended
> for people doing math or physics. In addition, I am using a minor
> mode called WHIZZYTEX . Whizzytex provides a flashmode for emacs ( I
> have never seen Textures so I don't know what it looks like).
> I was able to get whizzytex to work together with TeXniscope as the
> previewer.
> -------------------------
> What exactly does whizzytex do ? The way it works is this. At the
> beginning of your emacs session you load whizzytex with "M-x
> whizzytex-mode" , afterwards you can reactivate it with "C-c w".
> Whizzytex opens up a previewer and compiles a certain region of your
> document, the so-called "slice" on-the-fly. In other words, every word
> or symbol that you enter into your emacs buffer appears in the
> previewer - almost instantaneously. On my outdated 800 Mhz i-book the
> delay is about 3-4 seconds ( when using TeXnscope; with advi, it's a
> little faster)
> ------------------------------------------------------------------
> What is nice about whizzytex is that no matter how large your document
> is and even with a fairly slow processor you don't have to wait any
> longer for the compilation to finish.
> Whizzytex compiles continuously. The delay is only a few seconds.
> My original motivation for using whizzytex was this : a compilation
> of a large document of about 70 pages with lots of commutative
> diagrams (xypic) took at least 15 seconds (when issuing the command to
> compile from an xterm; from within emacs, it took even longer ( why
> ?)). I found this annoying. With whizzytex, it takes only a few
> seconds. Moreover, you don't have to save the document before
> recompilation. However, every time you do save the emacs buffer, the
> whole document is automatically recompiled.
>
> ---------------------------------------------------------------------
> So for those of you who are not satisfied with the speed of tex,
> whizzytex might be of interest.
> ----------------------------------------------------------------------
> Two reasons for the dramatically shorter compile time I can think of
> are
>
> (1) usually tetex has to load all the packages etc specified in the
> preamble each time you compile the document; whizyytex has to
> read/load the preamble at the beginning of the whizzytex-run only
> once;
>
> (2) whizzytex compiles only the current "slice" of the document; the
> slice can be the whole document, the chapter, section, subsection,
> paragraph ... I am using the paragraph mode : one paragraph ends and a
> new one begins where there are two empty lines in the emacs buffer.
> I changed the default to 4 empty lines. In this way you can easily
> organize the text in your emacs-buffer into 'paragraphs' (separated by
> 4 empty lines) such that each paragraph is not too long.
> -
> but there be may be other reasons having something to do with the
> specific way in which whizzytex analyzes the contents of the slice and
> keeps track of changes to the slice.
> -----------------------------------------------------------------------
> -----------------------------------------------------
>
>
>
> -----------------------------------------------------------------------
> -----------------------------------------------------
> What kind of previewers are available ?
>
> advi , xdvi, gv, xpdf and TeXniscope.
> -----------------------------------------------------------------------
> -----------------------------------------------------
>
>
> -----------------------------------------------------------------------
> ----------------------------------------------
> Using advi/xdvi/gv/xpdf as previewer :
> -----------------------------------------------------------------------
> -----------------------------------------------
>
> The default previewer for which whizzytex was specifically written is
> advi (dvi-viewer)
> It also works with xdvi, gv and (this is new) xpdf.
>
> ----------------------------------
> If you want to use advi, gv or xpdf, you should install them before
> installing whizzytex.
>
> For
>
> - advi : install the ocaml library via fink or darwinports, then
> download the advi package from
> http://pauillac.inria.fr/whizzytex/ and follow the instrcutions ( you
> need to use ocaml to compile certain libraries) ( you might have to
> use the unstable branch of fink to get the latest ocaml)
>
> -xdvi : is already installed
>
> -gv: i-package
>
> -xpdf: via fink or darwinports.
>
> -----------------------------------------
>
> Next, you need to install whizzytex.
>
> Go to http://pauillac.inria.fr/whizzytex/ and download the latest
> experimental whizzytex version ( with xpdf support). cd to the
> whizzytex-*.*.* - directory and look what's inside.
> Whizzytex was written for linux, so in order to install it on MacOsX
> one needs to modify the Makefile.config file. I am not quite sure but
> perhaps you first have to create the Makefile.config file out of the
> Makefile.config.in file by typing "make menuconfig" . Whizzytex will
> run a little test to see whether your environment is set up correctly.
> Since at this point it is not, whizzytex will issue an error message.
> This will create the desired Makefile.config file. Now you type "sudo
> pico Makefile.config" to manually edit the file ( I forgot whether the
> sudo is necessary).
> You should have in the first line
> PREFIX = /usr/loca/teTeX
> and further down in the section "Latex implementation" you should have
> :
> INITEX="/usr/local/teTeX/bin/powerpc-apple-darwin-current/latex -ini"
> LATEX=/usr/local/teTeX/bin/powerpc-apple-darwin-current/latex
> FORMAT = latex
> FMT = fmt
> BIBTEX = /usr/local/teTeX/bin/powerpc-apple-darwin-current/bibtex
>
> ( I am assuming that you are using Gerben Wierda's teTeX).
>
> Then type "make all" and then "sudo make install".
>
> The INSTALL file mentions that one should type "umask 022 make
> install". I have not tried this, but this might help to avoid some of
> the permission problems that I ran into later and which I will mention
> below.
>
> Type
>
> cd ~
> ln -s whizzytex-*.*.* whizzytex
>
> This will create symbolic link from the whizzytex-version
> whizzytex-*.*.* which you installed to a directory called 'whizzytex'.
>
> -----------------------------------
>
> Next you need to edit your .emacs file :
>
> Be default, whizzytex will install the "whizzytex.el" lisp file in
> /usr/local/teTeX/share/whizzytex/emacs/ , so you should add the
> following to your .emacs file :
>
> (setq load-path (cons "/usr/local/teTeX/share/whizzytex/emacs"
> load-path))
> (require 'whizzytex)
>
> In addition, you should add to the .emacs file the line
>
> (setq-default whizzy-viewers '(("-pdf" "xpdf" )("-advi" "advi")
> ("-xdvi" "xdvi")("-ps" "gv")))
>
> ( assuming that all these previewers are installed; otherwise, make an
> intelligent adjustment)
>
> ------------------------------------
>
> Next open up an xterm or Terminal and type
> cd
> cd /Applications/Emacs.app/Contents/MacOS/bin/
> mkdir ATH
> cd
> cd whizzytex
> You will find a subdirectory called ATH and inside the whizzytex shell
> script.
> cd ATH
> cp whizzytex /Applications/Emacs.app/Contents/MacOS/bin/ATH
>
> This way the shell script "whizzytex" is in your PATH but you do not
> need to become root to copy it into the above location. You could move
> ATH/whizzytex somewhere else, e.g. into /usr/local/bin, but then you
> cannot edit it without becoming root. Doing this and then running
> whizzytex causes emacs to complain that it cannot find ATH/whizzytex.
> This is the permission problem mentioned earlier.
> ( editing whizzytex is only necessary if you want to use TeXniscope,
> see below)
>
> -----------------------------------------
>
> Now add the following to your default preamble :
> The first lines should be ( each should be on one line) :
>
> %%; whizzy paragraph -pdf "xpdf -bg black -fg blue -g 1025x900 -z 170
> -remote $$" -initex "pdflatex -ini" -latex pdflatex
> %; whizzy paragraph -advi advi -A -html Start-Document -(perhaps you
> like -rv) -geometry 1025x900 -initex "pdflatex -ini" ( or just "latex
> -ini") -latex pdflatex (or just latex)
> %%; whizzy paragraph -dvi xdvi -expert -rv -s 5 -fullscreen -offsets 0
> %%; whizzy paragraph -ps "gv ..."
>
> Of course, the options for, say xpdf, are mine and you can modify
> them. Notice that the advi line begins with only one %, the others
> with more than one. In this case, when you activate whizzytex,
> whizzytex will choose the advi previewer. A simple addition of an % to
> advi and the removal of an % from the xpdf line, will make xpdf the
> previewer. This way you don't have to edit your .emacs file in order
> to switch previewers.
>
> --------------------------------
>
> Now you should be ready, finally.
>
> Since all of the previewers (advi,xdvi,gv,xpdf) use X11, and since
> somehow whizzytex requires communication between X11 and emacs back
> and forth, it seems that the only way for whizzytex to work is by
> doing the following :
>
> -open an xterm.
> -type "/Applications/Emacs.app/Contents/Resources/sitelisp/emacs"
>
> This will open up Enrico Franconi's Carbon Enhanced Emacs but - this
> is crucial- this emacs process will be a "child process" of the xterm
> shell.
> If you open up emacs by clicking on the emacs symbol in the Finder or
> in the dock, whizzytex won't work ( but it does work with TeXniscope,
> see below).
>
> Open up some latex document, with the "%; whizzy ..." lines included
> in the preamble, and then load whizzytex with "M-x whizzytex-mode" (
> by the way, M is the meta-key i.e. the comand key; C is the
> control-key; it might be necessary for you to go to "X11 Preferences"
> and un-check the box "Enable key equivalents under X11"; otherwise, I
> believe, the meta key would be the escape key which would be
> inconvenient).
>
> Whizzytex should open and it should work.... (hopefully)..
>
> -------------------------------------
> Advi has some rather nice features including syncronicity between the
> advi preview window and the emacs buffer, also a cool way to toggle
> the view of the slice and the whole document by pressing 'w' while
> advi is active. I should have mentioned earlier that whizzytex has a
> feature called "duplex" ( C-c d) which opens up a view of the whole
> document, in addition to the slice.
> For example, if you are looking at the slice and click on a hyperlink
> to a theorem or something which is located outside of the slice,
> clicking the link will cause advi to jump to the corresponding place
> in the whole-document-window.
> ---------------------------------------
>
> This is how I was using whizzytex until recently. However, I find that
> pdf files simply look much better than dvi files. The latest (March
> 2005, version 1.2.2 or higher) version of whizzytex makes it possible
> to use xpdf as a previewer. I don't like xpdf very much but I do like
> TeXniscope .
>
> So now I come finally to ..
>
>
> -----------------------------------------------------------------------
> -------------------------------------------
> Using TeXniscope as a previewer :
> -----------------------------------------------------------------------
> -----------------------------------------
>
> ----------------------
> - first of all, install TeXniscope.
> ----------------------
> - instruct whizzytex as described above (you shouldn't need to have
> advi installed; as long as whizzytex detects that at least one of
> advi/xdvi/gv is installed, the installation should work).
> For the sake of completeness , here are the installation instructions :
> -----------------------------
> Go to http://pauillac.inria.fr/whizzytex/ and download the latest
> experimental whizzytex version (with xpdf support). cd to the
> whizzytex-*.*.*- directory and look what's inside.
> Whizzytex was written for linux, so in order to install it on MacOsX
> one needs to modify the Makefile.config file. I am not quite sure but
> perhaps you first have to create the Makefile.config file out of the
> Makefile.config.in file by typing "make menuconfig" . Whizzytex will
> run a little test to see whether your environment is set up correctly.
> Since at this point it is not, whizzytex will issue an error message.
> This will create the desired Makefile.config file. Now you type "sudo
> pico Makefile.config" to manually edit the file ( I forgot whether the
> sudo is necessary).
> You should have in the first line
> PREFIX = /usr/loca/teTeX
> and further down in the section "Latex implementation" you should have
> :
> INITEX="/usr/local/teTeX/bin/powerpc-apple-darwin-current/latex -ini"
> LATEX=/usr/local/teTeX/bin/powerpc-apple-darwin-current/latex
> FORMAT = latex
> FMT = fmt
> BIBTEX = /usr/local/teTeX/bin/powerpc-apple-darwin-current/bibtex
>
> ( I am assuming that you are using Gerben Wierda's teTeX).
>
> Then type "make all" and then "sudo make install".
>
> The INSTALL file mentions that one should type "umask 022 make
> install". I have not tried this, but this might help to avoid some of
> the permission problems that I ran into later and which I will mention
> below.
>
> Type
>
> cd ~
> ln -s whizzytex-*.*.* whizzytex
>
> This will create symbolic link from the whizzytex-version
> whizzytex-*.*.* which you installed to a directory called 'whizzytex'.
> -----------------------------------
>
> Actually, whizzytex uses only three files : the shell script
> 'whizzytex', the emacs lisp file 'whizzytex.el' and the whizzytex
> style file 'whizzytex.sty'. During the installation, certain variables
> such as LATEX, INITEX etc in 'whizzytex' are set as specified in the
> file Makefile.config . Also, the variable PACKAGE is set to
> /usr/local/teTeX/share/whizzytex/latex/whizzytex.sty
> to let 'whizzytex' know where to find the style file 'whizzytex.sty'.
> Moreover, these three files are installed in certain locations
> - 'whizzytex' in a newly created subdirectory called ATH of the
> 'whizzytex' directory ( the directory in which you do the
> installation)
> - 'whizzytex.sty' in /usr/local/teTeX/share/whizzytex/latex/, and
> - 'whizzytex.el' in /usr/local/teTeX/share/whizzytex/emacs
>
> It should be possible to just set the variables just mentioned the way
> I just described it and put the three files manually in the right
> places. You wouldn't even have to install whizzytex ( via make etc) ,
> just put the three files, suitably edited, in the right places.
> However, I have not tried this. So perhaps the best thing to do is to
> first install whizzytex as described above and then to edit and move
> 'whizzytex' and 'whizzytex.el' as outlined below to make them work
> together with TeXniscope.
> --------------------------------
> - ( this step is optional and only necessary if you wish to edit
> whizzytex.el; I did so, because I wanted paragraphs to be separated by
> 4 empty lines rather than the default 2)
>
> open an xterm and type:
>
> cd
> cd /usr/local/teTeX/share/whizzytex/emacs
> cp whizzytex.el ~
>
> (This will create a whizzytex shell script in my home directory which
> I own so I can edit it)
>
> Open ~/whizzytex .el ( say in emacs) and edit it as follows :
>
> - In line 221 you should have
> (defvar whizzy-paragraph-regexp "\n *\n *\n *\n *\n"
>
> - in line 1352 you should have
> (defvar whizzy-load-factor 10
>
> ( I am not quite sure this helps; this is supposed to be the maximal
> value possible determining the speed of 'slicing' -perhaps it doesn't
> make much of a difference; default value is 0.6)
> -------------------------------
>
> Open 'whizzytex.el' in emacs ( either it is located in your home
> directory if you did the previous step or otherwise in
> /usr/local/teTeX/share/whizzytex/emacs/
>
> Find the menu option "Byte-compile this file" . This will create the
> file 'whizzytex.elc'.
> -------------------------------
>
> Next you need edit to your .emacs file.
>
> If you did did the optional step of moving whizzytex.el to your home
> directory and editing it,
> you should have :
>
> (setq load-path (cons "/Users/yourname/" load-path))
> (require 'whizzytex)
>
> (setq-default whizzy-viewers '(("-pdf"
> "Applications/TeXniscope.app/Contents/MacOS/TeXniscope" )("-advi"
> "advi") ("-xdvi" "xdvi")("-ps" "gv")))
>
> ( on one line)
>
> If you didn't move whizzytex.el, you should have
>
> (setq load-path (cons "/usr/local/teTeX/share/whizzytex/emacs"
> load-path))
> (require 'whizzytex)
>
> (setq-default whizzy-viewers '(("-pdf"
> "Applications/TeXniscope.app/Contents/MacOS/TeXniscope" )("-advi"
> "advi") ("-xdvi" "xdvi")("-ps" "gv")))
>
> ( on one line)
> ----------------------------------------------
>
>
> Next open up an xterm or Terminal and type
> cd
> cd /Applications/Emacs.app/Contents/MacOS/bin/
> mkdir ATH
> cd
> cd whizzytex
> You will find a subdirectory called ATH and inside the whizzytex shell
> script.
> cd ATH
> cp whizzytex /Applications/Emacs.app/Contents/MacOS/bin/ATH
>
> This way the shell script "whizzytex" is in your PATH but you do not
> need to become root to copy it into the above location. You could move
> ATH/whizzytex somewhere else, e.g. into /usr/local/bin, but then you
> cannot edit it without becoming root. Doing this and then running
> whizzytex causes emacs to complain that it cannot find ATH/whizzytex.
> This is the permission problem mentioned earlier.
>
> -------------------------------------------
>
>
> Next, you need to edit the shell script 'whizzytex' .
>
> Open up /Applications/Emacs.app/ Contents/MacOS/bin/ whizzytex , best
> in emacs, and modify it as follows :
>
> ------------------
> - around line 166, set DUPLEX to false
> (maybe it was set to false by default- I don't remember)
> I.e. you should have
>
> -pdf)
> LEVEL=1
> DVI=pdf
> .....
> FMT=fmt
> DUPLEX=false
> ....
>
> -----------------------
> - in line 658 or thereabouts you find a passage that looks like this
> :
>
> ....
> echo '# End of command' ) >> "OUTPUT"/command
>
> { $VIEWCOMMAND $WHIZZY.$VIEW $CLIENTVIEW 2>"OUTPUT"/view &
> echo $! >> #TMP"/pids
> ID=$!
> .....
>
> Modify this passage to
>
> ....
> echo '# End of command' ) >> "OUTPUT"/command
>
> { cp $WHIZZY.$VIEW .pdf
> $VIEWCOMMAND $WHIZZY.pdf $CLIENTVIEW 2>"OUTPUT"/view &
> echo $! >> #TMP"/pids
> ID=$!
> .....
> ------------------------
> - in line 670 or so , you will find the function "xpdfreload"
> You should comment out all lines and add
> cp $WHIZZY.$VIEW $WHIZZY.pdf
> i.e. you should have
>
> xpdfreload () {
> cp $WHIZZY.$VIEW $WHIZZY.pdf
> }
>
> ----------------------
> immediately afterwards comes the function "whole".
> Below the line "echo '<Whole document updated>'
> add the line
>
> cp $WHIZZY.$VIEW $WHIZZY.pdf
>
> - around line 714 you will find the function "duplex"
> comment out the line
> $VIEWCOMMAND $NAME.$VIEW &
> and replace it by
> $VIEWCOMMAND $NAME.pdf &
>
> -------------------
>
> Finally, in your document preamble the first line should be (on one
> line)
>
> %; whizzy paragraph -pdf
> "/Applications/TeXniscope.app/Contents/MacOS/TeXniscope" -initex
> "pdflatex -ini" -latex pdflatex
>
> -------------------
>
> If you want, you can change the AutoRefresh Interval of TeXniscope to
> 1.0 seconds by opening a Terminal and typing
>
> defaults write TeXniscope AutoRefreshInterval 1.0
> -----------------------------------------------------
> That's it ..... finally...
> -----------------------
> When using TeXniscope as the previewer, you don't need to be running
> X11. In particular, there is no need to open emacs from the command
> line of an xterm as before.
> Just open up Emacs and open some latex document, with the %; whizzy
> .... -line included
> in the first line of the preamble. Then load up whizzytex with "M-x
> whizzytex-mode".
> TeXniscope should open up and display the current slice. Typing "C-c
> d" should open up a view of the whole document.
>
> I apologize for this lengthy (first) post of mine. I don't intend to
> answer any questions so I spelt it all out.
>
> Finally, I became aware of the existence of whizzytex by doing a
> google search and stumbling over a post by Nathan Dunfield (July 2003)
> on this mailing list. The subject of the thread was something else.
> Nathan mentioned in his post the existence of Advi and whizzytex. I
> would like to thank him for bringing whizzytex to my attention.
>
> Philipp Mathey
>
> --------------------- Info ---------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
> & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
>
>
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
More information about the MacOSX-TeX
mailing list