Initial Commit
[packages] / xemacs-packages / x-symbol / man / x-symbol.texi
1 \input texinfo
2 @c Copyright (C) 1998-2003 Free Software Foundation, Inc.
3 @c
4 @c Author: Christoph Wedler <wedler@users.sourceforge.net>
5 @c Maintainer: (Please use `M-x x-symbol-package-bug' to contact the maintainer)
6 @c Keywords: WYSIWYG, LaTeX, HTML, wp, math, internationalization
7 @c X-URL: http://x-symbol.sourceforge.net/
8
9 @c %**start of header
10 @setfilename x-symbol.info
11 @settitle X-Symbol Manual
12 @setchapternewpage odd
13
14 @set edition 4.5.2
15 @set version 4.5.1
16 @set update December 2003
17 @set url http://x-symbol.sourceforge.net
18 @set maintainer wedler@@users.sourceforge.net
19 @set listdevel x-symbol-devel@@lists.sourceforge.net
20
21 @set imagemagickurl http://www.imagemagick.org/
22 @set proofgeneralurl http://proofgeneral.inf.ed.ac.uk
23 @set sgmlentitiesurl http://www.w3.org/TR/REC-html40/sgml/entities.html
24
25 @c for cross references to other manuals
26 @ifset GNU
27 @set subedition Emacs
28 @set emacs emacs
29 @set emacsman GNU Emacs Manual
30 @end ifset
31
32 @ifclear GNU
33 @set subedition XEmacs
34 @set emacs xemacs
35 @set emacsman XEmacs User's Manual
36 @end ifclear
37
38 @set auctex auctex
39 @set auctexman AUC@TeX{}
40
41 @set reftex reftex
42 @set reftexman Ref@TeX{} User Manual
43
44 @set kpathsea kpathsea
45 @set kpathseaman Kpathsea Manual
46
47 @syncodeindex fn vr
48 @c %**end of header
49 @dircategory Editors
50 @direntry
51 * X-Symbol::      Semi WYSIWYG for LaTeX, HTML and other "token languages"
52 @end direntry
53
54 @ifnottex
55 This file documents X-Symbol, a package providing semi-@sc{wysiwyg} for
56 La@TeX{}, HTML and other ``token languages''.  It uses additional fonts
57 and provide input methods to insert their characters into your document.
58
59 This is Edition @value{edition} (@value{subedition}) of the X-Symbol
60 Manual for X-Symbol @value{version}, @value{update}.
61
62 Copyright (c) 1998-2003 Free Software Foundation, Inc.
63
64 @c default
65 Permission is granted to make and distribute verbatim copies of this
66 manual provided the copyright notice and this permission notice are
67 preserved on all copies.
68
69 @ignore
70 Permission is granted to process this file through TeX and print the
71 results, provided the printed document carries a copying permission
72 notice identical to this one except for the removal of this paragraph
73 (this paragraph not being relevant to the printed manual).
74
75 @end ignore
76 Permission is granted to copy and distribute modified versions of this
77 manual under the conditions for verbatim copying, provided also that the
78 sections entitled ``Copying'' and ``GNU General Public License'' are
79 included exactly as in the original, and provided that the entire
80 resulting derived work is distributed under the terms of a permission
81 notice identical to this one.
82
83 Permission is granted to copy and distribute translations of this manual
84 into another language, under the above conditions for modified versions,
85 except that this permission notice may be stated in a translation
86 approved by the Free Software Foundation.
87 @c end default
88 @end ifnottex
89
90 @finalout
91 @titlepage
92 @title X-Symbol Manual
93 @subtitle Semi-@sc{wysiwyg} for La@TeX{}, HTML and other ``token languages''
94 @subtitle Edition @value{edition} (@value{subedition}), for X-Symbol @value{version}, @value{update}
95 @author by Christoph Wedler
96
97 @page
98 @vskip 0pt plus 1filll
99 Copyright @copyright{} 1998-2003 Free Software Foundation, Inc.
100
101 @c default (slight change)
102 Permission is granted to make and distribute verbatim copies of this
103 manual provided the copyright notice and this permission notice are
104 preserved on all copies.
105      
106 Permission is granted to copy and distribute modified versions of this
107 manual under the conditions for verbatim copying, provided that the
108 entire resulting derive work is distributed under the terms of a
109 permission notice identical to this one.
110      
111 Permission is granted to copy and distribute translations of this manual
112 into another language, under the above conditions for modified versions,
113 except that this permission notice may be stated in a translation
114 approved by the Free Software Foundation.
115 @c end default
116
117 @end titlepage
118
119 @c ===========================================================================
120
121 @ifnottex
122 @node Top, Introduction, (dir), (dir)
123 @comment  node-name,  next,  previous,  up
124 @top X-Symbol
125
126 When you edit La@TeX{}, HTML, BibTeX or @TeX{}info sources in Emacs,
127 package X-Symbol provides some kind of @sc{wysiwyg} by using real
128 characters for tokens like @code{\oplus} or @code{&trade;}.  It also
129 provides various input methods to insert these characters.  Thumbnails
130 for included images and real super-/subscripts and are also supported.
131
132 The first part of this master menu lists the major nodes in this Info
133 document, including the indexes.  The rest of the menu lists all the
134 lower level nodes in the document.
135
136 This is Edition @value{edition} (@value{subedition}) of the X-Symbol
137 Manual for X-Symbol @value{version}, @value{update}.  For recent
138 changes, see @ref{News}.
139
140 Bug fixes, bug reports, improvements, and suggestions are strongly
141 appreciated.  If you want to contact the maintainer of package X-Symbol,
142 please read @ref{Bug Reports}.
143 @end ifnottex
144
145 @menu
146 * Introduction::                Introduction to X-Symbol.
147 * Installation::                What to do before using package X-Symbol.
148 * Concepts::                    Token language, conversion, coding, etc.
149 * Input Methods::               How to insert X-Symbol characters.
150 * Features::                    Super-/subscripts, images, info, etc.
151 * Supported Languages::         Details of the predefined token languages.
152 * X-Symbol Internals::          How package X-Symbol works.
153 * Problems::                    Annoyances, contacting the maintainer.
154 * History::                     Changes, wishlist, projects.
155 * Indexes::                     Menus covering various topics.
156
157 @detailmenu
158  --- The Detailed Node Listing ---
159
160 Introduction
161
162 * Copying::                     X-Symbol is GPL'd.
163 * Summary::                     A brief summary of package X-Symbol.
164 * About::                       About this manual.
165
166 Installation
167
168 * Requirements::                Which programs you need for X-Symbol.
169 * Installing Files::            Basics 1: Put the files into your home dir.
170 * System-wide Installation::    Alternative:  Put the files into the XEmacs dir.
171 * Installing Lisp::             Basics 2: Initialize X-Symbol during startup.
172 * Installing Image Converter::  Recommended: How to install @code{convert}.
173 * Package Integration::         How X-Symbol interacts with other packages.
174 * Installing Fonts::            Optional: What to do when using other fonts.
175 * Installing Fonts Exceed::     If appropriate: What to do when using Exceed.
176 * Installing Fonts Lisp::       If appropriate: Lisp coding for other fonts.
177 * Installing Manual::           Optional: How to create the manual.
178 * Checking Installation::       Is package X-Symbol completely installed?
179
180 Package Integration
181
182 * LaTeX Packages::              Packages used in La@TeX{} buffers.
183 * Syntax Hiliting Packages::    Package @code{font-lock} and support modes.
184 * File IO Packages::            Compression, encryption, remote files, etc.
185 * Miscellaneous Packages::      Other packages.
186
187 Concepts of Package X-Symbol
188
189 * Token Language::              What does a X-Symbol character represent.
190 * Conversion::                  Decoding tokens, encoding characters.
191 * Minor Mode::                  How to control the behavior of X-Symbol.
192 * Poor Mans Mule::              Running X-Symbol under XEmacs/no-Mule.
193 * Role of font-lock::           Why does X-Symbol need @code{font-lock}.
194 * Char Group::                  Character group and token classes.
195
196 Conversion: Decoding and Encoding
197
198 * Default Coding::              Normal File and Default Encoding.
199 * File Coding::                 Specific encoding of a file.
200 * Controlling 8bit Coding::     Do you want to store 8bit characters?
201 * Unique Decoding::             Restrict decoding to avoid normalization?
202 * Conversion Commands::         Interactive encoding and decoding.
203 * Copy with Conversion::        Copy & paste with conversion.
204 * Char Aliases::                Different charsets include the same chars.
205
206 X-Symbol's Input Methods
207
208 * Introducing Input Methods::   Common behavior of all input methods.
209 * Input Method Token::          Replace token by character.
210 * Input Method Read Token::     Minibuffer input with completion.
211 * Input Method Menu::           Select a menu item.
212 * Input Method Grid::           Choose highlighted character.
213 * Input Method Keyboard::       Compose a key sequence.
214 * Input Method Context::        Replace character sequence.
215 * Input Method Electric::       Automatically replace character sequence.
216 * Input Method Quail::          A Mule input method "x-symbol".
217 * Customizing Input Method::    How to customize the input methods.
218
219 Features of Package X-Symbol
220
221 * Super and Subscripts::        Use special fonts for super-/subscripts.
222 * Images::                      Images after image insertion commands.
223 * Info::                        Display information in echo area.
224 * Ascii Representation::        Derive label from a buffer contents.
225 * Package Information::         Invoke info system, use WWW browser.
226
227 Images at the end of Image Insertion Commands
228
229 * Image Display::               When to display images.
230 * Image Conversion::            Producing a scaled-down image.
231 * Image Caching::               Speeding up the image processing.
232 * Special Images::              Signaling specific situations.
233 * Image Editor::                Editing the original image file.
234
235 Supported Token Languages
236
237 * Pseudo Language::             Token language ``x-symbol charsym''.
238 * TeX Macro::                   Token language @code{tex}.
239 * SGML Entity::                 Token language @code{sgml}.
240 * BibTeX Macro::                Token language @code{bib}.
241 * TeXinfo Command::             Token language @code{texi}.
242 * External Languages::          Languages defined in other Emacs Packages.
243
244 Token Language ``@TeX{} macro'' (@code{tex})
245
246 * TeX Macro Basics::            Basics of language ``@TeX{} macro''.
247 * TeX Macro Features::          Super-/subscripts and images in La@TeX{}.
248 * TeX Macro Problems::          Problems with @TeX{} macros.
249 * TeX Macro Conversion::        How the conversion of @TeX{} macros works.
250 * TeX Macro Symbols::           Extra Symbols of Language ``@TeX{} Macro''.
251
252 Token Language ``@sc{sgml} entity'' (@code{sgml})
253
254 * SGML Entity Basics::          Basics of Language ``@sc{sgml} entity''.
255 * SGML Entity Features::        Super-/Subscripts and Images in @sc{html}.
256 * SGML Entity Conversion::      How the conversion of @sc{sgml} entities works.
257
258 X-Symbol Internals
259
260 * Char Representation::         How X-Symbol represents X-Symbol chars.
261 * Defining Charsets::           How X-Symbol defines additional chars.
262 * Defining Input Methods::      How X-Symbol defines the input methods.
263 * Extending X-Symbol::          How to add fonts and token languages.
264 * Various Internals::           How X-Symbol handles other aspects.
265 * Design Alternatives::         Why X-Symbol is not designed differently.
266 * Language Internals::          How X-Symbol handles languages.
267 * Misc Internals::              Various.  TODO.
268
269 Defining Input Methods
270
271 * Input Method Objectives::     Input methods should be intuitive/consistent.
272 * Intro Char Descriptions::     An example introducing char descriptions.
273 * Char Descriptions::           The aspects and the contexts of a character.
274 * Example Char Descriptions::   A complete example defining input methods.
275 * Customizing Input Methods::   How to customize the input methods.
276
277 Extending Package X-Symbol
278
279 * Extending with Fonts::        How to add fonts to X-Symbol.
280 * Input Definitions::           Guidelines for input definitions.
281 * Font Definition File::        How to define new character in a file.
282 * Language Extension File::     Extending an existing language.
283 * Language Definition File::    Defining a new language.
284
285 Various Internals
286
287 * Tagging Insert Commands::     Don't break input methods Token and Electric.
288 * Avoiding Flickering::         Moving cursor in invisible commands.
289
290 Design Alternatives
291
292 * Alt Token Representations::   Why we need the conversion.
293 * Alt Global Mode::             How to turn on X-Symbol globally.
294 * Alt Auto Conversion::         When do we convert automatically.
295
296 Problems, Troubleshooting
297
298 * Nomule Problems::             X-Symbol provides a @emph{poor} man's Mule.
299 * Spurious Encodings::          Some commands turn off X-Symbol mode.
300 * No Encoding::                 The encoding does not work in a rare case.
301 * FAQ::                         Frequently asked questions.
302 * Bug Reports::                 How to contact the maintainer of X-Symbol.
303
304 Frequently Asked Questions
305
306 * FAQ XEmacs Core::             XEmacs crashes when using input method Token
307 * FAQ font-lock::               X-Symbol's fontification does not work.
308 * FAQ Strange Chars::           The buffer contains strange characters
309 * FAQ No Subscripts::           I cannot see any/some super-/subscripts.
310 * FAQ Stupid Subscripts::       I see subscripts where I don't want them.
311 * FAQ Font Size::               The characters are too small or too big.
312 * FAQ Conversion::              The conversion changes some tokens.
313 * FAQ Additional Spaces::       A space is added during the encoding.
314 * FAQ 8bit Chars::              I do not want 8bit characters in the file.
315 * FAQ Hyphen::                  I cannot distinguish @code{hyphen} from @samp{-}.
316 * FAQ Spell Check::             I have problems with spell-checking.
317 * FAQ News and Mail::           I want to use X-Symbol in Gnus or @sc{vm}.
318
319 History and Projects
320
321 * News::                        Changes in recent versions.
322 * Wishlist::                    Projects for X-Symbol.
323 * Open Questions::              How you can contribute.
324 * Acknowledgments::             People having contributed.
325
326 News: Changes in Recent Versions of X-Symbol
327
328 * Changes New::                 To be announced.
329 * Changes 4.5::                 Released Mar 2003 as beta.
330 * Changes 4.4::                 Released June 2002 as beta.
331 * Changes 4.1::                 Released Mar 2002 as beta.
332 * Changes 3.4::                 Released Mar 2002.
333 * Changes 3.3::                 Released Jan 1999.
334 * Changes 3.2::                 Released Dec 1998.
335 * Changes 3.1::                 Released Oct 1998.
336 * Changes 3.0::                 Released Sep 1998 as beta.
337 * Changes Old::                 Overview of old releases.
338
339 Wishlist: Projects for X-Symbol
340
341 * Wishlist Languages::          Additional token languages.
342 * Wishlist Fonts::              Automatically generated fonts.
343 * Wishlist Emacs::              Changes in Emacs/XEmacs.
344 * Wishlist LaTeX::              Changes in La@TeX{}.
345 * Wishlist Various::            Other changes.
346 * Wishlist Rejected::           Rejected Suggestions for X-Symbol.
347
348 Indexes
349
350 * Key Index::                   Key sequences.
351 * Program Index::               Programs and Emacs packages.
352 * Variable Index::              Commands, functions, variables.
353 * Concept Index::               Various topics.
354
355 @end detailmenu
356 @end menu
357
358 @c ===========================================================================
359
360 @node  Introduction, Installation, Top, Top
361 @comment  node-name,  next,  previous,  up
362 @chapter Introduction
363 @cindex Overview
364 @cindex Introduction
365
366 When you edit La@TeX{}, HTML, BibTeX or @TeX{}info sources in Emacs,
367 package X-Symbol provides some kind of @sc{wysiwyg} by using real
368 characters for tokens like @code{\oplus} or @code{&trade;}.  It also
369 provides various input methods to insert these characters.  Thumbnails
370 for included images and real super-/subscripts and are also supported.
371
372 @menu
373 * Copying::                     X-Symbol is GPL'd.
374 * Summary::                     A brief summary of package X-Symbol.
375 * About::                       About this manual.
376 @end menu
377
378 @c ====================================================================
379
380 @node Copying, Summary, Introduction, Introduction
381 @comment  node-name,  next,  previous,  up
382 @section X-Symbol's Copying Conditions: GPL
383 @cindex Copying
384 @cindex Copyright
385 @cindex GPL
386 @cindex General Public License
387 @cindex License
388 @cindex Warranty
389
390 (This text is stolen from the @TeX{}info manual, Edition 4.0).
391
392 The programs currently being distributed that relate to X-Symbol include
393 Emacs Lisp files and X11 font files.  These programs are @dfn{free};
394 this means that everyone is free to use them and free to redistribute
395 them on a free basis.  The X-Symbol related programs are not in the
396 public domain; they are copyrighted and there are restrictions on their
397 distribution, but these restrictions are designed to permit everything
398 that a good cooperating citizen would want to do.  What is not allowed
399 is to try to prevent others from further sharing any version of these
400 programs that they might get from you.
401
402 Specifically, we want to make sure that you have the right to give away
403 copies of the programs that relate to X-Symbol, that you receive source
404 code or else can get it if you want it, that you can change these
405 programs or use pieces of them in new free programs, and that you know
406 you can do these things.
407
408 To make sure that everyone has such rights, we have to forbid you to
409 deprive anyone else of these rights.  For example, if you distribute
410 copies of the X-Symbol related programs, you must give the recipients
411 all the rights that you have.  You must make sure that they, too,
412 receive or can get the source code.  And you must tell them their
413 rights.
414
415 Also, for our own protection, we must make certain that everyone finds
416 out that there is no warranty for the programs that relate to X-Symbol.
417 If these programs are modified by someone else and passed on, we want
418 their recipients to know that what they have is not what we distributed,
419 so that any problems introduced by others will not reflect on our
420 reputation.
421
422 The precise conditions of the licenses for the programs currently being
423 distributed that relate to X-Symbol are found in the General Public
424 Licenses that accompany them.
425
426 @c ====================================================================
427
428 @node Summary, About, Copying, Introduction
429 @comment  node-name,  next,  previous,  up
430 @section Brief Summary of X-Symbol
431 @cindex Summary
432 @cindex Brief Summary
433 @cindex X-Symbol in a Nutshell
434
435 @itemize @bullet
436 @item
437 X-Symbol provides a @strong{minor mode} which make use of characters in
438 the Latin-1, Latin-2, Latin-3, Latin-5, and Latin-9 font (179 chars +
439 294 char aliases), the Adobe symbol font (109 chars) and the xsymb1 font
440 (165 chars, distributed with the package).  Additional fonts could be
441 used easily.
442
443 @item
444 These characters are used in the buffer to represent @strong{tokens}
445 (e.g., @TeX{} macros, @sc{sgml} entities, more ``token languages'' could be
446 added easily) in the file.  The @emph{conversion} is done automatically
447 when visiting the file, saving the buffer and turning the minor mode
448 on/off.
449
450 @item
451 Defines 8 @strong{input methods} for these characters: @emph{Menu},
452 @emph{Grid} (selecting a character with the mouse), @emph{Keyboard},
453 @emph{Context} (replace/modify similar-looking char sequence),
454 @emph{Electric} (automatic replace), @emph{Quail} (a Mule input method),
455 @emph{Token} (replace token by corresponding char), @emph{Read Token}
456 (completing minibuffer input of token).
457
458 @item
459 Offers some @strong{info} in the echo area for these characters (e.g.,
460 that the character under point represents the TeX macro @code{\leadsto}
461 and that the macro is defined in La@TeX{} package @file{latexsym.sty}).
462
463 @item
464 Allows to use a @strong{8bit file encoding} which is different from your
465 "normal" 8bit file encoding, e.g., you can visit @TeX{} files with
466 @code{\usepackage[latin5]@{inputenc@}} even if you normally use a Latin-2
467 font.
468
469 @item
470 Provides a kind of ``@strong{poor man's Mule}'' when running on an
471 XEmacs without Mule support: it can @emph{display} more than 256
472 characters via @code{font-lock} and removes most annoyances resulting
473 from the fact that, without Mule support, many ``X-Symbol characters''
474 are actually a sequence of two chars.
475
476 @item
477 Provides fonts for single-line innermost @strong{super-} and
478 @strong{subscripts} to be displayed with per-buffer control. The
479 invisible part, like @code{<sub>} in HTML, is revealed at point.
480
481 @item
482 Displays thumbnails for @strong{images} at the end of image insertion
483 commands with per-buffer control (e.g.,
484 @code{\includegraphics@{@var{file}@}} in La@TeX{}, @code{<img
485 src=@var{file}>} in HTML).  They show a scaled-down version of the
486 included image files (using @code{convert} from
487 @uref{@value{imagemagickurl},ImageMagick}).  A single mouse click
488 on the image or command invokes the image editor for the corresponding
489 image file.
490
491 @item
492 It @emph{does not} and @emph{will not} provide commands to hide (more or
493 less) uninteresting parts of your document or fontify them differently.
494 This is more the task of the corresponding major mode or
495 @code{font-lock}, e.g., @code{font-latex}.  (I admit, the support of
496 super- and subscripts might let you think that this is a good point for
497 the todo list of package X-Symbol.)  Using @code{outline-minor-mode} or
498 folding might also be an alternative.
499 @end itemize
500
501 If you prefer a more @sc{wysiwyg}-like document processor, you should
502 probably use @code{LyX} or @code{GNU TeXmacs}.  Here are some reasons
503 why you would use Emacs/XEmacs with package X-Symbol instead:
504
505 @itemize @bullet
506 @item
507 You have complete control over the La@TeX{} source.  X-Symbol supports
508 more characters.
509
510 @item
511 You can read any La@TeX{} source and you write normal La@TeX{} code,
512 i.e., package X-Symbol does not use any special format.
513
514 @item
515 It also supports HTML and @TeX{}info documents and BibTeX entries.
516
517 @item
518 You can use your favorite editor, i.e., Emacs or XEmacs.
519 @end itemize
520
521 @c ====================================================================
522
523 @node About,  , Summary, Introduction
524 @comment  node-name,  next,  previous,  up
525 @section About this Manual
526 @cindex About
527 @cindex Web Pages
528 @cindex Info Pages
529 @cindex Manual
530 @cindex Online Help
531
532 Apart from this manual, there are two other sources of information about
533 X-Symbol:
534
535 @itemize @bullet
536 @item
537 The web pages of X-Symbol provide a summary of X-Symbol, including some
538 screen shots.  You are strongly encouraged to read them carefully.  They
539 probably provide enough info for the standard user and can be found at:
540
541 @display
542   @uref{@value{url}/}
543 @end display
544
545 @item
546 The online help for commands (functions) and user options (variables) is
547 quite technical.  It is shown during customization and when using Emacs'
548 Help menu.
549 @end itemize
550
551 This manual is somewhere in between: it more detailed than the web pages
552 and less technical than the online help.  For example, when explaining
553 some functionality, it states the default behavior, gives an impression
554 of what can be customized, and it even lists all related user options,
555 but it does not describes the technical format of possible values of
556 each option.
557
558 If you want to learn something about X-Symbol's internals, e.g., if you
559 want to define your own token language, see @ref{X-Symbol Internals}.
560
561 This manual does not explain Emacs in general or some optional programs
562 used by this package such as @code{convert} (used to produce the image
563 thumbnails).  It also includes no installation instructions for those
564 programs and the author of this package will not help you with the
565 installation of those programs (sorry for that).
566
567 You do not have to learn this manual by heart before sending a question
568 to the maintainer of X-Symbol, but you should give the impression that
569 your really have tried to find the necessary information yourself and
570 spend some time making your report precise.  Before sending a problem
571 report, please read @ref{Bug Reports}.
572
573 @c ===========================================================================
574
575 @node Installation, Concepts, Introduction, Top
576 @comment  node-name,  next,  previous,  up
577 @chapter Installation
578 @cindex Installation
579
580 The short version of the installation instructions for package X-Symbol
581 on XEmacs is: uncompress & extract the @emph{binary distribution} in
582 directory @file{~/.xemacs/xemacs-packages/}, add
583 @code{(x-symbol-initialize)} to your @file{~/.emacs} and install
584 ImageMagick for the image support (unless you want to get a warning).
585
586 Please check the web page @emph{additionally} to the sections here for
587 the installation instructions for package X-Symbol on Emacs.
588
589 The rest of this chapter contains the long version.  I recommend that
590 you read this chapter completely after a short test of X-Symbol,
591 especially if you have customized your Emacs more or less heavily or if
592 you get some problems.
593
594 @menu
595 * Requirements::                Which programs you need for X-Symbol.
596 * Installing Files::            Basics 1: Put the files into your home dir.
597 * System-wide Installation::    Alternative:  Put the files into the XEmacs dir.
598 * Installing Lisp::             Basics 2: Initialize X-Symbol during startup.
599 * Installing Image Converter::  Recommended: How to install @code{convert}.
600 * Package Integration::         How X-Symbol interacts with other packages.
601 * Installing Fonts::            Optional: What to do when using other fonts.
602 * Installing Fonts Exceed::     If appropriate: What to do when using Exceed.
603 * Installing Fonts Lisp::       If appropriate: Lisp coding for other fonts.
604 * Installing Manual::           Optional: How to create the manual.
605 * Checking Installation::       Is package X-Symbol completely installed?
606 @end menu
607
608 @c ====================================================================
609
610 @node Requirements, Installing Files, Installation, Installation
611 @comment  node-name,  next,  previous,  up
612 @section Requirements
613 @cindex Requirements
614 @cindex Binary Package
615 @cindex Source Package
616 @cindex Old Version
617 @cindex Window System
618 @cindex X
619 @cindex Windows
620 @cindex MS-Windows
621 @cindex Character Terminal
622 @cindex TTY
623 @pindex Emacs
624 @pindex XEmacs
625
626 This development version of package X-Symbol works with Emacs-21.1 or
627 higher, and XEmacs 20.4 or higher (XEmacs-21.1.9 is strongly
628 recommended, @ref{FAQ XEmacs Core}), with or without Mule support.
629
630 X-Symbol should work with all window systems Emacs is running under (Mac
631 is not testet and might not work).  Under X, no restrictions apply.
632 Under Windows with Emacs, images will not be displayed (they are not yet
633 supported by Emacs under Windows).  Under Windows with XEmacs, X-Symbol
634 just supports a limited number of characters (Latin-1, Latin-5, and half
635 the math symbols) and no super- and subscripts, due to missing
636 MS-Windows fonts (@pxref{Wishlist Fonts}).  Under a character terminal,
637 X-Symbol just supports Latin-1 characters only, no super- and subscripts
638 and no images.
639
640 @pindex font-lock
641 @pindex lazy-shot
642 @pindex texmathp
643 @pindex auctex
644 This package require package @code{font-lock} (distributed with Emacs
645 and XEmacs), the use of package @code{lazy-shot} is recommended, see
646 @ref{Syntax Hiliting Packages}.
647
648 @pindex convert
649 If you want to see the images at the end of image insertion commands,
650 install @code{convert} from
651 @uref{@value{imagemagickurl},ImageMagick},
652 see @ref{Installing Image Converter}.  They show a scaled-down version
653 of the included image files.
654
655 @pindex makeinfo
656 @pindex texi2dvi
657 @pindex latex2html
658 If you want to produce the Info files yourself (they are included in the
659 binary distribution), you need @code{makeinfo}, Version 1.68 or higher.
660 If you want to produce a PS file from the manual, you need
661 @code{texi2dvi}.  If you want to produce an HTML version of this manual,
662 you need @code{texi2html}, Version 1.62 or higher.  @xref{Installing
663 Manual}.
664
665
666 @c ====================================================================
667
668 @node Installing Files, System-wide Installation, Requirements, Installation
669 @comment  node-name,  next,  previous,  up
670 @section Put the Files into your Home Directory
671 @cindex Basic Installation
672 @cindex Uncompress Tarball
673 @cindex Extract Tarball
674 @cindex Tarball
675 @cindex Binary Distribution
676
677 If you use Emacs, please check the @uref{@value{url}/news.html,web pages
678 of X-Symbol}.
679
680 In this section, we assume that you want to install the binary
681 distribution (also called the binary tarball) of package X-Symbol in
682 your home directory.  To install it somewhere below the XEmacs root (it
683 might be already there), see @ref{System-wide Installation}.  If you use
684 the source distribution, you should know what do to instead.
685
686 In directory @file{~/.xemacs/xemacs-packages/}, run
687 @example
688 zcat x-symbol-pkg.tar.gz | tar xvf -
689 @end example
690
691 Remember that @code{tar} does not overwrite write-protected files.
692
693 X-Symbol's @file{pcf} files and font directory must be world-readable 
694 since you do not own the X11 font server process.  You are on the safe
695 side, if you run
696 @example
697 chmod -R a+rx ~/.xemacs/xemacs-packages
698 @end example
699
700 If package X-Symbol has been installed system-wide and you install a
701 newer version in your @file{~/.xemacs/xemacs-packages/}, you get a warning during
702 XEmacs' startup (autoload error: already loaded).  You can safely ignore
703 this warning, but there is unfortunately no good way to get rid of it.
704 Yes, XEmacs' packaging system is excellent, but there is still a place
705 for improvements@dots{}.
706
707 Before XEmacs-21.0: the user package directory was @file{~/.xemacs/}
708 instead of @file{~/.xemacs/packages/}; also: delete and recompile the
709 @file{.elc} files.
710
711 @c ====================================================================
712
713 @node System-wide Installation, Installing Lisp, Installing Files, Installation
714 @comment  node-name,  next,  previous,  up
715 @section System-wide Installation: Put the Files into the XEmacs Directory
716 @cindex System-wide Installation
717 @cindex Installing System-wide
718 @cindex @file{default.el}
719 @cindex @file{site-start.el}
720
721 You can skip this section if your have installed X-Symbol in your home
722 directory according to the previous section.
723
724 If you install package X-Symbol system-wide, use @file{default.el} and
725 @file{@var{xemacs}/site-packages/} whenever @file{~/.emacs} and
726 @file{~/.xemacs/xemacs-packages/} are mentioned in the previous or
727 following subsections.  @file{@var{xemacs}/site-packages/} is the
728 directory of independent packages for XEmacs.
729
730 Under XEmacs-21, you can uncompress and extract the tarball by
731
732 @example
733 M-x package-admin-add-binary-package @key{RET} @var{dir}/x-symbol-pkg.tar.gz
734 @end example
735
736 Then, @file{@var{xemacs}/} is the default directory of buffer
737 @file{*Package Output*} (use @kbd{C-x C-f} in that buffer to see it).
738 It might be @file{/usr/local/lib/xemacs/xemacs-packages/} (the first
739 element in variable @code{late-packages}).
740
741 Under XEmacs-20, @file{@var{xemacs}/} might be
742 @file{/usr/local/lib/xemacs-@var{version}/}.  Here, you have to
743 uncompress and extract the tarball as described in @ref{Installing
744 Files}.  You also have to load the autoload file explicitly by putting
745 the following line into file @file{site-start.el}:
746
747 @lisp
748 (load "@var{xemacs}/lisp/x-symbol/auto-autoloads")
749 @end lisp
750
751 I would appreciate if you would set the following variables:
752
753 @vtable @code
754 @item x-symbol-installer-address
755 Please set this variable to your email address to catch problems which
756 could be solved locally.  In your private @file{~/.emacs}, you might
757 want to set this variable to @code{nil}.
758
759 @item x-symbol-package-url
760 If you have a local copy of the web pages (@pxref{Installing Manual}), set
761 this variable to the corresponding @sc{url}.
762 @end vtable
763
764 @c ====================================================================
765
766 @node Installing Lisp, Installing Image Converter, System-wide Installation, Installation
767 @comment  node-name,  next,  previous,  up
768 @section Make XEmacs Initialize X-Symbol During Startup
769 @cindex Installing Lisp
770 @cindex Lisp Installation
771 @cindex Elisp Installation
772 @cindex @file{.emacs}
773 @findex x-symbol-initialize
774
775 Put the following into your @file{~/.emacs} (or @file{~/.xemacs/init.el}):
776
777 @lisp
778 (x-symbol-initialize)
779 @end lisp
780
781 Basically, that's it!  If your XEmacs runs on a different machine, check
782 @ref{Installing Fonts}.
783
784 If you get a warning about X-Symbol not being able to deduce a default
785 encoding (or about limited support with XEmacs under Windows or a
786 character terminal, @ref{Requirements}), set the default coding
787 (@pxref{Default Coding}) by putting the following in front of the line
788 above:
789
790 @lisp
791 (setq x-symbol-default-coding 'iso-8859-1)
792 @end lisp
793
794 When running Emacs under a character terminal, you might need to use the
795 following (with or without X-Symbol):
796
797 @lisp
798 (unless window-system (standard-display-european 1))
799 @end lisp
800
801 If your character terminal does not support Latin characters, there is
802 no reason to use package X-Symbol.  In this case, use the following
803 instead:
804
805 @lisp
806 (when window-system (x-symbol-initialize))
807 @end lisp
808
809 The initialization can be controlled by the following variable:
810
811 @vtable @code
812 @item x-symbol-initialize
813 By default, package X-Symbol does a full initialization.  This includes
814 an integration with some packages, see also @ref{Package Integration}.
815 @end vtable
816
817 If you use a B/W monitor and XEmacs/no-Mule, it might be necessary to
818 remove the font properties of any face which is used on regions with
819 X-Symbol characters: @code{isearch}, @code{highlight},
820 @code{primary-selection}, @code{secondary-selection},
821 @code{paren-match}, @code{paren-mismatch}, @code{paren-blink-off},
822 @code{underline}.  I.e., for each @var{face}, use:
823
824 @lisp
825 (remove-specifier (get (get-face '@var{face}) 'font))
826 @end lisp
827
828 @c ====================================================================
829
830 @node Installing Image Converter, Package Integration, Installing Lisp, Installation
831 @comment  node-name,  next,  previous,  up
832 @section Installing the Image Converter from ImageMagick
833 @cindex Installing Image Converter
834 @cindex Installing @code{convert}
835 @cindex Image Converter Installation
836 @cindex @code{convert} Installation
837
838 @pindex convert
839 Program @code{convert} from ImageMagick is used to display images at the
840 end of image insertion commands.  The images show a scaled-down version
841 of the included image files.
842
843 @vindex x-symbol-image-converter
844 While the installation of @code{convert} is optional, you get a warning
845 if @code{convert} is not found on your system or if there is no image
846 format supported by both @code{convert} and Emacs.  Set variable
847 @code{x-symbol-image-converter} to @code{nil} if you don't want to get
848 the warning.
849
850 @vindex x-symbol-image-convert-program
851 On Unix, @code{convert} must be in your @code{$PATH}.  On Windows, it is
852 assumed to be found at @file{C:\ImageMagick\convert}.  If this is not
853 the case, you have to customize the variable
854 @code{x-symbol-image-convert-program}.
855
856 Check @uref{@value{imagemagickurl}} for the installation
857 instructions.  Run @samp{convert -h} and @samp{convert -list Format} (in
858 newer versions of ImageMagick) in your shell to check whether the
859 installation of ImageMagick was successful.  If you have problems, check
860 the ImageMagick web page for FAQs and mailing lists.
861 @comment ImageMagick-5.0..5.37 failed to show formats sometimes
862
863 If you do not have a truecolor device (i.e., just 256 colors), package
864 X-Symbol uses @code{convert} with a colormap by default (@pxref{Image
865 Conversion}).  You might create and use your own colormap instead.  It
866 should be tuned to include the colors you use in Emacs anyway, i.e., the
867 face colors.
868
869 @c ====================================================================
870
871 @node Package Integration, Installing Fonts, Installing Image Converter, Installation
872 @comment  node-name,  next,  previous,  up
873 @section Package Integration
874 @cindex Package Integration
875 @cindex Integrating Package
876 @cindex Other Packages
877
878 You might skip this section when trying package X-Symbol the first time.
879 Nevertheless, I strongly recommend to read this section if you have
880 customized your Emacs more or less heavily or if you get some problems.
881
882 Some features of X-Symbol work by hooking itself into existing functions
883 of Emacs or related packages via predefined hooks.  A potential problem
884 arises if your customization or other packages use the same hooks, or if
885 other packages assume these hooks not to be used, e.g., some packages
886 assume the buffer contents to contain the same characters as the
887 corresponding file.
888
889 This section lists some special adaptation for other packages
890 (everything is fine if you do not use these packages).  It also lists
891 potential problems in combination with other packages.  If you discover
892 some problems in combination with other packages, please let me know.
893
894 @menu
895 * LaTeX Packages::              Packages used in La@TeX{} buffers.
896 * Syntax Hiliting Packages::    Package @code{font-lock} and support modes.
897 * File IO Packages::            Compression, encryption, remote files, etc.
898 * Miscellaneous Packages::      Other packages.
899 @end menu
900
901
902 @node LaTeX Packages, Syntax Hiliting Packages, Package Integration, Package Integration
903 @comment  node-name,  next,  previous,  up
904 @subsection La@TeX{} Packages
905 @cindex La@TeX{} Packages
906 @cindex Integrating La@TeX{} Packages
907
908 Objectives: relate positions in buffer to positions in file, do
909 conversion in master/slave buffers, preserve highlighting, improve input
910 methods and other things.
911
912 @table @code
913 @item auctex
914 @pindex auctex
915 @pindex texmathp
916 @findex TeX-next-error
917 @vindex TeX-translate-location-hook
918 @findex x-symbol-tex-error-location
919 Use Version 9.9c or higher, which includes @code{texmathp}.  There is
920 some special X-Symbol adaptation for Auc@TeX{}:
921
922 @itemize @minus
923 @item
924 @vindex TeX-master
925 X-Symbol supports Auc@TeX{}'s multifile documents: it respects the
926 variable @code{TeX-master} when searching for the file encoding
927 (@pxref{File Coding}) and when converting image files with relative
928 names (@pxref{Image Display}).
929
930 @item
931 @vindex TeX-region-hook
932 X-Symbol supports Auc@TeX{}'s region commands: it ensures that
933 characters in @file{_region_.tex} buffer are converted according to the
934 parent buffer.  Initialization changes @code{TeX-region-hook}.  Requires
935 Auc@TeX{}, v9.8a or higher.
936
937 @item
938 X-Symbol's input method Electric (@pxref{Input Method Electric}) with
939 token language @code{tex} uses package @code{texmathp}.
940
941 @item
942 @vindex LaTeX-math-insert-function
943 Auc@TeX{}'s math mode commands also inserts X-Symbol characters
944 (@pxref{Mathematics,,,
945 @value{auctex},
946 @value{auctexman}}).
947 Initialization sets @code{LaTeX-math-insert-function}.  Requires
948 Auc@TeX{}, v9.8a or higher.
949
950 @item
951 @findex TeX-next-error
952 @vindex TeX-translate-location-hook
953 If @TeX{} displays an error message, it also displays the context of the
954 error position.  Auc@TeX{} uses the context to set point to this
955 position when @kbd{M-x TeX-next-error} is invoked.  The former context
956 are characters in the file, the latter characters in the buffer,
957 X-Symbol provides the translation.  Initialization changes
958 @code{TeX-translate-location-hook}.
959 @end itemize
960
961 @item bib-cite
962 @pindex bib-cite
963 Use Version 3.0 or higher.  Initialization of package X-Symbol changes
964 the installation of package bib-cite to make X-Symbol's decoding not
965 overwrite @code{bib-cite}s highlighting of @code{\cite} and friends.
966
967 @item preview-latex
968 @pindex preview-latex
969 @findex x-symbol-tex-preview-locations
970 @TeX{}'s error positions are also used by package @code{preview-latex},
971 which was clever enough to reuse the above mentioned hook of Auc@TeX{}.
972 Unfortunately, that hook is @dots{} and does not allow a fast translation of
973 error positions, so @code{preview-latex} allows to provide better
974 variants of functions in that hook.  X-Symbol's variant is
975 @code{x-symbol-tex-preview-locations}.
976
977 @item reftex
978 @pindex reftex
979 @vindex reftex-translate-to-ascii-function
980 Use Version 3.26 or higher.  For a workaround for some minor annoyances
981 with the combination Ref@TeX{}/X-Symbol/Multifile Document, see
982 @ref{Problems and Work-arounds,,,@value{reftex},@value{reftexman}}.  By
983 default, the initialization of package X-Symbol makes Ref@TeX{}'s label
984 creation use the nicer Asciification of package X-Symbol (@pxref{Ascii
985 Representation}) by setting @code{reftex-translate-to-ascii-function}.
986
987 @item whizzytex
988 Use the newest.
989 @end table
990
991
992 @node Syntax Hiliting Packages, File IO Packages, LaTeX Packages, Package Integration
993 @comment  node-name,  next,  previous,  up
994 @subsection Syntax Highlighting Packages (@code{font-lock} and add-ons)
995 @cindex Syntax Highlighting Packages
996 @cindex @code{font-lock} Packages
997 @cindex Integrating @code{font-lock} Packages
998
999 Objectives: start highlighting after conversion.  Highlighting is
1000 needed for super- and subscripts and when using XEmacs without Mule
1001 support.
1002
1003 @table @code
1004 @item fast-lock
1005 @pindex fast-lock
1006 @vindex fast-lock-save-faces
1007 I recommend to use package @code{lazy-shot} instead.  By default, the
1008 initialization of package X-Symbol sets @code{fast-lock-save-faces} to
1009 @code{nil} to make package @code{fast-lock} work with X-Symbol.
1010
1011 @item font-latex
1012 @pindex font-latex
1013 @vindex font-lock-maximum-decoration
1014 I suggest to set @code{font-lock-maximum-decoration} to value @code{t},
1015 2 or higher if you do not want to use super- and subscripts in arguments
1016 of @code{\label} and friends.  @xref{FAQ Stupid Subscripts}.
1017
1018 @item font-lock
1019 @pindex font-lock
1020 @vindex font-lock-auto-fontify
1021 Is required by this package (@pxref{Role of font-lock}).  I strongly
1022 recommend @emph{not} to turn on font-lock in @emph{any} mode hook, set
1023 @code{font-lock-auto-fontify} to @code{t} instead (this is the default,
1024 anyway).  See also @code{lazy-shot}.
1025
1026 If you turn on font-lock in a mode-hook, visiting a file would become
1027 slower, since X-Symbol mode is usually turned on @emph{after} the
1028 functions in the mode hook have been run, i.e., the fontification is
1029 getting useless if the tokens are automatically decoded.
1030
1031 @item lazy-lock
1032 @pindex lazy-lock
1033 From XEmacs-20.3 on, the successor is called @code{lazy-shot}.
1034
1035 @item lazy-shot
1036 @pindex lazy-shot
1037 Is strongly recommended.
1038 @end table
1039
1040
1041 @node File IO Packages, Miscellaneous Packages, Syntax Hiliting Packages, Package Integration
1042 @comment  node-name,  next,  previous,  up
1043 @subsection File I/O Packages
1044 @cindex File I/O Packages
1045 @cindex I/O Packages
1046 @cindex Remote File Packages
1047 @cindex Compression Packages
1048 @cindex Encryption Packages
1049 @cindex Integrating I/O Packages
1050
1051 Issue: compression, encryption and so on can be seen as some kind of
1052 conversion.  When doing multiple conversion, the sequence matters.
1053
1054 @table @code
1055 @item ange-ftp
1056 @pindex ange-ftp
1057 See also @code{efs} and @code{jka-compr}.
1058
1059 @item comint
1060 @pindex comint
1061 @vindex comint-input-sender
1062 The default installation makes @code{comint}s in-/output use X-Symbol's
1063 conversion function.  If you set variable @code{comint-input-sender},
1064 set it before initializing package X-Symbol.
1065
1066 @item crypt
1067 @itemx crypt++
1068 @pindex crypt
1069 @pindex crypt++
1070 @findex save-buffer
1071 @vindex x-symbol-auto-conversion-method
1072 I recommend to use package @code{jka-compr} instead.  @xref{Spurious
1073 Encodings}.  @xref{No Encoding}.  If you use @code{crypt} or  @code{crypt++} and the
1074 character @code{alpha} looks like @samp{\233a} after @code{save-buffer},
1075 set this variable to @code{slowest}.  @xref{Open Questions}.
1076
1077 @item efs
1078 @pindex efs
1079 XEmacs' version of @code{ange-ftp}.  See also @code{jka-compr}.
1080
1081 @item iso-cvt
1082 @pindex iso-cvt
1083 There is no need to use it.  Package X-Symbol already provides the
1084 conversion between Latin-1 characters and ``@TeX{} macros''.  Package
1085 X-Symbol does not provide the German and Spanish conversion tables,
1086 though.
1087
1088 @item iso-sgml
1089 @pindex iso-sgml
1090 There is no need to use it.  Package X-Symbol already provides the
1091 conversion between Latin-1 characters and ``@sc{sgml} entities''.
1092 @xref{Miscellaneous Packages}, package @code{psgml-html}.
1093
1094 @item jka-compr
1095 @pindex jka-compr
1096 Can be used with package X-Symbol, preferred to @code{crypt}.  The
1097 following is absolutely necessary (with or without using package
1098 X-Symbol, at least in older Emacsen): load @code{jka-compr} after
1099 @code{efs}/@code{ange-ftp}!
1100
1101 @item latin-unity
1102 @pindex latin-unity
1103 This XEmacs package can be used with package X-Symbol, functionality is already provided by
1104 X-Symbol for Latin-@{1,2,3,5,9@} characters: remapping (@pxref{Char
1105 Aliases}) and recoding (@pxref{File Coding}).  Has some safe-encoding
1106 mechanism, but the test comes currently too early (@pxref{Wishlist
1107 Emacs}).
1108
1109 @c TODO: test mule-ucs.el with Emacs-21.4
1110 @item ucs-tables
1111 @pindex ucs-tables
1112 @findex unify-8859-on-decoding-mode
1113 @findex unify-8859-on-encoding-mode
1114 The Emacs minor modes @code{unify-8859-on-decoding-mode} and
1115 @code{unify-8859-on-encoding-mode} can be used with package X-Symbol.
1116
1117 @item vc
1118 @pindex vc
1119 @findex vc-next-action
1120 If you use package @code{crypt}, @code{vc-next-action} and friends
1121 encode characters to tokens.  @xref{Spurious Encodings}.
1122 @end table
1123
1124
1125 @node Miscellaneous Packages,  , File IO Packages, Package Integration
1126 @comment  node-name,  next,  previous,  up
1127 @subsection Miscellaneous Packages
1128 @cindex Miscellaneous Packages
1129
1130 @table @code
1131 @item abbrev
1132 @pindex abbrev
1133 On XEmacs without Mule support, I recommend to set variable
1134 @code{words-include-escapes} to @code{t}.  @xref{Nomule Problems}.
1135
1136 @item completion
1137 @pindex completion
1138 Should work with X-Symbol (earlier version of X-Symbol had problems with
1139 input method token).
1140
1141 @item desktop
1142 @pindex desktop
1143 XEmacs' version (an old one) does not save its @file{.emacs.desktop}
1144 files with a coding system.  Emacs' version save it with an incorrect
1145 coding system.  Thus, strings which contain X-Symbol's private
1146 characters might get corrupted.  See also package @code{session} below.
1147
1148 @item flyspell
1149 @pindex flyspell
1150 @findex global-flyspell-mode
1151 Should work apart from the general problem of @code{ispell}.
1152
1153 @item func-menu
1154 @pindex func-menu
1155 Should work with X-Symbol.
1156
1157 @item ispell
1158 @pindex ispell
1159 The package @code{ispell} assumes the buffer contents to be the same as
1160 the file contents and does not provide any hook to fix this.  This
1161 should be fixed in @code{ispell}, see @ref{Wishlist Emacs}.  @xref{FAQ
1162 Spell Check}.
1163
1164 @item ProofGeneral
1165 @pindex ProofGeneral
1166 Use a future version (hopefully v3.4).  Includes special X-Symbol
1167 initialization/handling and defines additional token languages.
1168 @xref{External Languages}.
1169
1170 @item psgml-html
1171 @pindex psgml
1172 @pindex psgml-html
1173 @code{psgml-html}: Do not set @code{html-auto-sgml-entity-conversion} to
1174 non-@code{nil}.  @xref{File IO Packages}, package @code{iso-sgml}.
1175
1176 @item session
1177 @pindex session
1178 Use Version 1.5a or higher.  If strings in this file should always be
1179 read correctly, you should put @code{(x-symbol-init-input)} into your
1180 @file{~/.emacs}; otherwise strings containing X-Symbol's private
1181 characters read from the @file{~/.session} file might look funny.  See
1182 also package @code{desktop} above.
1183
1184 @item x-compose
1185 @pindex x-compose
1186 All characters from @code{x-compose} are also supported by package
1187 X-Symbol.  Thus, I recommend to use @kbd{@key{multi-key}} instead
1188 @kbd{C-=} when running under XEmacs without Mule support.
1189 @xref{Introducing Input Methods}.
1190 @end table
1191
1192 @c ===========================================================================
1193
1194 @node Installing Fonts, Installing Fonts Exceed, Package Integration, Installation
1195 @comment  node-name,  next,  previous,  up
1196 @section Installing Additional Fonts
1197 @cindex Installing Fonts
1198 @cindex Fonts
1199 @cindex X11 Fonts
1200
1201 You don't have to install X-Symbol fonts in usual circumstances (with
1202 the binary distribution, Emacs runs on the same machine, you are happy
1203 with the default fonts).
1204
1205 If your Emacs runs on a different machine, please follow the steps 5 and
1206 6 below or read the next section.
1207
1208 If you want to install additional fonts (since the binary distribution
1209 contains only a limited selection of fonts and font sizes), please
1210 follow the following sequence which worked for me (on SunOS
1211 5.4-5.6/Solaris).  If you have to do s.th. (completely) different on
1212 your system, please let me know---I will include your hints.
1213
1214 If you are lost with the following instructions, use the standard fonts
1215 from the binary distribution.  (Sorry, I do not have to time to answer
1216 general Unix font questions.  Or to be more exact, I'm not an expert in
1217 this area@dots{}.  Nevertheless, if you have a clearer explanation for
1218 the installation sequence below, please send me a patch to
1219 @file{man/x-symbol/x-symbol.texi}.)
1220
1221 @enumerate
1222 @item
1223 @pindex xfd
1224 @pindex xfontsel
1225 Find the font which you want to replace by checking fonts with the X11
1226 program @code{xfontsel} or @code{xfd}.  The bad news is that there is no
1227 general way to say which character belongs to which font.  My only goal
1228 was to use standard fonts whenever possible; the rest belong the the
1229 xsymb1 font (which I have designed).  If you want to use a font as an
1230 alternative to another font, it must have the same charset
1231 registry-encoding.
1232
1233 @item
1234 Find the @file{.bdf} files of your preferred fonts in your file system
1235 or by Internet search engines like Google.  The source distribution of
1236 package X-Symbol contains @file{.bdf} files for additional fonts sizes
1237 of all fonts except the xsymb1 font (@pxref{Wishlist Fonts}).
1238
1239 There are two categories of @file{.bdf} files.  The first category
1240 contains files for fonts which are already installed; the files are
1241 needed to create and install the super- and subscript versions.  Copy
1242 these files to @file{~/.xemacs/xemacs-packages/etc/x-symbol/origfonts/}.  The second
1243 category contains files for fonts which are not installed.  Copy these
1244 files to @file{~/.xemacs/xemacs-packages/etc/x-symbol/fonts/}.
1245
1246 @item
1247 In file @file{~/.xemacs/xemacs-packages/etc/x-symbol/fonts/Makefile},
1248 change variables @code{ORIGBDFS} for the first category and @code{BDFS}
1249 for the second category accordingly.
1250
1251 @item
1252 @pindex perl
1253 In directory @file{~/.xemacs/xemacs-packages/etc/x-symbol/fonts/},
1254 execute @code{make mkdirs}, and @code{make pcfs}.  You need GNUs
1255 @code{make} and @code{perl}, Version 5 (or higher).  You might need to
1256 check the permissions of the created files (@pxref{Installing Files}).
1257
1258 @item
1259 If your Emacs runs on a different machine or if you want to use the
1260 fonts outside Emacs, too, add X-Symbol's fonts to your font path by
1261 inserting the following in your @file{~/.xsession} (X11 startup file).
1262
1263 @pindex xset
1264 @example
1265 xset +fp ~/.xemacs/xemacs-packages/etc/x-symbol/pcf/
1266 @end example
1267
1268 For a system-wide installation, you might want to add this directory to
1269 the system-wide font path instead.
1270
1271 If your system doesn't have @code{xset}, you should copy all @file{.pcf}
1272 files (compiled fonts) from @file{~/.xemacs/xemacs-packages/etc/x-symbol/pcf/} into
1273 directory @file{/usr/lib/X11/fonts/75dpi/} (Slackware distribution) and
1274 run @samp{mkfontdir 75dpi} in that directory.
1275
1276 @item
1277 Your are on the safe side if you restart X11 after this.
1278
1279 @item
1280 Set the Emacs Lisp variables which define the fonts.  @xref{Installing Fonts Lisp}.
1281 @end enumerate
1282
1283 @c ====================================================================
1284
1285 @node Installing Fonts Exceed, Installing Fonts Lisp, Installing Fonts, Installation
1286 @comment  node-name,  next,  previous,  up
1287 @section Installing Fonts for Exceed (X-server on Windows)
1288 @cindex Installing Fonts
1289 @cindex Fonts
1290 @pindex Exceed
1291 @cindex Windows
1292 @cindex Windows
1293 @cindex X-Server
1294
1295 If your X-server on Windows is Exceed and if you have configured
1296 Exceed to use the ``native window manager'' for your Unix screens, you
1297 must install the X-Symbol fonts on Windows.  The following works with
1298 Exceed 6.0 & NT 4.0 and Exceed 7.0 & Windows 2000:
1299
1300 @enumerate
1301 @item
1302 In Unix, edit file @file{~/.xemacs/xemacs-packages/etc/x-symbol/fonts/makesub} to limit 
1303 the shift for superscript to 3 points:
1304 @smallexample
1305 %supoffs = ('08',3, 10,3, 12,3, 14,3, 16,3, 18,3, 24,3);
1306 @end smallexample
1307
1308 @item
1309 Then, execute @code{make mkdirs}, and @code{make gens} in
1310 @file{~/.xemacs/xemacs-packages/etc/x-symbol/fonts/}.  If you have problems, please read 
1311 the previous section.
1312
1313 @item
1314 In Exceed's configuration window, click on @key{Font} to open Window
1315 @file{Font Settings}.  In this window, click on @key{Select All}, then
1316 on @key{Compile Fonts...}.
1317
1318 @item
1319 Copy X-Symbol's @file{bdf} files in @file{~/.xemacs/xemacs-packages/etc/x-symbol/fonts/}
1320 and @file{~/.xemacs/xemacs-packages/etc/x-symbol/genfonts/} to a Windows directory
1321 and select this directory in the Exceed Window @file{Compile Fonts}.
1322 Click on @key{Compile}.
1323
1324 @item
1325 In Window @file{Font Settings}, click on @key{Font Database...}.  In
1326 this window, click on @key{Add...}.  Enter the output directory from the
1327 previous step as the @samp{Font Directory} and @code{xsymb} as the
1328 @samp{File Name (*.fdb)}.  Click on @key{OK}.
1329
1330 @item
1331 You might want to rearrange the sequence of Font DB files to let files
1332 @file{75dpi} appear prior to files @file{100dpi}, because X-Symbol's
1333 fonts are designed for 75dpi.
1334
1335 @item
1336 In Window @file{Font Database}, click on @key{Rebuild Database...} and
1337 then on @key{OK}.
1338 @end enumerate
1339
1340 Note: @emph{Windows NT 4.0 will crash (bluescreen) if you use fonts
1341 compiled by Exceed from the @file{pcf} files or if you missed step 1,
1342 i.e., limiting the superscript shift!}  With Exceed 7.0 & Windows 2000,
1343 there is no crash, but these fonts cannot be displayed.
1344
1345 If you use XEmacs with Exceed as your X-server on Windows, X-Symbol
1346 cannot warn you about undefined fonts, because XEmacs in general cannot
1347 recognizes in that case, whether a font exists.
1348
1349 @c ====================================================================
1350
1351 @node Installing Fonts Lisp, Installing Manual, Installing Fonts Exceed, Installation
1352 @comment  node-name,  next,  previous,  up
1353 @section Lisp Coding when Using Other Fonts
1354 @cindex Font Lisp Setup
1355 @cindex Font Lisp Installation
1356
1357 Package X-Symbol needs to know which fonts to use for the X-Symbol
1358 characters and super- and subscripts.  It also must interact with
1359 package @code{font-lock} to display them (@pxref{Role of font-lock}).
1360
1361 If you have installed additional fonts (@pxref{Installing Fonts}) for
1362 use with package X-Symbol, you might have to change the following
1363 variables:
1364
1365 @vtable @code
1366 @item x-symbol-latin1-fonts
1367 @itemx x-symbol-latin2-fonts
1368 @itemx x-symbol-latin3-fonts
1369 @itemx x-symbol-latin5-fonts
1370 @itemx x-symbol-latin9-fonts
1371 @itemx x-symbol-xsymb0-fonts
1372 @itemx x-symbol-xsymb1-fonts
1373 The value of each variable consists of three elements: one for the
1374 normal text, one for subscripts and one for the superscripts.  Each
1375 element is a list of fonts which are tried in order---the first which
1376 exists on your system is used.
1377
1378 If you change the values of one of these variables, do only specify the
1379 same charset registry@minus{}encoding (e.g., @samp{adobe-fontspecific})
1380 as specified by the fonts in the default value of this variable.
1381
1382 @item x-symbol-font-sizes
1383 Here you can specify the sizes for all fonts in the above mentioned
1384 variables.  The value consists of regular expressions matching font
1385 names and numbers which replace all occurences of @samp{%d} in the
1386 names.
1387 @end vtable
1388
1389 E.g., if you prefer larger fonts, you might want to insert the following
1390 into your @file{~/.emacs}:
1391
1392 @smalllisp
1393 (setq x-symbol-font-sizes
1394   '(18 ("_su[bp]-" . 14) ("\\`-etl-" . 16)))
1395 (setq x-symbol-xsymb0-fonts
1396   '(("-adobe-symbol-medium-r-normal-*-*-%d0-*-*-*-*-adobe-fontspecific"
1397      "-xsymb-xsymb0-medium-r-normal--%d-%d0-75-75-p-85-adobe-fontspecific")
1398     ("-adobe-symbol_sub-medium-r-normal-*-*-%d0-*-*-*-*-adobe-fontspecific"
1399      "-xsymb-xsymb0_sub-medium-r-normal--%d-%d0-75-75-p-74-adobe-fontspecific")
1400     ("-adobe-symbol_sup-medium-r-normal-*-*-%d0-*-*-*-*-adobe-fontspecific"
1401      "-xsymb-xsymb0_sup-medium-r-normal--%d-%d0-75-75-p-74-adobe-fontspecific")))
1402 @end smalllisp
1403
1404 The first assignment changes the font sizes, the second makes X-Symbol
1405 using the original Adobe symbol font instead of my minor modification
1406 (appearance) of it.  The xsymb1 font will be scaled, which might not
1407 look nice (@pxref{FAQ Font Size}).
1408
1409 You might want to change the following variables:
1410
1411 @vtable @code
1412 @item x-symbol-latin-force-use
1413 Package X-Symbol defines Latin characters even when the corresponding
1414 fonts are missing (this can be changed by this variable).  Characters
1415 for the symbol fonts are only defined if the corresponding fonts are
1416 available.
1417
1418 @item x-symbol-mule-change-default-face
1419 Package X-Symbol does not change the fonts of pre-defined Mule charsets
1420 (this can be changed by this variable).  Thus, the variables from
1421 @ref{Installing Fonts Lisp} might have no influence if Emacs
1422 already has defined fonts for the corresponding charsets.
1423 @end vtable
1424
1425 @c ====================================================================
1426
1427 @node Installing Manual, Checking Installation, Installing Fonts Lisp, Installation
1428 @comment  node-name,  next,  previous,  up
1429 @section Installing Info, Postscript and HTML Files
1430 @cindex Installing Manual
1431 @cindex Info
1432 @cindex Texinfo
1433 @cindex Postscript
1434 @cindex HTML
1435 @cindex Manual
1436 @cindex Documentation
1437
1438 @pindex makeinfo
1439 To create the info files, execute @code{make info} in directory
1440 @file{~/.xemacs/xemacs-packages/man/x-symbol/} of the distribution.  It requires
1441 @code{makeinfo}, Version 1.68 or higher.  This should not be necessary
1442 if you use the binary distribution of package X-Symbol.
1443
1444 If no entry for X-Symbol is automatically added to the info directory
1445 listing, add the following line to @file{~/.xemacs/xemacs-packages/info/dir}:
1446 @smallexample
1447 * X-Symbol::     Semi WYSIWYG for LaTeX, HTML and other "token languages"
1448 @end smallexample
1449
1450
1451 @pindex texi2dvi
1452 Optionally, you might want to create a printed document from the @TeX{}info
1453 file.  Execute @code{make ps} in directory @file{~/.xemacs/xemacs-packages/man/x-symbol/}
1454 of the distribution.  It requires @code{texi2dvi}.
1455
1456 @pindex latex2html
1457 Optionally, you can create an online manual for a web browser by
1458 executing @code{make html} in directory @file{~/.xemacs/xemacs-packages/man/x-symbol/} of
1459 the distribution.  It requires @code{texi2html}.
1460
1461 All formats of the manual are created by executing @code{make all}.
1462
1463 @c ====================================================================
1464
1465 @node Checking Installation,  , Installing Manual, Installation
1466 @comment  node-name,  next,  previous,  up
1467 @section Checking the Correct Installation of Package X-Symbol
1468 @cindex Checking Installation
1469 @cindex Final Installation Checks
1470 @cindex Installation Checks
1471
1472 After having completed the installation, exit and restart Emacs.
1473
1474 @itemize @bullet
1475 @item
1476 Type @kbd{M-x show-message-log} to check whether you got problems so
1477 far, e.g., whether errors occurred when loading a file.  If you do,
1478 identity and correct the offender.
1479
1480 @item
1481 Type @kbd{M-x x-symbol-grid} in buffer @file{*scratch*}.  If you get the
1482 Grid but if you see less characters than you see on the web page of
1483 package X-Symbol, you have decided to use other fonts but failed to
1484 install them correctly.  This is also mentioned in buffer
1485 @file{*Warnings*}.  @xref{Installing Fonts}.
1486
1487 @item
1488 Move your mouse pointer to any X-Symbol character in buffer
1489 @file{*X-Symbol Grid (x-symbol charsym)*}, press the right mouse button
1490 and initialize successively all token languages.
1491
1492 @item
1493 Again, type @kbd{M-x show-message-log} to check whether you got problems
1494 so far, e.g., whether errors occurred when loading a file.  If you do,
1495 identity and correct the offender.
1496
1497 @item
1498 If buffer @file{*Warnings*} does not exist in the buffer menu,
1499 everything is fine.  So is (for me as the author of package X-Symbol),
1500 if @samp{X-Symbol} is not mentioned there.  If there is a warning with
1501 @samp{no valid image converter}, you have forgotten to install
1502 ImageMagick (@pxref{Installing Image Converter}).
1503 @end itemize
1504
1505 @c ===========================================================================
1506
1507 @node Concepts, Input Methods, Installation, Top
1508 @comment  node-name,  next,  previous,  up
1509 @chapter Concepts of Package X-Symbol
1510 @cindex Concepts
1511 @cindex Terminology
1512 @cindex Basics
1513
1514 This chapter describes the concepts of package X-Symbol.  It contains
1515 quite a few forward references to feature which are based on these
1516 concepts, such as @ref{Input Methods}, and @ref{Features}.
1517
1518 @menu
1519 * Token Language::              What does a X-Symbol character represent.
1520 * Conversion::                  Decoding tokens, encoding characters.
1521 * Minor Mode::                  How to control the behavior of X-Symbol.
1522 * Poor Mans Mule::              Running X-Symbol under XEmacs/no-Mule.
1523 * Role of font-lock::           Why does X-Symbol need @code{font-lock}.
1524 * Char Group::                  Character group and token classes.
1525 @end menu
1526
1527 @c ===========================================================================
1528
1529 @node Token Language, Conversion, Concepts, Concepts
1530 @comment  node-name,  next,  previous,  up
1531 @section Token Language
1532 @cindex Token Language
1533 @cindex Language
1534
1535 As mentioned in the overview, ``X-Symbol Characters'' in the buffer are
1536 represented by ``tokens'' in the file.  The correspondence between these
1537 is determined by the @dfn{token language} which is in close relation to
1538 the major mode of the current buffer.  E.g., character @code{alpha}
1539 stands for @code{\alpha} in La@TeX{} buffers.
1540
1541 For details of predefined token languages ``@TeX{} macro'' (@code{tex}),
1542 ``@sc{sgml} entity'' (@code{sgml}), ``Bib@TeX{} macro'' (@code{bib}), and
1543 ``@TeX{}info command'' (@code{texi}), see @ref{Supported Languages}.
1544
1545 The token language determines the conversion between X-Symbol characters
1546 and tokens (@pxref{Conversion}), the input methods (@pxref{Input
1547 Methods}), and various other features (@pxref{Features}).
1548
1549 The token language is defined by the following buffer-local variable:
1550
1551 @vtable @code
1552 @item x-symbol-language
1553 Token language used in current buffer.  You can set this variable in the
1554 ``local variables list'' near the end of the file (@pxref{File
1555 Variables,,,@value{emacs},@value{emacsman}}), e.g.:
1556
1557 @example
1558 %% Local Variables:
1559 %% x-symbol-language: tex
1560 %% End:
1561 @end example
1562 @end vtable
1563
1564 Package X-Symbol uses a reasonable value according to the major mode and
1565 the file name of a buffer if the variable is not already buffer-local.
1566 A valid token language is required to turn on X-Symbol Minor mode, see
1567 @ref{Minor Mode}.
1568
1569 A token language must be @dfn{registered}, if you want to use it.  By
1570 default, the above mentioned token languages are registered.
1571
1572 @c ===========================================================================
1573
1574 @node Conversion, Minor Mode, Token Language, Concepts
1575 @comment  node-name,  next,  previous,  up
1576 @section Conversion: Decoding and Encoding
1577 @cindex Conversion
1578 @cindex Decoding
1579 @cindex Encoding
1580
1581 As mentioned, X-Symbol characters in the buffer are represented by
1582 tokens in the file.  Thus, we need some conversion from tokens to
1583 characters, called @dfn{decoding}, and some conversion from characters
1584 to tokens, called @dfn{encoding}.
1585
1586 We have the additional problem that some characters are not only
1587 represented by tokens, but also via some 8bit character encoding.
1588
1589 Package X-Symbol supports the following 8bit character encodings:
1590 Latin-1 (@code{iso-8859-1}), Latin-2 (@code{iso-8859-2}), Latin-3
1591 (@code{iso-8859-3}), Latin-5 (@code{iso-8859-9}), and Latin-9
1592 (@code{iso-8859-15}).  It currently supports less encodings with XEmacs
1593 on Windows (@pxref{Requirements}).
1594
1595
1596 @menu
1597 * Default Coding::              Normal File and Default Encoding.
1598 * File Coding::                 Specific encoding of a file.
1599 * Controlling 8bit Coding::     Do you want to store 8bit characters?
1600 * Unique Decoding::             Restrict decoding to avoid normalization?
1601 * Conversion Commands::         Interactive encoding and decoding.
1602 * Copy with Conversion::        Copy & paste with conversion.
1603 * Char Aliases::                Different charsets include the same chars.
1604 @end menu
1605
1606
1607 @node Default Coding, File Coding, Conversion, Conversion
1608 @comment  node-name,  next,  previous,  up
1609 @subsection Normal File and Default Encoding
1610 @cindex Default Coding
1611 @cindex Default Encoding
1612 @cindex Default Font
1613 @cindex Coding, Default
1614 @cindex Encoding, Default
1615 @cindex Font, Default
1616
1617 As mentioned, some characters have a 8bit file encoding, and X-Symbol
1618 needs to know which 8bit file encoding you use normally when visiting a
1619 file and saving a buffer.
1620
1621 With Mule support, Emacs/XEmacs can recognize the @dfn{normal file
1622 encoding}, also called a coding system (@pxref{Recognize
1623 Coding,,,@value{emacs},@value{emacsman}}).
1624
1625 Without Mule support, XEmacs can usually only support 8bit characters of
1626 one encoding; this encoding corresponds to the charset/registry of your
1627 default font.  Here, the @dfn{normal file encoding} is the default
1628 encoding:
1629
1630 @vtable @code
1631 @item x-symbol-default-coding
1632 The default encoding.  The value must be a symbol denoting one of the
1633 supported encodings or @code{nil}.  The variable must be set before
1634 X-Symbol has been initialized.  @xref{Installing Lisp}.
1635 @end vtable
1636
1637 The @dfn{default encoding} is not only used to determine the normal file
1638 encoding without Mule, but also for the following:
1639
1640 @itemize @bullet
1641 @item
1642 X-Symbol has its own mechanism to recognize a file encoding which only
1643 works with a specified default encoding.  @xref{File Coding}.
1644
1645 @item
1646 The same character can be included in various Latin charsets and
1647 X-Symbol needs to know which of the instances (which Emacs views as
1648 different characters) to support.  @xref{Char Aliases}.
1649
1650 @item
1651 Without Mule support, the default encoding is also needed to decide
1652 which characters have to be faked by 2 characters internally: exactly
1653 the characters in those charsets which do not correspond to the default
1654 encoding.  @xref{Poor Mans Mule}.
1655 @end itemize
1656
1657 To deduce the default value, X-Symbol inspects the Mule language
1658 environment and the output of the shell command @code{locale}, or to be
1659 more exact:
1660
1661 @example
1662 locale -ck code_set_name charmap
1663 @end example
1664
1665 Without Mule support, you get a warning if the command does not exist on
1666 your system or lists an encoding which is not supported by X-Symbol,
1667 such as some Asian encoding.  Value @code{nil} is the same as
1668 @code{iso-8859-1}.
1669
1670 With Mule support, you get a warning if the command lists a supported
1671 encoding which is different from the encoding deduced from the Mule
1672 language environment.  Value @code{nil} makes sure that X-Symbol file
1673 encoding detection (@pxref{File Coding}) only works if Emacs has
1674 detected the same encoding; it works like @code{iso-8859-1} otherwise.
1675
1676
1677 @node File Coding, Controlling 8bit Coding, Default Coding, Conversion
1678 @comment  node-name,  next,  previous,  up
1679 @subsection File Coding of 8bit Characters
1680 @cindex File Coding
1681 @cindex Coding in File
1682 @cindex Encoding in File
1683 @cindex 8bit File Coding
1684 @cindex Latin File Coding
1685 @cindex Recoding
1686
1687 X-Symbol can use a different encoding for single buffers/files, even if
1688 you use X-Symbol on XEmacs without Mule support.  To do so, set the
1689 following buffer-local variable:
1690
1691 @vtable @code
1692 @item x-symbol-coding
1693 8bit character encoding in the file visited by the current buffer.
1694 Value @code{nil} represents the normal file encoding (@pxref{Default
1695 Coding}).
1696
1697 With Mule support, any value other than @code{nil} is considered invalid
1698 if the normal file encoding is neither the same as this value nor the
1699 same as the default encoding.  I.e., if your default encoding is
1700 @code{nil}, X-Symbol's file encoding detection never takes precedence
1701 over Emacs' one, i.e., the normal file encoding.
1702
1703 You can set this variable in the ``local variables list'' near the end
1704 of the file (@pxref{File Variables,,,@value{emacs},@value{emacsman}}),
1705 e.g.:
1706
1707 @example
1708 <!-- Local Variables: -->
1709 <!-- x-symbol-coding: iso-8859-2 -->
1710 <!-- End: -->
1711 @end example
1712 @end vtable
1713
1714 If the variable is not already buffer-local, a reasonable value is
1715 deduced when turning on X-Symbol (@pxref{Minor Mode}) by searching for
1716 some language dependent headers at the beginning of the file:
1717
1718 @vtable @code
1719 @item x-symbol-auto-coding-search-limit
1720 X-Symbol usually searches for something like
1721 @samp{\usepackage[@dots{}]@{inputenc@}} (@pxref{TeX Macro}) or @samp{<meta @dots{}
1722 charset=@dots{}>} (@pxref{SGML Entity}) in the first 10000 characters.
1723 @end vtable
1724
1725 If you choose not to save a file containing 8bit characters
1726 (@pxref{Controlling 8bit Coding}), the file encoding is still important,
1727 since the file might contain 8bit characters when you visit it.
1728
1729 If the file encoding is different to the normal file encoding, X-Symbol
1730 performs the necessary recoding itself.  @dfn{Recoding} changes a
1731 character with code position @var{pos} in one charset to a character
1732 with the same code position @var{pos} in another charset.  If the normal
1733 file encoding is different to the default encoding, X-Symbol also
1734 resolves character aliases (@pxref{Char Aliases}).
1735
1736 If you have specified an invalid file encoding (including an encoding
1737 different to a non-default normal file encoding), we have the following
1738 cases:
1739
1740 @itemize @bullet
1741 @item
1742 If the normal file encoding is unsupported (any file encoding is invalid
1743 in this case) or if the normal file encoding is supported and the file
1744 does not contain 8bit characters, we always encode all X-Symbol
1745 character (@pxref{Controlling 8bit Coding}).  The modeline includes
1746 @samp{-i} to represent the file encoding (@pxref{Minor Mode}), except if
1747 the default encoding is @code{nil}, the normal file encoding is
1748 unsupported, and the variable @code{x-symbol-coding} is not specified.
1749
1750 @item
1751 If the normal file encoding is supported and the file contains at least
1752 one 8bit character, X-Symbol does not touch 8bit characters and never
1753 produces them, neither via decoding (@pxref{Unique Decoding}) nor via
1754 input methods.  The modeline includes @samp{-err} to represent the file
1755 encoding (@pxref{Minor Mode}).
1756 @end itemize
1757
1758 We end with a little example: if your normal file encoding and default
1759 encoding is Latin-1, and you visit a file with
1760 @samp{\usepackage[latin9]@{inputenc@}} producing some document containing
1761 the Euro sign, you see the Euro character in Emacs when X-Symbol is
1762 enabled, but you see the currency character without X-Symbol.
1763
1764
1765 @node Controlling 8bit Coding, Unique Decoding, File Coding, Conversion
1766 @comment  node-name,  next,  previous,  up
1767 @subsection Store or Encode 8bit Characters
1768 @cindex Storing 8bit Characters
1769 @cindex Controlling 8bit Coding
1770 @c @cindex Buffer 8bit Control
1771 @cindex 8bit Coding Control
1772 @cindex Latin in File
1773
1774 You can specify that 8bit characters (according to the coding in your
1775 file, see @ref{File Coding}), are not encoded to tokens (when saving a
1776 file), by setting the following buffer-local variable:
1777
1778 @vtable @code
1779 @item x-symbol-8bits
1780 Whether to store 8bit characters when saving the current buffer.
1781
1782 You can set this variable in the ``local variables list'' near the end
1783 of the file (@pxref{File Variables,,,@value{emacs},@value{emacsman}}),
1784 e.g.:
1785
1786 @example
1787 %% Local Variables:
1788 %% x-symbol-8bits: t
1789 %% End:
1790 @end example
1791 @end vtable
1792
1793 If the variable is not already buffer-local, a reasonable value is
1794 deduced when turning on X-Symbol (@pxref{Minor Mode}) by setting it the
1795 the value of @code{x-symbol-coding}, or searching in the file for 8bit
1796 characters:
1797
1798 @vtable @code
1799 @item x-symbol-auto-8bit-search-limit
1800 If there is a 8bit character in the file when visiting it, X-Symbol will
1801 also store 8bit characters when saving the buffer.
1802 @end vtable
1803
1804 If the file encoding is invalid (@pxref{File Coding}), we always search
1805 for 8bit characters in the complete document and set
1806 @code{x-symbol-8bits} accordingly.  Then, a non-@code{nil} value also
1807 implies unique decoding (@pxref{Unique Decoding}).
1808
1809 While the variable @code{x-symbol-8bits} usually only influences the
1810 encoding, it also influences the decoding if you choose to decode
1811 uniquely (@pxref{Unique Decoding}).
1812
1813 Setting variable @code{x-symbol-8bits} to @code{nil} does not
1814 necessarily mean that the file will not contain 8bit characters: the
1815 characters might have no token representation in the current token
1816 language (@pxref{TeXinfo Command}), or they are glyphs for ununsed code
1817 points in the Latin-3 charset.  In both cases, it is unlikely that you
1818 have inserted these invalid characters via X-Symbol's input methods
1819 (@pxref{Introducing Input Methods}), you have probably copied them into
1820 the current buffer.
1821
1822
1823 @node Unique Decoding, Conversion Commands, Controlling 8bit Coding, Conversion
1824 @comment  node-name,  next,  previous,  up
1825 @subsection Unique Decoding
1826 @cindex Unique Decoding
1827 @cindex Restricted Decoding
1828 @cindex Unique @TeX{} macro
1829
1830 Token languages might define more than one token representing the same
1831 character.  When decoding and encoding these tokens, they will be
1832 @dfn{normalized} to one form, the @dfn{canonical representation}.  E.g.,
1833 with language @code{tex}, visiting a file with tokens @code{\neq} and
1834 @code{\ne} converts both tokens to character @code{lessequal}, saving
1835 the buffer stores the character as token @code{\neq} in both
1836 occurrences.
1837
1838 It can also happen that a file contains both a 8bit character and a
1839 token which would be converted to exactly that character.  When saving
1840 the file, both characters are either not encoded, or both are encoded to
1841 the same token.
1842
1843 Normally, this is no problem.  But if you redefine standard @TeX{}
1844 macros, it certainly could be the case (@pxref{TeX Macro Problems})!
1845 For this reason, package X-Symbol provides the following buffer-local
1846 variable:
1847
1848 @vtable @code
1849 @item x-symbol-unique
1850 Whether to limit the decoding in such a way that no normalization will
1851 happen.  That means: only decode canonical tokens, and, if
1852 @code{x-symbol-8bits} is non-@code{nil} (@pxref{Controlling 8bit
1853 Coding}), do not decode tokens which would be decoded to 8bit characters
1854 (according to the coding in your file, see @ref{File Coding}).
1855
1856 You can set this variable in the ``local variables list'' near the end
1857 of the file (@pxref{File Variables,,,@value{emacs},@value{emacsman}}),
1858 e.g., together with a setting for @code{x-symbol-8bits}:
1859
1860 @example
1861 %% Local Variables:
1862 %% x-symbol-8bits: t
1863 %% x-symbol-unique: t
1864 %% End:
1865 @end example
1866 @end vtable
1867
1868 If the variable is not already buffer-local, a reasonable value is
1869 deduced when turning on X-Symbol (@pxref{Minor Mode}): it will be set to
1870 @code{t} if X-Symbol mode is not automatically turned on.
1871
1872 If the file encoding is invalid (@pxref{File Coding}) and
1873 @code{x-symbol-8bits} is non-@code{nil} (@pxref{Controlling 8bit
1874 Coding}), X-Symbol always uses unique decoding (@pxref{Unique
1875 Decoding}).
1876
1877
1878 @node Conversion Commands, Copy with Conversion, Unique Decoding, Conversion
1879 @comment  node-name,  next,  previous,  up
1880 @subsection Conversion Commands
1881 @cindex Conversion Commands
1882 @cindex Automatic Conversion
1883 @cindex Interactive Conversion
1884 @cindex Explicit Conversion
1885
1886 First the good news: most of the time, the necessary conversions are
1887 performed automatically when you would expect them to be performed:
1888
1889 @itemize @bullet
1890 @item
1891 Turning X-Symbol minor mode (@pxref{Minor Mode}) on/off also performs
1892 decoding/encoding.
1893
1894 @item
1895 Saving a buffer where X-Symbol is enabled will encode the characters to
1896 tokens in the file (of course, you keep to have the characters in the
1897 buffer).
1898
1899 @item
1900 Inserting a file into a buffer where X-Symbol is enabled will decode the
1901 tokens in the inserted region.
1902 @end itemize
1903
1904 Nevertheless, you might want to perform the conversions explicitly in
1905 some situations by using one of the following commands (also to be found
1906 in the menu):
1907
1908 @table @kbd
1909 @item M-x x-symbol-decode-recode
1910 @findex x-symbol-decode-recode
1911 Recode all characters (if necessary) and decode all tokens to
1912 characters.
1913
1914 @item M-x x-symbol-decode
1915 @findex x-symbol-decode
1916 Decode all tokens to characters, do not recode characters.
1917
1918 @item M-x x-symbol-encode-recode
1919 @findex x-symbol-encode-recode
1920 Encode all characters in buffer to tokens or recode them.
1921
1922 @item M-x x-symbol-encode
1923 @findex x-symbol-encode
1924 Encode all characters in buffer to tokens.  No recoding will be
1925 performed since 8bit characters will always be encoded if the file
1926 coding is different to the default coding, since @code{x-symbol-8bits}
1927 is relative to the file coding, see @ref{Controlling 8bit Coding}.
1928 @end table
1929
1930 All commands work on the region if it is active, or the (narrowed part
1931 of the) buffer if no region is active.
1932
1933 If the file coding is the same as the default coding, the variants with
1934 and without recoding (@pxref{File Coding}) do the same.  The variants
1935 with recodings are the ones used when doing the conversion
1936 automatically.  The variants without recodings are the ones used when
1937 using the special Copy & Paste commands presented in the next
1938 subsection.
1939
1940
1941 @node Copy with Conversion, Char Aliases, Conversion Commands, Conversion
1942 @comment  node-name,  next,  previous,  up
1943 @subsection Copy & Paste with Conversion
1944 @cindex Copy and Conversion
1945 @cindex Copy Encoded
1946 @cindex Paste and Conversion
1947 @cindex Paste Decoded
1948 @cindex Yank Decoded
1949
1950 You probably use X-Symbol, because you want to produce some
1951 non-@sc{ascii} characters in your final document, but you are not really
1952 interested what kind of token you would need to write.  (After all, you do
1953 not use a hex editor to produce documents using some non-@sc{ascii}
1954 encoding in the file, since you are not interested in the byte sequence
1955 of individual characters.)
1956
1957 Consequently, all editing operations really work on characters, not on
1958 the corresponding tokens for the token language of the current buffer.
1959 This includes copying and pasting: if you copy the character
1960 @code{plusminus} from a LaTeX buffer to a HTML buffer, you really copy
1961 that character and not the three characters of the TeX macro @code{\pm}.
1962
1963 If you copy text to a buffer where X-Symbol is not enabled, like a mail
1964 buffer, that is probably not what you want.  Similarly, you would
1965 probably like to see the X-Symbol characters for tokens in a text which
1966 you have copied from such a buffer.  Therefore, X-Symbol provides the
1967 following commands (also to be found in the menu):
1968
1969 @table @kbd
1970 @item M-x x-symbol-copy-region-encoded
1971 @findex x-symbol-copy-region-encoded
1972 @vindex kill-ring
1973 Save the region in the @code{kill-ring} with all X-Symbol characters
1974 encoded like by @kbd{M-x x-symbol-encode}, i.e., without recoding.
1975
1976 @item M-x x-symbol-yank-decoded
1977 @findex x-symbol-yank-decoded
1978 Reinsert the last text in the @code{kill-ring} and decode the inserted
1979 text like @kbd{M-x x-symbol-decode}, i.e., without recoding.
1980 @end table
1981
1982 You could get the same result with the usual copy & paste commands and
1983 the conversion commands from the previous section (@pxref{Conversion
1984 Commands}), but this would clutter the undo information of the current
1985 buffer and would require an additional undo operation for the copy.
1986
1987
1988 @node Char Aliases,  , Copy with Conversion, Conversion
1989 @comment  node-name,  next,  previous,  up
1990 @subsection Character Aliases
1991 @cindex Char Aliases
1992 @cindex Character Aliases
1993 @cindex Aliases of Characters
1994 @cindex Latin Character Aliases
1995 @cindex Remapping Characters
1996
1997 A @dfn{character alias} or @dfn{char alias} is a character which is also
1998 a character in a font with another registry, e.g., @code{adiaeresis} is
1999 defined in all supported Latin fonts.  Emacs distinguish between these
2000 five characters.  In package X-Symbol, one of them, with
2001 @code{x-symbol-default-coding} (@pxref{Default Coding} if possible, is
2002 supported by the input methods, the other ones are char aliases to the
2003 supported one.
2004
2005 The reason is that it would be confusing for the user to choose among
2006 different @code{adiaeresis}es and that there are neither different
2007 @code{adiaeresis}es in Unicode nor in the token representations of
2008 languages @code{tex} and @code{sgml}.
2009
2010 8bit characters in files with a file coding @code{x-symbol-coding} other
2011 than @code{x-symbol-default-coding} are converted to the ``normal''
2012 form.  E.g., if you have a Latin-1 font by default, the
2013 @code{adiaeresis} in a Latin-2 encoded file is a Latin-1
2014 @code{adiaeresis} in the buffer.  When saving the buffer, its is again
2015 the right 8bit character in the Latin-2 encoded file.
2016
2017 Thus, in normal cases, buffers do not have char aliases.  In Emacs with
2018 Mule support, this is only possible if you copy characters from buffers
2019 with characters considered as char aliases by package X-Symbol, e.g.,
2020 from the Mule file @file{european.el}.  In XEmacs without Mule support,
2021 this is only possible if you use commands like @kbd{C-q 2 3 4}.
2022
2023 If you have char aliases in the current buffer, you might want to use
2024 (it is not really necessary, just when searching for characters):
2025
2026 @table @kbd
2027 @item M-x x-symbol-unalias
2028 @findex x-symbol-unalias
2029 Resolve all character aliases in buffer.  If the region is active, only
2030 resolve char aliases in the region.
2031 @end table
2032
2033 A single char alias before point can be resolved by command
2034 @code{x-symbol-modify-key} and @code{x-symbol-rotate-key}, see
2035 @ref{Input Method Context}.
2036
2037 @pindex latin-unity
2038 The XEmacs package @code{latin-unity} provides a command to ``remap''
2039 characters to one character set (if possible).  X-Symbol's unaliasing
2040 can be seen as remap operations to a fixed sequence of character sets.
2041
2042 @c ===========================================================================
2043
2044 @node Minor Mode, Poor Mans Mule, Conversion, Concepts
2045 @comment  node-name,  next,  previous,  up
2046 @section Minor Mode
2047 @cindex Minor Mode
2048 @cindex Mode
2049 @cindex X-Symbol Mode
2050
2051 X-Symbol is a minor mode (@pxref{Minor
2052 Modes,,,@value{emacs},@value{emacsman}}) which enables the features
2053 mentioned in this manual:
2054
2055 @itemize @bullet
2056 @item
2057 X-Symbol mode is required to do the conversions.  Turning the minor mode
2058 on/off also includes decoding/encoding (@pxref{Conversion Commands}).
2059
2060 @item
2061 X-Symbol mode provides the minor mode menu which includes: various
2062 commands, commands to insert characters (@pxref{Input Method Menu}), and
2063 entries to change some global and buffer-local variables mentioned in
2064 this manual.
2065
2066 @item
2067 X-Symbol mode is required for most input methods (@pxref{Input Methods})
2068 and other features (@pxref{Features}).
2069 @end itemize
2070
2071 With the default installation, X-Symbol mode is automatically turned on
2072 when it is appropriate to do so (see below for details).  You can
2073 control it for individually by the following command:
2074
2075 @table @kbd
2076 @item M-x x-symbol-mode
2077 @findex x-symbol-mode
2078 @vindex x-symbol-mode
2079 Toggle X-Symbol mode.  If provided with a prefix argument, turn X-Symbol
2080 mode on if the numeric value of the argument is positive, else turn it
2081 off.  If no token language can be deduced, ask for a token language; if
2082 provided with a non-numeric prefix argument (@kbd{C-u M-x
2083 x-symbol-mode}), always ask.
2084
2085 By default, X-Symbol mode is disabled in special major-modes visiting a
2086 file, e.g., @code{vm-mode} (@pxref{FAQ News and Mail}).  Use a prefix
2087 argument to be asked whether to turn in on anyway.
2088 @end table
2089
2090 Turning X-Symbol mode on requires that you have a valid token language
2091 for the current buffer.  Since turning X-Symbol mode on also decodes
2092 tokens, it is also useful to set the variables which control the
2093 conversion (@pxref{Conversion}).
2094
2095 Since people usually do not want to write some Emacs Lisp functions to
2096 do some customizations, X-Symbol provides the following variables which
2097 induce X-Symbol to set the necessary buffer-local variables when
2098 X-Symbol is turned on:
2099
2100 @vtable @code
2101 @item x-symbol-auto-style-alist
2102 You can use the major mode and/or the name of the buffer or visited
2103 file, and specific functions to set the following variables (if not
2104 already buffer-local):
2105
2106 @itemize @minus
2107 @item
2108 @code{x-symbol-token-language} (@pxref{Token Language}), indicated in
2109 the modeline, e.g. @samp{tex},
2110 @item
2111 @code{x-symbol-mode}, i.e., whether it is appropriate to turn on
2112 X-Symbol mode automatically,
2113 @item
2114 @code{x-symbol-coding} (@pxref{File Coding}), indicated in the modeline
2115 if different from the default coding, e.g. @samp{-l2} for Latin-2,
2116 @item
2117 @code{x-symbol-8bits} (@pxref{Controlling 8bit Coding}), indicated in
2118 the modeline by @samp{8},
2119 @item
2120 @code{x-symbol-unique} (@pxref{Unique Decoding}), indicated in
2121 the modeline by @samp{*},
2122 @item
2123 @code{x-symbol-subscripts} (@pxref{Super and Subscripts}), indicated in
2124 the modeline by @samp{s},
2125 @item
2126 @code{x-symbol-image} (@pxref{Images}), indicated in the modeline by
2127 @samp{i},
2128 @end itemize
2129
2130 @item x-symbol-@var{lang}-modes
2131 Major modes which use token language @var{lang} by default.
2132 @xref{Supported Languages}.  The languages are checked in registration
2133 order (the order shown in the language selection submenus).
2134
2135 @item x-symbol-@var{lang}-auto-style
2136 Default values for the above mentioned variables @code{x-symbol-mode},
2137 @code{x-symbol-coding}, @code{x-symbol-8bits}, @code{x-symbol-unique},
2138 @code{x-symbol-subscripts}, and @code{x-symbol-image} if not already
2139 buffer-local.
2140
2141 @item x-symbol-auto-mode-suffixes
2142 Regular expression matching file suffixes to be ignored when checking
2143 file names for the derivation above, e.g., extension @file{.orig}.
2144
2145 @item x-symbol-modeline-state-list
2146 This variable controls the modeline appearance just mentioned.
2147
2148
2149 The menu might also include individual entries for a token
2150 language (@pxref{TeX Macro Basics}):
2151
2152 @item x-symbol-@var{lang}-extra-menu-items
2153 Extra menu items for each token language @var{lang} (@pxref{TeX Macro
2154 Basics}).
2155 @end vtable
2156
2157 @c ====================================================================
2158
2159 @node Poor Mans Mule, Role of font-lock, Minor Mode, Concepts
2160 @comment  node-name,  next,  previous,  up
2161 @section Poor Man's Mule: Running Under XEmacs/no-Mule
2162 @cindex Poor Man's Mule
2163 @cindex No Mule
2164 @cindex XEmacs without Mule
2165
2166 Using XEmacs/no-Mule normally means that you are restricted to use not
2167 more than 256 different characters in your documents.
2168
2169 Package X-Symbol provides a lot more characters which can also be used
2170 with XEmacs/no-Mule.  Internally, all X-Symbol characters except the
2171 ones of your default font (@pxref{Default Coding}) are represented by
2172 two characters, see @ref{Char Representation}.
2173
2174 This can lead to a lot of problems, which are resolved by the following
2175 methods (some annoyances remain, @pxref{Nomule Problems}) when X-Symbol
2176 mode is turned on (@pxref{Minor Mode}):
2177
2178 @itemize @bullet
2179 @item
2180 After each editing command, i.e., point movement, deletion of text and
2181 insertion of text, package X-Symbol checks whether just one of the two
2182 internal characters of an X-Symbol character has been affected.
2183
2184 @item
2185 Package @code{font-lock} is used to display these two-character
2186 sequences with the correct fonts.  The potential problem lies in the
2187 set-up of the corresponding font-lock keywords, see @ref{Role of
2188 font-lock}.
2189
2190 @ftable @code
2191 @item x-symbol-nomule-fontify-cstrings
2192 Alternatively to enabling @code{font-lock}, you can run this functions
2193 in buffers having the special two-character sequences.  With the default
2194 installation, this function is run in the selection buffers of package
2195 @code{reftex}.
2196 @end ftable
2197 @end itemize
2198
2199 @c ====================================================================
2200
2201 @node Role of font-lock, Char Group, Poor Mans Mule, Concepts
2202 @comment  node-name,  next,  previous,  up
2203 @section The Role of @code{font-lock}
2204 @cindex Role of @code{font-lock}
2205 @cindex @code{font-lock} Use
2206 @cindex Special Fonts
2207
2208 Package X-Symbol uses package @code{font-lock} to display super- and
2209 subscripts (@pxref{Super and Subscripts}) and to display its special
2210 characters under XEmacs/no-Mule (@pxref{Poor Mans Mule}).  Thus, you
2211 should enable @code{font-lock} in buffers where you want to use X-Symbol
2212 (it is by default).  @xref{Syntax Hiliting Packages}.
2213
2214 When X-Symbol mode is turned on, it automatically adds the necessary
2215 font-lock keywords to the buffer-local value of
2216 @code{font-lock-keywords} and all font-lock keywords which are commonly
2217 used with the current token language.
2218
2219 Setting all font-lock keywords is important since @code{font-lock} might
2220 not yet been turned on or since you might want to change
2221 @code{font-lock}s decoration of the current buffer after X-Symbol has
2222 been turned on.
2223
2224 Please note that switching the mode by typing @kbd{M-x latex-mode}
2225 @emph{does not set} the La@TeX{}'s font-lock keywords!  They are set at
2226 the end of @kbd{C-x C-f}.  If you switch the mode, turn on
2227 @code{font-lock} by yourself.
2228
2229 Independently from package X-Symbol, the following command might be
2230 useful in some situations:
2231
2232 @table @kbd
2233 @item M-x x-symbol-fontify
2234 @findex x-symbol-fontify
2235 Refontify buffer.
2236 @end table
2237
2238 @c ====================================================================
2239
2240 @node Char Group,  , Role of font-lock, Concepts
2241 @comment  node-name,  next,  previous,  up
2242 @section Character Group and Token Classes
2243 @cindex Character Group
2244 @cindex Group of Characters
2245 @cindex Similar Characters
2246 @cindex Category of Character
2247 @cindex Syntax of Character
2248 @cindex Token Classes
2249 @cindex Classes of Tokens
2250 @cindex Coloring Scheme
2251
2252 Each X-Symbol character belongs to a @dfn{character group}, e.g.,
2253 @code{natnums} belongs to @code{setsymbol}.  A character group should
2254 consists of similar characters where ``similar'' means similar meaning,
2255 not similar appearance.  Two characters which have nearly the same
2256 appearance, should be in the same group, though.  The group determines:
2257
2258 @itemize @bullet
2259 @item
2260 The Grid and submenu header under which the character can be found
2261 (@pxref{Input Method Grid}, @ref{Input Method Menu}).
2262
2263 @item
2264 The default bindings of characters (@pxref{Input Method Keyboard}) of
2265 some groups.
2266
2267 @item
2268 Whether to show the context info for a character (@pxref{Info}).
2269
2270 @item
2271 The default @sc{ascii} representation of a character (@pxref{Ascii
2272 Representation}).
2273
2274 @item
2275 When using Emacs/XEmacs with Mule support, the syntax of a character
2276 (@pxref{Syntax,,,@value{emacs},@value{emacsman}}).
2277 @end itemize
2278
2279 The character group is independent from any token language, but is
2280 probably somewhat related to some of its @dfn{token classes}.  For each
2281 token language, each character is assigned to a list of token classes,
2282 which can be used for the following:
2283
2284 @itemize @bullet
2285 @item
2286 Information in the echo area (@pxref{Info}), it could inform users to
2287 include a specific La@TeX{} package when they want to use that character
2288 in the document.
2289
2290 @item
2291 Using a @dfn{coloring scheme} when displaying the characters in the echo
2292 area (@pxref{Info}) or the Grid of characters (@pxref{Input Method
2293 Grid}), useful for characters which can just be used in a specific
2294 context, like @TeX{}'s math-mode characters.
2295
2296 @item
2297 Restricting the ``electricity'' of input method Electric (@pxref{Input
2298 Method Electric}), useful to disable this input methods for @TeX{}'s
2299 math-mode characters if we are in text-mode.
2300 @end itemize
2301
2302 The token classes for individual token languages are explained in the
2303 corresponding sections of @ref{Supported Languages}:
2304
2305 @vtable @code
2306 @item x-symbol-@var{lang}-header-groups-alist
2307 The Grid and Menu headers for each token language @var{lang}.
2308
2309 @item x-symbol-@var{lang}-class-alist
2310 Strings for the character info in the echo area for each token language
2311 @var{lang}.
2312
2313 @item x-symbol-@var{lang}-class-face-alist
2314 The coloring scheme for each token language @var{lang}.
2315 @end vtable
2316
2317 @c ===========================================================================
2318
2319 @node Input Methods, Features, Concepts, Top
2320 @comment  node-name,  next,  previous,  up
2321 @chapter X-Symbol's Input Methods
2322 @cindex Input Methods
2323 @cindex Character Insertion
2324
2325 An X-Symbol @dfn{input method} is a way, provided by package X-Symbol,
2326 to insert a X-Symbol character (not in the sense of Mule's ``input
2327 methods'').  For a short overview with screenshots, see the
2328 @uref{@value{url}/details.html,web pages of X-Symbol}.
2329
2330 Input methods Token and Electric change the normal way to insert
2331 characters a bit.  Therefore, they require X-Symbol mode to be turned on
2332 and can be turned off explicitly.  The other input methods are provided
2333 with additional commands and key prefixes, they can also be used in
2334 buffers where X-Symbol mode is turned off.
2335
2336 With Auc@TeX{}, Version 9.8a or higher, its math mode commands also
2337 inserts X-Symbol characters
2338 (@pxref{Mathematics,,,@value{auctex},@value{auctexman}}).
2339
2340 @menu
2341 * Introducing Input Methods::   Common behavior of all input methods.
2342 * Input Method Token::          Replace token by character.
2343 * Input Method Read Token::     Minibuffer input with completion.
2344 * Input Method Menu::           Select a menu item.
2345 * Input Method Grid::           Choose highlighted character.
2346 * Input Method Keyboard::       Compose a key sequence.
2347 * Input Method Context::        Replace character sequence.
2348 * Input Method Electric::       Automatically replace character sequence.
2349 * Input Method Quail::          A Mule input method "x-symbol".
2350 * Customizing Input Method::    How to customize the input methods.
2351 @end menu
2352
2353 @c ===========================================================================
2354
2355 @node Introducing Input Methods, Input Method Token, Input Methods, Input Methods
2356 @comment  node-name,  next,  previous,  up
2357 @section Common Behavior of All Input Methods
2358 @cindex Input Methods, General
2359 @cindex Input Methods, Common
2360 @cindex Input Methods, Standard
2361 @cindex Valid Character
2362 @cindex Allowed Character
2363 @cindex Key Prefix
2364 @cindex Prefix Argument
2365 @cindex Prefix Key
2366 @cindex Defined Character
2367 @cindex Compose Key
2368
2369 Input methods normally just inserts @dfn{valid characters} which are
2370 those characters which have a useful representation in the file:
2371
2372 @vtable @code
2373 @item x-symbol-valid-charsym-function
2374 When X-Symbol is turned off, a character is valid if it is an 8bit
2375 character according to the value of @code{x-symbol-default-coding}.
2376
2377 When X-Symbol is turned on, a character is valid if the characters could
2378 be encoded to a token in language @code{x-symbol-language} (@pxref{Token
2379 Language}).
2380 @end vtable
2381
2382 If a buffer is read-only (@pxref{Misc
2383 Buffer,,,@value{emacs},@value{emacsman}}), most input methods push the
2384 character to insert onto the kill ring instead.  Typing @kbd{C-y} lets
2385 you then insert the character
2386 (@pxref{Yanking,,,@value{emacs},@value{emacsman}}).
2387
2388 The input methods Keyboard, Menu and Grid (the character selection with
2389 @kbd{@key{button2}}) have the same interpretation of the prefix
2390 argument:
2391
2392 @itemize @bullet
2393 @item
2394 With prefix argument @samp{0}, do not insert anything, just barf, if the
2395 character is not valid.
2396
2397 @item
2398 With a positive prefix argument, insert a character that many times.
2399 Barf, if the character is not valid.
2400
2401 @item
2402 With a negative prefix argument, insert a character as many times as
2403 specified by the absolute value of the prefix argument.  A character is
2404 also inserted if it is not valid.
2405
2406 @item
2407 With one or more @kbd{C-u}s with no digits, insert the token of a
2408 language to choose, including ``x-symbol charsym'' (@pxref{Pseudo
2409 Language}).
2410 @end itemize
2411
2412 Many input commands of package X-Symbol uses the same key prefix in its
2413 default binding:
2414
2415 @vtable @code
2416 @item x-symbol-compose-key
2417 @kindex C-=
2418 @kindex @key{multi-key}
2419 By default, @kbd{C-=} is used as the key prefix.  Under XEmacs/no-Mule,
2420 you might want to use @kbd{@key{multi-key}} instead:
2421
2422 @lisp
2423 (unless (featurep 'mule) (setq x-symbol-compose-key '(multi-key)))
2424 @end lisp
2425
2426 @item x-symbol-auto-key-autoload
2427 Set this to @code{nil}, if you do not want that pressing @kbd{C-=}
2428 automatically initializes the input methods.
2429 @end vtable
2430
2431 @c ===========================================================================
2432
2433 @node Input Method Token, Input Method Read Token, Introducing Input Methods, Input Methods
2434 @comment  node-name,  next,  previous,  up
2435 @section Input Method Token: Replace Token by Character
2436 @cindex Input Method Token
2437 @cindex Token, Input Method
2438 @cindex Replace Token
2439 @cindex Abbrev, Token           @c pre-2.2
2440
2441 If X-Symbol mode is on, input method @dfn{Token} automatically replaces
2442 the token by the corresponding character when inserting the next
2443 character following the token (in some token languages you need the next
2444 character to decide whether the token is completed) if it is valid.
2445
2446 The token will be replaced only if the next character has been inserted
2447 without prefix argument or with prefix argument 0 (@kbd{C-u 0}), the
2448 latter will therefore just induce the replacement.
2449
2450 Please note that the token is really replaced by the characters, it is
2451 not just @code{font-lock} which highlights the token to look like a
2452 character.
2453
2454 You might want to press @kbd{C-/} or @kbd{C-x u} to undo the
2455 replacement.  Input method Token requires X-Symbol mode to be enabled,
2456 it can be disabled (and re-enabled) by setting the following variable:
2457
2458 @vtable @code
2459 @item x-symbol-token-input
2460 A boolean which can also be changed via the X-Symbol menu.
2461 @end vtable
2462
2463 Individual token language might slightly change the way input method
2464 Token works exactly; from the predefined language, it is just @code{tex}
2465 (@pxref{TeX Macro}).
2466
2467 @c ===========================================================================
2468
2469 @node Input Method Read Token, Input Method Menu, Input Method Token, Input Methods
2470 @comment  node-name,  next,  previous,  up
2471 @section Input Method Read Token: Minibuffer Completion
2472 @cindex Input Method Read Token
2473 @cindex Read Token, Input Method
2474 @cindex Minibuffer Completion, Token
2475
2476 You can insert a character by reading the corresponding token in the
2477 minibuffer.  You are offered completion over the known tokens
2478 (@pxref{Completion,,,@value{emacs},@value{emacsman}}).
2479
2480 @table @kbd
2481 @item M-x x-symbol-read-token-direct
2482 @itemx C-= @key{TAB}
2483 @findex x-symbol-read-token-direct
2484 @kindex C-= @key{TAB}
2485 Insert character by selecting a token in the current token language
2486 (even if X-Symbol mode is turned off) or an ``x-symbol charsym''
2487 (@pxref{Pseudo Language}).
2488
2489 @item M-x x-symbol-read-token
2490 @itemx C-= @key{RET}
2491 @findex x-symbol-read-token
2492 @kindex C-= @key{RET}
2493 Insert character by first selecting the token language and then a token
2494 in that language.
2495 @end table
2496
2497 Input method Read Token also works if X-Symbol mode is not enabled.  It
2498 uses the common interpretation of prefix arguments for X-Symbol insert
2499 commands, see @ref{Introducing Input Methods}.
2500
2501 @c ===========================================================================
2502
2503 @node Input Method Menu, Input Method Grid, Input Method Read Token, Input Methods
2504 @comment  node-name,  next,  previous,  up
2505 @section Input Method Menu: Select a Menu Item
2506 @cindex Input Method Menu
2507 @cindex Menu, Input Method
2508
2509 If X-Symbol mode is turned on, a @dfn{Menu} @code{X-Symbol} appears in
2510 the menubar (@pxref{Minor Mode}).  It also appears over non-highlighted
2511 parts in the Grid and the Key Completions buffer (@pxref{Input Method
2512 Grid}).  The menu allows to change buffer-local and global variables
2513 (some directly, some via package @code{custom}).  It has a submenu with
2514 the most interesting commands of package X-Symbol.
2515
2516 The menu has submenus with commands to insert X-Symbol characters.  The
2517 submenu headers are the same as the headers in the Grid, see
2518 @ref{Char Group}.  The appearance of the menu can be customized:
2519
2520 @vtable @code
2521 @item x-symbol-local-menu
2522 With a valid token language, the X-Symbol menu only contains insertion
2523 commands for valid characters.  The entries are mentioned and sorted
2524 according to the token.  Otherwise, the X-Symbol menu contains all
2525 characters, the entries are mentioned according to their charsym name.
2526
2527 @item x-symbol-menu-max-items
2528 The submenus do not contain more than 30 insertion commands for X-Symbol
2529 characters.  A submenu is split if necessarily.
2530 @end vtable
2531
2532 Input method Menu also works if X-Symbol mode is not enabled.  It uses
2533 the common interpretation of prefix arguments for X-Symbol insert
2534 commands, see @ref{Introducing Input Methods}.
2535
2536 @c ===========================================================================
2537
2538 @node Input Method Grid, Input Method Keyboard, Input Method Menu, Input Methods
2539 @comment  node-name,  next,  previous,  up
2540 @section Input Method Grid: Choose Highlighted Character
2541 @cindex Input Method Grid
2542 @cindex Grid, Input Method
2543 @cindex Table of Characters
2544 @cindex Highlighted Character
2545
2546 Probably the easiest way to insert a character is by using a @dfn{Grid}
2547 of characters:
2548
2549 @table @kbd
2550 @item M-x x-symbol-grid
2551 @itemx C-= C-=
2552 @findex x-symbol-grid
2553 @kindex C-= C-=
2554 Pops up a buffer displaying X-Symbol characters in a grid like fashion.
2555 You can select a character with the mouse or @kbd{@key{RET}}, see below.
2556 @end table
2557
2558 In the Grid buffer and the buffer with the possible completions for an
2559 X-Symbol key sequence (@pxref{Input Method Keyboard}), the following
2560 commands are used if the mouse pointer is over an highlighted character.
2561
2562 @table @kbd
2563 @item @key{button2}
2564 @itemx @key{RET}
2565 @itemx @key{SPC}
2566 @c @itemx x-symbol-list-selected
2567 @kindex @key{button2}
2568 @kindex @key{RET}
2569 @kindex @key{SPC}
2570 @c @findex x-symbol-list-selected
2571 Insert highlighted character (or character under point, respectively)
2572 into the buffer of @code{point} if @code{point} is not in the same
2573 buffer as the highlighted character.  Otherwise, insert the character
2574 into the reference buffer, i.e., the buffer where you have invoked the
2575 grid or the key completions from.  (The reference to the buffer is
2576 erased when an X-Symbol character is inserted into any buffer.)
2577
2578 @item @key{button3}
2579 @kindex @key{button3}
2580 Pops up a highlight menu where you can select to insert the token of
2581 various token languages instead the character itself.  In order not to
2582 load and initialize all additional token language you have not yet used,
2583 the menu offers to do so explicitly for supported (registered) token
2584 languages (@pxref{Token Language}).
2585 @end table
2586
2587 Over all non-highlighted parts, the following commands are used:
2588
2589 @table @kbd
2590 @item @key{button2}
2591 @kindex @key{button2}
2592 @c @findex x-symbol-list-selected
2593 Scroll Grid or Key Completions buffer down in upper half of the window
2594 and scroll up in the lower half of the window.
2595
2596 @item @key{button3}
2597 @kindex @key{button3}
2598 Pops up the X-Symbol menu, see @ref{Input Method Menu}).
2599 @end table
2600
2601 When using the keyboard to select a character, the following command
2602 could be useful:
2603
2604 @table @kbd
2605 @item M-x x-symbol-list-info
2606 @itemx ?
2607 @itemx h
2608 @itemx i
2609 @findex x-symbol-list-info
2610 @kindex ?
2611 @kindex h
2612 @kindex i
2613 Display info for character under point in echo area.
2614
2615 @item M-x x-symbol-list-bury
2616 @itemx q
2617 @findex x-symbol-list-bury
2618 @kindex q
2619 Bury list buffer while trying to use the old window configuration.
2620 @end table
2621
2622 You can control the grid by the following variables:
2623
2624 @vtable @code
2625 @item x-symbol-local-grid
2626 With a valid token language, the Grid only contains insertion commands
2627 for valid characters and might use a coloring scheme.  Otherwise, it
2628 contains all characters.
2629
2630 @item x-symbol-temp-grid
2631 Inserting an X-Symbol character does not restore the window
2632 configuration current before the invocation of the Grid.
2633
2634 @item x-symbol-grid-reuse
2635 Use old Grid when invoking command @code{x-symbol-grid}, if this is
2636 reasonably to do.  If @code{x-symbol-grid} is called with a prefix
2637 argument, always create new Grid.
2638
2639 @item x-symbol-grid-ignore-charsyms
2640 The Grid does not contain @code{nobreakspace}.
2641
2642 @item x-symbol-grid-tab-width
2643 The tab width in the Grid buffer should correspond the font in
2644 @code{x-symbol-heading-face} which is also used as the default font in
2645 the Grid buffer.
2646
2647 @item x-symbol-heading-strut-glyph
2648 Use larger interline spacing if a line in the Grid starts with a header.
2649 @end vtable
2650
2651 The headers in the Grid are the same as the submenu headers, see
2652 @ref{Char Group}.  Similar looking characters for one headers are
2653 grouped together.  @xref{Input Method Context}.
2654
2655 Input method Grid also works if X-Symbol mode is not enabled.  It uses
2656 the common interpretation of prefix arguments for X-Symbol insert
2657 commands, see @ref{Introducing Input Methods}.
2658
2659 @c ===========================================================================
2660
2661 @node Input Method Keyboard, Input Method Context, Input Method Grid, Input Methods
2662 @comment  node-name,  next,  previous,  up
2663 @section Input Method Keyboard: Compose Key Sequence
2664 @cindex Input Method Keyboard
2665 @cindex Keyboard, Input Method
2666
2667 Key sequences starting with @kbd{C-=} (@pxref{Introducing Input
2668 Methods}) are used to insert X-Symbol characters, e.g., @kbd{C-= ~ >}
2669 inserts @code{leadsto}.  The Ascii sequence of the keys after @kbd{C-=}
2670 look similar to the character which you are going to insert.  It is the
2671 same as the sequence which is replaced by input method Context, see
2672 @ref{Input Method Context}.
2673
2674 If many characters are represented by the same Ascii sequence, the
2675 binding is extended by @samp{1}, @samp{2} and so on.  If you do not know
2676 how to continue your key sequence, the following commands might be
2677 useful:
2678
2679 @table @kbd
2680 @item M-x x-symbol-help
2681 @itemx C-= @var{zero-or-more-keys} @key{help}
2682 @itemx C-= @var{zero-or-more-keys} C-h
2683 @findex x-symbol-help
2684 @kindex C-= @key{help}
2685 @kindex C-= C-h
2686 @kindex @key{help}
2687 @kindex C-h
2688 Pops up a buffer displaying possible completions for the key sequence
2689 @kbd{C-= @var{zero-or-more-keys}}.  You do not have to type the key
2690 sequence again, i.e., @kbd{C-= @var{zero-or-more-keys}} is also used for
2691 the next input.
2692
2693 @item C-= @var{zero-or-more-keys} @key{button1}
2694 @itemx C-= @var{zero-or-more-keys} @key{button2}
2695 @itemx C-= @var{zero-or-more-keys} @key{button3}
2696 @kindex @key{button1}
2697 @kindex @key{button2}
2698 @kindex @key{button3}
2699 Use the normal bindings of @kbd{@key{button1}},  @kbd{@key{button2}} or
2700 @kbd{@key{button3}}, respectively (@pxref{Input Method Grid}).  The key sequence
2701 is not used for the next input.
2702
2703 @item C-= @var{zero-or-more-keys} M-@key{prior}
2704 @itemx C-= @var{zero-or-more-keys} M-@key{next}
2705 @itemx C-= @var{zero-or-more-keys} M-@key{home}
2706 @itemx C-= @var{zero-or-more-keys} M-@key{end}
2707 @kindex M-@key{prior}
2708 @kindex M-@key{next}
2709 @kindex M-@key{home}
2710 @kindex M-@key{end}
2711 Execute the commands @code{scroll-other-window-down},
2712 @code{scroll-other-window}, @code{beginning-of-buffer-other-window} or
2713 @code{end-of-buffer-other-window}, respectively.  You do not have to
2714 type the key sequence again, i.e., @kbd{C-= @var{zero-or-more-keys}} is
2715 also used for the next input.
2716 @end table
2717
2718 @vtable @code
2719 @item x-symbol-temp-help
2720 Inserting an X-Symbol character restores the window configuration
2721 current before the invocation of the Grid.
2722
2723 @item x-symbol-map-default-keys-alist
2724 Defines the bindings mentioned above.
2725 @end vtable
2726
2727 Input method Keyboard also works if X-Symbol mode is not enabled.  It
2728 uses the common interpretation of prefix arguments for X-Symbol insert
2729 commands, see @ref{Introducing Input Methods}.
2730
2731 @c ===========================================================================
2732
2733 @node Input Method Context, Input Method Electric, Input Method Keyboard, Input Methods
2734 @comment  node-name,  next,  previous,  up
2735 @section Input Method Context: Replace Char Sequence
2736 @cindex Context, Input Method
2737 @cindex Input Method Context
2738 @cindex Character Sequence Input
2739 @cindex Ascii Sequence Input
2740 @cindex Modify Chain
2741 @cindex Rotate Chain
2742 @cindex Greek Input
2743
2744 The idea of the input method @dfn{Context} is to replace a sequence of
2745 characters by a character which looks similar to the whole sequence.  If
2746 the sequence consists only of Ascii characters, it is also used for the
2747 key bindings, see @ref{Input Method Keyboard}.
2748
2749 There will be some info in the echo area that the character sequence
2750 before point can be replace via input method Context.  The following
2751 commands are provided:
2752
2753 @table @kbd
2754 @item M-x x-symbol-modify-key
2755 @itemx C-,
2756 @itemx C-= @key{left}
2757 @itemx C-= @key{right}
2758 @findex x-symbol-modify-key
2759 @kindex C-,
2760 @kindex C-= @key{left}
2761 @kindex C-= @key{right}
2762 If character before point is an X-Symbol character, ``modify'' it to an
2763 alternative character (if you do it often enough, you are back at your
2764 first character).  Otherwise replace sequence of characters by a
2765 character which looks similar to the whole sequence.
2766
2767 @item M-x x-symbol-rotate-key
2768 @itemx C-.
2769 @itemx C-= @key{up}
2770 @itemx C-= @key{down}
2771 @findex x-symbol-rotate-key
2772 @kindex C-.
2773 @kindex C-= @key{up}
2774 @kindex C-= @key{down}
2775 If character before point is an X-Symbol character, ``rotate'' its
2776 ``direction'' (or change uppercase/lowercase).
2777 @end table
2778
2779 Both commands can also be used to resolve a character alias before
2780 point, see @ref{Char Aliases}.  If the region is active, restrict
2781 replacement to use that region since the input method Context only
2782 considers the longest sequence of characters with a replacement.
2783
2784 Input method Context can be customized by changing the following
2785 variables:
2786
2787 @vtable @code
2788 @item x-symbol-rotate-prefix-alist
2789 If you provide a prefix argument to command @code{x-symbol-rotate-key},
2790 you can specify the direction you want to have: it is according to
2791 numerical keypads, e.g., with prefix argument @samp{7} you specify the
2792 direction ``north-west''.
2793
2794 @item x-symbol-rotate-suffix-char
2795 Command @code{x-symbol-rotate-key} is also used to ``Greekify'' the
2796 previous character: typing @kbd{a C-.} is shorter than @kbd{a # C-,}.
2797
2798 @item x-symbol-context-ignore
2799 Constrains whether a context/charsym can be replaced.  No constraints by
2800 default.
2801
2802 @item x-symbol-context-init-ignore
2803 Contexts starting with a space cannot be replaced.  This variable must
2804 be set before X-Symbol has been initialized.
2805 @end vtable
2806
2807 @c ===========================================================================
2808
2809 @node Input Method Electric, Input Method Quail, Input Method Context, Input Methods
2810 @comment  node-name,  next,  previous,  up
2811 @section Input Method Electric: Automatic Context
2812 @cindex Input Method Electric
2813 @cindex Electric, Input Method
2814 @cindex Aggressive Context      @c 2.6
2815 @cindex Automatic Context
2816
2817 The idea of input method @dfn{Electric} is to have the input method
2818 Context (@pxref{Input Method Context}) do its replacement automatically.
2819 X-Symbol automatically replaces some character sequences of input method
2820 Context by the X-Symbol character as soon as the last character in the
2821 sequence of the sequence has been pressed.
2822
2823 Input method Electric has nothing to do with the display of
2824 super-/subscripts (@pxref{Super and Subscripts}).
2825
2826 You might want to press @kbd{C-/} or @kbd{C-x u} to undo the
2827 replacement.  Input method Electric requires X-Symbol mode to be
2828 enabled, it can be disabled (and re-enabled) by setting the following
2829 variable:
2830
2831 @vtable @code
2832 @item x-symbol-electric-input
2833 A boolean which can also be changed via the X-Symbol menu.
2834 @end vtable
2835
2836 To make input method Electric useful and not annoying, several
2837 conditions must be met for X-Symbol to do the auto-replacement:
2838
2839 @itemize @bullet
2840 @item
2841 Not all contexts will be replaced automatically.  E.g., while input
2842 method Context allows both pre- and postfixes for accented characters,
2843 @kbd{:} and @kbd{'} only act as prefixes, and @kbd{`} and @kbd{~} only
2844 as postfixes for input method Electric, since these are the combinations
2845 where those characters are quite likely not used literally.
2846
2847 @item
2848 The character must be valid in the current token language, see
2849 @ref{Introducing Input Methods}.
2850
2851 @item
2852 All characters of the context have been typed without any other command
2853 in between, e.g., @kbd{- >} inserts @code{arrowright}, "- @key{left}
2854 @key{right} > simply inserts @samp{->}.
2855
2856 @item
2857 No prefix argument has been used for any character in the context.
2858
2859 @item
2860 The electric context must not be a suffix of a longer valid context for
2861 another character.  E.g., @kbd{' ' o} does not insert
2862 @samp{'@code{oacute}} because @samp{''o} is the context for
2863 @code{ohungarumlaut} (which cannot be inserted by input method
2864 Electric).
2865
2866 @item
2867 It should be ``allowed'' to change the context to the character via
2868 input method Context.
2869
2870 @item
2871 Individual contexts/charsyms can be disabled by setting the following
2872 variables:
2873
2874 @vtable @code
2875 @item x-symbol-electric-ignore
2876 The context should neither be @samp{'s} (this would be annoying when
2877 writing English), nor include a space.  If you want to disable input
2878 method Electric for all accented characters, use
2879
2880 @lisp
2881 (setq x-symbol-electric-ignore
2882       "[ \t]\\|[A-Za-z][~`]\\|[:'][A-Za-z]")
2883 @end lisp
2884
2885 @item x-symbol-@var{lang}-electric-ignore
2886 Individual contexts/charsyms can be disabled for each token language
2887 @var{lang}.
2888 @end vtable
2889 @end itemize
2890
2891 @c ===========================================================================
2892
2893 @node Input Method Quail, Customizing Input Method, Input Method Electric, Input Methods
2894 @comment  node-name,  next,  previous,  up
2895 @section Input Method Quail: a Mule Input Method
2896 @cindex Input Method Quail
2897 @cindex Mule Input Method
2898
2899 Another way to insert a characters is by using the Emacs/Mule
2900 multilingual text input method ``x-symbol'' (@pxref{Input
2901 Methods,,,@value{emacs},@value{emacsman}})..
2902
2903 Again, the Ascii sequence used there is the same as the sequence which
2904 is replaced by input method Context, see @ref{Input Method Context}.  A
2905 one-letter key sequence is extended by @key{;}.
2906
2907 If input method Quail is selected for a buffer, input method Electric
2908 (@pxref{Input Method Electric}) is disabled in that buffer.
2909
2910 @c TODO: more
2911
2912 @c ===========================================================================
2913
2914 @node Customizing Input Method,  , Input Method Quail, Input Methods
2915 @comment  node-name,  next,  previous,  up
2916 @section Customizing Input Methods
2917 @cindex Customizing Method Internals
2918 @cindex Input Methods Customization
2919
2920 You may safely define key bindings not using the @code{x-symbol-map}
2921 (i.e., starting with @kbd{C-=}).  E.g., for @code{alpha} on @kbd{A-a} ,
2922 use
2923
2924 @lisp
2925 (global-set-key [(alt a)] 'x-symbol-INSERT-alpha)
2926 @end lisp
2927
2928 Please note that the command @code{x-symbol-INSERT-alpha} is not defined
2929 before the main file (@file{x-symbol}) in the package has been loaded
2930 (if you really need it, function @code{autoload} is your friend).
2931
2932 Other possibilities to customize the input methods are by setting the
2933 following variables:
2934
2935 @vtable @code
2936 @item x-symbol-header-groups-alist
2937 Defines the groups whose characters appear after that header in the Grid
2938 and in submenus with that header.  @xref{Char Group}.  Extra variables
2939 exists for the language dependent Grid and Menu.
2940
2941 @item x-symbol-group-input-alist
2942 @itemx x-symbol-user-table
2943 These are variables which are used to compute the input definitions.
2944 While this kind of indirection might seem complicated to you (it is), it
2945 actually ensures consistency across all input methods.  @xref{Defining
2946 Input Methods}.
2947
2948 For example, if you prefer charsym @code{epsilon1} over @code{epsilon}
2949 you might want to use:
2950
2951 @lisp
2952 @group
2953 (setq x-symbol-user-table
2954       '((epsilon1 t (greek1 "e" nil "epsilon") nil -3000)))
2955 @end group
2956 @end lisp
2957
2958 @item x-symbol-list-mode-hook
2959 Additional functions to execute after setting up the Grid and Key
2960 Completions buffer.
2961
2962 @item x-symbol-after-init-input-hook
2963 You can change the input methods directly by functions in these hooks.
2964 @end vtable
2965
2966 @c ===========================================================================
2967
2968 @node Features, Supported Languages, Input Methods, Top
2969 @comment  node-name,  next,  previous,  up
2970 @chapter Features of Package X-Symbol
2971 @cindex Features of X-Symbol
2972 @cindex Supported Features
2973
2974 Package X-Symbol not only provides input methods for X-Symbol
2975 characters, it also provides more features which support an easy and
2976 comfortable preparation of documents.
2977
2978 @menu
2979 * Super and Subscripts::        Use special fonts for super-/subscripts.
2980 * Images::                      Images after image insertion commands.
2981 * Info::                        Display information in echo area.
2982 * Ascii Representation::        Derive label from a buffer contents.
2983 * Package Information::         Invoke info system, use WWW browser.
2984 @end menu
2985
2986 @c ===========================================================================
2987
2988 @node Super and Subscripts, Images, Features, Features
2989 @comment  node-name,  next,  previous,  up
2990 @section Super- and Subscripts
2991 @cindex Superscripts
2992 @cindex Subscripts
2993 @cindex Invisible, Revealing
2994 @cindex Point, Invisible
2995 @cindex Cursor, Invisible
2996 @cindex Keywords for Subscripts
2997
2998 Package X-Symbol displays the characters inside super-/subscript
2999 commands in a way to make them look like super-/subscripts.  It also
3000 marks the super-/subscript command itself as invisible, so you don't see
3001 it on the screen.  For example, the three characters @samp{a^2} in the
3002 buffer are @emph{displayed} as an @samp{a} and a raised, smaller
3003 @samp{2}---the @samp{^} is still in the buffer.
3004
3005 Therefore, the display of super- and subscripts has nothing to do with
3006 Input Method Electric (@pxref{Input Method Electric}).
3007
3008 Do not confuse the special Latin characters @code{twosuperior},
3009 @code{threesuperior}, @code{ordfeminine} and @code{masculine} with the
3010 characters @samp{2}, @samp{3}, @samp{a} and @samp{o} when displayed as
3011 superscripts.  You might notice that the characters look a bit
3012 different, but to help you seeing the difference, X-Symbol will display
3013 an info in the echo area (@pxref{Info}) for the special Latin
3014 characters when point is before or after the character in question.
3015
3016 X-Symbol only displays the innermost super- and subscripts, since we
3017 would need even more additional fonts otherwise.  It is also restricted
3018 to display single-line super- and subscripts.
3019
3020 The display of super- and subscripts requires @code{font-lock} to be
3021 enabled (@pxref{Role of font-lock}).
3022
3023 Super- and subscripts are by default enabled if the they are defined for
3024 the token language and it would be appropriate to turn on X-Symbol
3025 automatically for the current buffer (@pxref{Minor Mode}).  They can be
3026 disabled (and re-enabled) by setting the following buffer-local
3027 variable:
3028
3029 @vtable @code
3030 @item x-symbol-subscripts
3031 A boolean which can also be changed via the X-Symbol menu.
3032 @end vtable
3033
3034 As mentioned before, X-Symbol marks the super-/subscript command itself
3035 as invisible, except when point is directly before, inside or directly
3036 after this command.  During the time where this this is the case,
3037 X-Symbol makes the super-/subscript command reappear and highlights it
3038 with pink.  This feature can be disabled (and re-enabled) by setting the
3039 following variables:
3040
3041 @vtable @code
3042 @item x-symbol-reveal-invisible
3043 A boolean which can also be changed via the X-Symbol menu.
3044
3045 @item x-symbol-revealed-face
3046 The face used for the super-/subscript command when revealed.
3047
3048 @item x-symbol-idle-delay
3049 Time in seconds of idle time before revealing invisible characters.
3050 @end vtable
3051
3052 Super-/subscript commands are @code{^}/@code{_} (@pxref{TeX Macro}) and
3053 @code{<sup>}/@code{<sub>} (@pxref{SGML Entity}):
3054
3055 @c ===========================================================================
3056
3057 @node Images, Info, Super and Subscripts, Features
3058 @comment  node-name,  next,  previous,  up
3059 @section Images at the end of Image Insertion Commands
3060 @cindex Images
3061 @cindex Glyphs
3062
3063 @pindex convert
3064 Package X-Symbol can display @dfn{images} at the end of image insertion
3065 commands.  They show thumbnails (scaled-down version of the image) for
3066 the included image files (using @code{convert}, @pxref{Installing Image
3067 Converter}).  Using the middle mouse button invokes the image editor for
3068 the image under the mouse pointer.
3069
3070 @menu
3071 * Image Display::               When to display images.
3072 * Image Conversion::            Producing a scaled-down image.
3073 * Image Caching::               Speeding up the image processing.
3074 * Special Images::              Signaling specific situations.
3075 * Image Editor::                Editing the original image file.
3076 @end menu
3077
3078
3079 @node Image Display, Image Conversion, Images, Images
3080 @comment  node-name,  next,  previous,  up
3081 @subsection Display of Images
3082 @cindex Image Display
3083 @cindex Image Control
3084 @cindex Image Commands
3085 @cindex Controlling Images
3086 @cindex Image Keywords
3087 @cindex Keywords for Images
3088
3089 The display of images is by default enabled if the image commands are
3090 defined for the token language and it would be appropriate to turn on
3091 X-Symbol automatically for the current buffer (@pxref{Minor Mode}).  It
3092 can be disabled (and re-enabled) by setting the following buffer-local
3093 variable:
3094
3095 @vtable @code
3096 @item x-symbol-image
3097 A boolean which can also be changed via the X-Symbol menu.
3098 @end vtable
3099
3100 Image commands are @code{\includegraphics} and others (@pxref{TeX
3101 Macro}), and @code{<img>} (@pxref{SGML Entity}):
3102
3103 @vtable @code
3104 @item x-symbol-@var{lang}-image-keywords
3105 The keywords (image commands & arguments) for each token language
3106 @var{lang}.
3107 @end vtable
3108
3109 File names in the image commands must be interpreted correctly.  They
3110 can be:
3111
3112 @itemize @minus
3113 @item
3114 @dfn{absolute}, start with @samp{/} or @samp{~},
3115 @item
3116 @dfn{explicitly relative}, start with @samp{./} or @samp{../},
3117 @item
3118 @dfn{implicitly relative}, assumed otherwise, e.g., @file{image.eps}, or
3119 @item
3120 special, like having some special URL prefix like @file{http:} or @file{ftp:}.
3121 @end itemize
3122
3123 Relative file names can be relative to some @dfn{master directory}
3124 (usually the current directory of the file) or to directories in some
3125 @dfn{search path} (only used with token language @code{tex}):
3126
3127 @vtable @code
3128 @item x-symbol-@var{lang}-master-directory
3129 The master directory for each token language @var{lang}.
3130
3131 @item x-symbol-@var{lang}-image-searchpath
3132 The image search path for each token language @var{lang}.  Defaults to
3133 the current directory.
3134
3135 @item x-symbol-image-searchpath-follow-symlink
3136 Directories in the search path ending with @file{//} (double slash) are
3137 recursive: all subdirectories not starting with a dot are also included
3138 in the search path.  If this variable has value @code{nil} (the
3139 default), subdirectories which are symbolic links are not included.
3140 @end vtable
3141
3142 For details, see the section of the individual token languages
3143 (@pxref{Supported Languages}).
3144
3145
3146 @node Image Conversion, Image Caching, Image Display, Images
3147 @comment  node-name,  next,  previous,  up
3148 @subsection Image Conversion
3149 @cindex Image Conversion
3150 @cindex Converting Images
3151 @cindex Colormap
3152 @cindex Image Cache File
3153
3154 The file mentioned inside the image insertion command is not used
3155 directly to display the image after the command.  The image might be too
3156 big, it might use too many colors or the image format might not be
3157 supported by Emacs.  Therefore, it is converted to an @dfn{image cache
3158 file}, see @ref{Image Caching}.
3159
3160 @vtable @code
3161 @item x-symbol-image-max-width
3162 The image is not wider than 120 points.
3163
3164 @item x-symbol-image-max-height
3165 The image is not higher than 80 points.
3166
3167 @item x-symbol-image-convert-colormap
3168 Colormap used in function @code{x-symbol-image-convert-colormap} below.
3169 A colormap is a normal image whose colors are the only ones used for
3170 producing other images.  The distribution of package X-Symbol includes
3171 two colormaps: @file{etc/colormap138.xpm} and @file{etc/colormap66.xpm}.
3172
3173 @item x-symbol-image-colormap-allocation
3174 Package X-Symbol allocates the colors of the colormap at start-up and
3175 prevents them to be de-allocated.
3176
3177 @item x-symbol-image-converter
3178 @pindex convert
3179 Program @code{convert} from ImageMagick is used to convert the images
3180 (@pxref{Installing Image Converter}).  Set this variable to @code{nil},
3181 if you don't want to convert images.
3182
3183 The following variables controls the invocation of the program
3184 @code{convert} from ImageMagick:
3185
3186 @vtable @code
3187 @item x-symbol-image-convert-program
3188 The name of the program @code{convert}, it is
3189 @samp{C:\\ImageMagick\\convert} when running on Windows and
3190 @samp{convert} otherwise.
3191
3192 @item x-symbol-image-convert-file-alist
3193 Program @code{convert} needs to be told that @file{@var{file}.pstex} is
3194 a Postscript file.
3195 @end vtable
3196
3197 The following functions are possible values in
3198 @code{x-symbol-image-converter}:
3199
3200 @ftable @code
3201 @item x-symbol-image-start-convert-mono
3202 Produces monochrome images.  Used if your device has less than 32
3203 colors.
3204
3205 @item x-symbol-image-start-convert-truecolor
3206 Produce images with original colors.  Used if your device has more than
3207 767 colors.
3208
3209 @item x-symbol-image-start-convert-color
3210 Produce images with maximal four colors (just four because different
3211 images might use a different sets of colors).  Used otherwise without a
3212 colormap.
3213
3214 @item x-symbol-image-start-convert-colormap
3215 Produce image with colors from the colormap.  Used otherwise with a
3216 colormap.
3217
3218 @vtable @code
3219 @item x-symbol-image-convert-mono-regexp
3220 Function @code{x-symbol-image-start-convert-colormap} just produces
3221 monochrome images for temporary image cache files (@pxref{Image
3222 Caching}) since @code{convert} is slower when using a colormap.
3223 @end vtable
3224 @end ftable
3225 @end vtable
3226
3227
3228 @node Image Caching, Special Images, Image Conversion, Images
3229 @comment  node-name,  next,  previous,  up
3230 @subsection Image Caching
3231 @cindex Image Caching
3232 @cindex Caching of Images
3233 @cindex Glyph Caching
3234 @cindex Memory Cache for Images
3235 @cindex File Cache for Images
3236
3237 Editing would be extremely slow, if an image cache file would be
3238 produced every time an image insertion command has been recognized.
3239 Therefore, package X-Symbol uses the following techniques:
3240
3241 @itemize @bullet
3242 @item
3243 It uses an asynchronous process to create the image cache file.  You can
3244 edit your file during the conversion.
3245
3246 @item
3247 It uses a @dfn{file cache}: image cache file can be kept for future
3248 Emacs sessions.
3249
3250 @item
3251 It uses a @dfn{memory cache}: images from the most common file names are
3252 cached in a buffer-local memory cache.  The cached is initialized when
3253 parsing the whole buffer for image keywords.  Rescan the buffer if you
3254 want to display the the images of new image files by using the following
3255 command:
3256
3257 @table @kbd
3258 @item M-x x-symbol-image-parse-buffer
3259 @findex x-symbol-image-parse-buffer
3260 Parse the buffer to recognize image insertion commands.  Usually, this
3261 is done automatically.
3262 @end table
3263 @end itemize
3264
3265 File and memory caching can be controlled by the following variables:
3266
3267 @vtable @code
3268 @item x-symbol-image-update-cache
3269 The image cache is automatically updated if it does not exist yet or if it
3270 is older than the corresponding image file.
3271
3272 @item x-symbol-image-cache-directories
3273 Cache files for images in your home directory are stored in directory
3274 @file{~/.images/}, e.g., image @file{~/d/img.eps}, is cached in
3275 @file{~/.images/d/img.png}.
3276
3277 Images outside your home directory are just temporarily cached, or not
3278 displayed at all if they cannot be stored in the memory cache.
3279
3280 You could also specify that the cache files uses a relative
3281 subdirectory, e.g., that @file{~/d/img.eps} is cached in
3282 @file{~/d/.img/img.eps} or that the image is not displayed at all.
3283
3284 @item x-symbol-image-temp-name
3285 Temporary image files are stored in a temporary directory (@file{/tmp/})
3286 having some unique name.  They are not supported on Emacs.
3287
3288 @item x-symbol-image-use-remote
3289 Package X-Symbol only displays images which can be stored in the memory
3290 cache.  With value @code{t}, it tries to find the image file during
3291 editing (ignoring the search path for speed, though).  Editing lines
3292 with image files not in the memory cache would be slow, since file
3293 accesses are necessary for every command.
3294 @end vtable
3295
3296 The memory cache only stored image file from the current directory or
3297 some standard image directories like @file{figures/} (@pxref{TeX
3298 Macro}), or @file{images/} or @file{pictures/} (@pxref{SGML Entity}).
3299 Otherwise, the image file is considered similar to remote files:
3300
3301 @vtable @code
3302 @item x-symbol-@var{lang}-image-cached-dirs
3303 The directories with images which are stored in the memory cache.  Can
3304 be separately defined for each token language @var{lang}.
3305 @end vtable
3306
3307
3308 @node Special Images, Image Editor, Image Caching, Images
3309 @comment  node-name,  next,  previous,  up
3310 @subsection Special Images for Specific Situations
3311 @cindex Special Images
3312 @cindex Images for Specific Situations
3313 @cindex Glyph for Specific Situations
3314
3315 If package X-Symbol cannot display images representing the included
3316 image files, it uses special images instead:
3317
3318 @itemize @bullet
3319 @item
3320 @dfn{Remote:} An Escher knot is displayed if the file is remote or if
3321 the image cannot be cached in the memory cache, see @ref{Image Caching}.
3322
3323 @item
3324 @dfn{Junk}: A recycle sign is displayed if there is no image converter
3325 (@pxref{Image Conversion}), if it should not use a file cache or if the
3326 file cache cannot be written.
3327
3328 @item
3329 @dfn{Locked:} A terminal with a lock is displayed if the image cache file
3330 cannot be read or written.
3331
3332 @item
3333 @dfn{Design:} An ink pen is displayed if the image file does not exist.
3334
3335 @item
3336 @dfn{Create:} An hour glass is displayed used during the creation of the
3337 image cache file, an old image cache is used instead if it exists.
3338
3339 @item
3340 @dfn{Broken:} A tombstone is displayed if the creation of the image
3341 cache file has failed.
3342 @end itemize
3343
3344 To customize the glyphs for the special images, use:
3345
3346 @vtable @code
3347 @item x-symbol-image-data-directory
3348 Directory of files for the special images.
3349
3350 @item x-symbol-image-special-glyphs
3351 File names of special images and their image format.
3352 @end vtable
3353
3354
3355 @node Image Editor,  , Special Images, Images
3356 @comment  node-name,  next,  previous,  up
3357 @subsection Image Editor
3358 @cindex Image Editor
3359 @cindex Editing Image Files
3360 @cindex Designing Images
3361 @cindex Scale Factor, Images
3362 @cindex Image Highlight Menu
3363
3364 If you move the mouse pointer to an image insertion command or its
3365 image, it is highlighted.
3366
3367 @table @kbd
3368 @item @key{button2}
3369 @kindex @key{button2}
3370 Start image editor for highlighted image.  If the image is searched in
3371 the searchpath (@pxref{Image Caching}), edit first existing image file.
3372 If no image exists, open a new file in the first directory of the
3373 searchpath.
3374
3375 @item @key{button3}
3376 @kindex @key{button3}
3377 Pop up the @dfn{image highlight menu}.  You can rescan the buffer for
3378 image insertion commands (@pxref{Image Display}).
3379
3380 It also displays all directories in the searchpath if the file name is
3381 implicitly relative, or the current directory otherwise.  Selecting a
3382 directory starts the image editor in that directory (relatively to that
3383 directory if the file name has a directory part).
3384
3385 @item M-x x-symbol-image-editor
3386 @findex x-symbol-image-editor
3387 Start image editor.  Asks for the image file.
3388 @end table
3389
3390 You can control which editor to use:
3391
3392 @vtable @code
3393 @item x-symbol-image-editor-alist
3394 @pindex display
3395 @pindex xfig
3396 Normally, program @code{display} is used to edit the highlighted image
3397 file.  But for image names @file{@var{file}.eps}, @file{@var{file}.ps}
3398 or @file{@var{file}.pstex}, program @code{xfig} is invoked with
3399 @file{@var{file}.fig}.  It also uses a scale method, e.g., with
3400 @file{img.80.eps}, we edit @file{img.fig} (which should be exported with
3401 scale=80%).
3402
3403 @item x-symbol-image-scale-method
3404 If a scale method is used for a file name and the file name without
3405 extension ends with a dot and two digits, these three characters are
3406 removed from the file name.
3407
3408 @item x-symbol-image-current-marker
3409 Directories with an existing image for the specified file name are
3410 marked with an @samp{*}.  The first of these represents the file which
3411 is used when pressing @kbd{@key{button2}}.
3412 @end vtable
3413
3414 @c ===========================================================================
3415
3416 @node Info, Ascii Representation, Images, Features
3417 @comment  node-name,  next,  previous,  up
3418 @section Info in Echo Area
3419 @cindex Info in Echo Area
3420 @cindex Echo Area Info
3421 @cindex Character Info
3422 @cindex Context Info
3423 @cindex Minibuffer Info
3424
3425 The echo area (@pxref{Echo Area,,,@value{emacs},@value{emacsman}}) is
3426 used by X-Symbol to give some information about the character around
3427 point, and whether there is a context before point which can be replaced
3428 by input method Context (@pxref{Input Method Context}).
3429
3430 It will be controlled by the following variables (also to be found in
3431 the menu):
3432
3433 @vtable @code
3434 @item x-symbol-character-info
3435 A three-value variable which controls whether to display some info for
3436 the character after or around point.  The info for the character after
3437 point includes the character itself and the following infos:
3438
3439 @itemize @minus
3440 @item
3441 the token of the current language, eventually colored according to some
3442 coloring scheme (@pxref{Char Group}),
3443
3444 @item
3445 infos using the token classes (@pxref{Char Group}), which could inform
3446 users to include a specific La@TeX{} package when they want to use that
3447 character in the document,
3448
3449 @item
3450 the codings in which the characters is considered to be a 8bit character
3451 (@pxref{File Coding}), and
3452
3453 @item
3454 the key bindings (@pxref{Input Method Keyboard}).
3455 @end itemize
3456
3457 @item x-symbol-context-info
3458 If X-Symbol mode is on and some conditions are met, display some info
3459 for the character which would replace the context before point when
3460 pressing @kbd{C-,} (@pxref{Input Method Context}).  It can be controlled
3461 by the following variables:
3462
3463 @vtable @code
3464 @item x-symbol-context-info-ignore
3465 @findex x-symbol-default-context-info-ignore
3466 The default value @code{x-symbol-default-context-info-ignore} makes the
3467 following variables control whether to display the context info.
3468
3469 @item x-symbol-context-info-threshold
3470 The context does not consist of a single character.
3471
3472 @item x-symbol-context-info-ignore-regexp
3473 The context does not solely consist of letters.
3474
3475 @item x-symbol-context-info-ignore-groups
3476 The context is not replaced by an accented character, see @ref{Char
3477 Group}.
3478 @end vtable
3479
3480 @item x-symbol-idle-delay
3481 Time in seconds of idle time before showing the info.
3482 @end vtable
3483
3484 @c ====================================================================
3485
3486 @node Ascii Representation, Package Information, Info, Features
3487 @comment  node-name,  next,  previous,  up
3488 @section Ascii Representation of Strings 
3489 @cindex Ascii Representation
3490 @cindex Representation of Characters
3491 @cindex Label Creation
3492
3493 @pindex reftex
3494 If you want to derive labels from a buffer contents (provided e.g., by
3495 Emacs packages @code{reftex} or @code{bibtex}), you need a Ascii
3496 representation of strings containing X-Symbol characters.  This is
3497 provided by the following function:
3498
3499 @ftable @code
3500 @item x-symbol-translate-to-ascii
3501 Takes a string and returns a string only consisting of Ascii characters.
3502
3503 @vtable @code
3504 @item x-symbol-charsym-ascii-alist
3505 You might want to define the German way to Asciify accented characters
3506 by:
3507 @lisp
3508 @group
3509 (setq x-symbol-charsym-ascii-alist
3510       '((adiaeresis . "ae") (Adiaeresis . "Ae")
3511         (odiaeresis . "oe") (Odiaeresis . "Oe")
3512         (udiaeresis . "ue") (Udiaeresis . "Ue")))
3513 @end group
3514 @end lisp
3515
3516 @item x-symbol-charsym-ascii-groups
3517 By default, ``Ascii''fying accented characters means removing the
3518 accents.  Other characters have built-in Ascii representation, e.g,
3519 @code{sigma1} has the Ascii representation @samp{sigma}.
3520 @end vtable
3521 @end ftable
3522
3523 @c ====================================================================
3524
3525 @node Package Information,  , Ascii Representation, Features
3526 @comment  node-name,  next,  previous,  up
3527 @section X-Symbol Package Information
3528 @cindex Package Information
3529 @cindex WWW Browsing
3530 @cindex URL for X-Symbol
3531
3532 @table @kbd
3533 @item M-x x-symbol-package-info
3534 @findex x-symbol-package-info
3535 Read documentation for package X-Symbol in the info system.
3536
3537 @item M-x x-symbol-package-web
3538 @findex x-symbol-package-web
3539 Ask a WWW browser to load the URL of package X-Symbol.
3540
3541 @item M-x x-symbol-package-bug
3542 @findex x-symbol-package-bug
3543 Use this command to contact the maintainer of package X-Symbol @emph{in
3544 any case}, e.g., for suggestions, bug and problem reports, see @ref{Bug
3545 Reports}.  Use @kbd{C-u 9 M-x x-symbol-package-bug} for patches
3546 (including corrections of this manual, which are strongly appreciated)
3547 and for other messages.
3548 @end table
3549
3550 @vtable @code
3551 @item x-symbol-installer-address
3552 E-mail address of the person who has installed package X-Symbol
3553 system-wide (@pxref{System-wide Installation}).
3554
3555 @item x-symbol-package-url
3556 URL of package X-Symbol, used by @code{x-symbol-package-web}.
3557 @end vtable
3558
3559 @c ====================================================================
3560
3561 @node Supported Languages, X-Symbol Internals, Features, Top
3562 @comment  node-name,  next,  previous,  up
3563 @chapter Supported Token Languages
3564 @cindex Supported Languages
3565 @cindex Default Languages
3566 @cindex Built-in Languages
3567 @cindex Provided Languages
3568 @cindex Languages in Distribution
3569
3570 The chapter describe the predefined token language.  It also presents
3571 the language specific behavior for @ref{Concepts}, @ref{Input Methods},
3572 and @ref{Features}.
3573
3574 @menu
3575 * Pseudo Language::             Token language ``x-symbol charsym''.
3576 * TeX Macro::                   Token language @code{tex}.
3577 * SGML Entity::                 Token language @code{sgml}.
3578 * BibTeX Macro::                Token language @code{bib}.
3579 * TeXinfo Command::             Token language @code{texi}.
3580 * External Languages::          Languages defined in other Emacs Packages.
3581 @end menu
3582
3583 @c ====================================================================
3584
3585 @node Pseudo Language, TeX Macro, Supported Languages, Supported Languages
3586 @comment  node-name,  next,  previous,  up
3587 @section Pseudo Token Language ``x-symbol charsym''
3588 @cindex Pseudo Language
3589 @cindex Charsym
3590 @cindex X-Symbol Charsym
3591
3592 If no (or an invalid) token language is set for a buffer, the info in
3593 the echo area (@pxref{Info}) for a X-Symbol Character in the buffer (if
3594 it exists) uses the name of its @dfn{charsym}.  In this manual, we
3595 actually refer to X-Symbol characters by their charsym name, e.g.,
3596 @code{alpha}.
3597
3598 A charsym is a symbol which is used internally to represent a X-Symbol
3599 character.  Charsyms are used instead characters in all user variables
3600 of package X-Symbol.
3601
3602 The highlight menu of the Grid (@pxref{Input Method Grid}) also offers
3603 to insert a charsym name.  Charsyms can also be used for input method
3604 Read Token, see @ref{Input Method Read Token}.
3605
3606 You cannot use this pseudo language to turn on the X-Symbol minor mode
3607 (@pxref{Minor Mode}), you cannot decode charsyms to their characters, and
3608 you cannot encode characters to charsyms.
3609
3610 @c ===========================================================================
3611
3612 @node TeX Macro, SGML Entity, Pseudo Language, Supported Languages
3613 @comment  node-name,  next,  previous,  up
3614 @section Token Language ``@TeX{} macro'' (@code{tex})
3615 @cindex Token Language @code{tex}
3616 @cindex Language @code{tex}
3617 @cindex @TeX{} macro
3618 @cindex @code{tex}
3619 @cindex La@TeX{}
3620
3621 For buffers using the major mode @code{latex-mode}, @code{tex-mode} or
3622 @code{plain-tex-mode}, we use token language @dfn{@TeX{} macro}
3623 (@code{tex}).  This language provides the display of super-/subscripts
3624 and images.  If the buffer visits a file with extension @file{.tex},
3625 X-Symbol mode is automatically turned on.
3626
3627 @menu
3628 * TeX Macro Basics::            Basics of language ``@TeX{} macro''.
3629 * TeX Macro Features::          Super-/subscripts and images in La@TeX{}.
3630 * TeX Macro Problems::          Problems with @TeX{} macros.
3631 * TeX Macro Conversion::        How the conversion of @TeX{} macros works.
3632 * TeX Macro Symbols::           Extra Symbols of Language ``@TeX{} Macro''.
3633 @end menu
3634
3635
3636 @node TeX Macro Basics, TeX Macro Features, TeX Macro, TeX Macro
3637 @comment  node-name,  next,  previous,  up
3638 @subsection Basics of Language ``@TeX{} macro''
3639 @cindex TeX Macro Basics
3640 @cindex Basics TeX Macro
3641 @cindex Choosing TeX Macro
3642 @cindex TeX Macro Use
3643 @cindex TeX Macro Modes
3644
3645 The standard behavior can be controlled by the following variables:
3646
3647 @vtable @code
3648 @item x-symbol-tex-modes
3649 @itemx x-symbol-tex-auto-style
3650 The variables known from @ref{Minor Mode}.  If the buffer visits a file
3651 with extension @file{.tex}, super-/subscripts and images are displayed,
3652 otherwise unique decoding (@pxref{Unique Decoding}) will be used.
3653
3654 @item x-symbol-tex-auto-coding-alist
3655 Used there to automatically deduce the specific encoding of the file
3656 (@pxref{File Coding}) if the file visited by the buffer has the
3657 extension @file{.tex}.  It searches for one of the following two strings
3658 in the current buffer, including the comment:
3659
3660 @example
3661 \usepackage[@var{encoding}]@{inputenc@}
3662 %& -translation-file=i@var{enc}
3663 @end example
3664
3665 where @var{encoding} should be one of @samp{latin1}, @samp{latin2},
3666 @samp{latin3}, @samp{latin5}, or @samp{latin9}, and @var{enc} should be
3667 one of @samp{l1} or @samp{l2}.  8bit characters are not encoded if the
3668 file if the search was successful (@pxref{Controlling 8bit Coding}).
3669
3670 @item x-symbol-tex-coding-master
3671 @vindex TeX-master
3672 If one of the above strings cannot be found in the current buffer, and
3673 the current buffer has a buffer-local string value of @code{TeX-master},
3674 also search in the file denoted by that value for the strings.
3675 (Buffer-local variables will not be inherited.)
3676 @end vtable
3677
3678 The input methods and the character info in the echo area are controlled
3679 by:
3680
3681 @vtable @code
3682 @item x-symbol-tex-header-groups-alist
3683 We use the standard Grid and Menu headers.
3684
3685 @item x-symbol-tex-extra-menu-items
3686 There is an extra menu item to remove the braces around text-mode
3687 letters and other text-mode symbols.
3688 @c TODO: detailed list of additional commands
3689
3690 @item x-symbol-tex-electric-ignore
3691 @itemx x-symbol-tex-electric-ignore-regexp
3692 @pindex texmathp
3693 Input method Electric (@pxref{Input Method Electric}) is disabled if the
3694 character is not of the correct @TeX{} mode, i.e., it only produces a
3695 math-mode character in a math area and a text-mode character in a text
3696 area (this test requires package @code{texmathp}, see @ref{LaTeX Packages}).
3697 Postfix tilde is not electric, because @samp{~} produces a space in
3698 @TeX{}.
3699
3700 @item x-symbol-tex-token-suppress-space
3701 Input method Token (@pxref{Input Method Token}) only converts a token
3702 ending with a control word like @code{\i}, if the character following
3703 the token is no letter.  If that token is a text-mode token and a
3704 @key{SPC} has been entered without a prefix argument, the @key{SPC} will
3705 only perform the replacement, it will not insert a space, i.e., it will
3706 act like @kbd{C-u 0 @key{SPC}}.
3707
3708 @item x-symbol-tex-class-alist
3709 @itemx x-symbol-tex-class-face-alist
3710 Various token classes (@pxref{Char Group}) are defined.  They are used
3711 to give some info (@pxref{Info}) about the characters spacing behavior,
3712 which La@TeX{} packages are necessary to use the character (@pxref{TeX
3713 Macro Symbols}), and about the conversion (@pxref{TeX Macro
3714 Conversion}).  X-Symbol uses blue for text-mode only and purple for
3715 math-mode only characters in the Grid (@pxref{Input Method Grid} and the
3716 character info.
3717 @end vtable
3718
3719
3720 @node TeX Macro Features, TeX Macro Problems, TeX Macro Basics, TeX Macro
3721 @comment  node-name,  next,  previous,  up
3722 @subsection Super-/Subscripts and Images in La@TeX{}
3723 @cindex TeX Macro Features
3724 @cindex Features TeX Macro
3725 @cindex TeX Macro Superscripts
3726 @cindex TeX Macro Subscripts
3727 @cindex TeX Macro Images
3728
3729 The display of super- and subscripts (@pxref{Super and Subscripts}) is
3730 controlled by:
3731
3732 @vtable @code
3733 @itemx x-symbol-tex-font-lock-limit-regexp
3734 The superscript command @code{^} and the subscript command @code{_} is
3735 recognized.  The argument can be provided with and without braces.  The
3736 argument should not span more than one line and should not contain a
3737 super-/subscript command.
3738
3739 @item x-symbol-tex-font-lock-allowed-faces
3740 The characters @samp{^} and @samp{_} are not always commands (@pxref{TeX
3741 Macro Problems}), e.g., in the argument of @code{\ref}.  X-Symbol uses
3742 the usual syntax highlighting keywords to decide whether to recognize
3743 these characters as super-/subscript commands: they are commands if they
3744 are not highlighted or highlighted with the usual math-mode faces.
3745
3746 This might lead to problems: @ref{FAQ No Subscripts}, @ref{FAQ Stupid
3747 Subscripts}.  Using @code{texmathp} (@pxref{LaTeX Packages}) has even
3748 more problems:
3749
3750 @itemize @minus
3751 @item
3752 The syntax highlighting (which is used for super-/subscripts) would be
3753 much too slow.
3754
3755 @item
3756 With own La@TeX{} environments, you would need to customize
3757 @code{texmathp}.
3758
3759 @item
3760 It is actually wrong: whether @samp{^} and @samp{_} are
3761 super-/subscripts commands does not depend on whether we are in @TeX{}'s
3762 math mode, it depends on its catcodes (which are changed by commands
3763 like @code{\ref}).
3764 @end itemize
3765 @end vtable
3766
3767 The display of images (@pxref{Images}) is controlled by:
3768
3769 @vtable @code
3770 @item x-symbol-tex-image-keywords
3771 The following commands are recognized.  Extension @var{ext} stands for
3772 @file{eps} (which is the default extension for both versions of
3773 @code{\includegraphics} if the extension is omitted there), @file{ps},
3774 @file{gif}, @file{png}, @file{jpeg}, @file{jpg}, or @file{pdf}.  Options
3775 @var{options} can be omitted with their surrounding brackets or
3776 preceding comma, respectively.
3777
3778 @example
3779 \input@{@var{file}.pstex_t@}
3780 \includegraphics[@var{options}][@var{options}]@{@var{file}.@var{ext}@}
3781 \includegraphics*[@var{options}][@var{options}]@{@var{file}.@var{ext}@}
3782 \epsfig@{file=@var{file}.@var{ext},@var{options}@}
3783 \psfig@{file=@var{file}.@var{ext},@var{options}@}
3784 \epsfbox[@var{options}]@{@var{file}.@var{ext}@}
3785 \epsffile[@var{options}]@{@var{file}.@var{ext}@}
3786 @end example
3787
3788 @item x-symbol-tex-master-directory
3789 @vindex TeX-master
3790 Relative file names (@pxref{Image Display}, explicitly or implicitly)
3791 are relative to the directory part of variable @code{TeX-master} if it
3792 is buffer-local and a string.  Otherwise, they are relative to the
3793 directory of the current file.
3794
3795 @item x-symbol-tex-image-searchpath
3796 @vindex TEXPICTS
3797 @vindex TEXINPUTS
3798 Files with implicitly relative names are meant to be searched in a
3799 search path.  It defaults to the list of directories specified by the
3800 environment variable @code{TEXPICTS} or @code{TEXINPUTS} (@pxref{TeX
3801 environment variables,,,@value{kpathsea},@value{kpathseaman}}),
3802 extended by @file{./} if necessary.
3803
3804 Each directory in this list is used to expand the file name.  The first
3805 expansion naming a readable file is used.  Relative directories in this
3806 list are expanded in the master directory mentioned above.
3807
3808 This mimics the standard behavior of @TeX{}, omitting the ``built-in''
3809 directories of the search path (@pxref{Path
3810 sources,,,@value{kpathsea},@value{kpathseaman}}).
3811
3812 @item x-symbol-tex-image-cached-dirs
3813 The file name in the image command should not have a directory part or
3814 the directory part should be @file{figures/} if the image should be
3815 cached in the memory cache.
3816 @end vtable
3817
3818
3819 @node TeX Macro Problems, TeX Macro Conversion, TeX Macro Features, TeX Macro
3820 @comment  node-name,  next,  previous,  up
3821 @subsection Problems with @TeX{} Macros
3822 @cindex TeX Macro Problems
3823 @cindex Problems TeX Macro
3824
3825 Like with other token languages, the conversion between characters and
3826 @TeX{} macros induce the problem that we have two conflicting
3827 requirements: we would like X-Symbol not to change the file when
3828 visiting and saving a file, and we would like X-Symbol to use characters
3829 for all corresponding macros.  @xref{Unique Decoding}.
3830
3831 The additional problem with @TeX{} macros is that there is no fixed and
3832 simple definition of @TeX{} macros, and many users have their personal
3833 @TeX{} style, while many users are probably not aware that the style
3834 also influences @TeX{}'s typesetting:
3835
3836 @itemize @bullet
3837 @item
3838 The tokens in @TeX{} are not ended by a dedicated character (like
3839 @sc{sgml} entities are ended by @samp{;}).  Instead, we need the next
3840 char to decide whether a macro ends, which would be no problem if @TeX{}
3841 would have a character which has no meaning except separating tokens
3842 (like space in most programming languages).  Unfortunately, this is not
3843 the case: after an @dfn{control word} (an all-letter macro), a space has
3844 no meaning, but it does produce a space in the output after characters
3845 and other macros, except in math mode.
3846
3847 During decoding, a text-mode control word has to be replaced either with
3848 its trailing spaces or not be replaced at all.  Since the number of
3849 spaces can vary and X-Symbol does not remember the original @TeX{}
3850 sequence of a character, X-Symbol would change the file if it would use
3851 characters for all sequences.
3852
3853 @item
3854 During encoding, a space after a character in the buffer must produce a
3855 space in the document output, since users normally do not care whether
3856 the character is represented by a control word or not.  Let us assume
3857 that we (Bavarians) want to produce the output @samp{Ma@ss{}@ Bier}.
3858 @ifnottex
3859 In the info file, you will probably not see any 8bit characters (the
3860 sharp @samp{s} is shown as @samp{@ss{}}).
3861 @end ifnottex
3862
3863 @itemize @minus 
3864 @item
3865 Many people would use @samp{Ma\ss\@ Bier}.  This is (almost ever) fine
3866 in text mode, but a @samp{\@ } in math mode is not ignored (whereas the
3867 spaces after characters are).  If we have text- and math-mode control
3868 word, we have a problem, since math-mode detection cannot work properly
3869 without @TeX{} processing.
3870
3871 @item
3872 Many people would use @samp{Ma\ss@{@}@ Bier}.  This has less problems and
3873 is therefore used by X-Symbol.  The @samp{@{@}} at the end of the control
3874 word is not used if the character is not followed by a space, e.g., to
3875 produce @samp{Stra@ss{}e}, we use @samp{Stra\ss@ e}.  Consequently,
3876 @samp{Ma\ss\@ Bier} in the file would be decoded to @samp{Ma@ss{}\@ Bier},
3877 which would be encoded to the original sequence in the file.
3878
3879 @item
3880 Some people would always use @samp{@{@}} after a text-mode control word,
3881 even it is not followed by a space, like @samp{Stra\ss@{@}e}.  This is
3882 wrong, since it breaks ligatures and kerns.  For example, compare the
3883 output of @samp{\L@ V} with @samp{\L@{@}V} using @samp{T1} font encoding.
3884
3885 @item
3886 Up to Version 4.1, X-Symbol surrounded a text-mode control word with
3887 braces, like @samp{Stra@{\ss@}e}.  This was probably even worse than
3888 always adding @samp{@{@}} at the end of the control word.  It was used,
3889 because it is required by Bib@TeX{} (@pxref{BibTeX Macro}).
3890 Unfortunately, Bib@TeX{} sends this bad sequence directly to La@TeX{},
3891 but this has nothing to do with X-Symbol.
3892 @end itemize
3893
3894 @item
3895 The accented characters are not represented by one tokens in @TeX{}.
3896 Most people use @samp{\"a} to produce an @samp{@"a}, while some use
3897 @samp{\"@{a@}}.  X-Symbol uses the former, it does not even decode the
3898 latter automatically.  Up to Version 4.1, X-Symbol used @samp{@{\"a@}},
3899 having the same problems as using @samp{Stra@{\ss@}e}.
3900
3901 @item
3902 Around a dozen characters can be produced by more than one @TeX{} macro,
3903 like @code{\neq} and @code{\ne}.  Here, X-Symbol decodes both forms,
3904 because it is probably a bad idea to redefine standard @TeX{} macros.
3905 This will not be done with in style files (@pxref{Unique Decoding}).
3906
3907 @item
3908 In @TeX{}, you can change the lexer on the fly, i.e., in a strict sense,
3909 any conversion is unsafe without @TeX{} processing.  Since the most
3910 likely change is to change the catcode of the character @samp{@@} to a
3911 letter (used in La@TeX{}'s style files), this character is considered a
3912 letter by X-Symbol.  This means that although both @samp{\ss@ @@} and
3913 @samp{\ss@@} usually produce the same output, only the first is decoded
3914 to @samp{@ss{}@@}.
3915
3916 @item
3917 In @TeX{}, the definitions of macros can also change on the fly i.e., in
3918 a strict sense, any conversion is unsafe without @TeX{} processing.
3919 X-Symbol assumes that you do not do something like that except as done
3920 by the standard La@TeX{} @code{\verb} command, and the @code{verbatim}
3921 and @code{tabbing} environments.
3922 @end itemize
3923
3924
3925 @node TeX Macro Conversion, TeX Macro Symbols, TeX Macro Problems, TeX Macro
3926 @comment  node-name,  next,  previous,  up
3927 @subsection The Conversion of @TeX{} Macros
3928 @cindex TeX Macro Conversion
3929 @cindex Conversion of TeX Macros
3930
3931 The @TeX{} macros for Latin characters are according to the La@TeX{}
3932 package @file{inputenc.sty}, v0.97+.  Package X-Symbol uses U00B5 for
3933 @code{\mathmicro}, not for @code{\mu}, though!  @xref{Wishlist LaTeX}.
3934
3935 It is assumed that you do not redefine standard @TeX{} macros like
3936 @code{\ne} (@pxref{TeX Macro Conversion}), if you do so, you should
3937 better use unique decoding (@pxref{Unique Decoding}).
3938
3939 The encoding of characters to @TeX{} macros works as follows:
3940
3941 @itemize @bullet
3942 @item
3943 If the character is preceded by an odd number of backslashes, insert a
3944 space before the character.
3945
3946 @item
3947 Accented characters are encoded without braces, e.g., we encode @samp{@,{c}}
3948 to @samp{\c@ c}.  Accents are encoded with braces, e.g., we use
3949 @samp{\c@{@ @}} and @samp{\u@{@}}.
3950 @end itemize
3951
3952 Additionally, the encoding of characters to @TeX{} macros which are
3953 @dfn{control words} (all-letter macros), or whose @TeX{} representation
3954 ends with a control word (like @samp{\'\i}) works as follows:
3955
3956 @itemize @bullet
3957 @item
3958 If the character is followed by a letter, replace the character by the
3959 macro and insert a space.
3960
3961 @item
3962 If the macro is a text-mode macro and followed by one or more blanks,
3963 replace the character and insert @samp{@{@}}.
3964
3965 @item
3966 Otherwise, just replace the character.
3967 @end itemize
3968
3969 The decoding of @TeX{} macros which are control words to characters
3970 works as follows:
3971
3972 @itemize @bullet
3973 @item
3974 If the macro is a text-mode macro and followed by @samp{@{@}} which is
3975 followed by a blank, replace the macro and delete the braces.
3976
3977 @item
3978 If the macro is a text-mode macro and followed by one are more blanks,
3979 we have the following rule:
3980
3981 @itemize @minus
3982 @item
3983 If we have exactly one blank, the blank is a space, and it is not
3984 followed by a @samp{%} (comment character), replace the macro by the
3985 corresponding character and delete the space.  (With unique decoding,
3986 the character following the space must be a letter.)
3987
3988 @item
3989 Otherwise, do @emph{not decode} the macro!
3990 @end itemize
3991
3992 @item
3993 Otherwise, just replace the macro.
3994 @end itemize
3995
3996 To clarify, @dfn{letter} means @samp{A}-@samp{Z}, @samp{a}-@samp{z}, or
3997 @samp{@@}, @dfn{blank} means a space, newline or the end of the buffer
3998 (therefore, the last character in the buffer is always followed by a
3999 blank).
4000
4001 There are three control words which are both text-mode and math mode
4002 macros: @code{\ldots}, @code{\vdots}, and (by accident) @code{\angle}.
4003 They are all treated like math-mode characters, but their minibuffer
4004 info (@pxref{Info}) includes @samp{gobbles space} (spaces in the buffer
4005 after the character have no impact on the document),
4006
4007 Additionally, the following commands and environments are processed
4008 during decoding (but we are just looking for strings, i.e., they are
4009 also processed in comments):
4010
4011 @vtable @code
4012 @item x-symbol-tex-verb-delimiter-regexp
4013 If the command @code{\verb} is found, its argument is not decoded if it
4014 is delimited by one of the following characters: @samp{-}, @samp{!},
4015 @samp{#}, @samp{$}, @samp{&}, @samp{*}, @samp{+}, @samp{/}, @samp{=},
4016 @samp{?}, @samp{^}, @samp{|}, or @samp{!}.
4017
4018 @item x-symbol-tex-env-verbatim-regexp
4019 The contents of the @code{verbatim} environment is not decoded.  To
4020 produce accented characters inside this environment, use the La@TeX{}
4021 package @file{inputenc.sty}.
4022
4023 @c Inside @code{\hyphenation}@{@dots{}@}, you can only use Latin characters.
4024
4025 @c David Kastrup: Wrong.  inputenc.sty converts things like @"a into \"a
4026 @c anyway (take a look into your table of contents file, xxx.toc, for
4027 @c example).  Both @"a and \"a will not work in hyphenation patterns when you
4028 @c are using a font encoding without such a character (like the default OT1
4029 @c encoding), both @"a and \"a will work if something like
4030 @c \usepackage[T1]{fontenc} is active.  This holds for LaTeX; plain TeX is
4031 @c not as sophisticated as to replace \"a with a single character when in
4032 @c T1 encodings.
4033
4034 @item x-symbol-tex-env-tabbing-regexp
4035 Inside a @code{tabbing} environment, the macro sequences starting with
4036 @samp{\`}, @samp{\'}, @samp{\=} and @samp{\-} are not decoded.  It is
4037 probably better (with or without X-Symbol) to use the La@TeX{} package
4038 @file{inputenc.sty} or to the @code{Tabbing} environment, to be found in
4039 the @sc{ctan} archives.
4040 @end vtable
4041
4042 During encoding, these commands and environments are not respected,
4043 since it does not make any sense to have X-Symbol's private characters
4044 in the @TeX{} file.
4045
4046 @ifnottex
4047 Final note: in the info file, you will probably not see any 8bit
4048 characters.
4049 @end ifnottex
4050
4051 You might want change the conversion between characters and tokens in
4052 language @code{tex} by changing:
4053
4054 @vtable @code
4055 @item x-symbol-tex-user-table
4056 You can define you own tokens for X-Symbol characters.  E.g., if you
4057 like to have the command @code{\sqrt} represented by a character
4058 (shadowing the entry for @code{\surd}), add the following to your
4059 @file{~/.emacs}:
4060
4061 @lisp
4062 (setq x-symbol-tex-user-table '((radical (math special) "\\sqrt")))
4063 @end lisp
4064 @end vtable
4065
4066
4067 @node TeX Macro Symbols,  , TeX Macro Conversion, TeX Macro
4068 @comment  node-name,  next,  previous,  up
4069 @subsection Extra Symbols of Language ``@TeX{} Macro''
4070 @cindex Extra Symbols for @TeX{}
4071 @cindex Defining @code{tex}
4072 @cindex Initializing @code{tex}
4073 @cindex @TeX{} Macro Installation
4074 @cindex Installing @code{tex}
4075 @pindex @file{latexsym.sty}
4076 @pindex @file{amssymb.sty}
4077 @pindex @file{stmaryrd.sty}
4078 @pindex @file{fontenc.sty}
4079 @pindex @file{inputenc.sty}
4080
4081 This section describes what you should put into your private style file
4082 or your document if you want to use extra symbols, i.e., characters
4083 whose info in the echo area (@pxref{Info}) contains s.th. like
4084 @samp{@var{package}.sty} or @samp{user}.  If you do not use the
4085 corresponding characters, you do not have to do anything, of course.
4086
4087 The @TeX{} macros @code{\Box}, @code{\Diamond}, @code{\leadsto},
4088 @code{\Join}, @code{\lhd}, @code{\mho}, @code{\rhd}, @code{\sqsupset},
4089 @code{\sqsubset}, @code{\unlhd}, @code{\unrhd}, are defined in La@TeX{}
4090 package @file{latexsym.sty}:
4091
4092 @example
4093 \usepackage@{latexsym@}
4094 @end example
4095
4096 Note that these macros are also defined @file{amssymb.sty}.  Since the
4097 first four macros are defined differently (better) in
4098 @file{latexsym.sty}, it does make sense to load both La@TeX{} packages
4099 (e.g., @file{amssymb.sty} simply defines @code{\Diamond} to be the same
4100 as @code{\lozenge}).
4101
4102 The @TeX{} macros @code{\boldsymbol}, @code{\circledast},
4103 @code{\circledcirc}, @code{\circleddash}, @code{\digamma},
4104 @code{\gtrapprox}, @code{\gtrsim}, @code{\lessapprox}, @code{\lesssim},
4105 @code{\triangleq}, @code{\varkappa} are defined in AMS La@TeX{} package
4106 @file{amssymb.sty}:
4107
4108 @example
4109 \usepackage@{amssymb@}
4110 @end example
4111
4112 The @TeX{} macros @code{\bigsqcap}, @code{\llbracket},
4113 @code{\rrbracket}, @code{\llparenthesis}, @code{\rrparenthesis} are
4114 defined in the La@TeX{} package @file{stmaryrd.sty}:
4115
4116 @example
4117 \usepackage@{stmaryrd@}
4118 @end example
4119
4120 The @TeX{} macros @code{\guilsinglleft}, @code{\guilsinglright},
4121 @code{\dj}, @code{\NG}, @code{\ng}, @code{\DH}, @code{\DJ}, @code{\dh},
4122 @code{\dj}, @code{\TH}, @code{\th}, @code{\guillemotleft},
4123 @code{\guillemotright} and the ogonek characters are only defined if
4124 you use T1 font encoding:
4125
4126 @example
4127 \usepackage[T1]@{fontenc@}
4128 @end example
4129
4130 The @TeX{} macro @code{\mathmicro} for U00B5 can be defined by
4131 (@pxref{Wishlist LaTeX}):
4132
4133 @example
4134 \let\mathmicro\mu
4135 @end example
4136
4137 You should define the following in your La@TeX{} file (if you use the
4138 corresponding characters), the first can only be used with T1 font encoding.
4139
4140 @example
4141 \DeclareTextSymbol@{\textbackslash@}@{T1@}@{92@}
4142 \newcommand@{\nsubset@}@{\not\subset@}
4143 \newcommand@{\textflorin@}@{\textit@{f@}@}
4144 \newcommand@{\setB@}@{@{\mathord@{\mathbb B@}@}@}
4145 \newcommand@{\setC@}@{@{\mathord@{\mathbb C@}@}@}
4146 \newcommand@{\setN@}@{@{\mathord@{\mathbb N@}@}@}
4147 \newcommand@{\setQ@}@{@{\mathord@{\mathbb Q@}@}@}
4148 \newcommand@{\setR@}@{@{\mathord@{\mathbb R@}@}@}
4149 \newcommand@{\setZ@}@{@{\mathord@{\mathbb Z@}@}@}
4150 \newcommand@{\coloncolon@}@{\mathrel@{::@}@}
4151 @c \newcommand@{\lsemantics@}@{\mathopen@{\lbrack\mkern-3mu\lbrack@}@}
4152 @c \newcommand@{\rsemantics@}@{\mathclose@{\rbrack\mkern-3mu\rbrack@}@}
4153 @c \newcommand@{\lcata@}@{\mathopen@{(\mkern-3mu\mid@}@}
4154 @c \newcommand@{\rcata@}@{\mathclose@{\mid\mkern-3mu)@}@}
4155 @end example
4156
4157 The @TeX{} macros @code{\textordfeminine}, @code{\textordmasculine},
4158 @code{\textdegree}, @code{\textonequarter}, @code{\textonehalf},
4159 @code{\textthreequarters}, @code{\mathonesuperior},
4160 @code{\mathtwosuperior}, @code{\maththreesuperior},
4161 @code{\textcopyright} are only defined when using La@TeX{} package
4162 @file{inputenc.sty}:
4163
4164 @example
4165 \usepackage[latin1]@{inputenc@}
4166 @end example
4167
4168 The @TeX{} macros @code{\textcent}, @code{\textcurrency},
4169 @code{\textyen}, @code{\textbrokenbar}, @code{\textmalteseH},
4170 @code{\textmalteseh} are defined as not available in La@TeX{} package
4171 @file{inputenc.sty}.  @xref{Wishlist LaTeX}.  If you use this package
4172 and want to define these commands, use @code{\renewcommand} (or
4173 @code{\def}) after, e.g.:
4174
4175 @example
4176 \usepackage[latin1]@{inputenc@}
4177 \usepackage@{wasysym@}  %% defines \cent, \currency, \brokenvert
4178 \usepackage@{amssymb@}  %% defines \yen
4179 \renewcommand@{\textcent@}@{\cent@}
4180 \renewcommand@{\textcurrency@}@{\currency@}
4181 \renewcommand@{\textyen@}@{\yen@}
4182 \renewcommand@{\textbrokenbar@}@{brokenvert@}
4183 @end example
4184
4185 @c ===========================================================================
4186
4187 @node SGML Entity, BibTeX Macro, TeX Macro, Supported Languages
4188 @comment  node-name,  next,  previous,  up
4189 @section Token Language ``@sc{sgml} entity'' (@code{sgml})
4190 @cindex HTML
4191 @cindex SGML entity
4192 @cindex Token Language @code{sgml}
4193 @cindex Language @code{sgml}
4194 @pindex Netscape
4195
4196 For buffers using the major mode @code{html-mode}, @code{hm--html-mode},
4197 @code{html-helper-mode}, @code{sgml-mode} or @code{xml-mode}, we use
4198 token language @dfn{@sc{sgml} entity} (@code{sgml}).  This language
4199 provides the display of super-/subscripts and images.  If the buffer
4200 visits a file and uses a @sc{html} mode, X-Symbol mode is automatically
4201 turned on.
4202
4203 @menu
4204 * SGML Entity Basics::          Basics of Language ``@sc{sgml} entity''.
4205 * SGML Entity Features::        Super-/Subscripts and Images in @sc{html}.
4206 * SGML Entity Conversion::      How the conversion of @sc{sgml} entities works.
4207 @end menu
4208
4209
4210 @node SGML Entity Basics, SGML Entity Features, SGML Entity, SGML Entity
4211 @comment  node-name,  next,  previous,  up
4212 @subsection Basics of Language ``@sc{sgml} entity''
4213 @cindex SGML Entity Basics
4214 @cindex Basics SGML Entity
4215 @cindex Choosing SGML Entity
4216 @cindex SGML Entity Use
4217 @cindex SGML Entity Modes
4218
4219 The standard behavior can be controlled by the following variables:
4220
4221 @vtable @code
4222 @item x-symbol-sgml-modes
4223 @itemx x-symbol-sgml-auto-style
4224 The variables known from @ref{Minor Mode}.  If the buffer uses a
4225 @sc{html} mode, super-/subscripts and images are displayed, otherwise
4226 unique decoding (@pxref{Unique Decoding}) will be used.
4227
4228 @item x-symbol-sgml-auto-coding-alist
4229 Used there to automatically deduce the specific encoding of the file
4230 (@pxref{File Coding}).  It searches for the following string in the
4231 current buffer, including the comment:
4232
4233 @example
4234 <meta http-equiv="content-type"
4235       content="text/html; charset=@var{encoding}">
4236 @end example
4237
4238 where @var{encoding} should be one of @samp{iso-8859-1},
4239 @samp{iso-8859-2}, @samp{iso-8859-3}, @samp{iso-8859-9}, or
4240 @samp{iso-8859-15}.  8bit characters are not encoded if the file if the
4241 search was successful (@pxref{Controlling 8bit Coding}).
4242 @end vtable
4243
4244 The input methods and the character info in the echo area are controlled
4245 by:
4246
4247 @vtable @code
4248 @item x-symbol-sgml-header-groups-alist
4249 Defines the headers and their characters for the language specific Grid
4250 and Menu.
4251
4252 @item x-symbol-sgml-extra-menu-items
4253 There are no special entries in the X-Symbol menu.
4254
4255 @item x-symbol-sgml-electric-ignore
4256 There is no additional constraint to the ones mentioned in @ref{Input
4257 Method Electric}.
4258
4259 @item x-symbol-sgml-class-alist
4260 @itemx x-symbol-sgml-class-face-alist
4261 Token classes (@pxref{Char Group}) are only used to define a coloring
4262 scheme.  X-Symbol uses dark orange or dark red for non-Latin-1
4263 characters in the Grid (@pxref{Input Method Grid} and the character info
4264 (@pxref{Info}), dark red for characters without defined entity names in
4265 @sc{html} (@pxref{SGML Entity Conversion}).
4266 @end vtable
4267
4268
4269 @node SGML Entity Features, SGML Entity Conversion, SGML Entity Basics, SGML Entity
4270 @comment  node-name,  next,  previous,  up
4271 @subsection Super-/Subscripts and Images in @sc{html}
4272 @cindex SGML Entity Features
4273 @cindex Features SGML Entity
4274 @cindex SGML Entity Superscripts
4275 @cindex SGML Entity Subscripts
4276 @cindex SGML Entity Images
4277
4278 The display of super- and subscripts (@pxref{Super and Subscripts}) is
4279 controlled by:
4280
4281 @vtable @code
4282 @item x-symbol-sgml-font-lock-regexp
4283 @itemx x-symbol-sgml-font-lock-limit-regexp
4284 @itemx x-symbol-sgml-font-lock-alist
4285 @itemx x-symbol-sgml-font-lock-contents-regexp
4286 The superscript command @code{<sup>}@dots{}@code{</sup>} and the subscript
4287 command @code{<sub>}@dots{}@code{</sub>} is recognized.  The contents should
4288 contain at least one character which is not a space or a
4289 @code{nobreakspace}.
4290 @end vtable
4291
4292 The display of images (@pxref{Images}) is controlled by:
4293
4294 @vtable @code
4295 @item x-symbol-sgml-image-keywords
4296 The following commands are recognized.  Extension @var{ext} stands for
4297 @file{gif}, @file{png}, @file{jpeg} or @file{jpg}.
4298
4299 @example
4300 <img @var{@dots{}} src="@var{file}.@var{ext}" @var{@dots{}}>
4301 @end example
4302
4303 @item x-symbol-sgml-master-directory
4304 @itemx x-symbol-sgml-image-searchpath
4305 Relative file names (@pxref{Image Display}) are relative to the
4306 directory of the current file.
4307
4308 @item x-symbol-sgml-image-file-truename-alist
4309 The file name prefix @file{file:} is ignored.  For any other file name
4310 which starts with letters and then a colon, e.g., with @file{http:} or
4311 @file{C:\} (which is no @sc{url} anyway), the image insertion command
4312 will be skipped.  By changing this variable, you could specify that the
4313 prefix @file{http://www.fmi.uni-passau.de/~wedler/} corresponds to
4314 @file{~/public_html/}.
4315
4316 @item x-symbol-sgml-image-cached-dirs
4317 The file name in the image command should not have a directory part or
4318 the directory part should be @file{images/} or @file{pictures/} if the
4319 image should be cached in the memory cache.
4320 @end vtable
4321
4322
4323 @node SGML Entity Conversion,  , SGML Entity Features, SGML Entity
4324 @comment  node-name,  next,  previous,  up
4325 @subsection The Conversion of @sc{sgml} Entities
4326 @cindex SGML Entity Conversion
4327 @cindex Conversion of SGML Entities
4328
4329 Most character entities of HTML-4.0 are supported, except the following:
4330 uppercase Greek which look like uppercase Latin, ``markup-significant
4331 and internationalization'' characters, and some quotes.  See
4332 @uref{@value{sgmlentitiesurl}}.
4333
4334 By default, we encode to entity references like @code{&amp;}, and decode
4335 from both entity references and character references like @code{&#38;}.
4336 For Latin-N characters without defined entity names in @sc{html} (e.g.
4337 @code{scedilla}), we can only use character references.
4338
4339 Do not expect Netscape before v6 to display non-Latin-1 characters
4340 correctly (this might work by specifying the charset UTF-8 and using
4341 character references).
4342
4343 You might want change the conversion between characters and tokens in
4344 language @code{sgml} by changing:
4345
4346 @vtable @code
4347 @item x-symbol-sgml-token-list
4348 @findex x-symbol-sgml-token-list-name
4349 @findex x-symbol-sgml-token-list-code
4350 @findex x-symbol-sgml-token-list-netscape
4351 A symbol, which defines whether to use entity references, character
4352 references, or entity references for Latin-1 characters and character
4353 references for others.
4354
4355 @item x-symbol-sgml-user-table
4356 It is probably not a good idea to change the defined tokens (except via
4357 the variable above), but you might want to add some definitions:
4358
4359 @example
4360 (setq x-symbol-sgml-user-table '((circ () 999 "&bcomp;")))
4361 @end example
4362 @end vtable
4363
4364 @c ====================================================================
4365
4366 @node BibTeX Macro, TeXinfo Command, SGML Entity, Supported Languages
4367 @comment  node-name,  next,  previous,  up
4368 @section Token Language ``Bib@TeX{} macro'' (@code{bib})
4369 @cindex Token Language @code{bib}
4370 @cindex Language @code{bib}
4371 @cindex Bib@TeX{} macro
4372 @cindex @code{bib}
4373 @cindex Bib@TeX{}
4374
4375 For buffers using the major mode @code{bibtex-mode}, we use token
4376 language @dfn{Bib@TeX{} macro} (@code{bib}).  This language does not
4377 provide the display of super-/subscripts and images.  If the buffer
4378 visits a file, X-Symbol mode is automatically turned on.  It is
4379 controlled by:
4380
4381 @vtable @code
4382 @item x-symbol-bib-modes
4383 @itemx x-symbol-bib-auto-style
4384 The variables known from @ref{Minor Mode}.  There is no automatic
4385 deduction of the file encoding, 8bit characters are usually encoded, and
4386 there is usually no unique decoding.  @xref{Conversion}.
4387 @end vtable
4388
4389 @pindex bibtex
4390 The major difference between this language and the token language
4391 @code{tex} is that the tokens for text-mode characters are most likely
4392 enclosed by braces.  This has some problems (@pxref{TeX Macro
4393 Problems}), but is required by the program @code{bibtex}.
4394
4395 The input methods and most features except super-/subscripts and images
4396 work like in token language @code{tex} (@pxref{TeX Macro}):
4397
4398 @vtable @code
4399 @item x-symbol-bib-header-groups-alist
4400 @itemx x-symbol-bib-electric-ignore
4401 @itemx x-symbol-bib-class-alist
4402 @itemx x-symbol-bib-class-face-alist
4403 Like in @ref{TeX Macro Features}.
4404
4405 @item x-symbol-bib-extra-menu-items
4406 There are no special entries in the X-Symbol menu.
4407 @end vtable
4408
4409 You might want change the conversion between characters and tokens in
4410 language @code{bib} by changing:
4411
4412 @vtable @code
4413 @item x-symbol-bib-user-table
4414 @itemx x-symbol-tex-user-table
4415 Use the former for @code{bib}-only changes, the latter also influences
4416 the conversion with token language @code{tex}.
4417 @end vtable
4418
4419 @c ====================================================================
4420
4421 @node TeXinfo Command, External Languages, BibTeX Macro, Supported Languages
4422 @comment  node-name,  next,  previous,  up
4423 @section Token Language ``@TeX{}info command'' (@code{texi})
4424 @cindex Token Language @code{texi}
4425 @cindex Language @code{texi}
4426 @cindex @TeX{}info command
4427 @cindex @code{texi}
4428 @pindex texinfo
4429 @pindex GNU texinfo
4430
4431 For buffers using the major mode @code{texinfo-mode}, we use token
4432 language @dfn{@TeX{}info command} (@code{texi}).  This language does not
4433 provide the display of super-/subscripts and images.  If the buffer
4434 visits a file, X-Symbol mode is automatically turned on.  It is
4435 controlled by:
4436
4437 @vtable @code
4438 @item x-symbol-texi-modes
4439 @itemx x-symbol-texi-auto-style
4440 The variables known from @ref{Minor Mode}.  There is no automatic
4441 deduction of the file encoding, 8bit characters are usually encoded, and
4442 there is usually no unique decoding.  @xref{Conversion}.
4443 @end vtable
4444
4445 With @code{x-symbol-8bits} having value @code{nil} (the default), it
4446 might still happen that the saved file contains 8bit characters, since
4447 token language @code{texi} does not define tokens for all characters in
4448 the Latin charsets supported by X-Symbol.  @xref{Controlling 8bit
4449 Coding}.
4450
4451 With @code{x-symbol-unique} having value @code{nil} (the default), we
4452 have unique decoding anyway, since token language @code{texi} does only
4453 define one token per character, i.e., the value is not important if
4454 @code{x-symbol-8bits} is @code{nil}.  @xref{Unique Decoding}.
4455
4456 The input methods and the character info in the echo area are controlled
4457 by:
4458
4459 @vtable @code
4460 @item x-symbol-texi-header-groups-alist
4461 Defines the headers and their characters for the language specific Grid
4462 and Menu.
4463
4464 @item x-symbol-texi-extra-menu-items
4465 There are no special entries in the X-Symbol menu.
4466
4467 @item x-symbol-texi-electric-ignore
4468 There is no additional constraint to the ones mentioned in @ref{Input
4469 Method Electric}.
4470
4471 @item x-symbol-texi-class-alist
4472 @itemx x-symbol-texi-class-face-alist
4473 Only a few token classes (@pxref{Char Group}) are defined, the most
4474 interesting induces the character info (@pxref{Info}) to display
4475 @samp{not as code} for @code{@@minus@{@}} (@code{@@minus@{@}} should not
4476 used inside @code{@@code} and @code{@@example}).  No coloring scheme is
4477 defined.
4478 @end vtable
4479
4480 @pindex makeinfo
4481 At least with @code{makeinfo-4.0}, you do not get accented characters in
4482 the info file for the corresponding @TeX{}info commands in the
4483 @file{.texi} file, the @sc{html} output might contain illegal
4484 ``@sc{sgml} entities'' like @code{&140;}.
4485
4486 @pindex texi2html
4487 At least with @code{texi2html-1.62}, you see accented characters in the
4488 @sc{html} output for the corresponding @TeX{}info commands in the
4489 @file{.texi} file, but the output might also contain illegal ``@sc{sgml}
4490 entities'' like @code{&140;}.
4491
4492 You might want change the conversion between characters and tokens in
4493 language @code{texi} by changing:
4494
4495 @vtable @code
4496 @itemx x-symbol-texi-user-table
4497 Extra entries for the conversion.
4498 @end vtable
4499
4500 @c ====================================================================
4501
4502 @node External Languages,  , TeXinfo Command, Supported Languages
4503 @comment  node-name,  next,  previous,  up
4504 @section Languages Defined in Other Emacs Packages
4505 @cindex Foreign Languages
4506 @cindex External Languages
4507 @cindex Other Languages
4508
4509 It is no problem for other Emacs packages to define their own token
4510 language (@pxref{Extending X-Symbol}).
4511
4512 I know of the following package---please check its manual for details.
4513
4514 @itemize @bullet
4515 @item
4516 @pindex ProofGeneral
4517 @cindex Isabelle Symbol
4518 Package @uref{@value{proofgeneralurl},ProofGeneral} defines token
4519 language ``Isabelle symbol''.
4520 @end itemize
4521
4522 @c ===========================================================================
4523
4524 @node X-Symbol Internals, Problems, Supported Languages, Top
4525 @comment  node-name,  next,  previous,  up
4526 @chapter X-Symbol Internals
4527 @cindex Internals, X-Symbol
4528 @cindex X-Symbol Internals
4529
4530 This section is outdated, it currently describes Version 3.4.2 of X-Symbol.
4531
4532 Package X-Symbol is distributed in two ways.  End-users should use the
4533 @emph{binary package} which contains pre-compiled files.  X-Symbol
4534 developers should use the @emph{source package} which contains some
4535 additional files.
4536
4537 @menu
4538 * Char Representation::         How X-Symbol represents X-Symbol chars.
4539 * Defining Charsets::           How X-Symbol defines additional chars.
4540 * Defining Input Methods::      How X-Symbol defines the input methods.
4541 * Extending X-Symbol::          How to add fonts and token languages.
4542 * Various Internals::           How X-Symbol handles other aspects.
4543 * Design Alternatives::         Why X-Symbol is not designed differently.
4544 * Language Internals::          How X-Symbol handles languages.
4545 * Misc Internals::              Various.  TODO.
4546 @end menu
4547
4548 @c ====================================================================
4549
4550 @node Char Representation, Defining Charsets, X-Symbol Internals, X-Symbol Internals
4551 @comment  node-name,  next,  previous,  up
4552 @section Internal Representation of X-Symbol Characters
4553 @cindex Charsym
4554 @cindex Leading Character
4555 @cindex Octet
4556 @cindex Cstring
4557 @cindex Mule Character
4558
4559 As mentioned in @ref{Pseudo Language}, most functions do not operate
4560 on X-Symbol characters directly, they use ``x-symbol charsyms''.  These
4561 charsyms have a symbol property @code{x-symbol-cstring} which points to
4562 a string, called @dfn{cstring}, containing the X-Symbol character.
4563
4564 @itemize @bullet
4565 @item
4566 Under Emacs and XEmacs/Mule, the string only contains the character
4567 which is a normal Mule character created by @code{make-char}.
4568
4569 @item
4570 @pindex font-lock
4571 Under XEmacs/no-Mule, the string only contains the 8bit character if the
4572 X-Symbol character is a 8bit character according to
4573 @code{x-symbol-default-coding} (@pxref{Default Coding}).  Otherwise, the
4574 string contains of a @dfn{leading character} (with range @samp{\200} to
4575 @samp{\237}) and an @dfn{octet}.  Package @code{font-lock} is used to
4576 display them correctly as X-Symbol characters (@pxref{FAQ Strange
4577 Chars}).  E.g., with @samp{\251} is @code{copyright}, we get
4578
4579 @lisp
4580 (get 'Idotaccent 'x-symbol-cstring)
4581      @result{} "\235\251"
4582 @end lisp
4583 @end itemize
4584
4585 If the character is also a 8bit character in some encoding (@pxref{File
4586 Coding}), the charsym also has the symbol property
4587 @code{x-symbol-file-cstrings} for the representation in the file and
4588 property @code{x-symbol-buffer-cstrings} to recognize character aliases
4589 (@pxref{Char Aliases}).  E.g., under XEmacs/no-Mule, with @samp{\335} is
4590 @code{Yacute}, @samp{\251} is @code{copyright}, we get
4591
4592 @lisp
4593 (get 'Idotaccent 'x-symbol-file-cstrings)
4594      @result{} (iso-8859-9 "\335" iso-8859-3 "\251")
4595 (get 'Idotaccent 'x-symbol-buffer-cstrings)
4596      @result{} (iso-8859-9 "\234\335" iso-8859-3 "\235\251")
4597 @end lisp
4598
4599 The values are plists (@pxref{Property Lists,,,lispref,XEmacs Lisp
4600 Reference Manual}) mapping the file coding to the strings in the file or 
4601 the buffer, respectively.
4602
4603 After token languages have been initialized, the charsym also has the
4604 symbol properties @code{x-symbol-tokens} (@pxref{Token Language}) and
4605 @code{x-symbol-classes} (@pxref{Char Group}):
4606
4607 @lisp
4608 (get 'Idotaccent 'x-symbol-tokens)
4609      @result{} (sgml "&#304;" tex "@{\\.I@}")
4610 (get 'Idotaccent 'x-symbol-classes)
4611      @result{} (sgml (non-l1) tex (text aletter))
4612 @end lisp
4613
4614 @c ====================================================================
4615
4616 @node Defining Charsets, Defining Input Methods, Char Representation, X-Symbol Internals
4617 @comment  node-name,  next,  previous,  up
4618 @section Defining X-Symbol Charsets
4619 @cindex Cset
4620 @cindex Charset
4621 @cindex Final Byte
4622
4623 An X-Symbol charset, called @dfn{cset} in the code and the docstrings,
4624 handles one font used by package X-Symbol.  Each cset must use the
4625 same char registry@minus{}encoding as the corresponding variables for
4626 the fonts (@pxref{Installing Fonts Lisp}).
4627
4628 You have to tell X-Symbol, how to define Mule charsets with Emacs or
4629 XEmacs/Mule and which leading character to use with XEmacs/no-Mule.  As
4630 an example, we use the definition of the Adobe symbol font.
4631
4632 @lisp
4633 @group
4634 (defvar x-symbol-xsymb0-cset
4635   '((("adobe-fontspecific") ?\233 -3600)
4636     (xsymb0-left  "X-Symbol characters 0, left"  94 ?:) .
4637     (xsymb0-right "X-Symbol characters 0, right" 94 ?\;)))
4638 @end group
4639 @end lisp
4640
4641 Mule charsets (@pxref{Charsets,,,lispref,XEmacs Lisp Reference Manual})
4642 may be used for 94 or 96 characters (this example: 94, only charset with
4643 dimension 1 can be defined with X-Symbol).  Thus, if your font provides
4644 more characters, you are likely to use both the left and the right half
4645 of the font to define two Mule charsets.  For both of them, you have to
4646 define a unique, free final character/byte of the standard ISO 2022
4647 escape sequence designating the charset (this example: @samp{:} and
4648 @samp{;}).  The remaining free (reserved by Emacs for users) are
4649 @samp{>} and @samp{?}, the latter is already used in XEmacs.
4650
4651 For XEmacs/no-Mule, you have to define the leading character (this
4652 example: @samp{\233}).
4653
4654 @vtable @code
4655 @item x-symbol-latin1-cset
4656 @itemx x-symbol-latin2-cset
4657 @itemx x-symbol-latin3-cset
4658 @itemx x-symbol-latin5-cset
4659 Cset definitions only using the upper halves of the fonts where the
4660 corresponding Mule charsets are known and which define characters which
4661 are considered 8bit characters in the corresponding encoding, see
4662 @ref{File Coding}.
4663
4664 @item x-symbol-xsymb0-cset
4665 @itemx x-symbol-xsymb1-cset
4666 Cset definitions using both halves of the fonts where no corresponding
4667 Mule charset are yet known.
4668 @end vtable
4669
4670 @c ====================================================================
4671
4672 @node Defining Input Methods, Extending X-Symbol, Defining Charsets, X-Symbol Internals
4673 @comment  node-name,  next,  previous,  up
4674 @section Defining Input Methods
4675 @cindex Input Method Internals
4676 @cindex Internals, Input Method
4677 @cindex Defining Input Methods
4678
4679 This is probably the hardest section in this manual@dots{}.
4680
4681 @menu
4682 * Input Method Objectives::     Input methods should be intuitive/consistent.
4683 * Intro Char Descriptions::     An example introducing char descriptions.
4684 * Char Descriptions::           The aspects and the contexts of a character.
4685 * Example Char Descriptions::   A complete example defining input methods.
4686 * Customizing Input Methods::   How to customize the input methods.
4687 @end menu
4688
4689
4690 @node Input Method Objectives, Intro Char Descriptions, Defining Input Methods, Defining Input Methods
4691 @comment  node-name,  next,  previous,  up
4692 @subsection Defining Input Methods: Objectives
4693 @cindex Input Method Objectives
4694 @cindex Objectives, Input Methods
4695 @cindex Consistent Input Methods
4696
4697 Input methods should be intuitive.  This requires consistency:
4698
4699 @itemize @bullet
4700 @item
4701 Characters should be found under the same header in the Grid and in the
4702 Menu.
4703
4704 @item
4705 If one character can be modified or rotated to another character
4706 (@pxref{Input Method Context}), both should stand near to each other in
4707 the Grid.  E.g., since @code{arrowsouthwest} rotates to
4708 @code{arrowdown}, they stand next to each other.
4709
4710 @item
4711 The key binding should be similar to the context of input method
4712 Context.  If two characters are defined to have the same context, they
4713 should have the same key prefix and the suffix should be a number which
4714 increases with the ``modify-to'' behavior.  E.g., @code{reflexsubset}
4715 with key binding @kbd{C-= < _ 2} modifies to @code{reflexsqsubset} with
4716 key binding @kbd{C-= < _ 3}.
4717
4718 @item
4719 Consistent definition of ``modify-to'' and ``rotate-to'': if A can be
4720 modified to B and rotated to C and C can be modified to D, B can be
4721 rotated to D in most cases.
4722
4723 @item
4724 It should be possible to load character definitions later on, e.g., when
4725 new token languages get initialized.
4726
4727 @itemize @minus
4728 @item
4729 Existing key bindings should not be overwritten.  If some of them have to
4730 change, it should be done in a uniform way (solution: key suffix
4731 @samp{1}).
4732
4733 @item
4734 Also, modifying or rotating a new character to/from old ones should be
4735 possible without changing the input definitions of the old characters.
4736 @end itemize
4737 @end itemize
4738
4739 Observation: It is impossible, especially with the possibility to load
4740 character definitions later on, to define the input methods directly,
4741 i.e., by something like @code{define-key}.  The solution is an indirect
4742 definitions with ``character descriptions''.
4743
4744
4745 @node Intro Char Descriptions, Char Descriptions, Input Method Objectives, Defining Input Methods
4746 @comment  node-name,  next,  previous,  up
4747 @subsection X-Symbol Character Descriptions: Example
4748 @cindex Character Descriptions, Intro
4749 @cindex Character Descriptions, Example
4750
4751 As an example for ``character descriptions'', look at the definition of
4752 @code{longarrowright} in @code{x-symbol-xsymb1-table} (@samp{95} is the
4753 encoding in the font and not of interest here).  Some terms are defined
4754 in the next section:
4755
4756 @lisp
4757 @group
4758 (longarrowright 95
4759  (arrow) (size big . arrowright) nil ("->" t "-->") (emdash))
4760 @end group
4761 @end lisp
4762
4763 With this definition, package X-Symbol automatically defines:
4764
4765 @itemize @bullet
4766 @item
4767 Key bindings @kbd{C-= - - >} and @kbd{C-= - > 2}, the latter has suffix
4768 2, because @kbd{C-= - >} is also ``wanted'' by @code{arrowright} which
4769 now has the key binding @kbd{C-= - > 1} (the ``score'' of
4770 @code{longarrowright} is higher, due to @samp{size big}).  @xref{Input
4771 Method Keyboard}.
4772
4773 @item
4774 @code{arrowright} modifies to @code{longarrowright}, which modifies to
4775 @code{arrowright}.  @xref{Input Method Context}.
4776
4777 @item
4778 @code{longarrowleft} rotates to @code{longarrowright}, which rotates to
4779 @code{longarrowboth} (which rotates to @code{longarrowleft}).  (The
4780 ``rotate aspects'' are inherited from @code{arrowright}.)  @xref{Input
4781 Method Context}.
4782
4783 @item
4784 The following contexts can be modified to @code{longarrowright}:
4785 @samp{-->} or @code{minus1} / @code{endash} / @code{macron} /
4786 @code{emdash} / @code{hyphen} and @samp{->} (since all define context
4787 @samp{-}) and @code{emdash} and @samp{>} (since @code{emdash} defines
4788 context @samp{--}).  @samp{->} is used for @code{arrowright}, which has
4789 a lower score, see above.  @xref{Input Method Context}.
4790
4791 @item
4792 Input method Electric will change context @samp{-->} (is tagged with
4793 @code{t} in the definition) to @code{longarrowright}, also @code{emdash}
4794 and @samp{>} (only theoretically, since input method Electric will
4795 produce @code{emdash} only in @TeX{}'s text mode, and
4796 @code{longarrowright} only in @TeX{}'s math mode).  @xref{Input Method
4797 Electric}.
4798
4799 @item
4800 The character will appear in the Grid under the header @samp{Arrow}.
4801 You will probably recognize that the placement is based on the modify-to
4802 and rotate-to behavior above.  @xref{Input Method Grid}.
4803
4804 @item
4805 The character will appear in the Menu under one of the headers
4806 @samp{Arrow @var{n}}".  The submenus are sorted alphabetically.
4807 @xref{Input Method Menu}.
4808 @end itemize
4809
4810 Consider that this character would be missing in package X-Symbol and
4811 you want to define your own character (in your own font).  With the
4812 current scheme, the one line above is enough!  Have fun defining all the
4813 consequences directly instead@dots{}.
4814
4815
4816 @node Char Descriptions, Example Char Descriptions, Intro Char Descriptions, Defining Input Methods
4817 @comment  node-name,  next,  previous,  up
4818 @subsection Defining Input Methods by Character Descriptions
4819 @cindex Character Descriptions
4820 @cindex Aspects of Characters
4821 @cindex Parent Character
4822 @cindex Component of Characters
4823 @cindex Modify Scores
4824 @cindex Rotate Scores
4825 @cindex Modify Aspects
4826 @cindex Rotate Aspects
4827 @cindex Score of a Character
4828 @cindex Modify Chain
4829 @cindex Exclusive Modify Chain
4830 @cindex Rotate Chain
4831 @cindex Horizontal Chain
4832 @cindex Key Chain
4833
4834 Characters are defined with @dfn{character descriptions} which consist
4835 of different @dfn{aspects} and @dfn{contexts}, which can also be
4836 inherited from a @dfn{parent} character.  All characters which are
4837 connected with parents, form a @dfn{component}.  Aspects and contexts
4838 are used to determine the modify-to and rotate-to chain for characters,
4839 the contexts for input method Context and Electric, the key bindings,
4840 and the position in the Menu and the Grid.
4841
4842 If you want to check the component, scores, etc of a specific character,
4843 look at the symbol property (e.g., with @kbd{M-x hyper-apropos-get-doc})
4844 of the corresponding charsym, e.g., @code{arrowright}.  See also the
4845 docstrings of @code{x-symbol-init-cset} and @code{x-symbol-init-input}.
4846
4847 Remember, all characters which are connected with parents, form a
4848 component.  @dfn{Contexts} are the contexts of input method Context
4849 (@pxref{Input Method Context}).  If a table entry of a charsym does not
4850 define its own contexts, they are the same as the contexts of the
4851 charsym in an earlier position in the modify chain (see below), or the
4852 contexts of the first charsym with defined contexts in the modify chain.
4853 The @dfn{modify context} of a charsym is the first context.
4854
4855 @vtable @code
4856 @item x-symbol-rotate-aspects-alist
4857 Characters in the same component whose aspects only differ by their
4858 @code{direction} (@code{east},@dots{}), a key in this alist, are
4859 circularly connected by ``rotate-to''.  The sequence in the @dfn{rotate
4860 chain} is determined by @dfn{rotate scores} depending on the values in
4861 the @dfn{rotate aspects}.  Charsyms with the same ``rotate-aspects'' are
4862 not connected (charsyms with the smallest modify scores are preferred).
4863
4864 @lisp
4865 (get 'longarrowright 'x-symbol-rotate-aspects)
4866      @result{} (-1500 direction east)
4867 @end lisp
4868
4869 @item x-symbol-modify-aspects-alist
4870 Characters in the same components whose aspects only differ by their
4871 @code{size} (@code{big},@dots{}), @code{shape} (@code{round},
4872 @code{square}@dots{}) and/or @code{shift} (@code{up},
4873 @code{down},@dots{}), keys in this alist, are circularly connected by
4874 ``modify-to'', if all their modify contexts are used exclusively, i.e.,
4875 no other modify chain uses any of them.  The sequence in the @dfn{modify
4876 chain} is determined by @dfn{modify scores} depending on the values in
4877 the @dfn{modify aspects}, the charsym score defined in the definition
4878 tables and the score of the whole cset (@pxref{Defining Charsets}).
4879
4880 @lisp
4881 (get 'longarrowright 'x-symbol-score)
4882      @result{} -3500
4883 (get 'longarrowright 'x-symbol-modify-aspects)
4884      @result{} (1500 shift nil shape nil size big)
4885 @end lisp
4886
4887 Otherwise, the ``modify chain'' is divided into modify subchains, which
4888 are those charsyms sharing the same modify context.  All modify
4889 subchains using the same modify context, build a @dfn{horizontal chain}
4890 whose charsyms are circularly connected by ``modify-to''.
4891
4892 We build a @dfn{key chain} for all contexts (not just modify contexts),
4893 consisting of all charsyms (sorted according to modify scores) having
4894 the context.  Input method Context modifies the context to the first
4895 charsym in the key chain.
4896
4897 @item x-symbol-key-suffix-string
4898 If there is only one charsym in the key chain, @kbd{C-=} plus the
4899 context inserts the charsym.  Otherwise, we determine a suffix for each
4900 charsym in the key chain by its index and this string.  @kbd{C-=} plus
4901 the context plus the suffix inserts the charsym.
4902 @end vtable
4903
4904
4905 @node Example Char Descriptions, Customizing Input Methods, Char Descriptions, Defining Input Methods
4906 @comment  node-name,  next,  previous,  up
4907 @subsection Defining Input Methods: Example
4908 @cindex Character Descriptions, Example
4909
4910 @smallexample
4911 An example:  Modify  Modify  Rotate  Rotate  Modify   Other
4912              Score   Aspect  Score   Aspect  Context  Contexts
4913 --------------------------------------------------------------
4914 charsym 1w    150     nil     100     west    `a'      `c'
4915 charsym 2w    200     nil     100     west    `b'       -
4916 charsym 3w    350     big     100     west   (`b')     (-)
4917 charsym 1e    100     nil     200     east   (`a')    (`b')
4918 charsym 2e    250     big     200     east    `a'      `b'
4919 charsym 3e    300     big     200     east    `a'       -
4920 charsym 1n    100     nil     300     north   `d'      `c'
4921 charsym 2n    200     big     300     north   `c'       -
4922 @end smallexample
4923
4924 Assuming that all charsyms form one component, we have:
4925
4926 @smallexample
4927 Rotate chains:     (1w,2w)-1e-1n @r{and} 3w-(2e,3e)-2n.
4928 Modify chains:     1w-2w-3w @r{and} 1e-2w-3w and 1n-2n.
4929 Horizontal chains: 1e-1w-2e-3e       @r{(for modify context @samp{a})}
4930                    2w-3w             @r{(for modify context @samp{b})}
4931 Key chains:        1e-1w-2e-3e       @r{(for context @samp{a})}
4932                    1e-2w-2e-3w       @r{(for context @samp{b})}
4933                    1n-1w-2n          @r{(for context @samp{c})}
4934                    1n                @r{(for context @samp{d})}
4935 @end smallexample
4936
4937 That makes the following bindings:
4938
4939 @smallexample
4940 Rotate-to: 1w->1e, 2w->1e, 1e->1n, 1n->1w
4941            3w->2e, 2e->2n, 3e->2n, 2n->3w
4942 Modify-to: 1e->1w, 1w->2e, 2e->3e, 3e->1e     @r{(horizontal chain)}
4943            2w->3w, 3w->2w                     @r{(horizontal chain)}
4944            1n->2n, 2n->1n  @r{(modify chain with exclusive modify contexts)}
4945 CONTEXTS:  `a'->1e, `b'->1e, `c'->1n, `d'->1n
4946 KEY:       `a1'=1e, `a2'=1w, `a3'=2e, `a4'=3e, `b1'=1e, ..., `d'=1n
4947 @end smallexample
4948
4949
4950 @node Customizing Input Methods,  , Example Char Descriptions, Defining Input Methods
4951 @comment  node-name,  next,  previous,  up
4952 @subsection Customizing Input Methods
4953 @cindex Customizing Input Methods
4954 @cindex Input Methods Customization
4955
4956 When defining contexts for characters, you should try to use default
4957 contexts to make them and key bindings as consistent as possible.  E.g.,
4958 package X-Symbol only defines explicit contexts for 186 of the 437
4959 characters.
4960
4961 @vtable @code
4962 @item x-symbol-group-input-alist
4963 Defines default scores and bindings for characters of a group
4964 (@pxref{Char Group}).  E.g., the definition (in
4965 @code{x-symbol-latin1-table})
4966
4967 @lisp
4968 (aacute 225 (acute "a" Aacute))
4969 @end lisp
4970
4971 defines @code{aacute} without any explicit contexts, but having the
4972 group @code{acute} and the subgroup @samp{a}.  The default input for the 
4973 group is defined by the following element in this variable:
4974
4975 @lisp
4976 (acute 0 "%s'" t "'%s")
4977 @end lisp
4978
4979 That means: 0 is added to the normal ``modify-score'' of the character.
4980 @samp{%s'} and @samp{'%s} with @samp{%s} substituted by the subgroup,
4981 i.e., @samp{a'} and @samp{'a}, are the contexts for @code{aacute}.  The
4982 context @samp{'a} is also used for input method Electric since it is
4983 prefixed by @code{t}.
4984
4985 @item x-symbol-key-min-length
4986 It is quite unlikely that a one-character context is not the prefix of
4987 another context, at least when loading additional font definitions.  In
4988 order not to have to change key bindings @kbd{C-= @var{key}} to @kbd{C-=
4989 @var{key} 1}, it is required that the length of the key binding without
4990 @kbd{C-=} is at least 2.
4991 @end vtable
4992
4993 @c ====================================================================
4994
4995 @node Extending X-Symbol, Various Internals, Defining Input Methods, X-Symbol Internals
4996 @comment  node-name,  next,  previous,  up
4997 @section Extending Package X-Symbol
4998 @cindex Extending X-Symbol
4999
5000 In this section, you are told what to consider and what to do when
5001 extending package X-Symbol with new characters and new token languages.
5002 If you only want to define a token language using existing characters,
5003 you only have to read the last section.
5004
5005 @menu
5006 * Extending with Fonts::        How to add fonts to X-Symbol.
5007 * Input Definitions::           Guidelines for input definitions.
5008 * Font Definition File::        How to define new character in a file.
5009 * Language Extension File::     Extending an existing language.
5010 * Language Definition File::    Defining a new language.
5011 @end menu
5012
5013
5014 @node Extending with Fonts, Input Definitions, Extending X-Symbol, Extending X-Symbol
5015 @comment  node-name,  next,  previous,  up
5016 @subsection Extending X-Symbol with New Fonts
5017 @cindex Extending with Fonts
5018 @cindex Adding Fonts
5019 @cindex Font Extension
5020 @cindex Guidelines, Font Extension
5021
5022 If you add a new token language to package X-Symbol which should
5023 represent tokens by characters which are not yet defined by package
5024 X-Symbol, you have to add a new font to package X-Symbol, first.
5025
5026 When adding new fonts to package X-Symbol, consider that X-Symbol has to
5027 run under Emacs, XEmacs/Mule and XEmacs/no-Mule.
5028
5029 Running under Emacs and XEmacs/Mule requires that you cannot use all
5030 encodings in a font for characters: you should probably only use
5031 encodings 33 to 126 and 160 to 255.  You should also use a unique pair
5032 of charset properties @samp{CHARSET_REGISTRY} and
5033 @samp{CHARSET_ENCODING}.
5034
5035 Running under XEmacs/no-Mule can leads to problems when major modes do
5036 not check whether the previous character is an escape character (in our
5037 case, a leading character, @pxref{Char Representation}) when looking at a
5038 character.  Thus, you should probably not use encodings which represent
5039 characters in your default font with a special syntax.
5040
5041 @itemize @bullet
5042 @item
5043 In general, escape sequences use the digits of the current font.  Thus,
5044 you should probably define the encodings 48 to 57 as digits @samp{0} to
5045 @samp{9}.
5046
5047 @item
5048 In La@TeX{} buffers, characters in @samp{$%\@{@}} have a special
5049 syntax.  Thus, you should probably not use encodings 36, 37,
5050 92, 123 and 125 for characters which could also be useful with token
5051 languages @code{tex} and @code{utex}.
5052
5053 @item
5054 In HTML buffers, characters in @samp{&<>} have a special syntax.  Thus,
5055 you should probably not use encodings 38, 60 and 62 for
5056 characters which could also be useful with token language @code{sgml}.
5057 @end itemize
5058
5059 You have to tell package X-Symbol which fonts to use for the normal
5060 text, subscripts and superscripts.  @xref{Installing Fonts Lisp}.
5061
5062 You have to tell X-Symbol, how to define Mule charsets with Emacs and
5063 XEmacs/Mule and which leading character to use with XEmacs/no-Mule.
5064 @xref{Defining Charsets}.
5065
5066
5067 @node Input Definitions, Font Definition File, Extending with Fonts, Extending X-Symbol
5068 @comment  node-name,  next,  previous,  up
5069 @subsection Guidelines for Input Definitions
5070 @cindex Input Definitions, Guidelines
5071 @cindex Guidelines, Input Definitions
5072
5073 Read section @ref{Defining Input Methods}.  Look at the tables in
5074 @file{x-symbol.el}.  Here are some guidelines of how to define the input
5075 methods for new characters:
5076
5077 @enumerate
5078 @item
5079 Define reasonable character groups for new characters, see @ref{Char
5080 Group}.  E.g., if you add the IPA font for phonetic characters, you
5081 are likely to define at least one additional charset group.  If you do
5082 not know whether to use one or two groups for a set of characters, use
5083 two.
5084
5085 @item
5086 Define under which Grid/Menu header the character of the new character
5087 group should appear.  You may also want to add additional headers for
5088 these characters.  @xref{Char Group}.
5089
5090 @item
5091 If reasonable, define default contexts for characters of a group, see
5092 @ref{Customizing Input Methods}.
5093
5094 @item
5095 For the other characters, define contexts by Ascii sequences which look
5096 similar to the character.
5097
5098 @item
5099 Form a component for a set of characters which are strongly related to
5100 each other.  In most cases, characters of a component are in the same
5101 group but not vice versa.  E.g., the simple arrows already defined by
5102 package X-Symbol form one component.  You form a component of characters
5103 by specifying parents in their definition, see @ref{Char Descriptions}.
5104
5105 @item
5106 Use aspects to describe the new characters.  Add new aspects to
5107 @code{x-symbol-modify-aspects-alist} and
5108 @code{x-symbol-rotate-aspects-alist} if necessary (@pxref{Char
5109 Descriptions}).
5110
5111 @item
5112 Finish the definition of your font file (@pxref{Font Definition File}),
5113 load it with @kbd{M-x load-file}, and initialize the input methods,
5114 e.g., by invoking the grid (@kbd{M-x x-symbol-grid}).
5115
5116 @item
5117 If there are no errors, you are likely to get warnings about equal
5118 modify scores.  In this case, the sequence of characters in the
5119 modify-to chain is random, so are the numerical suffixes of key bindings.
5120
5121 @enumerate a
5122 @item
5123 Define a base score for the whole X-Symbol charset (``cset score'')
5124 which should be a positive number in order not to change the key bindings 
5125 of previously defined X-Symbol characters.
5126
5127 @item
5128 Define reasonable scores for newly defined aspects and character groups.
5129
5130 @item
5131 Finally, fine-tune your definitions by charsym scores in the tables.
5132 This should be necessary only for a few characters.
5133 @end enumerate
5134 @end enumerate
5135
5136
5137 @node Font Definition File, Language Extension File, Input Definitions, Extending X-Symbol
5138 @comment  node-name,  next,  previous,  up
5139 @subsection Emacs Lisp File Defining a New Font
5140 @cindex Font Definition File
5141
5142 Now put all things together in a separate font definition file.  You
5143 should not put it in a language definition file.
5144
5145 Here is a tiny example using only the lower half of the font:
5146
5147 @lisp
5148 (provide 'x-symbol-myfont)
5149 @group
5150 (defvar x-symbol-myfont-fonts
5151   '(("-xsymb-myfont-medium-r-normal--14-140-75-75-p-85-xsymb-myfont")
5152     ("-xsymb-myfont_sub-medium-r-normal--12-120-75-75-p-74-xsymb-myfont")
5153     ("-xsymb-myfont_sup-medium-r-normal--12-120-75-75-p-74-xsymb-myfont")))
5154 @end group
5155 @group
5156 (defvar x-symbol-myfont-cset
5157   '((("xsymb-myfont") ?\200 1000)
5158     (myfont-left "My font characters, left"  94 63) . nil))
5159 @end group
5160 @end lisp
5161
5162 @lisp
5163 @group
5164 (defvar x-symbol-myfont-table
5165   '((longarrownortheast 33 (arrow) (size big . arrownortheast))
5166     (koerper 34 (setsymbol "K"))
5167     (circleS 35 (symbol "S") nil nil "SO")))
5168 @end group
5169 @group
5170 (x-symbol-init-cset x-symbol-myfont-cset x-symbol-myfont-fonts
5171                       x-symbol-myfont-table)
5172 @end group
5173 @end lisp
5174
5175 Due to an XEmacs bug with char syntax @code{inherit}, you should also
5176 add the following line to files @file{x-symbol-xmas20.el} and
5177 @file{x-symbol-xmas21.el}:
5178
5179 @lisp
5180   (modify-syntax-entry ?\200 "\\" (standard-syntax-table))
5181 @end lisp
5182
5183
5184 @node Language Extension File, Language Definition File, Font Definition File, Extending X-Symbol
5185 @comment  node-name,  next,  previous,  up
5186 @subsection Emacs Lisp File Extending a Token Language
5187 @cindex Language Definition File
5188
5189 If you want to use the new font to extend an existing token language,
5190 define a new token language which inherits most variables from the
5191 ``parent language''.  E.g., token language @code{utex} inherits most
5192 variables from @code{tex}, see @file{x-symbol-utex.el}.
5193
5194 A language must define variables for all language aspects, see
5195 @ref{Language Internals}.  Our example defines a language @code{mytex}
5196 using the additional characters from @ref{Font Definition File}.
5197
5198 First, you have to register the language in a startup file:
5199
5200 @lisp
5201 (defvar x-symbol-mytex-name "My TeX macro")
5202 (defvar x-symbol-mytex-modes nil)
5203 (x-symbol-register-language 'mytex 'x-symbol-mytex x-symbol-mytex-modes)
5204 @end lisp
5205
5206 The language definition file should look like (leaving out most parts
5207 which are similar to the ones in @file{x-symbol-utex.el}):
5208
5209 @lisp
5210 (provide 'x-symbol-mytex)
5211 (require 'x-symbol-tex)
5212 (defvar x-symbol-mytex-required-fonts '(x-symbol-myfont))
5213 (put 'mytex 'x-symbol-font-lock-keywords 'x-symbol-tex-font-lock-keywords)
5214 @end lisp
5215
5216 @lisp
5217 (defvar x-symbol-mytex-user-table nil)
5218 @group
5219 (defvar x-symbol-mytex-myfont-table
5220   '((longarrownortheast (math arrow user) "\\longnortheastarrow")
5221     (koerper (math letter user) "\\setK")
5222     (circleS (math ordinary amssymb) "\\circledS")))
5223 @end group
5224 @group
5225 (defvar x-symbol-mytex-table
5226   (append x-symbol-mytex-user-table
5227           '(nil)
5228           x-symbol-mytex-myfont-table
5229           x-symbol-tex-table))
5230 @end group
5231 @end lisp
5232
5233 It is important that you do not define a variable for the language
5234 access @code{x-symbol-font-lock-keywords}, but rather use the variable
5235 of the parent language directly, see @ref{Language Internals}.
5236
5237 During the testing phase, you should probably leave out the
5238 @samp{'(nil)} which prevents warnings about redefinitions for the
5239 following elements.
5240
5241
5242 @node Language Definition File,  , Language Extension File, Extending X-Symbol
5243 @comment  node-name,  next,  previous,  up
5244 @subsection Emacs Lisp File Defining a New Token Language
5245 @cindex Language Definition File
5246
5247 You might also want to define a new token language not based on another
5248 language.
5249
5250 As an example, consider a token language ``My Unicode'' (@code{myuc})
5251 for buffers with major mode @code{myuc-mode}.  Thus, we register the
5252 language by:
5253
5254 @lisp
5255 (defvar x-symbol-myuc-name "My Unicode")
5256 (defvar x-symbol-myuc-modes '(myuc-mode))
5257 (x-symbol-register-language 'myuc 'x-symbol-myuc x-symbol-myuc-modes)
5258 @end lisp
5259
5260 Each token if language @code{myuc} consists of @samp{#} plus the
5261 hexadecimal representation of the Unicode with hexadecimal values where
5262 the case of digits is not important and the preferred case is upcase.  A 
5263 single @samp{#} is represented by the token @code{##}.  In order to be
5264 more flexible, we want to define the tokens by their decimal value in
5265 the table.  There are no subscript and no images.  The code below
5266 (@file{x-symbol-myuc.el}) is included in the source distribution of
5267 package X-Symbol.
5268
5269 @lisp
5270 (provide 'x-symbol-myuc)
5271 (defvar x-symbol-myuc-required-fonts nil)
5272 (defvar x-symbol-myuc-modeline-name "myuc")
5273 @group
5274 (defvar x-symbol-myuc-class-alist
5275   '((VALID "My Unicode" (x-symbol-info-face))
5276     (INVALID "no My Unicode" (red x-symbol-info-face))))
5277 @end group
5278 (defvar x-symbol-myuc-font-lock-keywords nil)
5279 (defvar x-symbol-myuc-image-keywords nil)
5280 @dots{}
5281 @end lisp
5282
5283 @lisp
5284 (defvar x-symbol-myuc-case-insensitive 'upcase)
5285 (defvar x-symbol-myuc-token-shape '(?# "#[0-9A-Fa-f]+\\'" . "[0-9A-Fa-f]"))
5286 (defvar x-symbol-myuc-exec-specs '(nil (nil . "#[0-9A-Fa-f]+")))
5287 (defvar x-symbol-myuc-input-token-ignore nil)
5288 @end lisp
5289
5290 @lisp
5291 @group
5292 (defun x-symbol-myuc-default-token-list (tokens)
5293   (list (format "#%X" (car tokens))))
5294 @end group
5295 (defvar x-symbol-myuc-token-list 'x-symbol-myuc-default-token-list)
5296 (defvar x-symbol-myuc-user-table nil)
5297 @group
5298 (defvar x-symbol-myuc-xsymb0-table
5299   '((alpha () 945) (beta () 946)))
5300 @end group
5301 @group
5302 (defvar x-symbol-myuc-table
5303   (append x-symbol-myuc-user-table x-symbol-myuc-xsymb0-table))
5304 @end group
5305 @dots{}
5306 @end lisp
5307
5308 @c ====================================================================
5309
5310 @node Various Internals, Design Alternatives, Extending X-Symbol, X-Symbol Internals
5311 @comment  node-name,  next,  previous,  up
5312 @section Various Internals
5313
5314 @menu
5315 * Tagging Insert Commands::     Don't break input methods Token and Electric.
5316 * Avoiding Flickering::         Moving cursor in invisible commands.
5317 @end menu
5318
5319
5320 @node Tagging Insert Commands, Avoiding Flickering, Various Internals, Various Internals
5321 @comment  node-name,  next,  previous,  up
5322 @subsection Tagging Insert Commands for Token and Electric
5323 @cindex Insert Commands, Tagging
5324 @cindex Tagging Insert Commands
5325 @cindex Recognizing Insert Commands
5326
5327 Input methods Token (@pxref{Input Method Token}) and Electric
5328 (@pxref{Input Method Electric}) stop their auto replacement if you use a 
5329 command which is not an insert command.
5330
5331 @ftable @code
5332 @item self-insert-command
5333 @itemx newline
5334 @itemx newline-and-indent
5335 @itemx reindent-then-newline-and-indent
5336 @itemx tex-insert-quote
5337 @itemx TeX-insert-quote
5338 @itemx TeX-insert-punctuation
5339 @itemx TeX-insert-dollar
5340 @itemx sgml-close-angle
5341 @itemx sgml-slash
5342 These commands and commands aliased to these are recognized as input
5343 commands by having a non-@code{nil} value of its symbol property
5344 @code{x-symbol-input}.
5345 @end ftable
5346
5347
5348 @node Avoiding Flickering,  , Tagging Insert Commands, Various Internals
5349 @comment  node-name,  next,  previous,  up
5350 @subsection Avoiding Hide/Show-Invisible Flickering
5351 @cindex Avoiding Flickering
5352 @cindex Flickering, Invisible
5353 @cindex Invisible Flickering
5354
5355 Starting a command makes a previously revealed super- or subscript
5356 command (@pxref{Super and Subscripts}) invisible again.  Repeatedly
5357 invoking commands which moves the point just by a small amount can lead
5358 to some flickering.
5359
5360 @ftable @code
5361 @item forward-char
5362 @itemx forward-char-command
5363 @itemx backward-char
5364 @itemx backward-char-command
5365 If the point position after the execution of these commands is still
5366 ``at'' the super- or subscript command, the command won't be made
5367 invisible at the first place.  Each of these four commands have a
5368 function (@code{1+} and @code{1-}) as the value of its symbol property
5369 @code{x-symbol-point-function} which returns the position ``after'' when
5370 called with the position ``before''.
5371 @end ftable
5372
5373 @c ====================================================================
5374
5375 @node Design Alternatives, Language Internals, Various Internals, X-Symbol Internals
5376 @comment  node-name,  next,  previous,  up
5377 @section Design Alternatives
5378
5379 This section describes potential design alternatives and why they were
5380 not used.
5381
5382 @menu
5383 * Alt Token Representations::   Why we need the conversion.
5384 * Alt Global Mode::             How to turn on X-Symbol globally.
5385 * Alt Auto Conversion::         When do we convert automatically.
5386 @end menu
5387
5388
5389 @node Alt Token Representations, Alt Global Mode, Design Alternatives, Design Alternatives
5390 @comment  node-name,  next,  previous,  up
5391 @subsection Alternative Token Representations
5392 @cindex Alternative Token Representations
5393 @cindex Token Representation, Alternatives
5394
5395 Package X-Symbol represents tokens in the file by characters in the
5396 buffer.  This requires an automatic conversion when visiting a file or
5397 saving a buffer, see @ref{Conversion}.
5398
5399 Another possibility would be to use the tokens directly in the buffer
5400 and just display them differently.  You would need no conversion and you
5401 could copy the text easily to a message buffer.  This could be done by a
5402 special face and an additional font-lock keyword for every token.  The
5403 disadvantages make this approach unfeasible:
5404
5405 @itemize @bullet
5406 @item
5407 The editing commands would work on the tokens which are invisible for
5408 the user.
5409
5410 @item
5411 Extremely resource and startup-time consuming.  If as many characters
5412 should be supported as done by package X-Symbol, including superscripts
5413 and subscripts, more than 2000 faces with display tables would have to
5414 be defined even without considering char aliases!
5415
5416 @item
5417 Time consuming.  More than 2000 entries in you font-lock keywords would
5418 slow down the fontification considerably, which would be too much even
5419 when using @code{lazy-shot}!
5420 @end itemize
5421
5422 Another possibility would be to adapt @TeX{} to the representations of
5423 the corresponding characters in Emacs' buffer.  Again, you would need no
5424 conversion.  The disadvantages make this approach too restrictive:
5425
5426 @itemize @bullet
5427 @item
5428 You cannot adopt @sc{sgml} to this approach.
5429
5430 @item
5431 You cannot read normal La@TeX{} files directly, you do not write normal
5432 La@TeX{} files.
5433
5434 @item
5435 You would have different @TeX{} versions: one for X-Symbol with Emacs
5436 and XEmacs/Mule, one with XEmacs/no-Mule.
5437
5438 @item
5439 If you are not an extremely good @TeX{} hacker, it would be impossible
5440 to adopt this approach to support more than 256 characters.
5441 @end itemize
5442
5443 A third alternative would be very similar to the method used in this
5444 package.  There would be just a slight difference when running under
5445 XEmacs/no-Mule: the internal representation of a character is always
5446 just one character, but we would also provide font properties for
5447 characters not of your default font.  The disadvantages make this
5448 approach too unsafe:
5449
5450 @itemize @bullet
5451 @item
5452 Problems with current search/replace commands.
5453
5454 @item
5455 Problems with the current version of @code{font-lock} (it should @emph{never}
5456 overwrite the font property for this character, even if the character
5457 matches some @var{match} in @code{font-lock-keywords} and
5458 @var{overwrite} is non-@code{nil}).  This gets even more difficult with
5459 superscripts/subscripts.
5460
5461 @item
5462 Unless you can provide a syntax table for faces (you cannot), characters
5463 in different faces with the same encoding are in the same syntax class,
5464 which is irritating: e.g., @code{\leftrightarrow} and @code{\approx}
5465 would be delimiters.
5466 @end itemize
5467
5468
5469 @node Alt Global Mode, Alt Auto Conversion, Alt Token Representations, Design Alternatives
5470 @comment  node-name,  next,  previous,  up
5471 @subsection Alternative Ways to Turn on X-Symbol Globally
5472 @cindex Alternative Global Mode
5473 @cindex Global Mode, Alternatives
5474 @cindex Turn on Globally, Alternatives
5475
5476 This package hooks itself into @code{hack-local-variables-hook} which
5477 makes the installation very simple.
5478
5479 Another possibility would be to use the major-mode hooks which is the
5480 normal way how to turn on a minor mode.  The disadvantages are:
5481
5482 @itemize @bullet
5483 @item
5484 The installation is more complicated.
5485
5486 @item
5487 Local variables in files are not yet processed (this was the main reason
5488 not to do it this way).
5489 @end itemize
5490
5491 Another possibility would be to hook X-Symbol into
5492 @code{find-file-hooks}, as it is done in old versions of package
5493 X-Symbol.  It would be as easy as the current approach but we would have
5494 to be careful with sequence of functions in @code{find-file-hooks},
5495 especially with the function hooked in by @code{font-lock}.
5496
5497
5498 @node Alt Auto Conversion,  , Alt Global Mode, Design Alternatives
5499 @comment  node-name,  next,  previous,  up
5500 @subsection Alternative Auto Conversion Methods
5501 @cindex Alternative Auto Conversion
5502 @cindex Auto Conversion, Alternatives
5503
5504 @vindex hack-local-variables-hook
5505 @vindex after-insert-file-functions
5506 @vindex write-region-annotate-functions
5507 Without package @code{crypt}, this package automatically decodes tokens
5508 when turning on the minor mode (in @code{hack-local-variables-hook},
5509 @pxref{Alt Global Mode}) or in @code{after-insert-file-functions}.  This
5510 package automatically encodes characters in
5511 @code{write-region-annotate-functions}.  The disadvantage is that the
5512 possibility to change buffers in @code{write-region-annotate-functions}
5513 is not official (@pxref{Wishlist Emacs}), i.e., not mentioned in the
5514 docstring (only mentioned for corresponding encode-functions of package
5515 @code{format} which use a similar loop in the C code).
5516
5517 @vindex write-file-hooks
5518 With package @code{crypt}, this package automatically decodes tokens
5519 when turning on the minor mode.  This package automatically encodes
5520 characters in @code{write-file-hooks}.  The disadvantage is that the
5521 encoding is slower (use @code{jka-compr} instead @code{crypt}) and the
5522 problem with @code{vc-next-action} (@pxref{Spurious Encodings}).
5523
5524 @vindex write-file-data-hooks
5525 Without package @code{crypt}, Version 2.6 of this package automatically
5526 encoded characters in @code{write-file-data-hooks}.  The advantage was
5527 that changing buffers there is official, the disadvantage is that it is
5528 also more complicated.
5529
5530 @pindex format
5531 A totally different method would be to use package @code{format}.
5532 Unfortunately, this is not really possible, since a @var{regexp} in
5533 @code{format-alist} is much too weak, i.e., X-Symbol's decoding does not
5534 change any file headers which would represent the file format.  In
5535 XEmacs, this package also fails to work properly with @code{jka-compr}
5536 and @code{crypt}.
5537
5538 @c ====================================================================
5539
5540 @node Language Internals, Misc Internals, Design Alternatives, X-Symbol Internals
5541 @comment  node-name,  next,  previous,  up
5542 @section Language Internals
5543 @cindex Language Internals
5544 @cindex Token Language Internals
5545 @cindex Internals, Languages
5546 @cindex Registered Languages
5547 @cindex Loaded Language
5548 @cindex Initialized Language
5549 @cindex Language Access
5550 @cindex Accessing Language Depending Variables
5551
5552 In order to use a token language or accessing one of the language
5553 dependent values, the following conditions must be met:
5554
5555 @itemize @bullet
5556 @item
5557 The language must be @dfn{registered}.  This makes it possible to select
5558 the language in the menus.  It also prevents to load a potentially
5559 dangerous file when a file specifies a buffer-local value of
5560 @code{x-symbol-language}.
5561
5562 @ftable @code
5563 @item x-symbol-register-language
5564 Registering a language includes stating the name of the feature (i.e., a
5565 file) which provides the language.  The name of the language must have
5566 been already defined.
5567 @end ftable
5568
5569 @item
5570 The file providing the language must have been @dfn{loaded}.  This will
5571 be done automatically when the language is initialized.  Customizing
5572 X-Symbol will also load the language files.
5573
5574 @item
5575 The language must be @dfn{initialized}.  This will be done automatically
5576 if the language is used.  This loads the language file and fails if the
5577 language has not been registered.  If some minor language information is
5578 needed, e.g., in the highlight menu of the Grid (@pxref{Input Method
5579 Grid}), you should initialize the language explicitly, e.g., by the
5580 following command:
5581
5582 @table @kbd
5583 @item M-x x-symbol-init-language-interactive
5584 @findex x-symbol-init-language-interactive
5585 Initialized a token language if it is not already initialized.
5586 @end table
5587 @end itemize
5588
5589 Language dependent values are accessed by language accesses:
5590
5591 @table @code
5592 @item x-symbol-language-value
5593 @findex x-symbol-language-value
5594 Returns the language depending value.  Also initializes language if
5595 necessary.  E.g., we get the name of a language by the language access
5596 @code{x-symbol-name}.  With a simplified expansion, we get
5597
5598 @lisp
5599 (x-symbol-language-value 'x-symbol-name 'tex)
5600      @expansion{} (symbol-value (get 'tex 'x-symbol-name))
5601      @result{} (symbol-value 'x-symbol-tex-name)
5602      @result{} "TeX macro"
5603 @end lisp
5604
5605 @item x-symbol-language-access-alist
5606 @vindex x-symbol-language-access-alist
5607 List of all language accesses.  A token language @emph{must} define all
5608 variables accessed by language accesses.  A @dfn{language access} is a
5609 property of the language symbol, its value is the symbol naming a
5610 variable whose value is used.
5611
5612 If the language is a derived language, e.g., like language @code{utex},
5613 the language access @code{x-symbol-font-lock-keywords}, should point
5614 directly to the variable of the parent language (here @code{tex}), see
5615 file @file{x-symbol-utex.el}.
5616 @end table
5617
5618
5619 @c Hi, X-Symbol's interna have changed considerably with v4.3.1-alpha.  For
5620 @c token languages to work with new versions of X-Symbol, it is important
5621 @c to define some new language accesses (you
5622 @c can also delete some if you do not want X-Symbol backward compatiblity)
5623
5624 @c The reason for the change is:
5625
5626 @c  * more general ways to define the "grammar" of tokens, also useful for
5627 @c    ProofGeneral's languages, see below.
5628 @c  * faster conversion (I also dropped the support of executables)
5629
5630
5631 @c As an example, let's look at x-symbol-texi.el:
5632
5633 @c The following vars must now be defined (value nil...)
5634
5635 @c    (defvar x-symbol-texi-generated-data nil)
5636
5637 @c Now the interesting part:
5638
5639 @c (defvar x-symbol-texi-token-grammar
5640 @c   '(x-symbol-make-grammar
5641 @c     :encode-spec (?@)
5642 @c     :decode-regexp
5643 @c     "@\\(?:[A-Za-z]+{[A-Za-z]?}\\|[{}]\\|[~^\"'`][A-Za-z]\\|,{[A-Za-z]}\\)"
5644 @c     :decode-spec (?@))
5645 @c   "Token grammar for language `texi'.")
5646
5647 @c In short, not too difficult if the token grammar is regular (even
5648 @c simpler for SGML entities).  The good news: powerful enough for
5649 @c irregular token grammar which couldn't be defined with previous versions
5650 @c of X-Symbol.
5651
5652 @c The conversion now works as follows:
5653
5654 @c  1. decode (token->char): search for regexp, then decode match except if
5655 @c     context is "bad".
5656 @c  2. encode (char->token): search for non-ascii/8bit, then encode match.
5657 @c     Surround by spaces if context is "bad".
5658
5659 @c The "token grammar" is simply a definition of the regexp and the bad
5660 @c contexts, which can be different for different "shapes" of the token.
5661 @c A special BEFORE context is the escape character: this character may
5662 @c appear exactly even times before the token; it will be used for
5663 @c all shapes.
5664
5665 @c Lets assume a language "Isabelle Symbol" plus symbols for identifiers
5666 @c and operators (see below for lisp coding):
5667
5668 @c   shape nil:  \<NAME>
5669 @c   shape id:   [A-Za-z_][A-Za-z_0-9]+
5670 @c   shape op:   [<>!+-*/|&]+
5671
5672 @c To make the conversion fast, the shape must be given at definition time,
5673 @c i.e., the init must get tokens in the form (TOKEN . SHAPE).
5674 @c Either per hand or computed via function in language access
5675 @c x-symbol-token-list...
5676
5677 @c The decode-regexp must match all tokens and:
5678
5679 @c  a. should be specific enough to make the conversion fast
5680 @c  b. must be general enough to match strings which should not be
5681 @c     considered to contain a token even if a substring is a token (to
5682 @c     avoid excessive context checking)
5683
5684 @c In our example, the regexp would be something like
5685
5686 @c   "\\\\<[A-Za-z]+>\\|[A-Za-z_][A-Za-z_0-9]+\\|[<>!+-*/|&]+"
5687
5688 @c No bad context has to be defined for decoding since the regexp is
5689 @c general enough.
5690
5691 @c For encoding, we have to define the following bad contexts (no context
5692 @c can be defined for shape nil):
5693
5694 @c   shape id:  BEFORE: [A-Za-z_0-9], AFTER: [A-Za-z_0-9]
5695 @c   shape op:  BEFORE: [<>!+-*/|&],  AFTER: [<>!+-*/|&]
5696
5697 @c BEFORE is a regexp used via `string-match' with the character before the
5698 @c character to encode; if it matches, we put a space before the token for
5699 @c the character.  AFTER is a regexp used with `looking-at' with point
5700 @c after the character.  We would put a space after the token.
5701
5702 @c There is probably no escape char defined for Isabelle Symbols (i.e.,
5703 @c "\\" is no token).
5704
5705 @c The input-token-grammar is very similar to the decode-grammar: the
5706 @c regexp should end with \\' such that only matches ending at point will
5707 @c get replaced, and we should define a bad context (which will be
5708 @c tried to match against `last-command-char').
5709
5710 @c This makes the grammar below.
5711
5712 @c Hope this helps,
5713 @c - Christoph
5714
5715
5716 @c (defvar x-symbol-xisa-token-grammar
5717 @c   '(x-symbol-make-grammar
5718 @c     :encode-spec '(((id . "[A-Za-z_0-9]") (op . "[<>!+-*/|&]")) .
5719 @c                ((id . "[A-Za-z_0-9]") (op . "[<>!+-*/|&]")))
5720 @c     :decode-spec nil
5721 @c     :decode-regexp "\\\\<[A-Za-z]+>\\|[A-Za-z_][A-Za-z_0-9]+\\|[<>!+-*/|&]+"
5722 @c     :token-list #'x-symbol-xisa-default-token-list))
5723
5724 @c (defvar x-symbol-xisa-input-token-grammar
5725 @c   '(("\\(?:\\\\<[A-Za-z]+>\\|[A-Za-z_][A-Za-z_0-9]+\\|[<>!+-*/|&]+\\)\\'")
5726 @c     ((id . "[A-Za-z_0-9]") (op . "[<>!+-*/|&]"))
5727 @c     (id . "[A-Za-z_0-9]") (op . "[<>!+-*/|&]")))
5728
5729 @c (defun x-symbol-xisa-default-token-list (tokens)
5730 @c   (mapcar (lambda (x)
5731 @c          (cons x (cond ((string-match "\\`[A-Za-z_][A-Za-z_0-9]+\\'" x) 'id)
5732 @c                        ((string-match "\\`[<>!+-*/|&]+\\'" x) 'op))))
5733 @c        tokens))
5734
5735 @c (defun x-symbol-xisa-table
5736 @c   '((product () "\\<Prod>")
5737 @c     (longarrowright () "-->")
5738 @c     (alpha () "alpha")))
5739
5740
5741 @c ====================================================================
5742
5743 @node Misc Internals,  , Language Internals, X-Symbol Internals
5744 @comment  node-name,  next,  previous,  up
5745 @section Miscellaneous Internals
5746
5747 TODO.  This is currently just a collection of unrelated stuff.
5748
5749 @c was in "Char Group
5750 Characters might also define a @dfn{subgroup} which is a string defining
5751 some order on characters in the same group (@pxref{Char Group}) and is
5752 also used for default contexts/bindings (@pxref{Customizing Input
5753 Methods}).
5754
5755 @vtable @code
5756 @item x-symbol-group-syntax-alist
5757 Lists all valid character groups.  Under Emacs and XEmacs/Mule, this
5758 list also determines the syntax of characters.
5759 @end vtable
5760
5761 The character group could probably also be used to define character
5762 categories if they are implemented in XEmacs.
5763
5764 @c ===========================================================================
5765
5766 @node Problems, History, X-Symbol Internals, Top
5767 @comment  node-name,  next,  previous,  up
5768 @chapter Problems, Troubleshooting
5769 @cindex Problems
5770 @cindex Troubleshooting
5771 @cindex Annoyances
5772 @cindex Bugs
5773
5774 This section is based on a successful installation of package X-Symbol.
5775 @xref{Checking Installation}.
5776
5777 @menu
5778 * Nomule Problems::             X-Symbol provides a @emph{poor} man's Mule.
5779 * Spurious Encodings::          Some commands turn off X-Symbol mode.
5780 * No Encoding::                 The encoding does not work in a rare case.
5781 * FAQ::                         Frequently asked questions.
5782 * Bug Reports::                 How to contact the maintainer of X-Symbol.
5783 @end menu
5784
5785 @c ===========================================================================
5786
5787 @node Nomule Problems, Spurious Encodings, Problems, Problems
5788 @comment  node-name,  next,  previous,  up
5789 @section Problems under XEmacs/no-Mule
5790 @cindex Nomule Problems
5791 @cindex @code{transpose-chars} Problems
5792 @cindex Replace Problems
5793 @cindex Rectangle Problems
5794 @cindex Abbrev Problems
5795 @cindex Invisible Point
5796 @cindex Parenthesis Problems
5797 @cindex Fill Problems
5798
5799 If you use package X-Symbol under XEmacs/no-Mule, there are some
5800 annoyances which result from the fact that additional ``X-Symbol
5801 characters'' are represented by two characters internally.  Package
5802 X-Symbol just provides a kind of ``@emph{poor} man's Mule'', see
5803 @ref{Poor Mans Mule}.  This means: I have provided workarounds for the
5804 most annoying ones, but some remain (and will remain: I am not going to
5805 provide workarounds for these):
5806
5807 @itemize @bullet
5808 @item
5809 If @code{font-lock} is not prepared to display these two-character
5810 sequences, i.e., if you installation is incomplete (@pxref{Role of
5811 font-lock}), they look like @samp{\233a} instead @code{alpha}.
5812
5813 @item
5814 Commands which add more than one entry to the @code{buffer-undo-list}
5815 and involve X-Symbol characters might lead to strange results,
5816 e.g. @kbd{C-t} (@code{transpose-chars}) with point between character
5817 @code{alpha} and @samp{b}, leads to @code{beta}@samp{a}.  Simple
5818 deletion and insertion works OK, though.
5819
5820 @item
5821 Selecting or inserting a rectangle with X-Symbol characters on the left
5822 or right margin might not work properly.
5823
5824 @item
5825 Be careful with @kbd{M-%} (@code{query-replace}): the first character of
5826 @var{from-string} can probably match the second of the two ``internal''
5827 characters of an X-Symbol character.
5828
5829 @item
5830 If you use @kbd{C-x '} (@code{expand-abbrev}) without @kbd{M-'}
5831 (@code{abbrev-prefix-mark}) and the last word before point starts
5832 directly after a X-Symbol character, @kbd{C-x '} could behave strange:
5833
5834 @itemize @minus
5835 @item
5836 If @code{words-include-escapes} is @code{t}, there will be no expansion.
5837
5838 @item
5839 If @code{words-include-escapes} is @code{nil}, the second ``internal''
5840 character could be the first character of the last word before point
5841 which is going to be replaced by the abbrev mechanism.
5842 @end itemize
5843
5844 @item
5845 If the character under point is a X-Symbol character, you will not see
5846 the cursor if you exit a command with an error or with quit (@kbd{C-g}).
5847 Unfortunately, XEmacs (as opposed to Emacs) does not run the hooks in
5848 @code{post-command-hook} in these cases.  Solution: move point right
5849 (@kbd{C-f}).
5850
5851 @item
5852 If you provide prefix arguments to commands, they are likely to consider
5853 just ``internal'' characters.  E.g., @kbd{C-u 2 C-f} before @code{alpha}
5854 behaves like @kbd{C-f}.
5855
5856 @item
5857 Column position considers ``internal'' characters, e.g., @kbd{C-n} might
5858 jump to an unexpected position (well, typically just one character
5859 left/right from the expected position, if at all).
5860
5861 @item
5862 Auto-filling also considers ``internal'' characters, i.e., might break
5863 the line too early.
5864
5865 @item
5866 There are no syntax definitions for the new characters, e.g.,
5867 @kbd{M-C-f} before @code{floorleft} does not move to the closing
5868 @code{floorright}.
5869
5870 @item
5871 In some cases, e.g., when using the minibuffer for input via @kbd{M-%}
5872 or @kbd{C-s}, the internal representation of X-Symbol characters
5873 (@pxref{Char Representation}) are displayed directly (@pxref{FAQ Strange
5874 Chars})
5875 @end itemize
5876
5877 @c ====================================================================
5878
5879 @node Spurious Encodings, No Encoding, Nomule Problems, Problems
5880 @comment  node-name,  next,  previous,  up
5881 @section Spurious Encodings
5882 @cindex Spurious Encodings
5883 @cindex Version Control Problems
5884 @cindex @code{write-file} Problems
5885 @cindex @code{vc} Problems
5886 @cindex Revert Buffer Problems
5887
5888 @pindex vc
5889 In rare cases, some commands (mostly from package @code{vc}) encode
5890 characters to tokens or even turn off X-Symbol mode.  Package X-Symbol
5891 will not provide a workaround for these problems, because the situations
5892 in which they appear are too rare, the workarounds are easy, and the
5893 problems are not really caused by package X-Symbol.
5894
5895 @itemize @bullet
5896 @item
5897 @pindex crypt
5898 Doing the next logical version control operation (@kbd{C-x v v} and
5899 friends) encode characters to tokens when using package @code{crypt}.
5900
5901 Solution: use package @code{jka-compr} instead @code{crypt} (this is
5902 recommended anyway, @pxref{File IO Packages}).  Or kill the buffer and
5903 revisit the file.
5904
5905 @item
5906 @pindex auctex
5907 When using Auc@TeX{} with its default-mode algorithm, getting rid of the
5908 recently checked-in version of a file without reverting the buffer
5909 afterwards (@kbd{C-u C-x v c}) turns off X-Symbol mode without encoding
5910 the characters, e.g. under XEmacs/no-Mule, you see some strange
5911 characters like @samp{\233a}.
5912
5913 Explanation: when using Auc@TeX{}'s @code{TeX-default-mode}, the final
5914 @code{major-mode} is different from the initial @code{major-mode}
5915 deduced using @code{auto-mode-alist}.  If this is the case, the VC
5916 command executes @code{normal-mode} which kills all local-variables
5917 including turning-off @code{x-symbol-mode}.
5918
5919 Solution: Turn on X-Symbol mode or change @code{auto-mode-alist} to
5920 directly choose @code{latex-mode}:
5921
5922 @lisp
5923 (push '("\\[tT]e[xX]\\'" . latex-mode) auto-mode-alist)
5924 @end lisp
5925
5926 @item
5927 @findex write-file
5928 @vindex change-major-mode-with-file-name
5929 When using Auc@TeX{} with its default-mode algorithm, writing a La@TeX{}
5930 buffer into a file with another file name turns off X-Symbol mode.
5931
5932 Explanation: Emacs sets the major mode with the file name.  When using
5933 Auc@TeX{}'s @code{TeX-default-mode}, we get the problems as described in
5934 the previous item.
5935
5936 Solution: Set @code{change-major-mode-with-file-name} to @code{nil} or
5937 use the solution from the previous item.
5938 @end itemize
5939
5940 @c ====================================================================
5941
5942 @node No Encoding, FAQ, Spurious Encodings, Problems
5943 @comment  node-name,  next,  previous,  up
5944 @section The Encoding Does Not Work
5945 @cindex No Encoding
5946 @cindex @code{write-region} Problems
5947
5948 In a rare case, X-Symbol cannot do its encoding, i.e., convert the
5949 characters to tokens.
5950
5951 @itemize @bullet
5952 @item
5953 @findex write-region
5954 @pindex crypt
5955 @vindex write-file-hooks
5956 @kbd{M-x write-region} fails to do the encoding if you use package
5957 @code{crypt}.
5958
5959 Explanation: with package @code{crypt}, the encoding has to be done by a
5960 function in @code{write-file-hooks} which is not used by
5961 @code{write-region}.
5962
5963 Solution: use package @code{jka-compr} instead @code{crypt} (this is
5964 recommended anyway, @pxref{File IO Packages}).  Or visit the region file
5965 and save it again via @kbd{C-x C-s}.
5966 @end itemize
5967
5968
5969 @c ===========================================================================
5970
5971 @node FAQ, Bug Reports, No Encoding, Problems
5972 @comment  node-name,  next,  previous,  up
5973 @section Frequently Asked Questions
5974 @cindex Frequently Asked Questions
5975 @cindex FAQ X-Symbol
5976
5977 It is assumed that you had successfully installed package X-Symbol, see
5978 @ref{Checking Installation}.
5979
5980 @menu
5981 * FAQ XEmacs Core::             XEmacs crashes when using input method Token
5982 * FAQ font-lock::               X-Symbol's fontification does not work.
5983 * FAQ Strange Chars::           The buffer contains strange characters
5984 * FAQ No Subscripts::           I cannot see any/some super-/subscripts.
5985 * FAQ Stupid Subscripts::       I see subscripts where I don't want them.
5986 * FAQ Font Size::               The characters are too small or too big.
5987 * FAQ Conversion::              The conversion changes some tokens.
5988 * FAQ Additional Spaces::       A space is added during the encoding.
5989 * FAQ 8bit Chars::              I do not want 8bit characters in the file.
5990 * FAQ Hyphen::                  I cannot distinguish @code{hyphen} from @samp{-}.
5991 * FAQ Spell Check::             I have problems with spell-checking.
5992 * FAQ News and Mail::           I want to use X-Symbol in Gnus or @sc{vm}.
5993 @end menu
5994
5995
5996 @node FAQ XEmacs Core, FAQ font-lock, FAQ, FAQ
5997 @comment  node-name,  next,  previous,  up
5998 @subsection XEmacs Crashes when using Input Method Token
5999 @cindex XEmacs Core
6000 @cindex Core XEmacs
6001 @cindex Crash XEmacs
6002 @cindex Input Method Token
6003
6004 It has been reported that XEmacs-21.0 to XEmacs-21.1.8 might produce
6005 cores when you use input method Token.  That's why I strongly recommend
6006 to use XEmacs-21.1.9 or higher with package X-Symbol, see
6007 @ref{Requirements}.
6008
6009 You get a warning during X-Symbol's initialization when using these
6010 XEmacs versions.  If you don't want to upgrade, but also don't want to
6011 see the warning, you might want to set variable
6012 @code{x-symbol-xmas-warn-about-core} to @code{nil}.
6013
6014 A core in XEmacs always indicates a bug in XEmacs itself, not in a Lisp
6015 package like X-Symbol.  Thus, send a bug report to the XEmacs team if
6016 you get cores with the @emph{newest} version of XEmacs (please put me in
6017 the CC).
6018
6019
6020 @node FAQ font-lock, FAQ Strange Chars, FAQ XEmacs Core, FAQ
6021 @comment  node-name,  next,  previous,  up
6022 @subsection X-Symbol's Fontification does Not Work
6023 @pindex font-lock
6024 @cindex No fontification
6025 @cindex @code{font-lock} Problems
6026
6027 In this case, super- and subscripts are not properly displayed
6028 (@pxref{FAQ No Subscripts}) and under XEmacs/no-Mule, the buffer
6029 contains s.th. like @samp{\233a} (@pxref{FAQ Strange Chars}).
6030 Possible causes:
6031
6032 @itemize @bullet
6033 @findex x-symbol-fontify
6034 @item
6035 You have turned off @code{font-lock} or @code{font-lock} is out of sync.
6036 Use @kbd{M-x x-symbol-fontify}.  @xref{Role of font-lock}.
6037
6038 @item
6039 The font-lock keywords of the current buffer are not prepared to display
6040 X-Symbol characters.  @xref{Role of font-lock}.
6041
6042 @item
6043 @vindex fast-lock-save-faces
6044 You use package @code{fast-lock}.  Solution: set
6045 @code{fast-lock-save-faces} to @code{nil} (done by default
6046 installation).
6047
6048 @item
6049 You use some version control commands.  You have probably noticed that
6050 these versions control commands also turn off @code{font-lock} in modes
6051 where you don't use X-Symbol, i.e., this is not a problem of package
6052 X-Symbol.  @xref{Wishlist Emacs}.  @xref{Spurious Encodings}.
6053 @end itemize
6054
6055
6056 @node FAQ Strange Chars, FAQ No Subscripts, FAQ font-lock, FAQ
6057 @comment  node-name,  next,  previous,  up
6058 @subsection The Buffer Contains Strange Characters
6059 @cindex Strange Characters
6060 @cindex Funny Characters
6061 @cindex Character Problems
6062 @cindex Escape Character Problems
6063 @pindex Mathematica
6064
6065 If you see s.th. like @samp{\233a}, you see the internal representation
6066 of X-Symbol characters under XEmacs/no-Mule (@pxref{Char
6067 Representation}) directly.  Possible causes:
6068
6069 @itemize @bullet
6070 @item
6071 You have @code{font-lock} problems, see @ref{FAQ font-lock}.
6072
6073 @item
6074 More complicated editing commands like @kbd{C-t} may produce strange
6075 character sequences which do not represent X-Symbol characters, see
6076 @ref{Nomule Problems}.
6077
6078 @item
6079 In some cases, e.g., when using the minibuffer for input via @kbd{M-%}
6080 or @kbd{C-s}, it would be too much work to fontify these character
6081 sequences in order to display proper X-Symbol characters.  @xref{Nomule
6082 Problems}.
6083 @end itemize
6084
6085 If Emacs shows some strange glyphs for some characters in your buffers
6086 but not the Grid, there is a font in you font path which pretends to
6087 have charset registry-encoding @code{adobe-fontspecific}, but in fact
6088 uses another encoding.  E.g., Mathematica's fonts cause the characters
6089 intersection and union to mix up.  Possible solutions:
6090
6091 @itemize @bullet
6092 @item
6093 Delete that font from the font path.  Maybe moving it at the end also
6094 works.
6095
6096 @item
6097 In Emacs-21, you have the chance to disable the use of some fonts (if
6098 you know something similar for XEmacs, please let me know).  For
6099 example, to disable the fonts from Mathematica, use
6100
6101 @lisp
6102 (setq face-ignored-fonts '("\\`-wri-math1"))
6103 @end lisp
6104
6105 @item
6106 If the characters show up correctly initially, but mix up after some
6107 font changing command, don't use that command.  E.g., the font selection
6108 in XEmacs via the Options menu seems to loose some information about the
6109 original font.  OK, this is not really a satisfying solution, but the
6110 whole issue isn't my fault, either.
6111 @end itemize
6112
6113
6114 @node FAQ No Subscripts, FAQ Stupid Subscripts, FAQ Strange Chars, FAQ
6115 @comment  node-name,  next,  previous,  up
6116 @subsection I Cannot See any/some Super- or Subscripts
6117 @cindex No Subscripts
6118 @cindex Subscript Problems
6119 @cindex Superscript Problems
6120
6121 If you cannot select @samp{Super-/Subscripts} in the menu, the first of
6122 the following points is more likely the cause, the others otherwise.
6123
6124 @itemize @bullet
6125 @item
6126 You have @code{font-lock} problems, see @ref{FAQ font-lock}.
6127
6128 @item
6129 There are cases where super- and subscripts are not displayed, see
6130 @ref{Super and Subscripts}.
6131
6132 @item
6133 The argument in braces are not correctly recognized, since the
6134 @code{font-lock} syntax-table is not correct.  It should include
6135 @samp{@{} as the only open parenthesis and @samp{@}} as the only close
6136 parenthesis character.  Note that this is quite difficult to archive
6137 under Emacs and XEmacs/Mule.  This is a minor bug in the corresponding
6138 @code{font-lock} package, but would require other changes there,
6139 therefore not likely to be fixed.  Fortunately, this does not happen
6140 often.
6141 @end itemize
6142
6143
6144 @node FAQ Stupid Subscripts, FAQ Font Size, FAQ No Subscripts, FAQ
6145 @comment  node-name,  next,  previous,  up
6146 @subsection I See Super- and Subscripts where I Don't Want Them.
6147 @pindex font-lock
6148 @pindex font-latex
6149 @cindex Stupid Subscripts
6150 @cindex Annoying Subscripts
6151 @cindex Label Subscripts
6152 @cindex Subscript Problems
6153 @cindex Superscript Problems
6154
6155 E.g., I see a subscript in arguments of @code{\label}.  Package X-Symbol
6156 only uses super- and subscripts if they are in braces, if the
6157 @code{asciicircum}/@code{underscore} has not been fontified yet or is
6158 only fontified with faces which are allowed by
6159 @code{x-symbol-tex-font-lock-allowed-faces}, see @ref{Super and
6160 Subscripts}.
6161
6162 @itemize @bullet
6163 @item
6164 You use the default @code{tex-font-lock-keywords}: The argument of
6165 @code{\include} and friends are not fontified by these, i.e., the use of super-
6166 and subscripts are not prohibited.  Solution: add your own keyword for
6167 these commands or use package @code{font-latex}, see below.
6168
6169 @item
6170 You use package @code{font-latex}.  Solution: set
6171 @code{font-lock-maximum-decoration} to value @code{t}, 2 or higher.
6172 Package X-Symbol will still use subscripts in @code{\verb}, in the
6173 @code{verbatim} environment, in the argument of @code{\includegraphics}
6174 and probably other commands.  Some of these problems will probably be
6175 solved by future versions of @code{font-latex}.
6176
6177 @item
6178 You use my font-lock keywords (file @file{x-font-lock.el}): everything
6179 should work fine.  Please note that this file is not meant to be a
6180 replacement of @file{font-latex.el} useful to all users.  Also,
6181 highlighting is a matter of taste, i.e., I am not going to change the
6182 @file{x-font-lock.el} to support La@TeX{}-2.09, @TeX{}'s math regions,
6183 other likings, etc.
6184
6185 @item
6186 You use your own font-lock keywords for @TeX{}.  In this case, you be able
6187 to adapt the solutions from the previous points to your situation.
6188 @end itemize
6189
6190
6191 @node FAQ Font Size, FAQ Conversion, FAQ Stupid Subscripts, FAQ
6192 @comment  node-name,  next,  previous,  up
6193 @subsection The Characters are Too Small or Too Big
6194 @cindex Font Size
6195 @cindex Big Characters
6196 @cindex Small Characters
6197
6198 Why aren't there more different font sizes?  Because nobody (including
6199 the author) was in the mood to design them (actually only the xsymb1
6200 font needs to be designed).  @emph{Please do only ask the author whether they
6201 are in work if you are serious to do it yourself otherwise!}
6202
6203 Why do I get a lower-case letter when I should get a capital letter (or
6204 vice versa)?  Please convince yourself (@pxref{Info}) that you actually
6205 get the correct letter---they are just of different sizes.
6206 @xref{Installing Fonts Lisp}.
6207
6208 I was told that the xsymb1 font scales reasonably well to a larger font
6209 size---if you don't think so, design a new font and send me the result.
6210
6211
6212 @node FAQ Conversion, FAQ Additional Spaces, FAQ Font Size, FAQ
6213 @comment  node-name,  next,  previous,  up
6214 @subsection The Conversion Changes Some Tokens
6215 @cindex Token Changes
6216 @cindex Conversion Problems
6217 @cindex Encoding Problems
6218
6219 In most token languages, a character might be represented by different
6220 tokens.  If this character is encoded (when saving the buffer), the
6221 canonical representation is saved.  @xref{Unique Decoding}.
6222
6223 @itemize @bullet
6224 @item
6225 Solution: Do not redefine standard @TeX{} macros or use unique
6226 decoding.  @xref{TeX Macro Problems}.
6227 @end itemize
6228
6229
6230 @node FAQ Additional Spaces, FAQ 8bit Chars, FAQ Conversion, FAQ
6231 @comment  node-name,  next,  previous,  up
6232 @subsection A Space is Added During the Encoding
6233 @cindex Additional Spaces
6234 @cindex Token Problems
6235 @cindex Encoding Problems
6236 @cindex Space Problems
6237
6238 A space is added after some characters during the encoding to tokens.
6239 With token languages @code{tex} and @code{utex} (not with language
6240 @code{sgml}), there must be a space after the token to recognize its end
6241 in some cases.
6242
6243 E.g., if your buffer contains @samp{a+b} (where + stands for the
6244 character @code{circleplus}), this is encoded to @samp{a\oplus b} (note
6245 the space after @code{\oplus}).  Decoding it yields @samp{a+ b}.
6246
6247 I admit, this looks ugly.  The space is only added if the symbol
6248 character is followed by a letter or by @samp{@@}.  Thus, decoding
6249 @samp{a\oplus\beta} yields @samp{a+b} (without space!).
6250
6251 @itemize @bullet
6252 @item
6253 Suggestion: Also use a space before @code{\oplus}.  The alternative
6254 would be to delete the space which other people won't like.
6255 @end itemize
6256
6257 For an exact description, @xref{TeX Macro Conversion} for an exact description.
6258
6259
6260 @node FAQ 8bit Chars, FAQ Hyphen, FAQ Additional Spaces, FAQ
6261 @comment  node-name,  next,  previous,  up
6262 @subsection I Don't Want 8bit Characters in the File
6263 @cindex 8bit Character Problems
6264 @cindex No 8bit Characters
6265
6266 By default, these are not encoded if the buffer-local variable
6267 @code{x-symbol-8bits} is non-@code{nil}.
6268
6269 By default, this variable is only set to non-@code{nil}, if something like
6270
6271 @example
6272 \usepackage[latin1]@{inputenc@}
6273 @end example
6274
6275 is found at the beginning of the file.  That line does not make sense if
6276 you do not have 8bit characters in the file, i.e., delete it.
6277 @xref{File Coding}.  Note: commenting the line is not enough!  (I do not
6278 run La@TeX{} to check for the line, I just do plain text search.)
6279
6280
6281 @node FAQ Hyphen, FAQ Spell Check, FAQ 8bit Chars, FAQ
6282 @comment  node-name,  next,  previous,  up
6283 @subsection I Cannot Distinguish Character @code{hyphen} from @samp{-}
6284 @cindex Hyphen Versus Minus
6285 @cindex Minus Versus Hyphen
6286
6287 In most fonts, the Latin character @code{hyphen} cannot be distinguish
6288 from the Ascii character @samp{-}.  If you do not want to decode the
6289 corresponding token @code{\-} or @code{&shy;}, put the following into
6290 your @file{~/.emacs}:
6291
6292 @lisp
6293 (setq x-symbol-tex-user-table '((hyphen)))
6294 (setq x-symbol-sgml-user-table '((hyphen)))
6295 @end lisp
6296
6297 A better alternative would be to make @code{font-lock} display these
6298 character in a different color.
6299
6300
6301 @node FAQ Spell Check, FAQ News and Mail, FAQ Hyphen, FAQ
6302 @comment  node-name,  next,  previous,  up
6303 @subsection Problems with Spell-checking
6304 @cindex Spell Checking
6305 @pindex ispell
6306 @findex ispell-word
6307 @findex ispell-region
6308
6309 As explained in @ref{Miscellaneous Packages}, @code{ispell} assumes the
6310 buffer contents to be the same as the file contents and does not provide
6311 any hook to fix this.  This might break @code{ispell-word} and
6312 @code{ispell-region}.  Possible symptoms:
6313
6314 @itemize @bullet
6315 @item
6316 A word which contains letters which the program @code{ispell} does not
6317 know about is either not spell-checked or parts of it are spell-checked
6318 as independent words.
6319
6320 Solution: Use the @code{ispell}s 8bit dictionaries even if you do not
6321 store 8bit characters in the file.  This should fix the problem for
6322 almost every word, except, e.g., words containing the Latin-9 character
6323 @code{oe} if you use a Latin-1 encoding.
6324
6325 @item
6326 Spell-checking might stop with the error message @samp{Ispell
6327 misalignment}.  I can reproduce this only with Emacs, not with XEmacs.
6328
6329 Question: If you know some settings (like for
6330 @code{process-coding-system-alist}) which solves this problem, please
6331 let me know!
6332
6333 Solution: turn X-Symbol off before spell-checking your buffer.  This is
6334 of course no option if you use @code{flyspell}.
6335 @end itemize
6336
6337 The real solution would be to fix @code{ispell}, at least by providing a
6338 useful hook which allows X-Symbol to fix the problem.  @xref{Wishlist
6339 Emacs}.  You are strongly encouraged to send a patch to the maintainer
6340 of @code{ispell}, you even get a paragraph here in
6341 @ref{Acknowledgments}!
6342
6343
6344 @node FAQ News and Mail,  , FAQ Spell Check, FAQ
6345 @comment  node-name,  next,  previous,  up
6346 @subsection How to Use X-Symbol with Gnus or @sc{vm}
6347 @cindex News Reader
6348 @cindex Mail Reader
6349 @pindex Gnus
6350 @pindex VM
6351 @pindex Message
6352
6353 You can also use X-Symbol to read and write your News and Mails.  This
6354 sections includes coding for your @file{~/.emacs} if you want to do so.
6355 It has been tested for Gnus-5.8.8 and @sc{vm}-6.96; if you use
6356 @sc{rmail} or @sc{mh-e}, you have to try to find a solution yourself
6357 (please send it to me).  Support for Gnus might become a standard
6358 part of X-Symbol.
6359
6360 @lisp
6361 (custom-set-variables
6362  '(x-symbol-auto-style-alist
6363    '(((mail-mode message-mode gnus-article-mode vm-presentation-mode)
6364       tex nil nil nil nil t nil))))
6365 @end lisp
6366
6367 This is optional (you might want to use the Custom interface for the
6368 same effect) and tells Emacs/X-Symbol to use token language @code{tex}
6369 and to display super-/subscripts (if @code{font-lock} is enabled),
6370 X-Symbol is not automatically turned on.  @xref{Minor Mode}.
6371
6372 @findex mail
6373 @findex message-mail
6374 @findex vm-mail
6375 @vindex mail-send-hook
6376 @vindex message-send-hook
6377 @vindex vm-mail-send-hook
6378 @lisp
6379 (defun x-symbol-x-mail-send-hook ()
6380   (if x-symbol-mode (x-symbol-mode 0)))
6381 (add-hook 'mail-send-hook 'x-symbol-x-mail-send-hook)
6382 (add-hook 'message-send-hook 'x-symbol-x-mail-send-hook)
6383 (add-hook 'vm-mail-send-hook 'x-symbol-x-mail-send-hook)
6384 @end lisp
6385
6386 This tells tells Emacs to automatically turn off X-Symbol (which
6387 includes encoding characters to token) before actually sending the
6388 message.
6389
6390 @findex gnus
6391 @vindex gnus-article-prepare-hook
6392 @lisp
6393 (defun x-symbol-x-gnus-prepare ()
6394   (when x-symbol-mode
6395     (setq x-symbol-mode nil)
6396     (x-symbol-mode-internal nil)))
6397 (add-hook 'gnus-article-prepare-hook 'x-symbol-x-gnus-prepare)
6398 @end lisp
6399
6400 Since Gnus reuses the @file{*Article*} buffer, where X-Symbol could
6401 have been turned on previously, we must make sure that X-Symbol is
6402 turned off with the new article.
6403
6404 @findex vm
6405 @vindex vm-select-message-hook
6406 @lisp
6407 (defun x-symbol-x-vm-prepare ()
6408   (and (boundp 'vm-presentation-buffer)
6409        (buffer-live-p vm-presentation-buffer)
6410        (save-excursion
6411          (set-buffer vm-presentation-buffer)
6412          (when x-symbol-mode
6413            (setq x-symbol-mode nil)
6414            (x-symbol-mode-internal nil)))))
6415 (add-hook 'vm-select-message-hook 'x-symbol-x-gnus-prepare)
6416 @end lisp
6417
6418 The same thing for @sc{vm}, although the hook is not as nice as
6419 Gnus' one; the function therefore might depend a bit too much on
6420 @sc{vm}'s interna.
6421
6422 @findex vm-mode
6423 @findex vm-presentation-mode
6424 @lisp
6425 (put 'vm-mode 'x-symbol-mode-disable
6426      "Use VM Presentation Mode to turn on X-Symbol")
6427 (custom-set-variables '(vm-fill-paragraphs-containing-long-lines 80))
6428 @end lisp
6429
6430 You cannot use X-Symbol in @sc{vm} Mode, only in @sc{vm} Presentation Mode
6431 (X-Symbol would change your @file{INBOX}).  The first (optional) Emacs
6432 Lisp expression gives you a better error message when you try to turn on
6433 X-Symbol Mode in @sc{vm} Mode.  The second line makes sure that @sc{vm}
6434 always uses @sc{vm} Presentation Mode to display the articles.
6435
6436 @c ===========================================================================
6437
6438 @node Bug Reports,  , FAQ, Problems
6439 @comment  node-name,  next,  previous,  up
6440 @section How to Send a Bug/Problem Report
6441 @cindex Bug Reports
6442 @cindex Problem Reports
6443 @cindex Contacting the Maintainer
6444 @cindex Maintainer Address
6445 @cindex Email to the Maintainer
6446 @cindex Reports of Bugs
6447
6448 Bug fixes, bug/problem reports, improvements, and suggestions are
6449 strongly appreciated.  So are corrections to this manual (better
6450 explanations, correcting my English, @dots{}).  Especially useful would be
6451 some feedback by people using default fonts with a charset
6452 registry-encoding other than @code{iso8859-1} (Western encoding).
6453
6454 Please read this section carefully, even if you generally know how to
6455 send a bug report (@pxref{Bugs,,,@value{emacs},@value{emacsman}}).
6456 This might look tedious to you, but it actually saves a lot of time
6457 (your time, too).
6458
6459 The @strong{general recommendation} for bug/problem reports is: give the
6460 impression that your really have tried to find the necessary information
6461 yourself and make your report precise while including all information
6462 you have.
6463
6464 For each bug/problem report or question you want to send to the
6465 maintainer, please use the following sequence:
6466
6467 @enumerate
6468 @item
6469 Make sure that you use the @strong{newest version} of X-Symbol.  You are
6470 reading Edition @value{edition} (@value{subedition}) of the manual for
6471 X-Symbol @value{version}.
6472
6473 @item
6474 Read the manual, especially @ref{Checking Installation}, @ref{Problems},
6475 and @ref{FAQ}.  The four indexes (@pxref{Indexes}) might also lead you
6476 to an answer to your question.
6477
6478 @item
6479 Use @kbd{M-x x-symbol-package-bug} (also to be found in X-Symbol's
6480 Command submenu) to write your report describing @emph{one} bug or
6481 problem, i.e., use @strong{different mails} for @strong{unrelated
6482 problems}.  Please do not ``reuse'' a mail thread with the maintainer,
6483 i.e., if you start a section with ``Here is another problem'', you do
6484 something wrong.
6485
6486 If Emacs is not your mail tool, copy the Subject header line and the
6487 message body from Emacs' @file{*mail*} buffer to your mail tool.
6488
6489 If @kbd{M-x x-symbol-package-bug} fails to work, you have a problem with
6490 your installation and your report should be about this problem.  In this
6491 case, use @samp{x-symbol @var{version}; @var{summary}} as Subject header
6492 where @var{version} is the version of X-Symbol (it should be
6493 @value{version}) and @var{summary} is a brief summary of your
6494 installation problem.
6495
6496 (@emph{Rationale}: This command automatically extracts some essential
6497 information without any work by you.  Don't waste your time pondering whether
6498 you should really use this command to write your report.)
6499 @c The additional advantage is that I can see who doesn't have any problems
6500 @c wasting my time.
6501
6502 @item
6503 Start your report with:
6504
6505 @quotation
6506 In the manual, I checked the sections @var{section1}, @var{section2},
6507 @dots{}, but didn't find anything which helped me with the following
6508 problem:
6509 @end quotation
6510
6511 The sections @var{section1}, @var{section2}, etc are names of the
6512 sections (not whole chapters) in the manual where you would expect an
6513 answer to your question/problem/bug.
6514
6515 If you didn't know which sections to inspect, please check the indexes.
6516 If they are not helpful, send me words/terms which should be included in
6517 the indexes.
6518
6519 (@emph{Rationale}: This way, I get an idea where to improve the manual,
6520 especially by adding cross references.)
6521 @c It also ensures that you really have tried to find the relevant
6522 @c information yourself.
6523
6524 @item
6525 If buffer @file{*Warnings*} does not exist in the buffer menu,
6526 everything is fine so far.  So is (for me as the author of package
6527 X-Symbol), if @samp{X-Symbol} is not mentioned there.  Otherwise,
6528 include the contents of buffer @file{*Warnings*} into your bug report.
6529
6530 @c TODO: without warnings.el from Emacs-21.4
6531 Temporary Emacs (< v21.4) note: the warnings might be somewhere hidden
6532 in buffer @file{*Messages*}; please check that buffer.
6533
6534 @item
6535 Put the parts of the code from @file{~/.emacs} and the system-wide files
6536 which causes the problem into a fresh file @file{@var{my-problem}.el}.
6537 The problem/error should be visible when invoking
6538
6539 @example
6540 xemacs -no-site-file -q -l @var{my-problem}.el
6541 @end example
6542
6543 In the minimal case, @file{@var{my-problem.el}} just contains the
6544 following line (@pxref{Installing Lisp}):
6545
6546 @lisp
6547 (x-symbol-initialize)
6548 @end lisp
6549
6550 If the error has disappeared after you have included your complete
6551 @file{~/.xemacs/init.el} and @file{~/.emacs}, the problem is likely
6552 caused by some code of your system-wide installation.  Include the code,
6553 which can be found using command @kbd{M-x find-library} with files
6554 @file{site-start} and @file{default} (everything is fine if these files
6555 do not exist).
6556
6557 If you use @file{x-symbol-site.el} (its use is deprecated), copy its
6558 contents into @file{@var{my-problem.el}} and delete the corresponding
6559 @code{load} command.
6560
6561 Attach the file @file{@var{my-problem}.el} to your report.
6562 @strong{Please try to minimize the size of @file{@var{my-problem}.el}}!
6563 A standard technique is recursive halving: Delete the second half of
6564 @file{@var{my-problem.el}}.  If the problem disappears, delete the first
6565 half instead.  Do the same with the smaller file again, @dots{}.
6566
6567 (@emph{Rationale}: Most problems are a consequence of some specific
6568 customizations, but I don't have time to debug each user's init file.)
6569
6570 @item
6571 If you have set variable @code{custom-file} in
6572 @file{@var{my-problem}.el}, attach the corresponding file to your report.
6573
6574 @item
6575 If the error can only be reproduced in combination with another Emacs
6576 package, please send me:
6577
6578 @itemize @minus
6579 @item
6580 If it is included in the standard Emacs/XEmacs distribution / if is an
6581 XEmacs package: the version you use if it is not that from the
6582 Emacs/XEmacs distribution (use @kbd{M-x find-library} to check whether
6583 you really use the version from the Emacs/XEmacs distribution).
6584
6585 @item
6586 If it is a non-standard (and non-obscure) package: the URL of the
6587 distribution and/or the source.
6588
6589 @item
6590 Otherwise: include its code into @file{@var{my-problem}.el} and delete
6591 the corresponding @code{load} or @code{require} command.  Then, reduce
6592 the size of @file{@var{my-problem}.el} as described above.
6593 @end itemize
6594
6595 @item
6596 If the problem is not reproducible with an @emph{arbitrary}
6597 (@file{.tex}, @file{.html}, @dots{}) file, include the file with its full file
6598 name into your bug report.  (If you like, you can try to minimize the
6599 file if the problem is still reproducible.)
6600
6601 (@emph{Rationale}: Most problems are only reproducible with specific
6602 files.)
6603
6604 @ignore
6605 @item
6606 I would appreciate, if you would set variable @code{debug-on-error} to
6607 @code{t} before you trigger the error and send me the contents of buffer
6608 @file{*Backtrace*}.  At best, using the uncompiled versions of the
6609 functions involved, i.e., by jumping to its definition and evaluation it:
6610
6611 @example
6612 M-x find-function @key{RET} @var{function} @key{RET} C-M-f C-x C-e
6613 @end example
6614 @end ignore
6615
6616 @item
6617 Finally, include the exact key sequence which causes the problem into
6618 your bug report.  You should also tell me the name of the buffer in
6619 which the problem occurred and how you have created that buffer (e.g.,
6620 by @kbd{C-x C-f @var{file} @key{RET}}).
6621
6622 At best, you start your Emacs, and then try to reproduce the problem as
6623 fast as possible (i.e., with a minimum number of key/mouse strokes).
6624
6625 As soon as the problem appears, press @kbd{C-h l} and include the
6626 contents of buffer @file{*Help*} in your bug report.
6627
6628 (@emph{Rationale}: Most problems are only reproducible with point being
6629 at a specific position in the file, with specific key sequences, etc.)
6630
6631 @item
6632 If you have problem with the display of images, please include the
6633 output of the shell commands @samp{convert -h} and @samp{convert -list
6634 Format} in your bug report.  If the first command fails, you have a
6635 problem with the program @code{convert}, not X-Symbol.
6636
6637 @item
6638 If necessary, include a screen-shot in your bug report.
6639
6640 @item
6641 If you could not use @kbd{M-x x-symbol-package-bug}, include the
6642 contents of buffer @file{*Help*} after the following actions:
6643
6644 @itemize @minus
6645 @item
6646 Type @kbd{C-h v x-symbol-version @key{RET}}.
6647 @item
6648 Type @kbd{C-h v emacs-version @key{RET}}.
6649 @item
6650 Type @kbd{C-h v features @key{RET}}.
6651 @end itemize
6652
6653 @end enumerate
6654
6655 If you have solved your problem during this sequence, but you think your
6656 situation is worth to be mention in this manual (e.g., in @ref{Package
6657 Integration}), I would appreciate if you would send me a some new text
6658 for this manual or a normal bug report together with your solution.
6659
6660 @c ===========================================================================
6661
6662 @node History, Indexes, Problems, Top
6663 @comment  node-name,  next,  previous,  up
6664 @chapter History and Projects
6665
6666 @menu
6667 * News::                        Changes in recent versions.
6668 * Wishlist::                    Projects for X-Symbol.
6669 * Open Questions::              How you can contribute.
6670 * Acknowledgments::             People having contributed.
6671 @end menu
6672
6673 @c ===========================================================================
6674
6675 @node News, Wishlist, History, History
6676 @comment  node-name,  next,  previous,  up
6677 @section News: Changes in Recent Versions of X-Symbol
6678 @cindex New Features
6679 @cindex Changes
6680 @cindex History
6681
6682 This is the complete history of X-Symbol.  It just lists the major
6683 changes before Version 3.0.
6684
6685 @menu
6686 * Changes New::                 To be announced.
6687 * Changes 4.5::                 Released Mar 2003 as beta.
6688 * Changes 4.4::                 Released June 2002 as beta.
6689 * Changes 4.1::                 Released Mar 2002 as beta.
6690 * Changes 3.4::                 Released Mar 2002.
6691 * Changes 3.3::                 Released Jan 1999.
6692 * Changes 3.2::                 Released Dec 1998.
6693 * Changes 3.1::                 Released Oct 1998.
6694 * Changes 3.0::                 Released Sep 1998 as beta.
6695 * Changes Old::                 Overview of old releases.
6696 @end menu
6697
6698
6699
6700 @node Changes New, Changes 4.5, News, News
6701 @comment  node-name,  next,  previous,  up
6702 @subsection Changes in X-Symbol @value{version}
6703
6704 Version @value{version} has not yet been announced.
6705
6706 @itemize @bullet
6707 @item
6708 Various bug fixes and minor changes.
6709 @end itemize
6710
6711
6712 @node Changes 4.5, Changes 4.4, Changes New, News
6713 @comment  node-name,  next,  previous,  up
6714 @subsection Changes in X-Symbol 4.5
6715
6716 Version 4.5 has been released on March 2003 as beta.
6717
6718 @itemize @bullet
6719 @item
6720 X-Symbol finally respects the Mule coding system of each individual buffer.
6721
6722 @item
6723 Bug fix: would mess up encoding of math-mode characters with token
6724 language @code{bib}.  Other conversion fixes for languages @code{bib}
6725 and @code{texi}.
6726
6727 @item
6728 Bug fix (workaround for bug in XEmacs): auto-save files would have
6729 length 0.
6730
6731 @item
6732 Bug fix (Emacs): package now works with package
6733 @code{crypt}/@code{crypt++}.
6734
6735 @item
6736 Token language @code{sgml}: always encode characters to entity
6737 references by default (where defined by the HTML standard).  Include
6738 @code{hm--html-mode}, @code{html-helper-mode}, remove @code{sgml-mode}
6739 as typical major modes which use X-Symbol.
6740
6741 @item
6742 Token language @code{tex}: support some symbols of package
6743 @file{stmaryrd.sty}.
6744
6745 @item
6746 Change the auto-style, formerly auto-mode, mechanism.
6747
6748 @item
6749 Image support when running on Emacs.
6750
6751 @item
6752 New input method Quail, a usual Mule input method.
6753
6754 @item
6755 Corrected Latin-5 definitions.  Support Latin-5 (``Turkish'') on XEmacs
6756 running under Windows.
6757
6758 @item
6759 X-Symbol works with Emacs/XEmacs running under a character terminal.
6760
6761 @item
6762 Improments for external languages.  Super-/subscript matching of token
6763 languages has changed.
6764
6765 @item
6766 X-Symbol can use package @code{format} and does not require special
6767 fonts for super-/subscripts with Emacs-21.4+.  Still open whether this
6768 will be used@dots{}.
6769
6770 @item
6771 Dropped support for XEmacs-20.3.
6772
6773 @item
6774 Various bug fixes and minor changes.
6775 @end itemize
6776
6777
6778 @node Changes 4.4, Changes 4.1, Changes 4.5, News
6779 @comment  node-name,  next,  previous,  up
6780 @subsection Changes in X-Symbol 4.2 to 4.4
6781
6782 Version 4.4 has been released on June 2002 as beta.
6783
6784 @itemize @bullet
6785 @item
6786 Token language TeX has changed: no excessive use of braces anymore, no
6787 excessive normalization, and aware of environments @code{@{tabbing@}} and
6788 @code{@{verbatim@}}, and macro @code{\verb}.  Reading and saving
6789 ``old-encoded'' files works without changes in the file (the buffer
6790 looks different), there is also a command to remove the unwanted braces
6791 around accented letters.
6792
6793 @item
6794 New token language ``Bib@TeX{} Macro'' (@code{bib}, similar to old
6795 @code{tex}), used for Bib@TeX{} files.
6796
6797 @item
6798 Nuked executables, the Lisp conversion for all languages is now 2-5
6799 times faster.
6800
6801 @item
6802 Latin-9 support.  Latin-9 font included in distribution.
6803
6804 @item
6805 Works with XEmacs-21.4+ on Windows.  Of course, it just supports a
6806 limited number of characters and no super- and subscripts there due to
6807 missing fonts.
6808
6809 @item
6810 More likely to save 8bit characters in the file by default: also look
6811 for 8bit characters in the file when visiting the file, also inspect
6812 master file (@code{TeX-master}) with token language @code{tex}.
6813
6814 @item
6815 New buffer-local variable @code{x-symbol-unique}: when non-@code{nil},
6816 decodes much less tokens to avoid near to all normalizations, used for
6817 @TeX{}'s style files (but X-Symbol is not automatically turned on).
6818 Dropped token language @code{utex}.
6819
6820 @item
6821 Menu changes, new commands: submenu ``Conversion'', menu items ``Copy
6822 Encoded'', ``Paste Decoded'' and others.
6823
6824 @item
6825 Special coding for @code{preview-latex}.  Using X-Symbol now only gives
6826 a 10% overhead of @code{preview}s parsing time.
6827
6828 @item
6829 X-Symbol now works with Whizzy@TeX{}.
6830
6831 @item
6832 The interface for defining a token language has changed, it is also much
6833 more general, useful for ProofGeneral.
6834
6835 @item
6836 Changed final bytes of ISO 2022 escape sequence for X-Symbol charsets
6837 since Emacs reserves the characters @samp{0-9} for itself.  Does XEmacs
6838 has any policy here (it also uses @samp{?})?
6839
6840 @item
6841 Dropped workaround for minor bug in XEmacs-20.X.
6842
6843 @item
6844 Various bug fixes and minor changes.
6845 @end itemize
6846
6847
6848 @node Changes 4.1, Changes 3.4, Changes 4.4, News
6849 @comment  node-name,  next,  previous,  up
6850 @subsection Changes in X-Symbol 4.1
6851
6852 Version 4.1 has been released on Mar 2002 as beta.
6853
6854 @itemize @bullet
6855 @item
6856 X-Symbol works with Emacs-21.1 or higher.  Porting is not complete, yet.
6857
6858 @item
6859 New token language ``@TeX{}info command'' (@code{texi}).
6860
6861 @item
6862 Slightly different definition of ``valid character''.
6863
6864 @item
6865 Remove the ``local if set'' and ``default: @dots{}'' submenu stuff.
6866 @end itemize
6867
6868
6869 @node Changes 3.4, Changes 3.3, Changes 4.1, News
6870 @comment  node-name,  next,  previous,  up
6871 @subsection Changes in X-Symbol 3.4
6872
6873 Version 3.4 has been released on Mar 2002.
6874
6875 @itemize @bullet
6876 @item
6877 Moved to SourceForge.net.  Added files for nicer HTML output of manual.
6878
6879 @item
6880 Would sometimes perform strange conversions when
6881 @code{global-flyspell-mode} is enabled.
6882
6883 @item
6884 Bug fixes: command @kbd{M-x write-region} would always save the whole
6885 buffer if X-Symbol is enabled for that buffer, writing a remote file via
6886 ange-ftp would not work (was OK with efs).
6887
6888 @item
6889 Automatically deduce default coding via @code{locale -ck LC_CTYPE}.
6890
6891 @item
6892 Issue warning when running on XEmacs-21.0 to XEmacs-21.1.8.  Update
6893 manual: XEmacs user package directory is @file{~/.xemacs/packages}.
6894
6895 @item
6896 Directories ending with @file{//} in image search paths are recursive.
6897
6898 @item
6899 New characters used for token languages ``@TeX{} macro'' and ``Isabelle
6900 symbol''.
6901
6902 @item
6903 Make sure to convert just the first part of a multi-part image.
6904
6905 @item
6906 Source distribution includes files for building an RPM package, all
6907 files also compile without Mule support.
6908
6909 @item
6910 Minor changes.  Manual changes.
6911 @end itemize
6912
6913
6914 @node Changes 3.3, Changes 3.2, Changes 3.4, News
6915 @comment  node-name,  next,  previous,  up
6916 @subsection Changes in X-Symbol 3.3
6917
6918 Version 3.3 has been released on Jan 1999.
6919
6920 @itemize @bullet
6921 @item
6922 Package X-Symbol is really a proper XEmacs package: no need to create
6923 fonts and to set the font path.  With XEmacs/no-Mule, I still recommend
6924 to create the executables (type @kbd{M-x x-symbol-exec-create}).
6925
6926 @item
6927 New functions used for interaction with Emacs package @code{comint}.
6928 This is necessary for new token language ``Isabelle symbol'', to be
6929 distributed with Emacs package ProofGeneral.
6930
6931 @item
6932 New characters used for token languages ``@TeX{} macro'' and ``Isabelle
6933 symbol''.
6934
6935 @item
6936 Minor changes.  Manual changes.
6937 @end itemize
6938
6939
6940 @node Changes 3.2, Changes 3.1, Changes 3.3, News
6941 @comment  node-name,  next,  previous,  up
6942 @subsection Changes in X-Symbol 3.2
6943
6944 Version 3.2 has been released on Dec 1998.
6945
6946 @itemize @bullet
6947 @item
6948 Package X-Symbol is a proper XEmacs package.  The installation process
6949 is much easier (using the binary package).  It has changed, though!
6950 The use of file @file{x-symbol-site.el} is deprecated.
6951
6952 @item
6953 Reverting the buffer and using @code{vc} commands do not encode
6954 characters when not using @code{crypt}.  (This did not work always.)
6955
6956 @item
6957 Workaround for bug (segfault) in XEmacs-21/Mule betas.
6958
6959 @item
6960 Command @code{x-symbol-package-bug} is less restrictive.  Please use
6961 this command to contact the maintainer.
6962
6963 @item
6964 Bug fixes.  Minor changes.  Manual changes.
6965 @end itemize
6966
6967
6968 @node Changes 3.1, Changes 3.0, Changes 3.2, News
6969 @comment  node-name,  next,  previous,  up
6970 @subsection Changes in X-Symbol 3.1
6971
6972 Version 3.1 has been released on Oct 1998.
6973
6974 @itemize @bullet
6975 @item
6976 @TeX{} macro @code{\mu} is represented by a character in the Adobe Symbol
6977 font, not in a Latin-@{1,3,5@} font anymore.
6978
6979 @item
6980 Support for most @sc{sgml} entities in HTML-4.0 specification.
6981
6982 @item
6983 Additional characters for @code{\therefore}/@code{&there4;},
6984 @code{&oline;} and @code{&euro;}.
6985
6986 @item
6987 Package X-Symbol has been customized.
6988
6989 @item
6990 The documentation has been completed (as @TeX{}info file).
6991
6992 @item
6993 Handle special URL prefixes @file{file:}, @file{http:} for images.
6994
6995 @item
6996 Bug fixes, configuration changes.
6997 @end itemize
6998
6999
7000 @node Changes 3.0, Changes Old, Changes 3.1, News
7001 @comment  node-name,  next,  previous,  up
7002 @subsection Changes in X-Symbol 3.0
7003
7004 Version 3.0 has been released on Sep 1998 as beta.
7005
7006 @itemize @bullet
7007 @item
7008 Package X-Symbol now works on XEmacs with and without Mule support.
7009 Dropped support for XEmacs 19.13 to 19.16/20.2.
7010
7011 @item
7012 Full support of token language @code{sgml} (executables, subscripts, images).
7013
7014 @item
7015 X-Symbol is a proper minor mode.
7016
7017 @item
7018 Easier (automatic) 8bit character control (e.g., for @code{\times}
7019 @code{\pm},@dots{}).  By default, the encoding when saving only writes
7020 8bit characters, if @samp{\usepackage[latin@var{n}]@{inputenc@}} with
7021 @var{n}=1,2,3,5 was found in the first 10000 characters of the file
7022 (including commentary).
7023
7024 @item
7025 Package X-Symbol can be easily extended with new token languages and
7026 fonts due to its modular design.  It consistently handles situations
7027 where an entry for an additional character defines the same preferred
7028 key binding (and context) as for a previously defined character
7029
7030 @item
7031 Key bindings have completely changed.  They are now consistent with the
7032 contexts of input method Context (which have changed a bit).
7033
7034 @item
7035 The keys @kbd{@@} and @kbd{!} are not used anymore as Modify- and
7036 Rotate-Key.  The Rotate key (instead of the Modify-Key) is used to
7037 ``Greek''ify the previous Ascii char.
7038
7039 @item
7040 Input method Aggressive Context is now called input method Electric and
7041 is much more restrictive (using package @code{texmathp} with language
7042 ``@TeX{} macro'').
7043
7044 @item
7045 Easier installation despite many additional features.
7046
7047 @item
7048 Supports more characters.
7049
7050 @item
7051 Nicer grid, info in echo area.
7052
7053 @item
7054 Better cooperation with packages: @code{vc} (check-out does not convert
7055 characters), @code{reftex} (no strange characters @samp{\237}, help with
7056 label creation), @code{auctex}, @code{ispell}, @code{font-latex} (no
7057 annoyances with @code{\exists}).
7058
7059 @item
7060 Safer use of executables.
7061
7062 @item
7063 The code has completely changed.  You have to redo your installation.
7064 @end itemize
7065
7066
7067 @node Changes Old,  , Changes 3.0, News
7068 @comment  node-name,  next,  previous,  up
7069 @subsection Changes in Old Releases.
7070
7071 This sections gives just an overview of the major changes in the releases.
7072
7073 Version 2.6 has been released on Oct 1998.
7074
7075 @itemize @bullet
7076 @item
7077 Fixed serious bug when used under tty.
7078 @end itemize
7079
7080 Version 2.5 has been released on Mar 1998.
7081
7082 @itemize @bullet
7083 @item
7084 Image support.
7085 @end itemize
7086
7087 Version 2.4 has been released on  Mar 1997.
7088
7089 @itemize @bullet
7090 @item
7091 Token language @code{sgml}.  (X-Symbol can handle more then token
7092 language @code{tex}.)
7093
7094 @item
7095 Input method Aggressive Context (precursor of input method Electric),
7096 input method Context has been much improved.
7097
7098 @item
7099 Fixed performance bug when saving a file with package @code{crypt}.
7100
7101 @item
7102 Control of Conversion and 8bit character has changed.
7103 @end itemize
7104
7105 Version 2.3 has been released on Sep 1996.
7106
7107 @itemize @bullet
7108 @item
7109 Distributed with own font for more math characters.
7110
7111 @item
7112 Info for the character around point in echo area.
7113 @end itemize
7114
7115 Version 2.2 has been released on June 1996.
7116
7117 @itemize @bullet
7118 @item
7119 Input method Grid.  Help when using input method Keyboard.
7120
7121 @item
7122 Control of Conversion and 8bit character has changed.
7123 @end itemize
7124
7125 Version 2.1 has been released on April 1996.
7126
7127 @itemize @bullet
7128 @item
7129 Fixed serious performance bug when loading files with
7130 font-lock/lazy-lock.  Use executables for conversion of large buffers.
7131
7132 @item
7133 The package @code{iso-cvt} is not integrated anymore.  Now this package
7134 can also convert to/from Latin-1 characters, it is much faster.
7135
7136 @item
7137 Menu support, including input method Menu.
7138
7139 @item
7140 @code{isearch} works with X-Symbol characters.
7141
7142 @item
7143 First multi-file version.
7144 @end itemize
7145
7146 Version 1.4 has been released on Feb 1996.
7147
7148 @itemize @bullet
7149 @item
7150 Provide some kind of ``poor man's Mule'' to remove most Nomule-Problems.
7151 @end itemize
7152
7153 Version 1.3 has been released on Jan 1996.
7154
7155 @itemize @bullet
7156 @item
7157 Input method Abbrev (precursor of input method Token).
7158
7159 @item
7160 Super-/subscript support.
7161 @end itemize
7162
7163 Version 1.2 has been released on Jan 1996.  It was the first release.
7164
7165 @itemize @bullet
7166 @item
7167 Conversion between characters and @TeX{} tokens.  Do so automatically
7168 when visiting a file and saving the buffer.
7169
7170 @item
7171 Input method Keyboard.
7172 @end itemize
7173
7174 @c ====================================================================
7175
7176 @node Wishlist, Open Questions, News, History
7177 @comment  node-name,  next,  previous,  up
7178 @section Wishlist: Projects for X-Symbol
7179 @cindex Wishlist
7180 @cindex Project
7181 @cindex Future Features
7182 @cindex Contributions
7183 @cindex Your Contribution
7184
7185 You are encouraged to try to provide a solution to one of the problems
7186 of this section.  In fact, it is quite unlikely that I do it myself
7187 without any contributions from you, see also @ref{Open Questions}.
7188
7189 Providing a solution to these problems is the second way of making your
7190 name appear in @ref{Acknowledgments}.
7191
7192 @menu
7193 * Wishlist Languages::          Additional token languages.
7194 * Wishlist Fonts::              Automatically generated fonts.
7195 * Wishlist Emacs::              Changes in Emacs/XEmacs.
7196 * Wishlist LaTeX::              Changes in La@TeX{}.
7197 * Wishlist Various::            Other changes.
7198 * Wishlist Rejected::           Rejected Suggestions for X-Symbol.
7199 @end menu
7200
7201
7202
7203 @node Wishlist Languages, Wishlist Fonts, Wishlist, Wishlist
7204 @comment  node-name,  next,  previous,  up
7205 @subsection Wishlist: Additional Token Languages
7206 @cindex More Token Languages
7207 @cindex Language Additions
7208 @cindex Ams@TeX{}
7209 @cindex IPA Fonts
7210
7211 Making a contribution here would require just a basic knowledge of Emacs
7212 and X-Symbol.  In fact, I would do the non-trivial part of the Emacs Lisp
7213 part (@pxref{Extending X-Symbol}) for general-interest token languages
7214 (e.g., Ams@TeX{}).
7215
7216 It is likely that this would require additional fonts: available fonts
7217 (e.g., IPA font), hand-crafted, or generated (@pxref{Wishlist
7218 Fonts}).
7219
7220
7221 @node Wishlist Fonts, Wishlist Emacs, Wishlist Languages, Wishlist
7222 @comment  node-name,  next,  previous,  up
7223 @subsection Wishlist: Generated Fonts
7224 @cindex Generated Fonts
7225 @cindex Fonts from Other Sources
7226 @cindex Fonts for Windows
7227 @cindex MS-Windows Fonts
7228 @cindex Windows Fonts
7229
7230 @pindex bdftofon
7231 A specific direction of font generation would be from @file{.bdf} or
7232 @file{.pcf} font files to Windows fonts to get rid of the limited
7233 support for XEmacs on Windows (@pxref{Requirements}).  If you have
7234 successfully converted X-Symbol's fonts from the Unix format to the
7235 Windows format (via @code{bdftofon} or whatever) or if you have free and
7236 real Latin-N fonts for Windows, please @emph{let me know}!  I would also
7237 appreciate if you would actively try to get those missing Windows fonts.
7238
7239 The general direction is to automatically generate the @file{.bdf} or
7240 @file{.fon} fonts from other sources.  This would have various
7241 advantages:
7242
7243 @itemize @bullet
7244 @item
7245 We could easily create different sizes for our symbol font.
7246
7247 @item
7248 It would be quite simple to create a font for Ams@TeX{} macros, etc.,
7249 which would be displayed as X-Symbol characters by package X-Symbol.
7250
7251 @item
7252 We could easily create different sizes for our symbol font.
7253
7254 @item
7255 We would have fonts for both X11 and Windows.
7256 @end itemize
7257
7258 New fonts for X-Symbol are being worked on.  You can find material to
7259 generate them at the @uref{@value{url}/news.html,web pages of X-Symbol}.
7260 Quite a few problems needs to be fixed though, so it is considered as
7261 experimental.  You are welcome to try, fix and report on the
7262 @uref{mailto:@value{listdevel},X-Symbol development mailing list}.
7263
7264 General open design issues (i.e., they could be re-thought for the
7265 currently used handcrafted fonts, too) are:
7266
7267 @itemize @bullet
7268 @item
7269 Different @TeX{} macros (same appearance, different @TeX{} class =
7270 different spacing) use the same MetaFont character, e.g., @code{\dagger}
7271 and @code{\dag}.  Therefore, we need different X11 characters for them.
7272
7273 @item
7274 Some Ascii characters have a special meaning in @TeX{}.  The
7275 corresponding MetaFont character is therefore produced by a TeX macro,
7276 e.g., @samp{@{} by @code{\@{}.
7277 @c @}@}
7278 We need a X11 character which looks similar to the character but not
7279 exactly like it.
7280 @end itemize
7281
7282 We could ask the question whether we should really distinguish the
7283 characters by appearance@dots{}we have the minibuffer info for the X-Symbol
7284 character anyway@dots{}.  Here are the options:
7285
7286 @itemize @minus
7287 @item
7288 distinguished by size/underlining/miscellaneous (currently used),
7289 @item
7290 distinguished by different spacing (my current favorite),
7291 @item
7292 not distinguished
7293 @end itemize
7294
7295
7296 @node Wishlist Emacs, Wishlist LaTeX, Wishlist Fonts, Wishlist
7297 @comment  node-name,  next,  previous,  up
7298 @subsection Wishlist: Changes in Emacs/XEmacs
7299 @cindex Emacs Changes
7300 @cindex XEmacs Changes
7301 @cindex Changes in Emacs
7302 @cindex Changes in XEmacs
7303
7304 Changes in Emacs and/or XEmacs would improve package X-Symbol, too:
7305
7306 @itemize @bullet
7307 @item
7308 In Emacs: a package system similar to XEmacs' one.  The installation
7309 would be easier.
7310
7311 @item
7312 @pindex ispell
7313 The package @code{ispell} assumes the buffer contents to be the same as
7314 the file contents and does not provide any hook to fix this.  This
7315 should be fixed in @code{ispell} (it will be better in Emacs-21.4),
7316 see @ref{Miscellaneous Packages}.
7317
7318 @item
7319 @pindex vc
7320 Some versions control commands turn off @code{font-lock}.  This should
7321 be changed.
7322
7323 @item
7324 Provide a face property @code{raise}: we wouldn't need extra fonts for
7325 super- and subscripts.  Emacs: it's already a display property, make it
7326 a face property, too (or make @code{font-lock} set properties other than
7327 faces).  XEmacs: no such property, yet.
7328
7329 @item
7330 You are sometimes unnecessarily asked (because X-Symbol will encode the
7331 corresponding characters anyway) for a safe coding system.  In Emacs
7332 (will be fixed in Emacs-21.4) for non-default Latin characters.  In
7333 XEmacs, for all non-default characters if you use package
7334 @code{latin-unity} (@pxref{File IO Packages}).
7335
7336 @item
7337 @findex isearch
7338 In Emacs, will be fixed in 21.4.  Using @code{isearch} and the input
7339 method Grid would not work.
7340
7341 @item
7342 @vindex after-insert-file-functions
7343 In XEmacs, fixed in 21.X.  In @code{after-insert-file-functions}, there
7344 should be a possibility to get to know the start position of the region
7345 which is inserted.  If @code{insert-file-contents} is called with
7346 argument @code{replace} being non-@code{nil}, it is not always point.
7347
7348 @item
7349 @vindex write-region-annotate-functions
7350 In Emacs and XEmacs, will be fixed in Emacs-21.4.  Make possibility to
7351 change buffers in @code{write-region-annotate-functions} official, see
7352 @ref{Alt Auto Conversion}, have a way to get the original buffer.
7353
7354 @item
7355 Since @code{font-lock} uses duplicable text properties in some cases, I
7356 need a function like @code{insert-buffer-substring-without-extents}.
7357 (Currently, I remove the extents afterwards, which looks slow for me.)
7358
7359 @item
7360 @vindex post-command-hook
7361 In XEmacs.  Run hooks in @code{post-command-hook} even if command exits
7362 with an error or quit (as it is in Emacs) or having some
7363 @code{post-error-or-quit-hook}.  @xref{Nomule Problems}.
7364
7365 @item
7366 In XEmacs.  There are some bugs in package @code{custom}/@code{widget}
7367 (still in XEmacs-21.4) which are visible during the customization of
7368 X-Symbol.
7369
7370 @end itemize
7371
7372
7373 @node Wishlist LaTeX, Wishlist Various, Wishlist Emacs, Wishlist
7374 @comment  node-name,  next,  previous,  up
7375 @subsection Wishlist: Changes in La@TeX{}
7376 @cindex La@TeX{} Changes
7377 @cindex Changes in La@TeX{}
7378 @cindex @file{inputenc.sty} Changes
7379 @pindex @file{inputenc.sty}
7380
7381 Changes in La@TeX{}, especially @file{inputenc.sty}, would improve package
7382 X-Symbol, too:
7383
7384 @itemize @bullet
7385 @item
7386 To make the definition of the character U00B5 consistent with Unicode,
7387 @file{inputenc.sty} should define the character to stand not for the
7388 token @code{\mu} (U03BC is the right character), but for an extra token,
7389 e.g., something like @code{\textmicro}.  X-Symbol uses @code{\mathmicro}
7390 here in order to avoid changing @code{\mu} to the character U00B5 if you
7391 have chosen to store 8bit characters.
7392 @c X-Symbol should not define it as \textmicro because then there would
7393 @c be a major difference between `x-symbol-8bits' nil and non-nil.
7394
7395 @item
7396 Use same encoding for both text and math, i.e. use @code{periodcentered}
7397 for both @code{\textperiodcentered} (the default) and @code{\cdot}.  At
7398 least provide text-and-math versions for characters where no alternative
7399 is more obvious than the other.  If that is not possible, always choose
7400 text mode except for @code{\lnot}, @code{\pm}, @code{\times} and
7401 @code{\division}: use
7402 @code{\textonesuperior} for U00B9, \texttwosuperior for U00B2, and
7403 @code{\textthreesuperior} for U00B3.
7404
7405 @item
7406 The @TeX{} macros @code{\textcent}, @code{\textcurrency},
7407 @code{\textbrokenbar}, @code{\textyen} are defined as not available with
7408 OT1 and T1 font encoding.  This should be changed.
7409 @end itemize
7410
7411
7412 @node Wishlist Various, Wishlist Rejected, Wishlist LaTeX, Wishlist
7413 @comment  node-name,  next,  previous,  up
7414 @subsection Various Projects for X-Symbol
7415
7416 The following suggestions seem to be useful, though not essential:
7417
7418 @itemize @bullet
7419 @item
7420 @cindex Print Buffer
7421 @cindex Buffer Printing
7422 @pindex ps-print
7423 It would be nice if we could print the buffer contents.  Currently, you
7424 see strange characters instead X-Symbol's own characters.
7425
7426 Printing non-standard fonts is only possible via the Emacs package
7427 @code{ps-print}.  A newer version of @code{ps-print} might be probably
7428 already capable of doing it.  Thus, you are encouraged to help the
7429 XEmacs team updating this package.
7430 @end itemize
7431
7432
7433 @node Wishlist Rejected,  , Wishlist Various, Wishlist
7434 @comment  node-name,  next,  previous,  up
7435 @subsection Rejected Suggestions for X-Symbol
7436 @cindex Rejected Suggestions
7437
7438 The following suggestions seem to be not useful enough to be worth the
7439 additional effort and increased package size.  I might be convinced
7440 otherwise by patches (i.e., code, not text), though:
7441
7442 @itemize @bullet
7443 @item
7444 @cindex Input Method Token
7445 It would be nice if X-Symbol would replace the token with the last
7446 character of the token if this is possible (@pxref{Input Method Token}),
7447 not just with the next character.  Well, during typing, this is not
7448 really annoying and after a while, you will use input method Token only
7449 for very short tokens.
7450 @end itemize
7451
7452 @c ===========================================================================
7453
7454 @node Open Questions, Acknowledgments, Wishlist, History
7455 @comment  node-name,  next,  previous,  up
7456 @section Open Questions
7457 @cindex Open Questions
7458 @cindex Various Questions
7459 @cindex Questions I Have
7460
7461 This section lists some minor open questions.
7462
7463 @itemize @bullet
7464 @item
7465 @findex x-symbol-initialize
7466 @cindex Auto Initialization
7467 Loading file @file{x-symbol.el} will initialize package X-Symbol (via
7468 function @code{x-symbol-initialize}), since all functions will need the
7469 initialization.  In my opinion, this is no problem, since all
7470 customization options are defined an other files which do not require
7471 file @file{x-symbol.el}.  Thus, customizing package X-Symbol will not
7472 initialize package X-Symbol.
7473
7474 The alternative would be to call function @code{x-symbol-initialize} in
7475 every function which can be autoloaded.  This seems quite tedious to
7476 me.  Also, I do not see a reason not to call @code{x-symbol-initialize}
7477 top-level in file @file{x-symbol.el}.  If I am wrong here, please let me 
7478 know (with an explanation).  Batch-compilation might be an issue@dots{}
7479
7480 @item
7481 @pindex crypt
7482 @vindex x-symbol-auto-conversion-method
7483 When is necessary to set @code{x-symbol-auto-conversion-method} to
7484 @code{slowest}?  Of course, it is only necessary when using
7485 @code{crypt}.  Is the other necessary condition to use the computer pool
7486 of the University of Edinburgh?
7487 @end itemize
7488
7489 @c ===========================================================================
7490
7491 @node Acknowledgments,  , Open Questions, History
7492 @comment  node-name,  next,  previous,  up
7493 @section Acknowledgments
7494 @cindex Acknowledgments
7495 @cindex Contributions
7496 @cindex Marlet, Renaud
7497 @cindex Bradfield, Julien
7498 @pindex math-mode
7499 @cindex Adobe
7500 @pindex frame-icon
7501 @cindex Thanks
7502
7503 Stefan Monnier did many of the changes necessary for porting X-Symbol to
7504 Emacs-21.  Fortunately, he not only changed X-Symbol to use a quite
7505 different API on Emacs for things like charsets and menus, he also made
7506 the necessary changes in Emacs itself.  Before that, Sang-Min Lee
7507 started porting X-Symbol to Emacs-20.4, which was important for moving
7508 the status of the Emacs port of X-Symbol from ``todo'' to ``in work''.
7509
7510 David Kastrup demonstrated that the old way of encoding characters to
7511 @TeX{} macros generally inhibited ligatures and kerns, i.e., it was
7512 worse than expected.  He also discussed the details of how to do the
7513 encoding and decoding right.  Christophe Raffalli suggested to use a
7514 decode method which can be used for a larger class of token languages.
7515 He also proved that it is faster.
7516
7517 Solofo Ramangalahy is working on scripts to generate X-Symbol fonts from
7518 other sources.  This has various advantages and is discussed in more detail at
7519 @ref{Wishlist Fonts}.  His work is now available at the
7520 X-Symbol download area.
7521
7522 Package @code{math-mode} by Renaud Marlet and the extension of it by
7523 Julian Bradfield gave the basic idea for the following features:
7524 supporting @TeX{}'s math macros, input methods token, context/electric,
7525 super-/subscript support.  The shell script @code{makesub} is a merge
7526 and change of the scripts @code{makesupers} and @code{makesub} by
7527 Julian.
7528
7529 The font @samp{xsymb0}, which is distributed with this package, is a
7530 minor modification (appearance) of the Adobe symbol font, thanks to its
7531 non-restrictive copyright.  You may use the Adobe font instead.  The
7532 special images are from package @code{frame-icon}.
7533
7534 The idea for Help during an X-Symbol key sequence is from package
7535 @code{x-compose}.  The general idea for showing some info in the echo
7536 area is from package @code{eldoc}.  The trick which stops
7537 @code{expand-abbrev} is from package @code{mail-abbrevs}.  The idea for
7538 @code{x-symbol-image-cache-directories} is from package
7539 @code{fast-lock}.  The code for image command parsing is influenced by
7540 some code in package @code{font-lock}.  The code around
7541 @code{x-symbol-image-delete-extents} is based on some code in package
7542 @code{bib-cite}.
7543
7544 @i{Thanks for patches/reports/suggestions to}: Adrian Aichner, Vladimir Alexiev, David
7545 Aspinall, Masayuki Ataka, Neal Becker, Matthias Berberich, Stefano
7546 Bianchi, Janusz S. Bien, Uwe Brauer, Alastair Burt, John Collins,
7547 Laurent Descamps, Frederic Devernay, Carsten Dominik, Steve Dunham,
7548 Michael Ebner, Stephen Eglen, Paul Furnanz, Jeffrey Grandy, Clemens
7549 Gr@"opl, Kenichi Handa, Meik Hellmund, Ryurick M. Hristev, Adriaan
7550 Joubert, Marcin Kasperski, David Kastrup, Richard Ketchersid, Felix
7551 E. Klee, Gerwin Klein, Thomas Kleymann, Ekkehard Koehler, Fred Labrosse,
7552 Jan-Ake Larsson, Bernhard Lehner, Stefan Monnier, Harald Muehlboeck,
7553 Karsten Muehlmann, Jakub Narebski, Peter M@o{}ller Neergaard, Raymond
7554 Nijssen, David von Oheimb, Alex Ott, Sudeep Kumar Palat, Arshak
7555 Petrosyan, Jim Radford, Christophe Raffalli, Solofo Ramangalahy, Alex
7556 Russell, Marciano Siniscalchi, Richard M. Stallman, Axel Thimm, Eli
7557 Tziperman, Jan Vroonhof, Markus Wenzel, Sabine Wetzel, Pierre-Henri
7558 Wuillemin, Roland Zumkeller, Marco Zunino, Gerard Zwaan.
7559
7560 @i{Thanks for general information to:} Per Abrahamsen, Steve L. Baur,
7561 Kenichi Handa, David Kastrup, Gerd Moellmann, Stefan Monnier, Primoz
7562 Peterlin, Martin Ramsch, Peter Schmitt, Toby Speight, Jan Vroonhof, Eli
7563 Zaretskii.
7564
7565 I made use of information from the following URLs:
7566
7567 @display
7568   @url{http://www.fmi.uni-passau.de/~ramsch/iso8859-1.html}
7569   @url{http://czyborra.com/charsets/iso8859.html}
7570   @url{http://www.bbsinc.com/iso8859.html}
7571   @url{http://www.bbsinc.com/iso8879.html}
7572   @url{http://ppewww.ph.gla.ac.uk/~flavell/charset/internat.html}
7573   @url{http://ppewww.ph.gla.ac.uk/~flavell/iso8859/iso8859-pointers.html}
7574   @url{http://sizif.mf.uni-lj.si/linux/cee/iso8859-2.html}
7575 @end display
7576
7577 I do not intend to update this list in the future---this is just an
7578 "Acknowledgment" section.
7579
7580
7581 @node Indexes,  , History, Top
7582 @comment  node-name,  next,  previous,  up@unnumbered Indexes
7583 @unnumbered Indexes
7584
7585 You should consult the following indexes if you are interested in a
7586 specific feature or aspect of package X-Symbol.  You should also consult
7587 them before sending a report to the maintainer (@pxref{Bug Reports}),
7588
7589 @menu
7590 * Key Index::                   Key sequences.
7591 * Program Index::               Programs and Emacs packages.
7592 * Variable Index::              Commands, functions, variables.
7593 * Concept Index::               Various topics.
7594 @end menu
7595
7596 The links lead you to the manual sections describing X-Symbol's commands
7597 and variables.  @xref{About}.
7598
7599 @comment workaround for bug with the length of the lists
7600 @iftex
7601 @vskip 6ex plus 1ex minus 4ex
7602 @end iftex
7603
7604 @node Key Index, Program Index, Indexes, Indexes
7605 @comment  node-name,  next,  previous,  up
7606 @unnumberedsec Key Index
7607 @printindex ky
7608
7609 @comment workaround for bug with the length of the lists
7610 @iftex
7611 @page
7612 @end iftex
7613
7614 @node Program Index, Variable Index, Key Index, Indexes
7615 @comment  node-name,  next,  previous,  up
7616 @unnumberedsec Program and Package Index
7617 @printindex pg
7618
7619 @comment workaround for bug with the length of the lists
7620 @iftex
7621 @page
7622 @end iftex
7623
7624 @node Variable Index, Concept Index, Program Index, Indexes
7625 @comment  node-name,  next,  previous,  up
7626 @unnumberedsec Command, Function and Variable Index
7627 @printindex vr
7628
7629 @comment workaround for bug with the length of the lists
7630 @iftex
7631 @page
7632 @end iftex
7633 @node Concept Index,  , Variable Index, Indexes
7634 @comment  node-name,  next,  previous,  up
7635 @unnumberedsec Concept Index
7636 @printindex cp
7637
7638 @contents
7639 @bye
7640 @c Local IspellPersDict: .ispell_xsymb