Annotation of ttbar/p20_taujets_note/ednmath0.sty, revision 1.1.1.1
1.1 uid12904 1: %% Macro package `ednmath0.sty' for LaTeX2e,
2: %% copyright (C) 2004 Uwe L\"uck,
3: %% http://www.contact-ednotes.sty.de.vu
4: %% --author-maintained;
5: %% math support for `lineno.sty' and `ednotes.sty'.
6: %%
7: \def\fileversion{v0.2b} \def\filedate{2005/01/10}
8: %% This program can be redistributed and/or modified under the
9: %% terms of the LaTeX Project Public License distributed from
10: %% CTAN archives in directory macros/latex/base/lppl.txt; either
11: %% version 1.3a of the License, or any later version.
12: %% The latest version of this license is in
13: %% http://www.latex-project.org/lppl.txt
14: %% There is NO WARRANTY.
15: %% This code is very EXPERIMENTAL!
16: %%
17: %% Please report bugs, problems, and suggestions via
18: %%
19: %% http://www.contact-ednotes.sty@web.de
20: %
21: %% * MAIN FEATURE *
22: %
23: % lineno.sty's \linelabel and ednotes.sty's commands are enabled
24: % to work in math mode if it's "entered in outer mode"
25: % (including `displaymath' and `equation' environments).
26: % (lineno.sty is the package by Stephan Boettcher.)
27: % They will even work in tabular environments that are adjusted
28: % to notes by package `edtable.sty'.
29: %
30: % CAVEATS:
31: % -- Does not work yet in environments like LaTeX's
32: % `eqnarray'. (This could probably repaired along the lines
33: % of Edtable.sty--we're short of time and will try later.)
34: % -- Useful error messages when (i) math mode is entered from
35: % inner mode or when (ii) a math display gets not line number
36: % are missing at present.
37: %
38: %% * USAGE: *
39: %
40: % * Most simple: *
41: % --If you are working with ednotes and want to use its
42: % commands in math mode, load ednotes.sty--version 0.8
43: % onwards--with its package option `mathnotes'.
44: % --If you don't work with ednotes, only with lineno, you
45: % get the main feature of making \linelabel work in math mode
46: % by loading lineno.sty--version 4.1 onwards--with its
47: % package option `mathrefs'.
48: %
49: % * Switch off and on: *
50: % To reduce danger resulting from missing error messages
51: % ("caveat" above), you may switch these new math facilities
52: % off by \NoNotesToMath where you don't expect to need them.
53: % You may switch them on again by \NotesToMath where you want
54: % to use them, being aware of the danger. Both commands work
55: % locally, so you can replace one of them by enclosing it in
56: % a group. E.g., even, after \NoNotesToMath you can use an
57: % environment as follows:
58: % \begin{NotesToMath}
59: % <text>
60: % \end{NotesToMath}
61: % (I am not quite sure that this is useful.)
62: %
63: % * Customize ellipsis: *
64: % ednotes' \lemmaellipsis is changed to expand to
65: % \mathlemmaellipsis when entering math, and this is preset
66: % to be LaTeX's \mathellipsis. (This is three dots as
67: % \mathinner.) You can change this by redefining
68: % \mathlemmaellipsis, e.g.:
69: % \renewcommand{\mathlemmaellipsis}{\cdots}
70: % If you need \cdots as the ellipsis at a single place only,
71: % you may, of course, use the `<...>' option of \<, e.g.:
72: % $ x = \Anote{a\<<\cdots>bcd\>e}{Indeed?} - y $
73: %
74: % * Customize note mode: *
75: % For variant readings, you may want that the note is
76: % usually set in math mode--so you may want that you
77: % needn't type the dollar signs in the note text.
78: % Note that you can do this by customizing \notefmt,
79: % and you can do this by customizing \Anotefmt (e.g.)
80: % to have this feature for \Anote only.
81: %
82:
83: \NeedsTeXFormat{LaTeX2e}
84: \ProvidesPackage{ednmath0}[\filedate\space\fileversion\space
85: math support for lineno/ednotes (ul)]
86: %
87: %% User commands:
88: \def\NotesToMath{\let\@LN@mathhook\@LN@labelinmath
89: \@bsphack \@esphack
90: % For \begin{NotesToMath}
91: }
92: \def\NoNotesToMath{\@bsphack
93: \def\@LN@mathhook{\@parmoderr\@gobble}%
94: \@esphack
95: }
96: \def\endNotesToMath{\@bsphack\@Esphack}
97: \let\endNoNotesToMath\endNotesToMath
98: %
99: %% Core code for lineno.sty:
100: \@ifundefined{@LN@postlabel}{%
101: \PackageError{ednmath0}{%
102: Bad lineno.sty version%
103: }{%
104: lineno.sty from 2004/08/16 or later
105: must be loaded earlier.%
106: }%
107: }{%
108: \def\@LN@labelinmath#1{%
109: \ifmmode
110: \@LN@postlabel{#1}%
111: \else
112: \@parmoderr
113: \fi
114: }
115: }
116: %
117: %% Core code for ednotes.sty:
118: \@ifundefined{@EN@note}{%
119: % v0.01 sent a warning in this case. Considered superfluous now.
120: }{%
121: \def\@EN@themathlemmatag{%
122: \ifmmode
123: \toks@\expandafter{\@EN@lemmatag}%
124: \edef\@EN@lemmatag{%
125: $%
126: \def\noexpand\lemmaellipsis{%
127: \noexpand\mathlemmaellipsis}%
128: \the\toks@
129: $%
130: }%
131: % \expandafter \def \expandafter \@EN@lemmatag
132: % \expandafter {\expandafter $\expandafter
133: % \def \expandafter \lemmaellipsis \expandafter {%
134: % \expandafter \mathlemmaellipsis \expandafter }%
135: % \@EN@lemmatag $}%
136: \fi
137: }
138: % To be sure, \lemmaellipsis doesn't need to be changed when
139: % ednotes `\<...\>' feature is not used. Though I prefer to
140: % use one hook only in ednotes for both situations, with and
141: % without `\<...\>'.
142: %
143: % The final \unskip in ednotes' \@EN@lemmatag would undo a final
144: % \quad. That's OK: outside math the same happens.
145: % In v0.01, \NoNotesToMath undid ednotes changes for math mode.
146: % However, re-appearence of \linelabel error messages suffices.
147: %
148: % Now add lemma switch to the left of \[No]NotesToMath:
149: \toks@\expandafter{\NotesToMath}
150: \edef\NotesToMath{%
151: \let \noexpand\@EN@mathlemmatag \noexpand\@EN@themathlemmatag
152: \the\toks@
153: }
154: % \typeout{\string\NotesToMath: \meaning\NotesToMath}
155: \toks@\expandafter{\NoNotesToMath}
156: \edef\NoNotesToMath{%
157: \let \noexpand\@EN@mathlemmatag \relax
158: \the\toks@
159: }
160: % \typeout{\string\NoNotesToMath: \meaning\NoNotesToMath}
161: }
162: % We need no extra device for a choice for users whether the *note*
163: % should be set in math mode or in horizontal mode by default
164: % (which might depend on the kind ["layer"] of notes).
165: % This can be done already by customization of ednotes' \notefmt.
166: % However, we might change ednotes' default \notefmt to default
167: % \renewcommand*{\notefmt}[1]{$#1$}
168: %
169: \let\mathlemmaellipsis\mathellipsis
170: %% TODO: Since when has LaTeX provided \mathellipsis?
171: %% -> \Needs...
172: %
173: % Default:
174: \NotesToMath
175: %
176: \endinput
177:
178: %% TODO: Without \linenumberdisplaymath, in displaymath,
179: %% an error should be shown. Use, e.g., that in a displaymath
180: %% \ifinner is false.
181: %% TODO: E.g., by changing \everymath, perhaps can be warned
182: %% that the math group is in a box already, so the vertical
183: %% items will get lost.
184: %% TODO: Adjust `eqnarray' (in Edtable?) as well.
185:
186: %% VERSION HISTORY:
187: v0.01 2004/08/16 First version, sent to Christian.
188: v0.02 2004/08/16 Considerably simplified for ednotes.
189: 2004/08/19 Added ellipsis stuff, documentation, and
190: instructions. Uncapitalized package names.
191: Added \end[No]NotesToMath.
192: 2004/08/20 Added \@bsphack and \@esphack; corrected
193: ednotes extension (too much deleted, completely
194: wrong), introducing \@EN@themathlemmatag.
195: v0.02b .../08/31 Rearranged preamble concerning maintenance.
196: v0.1 2004/09/20 Removed mentions of `linenox0.sty'.
197: v0.2 2004/10/07 Removed another mention of `linenox0.sty';
198: Instructions: `lineno' or `ednotes.sty' option.
199: v0.2a 2004/11/07 LPPL v1.3a.
200: v0.2b 2005/01/10 Contact via http.
201:
202:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>