Debian Codegraph @

texmf-dist/tex/latex/lineno/ednmath0.sty

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