yatex

view docs/yatexe.tex @ 472:355b28fc0025

Preparing release of 1.80
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 10 Sep 2017 00:03:52 +0859
parents d63ba3e187ca
children 668632d9392e
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 Sat Sep 9 23:41:37 2017 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-2017 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 (@var{AboveKeyStrokes} after region setting)
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 @item \includegraphics by Drag&Drop of image file
100 @end itemize
102 @node Installation, Typesetting, Main features, Top
103 @comment node-name, next, previous, up
104 @chapter Installation
105 @cindex installation
106 @cindex .emacs
107 @cindex auto-mode-alist
108 @cindex autoload
110 Put next two expressions into your @file{~/.emacs}.
112 @lisp
113 (setq auto-mode-alist
114 (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist))
115 (autoload 'yatex-mode "yatex" "Yet Another La@TeX{} mode" t)
116 @end lisp
118 Next, add certain path name where you put files of YaTeX to your
119 load-path. If you want to put them in @file{~/src/emacs}, write
121 @lisp
122 (setq load-path
123 (cons (expand-file-name "~/src/emacs") load-path))
124 @end lisp
126 @noindent
127 in your @file{~/.emacs}
129 Then, yatex-mode will be automatically loaded when you visit a
130 file which has extension @file{.tex}. If yatex-mode is successfully
131 loaded, mode string on mode line will be turned to "YaTeX".
134 @node Typesetting, %#notation, Installation, Top
135 @comment node-name, next, previous, up
136 @chapter Typesetting
137 @cindex typesetting
138 @cindex previewer
139 @cindex typesetter
140 @cindex latex
141 @cindex printing out
143 The prefix key stroke of yatex-mode is @kbd{C-c} (Press 'C' with Control
144 key) by default. If you don't intend to change the prefix key stroke,
145 assume all @kbd{[prefix]} as @kbd{C-c} in this document. These key
146 strokes execute typeset or preview command.
148 @table @kbd
149 @item [prefix] t j
150 @dots{} invoke typesetter
151 @item [prefix] t r
152 @dots{} invoke typesetter on region
153 @item [prefix] t e
154 @dots{} `on-the-fly preview' on current environment or whole
155 portion of current formulas in math-mode
156 @item [prefix] t d
157 @dots{} invoke dvipdfmx after successful typesetting
158 @item [prefix] t k
159 @dots{} kill current typesetting process
160 @item [prefix] t b
161 @dots{} invoke bibtex
162 @item [prefix] t i
163 @dots{} invoke makeindex
164 @item [prefix] t d
165 @dots{} invoke latex && dvipdfmx
166 @item [prefix] t p
167 @dots{} preview
168 @item [prefix] t l
169 @dots{} lpr dvi-file
170 @item [prefix] t s
171 @dots{} search current string on xdvi-remote
172 @end table
174 @menu
175 * Calling typesetter::
176 * Calling previewer::
177 * Printing out::
178 @end menu
180 @node Calling typesetter, Calling previewer, Typesetting, Typesetting
181 @comment node-name, next, previous, up
182 @section Calling typesetter
184 Typing @kbd{[prefix] t j}, the current editing window will be divided
185 horizontally when you invoke latex command, and log message of La@TeX{}
186 typesetting will be displayed in the other window; called typesetting
187 buffer. The typesetting buffer automatically scrolls up and traces
188 La@TeX{} warnings and error messages. If you see latex stopping by an
189 error, you can send string to latex in the typesetting buffer.
191 If an error stops the La@TeX{} typesetting, this key stroke will
192 move the cursor to the line where La@TeX{} error is detected.
194 @table @kbd
195 @item [prefix] '
196 @itemx ([prefix]+single quotation)
198 @dots{} jump to the previous error or warning
199 @end table
201 If you find a noticeable error, move to the typesetting buffer and move
202 the cursor on the line of error message and type @kbd{SPACE} key. This
203 makes the cursor move to corresponding source line.
205 YaTeX-typeset-region invoked by @kbd{[prefix] tr} call typesetter
206 for region. The region is specified by standard point and mark, or
207 by @code{%#BEGIN} and @code{%#END} marks. Selected region will be
208 copied to the temporary file @file{texput.tex} with the same preamble
209 as the main file of current editing sources. Be sure to put
210 all local macro settings in preamble, not after @code{\begin@{document@}}.
211 The method of specification of the region is shown in the
212 section @xref{%#notation}.
214 The documentclass for typeset-region is the same as that of editing
215 file if you edit one file, and is the same as main file's if you
216 edit splitting files.
218 The @kbd{[prefix] te} key automatically marks current inner environment
219 or inner math mode or paragraph, and then call typeset-region with marked
220 region. This
221 is convenient to quick view of current tabular environment or current
222 editing formulas. If running Emacs has the ability of displaying images,
223 typeset image will be shown in the next window. Further more,
224 if you modify the content within that environment, YaTeX performs
225 `on-the-fly' preview that automatically update preview image as you typed.
227 If your Emacs does not supply on-the-fly preview,
228 keeping previewer window for @file{texput.dvi} is handy
229 for debugging. Since @kbd{[prefix] te} selects the inner-most environment
230 as region, it is not suitable for partial typesetting of doubly or more
231 composed environment. If you want to do partial typesetting for a nested
232 environment, use @kbd{[prefix] tr} for static-region, which is described
233 in the section @xref{%#notation}.
235 @node Calling previewer, Printing out, Calling typesetter, Typesetting
236 @comment node-name, next, previous, up
237 @section Calling previewer
239 @kbd{[prefix] t p} invokes the TeX previewer. And if you are using
240 xdvi-remote, which can be controled from other terminals, @kbd{[prefix] t
241 s} enables you to search current string at the cursor on the running xdvi
242 window.
244 @node Printing out, , Calling previewer, Typesetting
245 @comment node-name, next, previous, up
246 @section Printing out
248 When you type @code{[preifx] t l}, YaTeX asks you the range of
249 dvi-printing by default. You can skip this by invoking it with
250 universal-argument as follows:
252 @example
253 C-u [prefix] tl
254 @end example
256 @node %#notation, Completion, Typesetting, Top
257 @comment node-name, next, previous, up
258 @chapter %# notation
259 @cindex %# notation
261 You can control the typesetting process by describing @code{%#}
262 notations in the source text.
264 @menu
265 * Changing typesetter::
266 * Splitting input files::
267 * Static region for typesetting::
268 * Lpr format::
269 * Controlling which command to invoke::
270 * Editing %# notation::
271 @end menu
273 @node Changing typesetter, Splitting input files, %#notation, %#notation
274 @comment node-name, next, previous, up
275 @section To change the `latex' command or to split a source text.
276 @cindex typesetter
278 To change the typesetting command, write
280 @example
281 %#!latex-big
282 @end example
284 @noindent
285 anywhere in the source text. This is useful for changing
286 typesetter.
288 @node Splitting input files, Static region for typesetting, Changing typesetter, %#notation
289 @comment node-name, next, previous, up
290 @section Splitting input files
292 And if you split the source text and
293 edit subfile that should be included from main text.
295 @example
296 %#!latex main.tex
297 @end example
299 @noindent
300 will be helpful to execute latex on main file from sub text buffer. Since
301 this command line after @kbd{%#!} will be sent to shell literally, next
302 description makes it convenient to use ghostview as dvi-previewer.
304 @example
305 %#!latex main && dvi2ps main.dvi > main
306 @end example
308 @noindent
309 Note that YaTeX assumes the component before the last period of
310 the last word in this line as base name of the main La@TeX{} source.
311 The @code{%f} notation in this line is replaced by main file name, and
312 @code{%r} replaced by root name of main file name. If you specify
313 @code{%f} or @code{%r}, YaTeX always ask you the name of main file at the
314 first typesetting.
316 To make best use of the feature of inter-file jumping by
317 @kbd{[prefix] g} (see @ref{Cursor jump}), take described below into
318 consideration.
320 @itemize
321 @item You can put split texts in sub directory, but not in
322 sub directory of sub directory.
323 @item In the main text, specify the child file name with relative path name
324 such as \include@{chap1/sub@}, when you include the file in
325 a sub-directory.
326 @item In a sub-text, write @code{%#!latex main.tex} even if @file{main.tex}
327 is in the parent directory(not %#!latex ../main.tex).
328 @end itemize
330 @node Static region for typesetting, Lpr format, Splitting input files, %#notation
331 @comment node-name, next, previous, up
332 @section Static region
333 @cindex static region
334 @cindex Fixed region
336 Typeset-region by @kbd{[prefix] tr} passes the region between point and
337 mark to typesetting command by default. But when you want to typeset
338 static region, enclose the region by @code{%#BEGIN} and @code{%#END} as
339 follows.
341 @example
342 %#BEGIN
343 TheRegionYouWantToTypesetManyTimes
344 %#END
345 @end example
347 This is the rule of deciding the region.
349 @enumerate
350 @item
351 If there exists %#BEGIN before point,
353 @enumerate
354 @item
355 If there exists %#END after %#BEGIN,
356 @itemize
357 @item From %#BEGIN to %#END.
358 @end itemize
360 @item
361 If %#END does not exist after %#BEGIN,
362 @itemize
363 @item From %#BEGIN to the end of buffer.
364 @end itemize
365 @end enumerate
367 @item
368 If there does not exist %#BEGIN before point,
369 @itemize
370 @item Between point and mark(standard method of Emacs).
371 @end itemize
372 @end enumerate
374 It is useful to write @code{%#BEGIN} in the previous line of \begin and
375 @code{%#END} in the next line of \@code{end} when you try complex
376 environment such as `tabular' many times. It is also useful to put only
377 @code{%#BEGIN} alone at the middle of very long text. Do not forget to
378 erase @code{%#BEGIN} @code{%#END} pair.
380 @node Lpr format, Controlling which command to invoke, Static region for typesetting, %#notation
381 @comment node-name, next, previous, up
382 @section Lpr format
383 @cindex lpr format
385 Lpr format is specified by three Lisp variables. Here are the
386 default values of them.
388 @table @code
389 @item (1)dviprint-command-format
390 @code{"dvi2ps %f %t %s | lpr"}
391 @item (2)dviprint-from-format
392 @code{"-f %b"}
393 @item (3)dviprint-to-format
394 @code{"-t %e"}
395 @end table
397 On YaTeX-lpr, @code{%s} in (1) is replaced by the file name of main
398 text, @code{%f} by contents of (2), %t by contents of (3). At these
399 replacements, @code{%b} in (2) is also replaced by the number of beginning
400 page, @code{%e} in (3) is replaced by the number of ending page. But
401 @code{%f} and @code{%t} are ignored when you omit the range of print-out
402 by @kbd{C-u [prefix] tl}.
404 If you want to change this lpr format temporarily, put a command
405 such as follows somewhere in the text:
407 @example
408 %#LPR dvi2ps %f %t %s | 4up -page 4 | texfix | lpr -Plp2
409 @end example
411 And if you want YaTeX not to ask you the range of printing
412 out, the next example may be helpful.
414 @example
415 %#LPR dvi2ps %s | lpr
416 @end example
418 @node Controlling which command to invoke, Editing %# notation, Lpr format, %#notation
419 @comment node-name, next, previous, up
420 @section Controlling which command to invoke
422 These %# notation below can control which command to invoke for
423 La@TeX{} related process.
425 @table @code
426 @item %#PREVIEW
427 @dots{} Command line for DVI viewing ([prefix] t p)
428 @item %#MAKEINDEX
429 @dots{} Command line for makeindex ([prefix] t i)
430 @item %#BIBTEX
431 @dots{} Command line for bibtex ([prefix] t b)
432 @item %#DVIPDF
433 @dots{} Command line for dvipdf(mx) ([prefix] t b)
434 @item %#LPR
435 @dots{} Command line for printing out([prefix] t l)
436 @item %#PDFVIEW
437 @dots{} Command line for PDF viewing
438 @item %#IMAGEDPI
439 @dots{} DPI value for converting to on-the-fly prewview image
440 @end table
442 If you want to invoke ``makeidx hogehoge'' to update index,
443 put the next line some upper place in the source, for example.
445 @example
446 %#MAKEINDEX makeidx hogehoge
447 @end example
450 @node Editing %# notation, , Controlling which command to invoke, %#notation
451 @comment node-name, next, previous, up
452 @section Editing %# notation
454 To edit @code{%#} notation described above, type
456 @table @kbd
457 @item [prefix] %
458 @dots{} editing %# notation menu
459 @end table
461 @noindent
462 and select one of the entry of the menu as follows.
464 @example
465 !)Edit-%#! B)EGIN-END-region L)Edit-%#LPR
466 @end example
468 @noindent
469 Type @kbd{!} to edit @code{%#!} entry, @code{b} to enclose the region with
470 @code{%#BEGIN} and @code{%#END}, and @code{l} to edit @code{%#LPR} entry.
471 When you type @kbd{b}, all @code{%#BEGIN} and @code{%#END} are
472 automatically erased.
474 @node Completion, Local dictionaries, %#notation, Top
475 @comment node-name, next, previous, up
476 @chapter Completion
477 @cindex completion
479 YaTeX makes it easy to input the La@TeX{} commands. There are several
480 kinds of completion type, begin-type, section-type, large-type, etc...
482 @menu
483 * Begin-type completion::
484 * Section-type completion::
485 * Label Generation::
486 * Large-type completion::
487 * Maketitle-type completion::
488 * Arbitrary completion::
489 * End completion::
490 * Accent completion::
491 * Image completion::
492 * Greek letters completion::
493 * Inserting parentheses::
494 @end menu
496 @node Begin-type completion, Section-type completion, Completion, Completion
497 @comment node-name, next, previous, up
498 @section Begin-type completion
499 @cindex begin-type completion
500 @cindex environment
501 @cindex prefix b
503 "Begin-type completion" completes commands of @code{\begin@{env@}} ...
504 @code{\end@{env@}}. All of the begin-type completions begin with this key
505 sequence.
507 @table @kbd
508 @item [prefix] b
509 @dots{} start begin-type completion
510 @end table
512 @noindent
513 An additional key stroke immediately completes a frequently used
514 La@TeX{} @code{\begin@{@}}...@code{\@code{end}@{@}} environment.
516 @table @kbd
517 @item [prefix] b c
518 @dots{} @code{\begin@{center@}...\end@{center@}}
519 @item [prefix] b d
520 @dots{} @code{\begin@{document@}...\end@{document@}}
521 @item [prefix] b D
522 @dots{} @code{\begin@{description@}...\end@{description@}}
523 @item [prefix] b e
524 @dots{} @code{\begin@{enumerate@}...\end@{enumerate@}}
525 @item [prefix] b E
526 @dots{} @code{\begin@{equation@}...\end@{equation@}}
527 @item [prefix] b i
528 @dots{} @code{\begin@{itemize@}...\end@{itemize@}}
529 @item [prefix] b l
530 @dots{} @code{\begin@{flushleft@}...\end@{flushleft@}}
531 @item [prefix] b m
532 @dots{} @code{\begin@{minipage@}...\end@{minipage@}}
533 @item [prefix] b t
534 @dots{} @code{\begin@{tabbing@}...\end@{tabbing@}}
535 @item [prefix] b T
536 @dots{} @code{\begin@{tabular@}...\end@{tabular@}}
537 @item [prefix] b^T
538 @dots{} @code{\begin@{table@}...\end@{table@}}
539 @item [prefix] b p
540 @dots{} @code{\begin@{picture@}...\end@{picture@}}
541 @item [prefix] b q
542 @dots{} @code{\begin@{quote@}...\end@{quote@}}
543 @item [prefix] b Q
544 @dots{} @code{\begin@{quotation@}...\end@{quotation@}}
545 @item [prefix] b r
546 @dots{} @code{\begin@{flushright@}...\end@{flushright@}}
547 @item [prefix] b v
548 @dots{} @code{\begin@{verbatim@}...\end@{verbatim@}}
549 @item [prefix] b V
550 @dots{} @code{\begin@{verse@}...\end@{verse@}}
551 @end table
553 Any other La@TeX{} environments are made by completing-read of the
554 Emacs function.
556 @table @kbd
557 @item [prefix] b SPACE
558 @dots{} begin-type completion
559 @end table
561 @noindent
562 The next message will show up in the minibuffer
564 @example
565 Begin environment(default document):
566 @end example
568 @noindent
569 by typing @kbd{[prefix] b}. Put the wishing environment with completion
570 in the minibuffer, and @code{\begin@{env@}}...\@code{\end@{env@}} will be
571 inserted in the La@TeX{} source text. If the environment you want to put
572 does not exist in the YaTeX completion table, it will be registered in the
573 user completion table. YaTeX automatically saves the user completion
574 table in the user dictionary file at exiting of emacs.
576 At the completion of certain environments, the expected initial entry will
577 automatically inserted such as @code{\item} for @code{itemize}
578 environment. If you don't want the entry, it can be removed by undoing.
580 If you want to enclose some paragraphs which have already been written
581 into environment, invoke the begin-type completion right after region marking.
582 @cindex enclose region into environment
584 If you set @code{transient-mark-mode} to @code{nil} in your
585 @file{~/.emacs}, typing @kbd{C-space} (@code{set-mark-command}) twice
586 turns @code{transient-mark-mode} on temporarily. Then, type call
587 begin-type completion to enclose text into a environment.
590 @node Section-type completion, , Begin-type completion, Completion
591 @comment node-name, next, previous, up
592 @section Section-type completion
593 @cindex section-type completion
594 @cindex prefix s
596 "Section-type completion" completes section-type commands which take an
597 argument or more such as @code{\section@{foo@}}. To invoke section-type
598 completion, type
600 @table @kbd
601 @item [prefix] s
602 @dots{} section-type completion
603 @end table
605 @noindent
606 then the prompt
608 @example
609 (C-v for view) \???@{@} (default documentclass):
610 @end example
612 @noindent
613 will show up in the minibuffer. Section-type La@TeX{} commands are
614 completed by space key, and the default value is selected when you
615 type nothing in the minibuffer.
617 Next,
619 @example
620 \section@{???@}:
621 @end example
623 @noindent
624 prompts you the argument of section-type La@TeX{} command. For
625 example, the following inputs
627 @example
628 \???@{@} (default documentclass): section
629 \section@{???@}: Hello world.
630 @end example
632 @noindent
633 will insert the string
635 @example
636 \section@{Hello world.@}
637 @end example
639 in your La@TeX{} source. When you neglect argument such as
641 @example
642 (C-v for view) \???@{@} (default section): vspace*
643 \vspace*@{???@}:
644 @end example
646 YaTeX puts
648 @example
649 \vspace*@{@}
650 @end example
652 @noindent
653 and move the cursor in the braces.
655 In La@TeX{} command, there are commands which take more than one
656 arguments such as @code{\addtolength@{\topmargin@}@{8mm@}}. To complete these
657 commands, invoke section-type completion with universal argument as,
658 @cindex number of argument
660 @example
661 C-u 2 [prefix] s (or ESC 2 [prefix] s)
662 @end example
664 @noindent
665 and make answers in minibuffer like this.
667 @example
668 (C-v for view) \???@{@} (default vspace*): addtolength
669 \addtolength@{???@}: \topmargin
670 Argument 2: 8mm
671 @end example
673 @code{\addtolength} and the first argument @code{\topmargin} can be typed
674 easily by completing read. Since YaTeX also learns the number of
675 arguments of section-type command and will ask that many arguments in
676 future completion, you had better tell the number of arguments to YaTeX at
677 the first completion of the new word. But you can change the number of
678 arguments by calling the completion with different universal argument
679 again.
682 Invoking section-type completion with @code{[Prefix] S} (Capital `S')
683 includes the region as the first argument of section-type command.
685 The section/large/maketitle type completion can work at the
686 prompt for the argument of other section-type completion.
687 Nested La@TeX{} commands are efficiently read with the recursive
688 completion by typing YaTeX's completion key sequence in the
689 minibuffer.
691 @menu
692 * view-sectioning::
693 @end menu
695 @node view-sectioning, , Section-type completion, Section-type completion
696 @comment node-name, next, previous, up
697 @subsection view-sectioning
698 @cindex view sectioning
699 @cindex outline
701 In the minibuffer at the prompt of section-type command completion,
702 typing @kbd{C-v} shows a list of sectioning commands in source text(The
703 line with @code{<<--} mark is the nearest sectioning command). Then,
704 default sectioning command appears in the minibuffer. You can go up/down
705 sectioning command by typing @kbd{C-p}/@kbd{C-n}, can scrolls up/down the
706 listing buffer by @kbd{C-v}/@kbd{M-v}, and can hide sectioning commands
707 under certain level by 0 through 6. Type @kbd{?} in the minibuffer of
708 sectioning prompt for more information.
710 You can generate this listing buffer (@code{*Sectioning Lines*} buffer)
711 by typing
712 @table @kbd
713 @item M-x YaTeX-section-overview
714 @dots{} Generate *Sectioning Lines* buffer
715 @end table
716 @cindex{Generate the listing of sectioning units}
717 from the LaTeX source buffer. In this listing buffer, typing @kbd{u} on
718 the sectioning command shifts up the corresponding sectioning command in
719 source text and @kbd{d} shifts down. After marking lines in the listing
720 buffer, typing @kbd{U} shifts up all sectioning commands in the region,
721 and @kbd{U} shifts down. Here are all the key bindings of
722 @code{*Sectioning Lines*} buffer.
724 @table @kbd
725 @item SPC
726 @dots{} Jump to corresponding source line
727 @item .
728 @dots{} Display corresponding source line
729 @item u
730 @dots{} Shift up a sectioning line
731 @item d
732 @dots{} Shift down a sectioning line
733 @item U
734 @dots{} Shift up sectioning lines in region
735 @item D
736 @dots{} Shift down sectioning lines in region
737 @item 0@dots{}6
738 @dots{} Hide sectioning commands whose level is lower than n
739 @end table
741 @node Label Generation, Large-type completion, Section-type completion, Completion
742 @section Label Generation
743 @comment label generation
744 @cindex label generation
745 @cindex ref label cite
747 When you want to type-in references of @code{\ref} or @code{\cite},
748 all you have to do is type @kbd{[prefix] s ref} without adding labels
749 beforehand. You will see possible La@TeX{}-counters in the next window
750 even if some counter does not have @code{\label}. Selecting the counter
751 will automatically set the label to that counter.
753 All possible counter list in the buffer tends to be large.
754 You can reduce the number of list by filtering type of counters by
755 key-commands as follows.
756 @table @kbd
757 @item M-a
758 @dots{} Show all(disable filtering)
759 @item M-c
760 @dots{} Captions only
761 @item M-e
762 @dots{} equations (with counters) only
763 @item M-i
764 @dots{} numbers items only
765 @item M-s
766 @dots{} sections only
767 @item M-m
768 @dots{} other counters only
769 @end table
772 @node Large-type completion, Maketitle-type completion, Label Generation, Completion
773 @comment node-name, next, previous, up
774 @section Large-type completion
776 "Large-type completion" inputs the font or size changing
777 descriptions such as @code{@{\large @}}. When you type
779 @table @kbd
780 @item [prefix] l
781 @dots{} large-type completion
782 @end table
784 @noindent
785 the message in the minibuffer
787 @example
788 @{\??? @} (default large):
789 @end example
791 prompts prompts you large-type command with completing-read. There are
792 TeX commands to change fonts or sizes, @code{it}, @code{huge} and so on,
793 in the completion table.
795 Region-based completion is also invoked by calling completion
796 after region activated.
798 @node Maketitle-type completion, Arbitrary completion, Large-type completion, Completion
799 @comment node-name, next, previous, up
800 @section Maketitle-type completion
801 @cindex maketitle-type completion
803 We call it "maketitle-type completion" which completes commands such as
804 @code{\maketitle}. Take notice that maketitle-type commands take no
805 arguments. Then, typing
807 @table @kbd
808 @item [prefix] m
809 @dots{} maketitle-type completion
810 @end table
812 @noindent
813 begins maketitle-completion. Above mentioned method is true for
814 maketitle-completion, and there are La@TeX{} commands with no
815 arguments in completion table.
817 @node Arbitrary completion, End completion, Maketitle-type completion, Completion
818 @comment node-name, next, previous, up
819 @section Arbitrary completion
820 @cindex arbitrary completion
822 @noindent
823 You can complete certain La@TeX{} command anywhere without typical
824 completing method as described, by typing
826 @table @kbd
827 @item [prefix] SPC
828 @dots{} arbitrary completion
829 @end table
831 @noindent
832 after the initial string of La@TeX{} command that is preceded by @code{\}.
834 @node End completion, Accent completion, Arbitrary completion, Completion
835 @comment node-name, next, previous, up
836 @section End completion
837 @cindex end completion
839 @noindent
840 YaTeX automatically detects the opened environment and close it with
841 \@code{\end@{environment@}}. Though proficient YaTeX users never fail to
842 make environment with begin-type completion, some may begin an environment
843 manually. In that case, type
845 @table @kbd
846 @item [prefix] e
847 @dots{} @code{end} completion
848 @end table
850 @noindent
851 at the end of the opened environment.
853 @node Accent completion, Image completion, End completion, Completion
854 @comment node-name, next, previous, up
855 @section Accent completion
856 @cindex accent completion
858 When you want to write the European accent marks(like @code{\`@{o@}}),
860 @table @kbd
861 @item [prefix] a
862 @dots{} accent completion
863 @end table
865 @noindent
866 shows the menu
868 @example
869 1:` 2:' 3:^ 4:" 5:~ 6:= 7:. u v H t c d b
870 @end example
872 @noindent
873 in the minibuffer. Chose one character or corresponding numeric,
874 and you will see
876 @example
877 \`@{@}
878 @end example
880 @noindent
881 in the editing buffer with the cursor positioned in braces. Type
882 one more character `o' for example, then
884 @example
885 \`@{o@}
886 @end example
888 @noindent
889 will be completed, and the cursor gets out from braces.
891 @node Image completion, Greek letters completion, Accent completion, Completion
892 @comment node-name, next, previous, up
893 @section Image completion of mathematical sign
894 @cindex image completion
895 @cindex math-mode
896 @cindex sigma
897 @cindex leftarrow
898 @cindex ;
900 Arrow marks, sigma mark and those signs mainly used in the
901 TeX's math environment are completed by key sequences which
902 imitate the corresponding symbols graphically. This completion
903 only works in the math environment. YaTeX automatically detects
904 whether the cursor located in math environment or not, and
905 change the behavior of key strokes @kbd{;} and @kbd{:}.
907 By the way, we often express the leftarrow mark by `<-' for example.
908 Considering such image, you can write @code{\leftarrow} by typing @kbd{<-}
909 after @kbd{;} (semicolon) as a prefix. In the same way,
910 @code{\longleftarrow} (@code{<--}) is completed by typing @kbd{;<--},
911 infinity mark which is imitated by @code{oo} is completed by typing
912 @kbd{;oo}.
914 Here are the sample operations in YaTeX math-mode.
916 @example
917 INPUT Completed La@TeX{} commands
918 ; < - @code{\leftarrow}
919 ; < - - @code{\longleftarrow}
920 ; < - - > @code{\longleftrightarrow}
921 ; o @code{\circ}
922 ; o o @code{\infty}
923 @end example
925 In any case, you can quit from image completion and can move
926 to the next editing operation if the La@TeX{} command you want is
927 shown in the buffer.
929 @code{;} itself in math-environment is inserted by @kbd{;;}. Typing
930 @kbd{TAB} in the midst of image completion shows all of the La@TeX{}
931 commands that start with the same name as string you previously typed in.
932 In this menu buffer, press @kbd{RET} after moving the cursor (by @kbd{n},
933 @kbd{p}, @kbd{b}, @kbd{f}) to insert the La@TeX{} command.
935 To know all of the completion table, type @kbd{TAB} just after @kbd{;}.
936 And here is the sample menu by @kbd{TAB} after @kbd{;<}.
938 @example
939 KEY LaTeX sequence sign
940 < \leq <
941 ~
942 << \ll <<
943 <- \leftarrow <-
944 <= \Leftarrow <=
945 @end example
947 You can define your favorite key-vs-sequence completion table in the
948 Emacs-Lisp variable @code{YaTeX-math-sign-alist-private}. See also
949 @file{yatexmth.el} for the information of the structure of this variable.
951 @node Greek letters completion, Inserting parentheses, Image completion, Completion
952 @comment node-name, next, previous, up
953 @section Greek letters completion
954 @cindex Greek letters completion
955 @cindex :
957 Math-mode of YaTeX provides another image completion, Greek letters
958 completion in the same method. After prefix @kbd{:}, typing @kbd{a} makes
959 @code{\alpha}, @kbd{b} makes @code{\beta} and @kbd{g} makes @code{\gamma}
960 and so on. First, type @kbd{:TAB} to know all the correspondence of
961 alphabets vs. Greek letters.
963 If you will find @kbd{;} or @kbd{:} doesn't work in correct position of
964 math environment, it may be a bug of YaTeX. Please send me a bug report
965 with the configuration of your text, and avoid it temporarily by typing
966 @kbd{;} or @kbd{:} after universal-argument(@kbd{C-u}) which forces
967 @kbd{;} and @kbd{:} to work as math-prefix.
969 @node Inserting parentheses, , Greek letters completion, Completion
970 @section Inserting parentheses
972 Typing opening parenthesis, one of @code{(}, @code{@{ and @code{[}},
973 automatically inserts the closing one. If a opening bracket is typed
974 after @code{\}, @code{\]} is automatically inserted with computed
975 indentation. If you stop automatic insertion, type @kbd{C-q} before
976 opening parenthesis.
978 @node Local dictionaries, Commenting out, Completion, Top
979 @comment node-name, next, previous, up
980 @chapter Local dictionaries
981 @cindex local dictionaries
982 @cindex nervous users
984 Tables for completion consist of three dictionaries; `standard
985 dictionary' built in @file{yatex.el}, `user dictionary' for your common
986 private commands, and `local dictionary' that is effective in a certain
987 directory.
989 When you input the command unknown to YaTeX at a completion in the
990 minibuffer, YaTeX asks you with the following prompt;
992 @example
993 `foo' is not in table. Register into: U)serDic L)ocalDic N)one D)iscard
994 @end example
996 @noindent
997 In this menu, typing @kbd{u} updates your `user dictionary', @kbd{l}
998 updates your local dictionary, @kbd{n} updates only on-memory dictionary
999 which go through only current Emacs session, and @kbd{d} updates no
1000 dictionary and throws the new word away.
1002 If you find this switching feature meaningless and bothersome, put the
1003 next expression into your @file{~/.emacs}
1005 @lisp
1006 (setq YaTeX-nervous nil)
1007 @end lisp
1009 @node Commenting out, Cursor jump, Local dictionaries, Top
1010 @comment node-name, next, previous, up
1011 @chapter Commenting out
1012 @cindex commenting out
1013 @cindex prefix >
1014 @cindex prefix <
1015 @cindex prefix ,
1016 @cindex prefix .
1018 You may want to comment out some region.
1020 @table @kbd
1021 @item [prefix] >
1022 @dots{} comment out region by %
1023 @item [prefix] <
1024 @dots{} uncomment region
1025 @end table
1027 @noindent
1028 cause an operation to the region between point and mark.
1030 @table @kbd
1031 @item [prefix] .
1032 @dots{} comment out current paragraph
1033 @item [prefix] ,
1034 @dots{} uncomment current paragraph
1035 @end table
1037 @noindent
1038 comments or uncomments the paragraph where the cursor belongs.
1039 This `paragraph' means the region marked by the function
1040 mark-paragraph, bound to @kbd{ESC h} by default. It is NOT
1041 predictable what will happen when you continuously comment out
1042 some paragraph many times.
1044 You can also comment out an environment between @code{\begin} and
1045 @code{\end}, or a @code{\begin}-\@code{\end} pair themselves, by making the
1046 following key strokes on the line where @code{\begin@{@}} or
1047 @code{\end@{@}} exists.
1049 @table @kbd
1050 @item [prefix] >
1051 @dots{} comment out from \begin to \@code{end}
1052 @item [prefix] <
1053 @dots{} uncomment from \begin to \@code{end}
1054 @end table
1056 @noindent
1057 comment whole the contents of environment. Moreover,
1059 @table @kbd
1060 @item [prefix] .
1061 @dots{} comment out \begin and \@code{end}
1062 @item [prefix] ,
1063 @dots{} uncomment \begin and \@code{end}
1064 @end table
1066 @noindent
1067 (un)comments out only environment declaration: @code{\begin@{@}} and
1068 @code{\end@{@}}. NOTE that even if you intend to comment out some region,
1069 invoking @kbd{[prefix] >} on the @code{\begin},@code{\end} line decides to
1070 work in `commenting out from @code{\begin} to @code{\end}' mode.
1073 @node Cursor jump, Changing and Deleting, Commenting out, Top
1074 @comment node-name, next, previous, up
1075 @chapter Cursor jump
1076 @cindex cursor jump
1077 @cindex prefix g
1080 @menu
1081 * Jump to corresponding object::
1082 * Invoking image processor::
1083 * Jump to main file::
1084 * Jumping around the environment::
1085 * Jumping to last completion position::
1086 @end menu
1088 @node Jump to corresponding object, Invoking image processor, Cursor jump, Cursor jump
1089 @comment node-name, next, previous, up
1090 @section Jump to corresponding object
1092 Typing
1094 @table @kbd
1095 @item [prefix] g
1096 @dots{} go to corresponding object
1097 @end table
1099 @noindent
1100 in a certain place move the cursor to the place corresponding to the
1101 La@TeX{} command of last place. YaTeX recognize the followings as pairs
1102 that have relation each other.
1104 @itemize @bullet
1105 @item @code{\begin@{@}} <-> @code{\end@{@}}
1106 @item @code{%#BEGIN} <-> @code{%#END}
1107 @item On the image-including line -> corresponding viewer or drawing tool
1108 @item @code{\label@{@}} <-> @code{\ref@{@}}
1109 @item @code{\include(\input)} -> included file
1110 @item @code{\bibitem@{@}} <-> @code{\cite@{@}}
1111 @end itemize
1113 On a @code{\begin},@code{\end} line, typing @kbd{[prefix] g} moves the
1114 cursor to the corresponding @code{\end},@code{\begin} line, if its partner
1115 really exists. The behavior on the line @code{%#BEGIN} and @code{%#END}
1116 are the same. Note that if the correspondent of @code{label/ref} or
1117 @code{cite/bibitem} exists in another file, that file have to be opened to
1118 make a round trip between references by @kbd{[prefix] g}.
1120 If you type @code{[prefix] g} on the line of @code{\include@{chap1@}},
1121 typically in the main text, YaTeX switches buffer to @file{chap1.tex}.
1123 @table @kbd
1124 @item [prefix] 4 g
1125 @dots{} go to corresponding object in other window
1126 @end table
1128 @noindent
1129 do the same job as @kbd{[prefix] g} except it's done in other window.
1130 Note that this function doesn't work on @code{begin/end},
1131 @code{%#BEGIN/%#END} pairs because it is meaningless.
1133 @node Invoking image processor, Jump to main file, Jump to corresponding object, Cursor jump
1134 @comment node-name, next, previous, up
1135 @section Invoking image processor
1136 @cindex{Drawing tool invocation}
1138 `image-including line' described above means such lines as
1139 @code{\epsfile@{file=foo.ps@}}. If you type @kbd{[prefix] g} on that
1140 line, YaTeX automatically searches source of `foo.ps' and invokes image
1141 viewer or drawing tool correspoinding to it. For example; if you draw
1142 an image foo.obj with Tgif and enclose its product named foo.eps by
1143 @code{\epsfile} command. Typing @kbd{[prefix] g} on @code{\epsfile} line
1144 make YaTeX invoke @code{tgif foo.obj}. How a processor is choosen is as
1145 follows.
1147 @enumerate
1148 @item
1149 If there is an expression matching with one of the pattern
1150 defined in @code{YaTeX-processed-file-regexp-alist}, extract file name
1151 from regexp group surrounded by \\(\\). (Which group corresponds is
1152 written in the cdr part of each list.) If no matches were found, do
1153 nothing.
1154 @item
1155 If there is a pattern as `%PROCESSOR' which is defined in the variable
1156 @code{YaTeX-file-processor-alist}, call that processor giving the
1157 file name with corresponding extension.
1158 @item
1159 If not, check the existence of each file which is supplied the
1160 extension in the cdr part of each list of
1161 @code{YaTeX-file-processor-alist}. If any, call the corresponding
1162 image viewer or drawing tool.
1163 @end enumerate
1165 @node Jump to main file, Jumping around the environment, Invoking image processor, Cursor jump
1166 @comment node-name, next, previous, up
1167 @section Jump to main file
1169 Typing
1171 @table @kbd
1172 @item [prefix] ^
1173 @dots{} visit main file
1174 @item [prefix] 4^
1175 @dots{} visit main file in other buffer
1176 @end table
1177 @cindex prefix ^
1178 @cindex prefix 4 ^
1180 in a sub text switch the buffer to the main text specified by
1181 @code{%#!} notation.
1183 @node Jumping around the environment, Jumping to last completion position, Jump to main file, Cursor jump
1184 @comment node-name, next, previous, up
1185 @section Jumping around the environment
1187 And these are the functions which work on the current La@TeX{}
1188 environment:
1190 @table @kbd
1191 @item M-C-a
1192 @dots{} beginning of environment
1193 @item M-C-e
1194 @dots{} @code{end} of environment
1195 @item M-C-@@
1196 @dots{} mark environment
1197 @end table
1198 @cindex M-C-a
1199 @cindex M-C-e
1200 @cindex M-C-@@
1202 @node Jumping to last completion position, , Jumping around the environment, Cursor jump
1203 @comment node-name, next, previous, up
1204 @section Jumping to last completion position
1206 YaTeX always memorize the position of completion into register @code{3}.
1207 So every time you make a trip to any other part of text other than you are
1208 writing, you can return to the editing paragraph by calling
1209 register-to-point with argument YaTeX-current-position-register, which is
1210 achieved by typing @kbd{C-x j 3}(by default).
1212 @node Changing and Deleting, Filling, Cursor jump, Top
1213 @comment node-name, next, previous, up
1214 @chapter Changing and Deleting
1216 These functions are for change or deletion of La@TeX{} commands
1217 already entered.
1219 @table @kbd
1220 @item [prefix] c
1221 @dots{} change La@TeX{} command
1222 @item [prefix] k
1223 @dots{} kill La@TeX{} command
1224 @end table
1225 @cindex prefix c
1226 @cindex prefix k
1228 @menu
1229 * Changing LaTeX commands::
1230 * Killing LaTeX commands::
1231 @end menu
1233 @node Changing LaTeX commands, Killing LaTeX commands, Changing and Deleting, Changing and Deleting
1234 @comment node-name, next, previous, up
1235 @section Changing La@TeX{} commands
1237 @kbd{[prefix] c} can change the various (La)@TeX{} commands. This can
1238 change the followings.
1239 @itemize @bullet
1240 @item Environment names
1241 @item Section-type commands
1242 @item Argument of section-type commands
1243 @item Optional parameters (enclosed by []) of section-type commands
1244 @item Font/size designators
1245 @item Math-mode's maketitle-type commands that can be inputted with
1246 image completion
1247 @end itemize
1249 Typing @kbd{[prefix] c} on one of above objects you want to change
1250 brings a suitable reading function sometimes with completion.
1251 Note: If you want to change the argument of section-type command that
1252 contains other La@TeX{} commands, type @kbd{[prefix] c} either of
1253 surrounding braces of the argument in order to make YaTeX ignore the
1254 internal La@TeX{} sequences as an object of changing. Anyway, it is
1255 very difficult to know which argument position the cursor belongs because
1256 the La@TeX{} commands can be nested and braces can freely emerge. So keep
1257 it mind to put the cursor on a brace when you are thinking of changing a
1258 complicated argument.
1260 @node Killing LaTeX commands, , Changing LaTeX commands, Changing and Deleting
1261 @comment node-name, next, previous, up
1262 @section Killing La@TeX{} commands
1263 @cindex Killing La@TeX{} commands
1265 @kbd{[prefix] k} kills the La@TeX{} commands sometimes with their
1266 arguments. Following table illustrates the correspondence of the invoking
1267 position and what is killed.
1269 @example
1270 [Invoking position] [action]
1271 \begin, \end line kill \begin,\end pairs
1272 %#BEGIN, %#END line kill %#BEGIN,%#END pairs
1273 on a Section-type command kill section-type command
1274 on a parenthesis kill parentheses
1275 @end example
1277 Note that when killing @code{\begin, \end} or @code{%#BEGIN, %#END} pair,
1278 the lines @code{\begin, \end} or @code{%#BEGIN, %#END} exist will be
1279 killed entirely. So take care not to create any line that contains more
1280 than one @code{\begin} or so.
1282 While all operations above are to kill `containers' which surround some
1283 text, universal argument (@kbd{C-u}) for these commands kills not only
1284 `containers' but also `contents' of them. See below as a sample.
1286 @example
1287 Original text: [prefix] k C-u [prefix] k
1288 Main \footnote@{note@} here. Main note here. Main here.
1289 ~(cursor)
1290 @end example
1292 @node Filling, Updation of includeonly, Changing and Deleting, Top
1293 @comment node-name, next, previous, up
1294 @chapter Filling
1295 @cindex filling
1297 @section Filling an item
1298 @cindex filling an item
1299 @cindex prefix i
1301 To fill a term (descriptive sentences) of @code{\item}, type
1303 @c @table @kbd
1304 @c @item [prefix] i
1305 @c @dots{} fill item
1306 @c @end table
1307 @table @kbd
1308 @item M-q
1309 @dots{} fill item
1310 @end table
1312 @noindent
1313 on that item.
1315 YaTeX uses the value of the variable @code{YaTeX-item-regexp} as the
1316 regular expression to search item header in itemize environment.
1317 If you make a newcommand to itemize terms(e.g. @code{\underlineitem}), put
1319 @lisp
1320 (setq YaTeX-item-regexp
1321 "\\(\\\\\\(sub\\)*item\\)\\|\\(\\\\underlineitem\\)")
1322 @end lisp
1323 @cindex YaTeX-item-regexp
1325 in your @file{~/.emacs}. If you are not familiar with regular expression
1326 for Emacs-Lisp, name a newcommand for `itemize' beginning with
1327 @code{\item} such as @code{\itembf}, not @code{\bfitem}.
1329 This function reformats the @code{\item} into `hang-indented' style.
1330 For example:
1332 @example
1333 itemize, enumerate environment:
1335 >\item[foo] `foo' is the typical word for describing an
1336 > arbitrarily written....
1337 description environment:
1338 > \item[bar] When the word `for' is used as an arbitrarily
1339 > word, `bar' is bound to follow it.
1340 @end example
1342 Note that the indent depth of an @code{\item} word and its descriptive
1343 paragraph are the same in latter case. If you want to use different
1344 depth, invoke fill-paragraph at the beginning of non-whitespace
1345 character(see below).
1347 @section Filling paragraph
1348 @cindex Filling paragraph
1349 @cindex M-q
1351 Fill-paragraph is little bit adapted for La@TeX{} sources. It retains from
1352 filling in certain environments where formatting leads to a disaster such
1353 as verbatim, tabular, or so. And it protects @code{\verb} expressions
1354 from being folded (The variable @code{YaTeX-verb-regexp} controls this).
1355 Besides, putting cursor on the first occurrence of non-whitespace
1356 character on a line changes the fill-prefix temporarily to the depth of
1357 the line.
1359 @node Updation of includeonly, What column, Filling, Top
1360 @comment node-name, next, previous, up
1361 @chapter Updation of @code{\includeonly}
1362 @cindex includeonly
1364 When you edit splitting source texts, the notation
1366 @example
1367 \includeonly@{CurrentEditingFileName@}
1368 @end example
1370 @noindent
1371 in the main file reduces the time of typesetting. If you want
1372 to hack other file a little however, you have to rewrite it to
1374 @example
1375 \includeonly@{OtherFileNameYouWantToFix@}
1376 @end example
1378 @noindent
1379 in the main file. YaTeX automatically detects that the current
1380 edited text is not in includeonly list and prompts you
1382 @example
1383 A)dd R)eplace %)comment?
1384 @end example
1386 in the minibuffer. Type @kbd{a} if you want to add the current file name
1387 to @code{\includeonly} list, @kbd{r} to replace \@code{includeonly} list
1388 with the current file, and type @kbd{%} to comment out the
1389 @code{\includeonly} line.
1391 @node What column, Intelligent newline, Updation of includeonly, Top
1392 @comment node-name, next, previous, up
1393 @chapter What column?
1394 @cindex what column
1395 @cindex complex tabular
1396 @cindex prefix &
1398 We are often get tired of finding the corresponding column in
1399 large tabulars. For example,
1401 @example
1402 \begin@{tabular@}@{|c|c|c|c|c|c|c|c|@}\hline
1403 Name&Position&Post No.&Addr.&Phone No.&FAX No.&
1404 Home Addr.&Home Phone\\ \hline
1405 Thunder Bird & 6 & 223 & LA & xxx-yyy &
1406 zzz-www & Japan & 9876-54321 \\
1407 & 2 & \multicolumn@{2@}@{c|@}@{Unknown@}
1408 &&&(???)
1409 \\ \hline
1410 \end@{tabular@}
1411 @end example
1413 Suppose you have the cursor located at @code{(???)} mark, can you tell
1414 which column it is belonging at once? Maybe no. In such case,
1415 type
1417 @table @kbd
1418 @item [prefix] &
1419 @dots{} What column
1420 @end table
1422 @noindent
1423 in that position. YaTeX tells you the column header of the
1424 current field. Since YaTeX assumes the first line of tabular
1425 environment as a row of column headers, you can create a row of
1426 virtual column headers by putting them in the first line and
1427 commenting that line with @code{%}.
1429 @node Intelligent newline, Usepackage checker, What column, Top
1430 @comment node-name, next, previous, up
1431 @chapter Intelligent newline
1432 @cindex Intelligent newline
1433 @cindex ESC RET
1434 @cindex M-C-m
1436 At the end of begin-type completion of tabular[*], array, itemize,
1437 enumerate or tabbing environment, or typing
1439 @table @kbd
1440 @item ESC RET
1441 @dots{} Intelligent newline
1442 @end table
1444 @noindent
1445 in these environments inserts the contents corresponding to the current
1446 environment in the next line. (At the begin-type completion, this
1447 contents can be removed by `undo'.) In @code{tabular} environment, for
1448 example, @kbd{ESC RET} inserts the certain number of @code{&} and trailing
1449 @code{\\}, and @code{\hline} if other @code{\hline} is found in backward.
1450 Here are the list of contents vs. environments.
1452 @itemize
1453 @item @code{tabular}, @code{tabular*}, @code{array}
1455 Corresponding number of @code{&} and @code{\\}.
1456 And @code{\hline} if needed.
1458 @item @code{tabbing}
1460 The same number of @code{\>} as @code{\=} in the first line.
1462 @item @code{itemize}, @code{enumerate}, @code{description}, @code{list}
1464 @code{\item} or @code{item[]}.
1465 @end itemize
1467 Note that since this function works seeing the contents of the first
1468 line, please call this after the second line if possible.
1470 If you want to apply these trick to other environments, @code{foo}
1471 environment for example, define the function named
1472 @code{YaTeX-intelligent-newline-foo} to insert corresponding contents.
1473 That function will be called at the beginning of the next line after the
1474 newline is inserted to the current line. Since the function
1475 @code{YaTeX-indent-line} is designed to indent the current line properly,
1476 calling this function before your code to insert certain contents must be
1477 useful. See the definition of the function
1478 @code{YaTeX-intelligent-newline-itemize} as an example.
1480 @node Usepackage checker, Online help, Intelligent newline, Top
1481 @comment node-name, next, previous, up
1482 @chapter Usepackage checker
1483 @cindex usepackage
1485 When you input begint-type, section-type, maketitle-type macros with
1486 completion, and it requires some LaTeX2e package, YaTeX examines
1487 the existence of correct @code{\usepackage}. If not, YaTeX inserts
1488 the @code{\usepackage@{@}} declaration corresponding to input macro.
1490 To activate the package completion for your favarite package,
1491 set the variable @code{YaTeX-package-alist-private} correctly.
1492 Please refere the value of @code{YaTeX-package-alist-default} as an
1493 example.
1495 @node Online help, Browsing file hierarchy, Usepackage checker, Top
1496 @comment node-name, next, previous, up
1497 @chapter Online help
1498 @cindex online help
1499 @cindex prefix ?
1500 @cindex prefix /
1501 @cindex apropos
1502 @cindex keyword search
1504 YaTeX provides you the online help with popular La@TeX{} commands.
1506 Here are the key strokes for the online help.
1508 @table @kbd
1509 @item [prefix] ?
1510 @dots{} Online help
1511 @item [prefix] /
1512 @dots{} Online apropos
1513 @end table
1515 @section Online help
1517 `Online help' shows the documentation for the popular La@TeX{}
1518 commands(defaults to the commands on the cursor) in the next buffer.
1519 There are two help file, `global help' and `private help'. The former
1520 file contains the descriptions on the standard La@TeX{} command and is
1521 specified its name by variable @code{YaTeX-help-file}. Usually, the
1522 global help file should be located in public space (@code{$EMACSEXECPATH}
1523 by default) and should be world writable so that anyone can update it to
1524 enrich its contents. The latter file contains descriptions on
1525 non-standard or personal command definitions and is specified by
1526 @code{YaTeX-help-file-private}. This file should be put into private
1527 directory.
1529 @section Online apropos
1531 `Online apropos' is an equivalent of GNU Emacs's apropos. It
1532 shows all the documentations that contains the keyword entered by
1533 the user.
1535 @section When no descriptions are found...
1537 If there is no description on a command in help files, YaTeX
1538 requires you to write a description on that command. If you are
1539 willing to do, determine which help file to add and write the
1540 description on it referring your manual of (La)TeX. Please send
1541 me your additional descriptions if you describe the help on some
1542 standard commands. I might want to include it in the next
1543 distribution.
1545 @node Browsing file hierarchy, Cooperation with other packages, Online help, Top
1546 @comment node-name, next, previous, up
1547 @chapter Browsing file hierarchy
1548 @cindex hierarchy
1549 @cindex browsing
1551 When you are editing multi-file source, typing
1553 @table @kbd
1554 @item [prefix] d
1555 @dots{} browse file hierarchy
1556 @end table
1558 @noindent
1559 asks you the parent-most file (which may be defaulted) and displays the
1560 documentation hierarchy in the next window. In this buffer, the following
1561 commands are available.
1563 @table @kbd
1564 @item n
1565 @dots{} move to the next line and show its contents
1566 @item p
1567 @dots{} move to the previous line and show its contents
1568 @item N
1569 @dots{} move to the next file in the same inclusion level
1570 @item P
1571 @dots{} move to the previous file in the same inclusion level
1572 @item j
1573 @dots{} move to the next line
1574 @item k
1575 @dots{} move to the previous line
1576 @item u
1577 @dots{} move to the parent file
1578 @item .
1579 @dots{} show the current files contents in the next window
1580 @item SPC
1581 @dots{} scroll up the current file window
1582 @item DEL, b
1583 @dots{} scroll down the current file window
1584 @item <
1585 @dots{} show the beginning of the current file
1586 @item >
1587 @dots{} show the end of the current file
1588 @item >
1589 @dots{} return to the previous postion after @kbd{<} or @kbd{>}
1590 @item RET, g
1591 @dots{} open the current file in the next window
1592 @item mouse-2
1593 @dots{} same as RET(available only with window system)
1594 @item o
1595 @dots{} other window
1596 @item 1
1597 @dots{} delete other windows
1598 @item -
1599 @dots{} shrink hierarchy buffer window
1600 @item +
1601 @dots{} enlarge hierarchy buffer window
1602 @item ?
1603 @dots{} describe mode
1604 @item q
1605 @dots{} quit
1606 @end table
1608 Note that operations on the file contents in the next window do not work
1609 correctly when you close the corresponding file.
1611 @node Cooperation with other packages, Customizations, Browsing file hierarchy, Top
1612 @comment node-name, next, previous, up
1613 @chapter Cooperation with other packages
1615 YaTeX works better with other brilliant packages.
1617 @section gmhist
1618 @cindex gmhist
1619 @cindex command history
1620 @cindex minibuffer history
1622 When you are loading @file{gmhist.el} and @file{gmhist-mh.el}, you can
1623 use independent command history list at the prompt of preview command
1624 (@kbd{[prefix] tp}) and print command (@kbd{[prefix] tl}). On each
1625 prompt, you can enter the previous command line string repeatedly by
1626 typing @kbd{M-p}.
1628 @section min-out
1629 @cindex min-out
1631 @file{min-out}, the outline minor mode, can be used in yatex-mode
1632 buffers. If you want to use it with YaTeX, please refer the
1633 file @file{yatexm-o.el} as an example.
1635 @node Customizations, Etcetera, Cooperation with other packages, Top
1636 @comment node-name, next, previous, up
1637 @chapter Customizations
1638 @cindex customizations
1640 You can customize YaTeX by setting Emacs-Lisp variables and by making
1641 add-in functions.
1643 @menu
1644 * Lisp variables::
1645 * Add-in functions::
1646 * Add-in generator::
1647 @end menu
1649 @node Lisp variables, Add-in functions, Customizations, Customizations
1650 @comment node-name, next, previous, up
1651 @section Lisp variables
1652 @cindex customizable variables
1654 You can change the key assignments or make completion more comfortable
1655 by setting the values of various variables which control the movement of
1656 yatex-mode.
1658 For example, if you want to change the prefix key stroke from @kbd{C-c}
1659 to any other sequence, set YaTeX-prefix to whatever you want to use. If
1660 you don't want to use the key sequence @kbd{C-c letter} which is assumed
1661 to be the user reserved sequence in Emacs world, set
1662 @code{YaTeX-inhibit-prefix-letter} to @code{t}, and all of the default key
1663 bind of @kbd{C-c letter} will turn to the corresponding @kbd{C-c C-letter}
1664 (but the region based completions that is invoked with @kbd{C-c
1665 Capital-letter} remain valid, if you want to disable those bindings, set
1666 that variable to 1 instead of @code{t}).
1668 @menu
1669 * All customizable variables::
1670 * Sample definitions::
1671 * Hook variables::
1672 * Hook file::
1673 @end menu
1675 @node All customizable variables, Sample definitions, Lisp variables, Lisp variables
1676 @comment node-name, next, previous, up
1677 @subsection All customizable variables
1678 @cindex all customizable variables
1680 Here are the customizable variables of yatex-mode. Each value setq-ed
1681 in @file{~/.emacs} is preferred and that of defined in @file{yatex.el} is
1682 neglected. Parenthesized contents stands for the default value. When you
1683 are to change some of these variables, see more detailed documentation of
1684 the variable by @kbd{M-x describe-variable}.
1686 @defvar YaTeX-japan
1687 Set this nil to produce all messages in English
1688 (@code{Depends on Japanese feature of Emacs})
1689 @end defvar
1691 @defvar YaTeX-kanji-code
1692 Default buffer-file-coding-system for YaTeX modes' buffer.
1693 Set this 0 to no language conversion. Nil to preserve original
1694 coding-system. 1=Shift JIS, 2=JIS, 3=EUC, 4=UTF-8 (@code{1 or 2})
1695 @end defvar
1697 @defvar YaTeX-prefix
1698 Prefix key stroke (@kbd{C-c})
1699 @end defvar
1701 @defvar YaTeX-inhibit-prefix-letter
1702 Change key stroke from @kbd{C-c letter} to @kbd{C-c C-letter} (@code{nil})
1703 @end defvar
1705 @defvar YaTeX-fill-prefix
1706 Fill-prefix used in yatex-mode (@code{nil})
1707 @end defvar
1709 @defvar YaTeX-user-completion-table
1710 Name of user dictionary where learned completion table will be stored.
1711 (@code{"~/.yatexrc"})
1712 @end defvar
1714 @defvar tex-command
1715 La@TeX{} typesetter command (@code{"latex"})
1716 @end defvar
1718 @defvar dvi2-command
1719 Preview command (@code{"xdvi -geo +0+0 -s 4"})
1720 @end defvar
1722 @defvar dviprint-command-format
1723 Command format to print dvi file (@code{"dvi2ps %f %t %s | lpr"})
1724 @end defvar
1726 @defvar dviprint-from-format
1727 Start page format of above %f. %b will turn to start page (@code{"-f %b"})
1728 @end defvar
1730 @defvar dviprint-to-format
1731 End page format of above %t. %e will turn to @code{end} page (@code{"-t %e"})
1732 @end defvar
1734 @defvar makeindex-command
1735 Default makeindex command (@code{"makeindex"} (@code{"makeind"} on MS-DOS))
1736 @end defvar
1738 @defvar YaTeX-dvipdf-command
1739 Default command name to convert .dvi to PDF (@code{"dvipdfmx"})
1740 @end defvar
1742 @defvar YaTeX-on-the-fly-preview-interval
1743 Interval time in seconds of idle to trigger on-the-fly preview of
1744 environment by @kbd{[prefix] t e}(0.9).
1745 @code{Nil} disables on-the-fly preview.
1746 @end defvar
1748 @defvar YaTeX-on-the-fly-math-preview-engine
1749 Function symbol to use on-the-fly preview of MATH environment
1750 started by @kbd{[prefix] t e} (@code{'YaTeX-typeset-environment-by-lmp}
1751 which calls latex-math-preview-expression function if latex-math-preview
1752 is available, otherwise @code{'YaTeX-typeset-environment-by-builtin} which
1753 alls built-in function).
1755 @code{Nil} disables on-the-fly preview.
1756 @end defvar
1758 @defvar YaTeX-cmd-gimp
1759 Command name of GIMP (code{"gimp"})
1760 @end defvar
1761 @defvar YaTeX-cmd-tgif
1762 Command name of tgif (code{"tgif"})
1763 @end defvar
1764 @defvar YaTeX-cmd-inkscape
1765 Command name of Inkscape (code{"inkscape"})
1766 @end defvar
1767 @defvar YaTeX-cmd-dia
1768 Command name of Dia (code{"dia"})
1769 @end defvar
1770 @defvar YaTeX-cmd-ooo
1771 Command name of OpenOffice.org/LibreOffice (code{"soffice"})
1772 @end defvar
1773 @defvar YaTeX-cmd-gs
1774 Command name of Ghostscript (code{"gs"})
1775 @end defvar
1776 @defvar YaTeX-cmd-dvips
1777 Command name of dvips (code{"dvips"})
1778 @end defvar
1779 @defvar YaTeX-cmd-displayline
1780 Command name of displayline
1781 (code{"/Applications/Skim.app/Contents/SharedSupport/displayline"})
1782 @end defvar
1783 @defvar YaTeX-cmd-edit-ps
1784 Command name for editing PostScript files(Value of code{"YaTeX-cmd-gimp"})
1785 @end defvar
1786 @defvar YaTeX-cmd-edit-pdf
1787 Command name for editing PDF files(Value of code{"YaTeX-cmd-ooo"})
1788 @end defvar
1789 @defvar YaTeX-cmd-edit-ai
1790 Command name for editing `.ai' files(Value of code{"YaTeX-cmd-inkscape"})
1791 @end defvar
1792 @defvar YaTeX-cmd-edit-svg
1793 Command name for editing SVG files(Value of code{"YaTeX-cmd-inkscape"})
1794 @end defvar
1795 @defvar YaTeX-cmd-edit-images
1796 Command name for editing image files(Value of code{"YaTeX-cmd-gimp"})
1797 @end defvar
1799 @defvar YaTeX-need-nonstop
1800 Put @code{\nonstopmode@{@}} or not (@code{nil})
1801 @end defvar
1803 @defvar latex-warning-regexp
1804 Regular expression of warning message latex command puts out
1805 (@code{"line.* [0-9]*"})
1806 @end defvar
1808 @defvar latex-error-regexp
1809 Regular expression of error message (@code{"l\\.[1-9][0-9]*"})
1810 @end defvar
1812 @defvar latex-dos-emergency-message
1813 Message latex command running on DOS puts at abort (@code{"Emergency stop"})
1814 @end defvar
1816 @defvar YaTeX-item-regexp
1817 Regular expression of item command (@code{"\\\\item"})
1818 @end defvar
1820 @defvar YaTeX-verb-regexp
1821 Regexp of verb family. Omit \\\\. (@code{"verb\\*?\\|path"})
1822 @end defvar
1824 @defvar YaTeX-nervous
1825 T for using local dictionary (@code{t})
1826 @end defvar
1828 @defvar YaTeX-sectioning-regexp
1829 Regexp of La@TeX{} sectioning command
1830 (@code{"\\(part\\|chapter\\*?\\|\\(sub\\)*\\(section\\|paragraph\\)\\*?\\)\\b"})
1831 @end defvar
1833 @defvar YaTeX-fill-inhibit-environments
1834 Inhibit fill in these environments
1835 (@code{'("tabular" "tabular*" "array" "picture" "eqnarray" "eqnarray*" "equation" "math" "displaymath" "verbatim" "verbatim*")})
1836 @end defvar
1838 @defvar YaTeX-uncomment-once
1839 T for deleting all preceding @code{%} (@code{nil})
1840 @end defvar
1842 @defvar YaTeX-close-paren-always
1843 T for always close all parenthesis automatically, @code{nil} for only eol
1844 (@code{t})
1845 @end defvar
1847 @defvar YaTeX-auto-math-mode
1848 Switch math-mode automatically (@code{t})
1849 @end defvar
1851 @defvar YaTeX-math-key-list-private
1852 User defined alist, math-mode-prefix vs completion alist
1853 used in image completion (@code{nil}). See @file{yatexmth.el}
1854 for the information about how to define a completion alist.
1855 @end defvar
1857 @defvar YaTeX-default-pop-window-height
1858 Initial height of typesetting buffer when one-window.
1859 Number for the lines of the buffer, numerical string for
1860 the percentage of the screen-height. @code{nil} for half height (10)
1861 @end defvar
1863 @defvar YaTeX-help-file
1864 Global online help file name (@file{$doc-directory/../../site-lisp/YATEXHLP.eng})
1865 @end defvar
1867 @defvar YaTeX-help-file-private
1868 Private online help file name (@file{"~/YATEXHLP.eng"})
1869 @end defvar
1871 @defvar YaTeX-no-begend-shortcut
1872 Disable [prefix] b ?? shortcut (@code{nil)}
1873 @end defvar
1875 @defvar YaTeX-hilit-pattern-adjustment-private
1876 List of the list that contain the regular expression and the symbol of
1877 logical meaning of the string that matches the pattern. See also the
1878 value from @code{(assq 'yatex-mode hilit-patterns-alist)} and the value of
1879 @code{YaTeX-hilit-pattern-adjustment-default} (and even the document of
1880 hilit19.el).
1881 @end defvar
1883 @defvar YaTeX-sectioning-level
1884 Alist of LaTeX's sectioning command vs its height.
1885 @end defvar
1887 @defvar YaTeX-hierarchy-ignore-heading-regexp
1888 @code{YaTeX-display-hierarchy} searches for sectioning command first, and
1889 comment line secondary as a file headings. In latter case, ignore lines
1890 that match with regular expression of this variable. Default value of
1891 this variable is RCS header expressions and mode specifying line `-*- xxxx
1892 -*'.
1893 @end defvar
1895 @defvar YaTeX-skip-default-reader
1896 Non-nil for this variable skips the default argument reader of
1897 section-type command when add-in function for it is not defined
1898 (@code{nil})
1899 @end defvar
1901 @defvar YaTeX-create-file-prefix-g
1902 When typing @kbd{prefix g} on the @code{\include} line,
1903 open the target file even if the file doesn't exist (@code{nil})
1904 @end defvar
1906 @defvar YaTeX-simple-messages
1907 Simplyfy messages of various completions (@code{nil})
1908 @end defvar
1910 @defvar YaTeX-hilit-sectioning-face
1911 When hilit19 and yatex19 is active, YaTeX colors the sectioning commands.
1912 This variable specifies the foreground and background color of
1913 @code{\part} macro. The default value is @code{'(yellow/dodgerblue
1914 yellow/slateblue)}. The first element of this list is for the screen when
1915 @code{hilit-background-mode} is @code{'light}, and the second element is
1916 for @code{'dark}. You should specify both color as `forecolor/backcolor'.
1917 @end defvar
1919 @defvar YaTeX-hilit-sectioning-attenuation-rate
1920 When color mode, this variable specifies how much attenuate the color
1921 density of @code{\subparagraph} compared with that of @code{\chapter}
1922 (@code{'(15 40)}) See also @code{YaTeX-hilit-sectioning-face}.
1923 @end defvar
1925 @defvar YaTeX-use-AMS-LaTeX
1926 If you use AMS-LaTeX, set to @code{t} (@code{nil})
1927 @end defvar
1929 @defvar YaTeX-use-LaTeX2e
1930 If you use LaTeX2e, set to @code{t} (@code{t})
1931 @end defvar
1933 @defvar YaTeX-template-file
1934 File name which is automatically inserted at creation
1935 (@code{~/work/template.tex})
1936 @end defvar
1938 @defvar YaTeX-search-file-from-top-directory
1939 Non-nil means to search input-files from the directory where main file exists
1940 (@code{t})
1941 @end defvar
1943 @defvar YaTeX-use-font-lock
1944 Use font-lock to fontify buffer or not (@code{(featurep 'font-lock)}
1945 @end defvar
1947 @defvar YaTeX-use-hilit19
1948 Use hilit19 to highlight buffer or not (@code{(featurep 'hilit19)}
1949 @end defvar
1951 @defvar YaTeX-use-italic-bold
1952 YaTeX tries to search italic, bold fontsets or not
1953 (@code{t} if Emacs-20 or later). This variable is effective only when
1954 font-lock is used.
1955 (@code{(featurep 'hilit19)}
1956 @end defvar
1958 @defvar YaTeX-singlecmd-suffix
1959 Suffix which is always inserted after maketitle-type macros.
1960 @code{"@{@}"} is recommended.
1961 @end defvar
1963 @defvar YaTeX-package-alist-private
1964 Alist of LaTeX2e-package name vs. lists of macros in it.
1965 Set this alist properly and YaTeX automatically check the declaratiion of
1966 `usepackage' for corresponding macro, when you input that macro with
1967 completion. If required `usepackage' is not found, YaTeX also
1968 automatically inserts `\usepackage'. Alist is as follows;
1969 @lisp
1970 '((PackageName1
1971 (completionType ListOfMacro)
1972 (completionType ListOfMacro))
1973 (PackageName2
1974 (completionType ListOfMacro)
1975 (completionType ListOfMacro...))....)
1976 @end lisp
1977 completionType is one of @code{env, section, maketitle}.
1978 Consult the value of @code{YaTeX-package-alist-default} as an example.
1979 @end defvar
1981 @defvar YaTeX-tabular-indentation
1982 At indentation by @kbd{C-i} in tabular or array environment,
1983 YaTeX put the additional spaces to the normail indentation depth.
1984 The number of additional spaces is the product of YaTeX-tabular-indentation
1985 and the number of column position in tabular.
1986 @end defvar
1988 @defvar YaTeX-noindent-env-regexp
1989 Regexp of environment names that should begin with no indentation.
1990 All verbatime-like environment name should match with.
1991 @end defvar
1993 @defvar YaTeX-electric-indent-mode
1994 Emacs 24.4 introduces automatic indentation of current and new lines.
1995 This might be annoying for some people. Pass this value to the function
1996 'electric-indent-local-mode. If you prefer to stop electric-indent-mode
1997 in yatex-mode, set `-1' to this variable.
1998 @end defvar
2000 @defvar YaTeX-ref-default-label-string
2001 Default \\ref time string format.
2002 This format is like strftime(3) but allowed conversion char are as follows;
2003 %y -> Last 2 digit of year, %b -> Month name, %m -> Monthe number(1-12),
2004 %d -> Day, %H -> Hour, %M -> Minute, %S -> Second,
2005 %qx -> alphabetical-decimal conversion of yymmdd.
2006 %qX -> alphabetical-decimal conversion of HHMMSS.
2007 Beware defualt label-string should be always unique. So this format string
2008 should have both time part (%H+%M+%S or %qX) and date
2009 part (%y+(%b|%m)+%d or %qx).
2010 @end defvar
2012 @defvar YaTeX-ref-generate-label-function
2013 Function to generate default label string for unnamed \\label@{@}s.
2014 The function pointed to this value should take two arguments.
2015 First argument is LaTeX macro's name, second is macro's argument.
2016 Here is an example for using this value.
2017 @lisp
2018 (setq YaTeX-ref-generate-label-function 'my-yatex-generate-label)
2019 (defun my-yatex-generate-label (command value)
2020 (and (string= command "caption")
2021 (re-search-backward "\\\\begin@{\\(figure\\|table\\)@}" nil t)
2022 (setq command (match-string 1)))
2023 (let ((alist '(("chapter" . "chap")
2024 ("section" . "sec")
2025 ("subsection" . "subsec")
2026 ("figure" . "fig")
2027 ("table" . "tbl"))))
2028 (if (setq command (cdr (assoc command alist)))
2029 (concat command ":" value)
2030 (YaTeX::ref-generate-label nil nil))))
2031 @end lisp
2032 @end defvar
2035 @node Sample definitions, Hook variables, All customizable variables, Lisp variables
2036 @comment node-name, next, previous, up
2037 @subsection Sample definitions
2038 @cindex prefix key stroke
2039 @cindex fill-prefix
2041 For instance, to change the prefix key stroke to @kbd{ESC}, and name of
2042 the user dictionary @file{~/src/emacs/yatexrc}, and set @code{fill-prefix}
2043 to single TAB character, add the following @code{setq} to @file{~/.emacs}.
2045 @lisp
2046 (setq YaTeX-prefix "\e"
2047 YaTeX-user-completion-table "~/src/emacs/yatexrc"
2048 YaTeX-fill-prefix " ")
2049 @end lisp
2051 @node Hook variables, Hook file, Sample definitions, Lisp variables
2052 @comment node-name, next, previous, up
2053 @subsection Hook variables
2054 @cindex hook variables
2056 More customizations will be done by the hook-function defined in
2057 hook-variable @code{yatex-mode-hook}. This is useful to define a shortcut
2058 key sequence to enter some environments other than @code{document} and
2059 @code{enumerate} etc. The following statement defines @code{[prefix] ba}
2060 to enter @code{\begin@{abstract@}} ... @code{=end@{abstract@}}
2061 immediately.
2063 @lisp
2064 (setq yatex-mode-hook
2065 '(lambda() (YaTeX-define-begend-key "ba" "abstract")))
2066 @end lisp
2068 You should use functions @code{YaTeX-define-key}, or
2069 @code{YaTeX-define-begend-key} to define all the key sequences of
2070 yatex-mode.
2072 @node Hook file, , Hook variables, Lisp variables
2073 @comment node-name, next, previous, up
2074 @subsection Hook file
2075 @cindex hook file
2077 You can stuff all of YaTeX related expressions into a file named
2078 @file{yatexhks.el} if you have a lot of codes. YaTeX automatically load
2079 this file at the initialization of itself. Using @file{yatexhks.el}
2080 makes @code{yatex-mode-load-hook} unnecessary.
2082 @node Add-in functions, Add-in generator, Lisp variables, Customizations
2083 @comment node-name, next, previous, up
2084 @section Add-in functions
2085 @cindex add-in functions
2086 @cindex yatexadd.el
2088 You can easily define a function to input detailed arguments
2089 with completion according to La@TeX{} environments or commands.
2091 @c @node What is add-in functions?, , Add-in functions, Add-in functions
2092 @comment node-name, next, previous, up
2093 @subsection What is add-in functions?
2094 @cindex tabular
2096 When you input @code{tabular} environment, don't you think ``I want
2097 YaTeX to complete its argument toward my favorite one such as
2098 @code{@{|c|c|c|@}}...''? Yes, you can define the function to complete
2099 arguments for any environment and any La@TeX{} commands.
2101 @subsection Procedure
2103 Here is the procedure to define add-in functions.
2104 @enumerate
2105 @item
2106 Define the function
2107 @item
2108 Put the function into @file{yatexhks.el}
2109 @end enumerate
2111 @menu
2112 * How the add-in function works::
2113 * How the function is called::
2114 * Useful functions for creating add-in::
2115 * Contribution::
2116 @end menu
2118 @node How the add-in function works, How the function is called, Add-in functions, Add-in functions
2119 @comment node-name, next, previous, up
2120 @subsection How the add-in function works
2122 There are three types of add-in.
2124 @enumerate
2125 @item
2126 Option add-in
2127 @item
2128 argument add-in
2129 @item
2130 enclosing add-in
2131 @end enumerate
2133 @dfn{Option add-in} returns the
2134 La@TeX{}'s optional parameters such as optional strings after
2135 @code{\begin@{ENV@}}, optional strings between a section-type command
2136 and its first argument, and optional strings just after type
2137 maketitle-type command. The following illustrates the name of add-in
2138 functions, where underlined strings are generated by add-in functions.
2140 @display
2141 \begin@{table@}[ht] (Function name: YaTeX:table)
2142 ~~~~
2143 \put(100,200)@{@} (Function name: YaTeX:put)
2144 ~~~~~~~~~
2145 \sum_@{i=0@}^@{n@} (Function name: YaTeX:sum)
2146 ~~~~~~~~~~
2147 @end display
2149 Obviously, the function name is decided by concatenating the prefix
2150 `YaTeX:' and La@TeX{} command's name.
2152 Another add-in type is @dfn{argument add-in}, which completes arguments
2153 for section-type commands.
2155 @display
2156 \newcommand@{\foo@}@{bar@} (Function name: YaTeX::newcommand)
2157 ~~~~ ~~~
2158 @end display
2160 When the section-type command is inputted, the function named by
2161 concatenating `YaTeX::' and section-type command, is called automatically
2162 with an integer argument which indicates which argument of section-type
2163 command is being read. Thus the add-in should determine the
2164 job referring the value of its argument.
2166 @dfn{enclosing add-in} is for modifying and/or checking the region that
2167 will be enclosed by section-type commands via @kbd{[prefix] S}. An
2168 enclosing add-in function will be called with two arguments, beginning of
2169 the enclosed region and end of the region. Suppose you want to enclose
2170 the existing text @code{(a+b)/c} by @code{\frac@{@}}.
2172 @display
2173 a/c
2174 | |
2175 A B
2176 @end display
2178 You do set-mark-command at point A and then move to point B. Typing
2179 @kbd{[prefix] S} and input @code{frac} enclose the region like this;
2181 @display
2182 \frac@{a/c@}
2183 @end display
2185 Normally, the expression @code{a/c} is translated to
2186 @code{\frac@{a@}@{c@}}. An enclosing add-in is useful for modifying
2187 @code{/} to @code{@}@{}.
2189 @menu
2190 * Defining option-add-in::
2191 * Defining argument-add-in::
2192 * Defining enclosing-add-in::
2193 @end menu
2195 @node Defining option-add-in, Defining argument-add-in, How the add-in function works, How the add-in function works
2196 @comment node-name, next, previous, up
2197 @subsubsection Defining `option add-in'
2199 If you want @code{@{|c|c|c|@}} for all @code{tabular} environment,
2201 @lisp
2202 (defun YaTeX:tabular ()
2203 "@{|c|c|c|@}")
2204 @end lisp
2206 @noindent
2207 is enough. If you want more complicated format, define as below.
2209 @lisp
2210 (defun YaTeX:tabular ()
2211 "@{@@@{\\vrule width 1pt\\ @}|||@@@{\\ \\vrule width 1pt@}@}")
2212 @end lisp
2214 @noindent
2215 Note that the character @code{\} must be described as @code{\\} in
2216 Emacs-Lisp. The next example reads the tabular format from keyboard.
2217 @lisp
2218 (defun YaTeX:tabular ()
2219 (concat "@{" (read-string "Rule: ") "@}"))
2220 @end lisp
2222 @node Defining argument-add-in, Defining enclosing-add-in, Defining option-add-in, How the add-in function works
2223 @comment node-name, next, previous, up
2224 @subsubsection Defining `argument add-in'
2226 This section describes how to define the add-in function for
2227 @code{\newcommand}.
2229 The first argument of @code{\newcommand} begins always with @code{\}.
2230 The second argument is usually so complex that we can not edit them in the
2231 minibuffer. Here is the created function considering this.
2233 @lisp
2234 (defun YaTeX::newcommand (n) ;n is argument position
2235 (cond
2236 ((= n 1) ;1st argument is macro name
2237 (read-string "Command: " "\\")) ;initial input `\'
2238 ((= n 2) "") ;do nothing when reading arg#2
2239 (t nil)))
2240 @end lisp
2242 Note that when the `argument add-in' function return `nil', normal
2243 argument reader will be called.
2245 @node Defining enclosing-add-in, , Defining argument-add-in, How the add-in function works
2246 @comment node-name, next, previous, up
2247 @subsubsection Defining `enclosing add-in'
2249 This section describes how to define the add-in function for
2250 text enclosed by @code{\frac@{@}}.
2252 When enclosing the text @code{5/3} by @code{\frac@{@}}, you might want to
2253 replace @code{/} with @code{@}@{}. Enclosing function
2254 @code{YaTeX::frac-region} is called with two arguments, beginning of
2255 enclosed text and end of enclosed text. The function is expected to
2256 replace @code{/} with @code{@}@{}. Here is an example expression.
2258 @lisp
2259 (defun YaTeX::frac-region (beg end)
2260 (catch 'done
2261 (while (search-forward "/" end t)
2262 (goto-char (match-beginning 0))
2263 (if (y-or-n-p "Replace this slash(/) with `@}@{'")
2264 (throw 'done (replace-match "@}@{")))
2265 (goto-char (match-end 0)))))
2266 @end lisp
2268 @node How the function is called, Useful functions for creating add-in, How the add-in function works, Add-in functions
2269 @comment node-name, next, previous, up
2270 @subsection How the function is called
2272 YaTeX calls the add-in functions for specified begin-type, section-type,
2273 and maketitle-type command, if any. `Option add-in' functions for
2274 begin-type are called when @code{\begin@{ENV@}} has been inserted,
2275 functions for section-type are called just before input of the first
2276 argument, and functions for maketitle-type is called after maketitle-type
2277 command has been inserted. `Argument add-in' functions are called at each
2278 entry of arguments for section-type commands.
2280 @node Useful functions for creating add-in, Contribution, How the function is called, Add-in functions
2281 @comment node-name, next, previous, up
2282 @subsection Useful functions for creating add-in
2284 Many add-in functions for typical La@TeX{} commands are defined in
2285 @file{yatexadd.el}. Those are also useful as references. Here are the
2286 short descriptions on useful functions, where [F] means function, [A]
2287 means arguments, [D] means description.
2289 @table @kbd
2290 @item [F]
2291 YaTeX:read-position
2292 @itemx [A]
2293 Character list which can show up in the brackets
2294 @itemx [D]
2295 Return the location specifier such as `[htb]'. When
2296 nothing is entered, omit [] itself. If the possible characters
2297 are "htbp", call this function as
2298 @code{(YaTeX:read-position "htbp")}
2300 @item [F]
2301 YaTeX:read-coordinates
2302 @itemx [A]
2303 Base prompt, X-axis prompt, Y-axis prompt (each optional)
2304 @itemx [D]
2305 Read the coordinates with the prompt ``BasePrompt X-axisPrompt:'' for
2306 X-axis, ``BasePrompt Y-axisPrompt:'' for Y-axis, and return it in the form
2307 of ``(X,Y)''. The default prompts are @code{Dimension}, @code{X},
2308 @code{Y} respectively.
2310 @item [F]
2311 YaTeX:check-completion-type
2312 @itemx [A]
2313 One of the symbols: 'begin, 'section, or 'maketitle
2314 @itemx [D]
2315 Check the current completion type is specified one and cause error if
2316 not. The variable @code{YaTeX-current-completion-type} holds the symbol
2317 according to the current completion type.
2318 @end table
2320 @node Contribution, , Useful functions for creating add-in, Add-in functions
2321 @comment node-name, next, previous, up
2322 @subsection Contribution
2324 If you make your own pretty function and you let it be in public, please
2325 send me the function. I'm going to include it in the next release.
2327 @node Add-in generator, , Add-in functions, Customizations
2328 @comment node-name, next, previous, up
2329 @section Add-in generator
2331 First, don't forget to read the section of add-in functions @ref{Add-in
2332 functions}. If you easily understand how to define them, there's no need
2333 to read this section. But being not familiar with Emacs-Lisp, when you
2334 don't have clear idea what to do, this section describes how to get YaTeX
2335 make add-in function.
2337 There are two methods of generation. One is for fully interactive
2338 generator for beginners and another requires little knowledge of
2339 Emacs-Lisp.
2341 @subsection Generator for beginners
2342 The former generator is called by
2343 @center @kbd{M-x YaTeX-generate}
2345 @noindent
2346 strokes. All you have to do is follow the guidances. Defying them may cases
2347 the disaster (I wonder what is it???). So when you make some mistake, it
2348 is recommendable to type @kbd{C-g} and start afresh.
2350 @subsection Simple generator
2352 The latter generator is invoked by the next sequence.
2353 @center @kbd{M-x YaTeX-generate-simple}
2354 This generator can make both ``option add-in'' and ``argument add-in''
2355 (@emph{refer the section add-in functions}
2356 @ref{How the add-in function works}), whereas @code{YaTeX-generate}
2357 cannot make ``argument addin''.
2359 For example, assume you have the LaTeX command as follows.
2361 @example
2362 \epsinput[t](250,50)@{hoge.eps@}@{plain@}@{Picture of foo@}
2363 (A) (B) (1) (2) (3)
2364 (A)Optional parameter to specify the position
2365 One of t(top), b(bottom), l(left), r(right)
2366 (B)Maximum size of frame
2367 (1)1st argument is filename of EPS file
2368 (2)2nd argument indicates
2369 plain do nothing
2370 frame make frame around image
2371 dframe make double-frame around image
2372 for included EPS file.
2373 (3)Caption for the picture
2374 @end example
2376 Now get start with generation. Typing @kbd{M-x YaTeX-generate-simple}
2377 brings the prompt:
2378 @display
2379 (O)ption? (A)rgument?
2380 @end display
2382 @subsubsection Generating ``option add-in''
2383 @cindex option add-in
2385 Since (A), (B) above are optional argument, all we have to do to
2386 complete them is define the option add-in for them. Let's generate the
2387 function to complete (A).
2389 @display
2390 M-x YaTeX-generate-simple RET
2391 epsinput RET
2393 @end display
2395 @noindent
2396 Typing as above leads the next prompt.
2398 @display
2399 Read type(1): (S)tring (C)omplete (F)ile ([)option (P)osition co(O)rd. (q)uit
2400 @end display
2402 @noindent
2403 This asks that ``Which type is the completion style of 1st argument?''.
2404 Here are the possible completion style.
2406 @table @code
2407 @item String
2408 read plain string
2409 @item Complete
2410 read with completion
2411 @item File
2412 read file name
2413 @item Option
2414 read optional string (if string omitted, omit [] too)
2415 @item Position
2416 read positional option (like [htbp])
2417 @item Coord.
2418 read coordinates
2419 @item Quit
2420 quit from generating
2421 @end table
2423 Since (A) is the optional argument to specify the location of included
2424 EPS file, the completion style is @code{Position}, and the possible
2425 characters are t, b, l, and r. To tell these information to generator,
2426 operate as follows.
2428 @display
2429 Read type(1).... p
2430 Acceptable characters: tblr RET
2431 @end display
2433 (B) is coordinate. So its completion style is coOrd. We want a prompt
2434 meaning ``Maximum size'' when completion.
2436 @display
2437 Read type(2).... o
2438 Prompt for coordinates: Max size RET
2439 @end display
2441 That's all for optional argument. Select quit.
2443 @display
2444 Read type(3).... q
2445 @end display
2447 Then the generated option add-in function for \epsinput will be shown in
2448 the next window.
2450 @subsubsection Generating ``argument add-in''
2451 @cindex argument add-in
2453 Next, create the argument add-in. The arguments for \epsinput are EPS
2454 file name, framing style, and caption string in sequence.
2456 @display
2457 M-x YaTeX-generate-simple RET
2458 epsinput RET
2460 @end display
2462 Above key strokes bring the prompt that asks the number of argument.
2463 Answer it with 3.
2465 @display
2466 How many arguments?: 3 RET
2467 @end display
2469 Then the generator asks the completion style and prompt for completion.
2470 Answer them. @kbd{f} for FileName and prompt string.
2472 @display
2473 Read type(1).... f
2474 Prompt for argument#1 EPS file name RET
2475 @end display
2477 The second argument is one of selected symbol. So the completion type
2478 is @code{Completion}.
2480 @display
2481 Read type(2).... c
2482 Prompt for argument#2 Include style RET
2483 @end display
2485 Then all the candidates ready to be read. Type single RET after
2486 entering all.
2488 @display
2489 Item[1](RET to exit): plain RET
2490 Item[2](RET to exit): frame RET
2491 Item[3](RET to exit): dframe RET
2492 Item[4](RET to exit): RET
2493 @end display
2495 The following prompt asks whether the entered string must belong to
2496 candidates or not. In this case, since the argument must be one of
2497 @code{plain}, @code{frame}, and @code{dframe}, type @code{y}.
2499 @display
2500 Require match? (y or n) y
2501 @end display
2503 The last argument is the caption string for which any completion is
2504 needed.
2506 @display
2507 Read type(3).... s
2508 Prompt for argument#3 Caption RET
2509 default: Figure of RET
2510 @end display
2512 Finally we'll get the argument add-in in the next window.
2514 @subsection Contribution
2516 If you get your own pretty function and you let it be in public, please
2517 steel yourself in the happy atmosphere and do not send me the function.
2518 I do know it is not fine because it is generated by yatexgen:-p.
2520 @node Etcetera, Copying, Customizations, Top
2521 @comment node-name, next, previous, up
2522 @chapter Etcetera
2524 The standard completion tables provided in @file{yatex.el} contain a
2525 few La@TeX{} commands I frequently use. This is to lessen the key
2526 strokes to complete entire word, because too many candidates
2527 rarely used often cause too many hits. Therefore always try to
2528 use completion in order to enrich your dictionary, and you will
2529 also find `Wild Bird' growing suitable for your La@TeX{} style.
2531 The package name `Wild Bird' is the English translation of Japanese
2532 title `Yachou', which is a trick on words of Japanese.
2534 @node Copying, , Etcetera, Top
2535 @comment node-name, next, previous, up
2536 @chapter Copying
2538 This program is distributed as a free software. You can
2539 use/copy/modify/redistribute this software freely but with NO warranty to
2540 anything as a result of using this software. Adopting code from this
2541 program is also free. But I would not do contract act.
2543 This software can be treated with: ``The 2-Clause BSD License''
2544 (since 2017-09-09, yatex 1.80).
2546 Any reports and suggestions are welcome as long as I feel interests in
2547 this software. My possible e-mail address is `yuuji@@yatex.org'. (as of
2548 Sep.2017) And there is mailing list for YaTeX. Although the common
2549 language is Japanese, questions in English will be welcome. To join the
2550 ML, send the mail whose subject is `append' to the address
2551 `yatex@@yatex.org. If you have some question, please ask to
2552 `yatex-admin@@yatex.org'.
2554 The specification of this software will be surely modified
2555 (depending on my feelings) without notice :-p.
2558 @flushright
2559 HIROSE Yuuji
2560 @end flushright
2561 @bye
2563 Local variables:
2564 mode: texinfo
2565 fill-prefix: nil
2566 fill-column: 74
2567 End: