summaryrefslogtreecommitdiff
path: root/support/jed/jlm/doc/jlm.tex
blob: 7b0fdeab63811c6e678aea4f71b30c111924892e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
\IfFileExists{nag.sty}{\RequirePackage[l2tabu,orthodox]{nag}}{}

\documentclass[draft,english]{scrreprt}

\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{textcomp}

\usepackage[ngerman,english]{babel}

\usepackage{fixltx2e}
\usepackage[draft=false]{microtype}
\usepackage{paralist}
\usepackage{color}
\usepackage[draft=false,colorlinks,urlcolor=blue]{hyperref}
\usepackage{svn}
\usepackage{array}
\usepackage{fancyvrb}
\usepackage{dtklogos}

\newcommand*{\file}[1]{\nolinkurl{#1}}
\newcommand*{\func}[1]{\textsf{#1()}}
\newcommand*{\var}[1]{\textsf{#1}}
\newcommand*{\key}[1]{\texttt{#1}}
\newcommand*{\ctrlkey}[1]{\key{\^{}#1}%
  \texorpdfstring{%
    \ifnum`#1=\lccode`#1%
      \PackageWarning{document}{Kleinbuchstaben #1 fuer ctrlkey verwendet}%
    \fi}{}}
\newcommand*{\metakey}{\key{ESC\,}}
\newcommand*{\reskey}{\ctrlkey{C}}
\newcommand*{\subseckey}{}
\newcommand*{\keyseq}[1]{\key{\reskey\subseckey#1}}

\newcommand*{\texstring}[1]{\texttt{#1}}
\newcommand*{\texcmd}[1]{\texstring{\textbackslash{}#1}}

\newcommand*{\editpoint}{\textbullet}

\newcommand*{\help}[1]{\textcolor{green}{help: #1}}
\newcommand*{\todo}[1]{\textcolor{red}{todo: #1}}

\newlength{\mywidth}
\newcommand*{\babelHyphExample}[2]{\settowidth{\mywidth}{#1}%
  \addtolength{\mywidth}{3.65pt}%          width of hyphen sign
  \addtolength{\mywidth}{-\linewidth}%
  \par\noindent\rule{-\mywidth}{.3mm}\hspace{0pt}#2}

\SVN $LastChangedRevision: 189 $
\SVN $LastChangedDate: 2007-08-05 18:57:13 +0200 (So, 05 Aug 2007) $

\begin{document}

\title{JLM---Jörg's \LaTeX{} Mode}
\author{Jörg Sommer
  \href{mailto:joerg@alea.gnuu.de}{\nolinkurl{<joerg@alea.gnuu.de>}} }
\date{\SVNDate}
\maketitle

\begin{abstract}
  JLM is an advanced \LaTeX{} mode for Jed. Its aim is to help the user by
  taking over annoying and stupid things they need to be done, like add a
  \texcmd{usepackage} when you add a command or environment from this package
  or put dollar signs around mathematical commands and move the cursor to an
  appropriate point.

  JLM does not think for you. If you want a \texstring{tabular}, but insert an
  \texstring{itemize}, JLM doesn't prevent this. So, you should be familiar
  with \LaTeX{} and know what environments and commands are and where to place
  them in a document---JLM helps writing them.
\end{abstract}

\tableofcontents
% \listoftables
% \listoffigures

\chapter{Installation}
\section{\ldots{} on Unix-like systems}

Obviously, you need Jed. You can download the current version from
\url{http://www.jedsoft.org/jed/download.html}, but it is also part of many
distributions. You need at least version 0.99.18 with SLang~2 support (run
\verb+jed --version+ to check it).

\begin{enumerate}
  \setcounter{enumi}{-1}
 \item Download the archive \file{jjm-rXYZ.tgz}, where XYZ is the version
  usually the highest available, from
  \url{http://www.minet.uni-jena.de/~joergs/}.

 \item Create a directory \file{.jed/} in your home directory, if it doesn't
  exist, and save there the files from the archive. Save in the same directory
  the file \file{x-keydefs.sl} from
  \url{http://jedmodes.sf.net/mode/x-keydefs/}---use
  \url{http://jedmodes.cvs.sourceforge.net/*checkout*/jedmodes/mode/x-keydefs/x-keydefs.sl?view=checkout&revision=HEAD}.

 \item Depending on your system, Jed loads the file \file{~/.jedrc} or
  \file{~/.jed/jed.rc} (on Debian) as your configuration file. You can copy
  the whole file \file{.jed/doc/latex-jed.rc} to this location or copy only
  parts from \file{latex-jed.rc} into your \file{jed.rc}.

  Important are only these lines to tell Jed where he can find JLM and that he
  should use it for files with the extention \file{.tex} or \file{.latex}.
  \begin{Verbatim}[gobble=2,fontsize=\small,frame=lines]
  Jed_Home_Directory = path_concat(getenv("HOME"), ".jed");
  set_jed_library_path(Jed_Home_Directory + "," + get_jed_library_path());
  Jed_Highlight_Cache_Dir = path_concat(Jed_Home_Directory, "dfa");

  add_mode_for_extension("latex", "tex");
  add_mode_for_extension("latex", "latex");
  \end{Verbatim}
  (On Debian the first three lines aren't needed.)
\end{enumerate}

Now you can open a \LaTeX{} file and start using JLM. Have fun.

\section{\ldots{} on Windows}

Obviously, you need Jed. You can download it from
\url{http://www.paneura.com/~dino/wjed.html}.

\begin{enumerate}
  \setcounter{enumi}{-1}
 \item Download the archive \file{jjm-rXYZ.tgz}, where XYZ is the version
  usually the highest available, from
  \url{http://www.minet.uni-jena.de/~joergs/}.

 \item Create a directory \file{C:\Dokumente und
  Einstellungen\USERNAME\Anwendungsdaten\jed} \help{Where are the
  spaces in this URL?} in your home directory, if it doesn't
  exist, and save there the files from the archive. Save in the same directory
  the file \file{x-keydefs.sl} from
  \url{http://jedmodes.sf.net/mode/x-keydefs/}---use
  \url{http://jedmodes.cvs.sourceforge.net/*checkout*/jedmodes/mode/x-keydefs/x-keydefs.sl?view=checkout&revision=HEAD}.

 \item Jed loads the file
  \file{C:\Dokumente und Einstellungen\USERNAME\jed.rc}. \help{Where are the
  spaces in this URL?} You can copy the
  whole file \file{doc/latex-jed.rc} from the archive to this location or copy
  only parts from \file{latex-jed.rc} into your \file{jed.rc}.

  Important are only these lines to tell Jed where he can find JLM and that he
  should use it for files with the extention \file{.tex} or \file{.latex}.
  \begin{Verbatim}[gobble=2,fontsize=\small,frame=lines]
  Jed_Home_Directory = path_concat(getenv("APPDATA"), "jed");
  set_jed_library_path(Jed_Home_Directory + "," + get_jed_library_path());
  Jed_Highlight_Cache_Dir = path_concat(Jed_Home_Directory, "dfa");

  add_mode_for_extension("latex", "tex");
  add_mode_for_extension("latex", "latex");
  \end{Verbatim}
\end{enumerate}

Now you can open a \LaTeX{} file and start using JLM. Have fun.

\chapter{\TeX{} environments---\func{env\_insert}}

\chapter{\texstring{array} like environments}

Environments they are organised in columns \texstring{table},
\texstring{array} or \texstring{cases}.

\chapter{\TeX{} commands---\func{cmd\_insert}}\label{sec:cmds}

The function \func{cmd\_insert} is an important function of the mode. It is
used for inserting \TeX{} commands like \texcmd{LaTeX} or \texcmd{frac}. With
a database (created with \func{cmd\_add}) it decides whether a command is a
math command and how much mandatory arguments it has. If a command must be in
math mode, e.\,g. \texcmd{frac}, it inserts dollar signs \$ around the
command.

The prefix of the command (\func{prefix\_argument}) determines the number of
optional arguments, e.\,g. the exponent of \texcmd{sqrt}.

Many commands are predefined in \file{latex_cmds.sl}.

\todo{packages needed by the command are inserted}

\chapter{Math stuff}
\section{In text formulas \$\ldots\$}\label{sec:dollar}

If a command is inserted via \func{cmd\_insert} and it is known that this is a
math command, it is automaticly placed inside \$\ldots\$. See \autoref{sec:cmds}.

If you insert a dollar sign manually and a backslash is before the editing
point or the dollar sign is a begin of an in text formula, nothing happens. If
the dollar sign is the end of an in text formula, something more happens:
\begin{itemize}
 \item If the variable \var{BLINK} is non-zero the editing point jumps to the
  begin of the text formula for a short period or until the next key is
  pressed.
 \item All open brackets [, \{ and ( in the formula are closed before the
  dollar sign is inserted or all closing brackets in front of the editing
  point matching an open bracket are skipped before the dollar sign is
  inserted. A dollar sign at the point where it should be inserted is skipped
  and nothing is inserted.

  Some examples:
  \begin{itemize}
   \item \$\texcmd{frac}\{1\}\{2\}\editpoint \quad $\rightarrow$\quad
    \$\texcmd{frac}\{1\}\{2\}\$\editpoint
   \item \$\texcmd{frac}\{1\}\{2\editpoint \quad $\rightarrow$\quad
    \$\texcmd{frac}\{1\}\{2\}\$\editpoint
   \item \$(\texcmd{\{}\texcmd{frac}\{1\}\{2\editpoint \quad $\rightarrow$\quad
    \$(\texcmd{\{}\texcmd{frac}\{1\}\{2\}\texcmd{\}})\$\editpoint
   \item \$\texcmd{frac}\{1\}\{2\editpoint\}\$ \quad $\rightarrow$\quad
    \$\texcmd{frac}\{1\}\{2\}\$\editpoint
  \end{itemize}
\end{itemize}

\section{Active characters after math commands}

Some commands defined in \file{latex_cmds.sl} run a hook after insertion. If
you press one of the characters “=-+<>” after you inserted one these commands
the editing point is moved before the dollar sign and the character is
inserted there. All greek letters have this hook.

Example: You want to write “$\alpha$ is the upper angle in a triangle and
$\alpha+\beta=\gamma$.” Simply type it. Use the math key for the greek
characters, e.\,g. \key{\reskey ma} for \texstring{\$\texcmd{alpha}\$}. After
the first \texcmd{alpha} the editing point is after the dollar sign
(\$\texcmd{alpha}\$\editpoint). There you can type \help{weiterschreiben}.
After the next \texcmd{alpha} you have the same situation. Press the plus sign
and you get this: \$\texcmd{alpha}+\editpoint\$. Type on til the
\texcmd{gamma}. There you must use the right key or use the dollar sign magic
\autoref{sec:dollar}.

\chapter{Folding}
\label{cha:folding}

JLM supports folding.

\begin{table}
  \begin{tabular}{|@{\hspace{1mm}}l}
    \ttfamily
    \texcmd{documentclass\{\ldots{}\}}\\
    \quad%
       \begin{tabular}{|@{\hspace{1mm}}l}
         \texcmd{usepackage\{\ldots{}\}}
       \end{tabular}\\
    \texcmd{begin\{document\}}\\
    \quad%
       \begin{tabular}{|@{\hspace{1mm}}l}
         \ldots{}\\
         \texcmd{begin\{\ldots{}\}}\\
         \quad%
            \begin{tabular}{|@{\hspace{1mm}}l}
              \ldots{}\\
              \texcmd{begin\{\ldots{}\}}\\
              \quad%
                 \begin{tabular}{|@{\hspace{1mm}}l}
                   \ldots{}
                 \end{tabular}\\
              \texcmd{end\{\ldots{}\}}\\
              \ldots{}\\
            \end{tabular}\\
         \texcmd{end\{\ldots{}\}}\\
         \ldots{}\\
         \texcmd{chapter\{\ldots{}\}}\\
         \quad%
            \begin{tabular}{|@{\hspace{1mm}}l}
              \ldots{}\\
              \texcmd{section\{\ldots{}\}}\\
              \quad%
                 \begin{tabular}{|@{\hspace{1mm}}l}
                   \ldots{}\\
                   \texcmd{subsection\{\ldots{}\}}\\
                   \quad%
                      \begin{tabular}{|@{\hspace{1mm}}l}
                        \ldots{}\\
                        \texcmd{subsubsection\{\ldots{}\}}\\
                        \quad%
                           \begin{tabular}{|@{\hspace{1mm}}l}
                             \ldots{}\\
                           \end{tabular}\\
                        \texcmd{subsubsection\{\ldots{}\}}\\
                        \quad%
                           \begin{tabular}{|@{\hspace{1mm}}l}
                             \ldots{}\\
                           \end{tabular}\\
                      \end{tabular}\\
                   \texcmd{subsection\{\ldots{}\}}\\
                   \quad%
                      \begin{tabular}{|@{\hspace{1mm}}l}
                        \ldots{}
                      \end{tabular}
                 \end{tabular}\\
            \end{tabular}\\
         \texcmd{chapter\{\ldots{}\}}
       \end{tabular}\\
    \texcmd{end\{document\}}\\
    \makebox[1em][l]{0}\makebox[1em][l]{|1}\makebox[1em][l]{|2}%
       \makebox[1em][l]{|3}\makebox[1em][l]{|4}\makebox[1em][l]{|5}
  \end{tabular}
\end{table}

\chapter{Babel}
\section{Hyphenation}
Compound words are common in german. But compounding words with a dash
(\texttt{-}) has some drawbacks: You loose automatic hyphenation or get bad
hyphen points; see \autoref{fig:hypen-examples} The package \textsf{babel}
provides commands to circumvent these problems, but they are difficult to type
in---they start with a \texstring{\dq} which is bound to quotation mark function
\todo{add link to this section}---and you must remember that you have to use
them.

JLM takes care of this and replaces the dash by an suitable command. A dash
followed by a dollar sign or alphabetical character starts the functions and
it watches out for alphabetical characters, a slash or a closing brace. So you
can cancel the operation by moving the editing point or enter a number.

The functions counts the characters on the left side and on the right side. If
they are more than an internal set threshold the dash is replaced. If on the
left side are fewer characters than the threshold the dash is replaced by
\texstring{\dq\~} otherwise by \texstring{\dq=}. If a shash or an closing
brace follows the dash, it is replaced by \texttt{\dq\~} and \texttt{\dq\dq}
is written after the slash or brace, respectively.

Some examples:
\begin{itemize}
 \item \texstring{primitiv-rekursiv} becomes \texstring{primitiv\dq=rekursiv}

 \item \texstring{t-produktiv} becomes \texstring{t\dq\~{}produktiv}

 \item \texstring{$\alpha$-Teilchen} becomes \texstring{$\alpha$\dq\~{}Teilchen}

 \item \texstring{Ein-/Ausgabe} becomes \texstring{Ein\dq\~{}/\dq\dq{}Ausgabe}

 \item \texstring{(Haupt-)Aufgabe} becomes \texstring{(Haupt\dq\~{})\dq\dq{}Aufgabe}
\end{itemize}

\begin{figure}
  \centering
  \selectlanguage{ngerman}
  \microtypesetup{protrusion=false} % disable font protrusion, because it
                                    % changes the hyphenation
  \begin{tabular}{*{2}{p{.4\linewidth}@{}|}}
    \multicolumn{1}{c@{}}{\underline{bad hyphenation}}&
    \multicolumn{1}{c@{}}{\underline{good hyphenation}}\\
    % \babelHyphExample{$C$-Vektor}{$C$-Vektorraum}&
    % \babelHyphExample{$C$-Vektor}{$C$"=Vektorraum}\\
    \babelHyphExample{HI}{HI-Virus}&
    \babelHyphExample{HI}{HI"~Virus}\\

    \babelHyphExample{bergauf und }{bergauf und -ab}&
    \babelHyphExample{bergauf und}{bergauf und "~ab}\\

    \babelHyphExample{primitiv-rekur}{primitiv-rekursiv}&
    \babelHyphExample{primitiv-rekur}{primitiv"=rekursiv}\\

    \babelHyphExample{Motor}{Motorrad-Handbuch}&
    \babelHyphExample{Motor}{Motorrad"=Handbuch}\\

    \babelHyphExample{Ein}{Ein-/Ausgabe}&
    \babelHyphExample{Ein/}{Ein"~/""Ausgabe}\\

    \babelHyphExample{(Haupt}{(Haupt-)Stromkreis}&
    \babelHyphExample{(Haupt)}{(Haupt"~)""Stromkreis}
  \end{tabular}
  \microtypesetup{protrusion=true}
  \selectlanguage{english}
  \caption{Examples of good and bad hyphenation of compound words in german
    caused by using a simple dash}
  \label{fig:hypen-examples}
\end{figure}

\chapter{Keys}

% This documentation assumes that the variable
% `_Reserved_Key_Prefix' == "^C".
% This is the default in Jed's "emacs" emulation.
%
% The "CUA" emulation sets it to "^E", so, e.g., a keybinding "^Ce<"
% will become "^Ee<".

\section{Newline with completion}

Some environments are structured internally with special commands like
\texcmd{item} in \texstring{enumerate} or \texcmd{\textbackslash} in
\texstring{tabular}. \func{newline\_with\_completion} (bound to
\key{\reskey-Return} and \key{Shift-Return}) inserts a text before and after
the linebreak.

Like the dollar sign (\autoref{sec:dollar}) it closes open brackets or skipps
closing brackets before it inserts.

Examples:
\begin{verbatim}
\begin{itemize}
 \item a aa•
 \item $aaaa•
 \item \texttt{aa aa•}
 \item \texttt{$aaa•}
 \item (•)
 \item $(\texttt{aaaa•})
 \item aaa $aa$ •
\end{itemize}

\begin{gather*}
  \begin{cases}
    aaa& aaa•
  \end{cases}\\
  aaa aa (a_{•})
\end{gather*}
\end{verbatim}

% % templates - ^CT or ^C^T
% definekey_reserved("menu_select_menu(\"Global.M&ode.&Templates\")", "t", MODE);
% definekey_reserved("menu_select_menu(\"Global.M&ode.&Templates\")", "^T", MODE);

% % packages - ^CP
% definekey_reserved("latex->pkg_prompt", "p", MODE);

% % array - ^Ca
% definekey_reserved("latex->array_edit_column_format",      "ae",  MODE);
% definekey_reserved("latex->array_next_cell",               "a\t", MODE);
% definekey_reserved("latex->array_next_cell",               "aa",  MODE);
% definekey_reserved("latex->array_new_cell",                "an",  MODE);
% definekey_reserved("latex->array_prev_cell",               "ap",  MODE);

\renewcommand*{\subseckey}{e}
\subsection{environments---\keyseq{}}
\begin{center}
  \begin{tabular}{l|cl}
    \multicolumn{1}{c|}{Key}& \multicolumn{1}{c}{Function}&
       \multicolumn{1}{c}{Description}\\
    \hline
    \keyseq{<}& \func{boenv}& goes to the \texcmd{begin} of the environment\\
    \keyseq{c}& \func{env\_close}& goes to the \texcmd{end} of the
       environment\\
    \keyseq{\}}& \func{env\_close}& inserts an \texcmd{end} to close the
       current environment\\
    \keyseq{e}& \func{env\_prompt}& inserts a new environment with
       \texcmd{begin} and \texcmd{end}\\
    \keyseq{Return}& \func{env\_prompt}& inserts a new environment with
       \texcmd{begin} and \texcmd{end}\\
    \keyseq{r}& \func{env\_rename}& renames the current environment\\
    \keyseq{>}& \func{eoenv}& goes to the \texcmd{end} of the environment
  \end{tabular}
\end{center}

\renewcommand*{\subseckey}{d}
\subsection{commands---\keyseq{}}

% definekey_reserved("latex->cmd_prompt", "d", MODE);

\section{Hot keys for \TeX{} commands}

\renewcommand*{\subseckey}{s}
\subsection{sectioning commands---\keyseq{}}

\begin{center}
  \begin{tabular}{l|l||l|l}
    \multicolumn{1}{c|}{\TeX{} command}& \multicolumn{1}{c||}{Key}&
       \multicolumn{1}{c|}{\TeX{} command}& \multicolumn{1}{c}{Key}\\
    \hline
    \texcmd{appendix}& \keyseq{a}&
       \texcmd{section}& \keyseq{s}\\
    \texcmd{chapter}& \keyseq{c}&
       \texcmd{subsubsection}& \keyseq{b}\\
    \texcmd{minisec}& \keyseq{m}&
       \texcmd{subsection}& \keyseq{u}\\
    \texcmd{paragraph}& \keyseq{g}&
       \texcmd{subparagraph}& \keyseq{h}\\
    \texcmd{part}& \keyseq{p}
  \end{tabular}
\end{center}

\renewcommand*{\subseckey}{f}
\subsection{font commands---\keyseq{}}

\todo{Klären, was \func{font\_cmd} ist. Liegt auf \keyseq{p}}
% definekey_reserved("latex->font_resize(1)",              "f-", MODE);
% definekey_reserved("latex->font_resize(0)",              "f+", MODE);

\begin{center}
  \begin{tabular}{l|*{2}{>{\centering\arraybackslash}p{19mm}}||l|*{2}{>{\centering\arraybackslash}p{19mm}}}
    \multicolumn{1}{c|}{\TeX{} cmd.}& in text mode& in mathe mode&
       \multicolumn{1}{c|}{\TeX{} cmd.}& in math mode& everywhere\\
    \hline
    \texcmd{emph}& \multicolumn{2}{c||}{\keyseq{e}}& &&\\
    &&&\texcmd{overline}& \multicolumn{2}{c}{\key{\reskey{}m\_}}\\
    \texcmd{textbf}& \keyseq{b}& ---&\texcmd{mathbf}& \keyseq{b}& \keyseq{B}\\
    &&&\texcmd{mathcal}& \multicolumn{2}{c}{\keyseq{a}/\key{\reskey{}nc}}\\
    \texcmd{textit}& \keyseq{i}& ---&\texcmd{mathit}& \keyseq{i}& \keyseq{I}\\
    &&&\texcmd{mathfrak}& \multicolumn{2}{c}{\keyseq{k}}\\
    \texcmd{textmd}& \multicolumn{2}{c||}{\keyseq{m}}&&&\\
    \texcmd{textnormal}& \keyseq{n}& ---&
       \texcmd{mathnormal}& \keyseq{n}& \keyseq{N}\\
    \texcmd{textrm}& \keyseq{r}& ---&\texcmd{mathrm}& \keyseq{r}& \keyseq{R}\\
    \texcmd{textsc}& \multicolumn{2}{c||}{\keyseq{c}}& &&\\
    \texcmd{textsf}& \keyseq{f}& ---&\texcmd{mathsf}& \keyseq{f}& \keyseq{F}\\
    \texcmd{textsl}& \multicolumn{2}{c||}{\keyseq{s}}& &&\\
    \texcmd{texttt}& \keyseq{t}& ---&\texcmd{mathtt}& \keyseq{t}& \keyseq{T}\\
    \texcmd{textup}& \multicolumn{2}{c||}{\keyseq{u}}& &&\\
    \texcmd{underline}& \keyseq{d}/\keyseq{\_}& ---&
       \texcmd{underbar}& \keyseq{d}/\keyseq{\_}& \keyseq{D}\\
    \texcmd{verb}& \multicolumn{2}{c||}{\keyseq{v}}& &&\\
    \texcmd{text}& \multicolumn{2}{c||}{\keyseq{x}}& &&
  \end{tabular}
\end{center}

\renewcommand*{\subseckey}{m}
\subsection{math commands---\keyseq{} and \key{\reskey{}n}}

\begin{center}
  \begin{tabular}[t]{lc||}
    \TeX{} cmd.& key\\
    \hline
    \texcmd{alpha}&                \keyseq{a}\\
    \texcmd{beta}&                 \keyseq{b}\\
    \texcmd{cap}&                  \keyseq{-}\\
    \texcmd{cdot}&                 \keyseq{.}\\
    \texcmd{chi}&                  \keyseq{c}\\
    \texcmd{colon}&                \keyseq{:}\\
    \texcmd{cos}&                  \keyseq{\ctrlkey{C}}\\
    \texcmd{cup}&                  \keyseq{+}\\
    \texcmd{Delta}&                \keyseq{D}\\
    \texcmd{delta}&                \keyseq{d}\\
    \texcmd{det}&                  \keyseq{\ctrlkey{D}}\\
    \texcmd{downarrow}&            \keyseq{\ctrlkey{N}}/\key{\reskey\textdownarrow}\\
    \texcmd{emptyset}&             \keyseq{0}\\
    \texcmd{epsilon}&              \keyseq{e}\\
    \texcmd{eta}&                  \keyseq{h}\\
    \texcmd{exists}&               \keyseq{E}\\
    \texcmd{exp}&                  \keyseq{\ctrlkey{E}}\\
    \texcmd{forall}&               \keyseq{A}\\
    \texcmd{frac}&                 \key{\reskey{}nf}\\
    \texcmd{frac\{1\}}&            \key{\reskey{}n1}\\
    \texcmd{frac\{1\}\{2\}}&       \key{\reskey{}n2}\\
    \texcmd{frac\{1\}\{3\}}&       \key{\reskey{}n3}\\
    \texcmd{frac\{1\}\{4\}}&       \key{\reskey{}n4}\\
    \texcmd{frac\{1\}\{5\}}&       \key{\reskey{}n5}\\
    \texcmd{frac\{1\}\{6\}}&       \key{\reskey{}n6}\\
    \texcmd{frac\{1\}\{7\}}&       \key{\reskey{}n7}\\
    \texcmd{frac\{1\}\{8\}}&       \key{\reskey{}n8}\\
    \texcmd{frac\{1\}\{9\}}&       \key{\reskey{}n9}\\
    \texcmd{Gamma}&                \keyseq{G}\\
    \texcmd{gamma}&                \keyseq{g}
  \end{tabular}%
  \begin{tabular}[t]{lc||}
    \TeX{} cmd.& key\\
    \hline
    \texcmd{geq}&                  \keyseq{>}\\
    \texcmd{hat}&                  \keyseq{\^}\\
    \texcmd{in}&                   \keyseq{i}\\
    \texcmd{inf}&                  \keyseq{\ctrlkey{\_}}\\
    \texcmd{infty}&                \keyseq{I}/\keyseq{8}\\
    \texcmd{int}&                  \key{\reskey{}ni}\\
    \texcmd{kappa}&                \keyseq{k}\\
    \texcmd{Lambda}&               \keyseq{L}\\
    \texcmd{lambda}&               \keyseq{l}\\
    \texcmd{langle}&               \keyseq{(}\\
    \texcmd{leftarrow}&            \keyseq{\ctrlkey{B}}/\key{\reskey\textleftarrow}\\
    \texcmd{leq}&                  \keyseq{<}\\
    \texcmd{lim}&                  \keyseq{\ctrlkey{L}}\\
    \texcmd{log}&                  \key{\reskey{}nl}\\
    \texcmd{mu}&                   \keyseq{m}\\
    \texcmd{nabla}&                \keyseq{N}\\
    \texcmd{ne}&                   \keyseq{=}\\
    \texcmd{neg}&                  \keyseq{!}\\
    \texcmd{nicefrac}&             \key{\reskey{}nF}\\
    \texcmd{not}&                  \keyseq{/}\\
    \texcmd{nu}&                   \keyseq{n}\\
    \texcmd{oint}&                 \key{\reskey{}no}\\
    \texcmd{Omega}&                \keyseq{O}/\keyseq{W}\\
    \texcmd{omega}&                \keyseq{o}/\keyseq{w}\\
    \texcmd{Phi}&                  \keyseq{V}/\keyseq{F}\\
    \texcmd{phi}&                  \keyseq{f}\\
    \texcmd{Pi}&                   \keyseq{P}\\
    \texcmd{pi}&                   \keyseq{p}\\
    \texcmd{pmod}&                 \key{\reskey{}nm}\\
    \texcmd{prod}&                 \key{\reskey{}np}
  \end{tabular}%
  \begin{tabular}[t]{lc}
    \TeX{} cmd.& key\\
    \hline
    \texcmd{Psi}&                  \keyseq{Y}\\
    \texcmd{psi}&                  \keyseq{y}\\
    \texcmd{rangle}&               \keyseq{)}\\
    \texcmd{rho}&                  \keyseq{r}\\
    \texcmd{rightarrow}&           \keyseq{\ctrlkey{F}}/\key{\reskey\textrightarrow}\\
    \texcmd{setminus}&             \keyseq{\textbackslash{}}\\
    \texcmd{Sigma}&                \keyseq{S}\\
    \texcmd{sigma}&                \keyseq{s}\\
    \texcmd{sin}&                  \keyseq{\ctrlkey{S}}\\
    \texcmd{sqrt}&                 \key{\reskey{}nq}\\
    \texcmd{subset}&               \keyseq{\{}\\
    \texcmd{subseteq}&             \keyseq{[}\\
    \texcmd{sum}&                  \key{\reskey{}ns}\\
    \texcmd{sup}&                  \keyseq{\ctrlkey{\^}}\\
    \texcmd{supset}&               \keyseq{\}}\\
    \texcmd{supseteq}&             \keyseq{]}\\
    \texcmd{tan}&                  \keyseq{\ctrlkey{T}}\\
    \texcmd{tau}&                  \keyseq{t}\\
    \texcmd{Theta}&                \keyseq{Q}\\
    \texcmd{theta}&                \keyseq{q}\\
    \texcmd{tilde}&                \keyseq{\~}\\
    \texcmd{times}&                \keyseq{*}\\
    \texcmd{uparrow}&              \keyseq{\ctrlkey{P}}/\key{\reskey\textuparrow}\\
    \texcmd{Upsilon}&              \keyseq{U}\\
    \texcmd{upsilon}&              \keyseq{u}\\
    \texcmd{vee}&                  \keyseq{|}/\keyseq{v}\\
    \texcmd{wedge}&                \keyseq{\&}\\
    \texcmd{Xi}&                   \keyseq{X}\\
    \texcmd{xi}&                   \keyseq{x}\\
    \texcmd{zeta}&                 \keyseq{z}
  \end{tabular}
\end{center}

\renewcommand*{\subseckey}{l}
\subsection{links---\keyseq{}}

% definekey_reserved("latex->label_insert_at_mark", "lm", MODE);
% definekey_reserved("latex->label_ref", "lr", MODE);

\begin{center}
  \begin{tabular}{lc}
    \TeX{} cmd.& key\\
    \hline
    \texcmd{cite}& \keyseq{b}\\
    \texcmd{index}& \key{\reskey{}ii}\\
    \texcmd{label}& \keyseq{l}\\
    \texcmd{nocite}& \keyseq{n}\\
    \texcmd{pageref}& \keyseq{p}\\
    \texcmd{url}& \keyseq{u}
  \end{tabular}
\end{center}

\renewcommand*{\subseckey}{o}
\subsection{folding---\keyseq{} and \key{return}}

\begin{itemize}
 \item With the keysequence \keyseq{o} you can fold a region. You can use
  \key{\metakey1}, \ldots{}, \key{\metakey8} to set the level relative from
  the current that gets folded. With \key{\metakey9} you get a prompt where
  you can enter an arbitrary level, e.\,g. -2 to fold the level 2nd levels
  upstairs.

 \item With the keysequence \keyseq{u} you can unfold a folded region. You
  can use it from within the region or at the begin (before the three dots).

  With a prefix argument (set with \key{\metakey1}, \ldots{},
  \key{\metakey9}) you can set the sublevel that should not be unfolded.

 \item The \key{return} key is redefined to unfold a region, if it is inside
  or before---looking at the three dots---a folded region. Otherwise it acts
  like everywhere else.
\end{itemize}

For the definition of levels see \autoref{cha:folding}.

\section{Mathematical arrows}

If you “draw” an arrow it becomes substitured with an corresponding math
command. The command is inserted with \func{cmd\_insert} (\autoref{sec:cmds})
so you have all comforts of \func{cmd\_insert}.

\begin{center}
  \begin{tabular}{lc||lc}
    Input& Substitution& Input& Substitution\\
    \hline
    \key{->}& \texcmd{rightarrow}& \key{-{}->}& \texcmd{longrightarrow}\\
    \key{<-}& \texcmd{leftarrow}$^{*}$& \key{<-{}-}& \texcmd{longleftarrow}$^{*}$\\
    \key{<->}& \texcmd{leftrightarrow}& \key{<-{}->}& \texcmd{longleftrightarrow}\\
    \key{=>}& \texcmd{Rightarrow}& \key{==>}& \texcmd{Longrightarrow}\\
    \key{<=}& \texcmd{Leftarrow}$^{*}$& \key{<==}& \texcmd{Longleftarrow}$^{*}$\\
    \key{<=>}& \texcmd{Leftrightarrow}& \key{<==>}& \texcmd{Longleftrightarrow}\\
    \key{|->}& \texcmd{mapsto}& \key{|-{}->}& \texcmd{longmapsto}\\
    \key{>>}& \texcmd{gg}& \key{<<}& \texcmd{ll}\\
    \key{`->}& \texcmd{hookrightarrow}& &
  \end{tabular}
\end{center}

Some of the input sequences---marked with $*$ in the table---become not
substitured immediately, because it's unclear if anything, e.g. a second
\key{-} or \key{>}, follows. They are substitured after the next key press.
So don't be confused and write on as if the substitution happend.

Sometimes these substitutions aren't intented. The character that actives the
substitution is not alway the last character. The emacs mode of Jed offers two
possibilities to work around this substition: \ctrlkey{Q} to insert one
character without showing it to the substition function and \key{\ctrlkey{X}q}
to insert a string.

\section{Mathematical sub- and superscripts}

The keys \key{\_} and \key{\^} are automaticly surround the word (all
alphanumeric characters and a possible \texcmd{} at the begin) before the
editing point with \$, if it is not still in math mode. If the word is a
\TeX{} command it is tried to find a completion from former usages of the
command. This is very helpful when you write equations with
\begin{center}
  \texstring{\texcmd{sum}\_\{foo\}\^{}\{bar\} 12+2 =
    \texcmd{sum}\_\{foo\}\^{}\{bar\} 10+4}
\end{center}
If you don't want the completion type in what you want. If you accept the
completion than hit \key{Enter} or \key{Return}. If there is also a completion
for the counterpar, it is also presented and you can accept it with
\key{Enter} or \key{Return} or you type what you want. The visible mark shows
you which part is offered and becomes removed if you don't accept.

If you started in text mode, the editing point is placed after accepted
completion in text mode. This is helpful when you write things like
\begin{center}
  \texstring{First, we look at \$\texcmd{alpha}\_\{i\}\$. The formula becomes\\
    the truth true, iff \$\texcmd{alpha}\_\{i\}\$ is even.}
\end{center}
Than you don't have to skip the dollar sign after the subscript was completed.

The sub- and superscript function treats some \TeX{} commands specially. An
sub- or superscript for an \texcmd{rightarrow} changes the command to
\texcmd{xrightarrow} from \AMS{}math. The commands \texcmd{cup}, \texcmd{cap},
\texcmd{vee} and \texcmd{wedge} become \texcmd{bigcup}, \texcmd{bigcap},
\texcmd{bigvee} and \texcmd{bigwedge}, respectively.

\end{document}

% breaks - ^CK
definekey_reserved("latex->cmd_insert(\"newline\");newline()", "kl", MODE);
definekey_reserved("latex->cmd_insert(\"newline\");newline()", "^K^L", MODE);
definekey_reserved("latex->cmd_insert(\"linebreak[1]\");newline()", "kb", MODE);
definekey_reserved("latex->cmd_insert(\"linebreak[1]\");newline()", "^K^B", MODE);
definekey_reserved("latex->cmd_insert(\"newpage\");newline()", "kp", MODE);
definekey_reserved("latex->cmd_insert(\"newpage\");newline()", "^K^P", MODE);
definekey_reserved("latex->cmd_insert(\"clearpage\");newline()", "kc", MODE);
definekey_reserved("latex->cmd_insert(\"clearpage\");newline()", "^K^C", MODE);
definekey_reserved("latex->cmd_insert(\"cleardoublepage\");newline()", "kd", MODE);
definekey_reserved("latex->cmd_insert(\"cleardoublepage\");newline()", "^K^D", MODE);
definekey_reserved("latex->cmd_insert(\"pagebreak\");newline()", "kr", MODE);
definekey_reserved("latex->cmd_insert(\"pagebreak\");newline()", "^K^R", MODE);
definekey_reserved("latex->cmd_insert(\"nolinebreak[1]\");newline()", "kn", MODE);
definekey_reserved("latex->cmd_insert(\"nolinebreak[1]\");newline()", "^K^N", MODE);
definekey_reserved("latex->cmd_insert(\"nopagebreak\");newline()", "ko", MODE);
definekey_reserved("latex->cmd_insert(\"nopagebreak\");newline()", "^K^O", MODE);
definekey_reserved("latex->cmd_insert(\"enlargethispage\")", "ke", MODE);
definekey_reserved("latex->cmd_insert(\"enlargethispage\")", "^K^E", MODE);

% misc
definekey("latex->insert_quote", "\"", MODE);
definekey("latex->insert_quote", "`",  MODE);
definekey("latex->insert_dollar", "$",  MODE);
definekey("latex->dots", ".",  MODE);

foreach $1 ([" ", ",", "~"])
  definekey_textormath("latex->insert_without_spaces", "self_insert_cmd",
                       $1, MODE);

definekey_textormath("self_insert_cmd", "latex->cmd_insert(\"colon\")",
                     ":", MODE);
definekey_textormath("self_insert_cmd", "latex->math_right_parenthesis",
                     ")", MODE);
definekey_textormath("self_insert_cmd", "latex->math_right_parenthesis",
                     "]", MODE);
definekey("latex->insert_limits_char()", "^", MODE);
definekey("latex->insert_limits_char()", "_", MODE);
definekey("latex->newline_with_completion", Key_Shift_Return, MODE);
definekey_reserved("latex->newline_with_completion", Key_Return, MODE);

% special characters
definekey_reserved(" \\$", "$", MODE);
definekey_reserved(" \\&", "&", MODE);
definekey_reserved(" \\%", "%", MODE);
definekey_reserved(" \\_", "_", MODE);
definekey_reserved(" \\#", "#", MODE);
definekey_reserved(" \\{", "(", MODE);
definekey_reserved(" \\}", ")", MODE);
definekey_reserved(" \\textless{}", "<", MODE);
definekey_reserved(" \\textgreater{}", ">", MODE);
definekey_reserved(" \\textbackslash{}", "\\", MODE);
definekey_reserved(" \\textbar{}", "|", MODE);
definekey_reserved(" \\textasciicircum{}", "^", MODE);
definekey_reserved(" \\textasciitilde{}", "~", MODE);

% stuff from latex_external - ^C r
definekey_reserved("latex_external->select_master_file",    "ra", MODE);
definekey_reserved("latex_external->bibtex",                "rb", MODE);
definekey_reserved("latex_external->clearup",               "rc", MODE);
definekey_reserved("latex_external->makeindex",             "ri", MODE);
definekey_reserved("latex_external->mrproper",              "rm", MODE);
definekey_reserved("latex_external->cust_view",             "ro", MODE);

% often used stuff from latex_external
definekey_reserved("latex_external->compose",               "c", MODE);
definekey_reserved("latex_external->compose",               "^C", MODE);
definekey_reserved("latex_external->view",                  "v", MODE);
definekey_reserved("latex_external->view",                  "^V", MODE);
definekey_reserved("latex_external->pop_log_file",          "y", MODE);
definekey_reserved("latex_external->pop_log_file",          "^y", MODE);

% help
definekey_reserved("latex->texdoc_help()",                  "ht", MODE);
definekey_reserved("latex->texdoc_search()",                "hT", MODE);
definekey_reserved("latex->texdoc_search()",                "^h^T", MODE);
definekey_reserved("()=system(\"texdoc symbols-a4 &\")",    "hs", MODE);
definekey_reserved("()=system(\"texdoc symbols-a4 &\")",    "^h^S", MODE);

definekey_reserved("latex->indent_region",                  "q", MODE);

\end{document}