summaryrefslogtreecommitdiff
path: root/support/TeX4ht/source/tex4ht-mathplayer.tex
blob: 2908440baf8dd3b13e210f53c66c8a2fd87a9605 (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
% $Id: tex4ht-mathplayer.tex 65 2010-11-17 19:16:45Z karl $
% compile 3 times: latex tex4ht-mathplayer
%            or   xhlatex tex4ht-mathplayer "html,3,sections+"
%
% Copyright (C) 2009-2010 TeX Users Group
% Copyright (C) 1997-2009 Eitan M. Gurari
% Released under LPPL 1.3c+.
% See tex4ht-cpright.tex for license text.

%%%%%%%%%%%%%%%%%% load style files %%%%%%%%%%%%%%%%%%%%%%%%%%

\ifx \HTML\UnDef
   \def\HTML{mathplayer}                   
   \def\CONFIG{\jobname}
   \def\MAKETITLE{\author{Eitan M. Gurari}}         
   \def\next{\input mktex4ht.4ht  \endinput}
   \expandafter\next
\fi

\input{common}
\input{tex4ht-cpright}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Preamble}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\<mathplayer\><<<
% mathplayer.4ht (|version), generated from |jobname.tex
% Copyright (C) 2009-2010 TeX Users Group
% Copyright (C) |CopyYear.2002. Eitan M. Gurari
|<TeX4ht copywrite|>
>>>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Start Here}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%
\section{Header}
%%%%%%%%%%%%%%%%

\<configure mathplayer Preamble\><<<
\edef\Preamble{\Preamble,xht}
\Configure{ext}{xht}
>>>

% \Configure{mathml}{m:}


\<dtd lang\><<<
\expandafter
\ifx \csname a:dtd-lang\endcsname\relax EN\else
  \csname a:dtd-lang\endcsname
\fi
>>>

\<configure mathplayer tex4ht\><<<
\Configure{DOCTYPE}
       {\HCode{<!DOCTYPE html PUBLIC
                "-//W3C//DTD XHTML 1.1 plus MathML 2.0//|<dtd lang|>"\Hnewline
                "http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd"\Hnewline
                 [\Hnewline
                     <!ENTITY \% MATHML.prefixed "INCLUDE">\Hnewline
                     <!ENTITY \% MATHML.prefix "m">\Hnewline
                 ]\Hnewline
                >\Hnewline }}
\Configure{@BODY}
   {\ifvmode \EndP\fi \IgnorePar\HCode{<script type="text/javascript">\Hnewline<!--\Hnewline
           |<check for ie 5.5 and mathplayer|>\Hnewline-->\Hnewline
           </script>\Hnewline
   }\par\ShowPar}
   \Configure{@HTML}
     {xmlns:m="http://www.w3.org/1998/Math/MathML"\Hnewline
%      xmlns:dsi="http://www.dessci.com/mathml" \Hnewline
     }
%\let\dsi:=\empty
>>>


application/xhtml+xml



\<check for ie 5.5 and mathplayer\><<<
if(   navigator.appName=="Microsoft Internet Explorer"   \Hnewline
   && navigator.platform=="Win32"                        \Hnewline
){                                                       \Hnewline
  if( parseFloat(navigator.appVersion.substr(            \Hnewline
       navigator.appVersion.indexOf("MSIE ")+5))>="5.5"  \Hnewline
  ){
    try {                                                  \Hnewline
      var oMP = new ActiveXObject("MathPlayer.Factory.1"); \Hnewline
    }                                                      \Hnewline
    catch(e) { alert("Can't find Design Science's MathPalyer" +  \Hnewline
          "(http://www.dessci.com/webmath/mathplayer)");} \Hnewline
  } else {                                                \Hnewline
    alert("Requires MSIE version 5.5 or later");          \Hnewline
} }                                                       \Hnewline
>>>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Wrapping in Tables}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The attribute \verb+nowrap="nowrap"+ in table cells prevents
Mathplayer from displaying them its own way, and one gets minimal
cells, overlapped: it ought to be avoided altogether.

\<configure mathplayer tex4ht\><<<
\Configure{halignTD} {}{}
   {<}{\ifmathml \HCode{ columnalign="left"}\else
        \HCode{ style="text-align:left" }\fi}
   {-}{\ifmathml \HCode{ columnalign="center"}\else
        \HCode{ style="text-align:center" }\fi}
   {>}{\ifmathml \HCode{ columnalign="right"}\else
        \HCode{ style="text-align:right" }\fi}
   {^}{\ifmathml \HCode{ rowalign="top"}\else
        \HCode{ style="vertical-align:top" }\fi}
   {=}{\ifmathml \HCode{ rowalign="baseline"}\else
        \HCode{ style="vertical-align:baseline" }\fi}
   {||}{\ifmathml \HCode{ rowalign="center"}\else
        \HCode{ style="vertical-align:middle" }\fi}
   {_}{\ifmathml \HCode{ rowalign="bottom"}\else
        \HCode{ style="vertical-align:bottom" }\fi}
   {p}{\ifmathml \HCode{ columnalign="left"}\else
        \HCode{ style="text-align:left"}\fi}
   {}
>>>







% %%%%%%%%%%%%%%%%%%%%%
% \section{Cross References}
% %%%%%%%%%%%%%%%%%%%%%

% 

% 

% \<configure mathplayer tex4htNO\><<<
% \LinkCommand\mtxt:link{\a:mathml maction,%
%    actiontype="link" \dsi: href, id, 
%    class="label"|<mtext ref decoration|>,,}
% \LinkCommand\msp:link{\a:mathml maction,%
%    actiontype="link" \dsi: href, id,
%    class="label"|<mstyle ref decoration|>,,}
% \def\Link{\ifmathml
%      \ifmtext |<end mtext|>\HCode{</\a:mathml mtext>}%
%               \expandafter\expandafter\expandafter\mtxt:link
%      \else    \expandafter\expandafter\expandafter\msp:link\fi
%    \else \expandafter\M:Link\fi}
% \def\EndLink{\ifmathml 
%      \ifmtext    |<end mtext|>|<end mtext ref decoration|>%
%        \Endmtxt:link \HCode{<\a:mathml mtext\Hnewline 
%                    class="endlabel">}|<start mtext|>%
%      \else  \HCode{|<end mstyle ref decoration|></\a:mathml
%                                maction><!--endlabel-->}\fi
%    \else \expandafter\M:EndLink\fi}
% >>>

% 

% 

% 

% 

% 

% 
% \<mtext ref decorationNO\><<<
% ><\a:mathml mtext  mathbackground="yellow"%
% >>>

% \<end mtext ref decorationNO\><<<
% \HCode{</\a:mathml mtext>}%
% >>>

% \<mstyle ref decorationNO\><<<
% ><\a:mathml mstyle  mathbackground="yellow"%
% >>>

% \<end mstyle ref decorationNO\><<<
% </\a:mathml mstyle>%
% >>>

% 
% \begin{verbatim}
%  JUST BACKGROUND (one could add colour, and it would be fine to include the
%  labels, if any)
%  <m:mstyle \a:mathml mathbackground="yellow"> <m:maction
%   actiontype="link" \dsi: href="#x1-2r1"  class="label"><m:mrow
%  ><m:mn>1</m:mn><!--tex4ht:ref: equ1 --></m:mrow></m:maction></m:mstyle >

%  HIGHLIGHT ON MOUSEOVER
%  <m:maction
%   actiontype="highlight" \dsi: color="pink" ><m:maction
%   actiontype="link" \dsi: href="#x1-2r1"  class="label"><m:mtext
%  background="yellow" >1<!--tex4ht:ref:
%  equ1 --></m:mtext></m:maction></m:maction>

%  TOOLTIP CLUE ON MOUSEOVER
%  <m:mrow>
%  <m:maction actiontype="tooltip" ><m:maction
%   actiontype="link" \dsi: href="#x1-2r1"  class="label"><m:mrow ><m:mn
%  background="yellow" >1</m:mn></m:mrow></m:maction>
%  <m:mtext>click to jump!</m:mtext>
%  <!--tex4ht:ref: equ1 --></m:maction><!--endlabel--></m:mrow>

% * <m:mtext m:mathbackground="yellow" > disables background colour in all
%   the (math-)links - this one coming from a typo in mathplayer.4ht, inserting
%   m: before mathbackground;

%   m: also problematic on actiontype
% \end{verbatim}

% \<start mtext\><<<
% \ht:special{t4ht@,&\#x00A0;}%
% >>>
% \<end mtext\><<<
% \ht:special{t4ht@,}%
% >>>

% 

% The area of the clickable links can be enlarged with a cpde similar to
% the following one.

% \begin{verbatim}
%   \let\svLink=\Link
%   \let\svEndLink=\EndLink
%   \Odef\Link[#1]#2#3{%
%      \svLink[#1]{#2}{#3}%
%      \ifmathml\ifmtext\else \HCode{<m:mpadded width="4">}\fi\fi}
%   \def\EndLink{%
%      \ifmathml\ifmtext\else \HCode{</m:mpadded>}\fi\fi
%      \svEndLink}
% \end{verbatim}


%%%%%%%%%%%%%%%%%%
\section{Namespace Prefixes}
%%%%%%%%%%%%%%%%%%

\<configure mathplayer tex4ht\><<<
\:CheckOption{xht} \if:Option
\else \:CheckOption{xml} \if:Option
\else
\Configure{DviMath}
   {\a:DviMathML \mathmltrue
      \ifOption{mml-fonts}{}{|%\mml:htfsym|%\NoFonts}%
      \IgnoreRule \HCode{<!--l.
      \the\inputlineno-->}\HCode{<\a:mathml math\Hnewline}%
         |<disable a:mathml for math attr|>%
         \HCode{\csname a:math-xmlns\endcsname \Hnewline \a:@math>}%
      |<end disable a:mathml for math attr|>\a:math
      |<sv dvimath par|>\IgnorePar}
   {\Tg</\a:mathml math>\EndIgnoreRule
    \ifOption{mml-fonts}{}{|%\ext:htfsym|%\EndNoFonts}%
    \mathmlfalse \b:DviMathML |<recall dvimath par|>}
\fi\fi
>>>


\<recall dvimath par\><<<
\sv:ignore
>>>

\<sv dvimath par\><<<
\edef\sv:ignore{\if:nopar  
    \noexpand\IgnorePar\else \noexpand\ShowPar\fi}%
>>>

\<disable a:mathml for math attr\><<<
\let\sva:mathml=\a:mathml \let\a:mathml=\empty
>>>

\<end disable a:mathml for math attr\><<<
\let\a:mathml=\sva:mathml 
>>>


%%%%%%%%%%%%%%%%%%
\section{Color}
%%%%%%%%%%%%%%%%%%

\<configure mathplayer color\><<<
\let\a:txt:textcolor\a:textcolor
\let\b:txt:textcolor\b:textcolor
\Configure{textcolor}
   {\ifmathml 
      \Configure{color}%
         {\Configure{SetHColor}
              {\HCode{<m:mstyle color="\HColor">}}}%
    \else \a:txt:textcolor \fi
   }
   {\ifmathml \HCode{</m:mstyle>}\else \b:txt:textcolor \fi}
>>>


\endinput