yatex

view docs/yatexe.tex @ 272:78d0fdc0459c

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