yatex

view docs/yatexe.tex @ 242:cb4449ecb9f3

Refer to %#MAKEINDEX and %#BIBTEX.
author yuuji@gentei.org
date Sun, 29 Jan 2012 23:01:57 +0900
parents bd0a9177e5e7
children 0b10d1fea265
line source
1 \def\lang{jp} % -*- texinfo -*-
2 \input texinfo.tex
3 @setfilename yatexe
4 @settitle Yet Another tex-mode for Emacs
6 @iftex
7 @c @syncodeindex fn cp
8 @c Last modified Sun Jan 29 22:55:53 2012 on firestorm
9 @syncodeindex vr cp
10 @end iftex
12 @titlepage
13 @sp 10
14 @center
15 @subtitle Yet Another tex-mode for emacs
16 @title Wild Bird
17 @subtitle // YaTeX //
18 @author @copyright{} 1991-2003 by HIROSE, Yuuji [yuuji@@yatex.org]
19 @end titlepage
21 @node Top, What is YaTeX?, (dir), (dir)
22 @comment node-name, next, previous, up
23 @cindex Demacs
24 @cindex Mule
25 @cindex LaTeX
26 @cindex YaTeX
28 @menu
29 * What is YaTeX?::
30 * Main features:: What YaTeX can do
31 * Installation:: Guide to install
32 * Typesetting:: Call typesetting processes
33 * %#notation:: Meta-keyword `%#'
34 * Completion:: Input LaTeX commands with completion
35 * Local dictionaries:: Directory dependent completion
36 * Commenting out:: Commenting/uncommenting text
37 * Cursor jump:: Jumping to related position
38 * Changing and Deleting:: Changing/deleting certain unit of text
39 * Filling:: Filling an item or paragraph
40 * Updation of includeonly:: Free from maintaining includeonly
41 * What column:: Check what table-column the cursor belong
42 * Intelligent newline:: Guess requisites of new line
43 * Usepackage checker:: Selecting correct \usepackage is YaTeX's job
44 * Online help:: On-line documentation of LaTeX
45 * Browsing file hierarchy:: Walking through file hierarchy
46 * Cooperation with other packages:: Work well with gmhist, min-out
47 * Customizations:: How to breed `Wild Bird'
48 * Etcetera:: YaTeX is acquisitive.
49 * Copying:: Redistribution
52 @node What is YaTeX?, Main features, Top, Top
53 @comment node-name, next, previous, up
54 @chapter What is YaTeX?
56 YaTeX automates typesetting and previewing of LaTeX and enables
57 completing input of LaTeX mark-up command such as
58 @code{\begin@{@}}..@code{\end@{@}}.
60 YaTeX also supports Demacs which runs on MS-DOS(386), Mule (Multi
61 Language Enhancement to GNU Emacs), and latex on DOS.
63 @node Main features, Installation, What is YaTeX?, Top
64 @comment node-name, next, previous, up
65 @chapter Main features
67 @itemize
68 @item Invocation of typesetter, previewer and related programs(@kbd{C-c t})
69 @item Typesetting on static region which is independent from point
70 @item Semiautomatic replacing of @code{\includeonly}
71 @item Jumping to error line(@kbd{C-c '})
72 @item Completing-read of La@TeX{} commands such as @code{\begin@{@}},
73 @code{\section} etc.
74 (@kbd{C-c b}, @kbd{C-c s}, @kbd{C-c l}, @kbd{C-c m})
75 @item Enclosing text into La@TeX{} environments or commands
76 (@kbd{C-u} @var{AboveKeyStrokes})
77 @item Displaying the structure of text at entering sectioning commands
78 @item Lump shifting of sectioning commands (@ref{view-sectioning})
79 @item Learning unknown/new La@TeX{} commands for the next completion
80 @item Argument reading with a guide for complicated La@TeX{} commands
81 @item Generating argument-readers for new/unsupported commands(@file{yatexgen})
82 @item Quick changing or deleting of La@TeX{} commands(@kbd{C-c c}, @kbd{C-c k})
83 @item Jumping from and to inter-file, begin<->end, ref<->label(@kbd{C-c g})
84 @item Blanket commenting out or uncommenting
85 (@kbd{C-c >}, @kbd{C-c <}, @kbd{C-c ,}, @kbd{C-c .})
86 @item Easy input of accent mark, math-mode's commands and Greek letters
87 (@kbd{C-c a}, @kbd{;}, @kbd{:})
88 @item Online help for the popular La@TeX{} commands
89 (@kbd{C-c ?}, @kbd{C-c /})
90 @item Document files hierarchy browser (@kbd{C-c d})
91 @item Adding automatically \usepackage corresponding to inputting LaTeX
92 macro with completion
93 @item Allow you to forget creating \label{}s, \ref or \cite completion
94 automatically generate labels.
95 @end itemize
97 @node Installation, Typesetting, Main features, Top
98 @comment node-name, next, previous, up
99 @chapter Installation
100 @cindex installation
101 @cindex .emacs
102 @cindex auto-mode-alist
103 @cindex autoload
105 Put next two expressions into your @file{~/.emacs}.
107 @lisp
108 (setq auto-mode-alist
109 (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist))
110 (autoload 'yatex-mode "yatex" "Yet Another La@TeX{} mode" t)
111 @end lisp
113 Next, add certain path name where you put files of YaTeX to your
114 load-path. If you want to put them in @file{~/src/emacs}, write
116 @lisp
117 (setq load-path
118 (cons (expand-file-name "~/src/emacs") load-path))
119 @end lisp
121 @noindent
122 in your @file{~/.emacs}
124 Then, yatex-mode will be automatically loaded when you visit a
125 file which has extension @file{.tex}. If yatex-mode is successfully
126 loaded, mode string on mode line will be turned to "YaTeX".
129 @node Typesetting, %#notation, Installation, Top
130 @comment node-name, next, previous, up
131 @chapter Typesetting
132 @cindex typesetting
133 @cindex previewer
134 @cindex typesetter
135 @cindex latex
136 @cindex printing out
138 The prefix key stroke of yatex-mode is @kbd{C-c} (Press 'C' with Control
139 key) by default. If you don't intend to change the prefix key stroke,
140 assume all @kbd{[prefix]} as @kbd{C-c} in this document. These key
141 strokes execute typeset or preview command.
143 @table @kbd
144 @item [prefix] t j
145 @dots{} invoke latex
146 @item [prefix] t r
147 @dots{} invoke latex on region
148 @item [prefix] t e
149 @dots{} invoke latex on current environment or whole
150 portion of current formulas in math-mode.
151 @item [prefix] t d
152 @dots{} invoke dvipdfmx after successful typesetting
153 @item [prefix] t k
154 @dots{} kill current typesetting process
155 @item [prefix] t b
156 @dots{} invoke bibtex
157 @item [prefix] t i
158 @dots{} invoke makeindex
159 @item [prefix] t d
160 @dots{} invoke latex && dvipdfmx
161 @item [prefix] t p
162 @dots{} preview
163 @item [prefix] t l
164 @dots{} lpr dvi-file
165 @item [prefix] t s
166 @dots{} search current string on xdvi-remote
167 @end table
169 @menu
170 * Calling typesetter::
171 * Calling previewer::
172 * Printing out::
173 @end menu
175 @node Calling typesetter, Calling previewer, Typesetting, Typesetting
176 @comment node-name, next, previous, up
177 @section Calling typesetter
179 Typing @kbd{[prefix] t j}, the current editing window will be divided
180 horizontally when you invoke latex command, and log message of La@TeX{}
181 typesetting will be displayed in the other window; called typesetting
182 buffer. The typesetting buffer automatically scrolls up and traces
183 La@TeX{} warnings and error messages. If you see latex stopping by an
184 error, you can send string to latex in the typesetting buffer.
186 If an error stops the La@TeX{} typesetting, this key stroke will
187 move the cursor to the line where La@TeX{} error is detected.
189 @table @kbd
190 @item [prefix] '
191 @itemx ([prefix]+single quotation)
193 @dots{} jump to the previous error or warning
194 @end table
196 If you find a noticeable error, move to the typesetting buffer and move
197 the cursor on the line of error message and type @kbd{SPACE} key. This
198 makes the cursor move to corresponding source line.
200 YaTeX-typeset-region invoked by @kbd{[prefix] tr} call typesetter
201 for region. The region is specified by standard point and mark, or
202 by @code{%#BEGIN} and @code{%#END} marks. Selected region will be
203 copied to the temporary file @file{texput.tex} with the same preamble
204 as the main file of current editing sources. Be sure to put
205 all local macro settings in preamble, not after @code{\begin{document}}.
206 The method of specification of the region is shown in the
207 section @xref{%#notation}.
209 The documentclass for typeset-region is the same as that of editing
210 file if you edit one file, and is the same as main file's if you
211 edit splitting files.
213 The @kbd{[prefix] te} key automatically marks current inner environment
214 or inner math mode and then call typeset-region with marked region. This
215 is convenient to quick view of current tabular environment or current
216 editing formulas. Keeping previewer window for @file{texput.dvi} is handy
217 for debugging. Since @kbd{[prefix] te} selects the inner-most environment
218 as region, it is not suitable for partial typesetting of doubly or more
219 composed environment. If you want to do partial typesetting for a nested
220 environment, use @kbd{[prefix] tr} for static-region, which is described
221 in the section @xref{%#notation}.
223 @node Calling previewer, Printing out, Calling typesetter, Typesetting
224 @comment node-name, next, previous, up
225 @section Calling previewer
227 @kbd{[prefix] t p} invokes the TeX previewer. And if you are using
228 xdvi-remote, which can be controled from other terminals, @kbd{[prefix] t
229 s} enables you to search current string at the cursor on the running xdvi
230 window.
232 @node Printing out, , Calling previewer, Typesetting
233 @comment node-name, next, previous, up
234 @section Printing out
236 When you type @code{[preifx] t l}, YaTeX asks you the range of
237 dvi-printing by default. You can skip this by invoking it with
238 universal-argument as follows:
240 @example
241 C-u [prefix] tl
242 @end example
244 @node %#notation, Completion, Typesetting, Top
245 @comment node-name, next, previous, up
246 @chapter %# notation
247 @cindex %# notation
249 You can control the typesetting process by describing @code{%#}
250 notations in the source text.
252 @menu
253 * Changing typesetter::
254 * Splitting input files::
255 * Static region for typesetting::
256 * Lpr format::
257 * Editing %# notation::
258 @end menu
260 @node Changing typesetter, Splitting input files, %#notation, %#notation
261 @comment node-name, next, previous, up
262 @section To change the `latex' command or to split a source text.
263 @cindex typesetter
265 To change the typesetting command, write
267 @example
268 %#!latex-big
269 @end example
271 @noindent
272 anywhere in the source text. This is useful for changing
273 typesetter.
275 @node Splitting input files, Static region for typesetting, Changing typesetter, %#notation
276 @comment node-name, next, previous, up
277 @section Splitting input files
279 And if you split the source text and
280 edit subfile that should be included from main text.
282 @example
283 %#!latex main.tex
284 @end example
286 @noindent
287 will be helpful to execute latex on main file from sub text buffer. Since
288 this command line after @kbd{%#!} will be sent to shell literally, next
289 description makes it convenient to use ghostview as dvi-previewer.
291 @example
292 %#!latex main && dvi2ps main.dvi > main
293 @end example
295 @noindent
296 Note that YaTeX assumes the component before the last period of
297 the last word in this line as base name of the main La@TeX{} source.
298 The @code{%f} notation in this line is replaced by main file name, and
299 @code{%r} replaced by root name of main file name. If you specify
300 @code{%f} or @code{%r}, YaTeX always ask you the name of main file at the
301 first typesetting.
303 To make best use of the feature of inter-file jumping by
304 @kbd{[prefix] g} (see @ref{Cursor jump}), take described below into
305 consideration.
307 @itemize
308 @item You can put split texts in sub directory, but not in
309 sub directory of sub directory.
310 @item In the main text, specify the child file name with relative path name
311 such as \include@{chap1/sub@}, when you include the file in
312 a sub-directory.
313 @item In a sub-text, write @code{%#!latex main.tex} even if @file{main.tex}
314 is in the parent directory(not %#!latex ../main.tex).
315 @end itemize
317 @node Static region for typesetting, Lpr format, Splitting input files, %#notation
318 @comment node-name, next, previous, up
319 @section Static region
320 @cindex static region
321 @cindex Fixed region
323 Typeset-region by @kbd{[prefix] tr} passes the region between point and
324 mark to typesetting command by default. But when you want to typeset
325 static region, enclose the region by @code{%#BEGIN} and @code{%#END} as
326 follows.
328 @example
329 %#BEGIN
330 TheRegionYouWantToTypesetManyTimes
331 %#END
332 @end example
334 This is the rule of deciding the region.
336 @enumerate
337 @item
338 If there exists %#BEGIN before point,
340 @enumerate
341 @item
342 If there exists %#END after %#BEGIN,
343 @itemize
344 @item From %#BEGIN to %#END.
345 @end itemize
347 @item
348 If %#END does not exist after %#BEGIN,
349 @itemize
350 @item From %#BEGIN to the end of buffer.
351 @end itemize
352 @end enumerate
354 @item
355 If there does not exist %#BEGIN before point,
356 @itemize
357 @item Between point and mark(standard method of Emacs).
358 @end itemize
359 @end enumerate
361 It is useful to write @code{%#BEGIN} in the previous line of \begin and
362 @code{%#END} in the next line of \@code{end} when you try complex
363 environment such as `tabular' many times. It is also useful to put only
364 @code{%#BEGIN} alone at the middle of very long text. Do not forget to
365 erase @code{%#BEGIN} @code{%#END} pair.
367 @node Lpr format, Editing %# notation, Static region for typesetting, %#notation
368 @comment node-name, next, previous, up
369 @section Lpr format
370 @cindex lpr format
372 Lpr format is specified by three Lisp variables. Here are the
373 default values of them.
375 @table @code
376 @item (1)dviprint-command-format
377 @code{"dvi2ps %f %t %s | lpr"}
378 @item (2)dviprint-from-format
379 @code{"-f %b"}
380 @item (3)dviprint-to-format
381 @code{"-t %e"}
382 @end table
384 On YaTeX-lpr, @code{%s} in (1) is replaced by the file name of main
385 text, @code{%f} by contents of (2), %t by contents of (3). At these
386 replacements, @code{%b} in (2) is also replaced by the number of beginning
387 page, @code{%e} in (3) is replaced by the number of ending page. But
388 @code{%f} and @code{%t} are ignored when you omit the range of print-out
389 by @kbd{C-u [prefix] tl}.
391 If you want to change this lpr format temporarily, put a command
392 such as follows somewhere in the text:
394 @example
395 %#LPR dvi2ps %f %t %s | 4up -page 4 | texfix | lpr -Plp2
396 @end example
398 And if you want YaTeX not to ask you the range of printing
399 out, the next example may be helpful.
401 @example
402 %#LPR dvi2ps %s | lpr
403 @end example
405 @node Controlling which command to invoke, Editing %# notation, lpr format, %#notation
406 @comment node-name, next, previous, up
407 @section Controlling which command to invoke
409 These %# notation below can control which command to invoke for
410 La@TeX{} related process.
412 @table @code
413 @item %#BIBTEX
414 @dots{} Command line for makeindex ([prefix] t i)
415 @item %#MAKEINDEX
416 @dots{} Command line for bibtex ([prefix] t b)
417 @end table
419 If you want to invoke ``makeidx hogehoge'' to update index,
420 put the next line some upper place in the source, for example.
422 @example
423 %#MAKEINDEX makeidx hogehoge
424 @end example
427 @node Editing %# notation, , Lpr format, %#notation
428 @comment node-name, next, previous, up
429 @section Editing %# notation
431 To edit @code{%#} notation described above, type
433 @table @kbd
434 @item [prefix] %
435 @dots{} editing %# notation menu
436 @end table
438 @noindent
439 and select one of the entry of the menu as follows.
441 @example
442 !)Edit-%#! B)EGIN-END-region L)Edit-%#LPR
443 @end example
445 @noindent
446 Type @kbd{!} to edit @code{%#!} entry, @code{b} to enclose the region with
447 @code{%#BEGIN} and @code{%#END}, and @code{l} to edit @code{%#LPR} entry.
448 When you type @kbd{b}, all @code{%#BEGIN} and @code{%#END} are
449 automatically erased.
451 @node Completion, Local dictionaries, %#notation, Top
452 @comment node-name, next, previous, up
453 @chapter Completion
454 @cindex completion
456 YaTeX makes it easy to input the La@TeX{} commands. There are several
457 kinds of completion type, begin-type, section-type, large-type, etc...
459 @menu
460 * Begin-type completion::
461 * Section-type completion::
462 * Large-type completion::
463 * Maketitle-type completion::
464 * Arbitrary completion::
465 * End completion::
466 * Accent completion::
467 * Image completion::
468 * Greek letters completion::
469 @end menu
471 @node Begin-type completion, Section-type completion, Completion, Completion
472 @comment node-name, next, previous, up
473 @section Begin-type completion
474 @cindex begin-type completion
475 @cindex environment
476 @cindex prefix b
478 "Begin-type completion" completes commands of @code{\begin@{env@}} ...
479 @code{\end@{env@}}. All of the begin-type completions begin with this key
480 sequence.
482 @table @kbd
483 @item [prefix] b
484 @dots{} start begin-type completion
485 @end table
487 @noindent
488 An additional key stroke immediately completes a frequently used
489 La@TeX{} @code{\begin@{@}}...@code{\@code{end}@{@}} environment.
491 @table @kbd
492 @item [prefix] b c
493 @dots{} @code{\begin@{center@}...\end@{center@}}
494 @item [prefix] b d
495 @dots{} @code{\begin@{document@}...\end@{document@}}
496 @item [prefix] b D
497 @dots{} @code{\begin@{description@}...\end@{description@}}
498 @item [prefix] b e
499 @dots{} @code{\begin@{enumerate@}...\end@{enumerate@}}
500 @item [prefix] b E
501 @dots{} @code{\begin@{equation@}...\end@{equation@}}
502 @item [prefix] b i
503 @dots{} @code{\begin@{itemize@}...\end@{itemize@}}
504 @item [prefix] b l
505 @dots{} @code{\begin@{flushleft@}...\end@{flushleft@}}
506 @item [prefix] b m
507 @dots{} @code{\begin@{minipage@}...\end@{minipage@}}
508 @item [prefix] b t
509 @dots{} @code{\begin@{tabbing@}...\end@{tabbing@}}
510 @item [prefix] b T
511 @dots{} @code{\begin@{tabular@}...\end@{tabular@}}
512 @item [prefix] b^T
513 @dots{} @code{\begin@{table@}...\end@{table@}}
514 @item [prefix] b p
515 @dots{} @code{\begin@{picture@}...\end@{picture@}}
516 @item [prefix] b q
517 @dots{} @code{\begin@{quote@}...\end@{quote@}}
518 @item [prefix] b Q
519 @dots{} @code{\begin@{quotation@}...\end@{quotation@}}
520 @item [prefix] b r
521 @dots{} @code{\begin@{flushright@}...\end@{flushright@}}
522 @item [prefix] b v
523 @dots{} @code{\begin@{verbatim@}...\end@{verbatim@}}
524 @item [prefix] b V
525 @dots{} @code{\begin@{verse@}...\end@{verse@}}
526 @end table
528 Any other La@TeX{} environments are made by completing-read of the
529 Emacs function.
531 @table @kbd
532 @item [prefix] b SPACE
533 @dots{} begin-type completion
534 @end table
536 @noindent
537 The next message will show up in the minibuffer
539 @example
540 Begin environment(default document):
541 @end example
543 @noindent
544 by typing @kbd{[prefix] b}. Put the wishing environment with completion
545 in the minibuffer, and @code{\begin@{env@}}...\@code{\end@{env@}} will be
546 inserted in the La@TeX{} source text. If the environment you want to put
547 does not exist in the YaTeX completion table, it will be registered in the
548 user completion table. YaTeX automatically saves the user completion
549 table in the user dictionary file at exiting of emacs.
551 At the completion of certain environments, the expected initial entry will
552 automatically inserted such as @code{\item} for @code{itemize}
553 environment. If you don't want the entry, it can be removed by undoing.
555 If you want to enclose some paragraphs which have already been
556 written, invoke the begin-type completion with changing the case
557 of @kbd{b} of key sequence upper(or invoke it with universal argument
558 by @kbd{C-u} prefix).
559 @cindex enclose region into environment
561 The following example encloses a region with `description'
562 environment.
564 @table @kbd
565 @item [prefix] B D
566 @itemx (or ESC 1 [prefix] b D)
567 @itemx (or C-u [prefix] b D)
569 @dots{} begin-type completion for region
570 @end table
572 This enclosing holds good for the completing input by @kbd{[prefix] b
573 SPC}. @kbd{[prefix] B SPC} enclose a region with the environment selected
574 by completing-read.
576 @node Section-type completion, Large-type completion, Begin-type completion, Completion
577 @comment node-name, next, previous, up
578 @section Section-type completion
579 @cindex section-type completion
580 @cindex prefix s
582 "Section-type completion" completes section-type commands which take an
583 argument or more such as @code{\section@{foo@}}. To invoke section-type
584 completion, type
586 @table @kbd
587 @item [prefix] s
588 @dots{} section-type completion
589 @end table
591 @noindent
592 then the prompt
594 @example
595 (C-v for view) \???@{@} (default documentclass):
596 @end example
598 @noindent
599 will show up in the minibuffer. Section-type La@TeX{} commands are
600 completed by space key, and the default value is selected when you
601 type nothing in the minibuffer.
603 Next,
605 @example
606 \section@{???@}:
607 @end example
609 @noindent
610 prompts you the argument of section-type La@TeX{} command. For
611 example, the following inputs
613 @example
614 \???@{@} (default documentclass): section
615 \section@{???@}: Hello world.
616 @end example
618 @noindent
619 will insert the string
621 @example
622 \section@{Hello world.@}
623 @end example
625 in your La@TeX{} source. When you neglect argument such as
627 @example
628 (C-v for view) \???@{@} (default section): vspace*
629 \vspace*@{???@}:
630 @end example
632 YaTeX puts
634 @example
635 \vspace*@{@}
636 @end example
638 @noindent
639 and move the cursor in the braces.
641 In La@TeX{} command, there are commands which take more than one
642 arguments such as @code{\addtolength@{\topmargin@}@{8mm@}}. To complete these
643 commands, invoke section-type completion with universal argument as,
644 @cindex number of argument
646 @example
647 C-u 2 [prefix] s (or ESC 2 [prefix] s)
648 @end example
650 @noindent
651 and make answers in minibuffer like this.
653 @example
654 (C-v for view) \???@{@} (default vspace*): addtolength
655 \addtolength@{???@}: \topmargin
656 Argument 2: 8mm
657 @end example
659 @code{\addtolength} and the first argument @code{\topmargin} can be typed
660 easily by completing read. Since YaTeX also learns the number of
661 arguments of section-type command and will ask that many arguments in
662 future completion, you had better tell the number of arguments to YaTeX at
663 the first completion of the new word. But you can change the number of
664 arguments by calling the completion with different universal argument
665 again.
668 Invoking section-type completion with @code{[Prefix] S} (Capital `S')
669 includes the region as the first argument of section-type command.
671 The section/large/maketitle type completion can work at the
672 prompt for the argument of other section-type completion.
673 Nested La@TeX{} commands are efficiently read with the recursive
674 completion by typing YaTeX's completion key sequence in the
675 minibuffer.
677 @menu
678 * view-sectioning::
679 @end menu
681 @node view-sectioning, , Section-type completion, Section-type completion
682 @comment node-name, next, previous, up
683 @subsection view-sectioning
684 @cindex view sectioning
685 @cindex outline
687 In the minibuffer at the prompt of section-type command completion,
688 typing @kbd{C-v} shows a list of sectioning commands in source text(The
689 line with @code{<<--} mark is the nearest sectioning command). Then,
690 default sectioning command appears in the minibuffer. You can go up/down
691 sectioning command by typing @kbd{C-p}/@kbd{C-n}, can scrolls up/down the
692 listing buffer by @kbd{C-v}/@kbd{M-v}, and can hide sectioning commands
693 under certain level by 0 through 6. Type @kbd{?} in the minibuffer of
694 sectioning prompt for more information.
696 You can generate this listing buffer (@code{*Sectioning Lines*} buffer)
697 by typing
698 @table @kbd
699 @item M-x YaTeX-section-overview
700 @dots{} Generate *Sectioning Lines* buffer
701 @end table
702 @cindex{Generate the listing of sectioning units}
703 from the LaTeX source buffer. In this listing buffer, typing @kbd{u} on
704 the sectioning command shifts up the corresponding sectioning command in
705 source text and @kbd{d} shifts down. After marking lines in the listing
706 buffer, typing @kbd{U} shifts up all sectioning commands in the region,
707 and @kbd{U} shifts down. Here are all the key bindings of
708 @code{*Sectioning Lines*} buffer.
710 @table @kbd
711 @item SPC
712 @dots{} Jump to corresponding source line
713 @item .
714 @dots{} Display corresponding source line
715 @item u
716 @dots{} Shift up a sectioning line
717 @item d
718 @dots{} Shift down a sectioning line
719 @item U
720 @dots{} Shift up sectioning lines in region
721 @item D
722 @dots{} Shift down sectioning lines in region
723 @item 0@dots{}6
724 @dots{} Hide sectioning commands whose level is lower than n
725 @end table
728 @node Large-type completion, Maketitle-type completion, Section-type completion, Completion
729 @comment node-name, next, previous, up
730 @section Large-type completion
732 "Large-type completion" inputs the font or size changing
733 descriptions such as @code{@{\large @}}. When you type
735 @table @kbd
736 @item [prefix] l
737 @dots{} large-type completion
738 @end table
740 @noindent
741 the message in the minibuffer
743 @example
744 @{\??? @} (default large):
745 @end example
747 prompts prompts you large-type command with completing-read. There are
748 TeX commands to change fonts or sizes, @code{it}, @code{huge} and so on,
749 in the completion table.
751 Region-based completion is also invoked by changing the letter after
752 prefix key stroke as @kbd{[prefix] L}. It encloses the region by braces
753 with large-type command.
755 @node Maketitle-type completion, Arbitrary completion, Large-type completion, Completion
756 @comment node-name, next, previous, up
757 @section Maketitle-type completion
758 @cindex maketitle-type completion
760 We call it "maketitle-type completion" which completes commands such as
761 @code{\maketitle}. Take notice that maketitle-type commands take no
762 arguments. Then, typing
764 @table @kbd
765 @item [prefix] m
766 @dots{} maketitle-type completion
767 @end table
769 @noindent
770 begins maketitle-completion. Above mentioned method is true for
771 maketitle-completion, and there are La@TeX{} commands with no
772 arguments in completion table.
774 @node Arbitrary completion, End completion, Maketitle-type completion, Completion
775 @comment node-name, next, previous, up
776 @section Arbitrary completion
777 @cindex arbitrary completion
779 @noindent
780 You can complete certain La@TeX{} command anywhere without typical
781 completing method as described, by typing
783 @table @kbd
784 @item [prefix] SPC
785 @dots{} arbitrary completion
786 @end table
788 @noindent
789 after the initial string of La@TeX{} command that is preceded by @code{\}.
791 @node End completion, Accent completion, Arbitrary completion, Completion
792 @comment node-name, next, previous, up
793 @section End completion
794 @cindex end completion
796 @noindent
797 YaTeX automatically detects the opened environment and close it with
798 \@code{\end@{environment@}}. Though proficient YaTeX users never fail to
799 make environment with begin-type completion, some may begin an environment
800 manually. In that case, type
802 @table @kbd
803 @item [prefix] e
804 @dots{} @code{end} completion
805 @end table
807 @noindent
808 at the end of the opened environment.
810 @node Accent completion, Image completion, End completion, Completion
811 @comment node-name, next, previous, up
812 @section Accent completion
813 @cindex accent completion
815 When you want to write the European accent marks(like @code{\`@{o@}}),
817 @table @kbd
818 @item [prefix] a
819 @dots{} accent completion
820 @end table
822 @noindent
823 shows the menu
825 @example
826 1:` 2:' 3:^ 4:" 5:~ 6:= 7:. u v H t c d b
827 @end example
829 @noindent
830 in the minibuffer. Chose one character or corresponding numeric,
831 and you will see
833 @example
834 \`@{@}
835 @end example
837 @noindent
838 in the editing buffer with the cursor positioned in braces. Type
839 one more character `o' for example, then
841 @example
842 \`@{o@}
843 @end example
845 @noindent
846 will be completed, and the cursor gets out from braces.
848 @node Image completion, Greek letters completion, Accent completion, Completion
849 @comment node-name, next, previous, up
850 @section Image completion of mathematical sign
851 @cindex image completion
852 @cindex math-mode
853 @cindex sigma
854 @cindex leftarrow
855 @cindex ;
857 Arrow marks, sigma mark and those signs mainly used in the
858 TeX's math environment are completed by key sequences which
859 imitate the corresponding symbols graphically. This completion
860 only works in the math environment. YaTeX automatically detects
861 whether the cursor located in math environment or not, and
862 change the behavior of key strokes @kbd{;} and @kbd{:}.
864 By the way, we often express the leftarrow mark by `<-' for example.
865 Considering such image, you can write @code{\leftarrow} by typing @kbd{<-}
866 after @kbd{;} (semicolon) as a prefix. In the same way,
867 @code{\longleftarrow} (@code{<--}) is completed by typing @kbd{;<--},
868 infinity mark which is imitated by @code{oo} is completed by typing
869 @kbd{;oo}.
871 Here are the sample operations in YaTeX math-mode.
873 @example
874 INPUT Completed La@TeX{} commands
875 ; < - @code{\leftarrow}
876 ; < - - @code{\longleftarrow}
877 ; < - - > @code{\longleftrightarrow}
878 ; o @code{\circ}
879 ; o o @code{\infty}
880 @end example
882 In any case, you can quit from image completion and can move
883 to the next editing operation if the La@TeX{} command you want is
884 shown in the buffer.
886 @code{;} itself in math-environment is inserted by @kbd{;;}. Typing
887 @kbd{TAB} in the midst of image completion shows all of the La@TeX{}
888 commands that start with the same name as string you previously typed in.
889 In this menu buffer, press @kbd{RET} after moving the cursor (by @kbd{n},
890 @kbd{p}, @kbd{b}, @kbd{f}) to insert the La@TeX{} command.
892 To know all of the completion table, type @kbd{TAB} just after @kbd{;}.
893 And here is the sample menu by @kbd{TAB} after @kbd{;<}.
895 @example
896 KEY LaTeX sequence sign
897 < \leq <
898 ~
899 << \ll <<
900 <- \leftarrow <-
901 <= \Leftarrow <=
902 @end example
904 You can define your favorite key-vs-sequence completion table in the
905 Emacs-Lisp variable @code{YaTeX-math-sign-alist-private}. See also
906 @file{yatexmth.el} for the information of the structure of this variable.
908 @node Greek letters completion, , Image completion, Completion
909 @comment node-name, next, previous, up
910 @section Greek letters completion
911 @cindex Greek letters completion
912 @cindex :
914 Math-mode of YaTeX provides another image completion, Greek letters
915 completion in the same method. After prefix @kbd{:}, typing @kbd{a} makes
916 @code{\alpha}, @kbd{b} makes @code{\beta} and @kbd{g} makes @code{\gamma}
917 and so on. First, type @kbd{:TAB} to know all the correspondence of
918 alphabets vs. Greek letters.
920 If you will find @kbd{;} or @kbd{:} doesn't work in correct position of
921 math environment, it may be a bug of YaTeX. Please send me a bug report
922 with the configuration of your text, and avoid it temporarily by typing
923 @kbd{;} or @kbd{:} after universal-argument(@kbd{C-u}) which forces
924 @kbd{;} and @kbd{:} to work as math-prefix.
926 @node Local dictionaries, Commenting out, Completion, Top
927 @comment node-name, next, previous, up
928 @chapter Local dictionaries
929 @cindex local dictionaries
930 @cindex nervous users
932 Tables for completion consist of three dictionaries; `standard
933 dictionary' built in @file{yatex.el}, `user dictionary' for your common
934 private commands, and `local dictionary' that is effective in a certain
935 directory.
937 When you input the command unknown to YaTeX at a completion in the
938 minibuffer, YaTeX asks you with the following prompt;
940 @example
941 `foo' is not in table. Register into: U)serDic L)ocalDic N)one D)iscard
942 @end example
944 @noindent
945 In this menu, typing @kbd{u} updates your `user dictionary', @kbd{l}
946 updates your local dictionary, @kbd{n} updates only on-memory dictionary
947 which go through only current Emacs session, and @kbd{d} updates no
948 dictionary and throws the new word away.
950 If you find this switching feature meaningless and bothersome, put the
951 next expression into your @file{~/.emacs}
953 @lisp
954 (setq YaTeX-nervous nil)
955 @end lisp
957 @node Commenting out, Cursor jump, Local dictionaries, Top
958 @comment node-name, next, previous, up
959 @chapter Commenting out
960 @cindex commenting out
961 @cindex prefix >
962 @cindex prefix <
963 @cindex prefix ,
964 @cindex prefix .
966 You may want to comment out some region.
968 @table @kbd
969 @item [prefix] >
970 @dots{} comment out region by %
971 @item [prefix] <
972 @dots{} uncomment region
973 @end table
975 @noindent
976 cause an operation to the region between point and mark.
978 @table @kbd
979 @item [prefix] .
980 @dots{} comment out current paragraph
981 @item [prefix] ,
982 @dots{} uncomment current paragraph
983 @end table
985 @noindent
986 comments or uncomments the paragraph where the cursor belongs.
987 This `paragraph' means the region marked by the function
988 mark-paragraph, bound to @kbd{ESC h} by default. It is NOT
989 predictable what will happen when you continuously comment out
990 some paragraph many times.
992 You can also comment out an environment between @code{\begin} and
993 @code{\end}, or a @code{\begin}-\@code{\end} pair themselves, by making the
994 following key strokes on the line where @code{\begin@{@}} or
995 @code{\end@{@}} exists.
997 @table @kbd
998 @item [prefix] >
999 @dots{} comment out from \begin to \@code{end}
1000 @item [prefix] <
1001 @dots{} uncomment from \begin to \@code{end}
1002 @end table
1004 @noindent
1005 comment whole the contents of environment. Moreover,
1007 @table @kbd
1008 @item [prefix] .
1009 @dots{} comment out \begin and \@code{end}
1010 @item [prefix] ,
1011 @dots{} uncomment \begin and \@code{end}
1012 @end table
1014 @noindent
1015 (un)comments out only environment declaration: @code{\begin@{@}} and
1016 @code{\end@{@}}. NOTE that even if you intend to comment out some region,
1017 invoking @kbd{[prefix] >} on the @code{\begin},@code{\end} line decides to
1018 work in `commenting out from @code{\begin} to @code{\end}' mode.
1021 @node Cursor jump, Changing and Deleting, Commenting out, Top
1022 @comment node-name, next, previous, up
1023 @chapter Cursor jump
1024 @cindex cursor jump
1025 @cindex prefix g
1028 @menu
1029 * Jump to corresponding object::
1030 * Invoking image processor::
1031 * Jump to main file::
1032 * Jumping around the environment::
1033 * Jumping to last completion position::
1034 @end menu
1036 @node Jump to corresponding object, Invoking image processor, Cursor jump, Cursor jump
1037 @comment node-name, next, previous, up
1038 @section Jump to corresponding object
1040 Typing
1042 @table @kbd
1043 @item [prefix] g
1044 @dots{} go to corresponding object
1045 @end table
1047 @noindent
1048 in a certain place move the cursor to the place corresponding to the
1049 La@TeX{} command of last place. YaTeX recognize the followings as pairs
1050 that have relation each other.
1052 @itemize @bullet
1053 @item @code{\begin@{@}} <-> @code{\end@{@}}
1054 @item @code{%#BEGIN} <-> @code{%#END}
1055 @item On the image-including line -> corresponding viewer or drawing tool
1056 @item @code{\label@{@}} <-> @code{\ref@{@}}
1057 @item @code{\include(\input)} -> included file
1058 @item @code{\bibitem@{@}} <-> @code{\cite@{@}}
1059 @end itemize
1061 On a @code{\begin},@code{\end} line, typing @kbd{[prefix] g} moves the
1062 cursor to the corresponding @code{\end},@code{\begin} line, if its partner
1063 really exists. The behavior on the line @code{%#BEGIN} and @code{%#END}
1064 are the same. Note that if the correspondent of @code{label/ref} or
1065 @code{cite/bibitem} exists in another file, that file have to be opened to
1066 make a round trip between references by @kbd{[prefix] g}.
1068 If you type @code{[prefix] g} on the line of @code{\include@{chap1@}},
1069 typically in the main text, YaTeX switches buffer to @file{chap1.tex}.
1071 @table @kbd
1072 @item [prefix] 4 g
1073 @dots{} go to corresponding object in other window
1074 @end table
1076 @noindent
1077 do the same job as @kbd{[prefix] g} except it's done in other window.
1078 Note that this function doesn't work on @code{begin/end},
1079 @code{%#BEGIN/%#END} pairs because it is meaningless.
1081 @node Invoking image processor, Jump to main file, Jump to corresponding object, Cursor jump
1082 @comment node-name, next, previous, up
1083 @section Invoking image processor
1084 @cindex{Drawing tool invocation}
1086 `image-including line' described above means such lines as
1087 @code{\epsfile@{file=foo.ps@}}. If you type @kbd{[prefix] g} on that
1088 line, YaTeX automatically searches source of `foo.ps' and invokes image
1089 viewer or drawing tool correspoinding to it. For example; if you draw
1090 an image foo.obj with Tgif and enclose its product named foo.eps by
1091 @code{\epsfile} command. Typing @kbd{[prefix] g} on @code{\epsfile} line
1092 make YaTeX invoke @code{tgif foo.obj}. How a processor is choosen is as
1093 follows.
1095 @enumerate
1096 @item
1097 If there is an expression matching with one of the pattern
1098 defined in @code{YaTeX-processed-file-regexp-alist}, extract file name
1099 from regexp group surrounded by \\(\\). (Which group corresponds is
1100 written in the cdr part of each list.) If no matches were found, do
1101 nothing.
1102 @item
1103 If there is a pattern as `%PROCESSOR' which is defined in the variable
1104 @code{YaTeX-file-processor-alist}, call that processor giving the
1105 file name with corresponding extension.
1106 @item
1107 If not, check the existence of each file which is supplied the
1108 extension in the cdr part of each list of
1109 @code{YaTeX-file-processor-alist}. If any, call the corresponding
1110 image viewer or drawing tool.
1111 @end enumerate
1113 @node Jump to main file, Jumping around the environment, Invoking image processor, Cursor jump
1114 @comment node-name, next, previous, up
1115 @section Jump to main file
1117 Typing
1119 @table @kbd
1120 @item [prefix] ^
1121 @dots{} visit main file
1122 @item [prefix] 4^
1123 @dots{} visit main file in other buffer
1124 @end table
1125 @cindex prefix ^
1126 @cindex prefix 4 ^
1128 in a sub text switch the buffer to the main text specified by
1129 @code{%#!} notation.
1131 @node Jumping around the environment, Jumping to last completion position, Jump to main file, Cursor jump
1132 @comment node-name, next, previous, up
1133 @section Jumping around the environment
1135 And these are the functions which work on the current La@TeX{}
1136 environment:
1138 @table @kbd
1139 @item M-C-a
1140 @dots{} beginning of environment
1141 @item M-C-e
1142 @dots{} @code{end} of environment
1143 @item M-C-@@
1144 @dots{} mark environment
1145 @end table
1146 @cindex M-C-a
1147 @cindex M-C-e
1148 @cindex M-C-@@
1150 @node Jumping to last completion position, , Jumping around the environment, Cursor jump
1151 @comment node-name, next, previous, up
1152 @section Jumping to last completion position
1154 YaTeX always memorize the position of completion into register @code{3}.
1155 So every time you make a trip to any other part of text other than you are
1156 writing, you can return to the editing paragraph by calling
1157 register-to-point with argument YaTeX-current-position-register, which is
1158 achieved by typing @kbd{C-x j 3}(by default).
1160 @node Changing and Deleting, Filling, Cursor jump, Top
1161 @comment node-name, next, previous, up
1162 @chapter Changing and Deleting
1164 These functions are for change or deletion of La@TeX{} commands
1165 already entered.
1167 @table @kbd
1168 @item [prefix] c
1169 @dots{} change La@TeX{} command
1170 @item [prefix] k
1171 @dots{} kill La@TeX{} command
1172 @end table
1173 @cindex prefix c
1174 @cindex prefix k
1176 @menu
1177 * Changing LaTeX commands::
1178 * Killing LaTeX commands::
1179 @end menu
1181 @node Changing LaTeX commands, Killing LaTeX commands, Changing and Deleting, Changing and Deleting
1182 @comment node-name, next, previous, up
1183 @section Changing La@TeX{} commands
1185 @kbd{[prefix] c} can change the various (La)@TeX{} commands. This can
1186 change the followings.
1187 @itemize @bullet
1188 @item Environment names
1189 @item Section-type commands
1190 @item Argument of section-type commands
1191 @item Optional parameters (enclosed by []) of section-type commands
1192 @item Font/size designators
1193 @item Math-mode's maketitle-type commands that can be inputted with
1194 image completion
1195 @end itemize
1197 Typing @kbd{[prefix] c} on one of above objects you want to change
1198 brings a suitable reading function sometimes with completion.
1199 Note: If you want to change the argument of section-type command that
1200 contains other La@TeX{} commands, type @kbd{[prefix] c} either of
1201 surrounding braces of the argument in order to make YaTeX ignore the
1202 internal La@TeX{} sequences as an object of changing. Anyway, it is
1203 very difficult to know which argument position the cursor belongs because
1204 the La@TeX{} commands can be nested and braces can freely emerge. So keep
1205 it mind to put the cursor on a brace when you are thinking of changing a
1206 complicated argument.
1208 @node Killing LaTeX commands, , Changing LaTeX commands, Changing and Deleting
1209 @comment node-name, next, previous, up
1210 @section Killing La@TeX{} commands
1211 @cindex Killing La@TeX{} commands
1213 @kbd{[prefix] k} kills the La@TeX{} commands sometimes with their
1214 arguments. Following table illustrates the correspondence of the invoking
1215 position and what is killed.
1217 @example
1218 [Invoking position] [action]
1219 \begin, \end line kill \begin,\end pairs
1220 %#BEGIN, %#END line kill %#BEGIN,%#END pairs
1221 on a Section-type command kill section-type command
1222 on a parenthesis kill parentheses
1223 @end example
1225 Note that when killing @code{\begin, \end} or @code{%#BEGIN, %#END} pair,
1226 the lines @code{\begin, \end} or @code{%#BEGIN, %#END} exist will be
1227 killed entirely. So take care not to create any line that contains more
1228 than one @code{\begin} or so.
1230 While all operations above are to kill `containers' which surround some
1231 text, universal argument (@kbd{C-u}) for these commands kills not only
1232 `containers' but also `contents' of them. See below as a sample.
1234 @example
1235 Original text: [prefix] k C-u [prefix] k
1236 Main \footnote@{note@} here. Main note here. Main here.
1237 ~(cursor)
1238 @end example
1240 @node Filling, Updation of includeonly, Changing and Deleting, Top
1241 @comment node-name, next, previous, up
1242 @chapter Filling
1243 @cindex filling
1245 @section Filling an item
1246 @cindex filling an item
1247 @cindex prefix i
1249 To fill a term (descriptive sentences) of @code{\item}, type
1251 @c @table @kbd
1252 @c @item [prefix] i
1253 @c @dots{} fill item
1254 @c @end table
1255 @table @kbd
1256 @item M-q
1257 @dots{} fill item
1258 @end table
1260 @noindent
1261 on that item.
1263 YaTeX uses the value of the variable @code{YaTeX-item-regexp} as the
1264 regular expression to search item header in itemize environment.
1265 If you make a newcommand to itemize terms(e.g. @code{\underlineitem}), put
1267 @lisp
1268 (setq YaTeX-item-regexp
1269 "\\(\\\\\\(sub\\)*item\\)\\|\\(\\\\underlineitem\\)")
1270 @end lisp
1271 @cindex YaTeX-item-regexp
1273 in your @file{~/.emacs}. If you are not familiar with regular expression
1274 for Emacs-Lisp, name a newcommand for `itemize' beginning with
1275 @code{\item} such as @code{\itembf}, not @code{\bfitem}.
1277 This function reformats the @code{\item} into `hang-indented' style.
1278 For example:
1280 @example
1281 itemize, enumerate environment:
1283 >\item[foo] `foo' is the typical word for describing an
1284 > arbitrarily written....
1285 description environment:
1286 > \item[bar] When the word `for' is used as an arbitrarily
1287 > word, `bar' is bound to follow it.
1288 @end example
1290 Note that the indent depth of an @code{\item} word and its descriptive
1291 paragraph are the same in latter case. If you want to use different
1292 depth, invoke fill-paragraph at the beginning of non-whitespace
1293 character(see below).
1295 @section Filling paragraph
1296 @cindex Filling paragraph
1297 @cindex M-q
1299 Fill-paragraph is little bit adapted for La@TeX{} sources. It retains from
1300 filling in certain environments where formatting leads to a disaster such
1301 as verbatim, tabular, or so. And it protects @code{\verb} expressions
1302 from being folded (The variable @code{YaTeX-verb-regexp} controls this).
1303 Besides, putting cursor on the first occurrence of non-whitespace
1304 character on a line changes the fill-prefix temporarily to the depth of
1305 the line.
1307 @node Updation of includeonly, What column, Filling, Top
1308 @comment node-name, next, previous, up
1309 @chapter Updation of @code{\includeonly}
1310 @cindex includeonly
1312 When you edit splitting source texts, the notation
1314 @example
1315 \includeonly@{CurrentEditingFileName@}
1316 @end example
1318 @noindent
1319 in the main file reduces the time of typesetting. If you want
1320 to hack other file a little however, you have to rewrite it to
1322 @example
1323 \includeonly@{OtherFileNameYouWantToFix@}
1324 @end example
1326 @noindent
1327 in the main file. YaTeX automatically detects that the current
1328 edited text is not in includeonly list and prompts you
1330 @example
1331 A)dd R)eplace %)comment?
1332 @end example
1334 in the minibuffer. Type @kbd{a} if you want to add the current file name
1335 to @code{\includeonly} list, @kbd{r} to replace \@code{includeonly} list
1336 with the current file, and type @kbd{%} to comment out the
1337 @code{\includeonly} line.
1339 @node What column, Intelligent newline, Updation of includeonly, Top
1340 @comment node-name, next, previous, up
1341 @chapter What column?
1342 @cindex what column
1343 @cindex complex tabular
1344 @cindex prefix &
1346 We are often get tired of finding the corresponding column in
1347 large tabulars. For example,
1349 @example
1350 \begin@{tabular@}@{|c|c|c|c|c|c|c|c|@}\hline
1351 Name&Position&Post No.&Addr.&Phone No.&FAX No.&
1352 Home Addr.&Home Phone\\ \hline
1353 Thunder Bird & 6 & 223 & LA & xxx-yyy &
1354 zzz-www & Japan & 9876-54321 \\
1355 & 2 & \multicolumn@{2@}@{c|@}@{Unknown@}
1356 &&&(???)
1357 \\ \hline
1358 \end@{tabular@}
1359 @end example
1361 Suppose you have the cursor located at @code{(???)} mark, can you tell
1362 which column it is belonging at once? Maybe no. In such case,
1363 type
1365 @table @kbd
1366 @item [prefix] &
1367 @dots{} What column
1368 @end table
1370 @noindent
1371 in that position. YaTeX tells you the column header of the
1372 current field. Since YaTeX assumes the first line of tabular
1373 environment as a row of column headers, you can create a row of
1374 virtual column headers by putting them in the first line and
1375 commenting that line with @code{%}.
1377 @node Intelligent newline, Usepackage checker, What column, Top
1378 @comment node-name, next, previous, up
1379 @chapter Intelligent newline
1380 @cindex Intelligent newline
1381 @cindex ESC RET
1382 @cindex M-C-m
1384 At the end of begin-type completion of tabular[*], array, itemize,
1385 enumerate or tabbing environment, or typing
1387 @table @kbd
1388 @item ESC RET
1389 @dots{} Intelligent newline
1390 @end table
1392 @noindent
1393 in these environments inserts the contents corresponding to the current
1394 environment in the next line. (At the begin-type completion, this
1395 contents can be removed by `undo'.) In @code{tabular} environment, for
1396 example, @kbd{ESC RET} inserts the certain number of @code{&} and trailing
1397 @code{\\}, and @code{\hline} if other @code{\hline} is found in backward.
1398 Here are the list of contents vs. environments.
1400 @itemize
1401 @item @code{tabular}, @code{tabular*}, @code{array}
1403 Corresponding number of @code{&} and @code{\\}.
1404 And @code{\hline} if needed.
1406 @item @code{tabbing}
1408 The same number of @code{\>} as @code{\=} in the first line.
1410 @item @code{itemize}, @code{enumerate}, @code{description}, @code{list}
1412 @code{\item} or @code{item[]}.
1413 @end itemize
1415 Note that since this function works seeing the contents of the first
1416 line, please call this after the second line if possible.
1418 If you want to apply these trick to other environments, @code{foo}
1419 environment for example, define the function named
1420 @code{YaTeX-intelligent-newline-foo} to insert corresponding contents.
1421 That function will be called at the beginning of the next line after the
1422 newline is inserted to the current line. Since the function
1423 @code{YaTeX-indent-line} is designed to indent the current line properly,
1424 calling this function before your code to insert certain contents must be
1425 useful. See the definition of the function
1426 @code{YaTeX-intelligent-newline-itemize} as an example.
1428 @node Usepackage checker, Online help, Intelligent newline, Top
1429 @comment node-name, next, previous, up
1430 @chapter Usepackage checker
1431 @cindex usepackage
1433 When you input begint-type, section-type, maketitle-type macros with
1434 completion, and it requires some LaTeX2e package, YaTeX examines
1435 the existence of correct @code{\usepackage}. If not, YaTeX inserts
1436 the @code{\usepackage@{@}} declaration corresponding to input macro.
1438 To activate the package completion for your favarite package,
1439 set the variable @code{YaTeX-package-alist-private} correctly.
1440 Please refere the value of @code{YaTeX-package-alist-default} as an
1441 example.
1443 @node Online help, Browsing file hierarchy, Usepackage checker, Top
1444 @comment node-name, next, previous, up
1445 @chapter Online help
1446 @cindex online help
1447 @cindex prefix ?
1448 @cindex prefix /
1449 @cindex apropos
1450 @cindex keyword search
1452 YaTeX provides you the online help with popular La@TeX{} commands.
1454 Here are the key strokes for the online help.
1456 @table @kbd
1457 @item [prefix] ?
1458 @dots{} Online help
1459 @item [prefix] /
1460 @dots{} Online apropos
1461 @end table
1463 @section Online help
1465 `Online help' shows the documentation for the popular La@TeX{}
1466 commands(defaults to the commands on the cursor) in the next buffer.
1467 There are two help file, `global help' and `private help'. The former
1468 file contains the descriptions on the standard La@TeX{} command and is
1469 specified its name by variable @code{YaTeX-help-file}. Usually, the
1470 global help file should be located in public space (@code{$EMACSEXECPATH}
1471 by default) and should be world writable so that anyone can update it to
1472 enrich its contents. The latter file contains descriptions on
1473 non-standard or personal command definitions and is specified by
1474 @code{YaTeX-help-file-private}. This file should be put into private
1475 directory.
1477 @section Online apropos
1479 `Online apropos' is an equivalent of GNU Emacs's apropos. It
1480 shows all the documentations that contains the keyword entered by
1481 the user.
1483 @section When no descriptions are found...
1485 If there is no description on a command in help files, YaTeX
1486 requires you to write a description on that command. If you are
1487 willing to do, determine which help file to add and write the
1488 description on it referring your manual of (La)TeX. Please send
1489 me your additional descriptions if you describe the help on some
1490 standard commands. I might want to include it in the next
1491 distribution.
1493 @node Browsing file hierarchy, Cooperation with other packages, Online help, Top
1494 @comment node-name, next, previous, up
1495 @chapter Browsing file hierarchy
1496 @cindex hierarchy
1497 @cindex browsing
1499 When you are editing multi-file source, typing
1501 @table @kbd
1502 @item [prefix] d
1503 @dots{} browse file hierarchy
1504 @end table
1506 @noindent
1507 asks you the parent-most file (which may be defaulted) and displays the
1508 documentation hierarchy in the next window. In this buffer, the following
1509 commands are available.
1511 @table @kbd
1512 @item n
1513 @dots{} move to the next line and show its contents
1514 @item p
1515 @dots{} move to the previous line and show its contents
1516 @item N
1517 @dots{} move to the next file in the same inclusion level
1518 @item P
1519 @dots{} move to the previous file in the same inclusion level
1520 @item j
1521 @dots{} move to the next line
1522 @item k
1523 @dots{} move to the previous line
1524 @item u
1525 @dots{} move to the parent file
1526 @item .
1527 @dots{} show the current files contents in the next window
1528 @item SPC
1529 @dots{} scroll up the current file window
1530 @item DEL, b
1531 @dots{} scroll down the current file window
1532 @item <
1533 @dots{} show the beginning of the current file
1534 @item >
1535 @dots{} show the end of the current file
1536 @item >
1537 @dots{} return to the previous postion after @kbd{<} or @kbd{>}
1538 @item RET, g
1539 @dots{} open the current file in the next window
1540 @item mouse-2
1541 @dots{} same as RET(available only with window system)
1542 @item o
1543 @dots{} other window
1544 @item 1
1545 @dots{} delete other windows
1546 @item -
1547 @dots{} shrink hierarchy buffer window
1548 @item +
1549 @dots{} enlarge hierarchy buffer window
1550 @item ?
1551 @dots{} describe mode
1552 @item q
1553 @dots{} quit
1554 @end table
1556 Note that operations on the file contents in the next window do not work
1557 correctly when you close the corresponding file.
1559 @node Cooperation with other packages, Customizations, Browsing file hierarchy, Top
1560 @comment node-name, next, previous, up
1561 @chapter Cooperation with other packages
1563 YaTeX works better with other brilliant packages.
1565 @section gmhist
1566 @cindex gmhist
1567 @cindex command history
1568 @cindex minibuffer history
1570 When you are loading @file{gmhist.el} and @file{gmhist-mh.el}, you can
1571 use independent command history list at the prompt of preview command
1572 (@kbd{[prefix] tp}) and print command (@kbd{[prefix] tl}). On each
1573 prompt, you can enter the previous command line string repeatedly by
1574 typing @kbd{M-p}.
1576 @section min-out
1577 @cindex min-out
1579 @file{min-out}, the outline minor mode, can be used in yatex-mode
1580 buffers. If you want to use it with YaTeX, please refer the
1581 file @file{yatexm-o.el} as an example.
1583 @node Customizations, Etcetera, Cooperation with other packages, Top
1584 @comment node-name, next, previous, up
1585 @chapter Customizations
1586 @cindex customizations
1588 You can customize YaTeX by setting Emacs-Lisp variables and by making
1589 add-in functions.
1591 @menu
1592 * Lisp variables::
1593 * Add-in functions::
1594 * Add-in generator::
1595 @end menu
1597 @node Lisp variables, Add-in functions, Customizations, Customizations
1598 @comment node-name, next, previous, up
1599 @section Lisp variables
1600 @cindex customizable variables
1602 You can change the key assignments or make completion more comfortable
1603 by setting the values of various variables which control the movement of
1604 yatex-mode.
1606 For example, if you want to change the prefix key stroke from @kbd{C-c}
1607 to any other sequence, set YaTeX-prefix to whatever you want to use. If
1608 you don't want to use the key sequence @kbd{C-c letter} which is assumed
1609 to be the user reserved sequence in Emacs world, set
1610 @code{YaTeX-inhibit-prefix-letter} to @code{t}, and all of the default key
1611 bind of @kbd{C-c letter} will turn to the corresponding @kbd{C-c C-letter}
1612 (but the region based completions that is invoked with @kbd{C-c
1613 Capital-letter} remain valid, if you want to disable those bindings, set
1614 that variable to 1 instead of @code{t}).
1616 @menu
1617 * All customizable variables::
1618 * Sample definitions::
1619 * Hook variables::
1620 * Hook file::
1621 @end menu
1623 @node All customizable variables, Sample definitions, Lisp variables, Lisp variables
1624 @comment node-name, next, previous, up
1625 @subsection All customizable variables
1626 @cindex all customizable variables
1628 Here are the customizable variables of yatex-mode. Each value setq-ed
1629 in @file{~/.emacs} is preferred and that of defined in @file{yatex.el} is
1630 neglected. Parenthesized contents stands for the default value. When you
1631 are to change some of these variables, see more detailed documentation of
1632 the variable by @kbd{M-x describe-variable}.
1634 @defvar YaTeX-japan
1635 Set this nil to produce all messages in English
1636 (@code{Depends on Japanese feature of Emacs})
1637 @end defvar
1639 @defvar YaTeX-kanji-code
1640 Default buffer-file-coding-system for YaTeX modes' buffer.
1641 Set this 0 to no language conversion. Nil to preserve original
1642 coding-system. 1=Shift JIS, 2=JIS, 3=EUC, 4=UTF-8 (@code{1 or 2})
1643 @end defvar
1645 @defvar YaTeX-prefix
1646 Prefix key stroke (@kbd{C-c})
1647 @end defvar
1649 @defvar YaTeX-inhibit-prefix-letter
1650 Change key stroke from @kbd{C-c letter} to @kbd{C-c C-letter} (@code{nil})
1651 @end defvar
1653 @defvar YaTeX-fill-prefix
1654 Fill-prefix used in yatex-mode (@code{nil})
1655 @end defvar
1657 @defvar YaTeX-user-completion-table
1658 Name of user dictionary where learned completion table will be stored.
1659 (@code{"~/.yatexrc"})
1660 @end defvar
1662 @defvar tex-command
1663 La@TeX{} typesetter command (@code{"latex"})
1664 @end defvar
1666 @defvar dvi2-command
1667 Preview command (@code{"xdvi -geo +0+0 -s 4"})
1668 @end defvar
1670 @defvar dviprint-command-format
1671 Command format to print dvi file (@code{"dvi2ps %f %t %s | lpr"})
1672 @end defvar
1674 @defvar dviprint-from-format
1675 Start page format of above %f. %b will turn to start page (@code{"-f %b"})
1676 @end defvar
1678 @defvar dviprint-to-format
1679 End page format of above %t. %e will turn to @code{end} page (@code{"-t %e"})
1680 @end defvar
1682 @defvar makeindex-command
1683 Default makeindex command (@code{"makeindex"} (@code{"makeind"} on MS-DOS))
1684 @end defvar
1686 @defvar YaTeX-dvipdf-command
1687 Default command name to convert .dvi to PDF (@code{"dvipdfmx"})
1688 @end defvar
1690 @defvar YaTeX-need-nonstop
1691 Put @code{\nonstopmode@{@}} or not (@code{nil})
1692 @end defvar
1694 @defvar latex-warning-regexp
1695 Regular expression of warning message latex command puts out
1696 (@code{"line.* [0-9]*"})
1697 @end defvar
1699 @defvar latex-error-regexp
1700 Regular expression of error message (@code{"l\\.[1-9][0-9]*"})
1701 @end defvar
1703 @defvar latex-dos-emergency-message
1704 Message latex command running on DOS puts at abort (@code{"Emergency stop"})
1705 @end defvar
1707 @defvar YaTeX-item-regexp
1708 Regular expression of item command (@code{"\\\\item"})
1709 @end defvar
1711 @defvar YaTeX-verb-regexp
1712 Regexp of verb family. Omit \\\\. (@code{"verb\\*?\\|path"})
1713 @end defvar
1715 @defvar YaTeX-nervous
1716 T for using local dictionary (@code{t})
1717 @end defvar
1719 @defvar YaTeX-sectioning-regexp
1720 Regexp of La@TeX{} sectioning command
1721 (@code{"\\(part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\*?\\)\\b"})
1722 @end defvar
1724 @defvar YaTeX-fill-inhibit-environments
1725 Inhibit fill in these environments
1726 (@code{'("tabular" "tabular*" "array" "picture" "eqnarray" "eqnarray*" "equation" "math" "displaymath" "verbatim" "verbatim*")})
1727 @end defvar
1729 @defvar YaTeX-uncomment-once
1730 T for deleting all preceding @code{%} (@code{nil})
1731 @end defvar
1733 @defvar YaTeX-close-paren-always
1734 T for always close all parenthesis automatically, @code{nil} for only eol
1735 (@code{t})
1736 @end defvar
1738 @defvar YaTeX-auto-math-mode
1739 Switch math-mode automatically (@code{t})
1740 @end defvar
1742 @defvar YaTeX-math-key-list-private
1743 User defined alist, math-mode-prefix vs completion alist
1744 used in image completion (@code{nil}). See @file{yatexmth.el}
1745 for the information about how to define a completion alist.
1746 @end defvar
1748 @defvar YaTeX-default-pop-window-height
1749 Initial height of typesetting buffer when one-window.
1750 Number for the lines of the buffer, numerical string for
1751 the percentage of the screen-height. @code{nil} for half height (10)
1752 @end defvar
1754 @defvar YaTeX-help-file
1755 Global online help file name (@file{$doc-directory/../../site-lisp/YATEXHLP.eng})
1756 @end defvar
1758 @defvar YaTeX-help-file-private
1759 Private online help file name (@file{"~/YATEXHLP.eng"})
1760 @end defvar
1762 @defvar YaTeX-no-begend-shortcut
1763 Disable [prefix] b ?? shortcut (@code{nil)}
1764 @end defvar
1766 @defvar YaTeX-hilit-pattern-adjustment-private
1767 List of the list that contain the regular expression and the symbol of
1768 logical meaning of the string that matches the pattern. See also the
1769 value from @code{(assq 'yatex-mode hilit-patterns-alist)} and the value of
1770 @code{YaTeX-hilit-pattern-adjustment-default} (and even the document of
1771 hilit19.el).
1772 @end defvar
1774 @defvar YaTeX-sectioning-level
1775 Alist of LaTeX's sectioning command vs its height.
1776 @end defvar
1778 @defvar YaTeX-hierarchy-ignore-heading-regexp
1779 @code{YaTeX-display-hierarchy} searches for sectioning command first, and
1780 comment line secondary as a file headings. In latter case, ignore lines
1781 that match with regular expression of this variable. Default value of
1782 this variable is RCS header expressions and mode specifying line `-*- xxxx
1783 -*'.
1784 @end defvar
1786 @defvar YaTeX-skip-default-reader
1787 Non-nil for this variable skips the default argument reader of
1788 section-type command when add-in function for it is not defined
1789 (@code{nil})
1790 @end defvar
1792 @defvar YaTeX-create-file-prefix-g
1793 When typing @kbd{prefix g} on the @code{\include} line,
1794 open the target file even if the file doesn't exist (@code{nil})
1795 @end defvar
1797 @defvar YaTeX-simple-messages
1798 Simplyfy messages of various completions (@code{nil})
1799 @end defvar
1801 @defvar YaTeX-hilit-sectioning-face
1802 When hilit19 and yatex19 is active, YaTeX colors the sectioning commands.
1803 This variable specifies the foreground and background color of
1804 @code{\part} macro. The default value is @code{'(yellow/dodgerblue
1805 yellow/slateblue)}. The first element of this list is for the screen when
1806 @code{hilit-background-mode} is @code{'light}, and the second element is
1807 for @code{'dark}. You should specify both color as `forecolor/backcolor'.
1808 @end defvar
1810 @defvar YaTeX-hilit-sectioning-attenuation-rate
1811 When color mode, this variable specifies how much attenuate the color
1812 density of @code{\subparagraph} compared with that of @code{\chapter}
1813 (@code{'(15 40)}) See also @code{YaTeX-hilit-sectioning-face}.
1814 @end defvar
1816 @defvar YaTeX-use-AMS-LaTeX
1817 If you use AMS-LaTeX, set to @code{t} (@code{nil})
1818 @end defvar
1820 @defvar YaTeX-use-LaTeX2e
1821 If you use LaTeX2e, set to @code{t} (@code{t})
1822 @end defvar
1824 @defvar YaTeX-template-file
1825 File name which is automatically inserted at creation
1826 (@code{~/work/template.tex})
1827 @end defvar
1829 @defvar YaTeX-search-file-from-top-directory
1830 Non-nil means to search input-files from the directory where main file exists
1831 (@code{t})
1832 @end defvar
1834 @defvar YaTeX-use-font-lock
1835 Use font-lock to fontify buffer or not (@code{(featurep 'font-lock)}
1836 @end defvar
1838 @defvar YaTeX-use-hilit19
1839 Use hilit19 to highlight buffer or not (@code{(featurep 'hilit19)}
1840 @end defvar
1842 @defvar YaTeX-use-italic-bold
1843 YaTeX tries to search italic, bold fontsets or not
1844 (@code{t} if Emacs-20 or later). This variable is effective only when
1845 font-lock is used.
1846 (@code{(featurep 'hilit19)}
1847 @end defvar
1849 @defvar YaTeX-singlecmd-suffix
1850 Suffix which is always inserted after maketitle-type macros.
1851 @code{"{}"} is recommended.
1852 @end defvar
1854 @defvar YaTeX-package-alist-private
1855 Alist of LaTeX2e-package name vs. lists of macros in it.
1856 Set this alist properly and YaTeX automatically check the declaratiion of
1857 `usepackage' for corresponding macro, when you input that macro with
1858 completion. If required `usepackage' is not found, YaTeX also
1859 automatically inserts `\usepackage'. Alist is as follows;
1860 @lisp
1861 '((PackageName1
1862 (completionType ListOfMacro)
1863 (completionType ListOfMacro))
1864 (PackageName2
1865 (completionType ListOfMacro)
1866 (completionType ListOfMacro...))....)
1867 @end lisp
1868 completionType is one of @code{env, section, maketitle}.
1869 Consult the value of @code{YaTeX-package-alist-default} as an example.
1870 @end defvar
1872 @defvar YaTeX-tabular-indentation
1873 At indentation by @kbd{C-i} in tabular or array environment,
1874 YaTeX put the additional spaces to the normail indentation depth.
1875 The number of additional spaces is the product of YaTeX-tabular-indentation
1876 and the number of column position in tabular.
1877 @end defvar
1879 @defvar YaTeX-noindent-env-regexp
1880 Regexp of environment names that should begin with no indentation.
1881 All verbatime-like environment name should match with.
1882 @end defvar
1884 @defvar YaTeX-ref-default-label-string
1885 Default \\ref time string format.
1886 This format is like strftime(3) but allowed conversion char are as follows;
1887 %y -> Last 2 digit of year, %b -> Month name, %m -> Monthe number(1-12),
1888 %d -> Day, %H -> Hour, %M -> Minute, %S -> Second,
1889 %qx -> alphabetical-decimal conversion of yymmdd.
1890 %qX -> alphabetical-decimal conversion of HHMMSS.
1891 Beware defualt label-string should be always unique. So this format string
1892 should have both time part (%H+%M+%S or %qX) and date
1893 part (%y+(%b|%m)+%d or %qx).
1894 @end defvar
1896 @defvar YaTeX-ref-generate-label-function
1897 Function to generate default label string for unnamed \\label{}s.
1898 The function pointed to this value should take two arguments.
1899 First argument is LaTeX macro's name, second is macro's argument.
1900 Here is an example for using this value.
1901 @lisp
1902 (setq YaTeX-ref-generate-label-function 'my-yatex-generate-label)
1903 (defun my-yatex-generate-label (command value)
1904 (and (string= command "caption")
1905 (re-search-backward "\\\\begin{\\(figure\\|table\\)}" nil t)
1906 (setq command (match-string 1)))
1907 (let ((alist '(("chapter" . "chap")
1908 ("section" . "sec")
1909 ("subsection" . "subsec")
1910 ("figure" . "fig")
1911 ("table" . "tbl"))))
1912 (if (setq command (cdr (assoc command alist)))
1913 (concat command ":" value)
1914 (YaTeX::ref-generate-label nil nil))))
1915 @end lisp
1916 @end defvar
1919 @node Sample definitions, Hook variables, All customizable variables, Lisp variables
1920 @comment node-name, next, previous, up
1921 @subsection Sample definitions
1922 @cindex prefix key stroke
1923 @cindex fill-prefix
1925 For instance, to change the prefix key stroke to @kbd{ESC}, and name of
1926 the user dictionary @file{~/src/emacs/yatexrc}, and set @code{fill-prefix}
1927 to single TAB character, add the following @code{setq} to @file{~/.emacs}.
1929 @lisp
1930 (setq YaTeX-prefix "\e"
1931 YaTeX-user-completion-table "~/src/emacs/yatexrc"
1932 YaTeX-fill-prefix " ")
1933 @end lisp
1935 @node Hook variables, Hook file, Sample definitions, Lisp variables
1936 @comment node-name, next, previous, up
1937 @subsection Hook variables
1938 @cindex hook variables
1940 More customizations will be done by the hook-function defined in
1941 hook-variable @code{yatex-mode-hook}. This is useful to define a shortcut
1942 key sequence to enter some environments other than @code{document} and
1943 @code{enumerate} etc. The following statement defines @code{[prefix] ba}
1944 to enter @code{\begin@{abstract@}} ... @code{=end@{abstract@}}
1945 immediately.
1947 @lisp
1948 (setq yatex-mode-hook
1949 '(lambda() (YaTeX-define-begend-key "ba" "abstract")))
1950 @end lisp
1952 You should use functions @code{YaTeX-define-key}, or
1953 @code{YaTeX-define-begend-key} to define all the key sequences of
1954 yatex-mode.
1956 @node Hook file, , Hook variables, Lisp variables
1957 @comment node-name, next, previous, up
1958 @subsection Hook file
1959 @cindex hook file
1961 You can stuff all of YaTeX related expressions into a file named
1962 @file{yatexhks.el} if you have a lot of codes. YaTeX automatically load
1963 this file at the initialization of itself. Using @file{yatexhks.el}
1964 makes @code{yatex-mode-load-hook} unnecessary.
1966 @node Add-in functions, Add-in generator, Lisp variables, Customizations
1967 @comment node-name, next, previous, up
1968 @section Add-in functions
1969 @cindex add-in functions
1970 @cindex yatexadd.el
1972 You can easily define a function to input detailed arguments
1973 with completion according to La@TeX{} environments or commands.
1975 @c @node What is add-in functions?, , Add-in functions, Add-in functions
1976 @comment node-name, next, previous, up
1977 @subsection What is add-in functions?
1978 @cindex tabular
1980 When you input @code{tabular} environment, don't you think ``I want
1981 YaTeX to complete its argument toward my favorite one such as
1982 @code{@{|c|c|c|@}}...''? Yes, you can define the function to complete
1983 arguments for any environment and any La@TeX{} commands.
1985 @subsection Procedure
1987 Here is the procedure to define add-in functions.
1988 @enumerate
1989 @item
1990 Define the function
1991 @item
1992 Put the function into @file{yatexhks.el}
1993 @end enumerate
1995 @menu
1996 * How the add-in function works::
1997 * How the function is called::
1998 * Useful functions for creating add-in::
1999 * Contribution::
2000 @end menu
2002 @node How the add-in function works, How the function is called, Add-in functions, Add-in functions
2003 @comment node-name, next, previous, up
2004 @subsection How the add-in function works
2006 There are three types of add-in.
2008 @enumerate
2009 @item
2010 Option add-in
2011 @item
2012 argument add-in
2013 @item
2014 enclosing add-in
2015 @end enumerate
2017 @dfn{Option add-in} returns the
2018 La@TeX{}'s optional parameters such as optional strings after
2019 @code{\begin@{ENV@}}, optional strings between a section-type command
2020 and its first argument, and optional strings just after type
2021 maketitle-type command. The following illustrates the name of add-in
2022 functions, where underlined strings are generated by add-in functions.
2024 @display
2025 \begin@{table@}[ht] (Function name: YaTeX:table)
2026 ~~~~
2027 \put(100,200)@{@} (Function name: YaTeX:put)
2028 ~~~~~~~~~
2029 \sum_@{i=0@}^@{n@} (Function name: YaTeX:sum)
2030 ~~~~~~~~~~
2031 @end display
2033 Obviously, the function name is decided by concatenating the prefix
2034 `YaTeX:' and La@TeX{} command's name.
2036 Another add-in type is @dfn{argument add-in}, which completes arguments
2037 for section-type commands.
2039 @display
2040 \newcommand@{\foo@}@{bar@} (Function name: YaTeX::newcommand)
2041 ~~~~ ~~~
2042 @end display
2044 When the section-type command is inputted, the function named by
2045 concatenating `YaTeX::' and section-type command, is called automatically
2046 with an integer argument which indicates which argument of section-type
2047 command is being read. Thus the add-in should determine the
2048 job referring the value of its argument.
2050 @dfn{enclosing add-in} is for modifying and/or checking the region that
2051 will be enclosed by section-type commands via @kbd{[prefix] S}. An
2052 enclosing add-in function will be called with two arguments, beginning of
2053 the enclosed region and end of the region. Suppose you want to enclose
2054 the existing text @code{(a+b)/c} by @code{\frac{}}.
2056 @display
2057 a/c
2058 | |
2059 A B
2060 @end display
2062 You do set-mark-command at point A and then move to point B. Typing
2063 @kbd{[prefix] S} and input @code{frac} enclose the region like this;
2065 @display
2066 \frac{a/c}
2067 @end display
2069 Normally, the expression @code{a/c} is translated to
2070 @code{\frac@{a@}@{c@}}. An enclosing add-in is useful for modifying
2071 @code{/} to @code{@}@{}.
2073 @menu
2074 * Defining option-add-in::
2075 * Defining argument-add-in::
2076 * Defining enclosing-add-in::
2077 @end menu
2079 @node Defining option-add-in, Defining argument-add-in, How the add-in function works, How the add-in function works
2080 @comment node-name, next, previous, up
2081 @subsubsection Defining `option add-in'
2083 If you want @code{@{|c|c|c|@}} for all @code{tabular} environment,
2085 @lisp
2086 (defun YaTeX:tabular ()
2087 "@{|c|c|c|@}")
2088 @end lisp
2090 @noindent
2091 is enough. If you want more complicated format, define as below.
2093 @lisp
2094 (defun YaTeX:tabular ()
2095 "@{@@@{\\vrule width 1pt\\ @}|||@@@{\\ \\vrule width 1pt@}@}")
2096 @end lisp
2098 @noindent
2099 Note that the character @code{\} must be described as @code{\\} in
2100 Emacs-Lisp. The next example reads the tabular format from keyboard.
2101 @lisp
2102 (defun YaTeX:tabular ()
2103 (concat "@{" (read-string "Rule: ") "@}"))
2104 @end lisp
2106 @node Defining argument-add-in, Defining enclosing-add-in, Defining option-add-in, How the add-in function works
2107 @comment node-name, next, previous, up
2108 @subsubsection Defining `argument add-in'
2110 This section describes how to define the add-in function for
2111 @code{\newcommand}.
2113 The first argument of @code{\newcommand} begins always with @code{\}.
2114 The second argument is usually so complex that we can not edit them in the
2115 minibuffer. Here is the created function considering this.
2117 @lisp
2118 (defun YaTeX::newcommand (n) ;n is argument position
2119 (cond
2120 ((= n 1) ;1st argument is macro name
2121 (read-string "Command: " "\\")) ;initial input `\'
2122 ((= n 2) "") ;do nothing when reading arg#2
2123 (t nil)))
2124 @end lisp
2126 Note that when the `argument add-in' function return `nil', normal
2127 argument reader will be called.
2129 @node Defining enclosing-add-in, , Defining argument-add-in, How the add-in function works
2130 @comment node-name, next, previous, up
2131 @subsubsection Defining `enclosing add-in'
2133 This section describes how to define the add-in function for
2134 text enclosed by @code{\frac@{@}}.
2136 When enclosing the text @code{5/3} by @code{\frac@{@}}, you might want to
2137 replace @code{/} with @code{@}@{}. Enclosing function
2138 @code{YaTeX::frac-region} is called with two arguments, beginning of
2139 enclosed text and end of enclosed text. The function is expected to
2140 replace @code{/} with @code{@}@{}. Here is an example expression.
2142 @lisp
2143 (defun YaTeX::frac-region (beg end)
2144 (catch 'done
2145 (while (search-forward "/" end t)
2146 (goto-char (match-beginning 0))
2147 (if (y-or-n-p "Replace this slash(/) with `}{'")
2148 (throw 'done (replace-match "}{")))
2149 (goto-char (match-end 0)))))
2150 @end lisp
2152 @node How the function is called, Useful functions for creating add-in, How the add-in function works, Add-in functions
2153 @comment node-name, next, previous, up
2154 @subsection How the function is called
2156 YaTeX calls the add-in functions for specified begin-type, section-type,
2157 and maketitle-type command, if any. `Option add-in' functions for
2158 begin-type are called when @code{\begin@{ENV@}} has been inserted,
2159 functions for section-type are called just before input of the first
2160 argument, and functions for maketitle-type is called after maketitle-type
2161 command has been inserted. `Argument add-in' functions are called at each
2162 entry of arguments for section-type commands.
2164 @node Useful functions for creating add-in, Contribution, How the function is called, Add-in functions
2165 @comment node-name, next, previous, up
2166 @subsection Useful functions for creating add-in
2168 Many add-in functions for typical La@TeX{} commands are defined in
2169 @file{yatexadd.el}. Those are also useful as references. Here are the
2170 short descriptions on useful functions, where [F] means function, [A]
2171 means arguments, [D] means description.
2173 @table @kbd
2174 @item [F]
2175 YaTeX:read-position
2176 @itemx [A]
2177 Character list which can show up in the brackets
2178 @itemx [D]
2179 Return the location specifier such as `[htb]'. When
2180 nothing is entered, omit [] itself. If the possible characters
2181 are "htbp", call this function as
2182 @code{(YaTeX:read-position "htbp")}
2184 @item [F]
2185 YaTeX:read-coordinates
2186 @itemx [A]
2187 Base prompt, X-axis prompt, Y-axis prompt (each optional)
2188 @itemx [D]
2189 Read the coordinates with the prompt ``BasePrompt X-axisPrompt:'' for
2190 X-axis, ``BasePrompt Y-axisPrompt:'' for Y-axis, and return it in the form
2191 of ``(X,Y)''. The default prompts are @code{Dimension}, @code{X},
2192 @code{Y} respectively.
2194 @item [F]
2195 YaTeX:check-completion-type
2196 @itemx [A]
2197 One of the symbols: 'begin, 'section, or 'maketitle
2198 @itemx [D]
2199 Check the current completion type is specified one and cause error if
2200 not. The variable @code{YaTeX-current-completion-type} holds the symbol
2201 according to the current completion type.
2202 @end table
2204 @node Contribution, , Useful functions for creating add-in, Add-in functions
2205 @comment node-name, next, previous, up
2206 @subsection Contribution
2208 If you make your own pretty function and you let it be in public, please
2209 send me the function. I'm going to include it in the next release.
2211 @node Add-in generator, , Add-in functions, Customizations
2212 @comment node-name, next, previous, up
2213 @section Add-in generator
2215 First, don't forget to read the section of add-in functions @ref{Add-in
2216 functions}. If you easily understand how to define them, there's no need
2217 to read this section. But being not familiar with Emacs-Lisp, when you
2218 don't have clear idea what to do, this section describes how to get YaTeX
2219 make add-in function.
2221 There are two methods of generation. One is for fully interactive
2222 generator for beginners and another requires little knowledge of
2223 Emacs-Lisp.
2225 @subsection Generator for beginners
2226 The former generator is called by
2227 @center @kbd{M-x YaTeX-generate}
2229 @noindent
2230 strokes. All you have to do is follow the guidances. Defying them may cases
2231 the disaster (I wonder what is it???). So when you make some mistake, it
2232 is recommendable to type @kbd{C-g} and start afresh.
2234 @subsection Simple generator
2236 The latter generator is invoked by the next sequence.
2237 @center @kbd{M-x YaTeX-generate-simple}
2238 This generator can make both ``option add-in'' and ``argument add-in''
2239 (@emph{refer the section add-in functions}
2240 @ref{How the add-in function works}), whereas @code{YaTeX-generate}
2241 cannot make ``argument addin''.
2243 For example, assume you have the LaTeX command as follows.
2245 @example
2246 \epsinput[t](250,50)@{hoge.eps@}@{plain@}@{Picture of foo@}
2247 (A) (B) (1) (2) (3)
2248 (A)Optional parameter to specify the position
2249 One of t(top), b(bottom), l(left), r(right)
2250 (B)Maximum size of frame
2251 (1)1st argument is filename of EPS file
2252 (2)2nd argument indicates
2253 plain do nothing
2254 frame make frame around image
2255 dframe make double-frame around image
2256 for included EPS file.
2257 (3)Caption for the picture
2258 @end example
2260 Now get start with generation. Typing @kbd{M-x YaTeX-generate-simple}
2261 brings the prompt:
2262 @display
2263 (O)ption? (A)rgument?
2264 @end display
2266 @subsubsection Generating ``option add-in''
2267 @cindex option add-in
2269 Since (A), (B) above are optional argument, all we have to do to
2270 complete them is define the option add-in for them. Let's generate the
2271 function to complete (A).
2273 @display
2274 M-x YaTeX-generate-simple RET
2275 epsinput RET
2277 @end display
2279 @noindent
2280 Typing as above leads the next prompt.
2282 @display
2283 Read type(1): (S)tring (C)omplete (F)ile ([)option (P)osition co(O)rd. (q)uit
2284 @end display
2286 @noindent
2287 This asks that ``Which type is the completion style of 1st argument?''.
2288 Here are the possible completion style.
2290 @table @code
2291 @item String
2292 read plain string
2293 @item Complete
2294 read with completion
2295 @item File
2296 read file name
2297 @item Option
2298 read optional string (if string omitted, omit [] too)
2299 @item Position
2300 read positional option (like [htbp])
2301 @item Coord.
2302 read coordinates
2303 @item Quit
2304 quit from generating
2305 @end table
2307 Since (A) is the optional argument to specify the location of included
2308 EPS file, the completion style is @code{Position}, and the possible
2309 characters are t, b, l, and r. To tell these information to generator,
2310 operate as follows.
2312 @display
2313 Read type(1).... p
2314 Acceptable characters: tblr RET
2315 @end display
2317 (B) is coordinate. So its completion style is coOrd. We want a prompt
2318 meaning ``Maximum size'' when completion.
2320 @display
2321 Read type(2).... o
2322 Prompt for coordinates: Max size RET
2323 @end display
2325 That's all for optional argument. Select quit.
2327 @display
2328 Read type(3).... q
2329 @end display
2331 Then the generated option add-in function for \epsinput will be shown in
2332 the next window.
2334 @subsubsection Generating ``argument add-in''
2335 @cindex argument add-in
2337 Next, create the argument add-in. The arguments for \epsinput are EPS
2338 file name, framing style, and caption string in sequence.
2340 @display
2341 M-x YaTeX-generate-simple RET
2342 epsinput RET
2344 @end display
2346 Above key strokes bring the prompt that asks the number of argument.
2347 Answer it with 3.
2349 @display
2350 How many arguments?: 3 RET
2351 @end display
2353 Then the generator asks the completion style and prompt for completion.
2354 Answer them. @kbd{f} for FileName and prompt string.
2356 @display
2357 Read type(1).... f
2358 Prompt for argument#1 EPS file name RET
2359 @end display
2361 The second argument is one of selected symbol. So the completion type
2362 is @code{Completion}.
2364 @display
2365 Read type(2).... c
2366 Prompt for argument#2 Include style RET
2367 @end display
2369 Then all the candidates ready to be read. Type single RET after
2370 entering all.
2372 @display
2373 Item[1](RET to exit): plain RET
2374 Item[2](RET to exit): frame RET
2375 Item[3](RET to exit): dframe RET
2376 Item[4](RET to exit): RET
2377 @end display
2379 The following prompt asks whether the entered string must belong to
2380 candidates or not. In this case, since the argument must be one of
2381 @code{plain}, @code{frame}, and @code{dframe}, type @code{y}.
2383 @display
2384 Require match? (y or n) y
2385 @end display
2387 The last argument is the caption string for which any completion is
2388 needed.
2390 @display
2391 Read type(3).... s
2392 Prompt for argument#3 Caption RET
2393 default: Figure of RET
2394 @end display
2396 Finally we'll get the argument add-in in the next window.
2398 @subsection Contribution
2400 If you get your own pretty function and you let it be in public, please
2401 steel yourself in the happy atmosphere and do not send me the function.
2402 I do know it is not fine because it is generated by yatexgen:-p.
2404 @node Etcetera, Copying, Customizations, Top
2405 @comment node-name, next, previous, up
2406 @chapter Etcetera
2408 The standard completion tables provided in @file{yatex.el} contain a
2409 few La@TeX{} commands I frequently use. This is to lessen the key
2410 strokes to complete entire word, because too many candidates
2411 rarely used often cause too many hits. Therefore always try to
2412 use completion in order to enrich your dictionary, and you will
2413 also find `Wild Bird' growing suitable for your La@TeX{} style.
2415 The package name `Wild Bird' is the English translation of Japanese
2416 title `Yachou', which is a trick on words of Japanese.
2418 @node Copying, , Etcetera, Top
2419 @comment node-name, next, previous, up
2420 @chapter Copying
2422 This program is distributed as a free software. You can
2423 use/copy/modify/redistribute this software freely but with NO warranty to
2424 anything as a result of using this software. Adopting code from this
2425 program is also free. But I would not do contract act.
2427 Any reports and suggestions are welcome as long as I feel interests in
2428 this software. My possible e-mail address is `yuuji@@yatex.org'. (as of
2429 Jan.2004) And there is mailing list for YaTeX. Although the common
2430 language is Japanese, questions in English will be welcome. To join the
2431 ML, send the mail whose subject is `append' to the address
2432 `yatex@@yatex.org. If you have some question, please ask to
2433 `yatex-admin@@yatex.org'.
2435 The specification of this software will be surely modified
2436 (depending on my feelings) without notice :-p.
2439 @flushright
2440 HIROSE Yuuji
2441 @end flushright
2442 @bye
2444 Local variables:
2445 mode: texinfo
2446 fill-prefix: nil
2447 fill-column: 74
2448 End: