yatex

view docs/yatexe.tex @ 183:1c41dc8a28eb

doc fix
author yuuji@gentei.org
date Thu, 13 Oct 2011 10:16:58 +0900
parents 8703f090c628
children cb4449ecb9f3
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 Thu May 27 18:04:10 2010 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 k
152 @dots{} kill current typesetting process
153 @item [prefix] t b
154 @dots{} invoke bibtex
155 @item [prefix] t i
156 @dots{} invoke makeindex
157 @item [prefix] t d
158 @dots{} invoke latex && dvipdfmx
159 @item [prefix] t p
160 @dots{} preview
161 @item [prefix] t l
162 @dots{} lpr dvi-file
163 @item [prefix] t s
164 @dots{} search current string on xdvi-remote
165 @end table
167 @menu
168 * Calling typesetter::
169 * Calling previewer::
170 * Printing out::
171 @end menu
173 @node Calling typesetter, Calling previewer, Typesetting, Typesetting
174 @comment node-name, next, previous, up
175 @section Calling typesetter
177 Typing @kbd{[prefix] t j}, the current editing window will be divided
178 horizontally when you invoke latex command, and log message of La@TeX{}
179 typesetting will be displayed in the other window; called typesetting
180 buffer. The typesetting buffer automatically scrolls up and traces
181 La@TeX{} warnings and error messages. If you see latex stopping by an
182 error, you can send string to latex in the typesetting buffer.
184 If an error stops the La@TeX{} typesetting, this key stroke will
185 move the cursor to the line where La@TeX{} error is detected.
187 @table @kbd
188 @item [prefix] '
189 @itemx ([prefix]+single quotation)
191 @dots{} jump to the previous error or warning
192 @end table
194 If you find a noticeable error, move to the typesetting buffer and move
195 the cursor on the line of error message and type @kbd{SPACE} key. This
196 makes the cursor move to corresponding source line.
198 YaTeX-typeset-region invoked by @kbd{[prefix] tr} call typesetter
199 for region. The region is specified by standard point and mark, or
200 by @code{%#BEGIN} and @code{%#END} marks. Selected region will be
201 copied to the temporary file @file{texput.tex} with the same preamble
202 as the main file of current editing sources. Be sure to put
203 all local macro settings in preamble, not after @code{\begin{document}}.
204 The method of specification of the region is shown in the
205 section @xref{%#notation}.
207 The documentclass for typeset-region is the same as that of editing
208 file if you edit one file, and is the same as main file's if you
209 edit splitting files.
211 The @kbd{[prefix] te} key automatically marks current inner environment
212 or inner math mode and then call typeset-region with marked region. This
213 is convenient to quick view of current tabular environment or current
214 editing formulas. Keeping previewer window for @file{texput.dvi} is handy
215 for debugging. Since @kbd{[prefix] te} selects the inner-most environment
216 as region, it is not suitable for partial typesetting of doubly or more
217 composed environment. If you want to do partial typesetting for a nested
218 environment, use @kbd{[prefix] tr} for static-region, which is described
219 in the section @xref{%#notation}.
221 @node Calling previewer, Printing out, Calling typesetter, Typesetting
222 @comment node-name, next, previous, up
223 @section Calling previewer
225 @kbd{[prefix] t p} invokes the TeX previewer. And if you are using
226 xdvi-remote, which can be controled from other terminals, @kbd{[prefix] t
227 s} enables you to search current string at the cursor on the running xdvi
228 window.
230 @node Printing out, , Calling previewer, Typesetting
231 @comment node-name, next, previous, up
232 @section Printing out
234 When you type @code{[preifx] t l}, YaTeX asks you the range of
235 dvi-printing by default. You can skip this by invoking it with
236 universal-argument as follows:
238 @example
239 C-u [prefix] tl
240 @end example
242 @node %#notation, Completion, Typesetting, Top
243 @comment node-name, next, previous, up
244 @chapter %# notation
245 @cindex %# notation
247 You can control the typesetting process by describing @code{%#}
248 notations in the source text.
250 @menu
251 * Changing typesetter::
252 * Splitting input files::
253 * Static region for typesetting::
254 * Lpr format::
255 * Editing %# notation::
256 @end menu
258 @node Changing typesetter, Splitting input files, %#notation, %#notation
259 @comment node-name, next, previous, up
260 @section To change the `latex' command or to split a source text.
261 @cindex typesetter
263 To change the typesetting command, write
265 @example
266 %#!latex-big
267 @end example
269 @noindent
270 anywhere in the source text. This is useful for changing
271 typesetter.
273 @node Splitting input files, Static region for typesetting, Changing typesetter, %#notation
274 @comment node-name, next, previous, up
275 @section Splitting input files
277 And if you split the source text and
278 edit subfile that should be included from main text.
280 @example
281 %#!latex main.tex
282 @end example
284 @noindent
285 will be helpful to execute latex on main file from sub text buffer. Since
286 this command line after @kbd{%#!} will be sent to shell literally, next
287 description makes it convenient to use ghostview as dvi-previewer.
289 @example
290 %#!latex main ; dvi2ps main.dvi > main
291 @end example
293 @noindent
294 Note that YaTeX assumes the component before the last period of
295 the last word in this line as base name of the main La@TeX{} source.
296 The @code{%f} notation in this line is replaced by main file name, and
297 @code{%r} replaced by root name of main file name. If you specify
298 @code{%f} or @code{%r}, YaTeX always ask you the name of main file at the
299 first typesetting.
301 To make best use of the feature of inter-file jumping by
302 @kbd{[prefix] g} (see @ref{Cursor jump}), take described below into
303 consideration.
305 @itemize
306 @item You can put split texts in sub directory, but not in
307 sub directory of sub directory.
308 @item In the main text, specify the child file name with relative path name
309 such as \include@{chap1/sub@}, when you include the file in
310 a sub-directory.
311 @item In a sub-text, write @code{%#!latex main.tex} even if @file{main.tex}
312 is in the parent directory(not %#!latex ../main.tex).
313 @end itemize
315 @node Static region for typesetting, Lpr format, Splitting input files, %#notation
316 @comment node-name, next, previous, up
317 @section Static region
318 @cindex static region
319 @cindex Fixed region
321 Typeset-region by @kbd{[prefix] tr} passes the region between point and
322 mark to typesetting command by default. But when you want to typeset
323 static region, enclose the region by @code{%#BEGIN} and @code{%#END} as
324 follows.
326 @example
327 %#BEGIN
328 TheRegionYouWantToTypesetManyTimes
329 %#END
330 @end example
332 This is the rule of deciding the region.
334 @enumerate
335 @item
336 If there exists %#BEGIN before point,
338 @enumerate
339 @item
340 If there exists %#END after %#BEGIN,
341 @itemize
342 @item From %#BEGIN to %#END.
343 @end itemize
345 @item
346 If %#END does not exist after %#BEGIN,
347 @itemize
348 @item From %#BEGIN to the end of buffer.
349 @end itemize
350 @end enumerate
352 @item
353 If there does not exist %#BEGIN before point,
354 @itemize
355 @item Between point and mark(standard method of Emacs).
356 @end itemize
357 @end enumerate
359 It is useful to write @code{%#BEGIN} in the previous line of \begin and
360 @code{%#END} in the next line of \@code{end} when you try complex
361 environment such as `tabular' many times. It is also useful to put only
362 @code{%#BEGIN} alone at the middle of very long text. Do not forget to
363 erase @code{%#BEGIN} @code{%#END} pair.
365 @node Lpr format, Editing %# notation, Static region for typesetting, %#notation
366 @comment node-name, next, previous, up
367 @section Lpr format
368 @cindex lpr format
370 Lpr format is specified by three Lisp variables. Here are the
371 default values of them.
373 @table @code
374 @item (1)dviprint-command-format
375 @code{"dvi2ps %f %t %s | lpr"}
376 @item (2)dviprint-from-format
377 @code{"-f %b"}
378 @item (3)dviprint-to-format
379 @code{"-t %e"}
380 @end table
382 On YaTeX-lpr, @code{%s} in (1) is replaced by the file name of main
383 text, @code{%f} by contents of (2), %t by contents of (3). At these
384 replacements, @code{%b} in (2) is also replaced by the number of beginning
385 page, @code{%e} in (3) is replaced by the number of ending page. But
386 @code{%f} and @code{%t} are ignored when you omit the range of print-out
387 by @kbd{C-u [prefix] tl}.
389 If you want to change this lpr format temporarily, put a command
390 such as follows somewhere in the text:
392 @example
393 %#LPR dvi2ps %f %t %s | 4up -page 4 | texfix | lpr -Plp2
394 @end example
396 And if you want YaTeX not to ask you the range of printing
397 out, the next example may be helpful.
399 @example
400 %#LPR dvi2ps %s | lpr
401 @end example
403 @node Editing %# notation, , Lpr format, %#notation
404 @comment node-name, next, previous, up
405 @section Editing %# notation
407 To edit @code{%#} notation described above, type
409 @table @kbd
410 @item [prefix] %
411 @dots{} editing %# notation menu
412 @end table
414 @noindent
415 and select one of the entry of the menu as follows.
417 @example
418 !)Edit-%#! B)EGIN-END-region L)Edit-%#LPR
419 @end example
421 @noindent
422 Type @kbd{!} to edit @code{%#!} entry, @code{b} to enclose the region with
423 @code{%#BEGIN} and @code{%#END}, and @code{l} to edit @code{%#LPR} entry.
424 When you type @kbd{b}, all @code{%#BEGIN} and @code{%#END} are
425 automatically erased.
427 @node Completion, Local dictionaries, %#notation, Top
428 @comment node-name, next, previous, up
429 @chapter Completion
430 @cindex completion
432 YaTeX makes it easy to input the La@TeX{} commands. There are several
433 kinds of completion type, begin-type, section-type, large-type, etc...
435 @menu
436 * Begin-type completion::
437 * Section-type completion::
438 * Large-type completion::
439 * Maketitle-type completion::
440 * Arbitrary completion::
441 * End completion::
442 * Accent completion::
443 * Image completion::
444 * Greek letters completion::
445 @end menu
447 @node Begin-type completion, Section-type completion, Completion, Completion
448 @comment node-name, next, previous, up
449 @section Begin-type completion
450 @cindex begin-type completion
451 @cindex environment
452 @cindex prefix b
454 "Begin-type completion" completes commands of @code{\begin@{env@}} ...
455 @code{\end@{env@}}. All of the begin-type completions begin with this key
456 sequence.
458 @table @kbd
459 @item [prefix] b
460 @dots{} start begin-type completion
461 @end table
463 @noindent
464 An additional key stroke immediately completes a frequently used
465 La@TeX{} @code{\begin@{@}}...@code{\@code{end}@{@}} environment.
467 @table @kbd
468 @item [prefix] b c
469 @dots{} @code{\begin@{center@}...\end@{center@}}
470 @item [prefix] b d
471 @dots{} @code{\begin@{document@}...\end@{document@}}
472 @item [prefix] b D
473 @dots{} @code{\begin@{description@}...\end@{description@}}
474 @item [prefix] b e
475 @dots{} @code{\begin@{enumerate@}...\end@{enumerate@}}
476 @item [prefix] b E
477 @dots{} @code{\begin@{equation@}...\end@{equation@}}
478 @item [prefix] b i
479 @dots{} @code{\begin@{itemize@}...\end@{itemize@}}
480 @item [prefix] b l
481 @dots{} @code{\begin@{flushleft@}...\end@{flushleft@}}
482 @item [prefix] b m
483 @dots{} @code{\begin@{minipage@}...\end@{minipage@}}
484 @item [prefix] b t
485 @dots{} @code{\begin@{tabbing@}...\end@{tabbing@}}
486 @item [prefix] b T
487 @dots{} @code{\begin@{tabular@}...\end@{tabular@}}
488 @item [prefix] b^T
489 @dots{} @code{\begin@{table@}...\end@{table@}}
490 @item [prefix] b p
491 @dots{} @code{\begin@{picture@}...\end@{picture@}}
492 @item [prefix] b q
493 @dots{} @code{\begin@{quote@}...\end@{quote@}}
494 @item [prefix] b Q
495 @dots{} @code{\begin@{quotation@}...\end@{quotation@}}
496 @item [prefix] b r
497 @dots{} @code{\begin@{flushright@}...\end@{flushright@}}
498 @item [prefix] b v
499 @dots{} @code{\begin@{verbatim@}...\end@{verbatim@}}
500 @item [prefix] b V
501 @dots{} @code{\begin@{verse@}...\end@{verse@}}
502 @end table
504 Any other La@TeX{} environments are made by completing-read of the
505 Emacs function.
507 @table @kbd
508 @item [prefix] b SPACE
509 @dots{} begin-type completion
510 @end table
512 @noindent
513 The next message will show up in the minibuffer
515 @example
516 Begin environment(default document):
517 @end example
519 @noindent
520 by typing @kbd{[prefix] b}. Put the wishing environment with completion
521 in the minibuffer, and @code{\begin@{env@}}...\@code{\end@{env@}} will be
522 inserted in the La@TeX{} source text. If the environment you want to put
523 does not exist in the YaTeX completion table, it will be registered in the
524 user completion table. YaTeX automatically saves the user completion
525 table in the user dictionary file at exiting of emacs.
527 At the completion of certain environments, the expected initial entry will
528 automatically inserted such as @code{\item} for @code{itemize}
529 environment. If you don't want the entry, it can be removed by undoing.
531 If you want to enclose some paragraphs which have already been
532 written, invoke the begin-type completion with changing the case
533 of @kbd{b} of key sequence upper(or invoke it with universal argument
534 by @kbd{C-u} prefix).
535 @cindex enclose region into environment
537 The following example encloses a region with `description'
538 environment.
540 @table @kbd
541 @item [prefix] B D
542 @itemx (or ESC 1 [prefix] b D)
543 @itemx (or C-u [prefix] b D)
545 @dots{} begin-type completion for region
546 @end table
548 This enclosing holds good for the completing input by @kbd{[prefix] b
549 SPC}. @kbd{[prefix] B SPC} enclose a region with the environment selected
550 by completing-read.
552 @node Section-type completion, Large-type completion, Begin-type completion, Completion
553 @comment node-name, next, previous, up
554 @section Section-type completion
555 @cindex section-type completion
556 @cindex prefix s
558 "Section-type completion" completes section-type commands which take an
559 argument or more such as @code{\section@{foo@}}. To invoke section-type
560 completion, type
562 @table @kbd
563 @item [prefix] s
564 @dots{} section-type completion
565 @end table
567 @noindent
568 then the prompt
570 @example
571 (C-v for view) \???@{@} (default documentclass):
572 @end example
574 @noindent
575 will show up in the minibuffer. Section-type La@TeX{} commands are
576 completed by space key, and the default value is selected when you
577 type nothing in the minibuffer.
579 Next,
581 @example
582 \section@{???@}:
583 @end example
585 @noindent
586 prompts you the argument of section-type La@TeX{} command. For
587 example, the following inputs
589 @example
590 \???@{@} (default documentclass): section
591 \section@{???@}: Hello world.
592 @end example
594 @noindent
595 will insert the string
597 @example
598 \section@{Hello world.@}
599 @end example
601 in your La@TeX{} source. When you neglect argument such as
603 @example
604 (C-v for view) \???@{@} (default section): vspace*
605 \vspace*@{???@}:
606 @end example
608 YaTeX puts
610 @example
611 \vspace*@{@}
612 @end example
614 @noindent
615 and move the cursor in the braces.
617 In La@TeX{} command, there are commands which take more than one
618 arguments such as @code{\addtolength@{\topmargin@}@{8mm@}}. To complete these
619 commands, invoke section-type completion with universal argument as,
620 @cindex number of argument
622 @example
623 C-u 2 [prefix] s (or ESC 2 [prefix] s)
624 @end example
626 @noindent
627 and make answers in minibuffer like this.
629 @example
630 (C-v for view) \???@{@} (default vspace*): addtolength
631 \addtolength@{???@}: \topmargin
632 Argument 2: 8mm
633 @end example
635 @code{\addtolength} and the first argument @code{\topmargin} can be typed
636 easily by completing read. Since YaTeX also learns the number of
637 arguments of section-type command and will ask that many arguments in
638 future completion, you had better tell the number of arguments to YaTeX at
639 the first completion of the new word. But you can change the number of
640 arguments by calling the completion with different universal argument
641 again.
644 Invoking section-type completion with @code{[Prefix] S} (Capital `S')
645 includes the region as the first argument of section-type command.
647 The section/large/maketitle type completion can work at the
648 prompt for the argument of other section-type completion.
649 Nested La@TeX{} commands are efficiently read with the recursive
650 completion by typing YaTeX's completion key sequence in the
651 minibuffer.
653 @menu
654 * view-sectioning::
655 @end menu
657 @node view-sectioning, , Section-type completion, Section-type completion
658 @comment node-name, next, previous, up
659 @subsection view-sectioning
660 @cindex view sectioning
661 @cindex outline
663 In the minibuffer at the prompt of section-type command completion,
664 typing @kbd{C-v} shows a list of sectioning commands in source text(The
665 line with @code{<<--} mark is the nearest sectioning command). Then,
666 default sectioning command appears in the minibuffer. You can go up/down
667 sectioning command by typing @kbd{C-p}/@kbd{C-n}, can scrolls up/down the
668 listing buffer by @kbd{C-v}/@kbd{M-v}, and can hide sectioning commands
669 under certain level by 0 through 6. Type @kbd{?} in the minibuffer of
670 sectioning prompt for more information.
672 You can generate this listing buffer (@code{*Sectioning Lines*} buffer)
673 by typing
674 @table @kbd
675 @item M-x YaTeX-section-overview
676 @dots{} Generate *Sectioning Lines* buffer
677 @end table
678 @cindex{Generate the listing of sectioning units}
679 from the LaTeX source buffer. In this listing buffer, typing @kbd{u} on
680 the sectioning command shifts up the corresponding sectioning command in
681 source text and @kbd{d} shifts down. After marking lines in the listing
682 buffer, typing @kbd{U} shifts up all sectioning commands in the region,
683 and @kbd{U} shifts down. Here are all the key bindings of
684 @code{*Sectioning Lines*} buffer.
686 @table @kbd
687 @item SPC
688 @dots{} Jump to corresponding source line
689 @item .
690 @dots{} Display corresponding source line
691 @item u
692 @dots{} Shift up a sectioning line
693 @item d
694 @dots{} Shift down a sectioning line
695 @item U
696 @dots{} Shift up sectioning lines in region
697 @item D
698 @dots{} Shift down sectioning lines in region
699 @item 0@dots{}6
700 @dots{} Hide sectioning commands whose level is lower than n
701 @end table
704 @node Large-type completion, Maketitle-type completion, Section-type completion, Completion
705 @comment node-name, next, previous, up
706 @section Large-type completion
708 "Large-type completion" inputs the font or size changing
709 descriptions such as @code{@{\large @}}. When you type
711 @table @kbd
712 @item [prefix] l
713 @dots{} large-type completion
714 @end table
716 @noindent
717 the message in the minibuffer
719 @example
720 @{\??? @} (default large):
721 @end example
723 prompts prompts you large-type command with completing-read. There are
724 TeX commands to change fonts or sizes, @code{it}, @code{huge} and so on,
725 in the completion table.
727 Region-based completion is also invoked by changing the letter after
728 prefix key stroke as @kbd{[prefix] L}. It encloses the region by braces
729 with large-type command.
731 @node Maketitle-type completion, Arbitrary completion, Large-type completion, Completion
732 @comment node-name, next, previous, up
733 @section Maketitle-type completion
734 @cindex maketitle-type completion
736 We call it "maketitle-type completion" which completes commands such as
737 @code{\maketitle}. Take notice that maketitle-type commands take no
738 arguments. Then, typing
740 @table @kbd
741 @item [prefix] m
742 @dots{} maketitle-type completion
743 @end table
745 @noindent
746 begins maketitle-completion. Above mentioned method is true for
747 maketitle-completion, and there are La@TeX{} commands with no
748 arguments in completion table.
750 @node Arbitrary completion, End completion, Maketitle-type completion, Completion
751 @comment node-name, next, previous, up
752 @section Arbitrary completion
753 @cindex arbitrary completion
755 @noindent
756 You can complete certain La@TeX{} command anywhere without typical
757 completing method as described, by typing
759 @table @kbd
760 @item [prefix] SPC
761 @dots{} arbitrary completion
762 @end table
764 @noindent
765 after the initial string of La@TeX{} command that is preceded by @code{\}.
767 @node End completion, Accent completion, Arbitrary completion, Completion
768 @comment node-name, next, previous, up
769 @section End completion
770 @cindex end completion
772 @noindent
773 YaTeX automatically detects the opened environment and close it with
774 \@code{\end@{environment@}}. Though proficient YaTeX users never fail to
775 make environment with begin-type completion, some may begin an environment
776 manually. In that case, type
778 @table @kbd
779 @item [prefix] e
780 @dots{} @code{end} completion
781 @end table
783 @noindent
784 at the end of the opened environment.
786 @node Accent completion, Image completion, End completion, Completion
787 @comment node-name, next, previous, up
788 @section Accent completion
789 @cindex accent completion
791 When you want to write the European accent marks(like @code{\`@{o@}}),
793 @table @kbd
794 @item [prefix] a
795 @dots{} accent completion
796 @end table
798 @noindent
799 shows the menu
801 @example
802 1:` 2:' 3:^ 4:" 5:~ 6:= 7:. u v H t c d b
803 @end example
805 @noindent
806 in the minibuffer. Chose one character or corresponding numeric,
807 and you will see
809 @example
810 \`@{@}
811 @end example
813 @noindent
814 in the editing buffer with the cursor positioned in braces. Type
815 one more character `o' for example, then
817 @example
818 \`@{o@}
819 @end example
821 @noindent
822 will be completed, and the cursor gets out from braces.
824 @node Image completion, Greek letters completion, Accent completion, Completion
825 @comment node-name, next, previous, up
826 @section Image completion of mathematical sign
827 @cindex image completion
828 @cindex math-mode
829 @cindex sigma
830 @cindex leftarrow
831 @cindex ;
833 Arrow marks, sigma mark and those signs mainly used in the
834 TeX's math environment are completed by key sequences which
835 imitate the corresponding symbols graphically. This completion
836 only works in the math environment. YaTeX automatically detects
837 whether the cursor located in math environment or not, and
838 change the behavior of key strokes @kbd{;} and @kbd{:}.
840 By the way, we often express the leftarrow mark by `<-' for example.
841 Considering such image, you can write @code{\leftarrow} by typing @kbd{<-}
842 after @kbd{;} (semicolon) as a prefix. In the same way,
843 @code{\longleftarrow} (@code{<--}) is completed by typing @kbd{;<--},
844 infinity mark which is imitated by @code{oo} is completed by typing
845 @kbd{;oo}.
847 Here are the sample operations in YaTeX math-mode.
849 @example
850 INPUT Completed La@TeX{} commands
851 ; < - @code{\leftarrow}
852 ; < - - @code{\longleftarrow}
853 ; < - - > @code{\longleftrightarrow}
854 ; o @code{\circ}
855 ; o o @code{\infty}
856 @end example
858 In any case, you can quit from image completion and can move
859 to the next editing operation if the La@TeX{} command you want is
860 shown in the buffer.
862 @code{;} itself in math-environment is inserted by @kbd{;;}. Typing
863 @kbd{TAB} in the midst of image completion shows all of the La@TeX{}
864 commands that start with the same name as string you previously typed in.
865 In this menu buffer, press @kbd{RET} after moving the cursor (by @kbd{n},
866 @kbd{p}, @kbd{b}, @kbd{f}) to insert the La@TeX{} command.
868 To know all of the completion table, type @kbd{TAB} just after @kbd{;}.
869 And here is the sample menu by @kbd{TAB} after @kbd{;<}.
871 @example
872 KEY LaTeX sequence sign
873 < \leq <
874 ~
875 << \ll <<
876 <- \leftarrow <-
877 <= \Leftarrow <=
878 @end example
880 You can define your favorite key-vs-sequence completion table in the
881 Emacs-Lisp variable @code{YaTeX-math-sign-alist-private}. See also
882 @file{yatexmth.el} for the information of the structure of this variable.
884 @node Greek letters completion, , Image completion, Completion
885 @comment node-name, next, previous, up
886 @section Greek letters completion
887 @cindex Greek letters completion
888 @cindex :
890 Math-mode of YaTeX provides another image completion, Greek letters
891 completion in the same method. After prefix @kbd{:}, typing @kbd{a} makes
892 @code{\alpha}, @kbd{b} makes @code{\beta} and @kbd{g} makes @code{\gamma}
893 and so on. First, type @kbd{:TAB} to know all the correspondence of
894 alphabets vs. Greek letters.
896 If you will find @kbd{;} or @kbd{:} doesn't work in correct position of
897 math environment, it may be a bug of YaTeX. Please send me a bug report
898 with the configuration of your text, and avoid it temporarily by typing
899 @kbd{;} or @kbd{:} after universal-argument(@kbd{C-u}) which forces
900 @kbd{;} and @kbd{:} to work as math-prefix.
902 @node Local dictionaries, Commenting out, Completion, Top
903 @comment node-name, next, previous, up
904 @chapter Local dictionaries
905 @cindex local dictionaries
906 @cindex nervous users
908 Tables for completion consist of three dictionaries; `standard
909 dictionary' built in @file{yatex.el}, `user dictionary' for your common
910 private commands, and `local dictionary' that is effective in a certain
911 directory.
913 When you input the command unknown to YaTeX at a completion in the
914 minibuffer, YaTeX asks you with the following prompt;
916 @example
917 `foo' is not in table. Register into: U)serDic L)ocalDic N)one D)iscard
918 @end example
920 @noindent
921 In this menu, typing @kbd{u} updates your `user dictionary', @kbd{l}
922 updates your local dictionary, @kbd{n} updates only on-memory dictionary
923 which go through only current Emacs session, and @kbd{d} updates no
924 dictionary and throws the new word away.
926 If you find this switching feature meaningless and bothersome, put the
927 next expression into your @file{~/.emacs}
929 @lisp
930 (setq YaTeX-nervous nil)
931 @end lisp
933 @node Commenting out, Cursor jump, Local dictionaries, Top
934 @comment node-name, next, previous, up
935 @chapter Commenting out
936 @cindex commenting out
937 @cindex prefix >
938 @cindex prefix <
939 @cindex prefix ,
940 @cindex prefix .
942 You may want to comment out some region.
944 @table @kbd
945 @item [prefix] >
946 @dots{} comment out region by %
947 @item [prefix] <
948 @dots{} uncomment region
949 @end table
951 @noindent
952 cause an operation to the region between point and mark.
954 @table @kbd
955 @item [prefix] .
956 @dots{} comment out current paragraph
957 @item [prefix] ,
958 @dots{} uncomment current paragraph
959 @end table
961 @noindent
962 comments or uncomments the paragraph where the cursor belongs.
963 This `paragraph' means the region marked by the function
964 mark-paragraph, bound to @kbd{ESC h} by default. It is NOT
965 predictable what will happen when you continuously comment out
966 some paragraph many times.
968 You can also comment out an environment between @code{\begin} and
969 @code{\end}, or a @code{\begin}-\@code{\end} pair themselves, by making the
970 following key strokes on the line where @code{\begin@{@}} or
971 @code{\end@{@}} exists.
973 @table @kbd
974 @item [prefix] >
975 @dots{} comment out from \begin to \@code{end}
976 @item [prefix] <
977 @dots{} uncomment from \begin to \@code{end}
978 @end table
980 @noindent
981 comment whole the contents of environment. Moreover,
983 @table @kbd
984 @item [prefix] .
985 @dots{} comment out \begin and \@code{end}
986 @item [prefix] ,
987 @dots{} uncomment \begin and \@code{end}
988 @end table
990 @noindent
991 (un)comments out only environment declaration: @code{\begin@{@}} and
992 @code{\end@{@}}. NOTE that even if you intend to comment out some region,
993 invoking @kbd{[prefix] >} on the @code{\begin},@code{\end} line decides to
994 work in `commenting out from @code{\begin} to @code{\end}' mode.
997 @node Cursor jump, Changing and Deleting, Commenting out, Top
998 @comment node-name, next, previous, up
999 @chapter Cursor jump
1000 @cindex cursor jump
1001 @cindex prefix g
1004 @menu
1005 * Jump to corresponding object::
1006 * Invoking image processor::
1007 * Jump to main file::
1008 * Jumping around the environment::
1009 * Jumping to last completion position::
1010 @end menu
1012 @node Jump to corresponding object, Invoking image processor, Cursor jump, Cursor jump
1013 @comment node-name, next, previous, up
1014 @section Jump to corresponding object
1016 Typing
1018 @table @kbd
1019 @item [prefix] g
1020 @dots{} go to corresponding object
1021 @end table
1023 @noindent
1024 in a certain place move the cursor to the place corresponding to the
1025 La@TeX{} command of last place. YaTeX recognize the followings as pairs
1026 that have relation each other.
1028 @itemize @bullet
1029 @item @code{\begin@{@}} <-> @code{\end@{@}}
1030 @item @code{%#BEGIN} <-> @code{%#END}
1031 @item On the image-including line -> corresponding viewer or drawing tool
1032 @item @code{\label@{@}} <-> @code{\ref@{@}}
1033 @item @code{\include(\input)} -> included file
1034 @item @code{\bibitem@{@}} <-> @code{\cite@{@}}
1035 @end itemize
1037 On a @code{\begin},@code{\end} line, typing @kbd{[prefix] g} moves the
1038 cursor to the corresponding @code{\end},@code{\begin} line, if its partner
1039 really exists. The behavior on the line @code{%#BEGIN} and @code{%#END}
1040 are the same. Note that if the correspondent of @code{label/ref} or
1041 @code{cite/bibitem} exists in another file, that file have to be opened to
1042 make a round trip between references by @kbd{[prefix] g}.
1044 If you type @code{[prefix] g} on the line of @code{\include@{chap1@}},
1045 typically in the main text, YaTeX switches buffer to @file{chap1.tex}.
1047 @table @kbd
1048 @item [prefix] 4 g
1049 @dots{} go to corresponding object in other window
1050 @end table
1052 @noindent
1053 do the same job as @kbd{[prefix] g} except it's done in other window.
1054 Note that this function doesn't work on @code{begin/end},
1055 @code{%#BEGIN/%#END} pairs because it is meaningless.
1057 @node Invoking image processor, Jump to main file, Jump to corresponding object, Cursor jump
1058 @comment node-name, next, previous, up
1059 @section Invoking image processor
1060 @cindex{Drawing tool invocation}
1062 `image-including line' described above means such lines as
1063 @code{\epsfile@{file=foo.ps@}}. If you type @kbd{[prefix] g} on that
1064 line, YaTeX automatically searches source of `foo.ps' and invokes image
1065 viewer or drawing tool correspoinding to it. For example; if you draw
1066 an image foo.obj with Tgif and enclose its product named foo.eps by
1067 @code{\epsfile} command. Typing @kbd{[prefix] g} on @code{\epsfile} line
1068 make YaTeX invoke @code{tgif foo.obj}. How a processor is choosen is as
1069 follows.
1071 @enumerate
1072 @item
1073 If there is an expression matching with one of the pattern
1074 defined in @code{YaTeX-processed-file-regexp-alist}, extract file name
1075 from regexp group surrounded by \\(\\). (Which group corresponds is
1076 written in the cdr part of each list.) If no matches were found, do
1077 nothing.
1078 @item
1079 If there is a pattern as `%PROCESSOR' which is defined in the variable
1080 @code{YaTeX-file-processor-alist}, call that processor giving the
1081 file name with corresponding extension.
1082 @item
1083 If not, check the existence of each file which is supplied the
1084 extension in the cdr part of each list of
1085 @code{YaTeX-file-processor-alist}. If any, call the corresponding
1086 image viewer or drawing tool.
1087 @end enumerate
1089 @node Jump to main file, Jumping around the environment, Invoking image processor, Cursor jump
1090 @comment node-name, next, previous, up
1091 @section Jump to main file
1093 Typing
1095 @table @kbd
1096 @item [prefix] ^
1097 @dots{} visit main file
1098 @item [prefix] 4^
1099 @dots{} visit main file in other buffer
1100 @end table
1101 @cindex prefix ^
1102 @cindex prefix 4 ^
1104 in a sub text switch the buffer to the main text specified by
1105 @code{%#!} notation.
1107 @node Jumping around the environment, Jumping to last completion position, Jump to main file, Cursor jump
1108 @comment node-name, next, previous, up
1109 @section Jumping around the environment
1111 And these are the functions which work on the current La@TeX{}
1112 environment:
1114 @table @kbd
1115 @item M-C-a
1116 @dots{} beginning of environment
1117 @item M-C-e
1118 @dots{} @code{end} of environment
1119 @item M-C-@@
1120 @dots{} mark environment
1121 @end table
1122 @cindex M-C-a
1123 @cindex M-C-e
1124 @cindex M-C-@@
1126 @node Jumping to last completion position, , Jumping around the environment, Cursor jump
1127 @comment node-name, next, previous, up
1128 @section Jumping to last completion position
1130 YaTeX always memorize the position of completion into register @code{3}.
1131 So every time you make a trip to any other part of text other than you are
1132 writing, you can return to the editing paragraph by calling
1133 register-to-point with argument YaTeX-current-position-register, which is
1134 achieved by typing @kbd{C-x j 3}(by default).
1136 @node Changing and Deleting, Filling, Cursor jump, Top
1137 @comment node-name, next, previous, up
1138 @chapter Changing and Deleting
1140 These functions are for change or deletion of La@TeX{} commands
1141 already entered.
1143 @table @kbd
1144 @item [prefix] c
1145 @dots{} change La@TeX{} command
1146 @item [prefix] k
1147 @dots{} kill La@TeX{} command
1148 @end table
1149 @cindex prefix c
1150 @cindex prefix k
1152 @menu
1153 * Changing LaTeX commands::
1154 * Killing LaTeX commands::
1155 @end menu
1157 @node Changing LaTeX commands, Killing LaTeX commands, Changing and Deleting, Changing and Deleting
1158 @comment node-name, next, previous, up
1159 @section Changing La@TeX{} commands
1161 @kbd{[prefix] c} can change the various (La)@TeX{} commands. This can
1162 change the followings.
1163 @itemize @bullet
1164 @item Environment names
1165 @item Section-type commands
1166 @item Argument of section-type commands
1167 @item Optional parameters (enclosed by []) of section-type commands
1168 @item Font/size designators
1169 @item Math-mode's maketitle-type commands that can be inputted with
1170 image completion
1171 @end itemize
1173 Typing @kbd{[prefix] c} on one of above objects you want to change
1174 brings a suitable reading function sometimes with completion.
1175 Note: If you want to change the argument of section-type command that
1176 contains other La@TeX{} commands, type @kbd{[prefix] c} either of
1177 surrounding braces of the argument in order to make YaTeX ignore the
1178 internal La@TeX{} sequences as an object of changing. Anyway, it is
1179 very difficult to know which argument position the cursor belongs because
1180 the La@TeX{} commands can be nested and braces can freely emerge. So keep
1181 it mind to put the cursor on a brace when you are thinking of changing a
1182 complicated argument.
1184 @node Killing LaTeX commands, , Changing LaTeX commands, Changing and Deleting
1185 @comment node-name, next, previous, up
1186 @section Killing La@TeX{} commands
1187 @cindex Killing La@TeX{} commands
1189 @kbd{[prefix] k} kills the La@TeX{} commands sometimes with their
1190 arguments. Following table illustrates the correspondence of the invoking
1191 position and what is killed.
1193 @example
1194 [Invoking position] [action]
1195 \begin, \end line kill \begin,\end pairs
1196 %#BEGIN, %#END line kill %#BEGIN,%#END pairs
1197 on a Section-type command kill section-type command
1198 on a parenthesis kill parentheses
1199 @end example
1201 Note that when killing @code{\begin, \end} or @code{%#BEGIN, %#END} pair,
1202 the lines @code{\begin, \end} or @code{%#BEGIN, %#END} exist will be
1203 killed entirely. So take care not to create any line that contains more
1204 than one @code{\begin} or so.
1206 While all operations above are to kill `containers' which surround some
1207 text, universal argument (@kbd{C-u}) for these commands kills not only
1208 `containers' but also `contents' of them. See below as a sample.
1210 @example
1211 Original text: [prefix] k C-u [prefix] k
1212 Main \footnote@{note@} here. Main note here. Main here.
1213 ~(cursor)
1214 @end example
1216 @node Filling, Updation of includeonly, Changing and Deleting, Top
1217 @comment node-name, next, previous, up
1218 @chapter Filling
1219 @cindex filling
1221 @section Filling an item
1222 @cindex filling an item
1223 @cindex prefix i
1225 To fill a term (descriptive sentences) of @code{\item}, type
1227 @c @table @kbd
1228 @c @item [prefix] i
1229 @c @dots{} fill item
1230 @c @end table
1231 @table @kbd
1232 @item M-q
1233 @dots{} fill item
1234 @end table
1236 @noindent
1237 on that item.
1239 YaTeX uses the value of the variable @code{YaTeX-item-regexp} as the
1240 regular expression to search item header in itemize environment.
1241 If you make a newcommand to itemize terms(e.g. @code{\underlineitem}), put
1243 @lisp
1244 (setq YaTeX-item-regexp
1245 "\\(\\\\\\(sub\\)*item\\)\\|\\(\\\\underlineitem\\)")
1246 @end lisp
1247 @cindex YaTeX-item-regexp
1249 in your @file{~/.emacs}. If you are not familiar with regular expression
1250 for Emacs-Lisp, name a newcommand for `itemize' beginning with
1251 @code{\item} such as @code{\itembf}, not @code{\bfitem}.
1253 This function reformats the @code{\item} into `hang-indented' style.
1254 For example:
1256 @example
1257 itemize, enumerate environment:
1259 >\item[foo] `foo' is the typical word for describing an
1260 > arbitrarily written....
1261 description environment:
1262 > \item[bar] When the word `for' is used as an arbitrarily
1263 > word, `bar' is bound to follow it.
1264 @end example
1266 Note that the indent depth of an @code{\item} word and its descriptive
1267 paragraph are the same in latter case. If you want to use different
1268 depth, invoke fill-paragraph at the beginning of non-whitespace
1269 character(see below).
1271 @section Filling paragraph
1272 @cindex Filling paragraph
1273 @cindex M-q
1275 Fill-paragraph is little bit adapted for La@TeX{} sources. It retains from
1276 filling in certain environments where formatting leads to a disaster such
1277 as verbatim, tabular, or so. And it protects @code{\verb} expressions
1278 from being folded (The variable @code{YaTeX-verb-regexp} controls this).
1279 Besides, putting cursor on the first occurrence of non-whitespace
1280 character on a line changes the fill-prefix temporarily to the depth of
1281 the line.
1283 @node Updation of includeonly, What column, Filling, Top
1284 @comment node-name, next, previous, up
1285 @chapter Updation of @code{\includeonly}
1286 @cindex includeonly
1288 When you edit splitting source texts, the notation
1290 @example
1291 \includeonly@{CurrentEditingFileName@}
1292 @end example
1294 @noindent
1295 in the main file reduces the time of typesetting. If you want
1296 to hack other file a little however, you have to rewrite it to
1298 @example
1299 \includeonly@{OtherFileNameYouWantToFix@}
1300 @end example
1302 @noindent
1303 in the main file. YaTeX automatically detects that the current
1304 edited text is not in includeonly list and prompts you
1306 @example
1307 A)dd R)eplace %)comment?
1308 @end example
1310 in the minibuffer. Type @kbd{a} if you want to add the current file name
1311 to @code{\includeonly} list, @kbd{r} to replace \@code{includeonly} list
1312 with the current file, and type @kbd{%} to comment out the
1313 @code{\includeonly} line.
1315 @node What column, Intelligent newline, Updation of includeonly, Top
1316 @comment node-name, next, previous, up
1317 @chapter What column?
1318 @cindex what column
1319 @cindex complex tabular
1320 @cindex prefix &
1322 We are often get tired of finding the corresponding column in
1323 large tabulars. For example,
1325 @example
1326 \begin@{tabular@}@{|c|c|c|c|c|c|c|c|@}\hline
1327 Name&Position&Post No.&Addr.&Phone No.&FAX No.&
1328 Home Addr.&Home Phone\\ \hline
1329 Thunder Bird & 6 & 223 & LA & xxx-yyy &
1330 zzz-www & Japan & 9876-54321 \\
1331 & 2 & \multicolumn@{2@}@{c|@}@{Unknown@}
1332 &&&(???)
1333 \\ \hline
1334 \end@{tabular@}
1335 @end example
1337 Suppose you have the cursor located at @code{(???)} mark, can you tell
1338 which column it is belonging at once? Maybe no. In such case,
1339 type
1341 @table @kbd
1342 @item [prefix] &
1343 @dots{} What column
1344 @end table
1346 @noindent
1347 in that position. YaTeX tells you the column header of the
1348 current field. Since YaTeX assumes the first line of tabular
1349 environment as a row of column headers, you can create a row of
1350 virtual column headers by putting them in the first line and
1351 commenting that line with @code{%}.
1353 @node Intelligent newline, Usepackage checker, What column, Top
1354 @comment node-name, next, previous, up
1355 @chapter Intelligent newline
1356 @cindex Intelligent newline
1357 @cindex ESC RET
1358 @cindex M-C-m
1360 At the end of begin-type completion of tabular[*], array, itemize,
1361 enumerate or tabbing environment, or typing
1363 @table @kbd
1364 @item ESC RET
1365 @dots{} Intelligent newline
1366 @end table
1368 @noindent
1369 in these environments inserts the contents corresponding to the current
1370 environment in the next line. (At the begin-type completion, this
1371 contents can be removed by `undo'.) In @code{tabular} environment, for
1372 example, @kbd{ESC RET} inserts the certain number of @code{&} and trailing
1373 @code{\\}, and @code{\hline} if other @code{\hline} is found in backward.
1374 Here are the list of contents vs. environments.
1376 @itemize
1377 @item @code{tabular}, @code{tabular*}, @code{array}
1379 Corresponding number of @code{&} and @code{\\}.
1380 And @code{\hline} if needed.
1382 @item @code{tabbing}
1384 The same number of @code{\>} as @code{\=} in the first line.
1386 @item @code{itemize}, @code{enumerate}, @code{description}, @code{list}
1388 @code{\item} or @code{item[]}.
1389 @end itemize
1391 Note that since this function works seeing the contents of the first
1392 line, please call this after the second line if possible.
1394 If you want to apply these trick to other environments, @code{foo}
1395 environment for example, define the function named
1396 @code{YaTeX-intelligent-newline-foo} to insert corresponding contents.
1397 That function will be called at the beginning of the next line after the
1398 newline is inserted to the current line. Since the function
1399 @code{YaTeX-indent-line} is designed to indent the current line properly,
1400 calling this function before your code to insert certain contents must be
1401 useful. See the definition of the function
1402 @code{YaTeX-intelligent-newline-itemize} as an example.
1404 @node Usepackage checker, Online help, Intelligent newline, Top
1405 @comment node-name, next, previous, up
1406 @chapter Usepackage checker
1407 @cindex usepackage
1409 When you input begint-type, section-type, maketitle-type macros with
1410 completion, and it requires some LaTeX2e package, YaTeX examines
1411 the existence of correct @code{\usepackage}. If not, YaTeX inserts
1412 the @code{\usepackage@{@}} declaration corresponding to input macro.
1414 To activate the package completion for your favarite package,
1415 set the variable @code{YaTeX-package-alist-private} correctly.
1416 Please refere the value of @code{YaTeX-package-alist-default} as an
1417 example.
1419 @node Online help, Browsing file hierarchy, Usepackage checker, Top
1420 @comment node-name, next, previous, up
1421 @chapter Online help
1422 @cindex online help
1423 @cindex prefix ?
1424 @cindex prefix /
1425 @cindex apropos
1426 @cindex keyword search
1428 YaTeX provides you the online help with popular La@TeX{} commands.
1430 Here are the key strokes for the online help.
1432 @table @kbd
1433 @item [prefix] ?
1434 @dots{} Online help
1435 @item [prefix] /
1436 @dots{} Online apropos
1437 @end table
1439 @section Online help
1441 `Online help' shows the documentation for the popular La@TeX{}
1442 commands(defaults to the commands on the cursor) in the next buffer.
1443 There are two help file, `global help' and `private help'. The former
1444 file contains the descriptions on the standard La@TeX{} command and is
1445 specified its name by variable @code{YaTeX-help-file}. Usually, the
1446 global help file should be located in public space (@code{$EMACSEXECPATH}
1447 by default) and should be world writable so that anyone can update it to
1448 enrich its contents. The latter file contains descriptions on
1449 non-standard or personal command definitions and is specified by
1450 @code{YaTeX-help-file-private}. This file should be put into private
1451 directory.
1453 @section Online apropos
1455 `Online apropos' is an equivalent of GNU Emacs's apropos. It
1456 shows all the documentations that contains the keyword entered by
1457 the user.
1459 @section When no descriptions are found...
1461 If there is no description on a command in help files, YaTeX
1462 requires you to write a description on that command. If you are
1463 willing to do, determine which help file to add and write the
1464 description on it referring your manual of (La)TeX. Please send
1465 me your additional descriptions if you describe the help on some
1466 standard commands. I might want to include it in the next
1467 distribution.
1469 @node Browsing file hierarchy, Cooperation with other packages, Online help, Top
1470 @comment node-name, next, previous, up
1471 @chapter Browsing file hierarchy
1472 @cindex hierarchy
1473 @cindex browsing
1475 When you are editing multi-file source, typing
1477 @table @kbd
1478 @item [prefix] d
1479 @dots{} browse file hierarchy
1480 @end table
1482 @noindent
1483 asks you the parent-most file (which may be defaulted) and displays the
1484 documentation hierarchy in the next window. In this buffer, the following
1485 commands are available.
1487 @table @kbd
1488 @item n
1489 @dots{} move to the next line and show its contents
1490 @item p
1491 @dots{} move to the previous line and show its contents
1492 @item N
1493 @dots{} move to the next file in the same inclusion level
1494 @item P
1495 @dots{} move to the previous file in the same inclusion level
1496 @item j
1497 @dots{} move to the next line
1498 @item k
1499 @dots{} move to the previous line
1500 @item u
1501 @dots{} move to the parent file
1502 @item .
1503 @dots{} show the current files contents in the next window
1504 @item SPC
1505 @dots{} scroll up the current file window
1506 @item DEL, b
1507 @dots{} scroll down the current file window
1508 @item <
1509 @dots{} show the beginning of the current file
1510 @item >
1511 @dots{} show the end of the current file
1512 @item >
1513 @dots{} return to the previous postion after @kbd{<} or @kbd{>}
1514 @item RET, g
1515 @dots{} open the current file in the next window
1516 @item mouse-2
1517 @dots{} same as RET(available only with window system)
1518 @item o
1519 @dots{} other window
1520 @item 1
1521 @dots{} delete other windows
1522 @item -
1523 @dots{} shrink hierarchy buffer window
1524 @item +
1525 @dots{} enlarge hierarchy buffer window
1526 @item ?
1527 @dots{} describe mode
1528 @item q
1529 @dots{} quit
1530 @end table
1532 Note that operations on the file contents in the next window do not work
1533 correctly when you close the corresponding file.
1535 @node Cooperation with other packages, Customizations, Browsing file hierarchy, Top
1536 @comment node-name, next, previous, up
1537 @chapter Cooperation with other packages
1539 YaTeX works better with other brilliant packages.
1541 @section gmhist
1542 @cindex gmhist
1543 @cindex command history
1544 @cindex minibuffer history
1546 When you are loading @file{gmhist.el} and @file{gmhist-mh.el}, you can
1547 use independent command history list at the prompt of preview command
1548 (@kbd{[prefix] tp}) and print command (@kbd{[prefix] tl}). On each
1549 prompt, you can enter the previous command line string repeatedly by
1550 typing @kbd{M-p}.
1552 @section min-out
1553 @cindex min-out
1555 @file{min-out}, the outline minor mode, can be used in yatex-mode
1556 buffers. If you want to use it with YaTeX, please refer the
1557 file @file{yatexm-o.el} as an example.
1559 @node Customizations, Etcetera, Cooperation with other packages, Top
1560 @comment node-name, next, previous, up
1561 @chapter Customizations
1562 @cindex customizations
1564 You can customize YaTeX by setting Emacs-Lisp variables and by making
1565 add-in functions.
1567 @menu
1568 * Lisp variables::
1569 * Add-in functions::
1570 * Add-in generator::
1571 @end menu
1573 @node Lisp variables, Add-in functions, Customizations, Customizations
1574 @comment node-name, next, previous, up
1575 @section Lisp variables
1576 @cindex customizable variables
1578 You can change the key assignments or make completion more comfortable
1579 by setting the values of various variables which control the movement of
1580 yatex-mode.
1582 For example, if you want to change the prefix key stroke from @kbd{C-c}
1583 to any other sequence, set YaTeX-prefix to whatever you want to use. If
1584 you don't want to use the key sequence @kbd{C-c letter} which is assumed
1585 to be the user reserved sequence in Emacs world, set
1586 @code{YaTeX-inhibit-prefix-letter} to @code{t}, and all of the default key
1587 bind of @kbd{C-c letter} will turn to the corresponding @kbd{C-c C-letter}
1588 (but the region based completions that is invoked with @kbd{C-c
1589 Capital-letter} remain valid, if you want to disable those bindings, set
1590 that variable to 1 instead of @code{t}).
1592 @menu
1593 * All customizable variables::
1594 * Sample definitions::
1595 * Hook variables::
1596 * Hook file::
1597 @end menu
1599 @node All customizable variables, Sample definitions, Lisp variables, Lisp variables
1600 @comment node-name, next, previous, up
1601 @subsection All customizable variables
1602 @cindex all customizable variables
1604 Here are the customizable variables of yatex-mode. Each value setq-ed
1605 in @file{~/.emacs} is preferred and that of defined in @file{yatex.el} is
1606 neglected. Parenthesized contents stands for the default value. When you
1607 are to change some of these variables, see more detailed documentation of
1608 the variable by @kbd{M-x describe-variable}.
1610 @defvar YaTeX-japan
1611 Set this nil to produce all messages in English
1612 (@code{Depends on Japanese feature of Emacs})
1613 @end defvar
1615 @defvar YaTeX-kanji-code
1616 Default buffer-file-coding-system for YaTeX modes' buffer.
1617 Set this 0 to no language conversion. Nil to preserve original
1618 coding-system. 1=Shift JIS, 2=JIS, 3=EUC, 4=UTF-8 (@code{1 or 2})
1619 @end defvar
1621 @defvar YaTeX-prefix
1622 Prefix key stroke (@kbd{C-c})
1623 @end defvar
1625 @defvar YaTeX-inhibit-prefix-letter
1626 Change key stroke from @kbd{C-c letter} to @kbd{C-c C-letter} (@code{nil})
1627 @end defvar
1629 @defvar YaTeX-fill-prefix
1630 Fill-prefix used in yatex-mode (@code{nil})
1631 @end defvar
1633 @defvar YaTeX-user-completion-table
1634 Name of user dictionary where learned completion table will be stored.
1635 (@code{"~/.yatexrc"})
1636 @end defvar
1638 @defvar tex-command
1639 La@TeX{} typesetter command (@code{"latex"})
1640 @end defvar
1642 @defvar dvi2-command
1643 Preview command (@code{"xdvi -geo +0+0 -s 4"})
1644 @end defvar
1646 @defvar dviprint-command-format
1647 Command format to print dvi file (@code{"dvi2ps %f %t %s | lpr"})
1648 @end defvar
1650 @defvar dviprint-from-format
1651 Start page format of above %f. %b will turn to start page (@code{"-f %b"})
1652 @end defvar
1654 @defvar dviprint-to-format
1655 End page format of above %t. %e will turn to @code{end} page (@code{"-t %e"})
1656 @end defvar
1658 @defvar makeindex-command
1659 Default makeindex command (@code{"makeindex"} (@code{"makeind"} on MS-DOS))
1660 @end defvar
1662 @defvar YaTeX-dvipdf-command
1663 Default command name to convert .dvi to PDF (@code{"dvipdfmx"})
1664 @end defvar
1666 @defvar YaTeX-need-nonstop
1667 Put @code{\nonstopmode@{@}} or not (@code{nil})
1668 @end defvar
1670 @defvar latex-warning-regexp
1671 Regular expression of warning message latex command puts out
1672 (@code{"line.* [0-9]*"})
1673 @end defvar
1675 @defvar latex-error-regexp
1676 Regular expression of error message (@code{"l\\.[1-9][0-9]*"})
1677 @end defvar
1679 @defvar latex-dos-emergency-message
1680 Message latex command running on DOS puts at abort (@code{"Emergency stop"})
1681 @end defvar
1683 @defvar YaTeX-item-regexp
1684 Regular expression of item command (@code{"\\\\item"})
1685 @end defvar
1687 @defvar YaTeX-verb-regexp
1688 Regexp of verb family. Omit \\\\. (@code{"verb\\*?\\|path"})
1689 @end defvar
1691 @defvar YaTeX-nervous
1692 T for using local dictionary (@code{t})
1693 @end defvar
1695 @defvar YaTeX-sectioning-regexp
1696 Regexp of La@TeX{} sectioning command
1697 (@code{"\\(part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\*?\\)\\b"})
1698 @end defvar
1700 @defvar YaTeX-fill-inhibit-environments
1701 Inhibit fill in these environments
1702 (@code{'("tabular" "tabular*" "array" "picture" "eqnarray" "eqnarray*" "equation" "math" "displaymath" "verbatim" "verbatim*")})
1703 @end defvar
1705 @defvar YaTeX-uncomment-once
1706 T for deleting all preceding @code{%} (@code{nil})
1707 @end defvar
1709 @defvar YaTeX-close-paren-always
1710 T for always close all parenthesis automatically, @code{nil} for only eol
1711 (@code{t})
1712 @end defvar
1714 @defvar YaTeX-auto-math-mode
1715 Switch math-mode automatically (@code{t})
1716 @end defvar
1718 @defvar YaTeX-math-key-list-private
1719 User defined alist, math-mode-prefix vs completion alist
1720 used in image completion (@code{nil}). See @file{yatexmth.el}
1721 for the information about how to define a completion alist.
1722 @end defvar
1724 @defvar YaTeX-default-pop-window-height
1725 Initial height of typesetting buffer when one-window.
1726 Number for the lines of the buffer, numerical string for
1727 the percentage of the screen-height. @code{nil} for half height (10)
1728 @end defvar
1730 @defvar YaTeX-help-file
1731 Global online help file name (@file{$doc-directory/../../site-lisp/YATEXHLP.eng})
1732 @end defvar
1734 @defvar YaTeX-help-file-private
1735 Private online help file name (@file{"~/YATEXHLP.eng"})
1736 @end defvar
1738 @defvar YaTeX-no-begend-shortcut
1739 Disable [prefix] b ?? shortcut (@code{nil)}
1740 @end defvar
1742 @defvar YaTeX-hilit-pattern-adjustment-private
1743 List of the list that contain the regular expression and the symbol of
1744 logical meaning of the string that matches the pattern. See also the
1745 value from @code{(assq 'yatex-mode hilit-patterns-alist)} and the value of
1746 @code{YaTeX-hilit-pattern-adjustment-default} (and even the document of
1747 hilit19.el).
1748 @end defvar
1750 @defvar YaTeX-sectioning-level
1751 Alist of LaTeX's sectioning command vs its height.
1752 @end defvar
1754 @defvar YaTeX-hierarchy-ignore-heading-regexp
1755 @code{YaTeX-display-hierarchy} searches for sectioning command first, and
1756 comment line secondary as a file headings. In latter case, ignore lines
1757 that match with regular expression of this variable. Default value of
1758 this variable is RCS header expressions and mode specifying line `-*- xxxx
1759 -*'.
1760 @end defvar
1762 @defvar YaTeX-skip-default-reader
1763 Non-nil for this variable skips the default argument reader of
1764 section-type command when add-in function for it is not defined
1765 (@code{nil})
1766 @end defvar
1768 @defvar YaTeX-create-file-prefix-g
1769 When typing @kbd{prefix g} on the @code{\include} line,
1770 open the target file even if the file doesn't exist (@code{nil})
1771 @end defvar
1773 @defvar YaTeX-simple-messages
1774 Simplyfy messages of various completions (@code{nil})
1775 @end defvar
1777 @defvar YaTeX-hilit-sectioning-face
1778 When hilit19 and yatex19 is active, YaTeX colors the sectioning commands.
1779 This variable specifies the foreground and background color of
1780 @code{\part} macro. The default value is @code{'(yellow/dodgerblue
1781 yellow/slateblue)}. The first element of this list is for the screen when
1782 @code{hilit-background-mode} is @code{'light}, and the second element is
1783 for @code{'dark}. You should specify both color as `forecolor/backcolor'.
1784 @end defvar
1786 @defvar YaTeX-hilit-sectioning-attenuation-rate
1787 When color mode, this variable specifies how much attenuate the color
1788 density of @code{\subparagraph} compared with that of @code{\chapter}
1789 (@code{'(15 40)}) See also @code{YaTeX-hilit-sectioning-face}.
1790 @end defvar
1792 @defvar YaTeX-use-AMS-LaTeX
1793 If you use AMS-LaTeX, set to @code{t} (@code{nil})
1794 @end defvar
1796 @defvar YaTeX-use-LaTeX2e
1797 If you use LaTeX2e, set to @code{t} (@code{t})
1798 @end defvar
1800 @defvar YaTeX-template-file
1801 File name which is automatically inserted at creation
1802 (@code{~/work/template.tex})
1803 @end defvar
1805 @defvar YaTeX-search-file-from-top-directory
1806 Non-nil means to search input-files from the directory where main file exists
1807 (@code{t})
1808 @end defvar
1810 @defvar YaTeX-use-font-lock
1811 Use font-lock to fontify buffer or not (@code{(featurep 'font-lock)}
1812 @end defvar
1814 @defvar YaTeX-use-hilit19
1815 Use hilit19 to highlight buffer or not (@code{(featurep 'hilit19)}
1816 @end defvar
1818 @defvar YaTeX-use-italic-bold
1819 YaTeX tries to search italic, bold fontsets or not
1820 (@code{t} if Emacs-20 or later). This variable is effective only when
1821 font-lock is used.
1822 (@code{(featurep 'hilit19)}
1823 @end defvar
1825 @defvar YaTeX-singlecmd-suffix
1826 Suffix which is always inserted after maketitle-type macros.
1827 @code{"{}"} is recommended.
1828 @end defvar
1830 @defvar YaTeX-package-alist-private
1831 Alist of LaTeX2e-package name vs. lists of macros in it.
1832 Set this alist properly and YaTeX automatically check the declaratiion of
1833 `usepackage' for corresponding macro, when you input that macro with
1834 completion. If required `usepackage' is not found, YaTeX also
1835 automatically inserts `\usepackage'. Alist is as follows;
1836 @lisp
1837 '((PackageName1
1838 (completionType ListOfMacro)
1839 (completionType ListOfMacro))
1840 (PackageName2
1841 (completionType ListOfMacro)
1842 (completionType ListOfMacro...))....)
1843 @end lisp
1844 completionType is one of @code{env, section, maketitle}.
1845 Consult the value of @code{YaTeX-package-alist-default} as an example.
1846 @end defvar
1848 @defvar YaTeX-tabular-indentation
1849 At indentation by @kbd{C-i} in tabular or array environment,
1850 YaTeX put the additional spaces to the normail indentation depth.
1851 The number of additional spaces is the product of YaTeX-tabular-indentation
1852 and the number of column position in tabular.
1853 @end defvar
1855 @defvar YaTeX-noindent-env-regexp
1856 Regexp of environment names that should begin with no indentation.
1857 All verbatime-like environment name should match with.
1858 @end defvar
1860 @defvar YaTeX-ref-default-label-string
1861 Default \\ref time string format.
1862 This format is like strftime(3) but allowed conversion char are as follows;
1863 %y -> Last 2 digit of year, %b -> Month name, %m -> Monthe number(1-12),
1864 %d -> Day, %H -> Hour, %M -> Minute, %S -> Second,
1865 %qx -> alphabetical-decimal conversion of yymmdd.
1866 %qX -> alphabetical-decimal conversion of HHMMSS.
1867 Beware defualt label-string should be always unique. So this format string
1868 should have both time part (%H+%M+%S or %qX) and date
1869 part (%y+(%b|%m)+%d or %qx).
1870 @end defvar
1872 @defvar YaTeX-ref-generate-label-function
1873 Function to generate default label string for unnamed \\label{}s.
1874 The function pointed to this value should take two arguments.
1875 First argument is LaTeX macro's name, second is macro's argument.
1876 Here is an example for using this value.
1877 @lisp
1878 (setq YaTeX-ref-generate-label-function 'my-yatex-generate-label)
1879 (defun my-yatex-generate-label (command value)
1880 (and (string= command "caption")
1881 (re-search-backward "\\\\begin{\\(figure\\|table\\)}" nil t)
1882 (setq command (match-string 1)))
1883 (let ((alist '(("chapter" . "chap")
1884 ("section" . "sec")
1885 ("subsection" . "subsec")
1886 ("figure" . "fig")
1887 ("table" . "tbl"))))
1888 (if (setq command (cdr (assoc command alist)))
1889 (concat command ":" value)
1890 (YaTeX::ref-generate-label nil nil))))
1891 @end lisp
1892 @end defvar
1895 @node Sample definitions, Hook variables, All customizable variables, Lisp variables
1896 @comment node-name, next, previous, up
1897 @subsection Sample definitions
1898 @cindex prefix key stroke
1899 @cindex fill-prefix
1901 For instance, to change the prefix key stroke to @kbd{ESC}, and name of
1902 the user dictionary @file{~/src/emacs/yatexrc}, and set @code{fill-prefix}
1903 to single TAB character, add the following @code{setq} to @file{~/.emacs}.
1905 @lisp
1906 (setq YaTeX-prefix "\e"
1907 YaTeX-user-completion-table "~/src/emacs/yatexrc"
1908 YaTeX-fill-prefix " ")
1909 @end lisp
1911 @node Hook variables, Hook file, Sample definitions, Lisp variables
1912 @comment node-name, next, previous, up
1913 @subsection Hook variables
1914 @cindex hook variables
1916 More customizations will be done by the hook-function defined in
1917 hook-variable @code{yatex-mode-hook}. This is useful to define a shortcut
1918 key sequence to enter some environments other than @code{document} and
1919 @code{enumerate} etc. The following statement defines @code{[prefix] ba}
1920 to enter @code{\begin@{abstract@}} ... @code{=end@{abstract@}}
1921 immediately.
1923 @lisp
1924 (setq yatex-mode-hook
1925 '(lambda() (YaTeX-define-begend-key "ba" "abstract")))
1926 @end lisp
1928 You should use functions @code{YaTeX-define-key}, or
1929 @code{YaTeX-define-begend-key} to define all the key sequences of
1930 yatex-mode.
1932 @node Hook file, , Hook variables, Lisp variables
1933 @comment node-name, next, previous, up
1934 @subsection Hook file
1935 @cindex hook file
1937 You can stuff all of YaTeX related expressions into a file named
1938 @file{yatexhks.el} if you have a lot of codes. YaTeX automatically load
1939 this file at the initialization of itself. Using @file{yatexhks.el}
1940 makes @code{yatex-mode-load-hook} unnecessary.
1942 @node Add-in functions, Add-in generator, Lisp variables, Customizations
1943 @comment node-name, next, previous, up
1944 @section Add-in functions
1945 @cindex add-in functions
1946 @cindex yatexadd.el
1948 You can easily define a function to input detailed arguments
1949 with completion according to La@TeX{} environments or commands.
1951 @c @node What is add-in functions?, , Add-in functions, Add-in functions
1952 @comment node-name, next, previous, up
1953 @subsection What is add-in functions?
1954 @cindex tabular
1956 When you input @code{tabular} environment, don't you think ``I want
1957 YaTeX to complete its argument toward my favorite one such as
1958 @code{@{|c|c|c|@}}...''? Yes, you can define the function to complete
1959 arguments for any environment and any La@TeX{} commands.
1961 @subsection Procedure
1963 Here is the procedure to define add-in functions.
1964 @enumerate
1965 @item
1966 Define the function
1967 @item
1968 Put the function into @file{yatexhks.el}
1969 @end enumerate
1971 @menu
1972 * How the add-in function works::
1973 * How the function is called::
1974 * Useful functions for creating add-in::
1975 * Contribution::
1976 @end menu
1978 @node How the add-in function works, How the function is called, Add-in functions, Add-in functions
1979 @comment node-name, next, previous, up
1980 @subsection How the add-in function works
1982 There are three types of add-in.
1984 @enumerate
1985 @item
1986 Option add-in
1987 @item
1988 argument add-in
1989 @item
1990 enclosing add-in
1991 @end enumerate
1993 @dfn{Option add-in} returns the
1994 La@TeX{}'s optional parameters such as optional strings after
1995 @code{\begin@{ENV@}}, optional strings between a section-type command
1996 and its first argument, and optional strings just after type
1997 maketitle-type command. The following illustrates the name of add-in
1998 functions, where underlined strings are generated by add-in functions.
2000 @display
2001 \begin@{table@}[ht] (Function name: YaTeX:table)
2002 ~~~~
2003 \put(100,200)@{@} (Function name: YaTeX:put)
2004 ~~~~~~~~~
2005 \sum_@{i=0@}^@{n@} (Function name: YaTeX:sum)
2006 ~~~~~~~~~~
2007 @end display
2009 Obviously, the function name is decided by concatenating the prefix
2010 `YaTeX:' and La@TeX{} command's name.
2012 Another add-in type is @dfn{argument add-in}, which completes arguments
2013 for section-type commands.
2015 @display
2016 \newcommand@{\foo@}@{bar@} (Function name: YaTeX::newcommand)
2017 ~~~~ ~~~
2018 @end display
2020 When the section-type command is inputted, the function named by
2021 concatenating `YaTeX::' and section-type command, is called automatically
2022 with an integer argument which indicates which argument of section-type
2023 command is being read. Thus the add-in should determine the
2024 job referring the value of its argument.
2026 @dfn{enclosing add-in} is for modifying and/or checking the region that
2027 will be enclosed by section-type commands via @kbd{[prefix] S}. An
2028 enclosing add-in function will be called with two arguments, beginning of
2029 the enclosed region and end of the region. Suppose you want to enclose
2030 the existing text @code{(a+b)/c} by @code{\frac{}}.
2032 @display
2033 a/c
2034 | |
2035 A B
2036 @end display
2038 You do set-mark-command at point A and then move to point B. Typing
2039 @kbd{[prefix] S} and input @code{frac} enclose the region like this;
2041 @display
2042 \frac{a/c}
2043 @end display
2045 Normally, the expression @code{a/c} is translated to
2046 @code{\frac@{a@}@{c@}}. An enclosing add-in is useful for modifying
2047 @code{/} to @code{@}@{}.
2049 @menu
2050 * Defining option-add-in::
2051 * Defining argument-add-in::
2052 * Defining enclosing-add-in::
2053 @end menu
2055 @node Defining option-add-in, Defining argument-add-in, How the add-in function works, How the add-in function works
2056 @comment node-name, next, previous, up
2057 @subsubsection Defining `option add-in'
2059 If you want @code{@{|c|c|c|@}} for all @code{tabular} environment,
2061 @lisp
2062 (defun YaTeX:tabular ()
2063 "@{|c|c|c|@}")
2064 @end lisp
2066 @noindent
2067 is enough. If you want more complicated format, define as below.
2069 @lisp
2070 (defun YaTeX:tabular ()
2071 "@{@@@{\\vrule width 1pt\\ @}|||@@@{\\ \\vrule width 1pt@}@}")
2072 @end lisp
2074 @noindent
2075 Note that the character @code{\} must be described as @code{\\} in
2076 Emacs-Lisp. The next example reads the tabular format from keyboard.
2077 @lisp
2078 (defun YaTeX:tabular ()
2079 (concat "@{" (read-string "Rule: ") "@}"))
2080 @end lisp
2082 @node Defining argument-add-in, Defining enclosing-add-in, Defining option-add-in, How the add-in function works
2083 @comment node-name, next, previous, up
2084 @subsubsection Defining `argument add-in'
2086 This section describes how to define the add-in function for
2087 @code{\newcommand}.
2089 The first argument of @code{\newcommand} begins always with @code{\}.
2090 The second argument is usually so complex that we can not edit them in the
2091 minibuffer. Here is the created function considering this.
2093 @lisp
2094 (defun YaTeX::newcommand (n) ;n is argument position
2095 (cond
2096 ((= n 1) ;1st argument is macro name
2097 (read-string "Command: " "\\")) ;initial input `\'
2098 ((= n 2) "") ;do nothing when reading arg#2
2099 (t nil)))
2100 @end lisp
2102 Note that when the `argument add-in' function return `nil', normal
2103 argument reader will be called.
2105 @node Defining enclosing-add-in, , Defining argument-add-in, How the add-in function works
2106 @comment node-name, next, previous, up
2107 @subsubsection Defining `enclosing add-in'
2109 This section describes how to define the add-in function for
2110 text enclosed by @code{\frac@{@}}.
2112 When enclosing the text @code{5/3} by @code{\frac@{@}}, you might want to
2113 replace @code{/} with @code{@}@{}. Enclosing function
2114 @code{YaTeX::frac-region} is called with two arguments, beginning of
2115 enclosed text and end of enclosed text. The function is expected to
2116 replace @code{/} with @code{@}@{}. Here is an example expression.
2118 @lisp
2119 (defun YaTeX::frac-region (beg end)
2120 (catch 'done
2121 (while (search-forward "/" end t)
2122 (goto-char (match-beginning 0))
2123 (if (y-or-n-p "Replace this slash(/) with `}{'")
2124 (throw 'done (replace-match "}{")))
2125 (goto-char (match-end 0)))))
2126 @end lisp
2128 @node How the function is called, Useful functions for creating add-in, How the add-in function works, Add-in functions
2129 @comment node-name, next, previous, up
2130 @subsection How the function is called
2132 YaTeX calls the add-in functions for specified begin-type, section-type,
2133 and maketitle-type command, if any. `Option add-in' functions for
2134 begin-type are called when @code{\begin@{ENV@}} has been inserted,
2135 functions for section-type are called just before input of the first
2136 argument, and functions for maketitle-type is called after maketitle-type
2137 command has been inserted. `Argument add-in' functions are called at each
2138 entry of arguments for section-type commands.
2140 @node Useful functions for creating add-in, Contribution, How the function is called, Add-in functions
2141 @comment node-name, next, previous, up
2142 @subsection Useful functions for creating add-in
2144 Many add-in functions for typical La@TeX{} commands are defined in
2145 @file{yatexadd.el}. Those are also useful as references. Here are the
2146 short descriptions on useful functions, where [F] means function, [A]
2147 means arguments, [D] means description.
2149 @table @kbd
2150 @item [F]
2151 YaTeX:read-position
2152 @itemx [A]
2153 Character list which can show up in the brackets
2154 @itemx [D]
2155 Return the location specifier such as `[htb]'. When
2156 nothing is entered, omit [] itself. If the possible characters
2157 are "htbp", call this function as
2158 @code{(YaTeX:read-position "htbp")}
2160 @item [F]
2161 YaTeX:read-coordinates
2162 @itemx [A]
2163 Base prompt, X-axis prompt, Y-axis prompt (each optional)
2164 @itemx [D]
2165 Read the coordinates with the prompt ``BasePrompt X-axisPrompt:'' for
2166 X-axis, ``BasePrompt Y-axisPrompt:'' for Y-axis, and return it in the form
2167 of ``(X,Y)''. The default prompts are @code{Dimension}, @code{X},
2168 @code{Y} respectively.
2170 @item [F]
2171 YaTeX:check-completion-type
2172 @itemx [A]
2173 One of the symbols: 'begin, 'section, or 'maketitle
2174 @itemx [D]
2175 Check the current completion type is specified one and cause error if
2176 not. The variable @code{YaTeX-current-completion-type} holds the symbol
2177 according to the current completion type.
2178 @end table
2180 @node Contribution, , Useful functions for creating add-in, Add-in functions
2181 @comment node-name, next, previous, up
2182 @subsection Contribution
2184 If you make your own pretty function and you let it be in public, please
2185 send me the function. I'm going to include it in the next release.
2187 @node Add-in generator, , Add-in functions, Customizations
2188 @comment node-name, next, previous, up
2189 @section Add-in generator
2191 First, don't forget to read the section of add-in functions @ref{Add-in
2192 functions}. If you easily understand how to define them, there's no need
2193 to read this section. But being not familiar with Emacs-Lisp, when you
2194 don't have clear idea what to do, this section describes how to get YaTeX
2195 make add-in function.
2197 There are two methods of generation. One is for fully interactive
2198 generator for beginners and another requires little knowledge of
2199 Emacs-Lisp.
2201 @subsection Generator for beginners
2202 The former generator is called by
2203 @center @kbd{M-x YaTeX-generate}
2205 @noindent
2206 strokes. All you have to do is follow the guidances. Defying them may cases
2207 the disaster (I wonder what is it???). So when you make some mistake, it
2208 is recommendable to type @kbd{C-g} and start afresh.
2210 @subsection Simple generator
2212 The latter generator is invoked by the next sequence.
2213 @center @kbd{M-x YaTeX-generate-simple}
2214 This generator can make both ``option add-in'' and ``argument add-in''
2215 (@emph{refer the section add-in functions}
2216 @ref{How the add-in function works}), whereas @code{YaTeX-generate}
2217 cannot make ``argument addin''.
2219 For example, assume you have the LaTeX command as follows.
2221 @example
2222 \epsinput[t](250,50)@{hoge.eps@}@{plain@}@{Picture of foo@}
2223 (A) (B) (1) (2) (3)
2224 (A)Optional parameter to specify the position
2225 One of t(top), b(bottom), l(left), r(right)
2226 (B)Maximum size of frame
2227 (1)1st argument is filename of EPS file
2228 (2)2nd argument indicates
2229 plain do nothing
2230 frame make frame around image
2231 dframe make double-frame around image
2232 for included EPS file.
2233 (3)Caption for the picture
2234 @end example
2236 Now get start with generation. Typing @kbd{M-x YaTeX-generate-simple}
2237 brings the prompt:
2238 @display
2239 (O)ption? (A)rgument?
2240 @end display
2242 @subsubsection Generating ``option add-in''
2243 @cindex option add-in
2245 Since (A), (B) above are optional argument, all we have to do to
2246 complete them is define the option add-in for them. Let's generate the
2247 function to complete (A).
2249 @display
2250 M-x YaTeX-generate-simple RET
2251 epsinput RET
2253 @end display
2255 @noindent
2256 Typing as above leads the next prompt.
2258 @display
2259 Read type(1): (S)tring (C)omplete (F)ile ([)option (P)osition co(O)rd. (q)uit
2260 @end display
2262 @noindent
2263 This asks that ``Which type is the completion style of 1st argument?''.
2264 Here are the possible completion style.
2266 @table @code
2267 @item String
2268 read plain string
2269 @item Complete
2270 read with completion
2271 @item File
2272 read file name
2273 @item Option
2274 read optional string (if string omitted, omit [] too)
2275 @item Position
2276 read positional option (like [htbp])
2277 @item Coord.
2278 read coordinates
2279 @item Quit
2280 quit from generating
2281 @end table
2283 Since (A) is the optional argument to specify the location of included
2284 EPS file, the completion style is @code{Position}, and the possible
2285 characters are t, b, l, and r. To tell these information to generator,
2286 operate as follows.
2288 @display
2289 Read type(1).... p
2290 Acceptable characters: tblr RET
2291 @end display
2293 (B) is coordinate. So its completion style is coOrd. We want a prompt
2294 meaning ``Maximum size'' when completion.
2296 @display
2297 Read type(2).... o
2298 Prompt for coordinates: Max size RET
2299 @end display
2301 That's all for optional argument. Select quit.
2303 @display
2304 Read type(3).... q
2305 @end display
2307 Then the generated option add-in function for \epsinput will be shown in
2308 the next window.
2310 @subsubsection Generating ``argument add-in''
2311 @cindex argument add-in
2313 Next, create the argument add-in. The arguments for \epsinput are EPS
2314 file name, framing style, and caption string in sequence.
2316 @display
2317 M-x YaTeX-generate-simple RET
2318 epsinput RET
2320 @end display
2322 Above key strokes bring the prompt that asks the number of argument.
2323 Answer it with 3.
2325 @display
2326 How many arguments?: 3 RET
2327 @end display
2329 Then the generator asks the completion style and prompt for completion.
2330 Answer them. @kbd{f} for FileName and prompt string.
2332 @display
2333 Read type(1).... f
2334 Prompt for argument#1 EPS file name RET
2335 @end display
2337 The second argument is one of selected symbol. So the completion type
2338 is @code{Completion}.
2340 @display
2341 Read type(2).... c
2342 Prompt for argument#2 Include style RET
2343 @end display
2345 Then all the candidates ready to be read. Type single RET after
2346 entering all.
2348 @display
2349 Item[1](RET to exit): plain RET
2350 Item[2](RET to exit): frame RET
2351 Item[3](RET to exit): dframe RET
2352 Item[4](RET to exit): RET
2353 @end display
2355 The following prompt asks whether the entered string must belong to
2356 candidates or not. In this case, since the argument must be one of
2357 @code{plain}, @code{frame}, and @code{dframe}, type @code{y}.
2359 @display
2360 Require match? (y or n) y
2361 @end display
2363 The last argument is the caption string for which any completion is
2364 needed.
2366 @display
2367 Read type(3).... s
2368 Prompt for argument#3 Caption RET
2369 default: Figure of RET
2370 @end display
2372 Finally we'll get the argument add-in in the next window.
2374 @subsection Contribution
2376 If you get your own pretty function and you let it be in public, please
2377 steel yourself in the happy atmosphere and do not send me the function.
2378 I do know it is not fine because it is generated by yatexgen:-p.
2380 @node Etcetera, Copying, Customizations, Top
2381 @comment node-name, next, previous, up
2382 @chapter Etcetera
2384 The standard completion tables provided in @file{yatex.el} contain a
2385 few La@TeX{} commands I frequently use. This is to lessen the key
2386 strokes to complete entire word, because too many candidates
2387 rarely used often cause too many hits. Therefore always try to
2388 use completion in order to enrich your dictionary, and you will
2389 also find `Wild Bird' growing suitable for your La@TeX{} style.
2391 The package name `Wild Bird' is the English translation of Japanese
2392 title `Yachou', which is a trick on words of Japanese.
2394 @node Copying, , Etcetera, Top
2395 @comment node-name, next, previous, up
2396 @chapter Copying
2398 This program is distributed as a free software. You can
2399 use/copy/modify/redistribute this software freely but with NO warranty to
2400 anything as a result of using this software. Adopting code from this
2401 program is also free. But I would not do contract act.
2403 Any reports and suggestions are welcome as long as I feel interests in
2404 this software. My possible e-mail address is `yuuji@@yatex.org'. (as of
2405 Jan.2004) And there is mailing list for YaTeX. Although the common
2406 language is Japanese, questions in English will be welcome. To join the
2407 ML, send the mail whose subject is `append' to the address
2408 `yatex@@yatex.org. If you have some question, please ask to
2409 `yatex-admin@@yatex.org'.
2411 The specification of this software will be surely modified
2412 (depending on my feelings) without notice :-p.
2415 @flushright
2416 HIROSE Yuuji
2417 @end flushright
2418 @bye
2420 Local variables:
2421 mode: texinfo
2422 fill-prefix: nil
2423 fill-column: 74
2424 End: