yatex

view docs/yatexe.tex @ 118:e1693ffc64cc

kanji-code: 4=UTF-8
author yuuji@gentei.org
date Fri, 20 Nov 2009 07:22:01 +0900
parents 9b4354af748c
children 91bf68eeefe8
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 Fri Nov 20 07:20:18 2009 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 k
149 @dots{} kill current typesetting process
150 @item [prefix] t b
151 @dots{} invoke bibtex
152 @item [prefix] t p
153 @dots{} preview
154 @item [prefix] t l
155 @dots{} lpr dvi-file
156 @item [prefix] t s
157 @dots{} search current string on xdvi-remote
158 @end table
160 @menu
161 * Calling typesetter::
162 * Calling previewer::
163 * Printing out::
164 @end menu
166 @node Calling typesetter, Calling previewer, Typesetting, Typesetting
167 @comment node-name, next, previous, up
168 @section Calling typesetter
170 Typing @kbd{[prefix] t j}, the current editing window will be divided
171 horizontally when you invoke latex command, and log message of La@TeX{}
172 typesetting will be displayed in the other window; called typesetting
173 buffer. The typesetting buffer automatically scrolls up and traces
174 La@TeX{} warnings and error messages. If you see latex stopping by an
175 error, you can send string to latex in the typesetting buffer.
177 If an error stops the La@TeX{} typesetting, this key stroke will
178 move the cursor to the line where La@TeX{} error is detected.
180 @table @kbd
181 @item [prefix] '
182 @itemx ([prefix]+single quotation)
184 @dots{} jump to the previous error or warning
185 @end table
187 If you find a noticeable error, move to the typesetting buffer and move
188 the cursor on the line of error message and type @kbd{SPACE} key. This
189 makes the cursor move to corresponding source line.
191 Since @kbd{[prefix] tr} pastes the region into the file
192 @file{texput.tex} in the current directory, you should be careful of
193 overwriting. The method of specification of the region is shown in the
194 section @xref{%#notation}.
196 The documentclass for typeset-region is the same as that of editing
197 file if you edit one file, and is the same as main file's if you
198 edit splitting files.
200 @node Calling previewer, Printing out, Calling typesetter, Typesetting
201 @comment node-name, next, previous, up
202 @section Calling previewer
204 @kbd{[prefix] t p} invokes the TeX previewer. And if you are using
205 xdvi-remote, which can be controled from other terminals, @kbd{[prefix] t
206 s} enables you to search current string at the cursor on the running xdvi
207 window.
209 @node Printing out, , Calling previewer, Typesetting
210 @comment node-name, next, previous, up
211 @section Printing out
213 When you type @code{[preifx] t l}, YaTeX asks you the range of
214 dvi-printing by default. You can skip this by invoking it with
215 universal-argument as follows:
217 @example
218 C-u [prefix] tl
219 @end example
221 @node %#notation, Completion, Typesetting, Top
222 @comment node-name, next, previous, up
223 @chapter %# notation
224 @cindex %# notation
226 You can control the typesetting process by describing @code{%#}
227 notations in the source text.
229 @menu
230 * Changing typesetter::
231 * Splitting input files::
232 * Static region for typesetting::
233 * Lpr format::
234 * Editing %# notation::
235 @end menu
237 @node Changing typesetter, Splitting input files, %#notation, %#notation
238 @comment node-name, next, previous, up
239 @section To change the `latex' command or to split a source text.
240 @cindex typesetter
242 To change the typesetting command, write
244 @example
245 %#!latex-big
246 @end example
248 @noindent
249 anywhere in the source text. This is useful for changing
250 typesetter.
252 @node Splitting input files, Static region for typesetting, Changing typesetter, %#notation
253 @comment node-name, next, previous, up
254 @section Splitting input files
256 And if you split the source text and
257 edit subfile that should be included from main text.
259 @example
260 %#!latex main.tex
261 @end example
263 @noindent
264 will be helpful to execute latex on main file from sub text buffer. Since
265 this command line after @kbd{%#!} will be sent to shell literally, next
266 description makes it convenient to use ghostview as dvi-previewer.
268 @example
269 %#!latex main ; dvi2ps main.dvi > main
270 @end example
272 @noindent
273 Note that YaTeX assumes the component before the last period of
274 the last word in this line as base name of the main La@TeX{} source.
275 The @code{%f} notation in this line is replaced by main file name, and
276 @code{%r} replaced by root name of main file name. If you specify
277 @code{%f} or @code{%r}, YaTeX always ask you the name of main file at the
278 first typesetting.
280 To make best use of the feature of inter-file jumping by
281 @kbd{[prefix] g} (see @ref{Cursor jump}), take described below into
282 consideration.
284 @itemize
285 @item You can put split texts in sub directory, but not in
286 sub directory of sub directory.
287 @item In the main text, specify the child file name with relative path name
288 such as \include@{chap1/sub@}, when you include the file in
289 a sub-directory.
290 @item In a sub-text, write @code{%#!latex main.tex} even if @file{main.tex}
291 is in the parent directory(not %#!latex ../main.tex).
292 @end itemize
294 @node Static region for typesetting, Lpr format, Splitting input files, %#notation
295 @comment node-name, next, previous, up
296 @section Static region
297 @cindex static region
298 @cindex Fixed region
300 Typeset-region by @kbd{[prefix] tr} passes the region between point and
301 mark to typesetting command by default. But when you want to typeset
302 static region, enclose the region by @code{%#BEGIN} and @code{%#END} as
303 follows.
305 @example
306 %#BEGIN
307 TheRegionYouWantToTypesetManyTimes
308 %#END
309 @end example
311 This is the rule of deciding the region.
313 @enumerate
314 @item
315 If there exists %#BEGIN before point,
317 @enumerate
318 @item
319 If there exists %#END after %#BEGIN,
320 @itemize
321 @item From %#BEGIN to %#END.
322 @end itemize
324 @item
325 If %#END does not exist after %#BEGIN,
326 @itemize
327 @item From %#BEGIN to the end of buffer.
328 @end itemize
329 @end enumerate
331 @item
332 If there does not exist %#BEGIN before point,
333 @itemize
334 @item Between point and mark(standard method of Emacs).
335 @end itemize
336 @end enumerate
338 It is useful to write @code{%#BEGIN} in the previous line of \begin and
339 @code{%#END} in the next line of \@code{end} when you try complex
340 environment such as `tabular' many times. It is also useful to put only
341 @code{%#BEGIN} alone at the middle of very long text. Do not forget to
342 erase @code{%#BEGIN} @code{%#END} pair.
344 @node Lpr format, Editing %# notation, Static region for typesetting, %#notation
345 @comment node-name, next, previous, up
346 @section Lpr format
347 @cindex lpr format
349 Lpr format is specified by three Lisp variables. Here are the
350 default values of them.
352 @table @code
353 @item (1)dviprint-command-format
354 @code{"dvi2ps %f %t %s | lpr"}
355 @item (2)dviprint-from-format
356 @code{"-f %b"}
357 @item (3)dviprint-to-format
358 @code{"-t %e"}
359 @end table
361 On YaTeX-lpr, @code{%s} in (1) is replaced by the file name of main
362 text, @code{%f} by contents of (2), %t by contents of (3). At these
363 replacements, @code{%b} in (2) is also replaced by the number of beginning
364 page, @code{%e} in (3) is replaced by the number of ending page. But
365 @code{%f} and @code{%t} are ignored when you omit the range of print-out
366 by @kbd{C-u [prefix] tl}.
368 If you want to change this lpr format temporarily, put a command
369 such as follows somewhere in the text:
371 @example
372 %#LPR dvi2ps %f %t %s | 4up -page 4 | texfix | lpr -Plp2
373 @end example
375 And if you want YaTeX not to ask you the range of printing
376 out, the next example may be helpful.
378 @example
379 %#LPR dvi2ps %s | lpr
380 @end example
382 @node Editing %# notation, , Lpr format, %#notation
383 @comment node-name, next, previous, up
384 @section Editing %# notation
386 To edit @code{%#} notation described above, type
388 @table @kbd
389 @item [prefix] %
390 @dots{} editing %# notation menu
391 @end table
393 @noindent
394 and select one of the entry of the menu as follows.
396 @example
397 !)Edit-%#! B)EGIN-END-region L)Edit-%#LPR
398 @end example
400 @noindent
401 Type @kbd{!} to edit @code{%#!} entry, @code{b} to enclose the region with
402 @code{%#BEGIN} and @code{%#END}, and @code{l} to edit @code{%#LPR} entry.
403 When you type @kbd{b}, all @code{%#BEGIN} and @code{%#END} are
404 automatically erased.
406 @node Completion, Local dictionaries, %#notation, Top
407 @comment node-name, next, previous, up
408 @chapter Completion
409 @cindex completion
411 YaTeX makes it easy to input the La@TeX{} commands. There are several
412 kinds of completion type, begin-type, section-type, large-type, etc...
414 @menu
415 * Begin-type completion::
416 * Section-type completion::
417 * Large-type completion::
418 * Maketitle-type completion::
419 * Arbitrary completion::
420 * End completion::
421 * Accent completion::
422 * Image completion::
423 * Greek letters completion::
424 @end menu
426 @node Begin-type completion, Section-type completion, Completion, Completion
427 @comment node-name, next, previous, up
428 @section Begin-type completion
429 @cindex begin-type completion
430 @cindex environment
431 @cindex prefix b
433 "Begin-type completion" completes commands of @code{\begin@{env@}} ...
434 @code{\end@{env@}}. All of the begin-type completions begin with this key
435 sequence.
437 @table @kbd
438 @item [prefix] b
439 @dots{} start begin-type completion
440 @end table
442 @noindent
443 An additional key stroke immediately completes a frequently used
444 La@TeX{} @code{\begin@{@}}...@code{\@code{end}@{@}} environment.
446 @table @kbd
447 @item [prefix] b c
448 @dots{} @code{\begin@{center@}...\end@{center@}}
449 @item [prefix] b d
450 @dots{} @code{\begin@{document@}...\end@{document@}}
451 @item [prefix] b D
452 @dots{} @code{\begin@{description@}...\end@{description@}}
453 @item [prefix] b e
454 @dots{} @code{\begin@{enumerate@}...\end@{enumerate@}}
455 @item [prefix] b E
456 @dots{} @code{\begin@{equation@}...\end@{equation@}}
457 @item [prefix] b i
458 @dots{} @code{\begin@{itemize@}...\end@{itemize@}}
459 @item [prefix] b l
460 @dots{} @code{\begin@{flushleft@}...\end@{flushleft@}}
461 @item [prefix] b m
462 @dots{} @code{\begin@{minipage@}...\end@{minipage@}}
463 @item [prefix] b t
464 @dots{} @code{\begin@{tabbing@}...\end@{tabbing@}}
465 @item [prefix] b T
466 @dots{} @code{\begin@{tabular@}...\end@{tabular@}}
467 @item [prefix] b^T
468 @dots{} @code{\begin@{table@}...\end@{table@}}
469 @item [prefix] b p
470 @dots{} @code{\begin@{picture@}...\end@{picture@}}
471 @item [prefix] b q
472 @dots{} @code{\begin@{quote@}...\end@{quote@}}
473 @item [prefix] b Q
474 @dots{} @code{\begin@{quotation@}...\end@{quotation@}}
475 @item [prefix] b r
476 @dots{} @code{\begin@{flushright@}...\end@{flushright@}}
477 @item [prefix] b v
478 @dots{} @code{\begin@{verbatim@}...\end@{verbatim@}}
479 @item [prefix] b V
480 @dots{} @code{\begin@{verse@}...\end@{verse@}}
481 @end table
483 Any other La@TeX{} environments are made by completing-read of the
484 Emacs function.
486 @table @kbd
487 @item [prefix] b SPACE
488 @dots{} begin-type completion
489 @end table
491 @noindent
492 The next message will show up in the minibuffer
494 @example
495 Begin environment(default document):
496 @end example
498 @noindent
499 by typing @kbd{[prefix] b}. Put the wishing environment with completion
500 in the minibuffer, and @code{\begin@{env@}}...\@code{\end@{env@}} will be
501 inserted in the La@TeX{} source text. If the environment you want to put
502 does not exist in the YaTeX completion table, it will be registered in the
503 user completion table. YaTeX automatically saves the user completion
504 table in the user dictionary file at exiting of emacs.
506 At the completion of certain environments, the expected initial entry will
507 automatically inserted such as @code{\item} for @code{itemize}
508 environment. If you don't want the entry, it can be removed by undoing.
510 If you want to enclose some paragraphs which have already been
511 written, invoke the begin-type completion with changing the case
512 of @kbd{b} of key sequence upper(or invoke it with universal argument
513 by @kbd{C-u} prefix).
514 @cindex enclose region into environment
516 The following example encloses a region with `description'
517 environment.
519 @table @kbd
520 @item [prefix] B D
521 @itemx (or ESC 1 [prefix] b D)
522 @itemx (or C-u [prefix] b D)
524 @dots{} begin-type completion for region
525 @end table
527 This enclosing holds good for the completing input by @kbd{[prefix] b
528 SPC}. @kbd{[prefix] B SPC} enclose a region with the environment selected
529 by completing-read.
531 @node Section-type completion, Large-type completion, Begin-type completion, Completion
532 @comment node-name, next, previous, up
533 @section Section-type completion
534 @cindex section-type completion
535 @cindex prefix s
537 "Section-type completion" completes section-type commands which take an
538 argument or more such as @code{\section@{foo@}}. To invoke section-type
539 completion, type
541 @table @kbd
542 @item [prefix] s
543 @dots{} section-type completion
544 @end table
546 @noindent
547 then the prompt
549 @example
550 (C-v for view) \???@{@} (default documentclass):
551 @end example
553 @noindent
554 will show up in the minibuffer. Section-type La@TeX{} commands are
555 completed by space key, and the default value is selected when you
556 type nothing in the minibuffer.
558 Next,
560 @example
561 \section@{???@}:
562 @end example
564 @noindent
565 prompts you the argument of section-type La@TeX{} command. For
566 example, the following inputs
568 @example
569 \???@{@} (default documentclass): section
570 \section@{???@}: Hello world.
571 @end example
573 @noindent
574 will insert the string
576 @example
577 \section@{Hello world.@}
578 @end example
580 in your La@TeX{} source. When you neglect argument such as
582 @example
583 (C-v for view) \???@{@} (default section): vspace*
584 \vspace*@{???@}:
585 @end example
587 YaTeX puts
589 @example
590 \vspace*@{@}
591 @end example
593 @noindent
594 and move the cursor in the braces.
596 In La@TeX{} command, there are commands which take more than one
597 arguments such as @code{\addtolength@{\topmargin@}@{8mm@}}. To complete these
598 commands, invoke section-type completion with universal argument as,
599 @cindex number of argument
601 @example
602 C-u 2 [prefix] s (or ESC 2 [prefix] s)
603 @end example
605 @noindent
606 and make answers in minibuffer like this.
608 @example
609 (C-v for view) \???@{@} (default vspace*): addtolength
610 \addtolength@{???@}: \topmargin
611 Argument 2: 8mm
612 @end example
614 @code{\addtolength} and the first argument @code{\topmargin} can be typed
615 easily by completing read. Since YaTeX also learns the number of
616 arguments of section-type command and will ask that many arguments in
617 future completion, you had better tell the number of arguments to YaTeX at
618 the first completion of the new word. But you can change the number of
619 arguments by calling the completion with different universal argument
620 again.
623 Invoking section-type completion with @code{[Prefix] S} (Capital `S')
624 includes the region as the first argument of section-type command.
626 The section/large/maketitle type completion can work at the
627 prompt for the argument of other section-type completion.
628 Nested La@TeX{} commands are efficiently read with the recursive
629 completion by typing YaTeX's completion key sequence in the
630 minibuffer.
632 @menu
633 * view-sectioning::
634 @end menu
636 @node view-sectioning, , Section-type completion, Section-type completion
637 @comment node-name, next, previous, up
638 @subsection view-sectioning
639 @cindex view sectioning
640 @cindex outline
642 In the minibuffer at the prompt of section-type command completion,
643 typing @kbd{C-v} shows a list of sectioning commands in source text(The
644 line with @code{<<--} mark is the nearest sectioning command). Then,
645 default sectioning command appears in the minibuffer. You can go up/down
646 sectioning command by typing @kbd{C-p}/@kbd{C-n}, can scrolls up/down the
647 listing buffer by @kbd{C-v}/@kbd{M-v}, and can hide sectioning commands
648 under certain level by 0 through 6. Type @kbd{?} in the minibuffer of
649 sectioning prompt for more information.
651 You can generate this listing buffer (@code{*Sectioning Lines*} buffer)
652 by typing
653 @table @kbd
654 @item M-x YaTeX-section-overview
655 @dots{} Generate *Sectioning Lines* buffer
656 @end table
657 @cindex{Generate the listing of sectioning units}
658 from the LaTeX source buffer. In this listing buffer, typing @kbd{u} on
659 the sectioning command shifts up the corresponding sectioning command in
660 source text and @kbd{d} shifts down. After marking lines in the listing
661 buffer, typing @kbd{U} shifts up all sectioning commands in the region,
662 and @kbd{U} shifts down. Here are all the key bindings of
663 @code{*Sectioning Lines*} buffer.
665 @table @kbd
666 @item SPC
667 @dots{} Jump to corresponding source line
668 @item .
669 @dots{} Display corresponding source line
670 @item u
671 @dots{} Shift up a sectioning line
672 @item d
673 @dots{} Shift down a sectioning line
674 @item U
675 @dots{} Shift up sectioning lines in region
676 @item D
677 @dots{} Shift down sectioning lines in region
678 @item 0@dots{}6
679 @dots{} Hide sectioning commands whose level is lower than n
680 @end table
683 @node Large-type completion, Maketitle-type completion, Section-type completion, Completion
684 @comment node-name, next, previous, up
685 @section Large-type completion
687 "Large-type completion" inputs the font or size changing
688 descriptions such as @code{@{\large @}}. When you type
690 @table @kbd
691 @item [prefix] l
692 @dots{} large-type completion
693 @end table
695 @noindent
696 the message in the minibuffer
698 @example
699 @{\??? @} (default large):
700 @end example
702 prompts prompts you large-type command with completing-read. There are
703 TeX commands to change fonts or sizes, @code{it}, @code{huge} and so on,
704 in the completion table.
706 Region-based completion is also invoked by changing the letter after
707 prefix key stroke as @kbd{[prefix] L}. It encloses the region by braces
708 with large-type command.
710 @node Maketitle-type completion, Arbitrary completion, Large-type completion, Completion
711 @comment node-name, next, previous, up
712 @section Maketitle-type completion
713 @cindex maketitle-type completion
715 We call it "maketitle-type completion" which completes commands such as
716 @code{\maketitle}. Take notice that maketitle-type commands take no
717 arguments. Then, typing
719 @table @kbd
720 @item [prefix] m
721 @dots{} maketitle-type completion
722 @end table
724 @noindent
725 begins maketitle-completion. Above mentioned method is true for
726 maketitle-completion, and there are La@TeX{} commands with no
727 arguments in completion table.
729 @node Arbitrary completion, End completion, Maketitle-type completion, Completion
730 @comment node-name, next, previous, up
731 @section Arbitrary completion
732 @cindex arbitrary completion
734 @noindent
735 You can complete certain La@TeX{} command anywhere without typical
736 completing method as described, by typing
738 @table @kbd
739 @item [prefix] SPC
740 @dots{} arbitrary completion
741 @end table
743 @noindent
744 after the initial string of La@TeX{} command that is preceded by @code{\}.
746 @node End completion, Accent completion, Arbitrary completion, Completion
747 @comment node-name, next, previous, up
748 @section End completion
749 @cindex end completion
751 @noindent
752 YaTeX automatically detects the opened environment and close it with
753 \@code{\end@{environment@}}. Though proficient YaTeX users never fail to
754 make environment with begin-type completion, some may begin an environment
755 manually. In that case, type
757 @table @kbd
758 @item [prefix] e
759 @dots{} @code{end} completion
760 @end table
762 @noindent
763 at the end of the opened environment.
765 @node Accent completion, Image completion, End completion, Completion
766 @comment node-name, next, previous, up
767 @section Accent completion
768 @cindex accent completion
770 When you want to write the European accent marks(like @code{\`@{o@}}),
772 @table @kbd
773 @item [prefix] a
774 @dots{} accent completion
775 @end table
777 @noindent
778 shows the menu
780 @example
781 1:` 2:' 3:^ 4:" 5:~ 6:= 7:. u v H t c d b
782 @end example
784 @noindent
785 in the minibuffer. Chose one character or corresponding numeric,
786 and you will see
788 @example
789 \`@{@}
790 @end example
792 @noindent
793 in the editing buffer with the cursor positioned in braces. Type
794 one more character `o' for example, then
796 @example
797 \`@{o@}
798 @end example
800 @noindent
801 will be completed, and the cursor gets out from braces.
803 @node Image completion, Greek letters completion, Accent completion, Completion
804 @comment node-name, next, previous, up
805 @section Image completion of mathematical sign
806 @cindex image completion
807 @cindex math-mode
808 @cindex sigma
809 @cindex leftarrow
810 @cindex ;
812 Arrow marks, sigma mark and those signs mainly used in the
813 TeX's math environment are completed by key sequences which
814 imitate the corresponding symbols graphically. This completion
815 only works in the math environment. YaTeX automatically detects
816 whether the cursor located in math environment or not, and
817 change the behavior of key strokes @kbd{;} and @kbd{:}.
819 By the way, we often express the leftarrow mark by `<-' for example.
820 Considering such image, you can write @code{\leftarrow} by typing @kbd{<-}
821 after @kbd{;} (semicolon) as a prefix. In the same way,
822 @code{\longleftarrow} (@code{<--}) is completed by typing @kbd{;<--},
823 infinity mark which is imitated by @code{oo} is completed by typing
824 @kbd{;oo}.
826 Here are the sample operations in YaTeX math-mode.
828 @example
829 INPUT Completed La@TeX{} commands
830 ; < - @code{\leftarrow}
831 ; < - - @code{\longleftarrow}
832 ; < - - > @code{\longleftrightarrow}
833 ; o @code{\circ}
834 ; o o @code{\infty}
835 @end example
837 In any case, you can quit from image completion and can move
838 to the next editing operation if the La@TeX{} command you want is
839 shown in the buffer.
841 @code{;} itself in math-environment is inserted by @kbd{;;}. Typing
842 @kbd{TAB} in the midst of image completion shows all of the La@TeX{}
843 commands that start with the same name as string you previously typed in.
844 In this menu buffer, press @kbd{RET} after moving the cursor (by @kbd{n},
845 @kbd{p}, @kbd{b}, @kbd{f}) to insert the La@TeX{} command.
847 To know all of the completion table, type @kbd{TAB} just after @kbd{;}.
848 And here is the sample menu by @kbd{TAB} after @kbd{;<}.
850 @example
851 KEY LaTeX sequence sign
852 < \leq <
853 ~
854 << \ll <<
855 <- \leftarrow <-
856 <= \Leftarrow <=
857 @end example
859 You can define your favorite key-vs-sequence completion table in the
860 Emacs-Lisp variable @code{YaTeX-math-sign-alist-private}. See also
861 @file{yatexmth.el} for the information of the structure of this variable.
863 @node Greek letters completion, , Image completion, Completion
864 @comment node-name, next, previous, up
865 @section Greek letters completion
866 @cindex Greek letters completion
867 @cindex :
869 Math-mode of YaTeX provides another image completion, Greek letters
870 completion in the same method. After prefix @kbd{:}, typing @kbd{a} makes
871 @code{\alpha}, @kbd{b} makes @code{\beta} and @kbd{g} makes @code{\gamma}
872 and so on. First, type @kbd{:TAB} to know all the correspondence of
873 alphabets vs. Greek letters.
875 If you will find @kbd{;} or @kbd{:} doesn't work in correct position of
876 math environment, it may be a bug of YaTeX. Please send me a bug report
877 with the configuration of your text, and avoid it temporarily by typing
878 @kbd{;} or @kbd{:} after universal-argument(@kbd{C-u}) which forces
879 @kbd{;} and @kbd{:} to work as math-prefix.
881 @node Local dictionaries, Commenting out, Completion, Top
882 @comment node-name, next, previous, up
883 @chapter Local dictionaries
884 @cindex local dictionaries
885 @cindex nervous users
887 Tables for completion consist of three dictionaries; `standard
888 dictionary' built in @file{yatex.el}, `user dictionary' for your common
889 private commands, and `local dictionary' that is effective in a certain
890 directory.
892 When you input the command unknown to YaTeX at a completion in the
893 minibuffer, YaTeX asks you with the following prompt;
895 @example
896 `foo' is not in table. Register into: U)serDic L)ocalDic N)one D)iscard
897 @end example
899 @noindent
900 In this menu, typing @kbd{u} updates your `user dictionary', @kbd{l}
901 updates your local dictionary, @kbd{n} updates only on-memory dictionary
902 which go through only current Emacs session, and @kbd{d} updates no
903 dictionary and throws the new word away.
905 If you find this switching feature meaningless and bothersome, put the
906 next expression into your @file{~/.emacs}
908 @lisp
909 (setq YaTeX-nervous nil)
910 @end lisp
912 @node Commenting out, Cursor jump, Local dictionaries, Top
913 @comment node-name, next, previous, up
914 @chapter Commenting out
915 @cindex commenting out
916 @cindex prefix >
917 @cindex prefix <
918 @cindex prefix ,
919 @cindex prefix .
921 You may want to comment out some region.
923 @table @kbd
924 @item [prefix] >
925 @dots{} comment out region by %
926 @item [prefix] <
927 @dots{} uncomment region
928 @end table
930 @noindent
931 cause an operation to the region between point and mark.
933 @table @kbd
934 @item [prefix] .
935 @dots{} comment out current paragraph
936 @item [prefix] ,
937 @dots{} uncomment current paragraph
938 @end table
940 @noindent
941 comments or uncomments the paragraph where the cursor belongs.
942 This `paragraph' means the region marked by the function
943 mark-paragraph, bound to @kbd{ESC h} by default. It is NOT
944 predictable what will happen when you continuously comment out
945 some paragraph many times.
947 You can also comment out an environment between @code{\begin} and
948 @code{\end}, or a @code{\begin}-\@code{\end} pair themselves, by making the
949 following key strokes on the line where @code{\begin@{@}} or
950 @code{\end@{@}} exists.
952 @table @kbd
953 @item [prefix] >
954 @dots{} comment out from \begin to \@code{end}
955 @item [prefix] <
956 @dots{} uncomment from \begin to \@code{end}
957 @end table
959 @noindent
960 comment whole the contents of environment. Moreover,
962 @table @kbd
963 @item [prefix] .
964 @dots{} comment out \begin and \@code{end}
965 @item [prefix] ,
966 @dots{} uncomment \begin and \@code{end}
967 @end table
969 @noindent
970 (un)comments out only environment declaration: @code{\begin@{@}} and
971 @code{\end@{@}}. NOTE that even if you intend to comment out some region,
972 invoking @kbd{[prefix] >} on the @code{\begin},@code{\end} line decides to
973 work in `commenting out from @code{\begin} to @code{\end}' mode.
976 @node Cursor jump, Changing and Deleting, Commenting out, Top
977 @comment node-name, next, previous, up
978 @chapter Cursor jump
979 @cindex cursor jump
980 @cindex prefix g
983 @menu
984 * Jump to corresponding object::
985 * Invoking image processor::
986 * Jump to main file::
987 * Jumping around the environment::
988 * Jumping to last completion position::
989 @end menu
991 @node Jump to corresponding object, Invoking image processor, Cursor jump, Cursor jump
992 @comment node-name, next, previous, up
993 @section Jump to corresponding object
995 Typing
997 @table @kbd
998 @item [prefix] g
999 @dots{} go to corresponding object
1000 @end table
1002 @noindent
1003 in a certain place move the cursor to the place corresponding to the
1004 La@TeX{} command of last place. YaTeX recognize the followings as pairs
1005 that have relation each other.
1007 @itemize @bullet
1008 @item @code{\begin@{@}} <-> @code{\end@{@}}
1009 @item @code{%#BEGIN} <-> @code{%#END}
1010 @item On the image-including line -> corresponding viewer or drawing tool
1011 @item @code{\label@{@}} <-> @code{\ref@{@}}
1012 @item @code{\include(\input)} -> included file
1013 @item @code{\bibitem@{@}} <-> @code{\cite@{@}}
1014 @end itemize
1016 On a @code{\begin},@code{\end} line, typing @kbd{[prefix] g} moves the
1017 cursor to the corresponding @code{\end},@code{\begin} line, if its partner
1018 really exists. The behavior on the line @code{%#BEGIN} and @code{%#END}
1019 are the same. Note that if the correspondent of @code{label/ref} or
1020 @code{cite/bibitem} exists in another file, that file have to be opened to
1021 make a round trip between references by @kbd{[prefix] g}.
1023 If you type @code{[prefix] g} on the line of @code{\include@{chap1@}},
1024 typically in the main text, YaTeX switches buffer to @file{chap1.tex}.
1026 @table @kbd
1027 @item [prefix] 4 g
1028 @dots{} go to corresponding object in other window
1029 @end table
1031 @noindent
1032 do the same job as @kbd{[prefix] g} except it's done in other window.
1033 Note that this function doesn't work on @code{begin/end},
1034 @code{%#BEGIN/%#END} pairs because it is meaningless.
1036 @node Invoking image processor, Jump to main file, Jump to corresponding object, Cursor jump
1037 @comment node-name, next, previous, up
1038 @section Invoking image processor
1039 @cindex{Drawing tool invocation}
1041 `image-including line' described above means such lines as
1042 @code{\epsfile@{file=foo.ps@}}. If you type @kbd{[prefix] g} on that
1043 line, YaTeX automatically searches source of `foo.ps' and invokes image
1044 viewer or drawing tool correspoinding to it. For example; if you draw
1045 an image foo.obj with Tgif and enclose its product named foo.eps by
1046 @code{\epsfile} command. Typing @kbd{[prefix] g} on @code{\epsfile} line
1047 make YaTeX invoke @code{tgif foo.obj}. How a processor is choosen is as
1048 follows.
1050 @enumerate
1051 @item
1052 If there is an expression matching with one of the pattern
1053 defined in @code{YaTeX-processed-file-regexp-alist}, extract file name
1054 from regexp group surrounded by \\(\\). (Which group corresponds is
1055 written in the cdr part of each list.) If no matches were found, do
1056 nothing.
1057 @item
1058 If there is a pattern as `%PROCESSOR' which is defined in the variable
1059 @code{YaTeX-file-processor-alist}, call that processor giving the
1060 file name with corresponding extension.
1061 @item
1062 If not, check the existence of each file which is supplied the
1063 extension in the cdr part of each list of
1064 @code{YaTeX-file-processor-alist}. If any, call the corresponding
1065 image viewer or drawing tool.
1066 @end enumerate
1068 @node Jump to main file, Jumping around the environment, Invoking image processor, Cursor jump
1069 @comment node-name, next, previous, up
1070 @section Jump to main file
1072 Typing
1074 @table @kbd
1075 @item [prefix] ^
1076 @dots{} visit main file
1077 @item [prefix] 4^
1078 @dots{} visit main file in other buffer
1079 @end table
1080 @cindex prefix ^
1081 @cindex prefix 4 ^
1083 in a sub text switch the buffer to the main text specified by
1084 @code{%#!} notation.
1086 @node Jumping around the environment, Jumping to last completion position, Jump to main file, Cursor jump
1087 @comment node-name, next, previous, up
1088 @section Jumping around the environment
1090 And these are the functions which work on the current La@TeX{}
1091 environment:
1093 @table @kbd
1094 @item M-C-a
1095 @dots{} beginning of environment
1096 @item M-C-e
1097 @dots{} @code{end} of environment
1098 @item M-C-@@
1099 @dots{} mark environment
1100 @end table
1101 @cindex M-C-a
1102 @cindex M-C-e
1103 @cindex M-C-@@
1105 @node Jumping to last completion position, , Jumping around the environment, Cursor jump
1106 @comment node-name, next, previous, up
1107 @section Jumping to last completion position
1109 YaTeX always memorize the position of completion into register @code{3}.
1110 So every time you make a trip to any other part of text other than you are
1111 writing, you can return to the editing paragraph by calling
1112 register-to-point with argument YaTeX-current-position-register, which is
1113 achieved by typing @kbd{C-x j 3}(by default).
1115 @node Changing and Deleting, Filling, Cursor jump, Top
1116 @comment node-name, next, previous, up
1117 @chapter Changing and Deleting
1119 These functions are for change or deletion of La@TeX{} commands
1120 already entered.
1122 @table @kbd
1123 @item [prefix] c
1124 @dots{} change La@TeX{} command
1125 @item [prefix] k
1126 @dots{} kill La@TeX{} command
1127 @end table
1128 @cindex prefix c
1129 @cindex prefix k
1131 @menu
1132 * Changing LaTeX commands::
1133 * Killing LaTeX commands::
1134 @end menu
1136 @node Changing LaTeX commands, Killing LaTeX commands, Changing and Deleting, Changing and Deleting
1137 @comment node-name, next, previous, up
1138 @section Changing La@TeX{} commands
1140 @kbd{[prefix] c} can change the various (La)@TeX{} commands. This can
1141 change the followings.
1142 @itemize @bullet
1143 @item Environment names
1144 @item Section-type commands
1145 @item Argument of section-type commands
1146 @item Optional parameters (enclosed by []) of section-type commands
1147 @item Font/size designators
1148 @item Math-mode's maketitle-type commands that can be inputted with
1149 image completion
1150 @end itemize
1152 Typing @kbd{[prefix] c} on one of above objects you want to change
1153 brings a suitable reading function sometimes with completion.
1154 Note: If you want to change the argument of section-type command that
1155 contains other La@TeX{} commands, type @kbd{[prefix] c} either of
1156 surrounding braces of the argument in order to make YaTeX ignore the
1157 internal La@TeX{} sequences as an object of changing. Anyway, it is
1158 very difficult to know which argument position the cursor belongs because
1159 the La@TeX{} commands can be nested and braces can freely emerge. So keep
1160 it mind to put the cursor on a brace when you are thinking of changing a
1161 complicated argument.
1163 @node Killing LaTeX commands, , Changing LaTeX commands, Changing and Deleting
1164 @comment node-name, next, previous, up
1165 @section Killing La@TeX{} commands
1166 @cindex Killing La@TeX{} commands
1168 @kbd{[prefix] k} kills the La@TeX{} commands sometimes with their
1169 arguments. Following table illustrates the correspondence of the invoking
1170 position and what is killed.
1172 @example
1173 [Invoking position] [action]
1174 \begin, \end line kill \begin,\end pairs
1175 %#BEGIN, %#END line kill %#BEGIN,%#END pairs
1176 on a Section-type command kill section-type command
1177 on a parenthesis kill parentheses
1178 @end example
1180 Note that when killing @code{\begin, \end} or @code{%#BEGIN, %#END} pair,
1181 the lines @code{\begin, \end} or @code{%#BEGIN, %#END} exist will be
1182 killed entirely. So take care not to create any line that contains more
1183 than one @code{\begin} or so.
1185 While all operations above are to kill `containers' which surround some
1186 text, universal argument (@kbd{C-u}) for these commands kills not only
1187 `containers' but also `contents' of them. See below as a sample.
1189 @example
1190 Original text: [prefix] k C-u [prefix] k
1191 Main \footnote@{note@} here. Main note here. Main here.
1192 ~(cursor)
1193 @end example
1195 @node Filling, Updation of includeonly, Changing and Deleting, Top
1196 @comment node-name, next, previous, up
1197 @chapter Filling
1198 @cindex filling
1200 @section Filling an item
1201 @cindex filling an item
1202 @cindex prefix i
1204 To fill a term (descriptive sentences) of @code{\item}, type
1206 @c @table @kbd
1207 @c @item [prefix] i
1208 @c @dots{} fill item
1209 @c @end table
1210 @table @kbd
1211 @item M-q
1212 @dots{} fill item
1213 @end table
1215 @noindent
1216 on that item.
1218 YaTeX uses the value of the variable @code{YaTeX-item-regexp} as the
1219 regular expression to search item header in itemize environment.
1220 If you make a newcommand to itemize terms(e.g. @code{\underlineitem}), put
1222 @lisp
1223 (setq YaTeX-item-regexp
1224 "\\(\\\\\\(sub\\)*item\\)\\|\\(\\\\underlineitem\\)")
1225 @end lisp
1226 @cindex YaTeX-item-regexp
1228 in your @file{~/.emacs}. If you are not familiar with regular expression
1229 for Emacs-Lisp, name a newcommand for `itemize' beginning with
1230 @code{\item} such as @code{\itembf}, not @code{\bfitem}.
1232 This function reformats the @code{\item} into `hang-indented' style.
1233 For example:
1235 @example
1236 itemize, enumerate environment:
1238 >\item[foo] `foo' is the typical word for describing an
1239 > arbitrarily written....
1240 description environment:
1241 > \item[bar] When the word `for' is used as an arbitrarily
1242 > word, `bar' is bound to follow it.
1243 @end example
1245 Note that the indent depth of an @code{\item} word and its descriptive
1246 paragraph are the same in latter case. If you want to use different
1247 depth, invoke fill-paragraph at the beginning of non-whitespace
1248 character(see below).
1250 @section Filling paragraph
1251 @cindex Filling paragraph
1252 @cindex M-q
1254 Fill-paragraph is little bit adapted for La@TeX{} sources. It retains from
1255 filling in certain environments where formatting leads to a disaster such
1256 as verbatim, tabular, or so. And it protects @code{\verb} expressions
1257 from being folded (The variable @code{YaTeX-verb-regexp} controls this).
1258 Besides, putting cursor on the first occurrence of non-whitespace
1259 character on a line changes the fill-prefix temporarily to the depth of
1260 the line.
1262 @node Updation of includeonly, What column, Filling, Top
1263 @comment node-name, next, previous, up
1264 @chapter Updation of @code{\includeonly}
1265 @cindex includeonly
1267 When you edit splitting source texts, the notation
1269 @example
1270 \includeonly@{CurrentEditingFileName@}
1271 @end example
1273 @noindent
1274 in the main file reduces the time of typesetting. If you want
1275 to hack other file a little however, you have to rewrite it to
1277 @example
1278 \includeonly@{OtherFileNameYouWantToFix@}
1279 @end example
1281 @noindent
1282 in the main file. YaTeX automatically detects that the current
1283 edited text is not in includeonly list and prompts you
1285 @example
1286 A)dd R)eplace %)comment?
1287 @end example
1289 in the minibuffer. Type @kbd{a} if you want to add the current file name
1290 to @code{\includeonly} list, @kbd{r} to replace \@code{includeonly} list
1291 with the current file, and type @kbd{%} to comment out the
1292 @code{\includeonly} line.
1294 @node What column, Intelligent newline, Updation of includeonly, Top
1295 @comment node-name, next, previous, up
1296 @chapter What column?
1297 @cindex what column
1298 @cindex complex tabular
1299 @cindex prefix &
1301 We are often get tired of finding the corresponding column in
1302 large tabulars. For example,
1304 @example
1305 \begin@{tabular@}@{|c|c|c|c|c|c|c|c|@}\hline
1306 Name&Position&Post No.&Addr.&Phone No.&FAX No.&
1307 Home Addr.&Home Phone\\ \hline
1308 Thunder Bird & 6 & 223 & LA & xxx-yyy &
1309 zzz-www & Japan & 9876-54321 \\
1310 & 2 & \multicolumn@{2@}@{c|@}@{Unknown@}
1311 &&&(???)
1312 \\ \hline
1313 \end@{tabular@}
1314 @end example
1316 Suppose you have the cursor located at @code{(???)} mark, can you tell
1317 which column it is belonging at once? Maybe no. In such case,
1318 type
1320 @table @kbd
1321 @item [prefix] &
1322 @dots{} What column
1323 @end table
1325 @noindent
1326 in that position. YaTeX tells you the column header of the
1327 current field. Since YaTeX assumes the first line of tabular
1328 environment as a row of column headers, you can create a row of
1329 virtual column headers by putting them in the first line and
1330 commenting that line with @code{%}.
1332 @node Intelligent newline, Usepackage checker, What column, Top
1333 @comment node-name, next, previous, up
1334 @chapter Intelligent newline
1335 @cindex Intelligent newline
1336 @cindex ESC RET
1337 @cindex M-C-m
1339 At the end of begin-type completion of tabular[*], array, itemize,
1340 enumerate or tabbing environment, or typing
1342 @table @kbd
1343 @item ESC RET
1344 @dots{} Intelligent newline
1345 @end table
1347 @noindent
1348 in these environments inserts the contents corresponding to the current
1349 environment in the next line. (At the begin-type completion, this
1350 contents can be removed by `undo'.) In @code{tabular} environment, for
1351 example, @kbd{ESC RET} inserts the certain number of @code{&} and trailing
1352 @code{\\}, and @code{\hline} if other @code{\hline} is found in backward.
1353 Here are the list of contents vs. environments.
1355 @itemize
1356 @item @code{tabular}, @code{tabular*}, @code{array}
1358 Corresponding number of @code{&} and @code{\\}.
1359 And @code{\hline} if needed.
1361 @item @code{tabbing}
1363 The same number of @code{\>} as @code{\=} in the first line.
1365 @item @code{itemize}, @code{enumerate}, @code{description}, @code{list}
1367 @code{\item} or @code{item[]}.
1368 @end itemize
1370 Note that since this function works seeing the contents of the first
1371 line, please call this after the second line if possible.
1373 If you want to apply these trick to other environments, @code{foo}
1374 environment for example, define the function named
1375 @code{YaTeX-intelligent-newline-foo} to insert corresponding contents.
1376 That function will be called at the beginning of the next line after the
1377 newline is inserted to the current line. Since the function
1378 @code{YaTeX-indent-line} is designed to indent the current line properly,
1379 calling this function before your code to insert certain contents must be
1380 useful. See the definition of the function
1381 @code{YaTeX-intelligent-newline-itemize} as an example.
1383 @node Usepackage checker, Online help, Intelligent newline, Top
1384 @comment node-name, next, previous, up
1385 @chapter Usepackage checker
1386 @cindex usepackage
1388 When you input begint-type, section-type, maketitle-type macros with
1389 completion, and it requires some LaTeX2e package, YaTeX examines
1390 the existence of correct @code{\usepackage}. If not, YaTeX inserts
1391 the @code{\usepackage@{@}} declaration corresponding to input macro.
1393 To activate the package completion for your favarite package,
1394 set the variable @code{YaTeX-package-alist-private} correctly.
1395 Please refere the value of @code{YaTeX-package-alist-default} as an
1396 example.
1398 @node Online help, Browsing file hierarchy, Usepackage checker, Top
1399 @comment node-name, next, previous, up
1400 @chapter Online help
1401 @cindex online help
1402 @cindex prefix ?
1403 @cindex prefix /
1404 @cindex apropos
1405 @cindex keyword search
1407 YaTeX provides you the online help with popular La@TeX{} commands.
1409 Here are the key strokes for the online help.
1411 @table @kbd
1412 @item [prefix] ?
1413 @dots{} Online help
1414 @item [prefix] /
1415 @dots{} Online apropos
1416 @end table
1418 @section Online help
1420 `Online help' shows the documentation for the popular La@TeX{}
1421 commands(defaults to the commands on the cursor) in the next buffer.
1422 There are two help file, `global help' and `private help'. The former
1423 file contains the descriptions on the standard La@TeX{} command and is
1424 specified its name by variable @code{YaTeX-help-file}. Usually, the
1425 global help file should be located in public space (@code{$EMACSEXECPATH}
1426 by default) and should be world writable so that anyone can update it to
1427 enrich its contents. The latter file contains descriptions on
1428 non-standard or personal command definitions and is specified by
1429 @code{YaTeX-help-file-private}. This file should be put into private
1430 directory.
1432 @section Online apropos
1434 `Online apropos' is an equivalent of GNU Emacs's apropos. It
1435 shows all the documentations that contains the keyword entered by
1436 the user.
1438 @section When no descriptions are found...
1440 If there is no description on a command in help files, YaTeX
1441 requires you to write a description on that command. If you are
1442 willing to do, determine which help file to add and write the
1443 description on it referring your manual of (La)TeX. Please send
1444 me your additional descriptions if you describe the help on some
1445 standard commands. I might want to include it in the next
1446 distribution.
1448 @node Browsing file hierarchy, Cooperation with other packages, Online help, Top
1449 @comment node-name, next, previous, up
1450 @chapter Browsing file hierarchy
1451 @cindex hierarchy
1452 @cindex browsing
1454 When you are editing multi-file source, typing
1456 @table @kbd
1457 @item [prefix] d
1458 @dots{} browse file hierarchy
1459 @end table
1461 @noindent
1462 asks you the parent-most file (which may be defaulted) and displays the
1463 documentation hierarchy in the next window. In this buffer, the following
1464 commands are available.
1466 @table @kbd
1467 @item n
1468 @dots{} move to the next line and show its contents
1469 @item p
1470 @dots{} move to the previous line and show its contents
1471 @item N
1472 @dots{} move to the next file in the same inclusion level
1473 @item P
1474 @dots{} move to the previous file in the same inclusion level
1475 @item j
1476 @dots{} move to the next line
1477 @item k
1478 @dots{} move to the previous line
1479 @item u
1480 @dots{} move to the parent file
1481 @item .
1482 @dots{} show the current files contents in the next window
1483 @item SPC
1484 @dots{} scroll up the current file window
1485 @item DEL, b
1486 @dots{} scroll down the current file window
1487 @item <
1488 @dots{} show the beginning of the current file
1489 @item >
1490 @dots{} show the end of the current file
1491 @item >
1492 @dots{} return to the previous postion after @kbd{<} or @kbd{>}
1493 @item RET, g
1494 @dots{} open the current file in the next window
1495 @item mouse-2
1496 @dots{} same as RET(available only with window system)
1497 @item o
1498 @dots{} other window
1499 @item 1
1500 @dots{} delete other windows
1501 @item -
1502 @dots{} shrink hierarchy buffer window
1503 @item +
1504 @dots{} enlarge hierarchy buffer window
1505 @item ?
1506 @dots{} describe mode
1507 @item q
1508 @dots{} quit
1509 @end table
1511 Note that operations on the file contents in the next window do not work
1512 correctly when you close the corresponding file.
1514 @node Cooperation with other packages, Customizations, Browsing file hierarchy, Top
1515 @comment node-name, next, previous, up
1516 @chapter Cooperation with other packages
1518 YaTeX works better with other brilliant packages.
1520 @section gmhist
1521 @cindex gmhist
1522 @cindex command history
1523 @cindex minibuffer history
1525 When you are loading @file{gmhist.el} and @file{gmhist-mh.el}, you can
1526 use independent command history list at the prompt of preview command
1527 (@kbd{[prefix] tp}) and print command (@kbd{[prefix] tl}). On each
1528 prompt, you can enter the previous command line string repeatedly by
1529 typing @kbd{M-p}.
1531 @section min-out
1532 @cindex min-out
1534 @file{min-out}, the outline minor mode, can be used in yatex-mode
1535 buffers. If you want to use it with YaTeX, please refer the
1536 file @file{yatexm-o.el} as an example.
1538 @node Customizations, Etcetera, Cooperation with other packages, Top
1539 @comment node-name, next, previous, up
1540 @chapter Customizations
1541 @cindex customizations
1543 You can customize YaTeX by setting Emacs-Lisp variables and by making
1544 add-in functions.
1546 @menu
1547 * Lisp variables::
1548 * Add-in functions::
1549 * Add-in generator::
1550 @end menu
1552 @node Lisp variables, Add-in functions, Customizations, Customizations
1553 @comment node-name, next, previous, up
1554 @section Lisp variables
1555 @cindex customizable variables
1557 You can change the key assignments or make completion more comfortable
1558 by setting the values of various variables which control the movement of
1559 yatex-mode.
1561 For example, if you want to change the prefix key stroke from @kbd{C-c}
1562 to any other sequence, set YaTeX-prefix to whatever you want to use. If
1563 you don't want to use the key sequence @kbd{C-c letter} which is assumed
1564 to be the user reserved sequence in Emacs world, set
1565 @code{YaTeX-inhibit-prefix-letter} to @code{t}, and all of the default key
1566 bind of @kbd{C-c letter} will turn to the corresponding @kbd{C-c C-letter}
1567 (but the region based completions that is invoked with @kbd{C-c
1568 Capital-letter} remain valid, if you want to disable those bindings, set
1569 that variable to 1 instead of @code{t}).
1571 @menu
1572 * All customizable variables::
1573 * Sample definitions::
1574 * Hook variables::
1575 * Hook file::
1576 @end menu
1578 @node All customizable variables, Sample definitions, Lisp variables, Lisp variables
1579 @comment node-name, next, previous, up
1580 @subsection All customizable variables
1581 @cindex all customizable variables
1583 Here are the customizable variables of yatex-mode. Each value setq-ed
1584 in @file{~/.emacs} is preferred and that of defined in @file{yatex.el} is
1585 neglected. Parenthesized contents stands for the default value. When you
1586 are to change some of these variables, see more detailed documentation of
1587 the variable by @kbd{M-x describe-variable}.
1589 @defvar YaTeX-japan
1590 Set this nil to produce all messages in English
1591 (@code{Depends on Japanese feature of Emacs})
1592 @end defvar
1594 @defvar YaTeX-kanji-code
1595 Default buffer-file-coding-system for YaTeX modes' buffer.
1596 Set this 0 to no language conversion. Nil to preserve original
1597 coding-system. 1=Shift JIS, 2=JIS, 3=EUC, 4=UTF-8 (@code{1 or 2})
1598 @end defvar
1600 @defvar YaTeX-prefix
1601 Prefix key stroke (@kbd{C-c})
1602 @end defvar
1604 @defvar YaTeX-inhibit-prefix-letter
1605 Change key stroke from @kbd{C-c letter} to @kbd{C-c C-letter} (@code{nil})
1606 @end defvar
1608 @defvar YaTeX-fill-prefix
1609 Fill-prefix used in yatex-mode (@code{nil})
1610 @end defvar
1612 @defvar YaTeX-user-completion-table
1613 Name of user dictionary where learned completion table will be stored.
1614 (@code{"~/.yatexrc"})
1615 @end defvar
1617 @defvar tex-command
1618 La@TeX{} typesetter command (@code{"latex"})
1619 @end defvar
1621 @defvar dvi2-command
1622 Preview command (@code{"xdvi -geo +0+0 -s 4"})
1623 @end defvar
1625 @defvar dviprint-command-format
1626 Command format to print dvi file (@code{"dvi2ps %f %t %s | lpr"})
1627 @end defvar
1629 @defvar dviprint-from-format
1630 Start page format of above %f. %b will turn to start page (@code{"-f %b"})
1631 @end defvar
1633 @defvar dviprint-to-format
1634 End page format of above %t. %e will turn to @code{end} page (@code{"-t %e"})
1635 @end defvar
1637 @defvar makeindex-command
1638 Default makeindex command (@code{"makeindex"} (@code{"makeind"} on MS-DOS))
1639 @end defvar
1641 @defvar YaTeX-need-nonstop
1642 Put @code{\nonstopmode@{@}} or not (@code{nil})
1643 @end defvar
1645 @defvar latex-warning-regexp
1646 Regular expression of warning message latex command puts out
1647 (@code{"line.* [0-9]*"})
1648 @end defvar
1650 @defvar latex-error-regexp
1651 Regular expression of error message (@code{"l\\.[1-9][0-9]*"})
1652 @end defvar
1654 @defvar latex-dos-emergency-message
1655 Message latex command running on DOS puts at abort (@code{"Emergency stop"})
1656 @end defvar
1658 @defvar YaTeX-item-regexp
1659 Regular expression of item command (@code{"\\\\item"})
1660 @end defvar
1662 @defvar YaTeX-verb-regexp
1663 Regexp of verb family. Omit \\\\. (@code{"verb\\*?\\|path"})
1664 @end defvar
1666 @defvar YaTeX-nervous
1667 T for using local dictionary (@code{t})
1668 @end defvar
1670 @defvar YaTeX-sectioning-regexp
1671 Regexp of La@TeX{} sectioning command
1672 (@code{"\\(part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\*?\\)\\b"})
1673 @end defvar
1675 @defvar YaTeX-fill-inhibit-environments
1676 Inhibit fill in these environments
1677 (@code{'("tabular" "tabular*" "array" "picture" "eqnarray" "eqnarray*" "equation" "math" "displaymath" "verbatim" "verbatim*")})
1678 @end defvar
1680 @defvar YaTeX-uncomment-once
1681 T for deleting all preceding @code{%} (@code{nil})
1682 @end defvar
1684 @defvar YaTeX-close-paren-always
1685 T for always close all parenthesis automatically, @code{nil} for only eol
1686 (@code{t})
1687 @end defvar
1689 @defvar YaTeX-auto-math-mode
1690 Switch math-mode automatically (@code{t})
1691 @end defvar
1693 @defvar YaTeX-math-key-list-private
1694 User defined alist, math-mode-prefix vs completion alist
1695 used in image completion (@code{nil}). See @file{yatexmth.el}
1696 for the information about how to define a completion alist.
1697 @end defvar
1699 @defvar YaTeX-default-pop-window-height
1700 Initial height of typesetting buffer when one-window.
1701 Number for the lines of the buffer, numerical string for
1702 the percentage of the screen-height. @code{nil} for half height (10)
1703 @end defvar
1705 @defvar YaTeX-help-file
1706 Global online help file name (@file{$doc-directory/../../site-lisp/YATEXHLP.eng})
1707 @end defvar
1709 @defvar YaTeX-help-file-private
1710 Private online help file name (@file{"~/YATEXHLP.eng"})
1711 @end defvar
1713 @defvar YaTeX-no-begend-shortcut
1714 Disable [prefix] b ?? shortcut (@code{nil)}
1715 @end defvar
1717 @defvar YaTeX-hilit-pattern-adjustment-private
1718 List of the list that contain the regular expression and the symbol of
1719 logical meaning of the string that matches the pattern. See also the
1720 value from @code{(assq 'yatex-mode hilit-patterns-alist)} and the value of
1721 @code{YaTeX-hilit-pattern-adjustment-default} (and even the document of
1722 hilit19.el).
1723 @end defvar
1725 @defvar YaTeX-sectioning-level
1726 Alist of LaTeX's sectioning command vs its height.
1727 @end defvar
1729 @defvar YaTeX-hierarchy-ignore-heading-regexp
1730 @code{YaTeX-display-hierarchy} searches for sectioning command first, and
1731 comment line secondary as a file headings. In latter case, ignore lines
1732 that match with regular expression of this variable. Default value of
1733 this variable is RCS header expressions and mode specifying line `-*- xxxx
1734 -*'.
1735 @end defvar
1737 @defvar YaTeX-skip-default-reader
1738 Non-nil for this variable skips the default argument reader of
1739 section-type command when add-in function for it is not defined
1740 (@code{nil})
1741 @end defvar
1743 @defvar YaTeX-create-file-prefix-g
1744 When typing @kbd{prefix g} on the @code{\include} line,
1745 open the target file even if the file doesn't exist (@code{nil})
1746 @end defvar
1748 @defvar YaTeX-simple-messages
1749 Simplyfy messages of various completions (@code{nil})
1750 @end defvar
1752 @defvar YaTeX-hilit-sectioning-face
1753 When hilit19 and yatex19 is active, YaTeX colors the sectioning commands.
1754 This variable specifies the foreground and background color of
1755 @code{\part} macro. The default value is @code{'(yellow/dodgerblue
1756 yellow/slateblue)}. The first element of this list is for the screen when
1757 @code{hilit-background-mode} is @code{'light}, and the second element is
1758 for @code{'dark}. You should specify both color as `forecolor/backcolor'.
1759 @end defvar
1761 @defvar YaTeX-hilit-sectioning-attenuation-rate
1762 When color mode, this variable specifies how much attenuate the color
1763 density of @code{\subparagraph} compared with that of @code{\chapter}
1764 (@code{'(15 40)}) See also @code{YaTeX-hilit-sectioning-face}.
1765 @end defvar
1767 @defvar YaTeX-use-AMS-LaTeX
1768 If you use AMS-LaTeX, set to @code{t} (@code{nil})
1769 @end defvar
1771 @defvar YaTeX-use-LaTeX2e
1772 If you use LaTeX2e, set to @code{t} (@code{t})
1773 @end defvar
1775 @defvar YaTeX-template-file
1776 File name which is automatically inserted at creation
1777 (@code{~/work/template.tex})
1778 @end defvar
1780 @defvar YaTeX-search-file-from-top-directory
1781 Non-nil means to search input-files from the directory where main file exists
1782 (@code{t})
1783 @end defvar
1785 @defvar YaTeX-use-font-lock
1786 Use font-lock to fontify buffer or not (@code{(featurep 'font-lock)}
1787 @end defvar
1789 @defvar YaTeX-use-hilit19
1790 Use hilit19 to highlight buffer or not (@code{(featurep 'hilit19)}
1791 @end defvar
1793 @defvar YaTeX-use-italic-bold
1794 YaTeX tries to search italic, bold fontsets or not
1795 (@code{t} if Emacs-20 or later). This variable is effective only when
1796 font-lock is used.
1797 (@code{(featurep 'hilit19)}
1798 @end defvar
1800 @defvar YaTeX-singlecmd-suffix
1801 Suffix which is always inserted after maketitle-type macros.
1802 @code{"{}"} is recommended.
1803 @end defvar
1805 @defvar YaTeX-package-alist-private
1806 Alist of LaTeX2e-package name vs. lists of macros in it.
1807 Set this alist properly and YaTeX automatically check the declaratiion of
1808 `usepackage' for corresponding macro, when you input that macro with
1809 completion. If required `usepackage' is not found, YaTeX also
1810 automatically inserts `\usepackage'. Alist is as follows;
1811 @lisp
1812 '((PackageName1
1813 (completionType ListOfMacro)
1814 (completionType ListOfMacro))
1815 (PackageName2
1816 (completionType ListOfMacro)
1817 (completionType ListOfMacro...))....)
1818 @end lisp
1819 completionType is one of @code{env, section, maketitle}.
1820 Consult the value of @code{YaTeX-package-alist-default} as an example.
1821 @end defvar
1823 @defvar YaTeX-tabular-indentation
1824 At indentation by @kbd{C-i} in tabular or array environment,
1825 YaTeX put the additional spaces to the normail indentation depth.
1826 The number of additional spaces is the product of YaTeX-tabular-indentation
1827 and the number of column position in tabular.
1828 @end defvar
1830 @defvar YaTeX-noindent-env-regexp
1831 Regexp of environment names that should begin with no indentation.
1832 All verbatime-like environment name should match with.
1833 @end defvar
1835 @defvar YaTeX-ref-default-label-string
1836 Default \\ref time string format.
1837 This format is like strftime(3) but allowed conversion char are as follows;
1838 %y -> Last 2 digit of year, %b -> Month name, %m -> Monthe number(1-12),
1839 %d -> Day, %H -> Hour, %M -> Minute, %S -> Second,
1840 %qx -> alphabetical-decimal conversion of yymmdd.
1841 %qX -> alphabetical-decimal conversion of HHMMSS.
1842 Beware defualt label-string should be always unique. So this format string
1843 should have both time part (%H+%M+%S or %qX) and date
1844 part (%y+(%b|%m)+%d or %qx).
1845 @end defvar
1847 @defvar YaTeX-ref-generate-label-function
1848 Function to generate default label string for unnamed \\label{}s.
1849 The function pointed to this value should take two arguments.
1850 First argument is LaTeX macro's name, second is macro's argument.
1851 Here is an example for using this value.
1852 @lisp
1853 (setq YaTeX-ref-generate-label-function 'my-yatex-generate-label)
1854 (defun my-yatex-generate-label (command value)
1855 (and (string= command "caption")
1856 (re-search-backward "\\\\begin{\\(figure\\|table\\)}" nil t)
1857 (setq command (match-string 1)))
1858 (let ((alist '(("chapter" . "chap")
1859 ("section" . "sec")
1860 ("subsection" . "subsec")
1861 ("figure" . "fig")
1862 ("table" . "tbl"))))
1863 (if (setq command (cdr (assoc command alist)))
1864 (concat command ":" value)
1865 (YaTeX::ref-generate-label nil nil))))
1866 @end lisp
1867 @end defvar
1870 @node Sample definitions, Hook variables, All customizable variables, Lisp variables
1871 @comment node-name, next, previous, up
1872 @subsection Sample definitions
1873 @cindex prefix key stroke
1874 @cindex fill-prefix
1876 For instance, to change the prefix key stroke to @kbd{ESC}, and name of
1877 the user dictionary @file{~/src/emacs/yatexrc}, and set @code{fill-prefix}
1878 to single TAB character, add the following @code{setq} to @file{~/.emacs}.
1880 @lisp
1881 (setq YaTeX-prefix "\e"
1882 YaTeX-user-completion-table "~/src/emacs/yatexrc"
1883 YaTeX-fill-prefix " ")
1884 @end lisp
1886 @node Hook variables, Hook file, Sample definitions, Lisp variables
1887 @comment node-name, next, previous, up
1888 @subsection Hook variables
1889 @cindex hook variables
1891 More customizations will be done by the hook-function defined in
1892 hook-variable @code{yatex-mode-hook}. This is useful to define a shortcut
1893 key sequence to enter some environments other than @code{document} and
1894 @code{enumerate} etc. The following statement defines @code{[prefix] ba}
1895 to enter @code{\begin@{abstract@}} ... @code{=end@{abstract@}}
1896 immediately.
1898 @lisp
1899 (setq yatex-mode-hook
1900 '(lambda() (YaTeX-define-begend-key "ba" "abstract")))
1901 @end lisp
1903 You should use functions @code{YaTeX-define-key}, or
1904 @code{YaTeX-define-begend-key} to define all the key sequences of
1905 yatex-mode.
1907 @node Hook file, , Hook variables, Lisp variables
1908 @comment node-name, next, previous, up
1909 @subsection Hook file
1910 @cindex hook file
1912 You can stuff all of YaTeX related expressions into a file named
1913 @file{yatexhks.el} if you have a lot of codes. YaTeX automatically load
1914 this file at the initialization of itself. Using @file{yatexhks.el}
1915 makes @code{yatex-mode-load-hook} unnecessary.
1917 @node Add-in functions, Add-in generator, Lisp variables, Customizations
1918 @comment node-name, next, previous, up
1919 @section Add-in functions
1920 @cindex add-in functions
1921 @cindex yatexadd.el
1923 You can easily define a function to input detailed arguments
1924 with completion according to La@TeX{} environments or commands.
1926 @c @node What is add-in functions?, , Add-in functions, Add-in functions
1927 @comment node-name, next, previous, up
1928 @subsection What is add-in functions?
1929 @cindex tabular
1931 When you input @code{tabular} environment, don't you think ``I want
1932 YaTeX to complete its argument toward my favorite one such as
1933 @code{@{|c|c|c|@}}...''? Yes, you can define the function to complete
1934 arguments for any environment and any La@TeX{} commands.
1936 @subsection Procedure
1938 Here is the procedure to define add-in functions.
1939 @enumerate
1940 @item
1941 Define the function
1942 @item
1943 Put the function into @file{yatexhks.el}
1944 @end enumerate
1946 @menu
1947 * How the add-in function works::
1948 * How the function is called::
1949 * Useful functions for creating add-in::
1950 * Contribution::
1951 @end menu
1953 @node How the add-in function works, How the function is called, Add-in functions, Add-in functions
1954 @comment node-name, next, previous, up
1955 @subsection How the add-in function works
1957 There are three types of add-in.
1959 @enumerate
1960 @item
1961 Option add-in
1962 @item
1963 argument add-in
1964 @item
1965 enclosing add-in
1966 @end enumerate
1968 @dfn{Option add-in} returns the
1969 La@TeX{}'s optional parameters such as optional strings after
1970 @code{\begin@{ENV@}}, optional strings between a section-type command
1971 and its first argument, and optional strings just after type
1972 maketitle-type command. The following illustrates the name of add-in
1973 functions, where underlined strings are generated by add-in functions.
1975 @display
1976 \begin@{table@}[ht] (Function name: YaTeX:table)
1977 ~~~~
1978 \put(100,200)@{@} (Function name: YaTeX:put)
1979 ~~~~~~~~~
1980 \sum_@{i=0@}^@{n@} (Function name: YaTeX:sum)
1981 ~~~~~~~~~~
1982 @end display
1984 Obviously, the function name is decided by concatenating the prefix
1985 `YaTeX:' and La@TeX{} command's name.
1987 Another add-in type is @dfn{argument add-in}, which completes arguments
1988 for section-type commands.
1990 @display
1991 \newcommand@{\foo@}@{bar@} (Function name: YaTeX::newcommand)
1992 ~~~~ ~~~
1993 @end display
1995 When the section-type command is inputted, the function named by
1996 concatenating `YaTeX::' and section-type command, is called automatically
1997 with an integer argument which indicates which argument of section-type
1998 command is being read. Thus the add-in should determine the
1999 job referring the value of its argument.
2001 @dfn{enclosing add-in} is for modifying and/or checking the region that
2002 will be enclosed by section-type commands via @kbd{[prefix] S}. An
2003 enclosing add-in function will be called with two arguments, beginning of
2004 the enclosed region and end of the region. Suppose you want to enclose
2005 the existing text @code{(a+b)/c} by @code{\frac{}}.
2007 @display
2008 a/c
2009 | |
2010 A B
2011 @end display
2013 You do set-mark-command at point A and then move to point B. Typing
2014 @kbd{[prefix] S} and input @code{frac} enclose the region like this;
2016 @display
2017 \frac{a/c}
2018 @end display
2020 Normally, the expression @code{a/c} is translated to
2021 @code{\frac@{a@}@{c@}}. An enclosing add-in is useful for modifying
2022 @code{/} to @code{@}@{}.
2024 @menu
2025 * Defining option-add-in::
2026 * Defining argument-add-in::
2027 * Defining enclosing-add-in::
2028 @end menu
2030 @node Defining option-add-in, Defining argument-add-in, How the add-in function works, How the add-in function works
2031 @comment node-name, next, previous, up
2032 @subsubsection Defining `option add-in'
2034 If you want @code{@{|c|c|c|@}} for all @code{tabular} environment,
2036 @lisp
2037 (defun YaTeX:tabular ()
2038 "@{|c|c|c|@}")
2039 @end lisp
2041 @noindent
2042 is enough. If you want more complicated format, define as below.
2044 @lisp
2045 (defun YaTeX:tabular ()
2046 "@{@@@{\\vrule width 1pt\\ @}|||@@@{\\ \\vrule width 1pt@}@}")
2047 @end lisp
2049 @noindent
2050 Note that the character @code{\} must be described as @code{\\} in
2051 Emacs-Lisp. The next example reads the tabular format from keyboard.
2052 @lisp
2053 (defun YaTeX:tabular ()
2054 (concat "@{" (read-string "Rule: ") "@}"))
2055 @end lisp
2057 @node Defining argument-add-in, Defining enclosing-add-in, Defining option-add-in, How the add-in function works
2058 @comment node-name, next, previous, up
2059 @subsubsection Defining `argument add-in'
2061 This section describes how to define the add-in function for
2062 @code{\newcommand}.
2064 The first argument of @code{\newcommand} begins always with @code{\}.
2065 The second argument is usually so complex that we can not edit them in the
2066 minibuffer. Here is the created function considering this.
2068 @lisp
2069 (defun YaTeX::newcommand (n) ;n is argument position
2070 (cond
2071 ((= n 1) ;1st argument is macro name
2072 (read-string "Command: " "\\")) ;initial input `\'
2073 ((= n 2) "") ;do nothing when reading arg#2
2074 (t nil)))
2075 @end lisp
2077 Note that when the `argument add-in' function return `nil', normal
2078 argument reader will be called.
2080 @node Defining enclosing-add-in, , Defining argument-add-in, How the add-in function works
2081 @comment node-name, next, previous, up
2082 @subsubsection Defining `enclosing add-in'
2084 This section describes how to define the add-in function for
2085 text enclosed by @code{\frac@{@}}.
2087 When enclosing the text @code{5/3} by @code{\frac@{@}}, you might want to
2088 replace @code{/} with @code{@}@{}. Enclosing function
2089 @code{YaTeX::frac-region} is called with two arguments, beginning of
2090 enclosed text and end of enclosed text. The function is expected to
2091 replace @code{/} with @code{@}@{}. Here is an example expression.
2093 @lisp
2094 (defun YaTeX::frac-region (beg end)
2095 (catch 'done
2096 (while (search-forward "/" end t)
2097 (goto-char (match-beginning 0))
2098 (if (y-or-n-p "Replace this slash(/) with `}{'")
2099 (throw 'done (replace-match "}{")))
2100 (goto-char (match-end 0)))))
2101 @end lisp
2103 @node How the function is called, Useful functions for creating add-in, How the add-in function works, Add-in functions
2104 @comment node-name, next, previous, up
2105 @subsection How the function is called
2107 YaTeX calls the add-in functions for specified begin-type, section-type,
2108 and maketitle-type command, if any. `Option add-in' functions for
2109 begin-type are called when @code{\begin@{ENV@}} has been inserted,
2110 functions for section-type are called just before input of the first
2111 argument, and functions for maketitle-type is called after maketitle-type
2112 command has been inserted. `Argument add-in' functions are called at each
2113 entry of arguments for section-type commands.
2115 @node Useful functions for creating add-in, Contribution, How the function is called, Add-in functions
2116 @comment node-name, next, previous, up
2117 @subsection Useful functions for creating add-in
2119 Many add-in functions for typical La@TeX{} commands are defined in
2120 @file{yatexadd.el}. Those are also useful as references. Here are the
2121 short descriptions on useful functions, where [F] means function, [A]
2122 means arguments, [D] means description.
2124 @table @kbd
2125 @item [F]
2126 YaTeX:read-position
2127 @itemx [A]
2128 Character list which can show up in the brackets
2129 @itemx [D]
2130 Return the location specifier such as `[htb]'. When
2131 nothing is entered, omit [] itself. If the possible characters
2132 are "htbp", call this function as
2133 @code{(YaTeX:read-position "htbp")}
2135 @item [F]
2136 YaTeX:read-coordinates
2137 @itemx [A]
2138 Base prompt, X-axis prompt, Y-axis prompt (each optional)
2139 @itemx [D]
2140 Read the coordinates with the prompt ``BasePrompt X-axisPrompt:'' for
2141 X-axis, ``BasePrompt Y-axisPrompt:'' for Y-axis, and return it in the form
2142 of ``(X,Y)''. The default prompts are @code{Dimension}, @code{X},
2143 @code{Y} respectively.
2145 @item [F]
2146 YaTeX:check-completion-type
2147 @itemx [A]
2148 One of the symbols: 'begin, 'section, or 'maketitle
2149 @itemx [D]
2150 Check the current completion type is specified one and cause error if
2151 not. The variable @code{YaTeX-current-completion-type} holds the symbol
2152 according to the current completion type.
2153 @end table
2155 @node Contribution, , Useful functions for creating add-in, Add-in functions
2156 @comment node-name, next, previous, up
2157 @subsection Contribution
2159 If you make your own pretty function and you let it be in public, please
2160 send me the function. I'm going to include it in the next release.
2162 @node Add-in generator, , Add-in functions, Customizations
2163 @comment node-name, next, previous, up
2164 @section Add-in generator
2166 First, don't forget to read the section of add-in functions @ref{Add-in
2167 functions}. If you easily understand how to define them, there's no need
2168 to read this section. But being not familiar with Emacs-Lisp, when you
2169 don't have clear idea what to do, this section describes how to get YaTeX
2170 make add-in function.
2172 There are two methods of generation. One is for fully interactive
2173 generator for beginners and another requires little knowledge of
2174 Emacs-Lisp.
2176 @subsection Generator for beginners
2177 The former generator is called by
2178 @center @kbd{M-x YaTeX-generate}
2180 @noindent
2181 strokes. All you have to do is follow the guidances. Defying them may cases
2182 the disaster (I wonder what is it???). So when you make some mistake, it
2183 is recommendable to type @kbd{C-g} and start afresh.
2185 @subsection Simple generator
2187 The latter generator is invoked by the next sequence.
2188 @center @kbd{M-x YaTeX-generate-simple}
2189 This generator can make both ``option add-in'' and ``argument add-in''
2190 (@emph{refer the section add-in functions}
2191 @ref{How the add-in function works}), whereas @code{YaTeX-generate}
2192 cannot make ``argument addin''.
2194 For example, assume you have the LaTeX command as follows.
2196 @example
2197 \epsinput[t](250,50)@{hoge.eps@}@{plain@}@{Picture of foo@}
2198 (A) (B) (1) (2) (3)
2199 (A)Optional parameter to specify the position
2200 One of t(top), b(bottom), l(left), r(right)
2201 (B)Maximum size of frame
2202 (1)1st argument is filename of EPS file
2203 (2)2nd argument indicates
2204 plain do nothing
2205 frame make frame around image
2206 dframe make double-frame around image
2207 for included EPS file.
2208 (3)Caption for the picture
2209 @end example
2211 Now get start with generation. Typing @kbd{M-x YaTeX-generate-simple}
2212 brings the prompt:
2213 @display
2214 (O)ption? (A)rgument?
2215 @end display
2217 @subsubsection Generating ``option add-in''
2218 @cindex option add-in
2220 Since (A), (B) above are optional argument, all we have to do to
2221 complete them is define the option add-in for them. Let's generate the
2222 function to complete (A).
2224 @display
2225 M-x YaTeX-generate-simple RET
2226 epsinput RET
2228 @end display
2230 @noindent
2231 Typing as above leads the next prompt.
2233 @display
2234 Read type(1): (S)tring (C)omplete (F)ile ([)option (P)osition co(O)rd. (q)uit
2235 @end display
2237 @noindent
2238 This asks that ``Which type is the completion style of 1st argument?''.
2239 Here are the possible completion style.
2241 @table @code
2242 @item String
2243 read plain string
2244 @item Complete
2245 read with completion
2246 @item File
2247 read file name
2248 @item Option
2249 read optional string (if string omitted, omit [] too)
2250 @item Position
2251 read positional option (like [htbp])
2252 @item Coord.
2253 read coordinates
2254 @item Quit
2255 quit from generating
2256 @end table
2258 Since (A) is the optional argument to specify the location of included
2259 EPS file, the completion style is @code{Position}, and the possible
2260 characters are t, b, l, and r. To tell these information to generator,
2261 operate as follows.
2263 @display
2264 Read type(1).... p
2265 Acceptable characters: tblr RET
2266 @end display
2268 (B) is coordinate. So its completion style is coOrd. We want a prompt
2269 meaning ``Maximum size'' when completion.
2271 @display
2272 Read type(2).... o
2273 Prompt for coordinates: Max size RET
2274 @end display
2276 That's all for optional argument. Select quit.
2278 @display
2279 Read type(3).... q
2280 @end display
2282 Then the generated option add-in function for \epsinput will be shown in
2283 the next window.
2285 @subsubsection Generating ``argument add-in''
2286 @cindex argument add-in
2288 Next, create the argument add-in. The arguments for \epsinput are EPS
2289 file name, framing style, and caption string in sequence.
2291 @display
2292 M-x YaTeX-generate-simple RET
2293 epsinput RET
2295 @end display
2297 Above key strokes bring the prompt that asks the number of argument.
2298 Answer it with 3.
2300 @display
2301 How many arguments?: 3 RET
2302 @end display
2304 Then the generator asks the completion style and prompt for completion.
2305 Answer them. @kbd{f} for FileName and prompt string.
2307 @display
2308 Read type(1).... f
2309 Prompt for argument#1 EPS file name RET
2310 @end display
2312 The second argument is one of selected symbol. So the completion type
2313 is @code{Completion}.
2315 @display
2316 Read type(2).... c
2317 Prompt for argument#2 Include style RET
2318 @end display
2320 Then all the candidates ready to be read. Type single RET after
2321 entering all.
2323 @display
2324 Item[1](RET to exit): plain RET
2325 Item[2](RET to exit): frame RET
2326 Item[3](RET to exit): dframe RET
2327 Item[4](RET to exit): RET
2328 @end display
2330 The following prompt asks whether the entered string must belong to
2331 candidates or not. In this case, since the argument must be one of
2332 @code{plain}, @code{frame}, and @code{dframe}, type @code{y}.
2334 @display
2335 Require match? (y or n) y
2336 @end display
2338 The last argument is the caption string for which any completion is
2339 needed.
2341 @display
2342 Read type(3).... s
2343 Prompt for argument#3 Caption RET
2344 default: Figure of RET
2345 @end display
2347 Finally we'll get the argument add-in in the next window.
2349 @subsection Contribution
2351 If you get your own pretty function and you let it be in public, please
2352 steel yourself in the happy atmosphere and do not send me the function.
2353 I do know it is not fine because it is generated by yatexgen:-p.
2355 @node Etcetera, Copying, Customizations, Top
2356 @comment node-name, next, previous, up
2357 @chapter Etcetera
2359 The standard completion tables provided in @file{yatex.el} contain a
2360 few La@TeX{} commands I frequently use. This is to lessen the key
2361 strokes to complete entire word, because too many candidates
2362 rarely used often cause too many hits. Therefore always try to
2363 use completion in order to enrich your dictionary, and you will
2364 also find `Wild Bird' growing suitable for your La@TeX{} style.
2366 The package name `Wild Bird' is the English translation of Japanese
2367 title `Yachou', which is a trick on words of Japanese.
2369 @node Copying, , Etcetera, Top
2370 @comment node-name, next, previous, up
2371 @chapter Copying
2373 This program is distributed as a free software. You can
2374 use/copy/modify/redistribute this software freely but with NO warranty to
2375 anything as a result of using this software. Adopting code from this
2376 program is also free. But I would not do contract act.
2378 Any reports and suggestions are welcome as long as I feel interests in
2379 this software. My possible e-mail address is `yuuji@@yatex.org'. (as of
2380 Jan.2004) And there is mailing list for YaTeX. Although the common
2381 language is Japanese, questions in English will be welcome. To join the
2382 ML, send the mail whose subject is `append' to the address
2383 `yatex@@yatex.org. If you have some question, please ask to
2384 `yatex-admin@@yatex.org'.
2386 The specification of this software will be surely modified
2387 (depending on my feelings) without notice :-p.
2390 @flushright
2391 HIROSE Yuuji
2392 @end flushright
2393 @bye
2395 Local variables:
2396 mode: texinfo
2397 fill-prefix: nil
2398 fill-column: 74
2399 End: