\input texinfo.tex
@setfilename yatexe
@settitle Yet Another tex-mode for Emacs

@iftex
@syncodeindex fn cp
@syncodeindex vr cp
@end iftex

@titlepage
@sp 10
@center
@subtitle Yet Another tex-mode for emacs
@title Wild Bird
@subtitle // YaTeX //
@author @copyright{} 1991-1994 by    HIROSE, Yuuji [yuuji@@ae.keio.ac.jp]
@end titlepage

@node Top, What is YaTeX?, (dir), (dir)
@comment  node-name,  next,  previous,  up
@cindex Demacs
@cindex Mule
@cindex LaTeX
@cindex YaTeX

@menu
* What is YaTeX?::              
* Main features::               
* Installation::                
* Typesetting::                 
* %# notation::                 
* Completion::                  
* Commenting out::              
* Cursor jump::                 
* Changing and Deleting::       
* Filling an item::             
* Local dictionaries::          
* Updation of @code{\includeonly}::  
* What column?::                
* Intelligent newline::         
* Online help::                 
* Cooperation with other packages::  
* Customizations::              
* Etcetera::                    
* Copying::                     

 --- The Detailed Node Listing ---

%# notation

* Changing typesetter::         
* Static region for typesetting::  
* Lpr format::                  
* Editing %# notation::         

Completion

* Begin-type completion::       
* Section-type completion::     
* Large-type completion::       
* Maketitle-type completion::   
* Arbitrary completion::        
* End completion::              
* Accent completion::           
* Image completion::            
* Greek letters completion::    

Section-type completion

* view-sectioning::             

Customizations

* Lisp variables::              
* Add-in functions::            

Lisp variables

* All customizable variables::  
* Sample definitions::          
* Hook variables::              
* Hook file::                   
@end menu

@node What is YaTeX?, Main features, Top, Top
@comment  node-name,  next,  previous,  up
@chapter What is YaTeX?

  YaTeX automates typesetting and previewing of LaTeX and enables
completing input of LaTeX mark-up command such as
@code{\begin@{@}}..@code{\end@{@}}.

  YaTeX also supports Demacs which runs on MS-DOS(386), Mule (Multi
Language Enhancement to GNU Emacs), and latex on DOS.

@node Main features, Installation, What is YaTeX?, Top
@comment  node-name,  next,  previous,  up
@chapter Main features

@itemize
@item Invocation of typesetter,  previewer and related programs(C-c t)
@item Typesetting on static region which is independent from point
@item Semiautomatic replacing of @code{\include only}
@item Jumping to error line(@kbd{C-c '})
@item Completing-read of La@TeX{} commands such as @code{\begin@{@}},
        @code{\section} etc. 
        (@kbd{C-c b}, @kbd{C-c s}, @kbd{C-c l}, @kbd{C-c m})
@item Enclosing text into La@TeX{} environments or commands
      (@kbd{C-u} @var{AboveKeyStrokes})
@item Learning unknown/new La@TeX{} commands for the next completion
@item Argument reading with a guide for complicated La@TeX{} commands
@item Generating argument-readers for new/unsupported commands(@file{yatexgen})
@item Quick changing or deleting of La@TeX{} commands(@kbd{C-c c}, @kbd{C-c k})
@item Jumping from and to inter-file, begin<->end, ref<->label(@kbd{C-c g})
@item Blanket commenting out or uncommenting
        (@kbd{C-c >}, @kbd{C-c <}, @kbd{C-c ,}, @kbd{C-c .})
@item Easy input of accent mark, math-mode's commands and Greek letters
        (@kbd{C-c a}, @kbd{;}, @kbd{/})
@item Online help for the popular La@TeX{} commands
      (@kbd{C-c ?}, @kbd{C-c /})(English help is not yet supported)
@end itemize

@node Installation, Typesetting, Main features, Top
@comment  node-name,  next,  previous,  up
@chapter Installation
@cindex installation
@cindex .emacs
@cindex auto-mode-alist
@cindex autoload

  Put next two expressions into your @file{~/.emacs}.

@lisp
        (setq auto-mode-alist
	      (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist))
        (autoload 'yatex-mode "yatex" "Yet Another La@TeX{} mode" t)
@end lisp

Next, add certain path name where you put files of YaTeX to your
load-path.  If you want to put them in @file{~/src/emacs}, write

@lisp
       (setq load-path
             (cons (expand-file-name "~/src/emacs") load-path))
@end lisp

@noindent
in your @file{~/.emacs}

  Then, yatex-mode will be automatically loaded when you visit a
file which has extension @file{.tex}.  If yatex-mode is successfully
loaded, mode string on mode line will be turned to "YaTeX".


@node Typesetting, %# notation, Installation, Top
@comment  node-name,  next,  previous,  up
@chapter Typesetting
@cindex typesetting
@cindex previewer
@cindex typesetter
@cindex latex
@cindex printing out

  The prefix key stroke of yatex-mode is @kbd{C-c} (Press 'C' with Control
key) by default.  If you don't intend to change the prefix key stroke,
assume all @kbd{[prefix]} as @kbd{C-c} in this document.  These key
strokes execute typeset or preview command.

@table @kbd
@item [prefix] tj
	@dots{}	invoke latex
@item [prefix] tr
	@dots{}	invoke latex on region
@item [prefix] tk
	@dots{}	kill current typesetting process
@item [prefix] tb
	@dots{}	invoke bibtex
@item [prefix] tp
	@dots{}	preview
@item [prefix] tl
	@dots{}	lpr dvi-file
@end table

  The current editing window will be divided horizontally when you
invoke latex command, and log message of La@TeX{} typesetting will be
displayed   in the other window;   called typesetting buffer.  The
typesetting  buffer automatically  scrolls  up  and  traces  La@TeX{}
warnings and  error  messages.  If  you  see latex stopping  by an
error, you can send string to latex in the typesetting buffer.

  If an error  stops the La@TeX{}  typesetting, this  key stroke will
move the cursor to the line where La@TeX{} error is detected.

@table @kbd
@item [prefix] '
@itemx ([prefix]+single quotation)

	@dots{}	jump to the previous error or warning
@end table

  If you find a noticeable error, move to the typesetting buffer and move
the cursor on the line of error message and type @kbd{SPACE} key.  This
makes the cursor move to corresponding source line.

  Since @kbd{[prefix] tr} pastes the region into the file
@file{texput.tex} in the current directory, you should be careful of
overwriting.  The method of specification of the region is shown in the
section @xref{%#NOTATION}.

  The documentstyle  for typeset-region is the same as that of editing
file if you edit one  file,  and is the same as main file's if you
edit splitting files.

  YaTeX asks you the range of dvi-printing by default.  You can
skip this by invoking it with universal-argument as follows:

@example
C-u [prefix] tl
@end example

@node %# notation, Completion, Typesetting, Top
@comment  node-name,  next,  previous,  up
@chapter %# notation
@cindex %# notation

  You can control the typesetting process by describing @code{%#}
notations in the source text.

@menu
* Changing typesetter::         
* Static region for typesetting::  
* Lpr format::                  
* Editing %# notation::         
@end menu

@node Changing typesetter, Static region for typesetting, %# notation, %# notation
@comment  node-name,  next,  previous,  up
@section To change the `latex' command or to split a source text.
@cindex typesetter

  To change the typesetting command, write

@example
 	%#!latex-big
@end example

@noindent
anywhere in the source text.  And if you split the source text and
edit subfile that should be included from main text.

@example
 	%#!latex main.tex
@end example

@noindent
will be helpful to execute latex on main file from sub text buffer.  Since
this command line after @kbd{%#!} will be sent to shell literally, next
description makes it convenient to use ghostview as dvi-previewer.

@example
 	%#!latex main ; dvi2ps main.dvi > main
@end example

@noindent
Note that YaTeX  assumes the component  before the  last period of
the last word in this line as base name of the main La@TeX{} source.

  Here are the restrictions on splitting sources.

@itemize
@item All the file name should be different.
@item You can put split texts in sub directory, but not in
 sub directory of sub directory.
@item In the main text,specify the file with relative path name
 such as \include{chap1/sub}, when you include the file in
 a sub-directory.
@item In a sub-text, write @code{%#!latex main.tex} even if @file{main.tex}
 is in the parent directory(not %#!latex ../main.tex).
@end itemize

@node Static region for typesetting, Lpr format, Changing typesetter, %# notation
@comment  node-name,  next,  previous,  up
@section Static region
@cindex static region
@cindex Fixed region

  Typeset-region by @kbd{[prefix] tr} passes the region between point and
mark to typesetting command by default.  But when you want to typeset
static region, enclose the region by @code{%#BEGIN} and @code{%#END} as
follows.

@example
	%#BEGIN
	  TheRegionYouWantToTypesetManyTimes
	%#END
@end example

This is the rule of deciding the region.

@enumerate
@item
If there exists %#BEGIN before point,

@enumerate
@item
If there exists %#END after %#BEGIN,
@itemize
@item From %#BEGIN to %#END.
@end itemize

@item
If %#END does not exist after %#BEGIN,
@itemize
@item From %#BEGIN to the end of buffer.
@end itemize
@end enumerate

@item
If there does not exist %#BEGIN before point,
@itemize
@item Between point and mark(standard method of Emacs).
@end itemize
@end enumerate

  It is useful to write @code{%#BEGIN} in the previous line of \begin and
@code{%#END} in the next line of \@code{end} when you try complex
environment such as `tabular' many times.  It is also useful to put only
@code{%#BEGIN} alone at the middle of very long text.  Do not forget to
erase @code{%#BEGIN} @code{%#END} pair.

@node Lpr format, Editing %# notation, Static region for typesetting, %# notation
@comment  node-name,  next,  previous,  up
@section Lpr format
@cindex lpr format

  Lpr format is specified by three Lisp variables.  Here are the
default values of them.

@table @code
@item (1)dviprint-command-format
	@code{"dvi2ps %f %t %s | lpr"}
@item (2)dviprint-from-format
	@code{"-f %b"}
@item (3)dviprint-to-format
	@code{"-t %e"}
@end table

  On YaTeX-lpr, @code{%s} in (1) is replaced by the file name of main
text, @code{%f} by contents of (2), %t by contents of (3).  At these
replacements, @code{%b} in (2) is also replaced by the number of beginning
page, @code{%e} in (3) is replaced by the number of ending page.  But
@code{%f} and @code{%t} are ignored when you omit the range of print-out
by @kbd{C-u [prefix] tl}.

  If you want to change this lpr format temporarily, put a command
such as follows somewhere in the text:

@example
	%#LPR dvi2ps %f %t %s | 4up -page 4 | texfix | lpr -Plp2
@end example

  And if you want YaTeX not to ask you the range of printing
out, the next example may be helpful.

@example
	%#LPR dvi2ps %s | lpr
@end example

@node Editing %# notation,  , Lpr format, %# notation
@comment  node-name,  next,  previous,  up
@section Editing %# notation

  To edit @code{%#} notation described above, type

@table @kbd
@item [prefix] %
	@dots{}	editing %# notation menu
@end table

@noindent
and select one of the entry of the menu as follows.

@example
	!)Edit-%#! B)EGIN-END-region L)Edit-%#LPR
@end example

@noindent
Type @kbd{!} to edit @code{%#!} entry, @code{b} to enclose the region with
@code{%#BEGIN} and @code{%#END}, and @code{l} to edit @code{%#LPR} entry.
When you type @kbd{b}, all @code{%#BEGIN} and @code{%#END} are
automatically erased.

@node Completion, Commenting out, %# notation, Top
@comment  node-name,  next,  previous,  up
@chapter Completion
@cindex completion

  YaTeX makes it easy to input the La@TeX{} commands.  There are several
kinds of completion type, begin-type, section-type, large-type, etc...

@menu
* Begin-type completion::       
* Section-type completion::     
* Large-type completion::       
* Maketitle-type completion::   
* Arbitrary completion::        
* End completion::              
* Accent completion::           
* Image completion::            
* Greek letters completion::    
@end menu

@node Begin-type completion, Section-type completion, Completion, Completion
@comment  node-name,  next,  previous,  up
@section Begin-type completion
@cindex begin-type completion
@cindex environment
@cindex prefix b

  "Begin-type completion" completes commands of @code{\begin@{env@}} ... 
@code{\end@{env@}}.  All of the begin-type completions begin with this key
sequence.

@table @kbd
@item [prefix] b
	@dots{}	start begin-type completion
@end table

@noindent
An additional key  stroke immediately  completes a frequently used
La@TeX{} @code{\begin@{@}}...@code{\@code{end}@{@}} environment.

@table @kbd
@item [prefix] b c
	@dots{}  @code{\begin@{center@}...\end@{center@}}
@item [prefix] b d
	@dots{}  @code{\begin@{document@}...\end@{document@}}
@item [prefix] b D
	@dots{}  @code{\begin@{description@}...\end@{description@}}
@item [prefix] b e
	@dots{}  @code{\begin@{enumerate@}...\end@{enumerate@}}
@item [prefix] b E
	@dots{}  @code{\begin@{equation@}...\end@{equation@}}
@item [prefix] b i
	@dots{}  @code{\begin@{itemize@}...\end@{itemize@}}
@item [prefix] b l
	@dots{}  @code{\begin@{flushleft@}...\end@{flushleft@}}
@item [prefix] b m
	@dots{}  @code{\begin@{minipage@}...\end@{minipage@}}
@item [prefix] b t
	@dots{}  @code{\begin@{tabbing@}...\end@{tabbing@}}
@item [prefix] b T
	@dots{}  @code{\begin@{tabular@}...\end@{tabular@}}
@item [prefix] b^T
	@dots{}  @code{\begin@{table@}...\end@{table@}}
@item [prefix] b p
	@dots{}  @code{\begin@{picture@}...\end@{picture@}}
@item [prefix] b q
	@dots{}  @code{\begin@{quote@}...\end@{quote@}}
@item [prefix] b Q
	@dots{}  @code{\begin@{quotation@}...\end@{quotation@}}
@item [prefix] b r
	@dots{}  @code{\begin@{flushright@}...\end@{flushright@}}
@item [prefix] b v
	@dots{}  @code{\begin@{verbatim@}...\end@{verbatim@}}
@item [prefix] b V
	@dots{}  @code{\begin@{verse@}...\end@{verse@}}
@end table

  Any other La@TeX{} environments are made by  completing-read of the
Emacs function.

@table @kbd
@item [prefix] b SPACE
	@dots{}	begin-type completion
@end table

@noindent
The next message will show up in the minibuffer

@example
	Begin environment(default document): 
@end example

@noindent
by typing @kbd{[prefix] b}.  Put the wishing environment with completion
in the minibuffer, and @code{\begin@{env@}}...\@code{\end@{env@}} will be
inserted in the La@TeX{} source text.  If the environment you want to put
does not exist in the YaTeX completion table, it will be registered in the
user completion table.  YaTeX automatically saves the user completion
table in the user dictionary file at exiting of emacs.

  If you want to  enclose some paragraphs  which have already been
written, invoke the  begin-type completion with changing  the case
of @kbd{b} of key sequence upper(or invoke it with  universal argument
by @kbd{C-u} prefix).
@cindex enclose region into environment

  The following example encloses a region with `description'
environment.

@table @kbd
@item [prefix] B D
@itemx (or ESC 1 [prefix] b D)
@itemx (or  C-u  [prefix] b D)

	@dots{}	begin-type completion for region
@end table

  This enclosing holds good for the completing input by @kbd{[prefix] b
SPC}.  @kbd{[prefix] B SPC} enclose a region with the environment selected
by completing-read.

@node Section-type completion, Large-type completion, Begin-type completion, Completion
@comment  node-name,  next,  previous,  up
@section Section-type completion
@cindex section-type completion
@cindex prefix s

  "Section-type completion" completes section-type commands which take an
argument or more such as @code{\section@{foo@}}.  To invoke section-type
completion, type

@table @kbd
@item [prefix] s
	@dots{}	section-type completion
@end table

@noindent
then the prompt

@example
	(C-v for view) \???@{@} (default documentstyle):
@end example

@noindent
will  show up in the  minibuffer.  Section-type La@TeX{} commands are
completed by space key, and the default value is selected when you
type nothing in the minibuffer.

  Next, 

@example
	\section@{???@}:
@end example

@noindent
prompts you the argument of section-type La@TeX{} command.  For
example, the following inputs

@example
	\???@{@} (default documentstyle): section
	\section{???}: Hello world.
@end example

@noindent
will insert the string

@example
	\section@{Hello world.@}
@end example

in your La@TeX{} source.  When you neglect argument such as

@example
	(C-v for view) \???@{@} (default section): vspace*
	\vspace*@{???@}: 
@end example

YaTeX puts

@example
	\vspace*@{@}
@end example

@noindent
and move the cursor in the braces.

  In La@TeX{} command, there are commands which take more than one
arguments such as @code{\addtolength{\topmargin}{8mm}}.  To complete these
commands, invoke section-type completion with universal argument as,
@cindex number of argument

@example
C-u 2 [prefix] s (or ESC 2 [prefix] s)
@end example

@noindent
and make answers in minibuffer like this.

@example
	(C-v for view) \???@{@} (default vspace*): addtolength
	\addtolength@{???@}: \topmargin
	Argument 2: 8mm
@end example

@code{\addtolength} and the first argument @code{\topmargin} can be typed
easily by completing read.  Since YaTeX also learns the number of
arguments of section-type command and will ask that many arguments in
future completion, you had better tell the number of arguments to YaTeX at
the first completion of the new word.  But you can change the number of
arguments by calling the completion with different universal argument
again.

  The special number of argument 0 makes YaTeX  use read-string to
read the first  argument  instead of completing-read.  It  is more
comfortable  to enter first  argument  without completion when you
put section title which contains  space character.  Normally, such
sectioning commands as    chapter,  section,  paragraph...,   have
argument 0 in the completion table.

  Invoking section-type completion with @code{[Prefix] S} (Capital `S')
includes the region as the first argument of section-type command.

  The  section/large/maketitle type completion  can  work at the
prompt for   the argument   of  other section-type   completion.
Nested La@TeX{}  commands are  efficiently read with  the recursive
completion by typing  YaTeX's   completion key sequence in   the
minibuffer.

@menu
* view-sectioning::             
@end menu

@node view-sectioning,  , Section-type completion, Section-type completion
@comment  node-name,  next,  previous,  up
@subsection view-sectioning
@cindex view sectioning
@cindex outline

  In the minibuffer at the prompt of section-type command completion,
typing @kbd{C-v} shows a list of sectioning commands in source text(The
line with @code{<<--} mark is the nearest sectioning command).  Then,
default sectioning command appears in the minibuffer.  You can go up/down
sectioning command by typing @kbd{C-p}/@kbd{C-n}, can scrolls up/down the
listing buffer by @kbd{C-v}/@kbd{M-v}, and can hide sectioning commands
under certain level by 0 through 6.  Type @kbd{?}  in the minibuffer of
sectioning prompt for more information.

@node Large-type completion, Maketitle-type completion, Section-type completion, Completion
@comment  node-name,  next,  previous,  up
@section Large-type completion

  "Large-type   completion"  inputs  the  font  or  size  changing
descriptions such as @code{@{\large @}}.  When you type

@table @kbd
@item [prefix] l
	@dots{}	large-type completion
@end table

@noindent
the message in the minibuffer

@example
	@{\??? @} (default large): 
@end example

prompts prompts you large-type command with completing-read.  There are
TeX commands to change fonts or sizes, @code{it}, @code{huge} and so on,
in the completion table.

  Region-based completion is also invoked by changing the letter after
prefix key stroke as @kbd{[prefix] L}.  It encloses the region by braces
with large-type command.

@node Maketitle-type completion, Arbitrary completion, Large-type completion, Completion
@comment  node-name,  next,  previous,  up
@section Maketitle-type completion
@cindex maketitle-type completion

  We call it "maketitle-type completion" which completes commands such as
@code{\maketitle}.  Take notice that maketitle-type commands take no
arguments.  Then, typing

@table @kbd
@item [prefix] m
	@dots{}	maketitle-type completion
@end table

@noindent
begins maketitle-completion.  Above mentioned  method is  true for
maketitle-completion, and   there  are   La@TeX{} commands    with no
arguments in completion table.

@node Arbitrary completion, End completion, Maketitle-type completion, Completion
@comment  node-name,  next,  previous,  up
@section Arbitrary completion
@cindex arbitrary completion

@noindent
  You can complete certain La@TeX{} command anywhere without typical
completing method as described, by typing

@table @kbd
@item [prefix] SPC
	@dots{}	arbitrary completion
@end table

@noindent
after the initial string of La@TeX{} command that is preceded by @code{\}.

@node End completion, Accent completion, Arbitrary completion, Completion
@comment  node-name,  next,  previous,  up
@section End completion
@cindex end completion

@noindent
  YaTeX automatically detects the opened environment and close it with
\@code{\end@{environment@}}.  Though proficient YaTeX users never fail to
make environment with begin-type completion, some may begin an environment
manually.  In that case, type

@table @kbd
@item [prefix] e
	@dots{}	@code{end} completion
@end table

@noindent
at the end of the opened environment.

@node Accent completion, Image completion, End completion, Completion
@comment  node-name,  next,  previous,  up
@section Accent completion
@cindex accent completion

  When you want to write the European accent marks(like @code{\`@{o@}}),

@table @kbd
@item [prefix] a
	@dots{}	accent completion
@end table

@noindent
shows the menu

@example
	1:` 2:' 3:^ 4:" 5:~ 6:= 7:. u v H t c d b
@end example

@noindent
in the minibuffer.  Chose one character or corresponding numeric,
and you will see

@example
	\`{}
@end example

@noindent
in the editing buffer with the cursor positioned  in braces.  Type
one more character `o' for example, then

@example
	\`{o}
@end example

@noindent
will be completed, and the cursor gets out from braces.

@node Image completion, Greek letters completion, Accent completion, Completion
@comment  node-name,  next,  previous,  up
@section Image completion of mathematical sign
@cindex image completion
@cindex math-mode
@cindex sigma
@cindex leftarrow
@cindex ;

  Arrow  marks,  sigma mark and those signs mainly used  in  the
TeX's  math environment  are completed by  key  sequences  which
imitate the  corresponding symbols graphically.  This completion
only works in the math environment.  YaTeX automatically detects
whether the  cursor  located  in math environment  or  not,  and
change the behavior of key strokes @kbd{;} and @kbd{/}.

  By the way, we often express the leftarrow mark by `<-' for example.
Considering such image, you can write @code{\leftarrow} by typing @kbd{<-}
after @kbd{;} (semicolon) as a prefix.  In the same way,
@code{\longleftarrow} (@code{<--}) is completed by typing @kbd{;<--},
infinity mark which is imitated by @code{oo} is completed by typing
@kbd{;oo}.

  Here are the sample operations in YaTeX math-mode.

@example
INPUT                   Completed La@TeX{} commands
; < -                   @code{\leftarrow}
; < - -                 @code{\longleftarrow}
; < - - >               @code{\longleftrightarrow}
; o                     @code{\circ}
; o o                   @code{\infty}
@end example

  In  any case, you can quit  from image completion and can move
to the next editing  operation if the La@TeX{}  command you want is
shown in the buffer.

  @code{;} itself in math-environment is inserted by @kbd{;;}.  Typing
@kbd{TAB} in the midst of image completion shows all of the La@TeX{}
commands that start with the same name as string you previously typed in.
In this menu buffer, press @kbd{RET} after moving the cursor (by @kbd{n},
@kbd{p}, @kbd{b}, @kbd{f}) to insert the La@TeX{} command.

  To know all of the completion table, type @kbd{TAB} just after @kbd{;}.
And here is the sample menu by @kbd{TAB} after @kbd{;<}.

@example
KEY             LaTeX sequence          sign
<               \leq                    <
                                        ~
<<              \ll                     << 
<-              \leftarrow              <-
<=              \Leftarrow              <=
@end example

  You can define your favorite key-vs-sequence completion table in the
Emacs-Lisp variable @code{YaTeX-math-sign-alist-private}.  See also
@file{yatexmth.el} for the information of the structure of this variable.

@node Greek letters completion,  , Image completion, Completion
@comment  node-name,  next,  previous,  up
@section Greek letters completion
@cindex Greek letters completion
@cindex /

  Math-mode of YaTeX provides another image completion, Greek letters
completion in the same method.  After prefix @kbd{/}, typing @kbd{a} makes
@code{\alpha}, @kbd{b} makes @code{\beta} and @kbd{g} makes @code{\gamma}
and so on.  First, type @kbd{/TAB} to know all the correspondence of
alphabets v.s. Greek letters.

  If you will find @kbd{;} or @kbd{/} doesn't work in correct position of
math environment, it may be a bug of YaTeX.  Please send me a bug report
with the configuration of your text, and avoid it temporarily by typing
@kbd{;} or @kbd{/} after universal-argument(@kbd{C-u}) which forces
@kbd{;} and @kbd{/} to work as math-prefix.

@node Commenting out, Cursor jump, Completion, Top
@comment  node-name,  next,  previous,  up
@chapter Commenting out
@cindex commenting out
@cindex prefix >
@cindex prefix <
@cindex prefix ,
@cindex prefix .

  You may want to comment out some region.

@table @kbd
@item [prefix] >
	@dots{}	comment out region by %
@item [prefix] <
	@dots{}	uncomment region
@end table

@noindent
cause an operation to the region between point and mark.

@table @kbd
@item [prefix] .
	@dots{}	comment out current paragraph
@item [prefix] ,
	@dots{}	uncomment current paragraph
@end table

@noindent
comments or  uncomments the paragraph  where the  cursor  belongs.
This  `paragraph' means   the   region marked    by  the  function
mark-paragraph,  bound    to  @kbd{ESC h}   by   default.   It  is NOT
predictable  what will happen  when you  continuously  comment out
some paragraph many times.

  You can also comment out an environment between @code{\begin} and
@code{\end}, or a @code{\begin}-\@code{\end} pair themselves, by making the
following key strokes on the line where @code{\begin@{@}} or
@code{\end@{@}} exists.

@table @kbd
@item [prefix] >
	@dots{}	comment out from \begin to \@code{end}
@item [prefix] <
	@dots{}	uncomment from \begin to \@code{end}
@end table

@noindent
comment whole the contents of environment.  Moreover,

@table @kbd
@item [prefix] .
	@dots{}	comment out \begin and \@code{end}
@item [prefix] ,
	@dots{}	uncomment \begin and \@code{end}
@end table

@noindent
(un)comments out only environment declaration: @code{\begin@{@}} and
@code{\end@{@}}.  NOTE that even if you intend to comment out some region,
invoking @kbd{[prefix] >} on the @code{\begin},@code{\end} line decides to
work in `commenting out from @code{\begin} to @code{\end}' mode.


@node Cursor jump, Changing and Deleting, Commenting out, Top
@comment  node-name,  next,  previous,  up
@chapter Cursor jump
@cindex cursor jump
@cindex prefix g

  On a @code{\begin},@code{\end} line, the key stroke

@table @kbd
@item [prefix] g
	@dots{}	go to corresponding object
@end table

@noindent
moves the cursor to the corresponding @code{\end},@code{\begin} line, if
its partner really exists.  It is also applicable to A @code{%#BEGIN} and
@code{%#END} pair.

  If you type @code{[prefix] g} on the line of @code{\include@{chap1@}},
maybe	in main text, YaTeX switches buffer to @file{chap1.tex}.  On the
contrary, the key strokes

@table @kbd
@item [prefix] ^
	@dots{}	visit main file
@item [prefix] 4^
	@dots{}	visit main file in other buffer
@end table
@cindex prefix ^
@cindex prefix 4 ^

in a sub text switch the buffer to the main text specified by
@code{%#!}  notation.

  And these are the functions which work on the current La@TeX{}
environment:

@table @kbd
@item M-C-a
	@dots{}	beginning of environment
@item M-C-e
	@dots{}	@code{end} of environment
@item M-C-@@
	@dots{}	mark environment
@end table
@cindex M-C-a
@cindex M-C-e
@cindex M-C-@@

@node Changing and Deleting, Filling an item, Cursor jump, Top
@comment  node-name,  next,  previous,  up
@chapter Changing and Deleting

  These  functions  are for change or   deletion of La@TeX{} commands
already entered.

@table @kbd
@item [prefix] c
	@dots{}	change La@TeX{} command
@item [prefix] k
	@dots{}	kill La@TeX{} command
@end table
@cindex prefix c
@cindex prefix k

@kbd{[prefix] c} can change the name of the corresponding environment
declaration. @kbd{[prefix] k} works as follows:

@example
[Invoking position]             [action]
\begin,\end line                kill \begin,\end pairs
%BEGIN, %END line               kill %BEGIN,%END pairs
on a Section-type command       kill section-type command
on a parenthesis                kill parentheses
@end example

While all operations above are to kill `containers' which surround some
text, universal argument (@kbd{C-u}) for these commands kills not only
`containers' but also `contents' of them.  See below as a sample.

@example
Original text:			[prefix] k	C-u [prefix] k
Main \footnote@{note@} here.	Main note here.	Main  here.
       ~(cursor)
@end example

@node Filling an item, Local dictionaries, Changing and Deleting, Top
@comment  node-name,  next,  previous,  up
@chapter Filling an item
@cindex filling an item
@cindex prefix i

  To fill a term (sentence) of @code{\item}, type

@table @kbd
@item [prefix] i
	@dots{}	fill item
@end table

@noindent
on that item.

  YaTeX uses the value of  the variable @code{YaTeX-item-regexp} as the
regular expression to search item header  in  itemize environment.
If you make a newcommand to itemize terms(eg. @code{\underlineitem}), put

@lisp
 	(setq YaTeX-item-regexp
	      "\\(\\\\item\\)\\|\\(\\\\underlineitem\\)")
@end lisp
@cindex YaTeX-item-regexp

in your @file{~/.emacs}.  If you are not familiar with regular expression
for Emacs-Lisp, name  a newcommand  for  `itemize' beginning  with
@code{\item} such as @code{\itembf}, not @code{\bfitem}.

@node Local dictionaries, Updation of @code{\includeonly}, Filling an item, Top
@comment  node-name,  next,  previous,  up
@chapter Local dictionaries
@cindex local dictionaries
@cindex nervous users

  Tables for completion consist of three dictionaries; `standard
dictionary' built in @file{yatex.el}, `user dictionary' for your common
private commands, and `local dictionary' that is effective in a certain
directory.

  When you input the command unknown to YaTeX at a completion in the
minibuffer, YaTeX asks you with the following prompt;

@example
  `foo' is not in table. Register into: U)serTable L)ocal N)one
@end example

@noindent 
In this menu, typing `u' updates your `user dictionary', `l' updates your
local dictionary, and `n' updates no dictionary and throws the word away.

  If you find this switching feature meaningless and bothersome, put the
next expression into your @file{~/.emacs}

@lisp
 	(setq YaTeX-nervous nil)
@end lisp

@node Updation of @code{\includeonly}, What column?, Local dictionaries, Top
@comment  node-name,  next,  previous,  up
@chapter Updation of @code{\includeonly}
@cindex includeonly

  When you edit splitting source texts, the notation

@example
	\includeonly@{CurrentEditingFileName@}
@end example

@noindent
in the main file reduces the time of typesetting.  If you want
to hack other file a little however, you have to rewrite it to

@example
	\includeonly@{OtherFileNameYouWantToFix@}
@end example

@noindent
in the main file.  YaTeX automatically detects that the current
edited text is not in includeonly list and prompts you

@example
 	A)dd R)eplace %)comment?
@end example

in the minibuffer.  Type @kbd{a} if you want to add the current file name
to @code{\includeonly} list, @kbd{r} to replace \@code{includeonly} list
by the current file, and type @kbd{%} to comment out the
@code{\includeonly} line.

@node What column?, Intelligent newline, Updation of @code{\includeonly}, Top
@comment  node-name,  next,  previous,  up
@chapter What column?
@cindex what column
@cindex complex tabular
@cindex prefix &

  We  are often get  tired of  finding the corresponding column in
large tabulars.  For example,

@example
        \begin@{tabular@}@{|c|c|c|c|c|c|c|c|@}\hline
         Name&Position&Post No.&Addr.&Phone No.&FAX No.&
                Home Addr.&Home Phone\\ \hline
         Thunder Bird & 6 & 223 & LA & xxx-yyy &
          zzz-www & Japan & 9876-54321 \\
           & 2 & \multicolumn@{2@}@{c|@}@{Unknown@}
                &&&(???)
         \\ \hline
         \end@{tabular@}
@end example

Suppose you have the cursor located  at @code{(???)} mark, can you tell
which  column it is  belonging  at once?  Maybe no.  In such case,
type

@table @kbd
@item [prefix] &
	@dots{}	What column
@end table

@noindent
in  that position.   YaTeX  tells you  the  column header  of  the
current  field.  Since  YaTeX  assumes  the  first line of tabular
environment  as a row of column  headers, you  can  create a row of
virtual column  headers by  putting  them  in the  first line  and
commenting that line with @code{%}.

@node Intelligent newline, Online help, What column?, Top
@comment  node-name,  next,  previous,  up
@chapter Intelligent newline
@cindex Intelligent newline
@cindex ESC RET
@cindex M-C-m

  In tabular[*], array, itemize, enumerate or tabbing environment,

@table @kbd
@item ESC RET
	@dots{} Intelligent newline
@end table

@noindent 
inserts the contents corresponding to the current environment in the next
line.  In @code{tabular} environment, for example, @kbd{ESC RET} inserts
the certain number of @code{&} and trailing @code{\\}, and @code{\hline}
if other @code{\hline} is found in backward.  Here are the list of
contents v.s. environments.

@itemize
@item @code{tabular}, @code{tabular*}, @code{array}

	Corresponding number of @code{&} and  @code{\\}.
	And @code{\hline} if needed.

@item @code{tabbing}

	The same number of @code{\>} as @code{\=} in the first line.

@item @code{itemize}, @code{enumerate}, @code{description}, @code{list}

	@code{\item} or @code{item[]}.
@end itemize

  Note that since this function works seeing the contents of the first
line, please call this after the second line if possible.

  If you want to apply these trick to other environments, @code{foo}
environment for example, define the function named
@code{YaTeX-intelligent-newline-foo} to insert corresponding contents.
That function will be called at the beginning of the next line after the
newline is inserted to the current line.  Since the function
@code{YaTeX-indent-line} is designed to indent the current line properly,
calling this function before your code to insert certain contents must be
useful.  See the definition of the function
@code{YaTeX-intelligent-newline-itemize} as an example.

@node Online help, Cooperation with other packages, Intelligent newline, Top
@comment  node-name,  next,  previous,  up
@chapter Online help
@cindex online help
@cindex prefix ?
@cindex prefix /
@cindex apropos
@cindex keyword search

  YaTeX provides you the online help with popular La@TeX{} commands.

  Here are the key strokes for the online help.

@table @kbd
@item [prefix] ?
	@dots{}	Online help
@item [prefix] /
	@dots{}	Online apropos
@end table

@section Online help

  `Online help' shows the documentation for the popular La@TeX{}
commands(defaults to the commands on the cursor) in the next buffer.
There are two help file, `global help' and `private help'.  The former
file contains the descriptions on the standard La@TeX{} command and is
specified its name by variable @code{YaTeX-help-file}.  Usually, the
global help file should be located in public space (@code{$EMACSEXECPATH}
by default) and should be world writable so that anyone can update it to
enrich its contents.  The latter file contains descriptions on
non-standard or personal command definitions and is specified by
@code{YaTeX-help-file-private}.  This file should be put into private
directory.

@section Online apropos

  `Online  apropos' is an  equivalent  of GNU Emacs's apropos.  It
shows all the documentations that contains  the keyword entered by
the user.

@section When no descriptions are found...

  If there is no description  on a command   in help files,  YaTeX
requires you to  write a description on  that command.  If you are
willing  to  do, determine  which help file  to add and  write the
description on it referring  your manual of (La)TeX.  Please  send
me your additional descriptions if you  describe  the help on some
standard commands.   I might  want    to include it  in   the next
distribution.

@node Cooperation with other packages, Customizations, Online help, Top
@comment  node-name,  next,  previous,  up
@chapter Cooperation with other packages

  YaTeX works better with other brilliant packages.

@section gmhist
@cindex gmhist
@cindex command history
@cindex minibuffer history

  When you are loading @file{gmhist.el} and @file{gmhist-mh.el}, you can
use independent command history list at the prompt of preview command
(@kbd{[prefix] tp}) and print command (@kbd{[prefix] tl}).  On each
prompt, you can enter the previous command line string repeatedly by
typing @kbd{M-p}.

@section min-out
@cindex min-out

  @file{min-out}, the outline minor mode,  can  be used in yatex-mode
buffers.  If you want to use it with YaTeX, please refer the
file @file{yatexm-o.el} as an example.

@node Customizations, Etcetera, Cooperation with other packages, Top
@comment  node-name,  next,  previous,  up
@chapter Customizations
@cindex customizations

  You can customize YaTeX by setting Emacs-Lisp variables and by making
add-in functions.

@menu
* Lisp variables::              
* Add-in functions::            
@end menu

@node Lisp variables, Add-in functions, Customizations, Customizations
@comment  node-name,  next,  previous,  up
@section Lisp variables
@cindex customizable variables

  You   can change the   key assignments or   make completion more
comfortable  by  setting the values   of   various variables which
control the movement of yatex-mode.

  For example, if you want to change the prefix key stroke from @kbd{C-c}
to any other sequence, set YaTeX-prefix to whatever you want to use.  If
you don't want to use the key sequence @kbd{C-c letter} which is assumed
to be the user reserved sequence in Emacs world, set
@code{YaTeX-inhibit-prefix-letter} to @code{t}, and all of the default key
bind of @kbd{C-c letter} will turn to the corresponding @kbd{C-c C-letter}
(but the region based completions that is invoked with @kbd{C-c
Capital-letter} remain valid, if you want to disable those bindings, set
that variable to 1 instead of @code{t}).

@menu
* All customizable variables::  
* Sample definitions::          
* Hook variables::              
* Hook file::                   
@end menu

@node All customizable variables, Sample definitions, Lisp variables, Lisp variables
@comment  node-name,  next,  previous,  up
@subsection All customizable variables
@cindex all customizable variables

  Here are the customizable variables of yatex-mode.  Each value setq-ed
in @file{~/.emacs} is preferred and that of defined in @file{yatex.el} is
neglected.  Parenthesized contents stands for the default value.

@table @samp
@item YaTeX-prefix

	Prefix key stroke (@kbd{C-c})

@item YaTeX-inhibit-prefix-letter

        Change key stroke from @kbd{C-c letter} to @kbd{C-c C-letter}
        (@code{nil})

@item YaTeX-fill-prefix

	Fill-prefix used in yatex-mode (@code{nil})

@item YaTeX-open-lines

	Number of blank lines between cursor and @code{\begin@{@}},
        @code{\@code{end}@{@}} (0)

@item YaTeX-user-completion-table

	Name of user dictionary where learned completion table will be stored.
        (@code{"~/.yatexrc"})

@item YaTeX-item-regexp

	Regular expression of item command(@code{"\\\\item"})

@item tex-command

	La@TeX{} typesetter command (@code{"latex"})

@item dvi2-command

	Preview command
        (@code{"xdvi -geo +0+0 -s 4 -display (getenv"DISPLAY")"})

@item dviprint-command-format

	Command format to print dvi file (@code{"dvi2ps %f %t %s | lpr"})

@item dviprint-from-format

	Start page format of above %f. %b will turn to start page
        (@code{"-f %b"})

@item dviprint-to-format

	End page format of above %t. %e will turn to @code{end} page
        (@code{"-t %e"})

@item section-name

	Initial default value at the first section-type completion
        (@code{"documentstyle"})

@item env-name

	Initial default value at the first begin-type completion
        (@code{"document"})

@item fontsize-name

	Ditto of large-type (@code{"large"})

@item single-command

	Ditto of maketitle-type (@code{"maketitle"})

@item YaTeX-need-nonstop

	Put @code{\nonstopmode@{@}} or not (@code{nil})

@item latex-warning-regexp

	Regular expression of warning message latex command puts out
        (@code{"line.* [0-9]*"})

@item latex-error-regexp

	Regular expression of error message (@code{"l\\.[1-9][0-9]*"})

@item latex-dos-emergency-message

	Message latex command running on DOS puts at abort
        (@code{"Emergency stop"})

@item YaTeX-item-regexp

	Regexp of La@TeX{} itemization command (@code{"\\\\(sub\\)*item"})

@item 	YaTeX-nervous

	T for using local dictionary (@code{t})

@item YaTeX-sectioning-regexp

	Regexp of La@TeX{} sectioning command

	(@code{"part\\|chapter\\|\\(sub\\)*\\(section\\|paragraph\\)"})

@item YaTeX-fill-inhibit-environments

        Inhibit fill in these environments (@code{'("verbatim" "tabular")})

@item YaTeX-uncomment-once

	@code{T} for deleting all preceding @code{%} (@code{nil})

@item YaTeX-close-paren-always

	@code{T} for always close all parenthesis automatically,
        @code{nil} for only eol(@code{t})

@item YaTeX-auto-math-mode

	Switch math-mode automatically(@code{t})

@item YaTeX-default-pop-window-height

        Initial height of typesetting buffer when one-window.
        Number for the lines of the buffer, numerical string for
        the percentage of the screen-height.
        @code{nil} for half height(10)

@item YaTeX-help-file

	Global online help file name (@file{$EMACS/etc/YATEXHLP.jp})

@item YaTeX-help-file-private

	Private online help file name (@file{"~/YATEXHLP.jp"})

@item YaTeX-no-begend-shortcut

	Disable [prefix] b ?? shortcut (@code{nil)}
@end table

@node Sample definitions, Hook variables, All customizable variables, Lisp variables
@comment  node-name,  next,  previous,  up
@subsection Sample definitions
@cindex prefix key stroke
@cindex fill-prefix

 For instance, to change the prefix key stroke to @kbd{ESC}, and name of
the user dictionary @file{~/src/emacs/yatexrc}, and set @code{fill-prefix}
to single TAB character, add the following @code{setq} to @file{~/.emacs}.

@lisp
 	(setq YaTeX-prefix "\e"
	      YaTeX-user-completion-table "~/src/emacs/yatexrc"
	      YaTeX-fill-prefix "	")
@end lisp

@node Hook variables, Hook file, Sample definitions, Lisp variables
@comment  node-name,  next,  previous,  up
@subsection Hook variables
@cindex hook variables

  More customizations will be done by the hook-function defined in
hook-variable @code{yatex-mode-hook}.  This is useful to define a shortcut
key sequence to enter some environments other than @code{document} and
@code{enumerate} etc.  The following statement defines @code{[prefix] ba}
to enter @code{\begin@{abstract@}} ...  @code{=end@{abstract@}}
immediately.

@lisp
 	(setq yatex-mode-hook
	      '(lambda() (YaTeX-define-begend-key "ba" "abstract")))
@end lisp

	You should use functions @code{YaTeX-define-key}, or
@code{YaTeX-define-begend-key} 	to define all the key sequences of
yatex-mode.

@node Hook file,  , Hook variables, Lisp variables
@comment  node-name,  next,  previous,  up
@subsection Hook file
@cindex hook file

  You can stuff all of YaTeX relating expressions into a file named
@file{yatexhks.el} if you have a lot of codes.  YaTeX automatically load
this file at the initialization of itself.  Using @file{yatexhks.el}
makes @code{yatex-mode-load-hook} unnecessary.

@node Add-in functions,  , Lisp variables, Customizations
@comment  node-name,  next,  previous,  up
@section Add-in functions
@cindex add-in functions

  You can easily  define  a function to input  detailed  arguments
with completion according  to La@TeX{} environments  or commands.  To
know the way to define these functions, see also @file{yatexadd.doc} in
this package please.


@node Etcetera, Copying, Customizations, Top
@comment  node-name,  next,  previous,  up
@chapter Etcetera

  The standard completion  tables provided  in @file{yatex.el} contain  a
few La@TeX{}  commands  I frequently use.  This is  to lessen the key
strokes to  complete  entire  word, because   too  many candidates
rarely used  often cause too many  hits.   Therefore always try to
use completion  in order to  enrich your dictionary,  and you will
also find `Wild Bird' growing suitable for your La@TeX{} style.


@node Copying,  , Etcetera, Top
@comment  node-name,  next,  previous,  up
@chapter Copying

  This program  is distributed   as a   free  software.   You  can
redistribute this software freely but with NO warranty to anything
as a result  of using this  software.   However, any  reports  and
suggestions are  welcome as  long as I   feel  interests in   this
software.   My possible  e-mail address is  `yuuji@@ae.keio.ac.jp'.
(up to Mar.1993 at least)

  The specification of this software will be surely modified
(depending on my feelings) without notice :-p.


@flushright
                                                        HIROSE Yuuji
@end flushright
@bye

Local variables:
mode: texinfo
fill-prefix: nil
fill-column: 74
End:
