~ubuntu-branches/debian/sid/tex4ht/sid

« back to all changes in this revision

Viewing changes to src/tex4ht-mathplayer.tex

  • Committer: Bazaar Package Importer
  • Author(s): Kapil Hari Paranjape
  • Date: 2005-04-05 14:14:41 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050405141441-x4dojdgz3frkfyet
Tags: 20050402.1817-1
* New upstream release (2005-04-02-18:17). Closes: #299934.
* See README.src, README.validate, README.Debian and copyright
  for information on minor changes.
* This upload fixes a some .htf files. Closes: #295109.
* Updated the description to reflect recent changes.
* Fixed some typos in src/tex4ht-mkht.tex and consequently
  in the mk4ht script.
* Updated the man page to include mk4ht. 
* Updated the description of options for the scripts in the man page.
  Put more information in the man page about the way the system works.
  Closes: #219348, #219347.
* Added debian/watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
% compile 3 timws: latex tex4ht-mathplayer
 
2
%            or   xhlatex tex4ht-mathplayer "html,3,sections+"
 
3
%
 
4
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
5
% tex4ht-mathplayer.tex                                  %
 
6
% Copyright (C) 2002--            Eitan M. Gurari        %
 
7
%                                                        %
 
8
% This work may be distributed and/or modified under the %
 
9
% conditions of the LaTeX Project Public License, either %
 
10
% version 1.3 of this license or (at your option) any    %
 
11
% later version. The latest version of this license is   %
 
12
% in                                                     %
 
13
%   http://www.latex-project.org/lppl.txt                %
 
14
% and version 1.3 or later is part of all distributions  %
 
15
% of LaTeX version 2003/12/01 or later.                  %
 
16
%                                                        %
 
17
% This work has the LPPL maintenance status "maintained".%
 
18
%                                                        %
 
19
% This Current Maintainer of this work                   %
 
20
% is Eitan M. Gurari.                                    %
 
21
%                                                        %
 
22
% If you modify this file your changing the signature    %
 
23
% in \message{(signature)} below will be appreciated.    %
 
24
%                                                        %
 
25
%                             gurari@cse.ohio-state.edu  %
 
26
%                 http://www.cse.ohio-state.edu/~gurari  %
 
27
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 
28
\message{(<signature>)}
 
29
 
 
30
%%%%%%%%%%%%%%%%%% load style files %%%%%%%%%%%%%%%%%%%%%%%%%%
 
31
 
 
32
\ifx \HTML\UnDef
 
33
   \def\HTML{mathplayer}                   
 
34
   \def\CONFIG{\jobname}
 
35
   \def\MAKETITLE{\author{Eitan M. Gurari}}         
 
36
   \def\next{\input mktex4ht.4ht  \endinput}
 
37
   \expandafter\next
 
38
\fi
 
39
 
 
40
%%%%%%%%%%%%%%%%%%%%% definitions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
41
 
 
42
\newcount\tmpcnt  \tmpcnt\time  \divide\tmpcnt  60
 
43
\edef\temp{\the\tmpcnt}
 
44
\multiply\tmpcnt  -60 \advance\tmpcnt  \time
 
45
 
 
46
\edef\version{\the\year-\ifnum \month<10 0\fi
 
47
  \the\month-\ifnum \day<10 0\fi\the\day
 
48
   -\ifnum \temp<10 0\fi \temp
 
49
   :\ifnum \tmpcnt<10 0\fi\the\tmpcnt}
 
50
 
 
51
\def\CopyYear.#1.{%
 
52
   \ifnum #1=\year #1\space\space\space\space\space\space
 
53
    \else          #1--\the\year\fi
 
54
}
 
55
 
 
56
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
57
\chapter{Preamble}
 
58
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
59
 
 
60
\<mathplayer\><<<
 
61
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
 
62
% mathplayer.4ht                        |version %
 
63
% Copyright (C) |CopyYear.2002.       Eitan M. Gurari         %
 
64
|<TeX4ht copyright|>
 
65
>>>
 
66
 
 
67
 
 
68
 
 
69
\<TeX4ht copyright\><<<
 
70
%                                                        %
 
71
% This work may be distributed and/or modified under the %
 
72
% conditions of the LaTeX Project Public License, either %
 
73
% version 1.3 of this license or (at your option) any    %
 
74
% later version. The latest version of this license is   %
 
75
% in                                                     %
 
76
%   http://www.latex-project.org/lppl.txt                %
 
77
% and version 1.3 or later is part of all distributions  %
 
78
% of LaTeX version 2003/12/01 or later.                  %
 
79
%                                                        %
 
80
% This work has the LPPL maintenance status "maintained".%
 
81
%                                                        %
 
82
% This Current Maintainer of this work                   %
 
83
% is Eitan M. Gurari.                                    %
 
84
%                                                        %
 
85
% If you modify this program your changing its signature %
 
86
% with a directive of the following form will be         %
 
87
% appreciated.                                           %
 
88
%            \message{signature}                         %
 
89
%                                                        %
 
90
%                             gurari@cse.ohio-state.edu  %
 
91
%                 http://www.cse.ohio-state.edu/~gurari  %
 
92
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
93
\immediate\write-1{version |version}
 
94
>>>
 
95
 
 
96
 
 
97
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
98
\chapter{Start Here}
 
99
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
100
 
 
101
%%%%%%%%%%%%%%%%%
 
102
\section{Header}
 
103
%%%%%%%%%%%%%%%%
 
104
 
 
105
\<configure mathplayer Preamble\><<<
 
106
\:CheckOption{xht} \if:Option 
 
107
  \Configure{html}{xht}
 
108
\else \:CheckOption{xml} \if:Option 
 
109
  \Configure{html}{xml}
 
110
\else
 
111
  \Configure{html}{html}
 
112
  \Configure{mathml}{m:}
 
113
\fi \fi
 
114
>>>
 
115
 
 
116
 
 
117
\<dtd lang\><<<
 
118
\expandafter
 
119
\ifx \csname a:dtd-lang\endcsname\relax EN\else
 
120
  \csname a:dtd-lang\endcsname
 
121
\fi
 
122
>>>
 
123
 
 
124
\<configure mathplayer tex4ht\><<<
 
125
\Configure{VERSION}{}
 
126
\:CheckOption{xht} \if:Option
 
127
   |<DOCTYPE and namespaces for xml and xht|>
 
128
\else \:CheckOption{xml} \if:Option
 
129
   |<DOCTYPE and namespaces for xml and xht|>
 
130
\else 
 
131
   \Configure{DOCTYPE}
 
132
    {\HCode{<!DOCTYPE html PUBLIC
 
133
                "-//W3C//DTD XHTML 1.1 plus MathML 2.0//|<dtd lang|>"\Hnewline
 
134
%                "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"\Hnewline
 
135
                "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd"\Hnewline
 
136
                >\Hnewline }}
 
137
   \Configure{@HTML}
 
138
     {xmlns:m="http://www.w3.org/1998/Math/MathML"\Hnewline
 
139
      xmlns:dsi="http://www.dessci.com/mathml" \Hnewline}
 
140
   \Configure{@HEAD}
 
141
     {\HCode{
 
142
        <object id="MathPlayer" 
 
143
                classid="clsid:32F66A20-7614-11D4-BD11-00104BD3F987"
 
144
        ></object>\Hnewline
 
145
        <?import namespace="m" implementation="\#MathPlayer" ?>\Hnewline
 
146
        <!--http://www.dessci.com/webmath/mathplayer/-->\Hnewline
 
147
    }}
 
148
    \Configure{@BODY}
 
149
       {\HCode{<script language="javascript">\Hnewline<!--\Hnewline
 
150
               |<check for ie 5.5 and mathplayer|>\Hnewline-->\Hnewline
 
151
               </script>\Hnewline
 
152
       }}
 
153
    \Configure{math-xmlns}{}
 
154
\fi \fi
 
155
>>>
 
156
 
 
157
\<DOCTYPE and namespaces for xml and xht\><<<
 
158
   \Configure{DOCTYPE}
 
159
       {\HCode{<!DOCTYPE html PUBLIC
 
160
                "-//W3C//DTD XHTML 1.1 plus MathML 2.0//|<dtd lang|>"\Hnewline
 
161
                "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd"\Hnewline
 
162
%                "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"\Hnewline
 
163
%                [<!ENTITY mathml "http://www.w3.org/1998/Math/MathML">]\Hnewline
 
164
                >\Hnewline }}
 
165
    \Configure{@HTML}
 
166
        {xmlns:dsi="http://www.dessci.com/mathml" \Hnewline}
 
167
>>>
 
168
 
 
169
 
 
170
\<configure mathplayer tex4ht\><<<
 
171
\:CheckOption{xht} \if:Option
 
172
\else \:CheckOption{xml} \if:Option
 
173
\else
 
174
   \Configure{$}
 
175
      {\Configure{@math}{display="inline"}\DviMath}
 
176
      {\EndDviMath\HCode{<span></span>}}{}
 
177
\fi\fi
 
178
>>>
 
179
 
 
180
Without the extra span mathplayer overlaps the table entries.
 
181
 
 
182
 
 
183
 
 
184
\<check for ie 5.5 and mathplayer\><<<
 
185
if(   navigator.appName=="Microsoft Internet Explorer"   \Hnewline
 
186
   && navigator.platform=="Win32"                        \Hnewline
 
187
   && parseFloat(navigator.appVersion.substr(            \Hnewline
 
188
                navigator.appVersion.indexOf("MSIE ")+5))>="5.5"  \Hnewline
 
189
){                                                       \Hnewline
 
190
  try {                                                  \Hnewline
 
191
    var oMP = new ActiveXObject("MathPlayer.Factory.1"); \Hnewline
 
192
  }                                                      \Hnewline
 
193
  catch(e) { alert("Can't find Design Science's MathPalyer" +  \Hnewline
 
194
        "(http://www.dessci.com/webmath/mathplayer)");}  \Hnewline
 
195
} else {                                                 \Hnewline
 
196
  alert("Requires MSIE version 5.5 or later");           \Hnewline
 
197
}                                                        \Hnewline
 
198
>>>
 
199
 
 
200
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
201
\section{Wrapping in Tables}
 
202
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
203
 
 
204
The attribute \verb+nowrap="nowrap"+ in table cells prevents
 
205
Mathplayer from displaying them its own way, and one gets minimal
 
206
cells, overlapped: it ought to be avoided altogether.
 
207
 
 
208
\<configure mathplayer tex4ht\><<<
 
209
\Configure{halignTD} {}{}
 
210
   {<}{\ifmathml \HCode{ columnalign="left"}\else
 
211
        \HCode{ align="left" }\fi}
 
212
   {-}{\ifmathml \HCode{ columnalign="center"}\else
 
213
        \HCode{ align="center" }\fi}
 
214
   {>}{\ifmathml \HCode{ columnalign="right"}\else
 
215
        \HCode{ align="right" }\fi}
 
216
   {^}{\ifmathml \HCode{ rowalign="top"}\else
 
217
        \HCode{ valign="top" }\fi}
 
218
   {=}{\ifmathml \HCode{ rowalign="baseline"}\else
 
219
        \HCode{ valign="baseline" }\fi}
 
220
   {||}{\ifmathml \HCode{ rowalign="center"}\else
 
221
        \HCode{ valign="middle" }\fi}
 
222
   {_}{\ifmathml \HCode{ rowalign="bottom"}\else
 
223
        \HCode{ valign="bottom" }\fi}
 
224
   {p}{\ifmathml \HCode{ columnalign="left"}\else
 
225
        \HCode{ align="left"}\fi}
 
226
   {}
 
227
>>>
 
228
 
 
229
 
 
230
 
 
231
 
 
232
 
 
233
 
 
234
 
 
235
%%%%%%%%%%%%%%%%%%%%%
 
236
\section{Cross References}
 
237
%%%%%%%%%%%%%%%%%%%%%
 
238
 
 
239
 
 
240
\<configure mathplayer tex4ht\><<<
 
241
\LinkCommand\mtxt:link{\a:mathml maction,%
 
242
   actiontype="link" dsi:href, id, 
 
243
   \a:mathml class="label"|<mtext ref decoration|>,,}
 
244
\LinkCommand\msp:link{\a:mathml maction,%
 
245
   actiontype="link" dsi:href, id,
 
246
   \a:mathml class="label"|<mstyle ref decoration|>,,}
 
247
\def\Link{\ifmathml
 
248
     \ifmtext |<end mtext|>\HCode{</\a:mathml mtext>}%
 
249
              \expandafter\expandafter\expandafter\mtxt:link
 
250
     \else    \expandafter\expandafter\expandafter\msp:link\fi
 
251
   \else \expandafter\M:Link\fi}
 
252
\def\EndLink{\ifmathml 
 
253
     \ifmtext    |<end mtext|>|<end mtext ref decoration|>%
 
254
       \Endmtxt:link \HCode{<\a:mathml mtext\Hnewline 
 
255
                   \a:mathml class="endlabel">}|<start mtext|>%
 
256
     \else  \HCode{|<end mstyle ref decoration|></\a:mathml
 
257
                               maction><!--endlabel-->}\fi
 
258
   \else \expandafter\M:EndLink\fi}
 
259
>>>
 
260
 
 
261
\<mtext ref decoration\><<<
 
262
><\a:mathml mtext  mathbackground="yellow"%
 
263
>>>
 
264
 
 
265
\<end mtext ref decoration\><<<
 
266
\HCode{</\a:mathml mtext>}%
 
267
>>>
 
268
 
 
269
\<mstyle ref decoration\><<<
 
270
><\a:mathml mstyle  mathbackground="yellow"%
 
271
>>>
 
272
 
 
273
\<end mstyle ref decoration\><<<
 
274
</\a:mathml mstyle>%
 
275
>>>
 
276
 
 
277
 
 
278
\begin{verbatim}
 
279
 JUST BACKGROUND (one could add colour, and it would be fine to include the
 
280
 labels, if any)
 
281
 <m:mstyle \a:mathml mathbackground="yellow"> <m:maction
 
282
  actiontype="link" dsi:href="#x1-2r1"  class="label"><m:mrow
 
283
 ><m:mn>1</m:mn><!--tex4ht:ref: equ1 --></m:mrow></m:maction></m:mstyle >
 
284
 
 
285
 HIGHLIGHT ON MOUSEOVER
 
286
 <m:maction
 
287
  actiontype="highlight" dsi:color="pink" ><m:maction
 
288
  actiontype="link" dsi:href="#x1-2r1"  class="label"><m:mtext
 
289
 background="yellow" >1<!--tex4ht:ref:
 
290
 equ1 --></m:mtext></m:maction></m:maction>
 
291
 
 
292
 TOOLTIP CLUE ON MOUSEOVER
 
293
 <m:mrow>
 
294
 <m:maction actiontype="tooltip" ><m:maction
 
295
  actiontype="link" dsi:href="#x1-2r1"  class="label"><m:mrow ><m:mn
 
296
 background="yellow" >1</m:mn></m:mrow></m:maction>
 
297
 <m:mtext>click to jump!</m:mtext>
 
298
 <!--tex4ht:ref: equ1 --></m:maction><!--endlabel--></m:mrow>
 
299
 
 
300
* <m:mtext m:mathbackground="yellow" > disables background colour in all
 
301
  the (math-)links - this one coming from a typo in mathplayer.4ht, inserting
 
302
  m: before mathbackground;
 
303
 
 
304
  m: also problematic on actiontype
 
305
\end{verbatim}
 
306
 
 
307
\<start mtext\><<<
 
308
\ht:special{t4ht@,&\#x00A0;}%
 
309
>>>
 
310
\<end mtext\><<<
 
311
\ht:special{t4ht@,}%
 
312
>>>
 
313
 
 
314
 
 
315
 
 
316
The area of the clickable links can be enlarged with a cpde similar to
 
317
the following one.
 
318
 
 
319
\begin{verbatim}
 
320
  \let\svLink=\Link
 
321
  \let\svEndLink=\EndLink
 
322
  \Odef\Link[#1]#2#3{%
 
323
     \svLink[#1]{#2}{#3}%
 
324
     \ifmathml\ifmtext\else \HCode{<m:mpadded width="4">}\fi\fi}
 
325
  \def\EndLink{%
 
326
     \ifmathml\ifmtext\else \HCode{</m:mpadded>}\fi\fi
 
327
     \svEndLink}
 
328
\end{verbatim}
 
329
 
 
330
 
 
331
%%%%%%%%%%%%%%%%%%
 
332
\section{Namespace Prefixes}
 
333
%%%%%%%%%%%%%%%%%%
 
334
 
 
335
\<configure mathplayer tex4ht\><<<
 
336
\:CheckOption{xht} \if:Option
 
337
\else \:CheckOption{xml} \if:Option
 
338
\else
 
339
\Configure{DviMath}
 
340
   {\a:DviMathML \mathmltrue
 
341
      \ifOption{mml-fonts}{}{|%\mml:htfsym|%\NoFonts}%
 
342
      \IgnoreRule \HCode{<!--l.
 
343
      \the\inputlineno-->}\HCode{<\a:mathml math\Hnewline}%
 
344
         |<disable a:mathml for math attr|>%
 
345
         \HCode{\csname a:math-xmlns\endcsname \Hnewline \a:@math>}%
 
346
      |<end disable a:mathml for math attr|>\a:math
 
347
      |<sv dvimath par|>\IgnorePar}
 
348
   {\Tg</\a:mathml math>\EndIgnoreRule
 
349
    \ifOption{mml-fonts}{}{|%\ext:htfsym|%\EndNoFonts}%
 
350
    \mathmlfalse \b:DviMathML |<recall dvimath par|>}
 
351
\fi\fi
 
352
>>>
 
353
 
 
354
 
 
355
\<recall dvimath par\><<<
 
356
\sv:ignore
 
357
>>>
 
358
 
 
359
\<sv dvimath par\><<<
 
360
\edef\sv:ignore{\if:nopar  
 
361
    \noexpand\IgnorePar\else \noexpand\ShowPar\fi}%
 
362
>>>
 
363
 
 
364
\<disable a:mathml for math attr\><<<
 
365
\let\sva:mathml=\a:mathml \let\a:mathml=\empty
 
366
>>>
 
367
 
 
368
\<end disable a:mathml for math attr\><<<
 
369
\let\a:mathml=\sva:mathml 
 
370
>>>
 
371
 
 
372
 
 
373
 
 
374
 
 
375
\endinput