| 1 |
% $Id: tex4ht-html-speech-xtpipes.tex 740 2020-06-13 22:35:32Z karl $ |
| 2 |
% htlatex tex4ht-html-speech-xtpipes "html,next,3" "" "-d./" |
| 3 |
% |
| 4 |
% Copyright 2009-2020 TeX Users Group |
| 5 |
% Copyright 2006-2009 Eitan M. Gurari |
| 6 |
% Released under LPPL 1.3c+. |
| 7 |
% See tex4ht-cpright.tex for license text. |
| 8 |
\documentclass{article} |
| 9 |
\Configure{ProTex}{log,<<<>>>,title,list,`,[[]]} |
| 10 |
\begin{document} |
| 11 |
|
| 12 |
\input{common} |
| 13 |
\input{tex4ht-dir} |
| 14 |
\input{tex4ht-cpright} |
| 15 |
|
| 16 |
%%%%%%%%%%%%%%%%%% |
| 17 |
\part{Script for xtpipes} |
| 18 |
%%%%%%%%%%%%%%%%%% |
| 19 |
|
| 20 |
|
| 21 |
%%%%%%%%%%%%%%%%%% |
| 22 |
\section{Outline} |
| 23 |
%%%%%%%%%%%%%%%%%% |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
\AtEndDocument{\OutputCodE\<htspk.4xt\>} |
| 28 |
|
| 29 |
|
| 30 |
\Needs{"xmllint --valid --noout htspk.4xt"} |
| 31 |
|
| 32 |
|
| 33 |
\<htspk.4xt\><<< |
| 34 |
<?xml version="1.0" encoding="UTF-8" ?> |
| 35 |
<!DOCTYPE xtpipes SYSTEM "xtpipes.dtd" > |
| 36 |
<!-- htspk.4xt (`version), generated from `jobname.tex |
| 37 |
Copyright (C) 2009-2010 TeX Users Group |
| 38 |
Copyright (C) `CopyYear.2002. Eitan M. Gurari |
| 39 |
`<TeX4ht copyright`> --> |
| 40 |
<xtpipes> |
| 41 |
<sax content-handler="xtpipes.util.ScriptsManager" |
| 42 |
lexical-handler="xtpipes.util.ScriptsManagerLH" > |
| 43 |
`<non short tag br elements`> |
| 44 |
`<undo empty scripts`> |
| 45 |
`<span frac elements`> |
| 46 |
`<short cut modifiers`> |
| 47 |
`<over and under scripts`> |
| 48 |
`<bold math`> |
| 49 |
`<capital math letters`> |
| 50 |
`<remove multline eqnum cell`> |
| 51 |
`<inline math`> |
| 52 |
`<display math`> |
| 53 |
`<measure tables`> |
| 54 |
`<remove empty split entries`> |
| 55 |
`<boundaries on theorems`> |
| 56 |
</sax> |
| 57 |
</xtpipes> |
| 58 |
>>> |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
\<inline math\><<< |
| 63 |
<script element="span::inline-math" > |
| 64 |
`<compress numeric subscripts`> |
| 65 |
`<set levels for hyper complex fracs`> |
| 66 |
`<set levels for sub and sup scripts`> |
| 67 |
`<set levels for roots`> |
| 68 |
<set name="inline-math" > |
| 69 |
`<open xslt script`> |
| 70 |
`<shared display and inline math 1`> |
| 71 |
`<eliminate inline math narrative`> |
| 72 |
`<close xslt script`> |
| 73 |
</set> |
| 74 |
<xslt name="." xml="." xsl="inline-math" /> |
| 75 |
<set name="inline-math-2" > |
| 76 |
`<open xslt script`> |
| 77 |
`<shared display and inline math 2`> |
| 78 |
`<eliminate inline math narrative 2`> |
| 79 |
`<close xslt script`> |
| 80 |
</set> |
| 81 |
<xslt name="." xml="." xsl="inline-math-2" /> |
| 82 |
`<set empty elements for the w3 browser`> |
| 83 |
</script> |
| 84 |
>>> |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
\<display math\><<< |
| 90 |
<script element="div::display-math" > |
| 91 |
`<compress numeric subscripts`> |
| 92 |
`<set levels for hyper complex fracs`> |
| 93 |
`<set levels for sub and sup scripts`> |
| 94 |
`<set levels for roots`> |
| 95 |
<set name="display-math" > |
| 96 |
`<open xslt script`> |
| 97 |
`<shared display and inline math 1`> |
| 98 |
`<close xslt script`> |
| 99 |
</set> |
| 100 |
<xslt name="." xml="." xsl="display-math" /> |
| 101 |
<set name="display-math-2" > |
| 102 |
`<open xslt script`> |
| 103 |
`<shared display and inline math 2`> |
| 104 |
`<close xslt script`> |
| 105 |
</set> |
| 106 |
<xslt name="." xml="." xsl="display-math-2" /> |
| 107 |
`<set empty elements for the w3 browser`> |
| 108 |
</script> |
| 109 |
>>> |
| 110 |
|
| 111 |
\<shared display and inline math 1\><<< |
| 112 |
`<get content template`> |
| 113 |
`<eliminate baseline script marks`> |
| 114 |
`<fraction 'and' prefix`> |
| 115 |
`<'minus' into 'negative'`> |
| 116 |
`<compress limit script`> |
| 117 |
`<remove scrip indicators from primes`> |
| 118 |
>>> |
| 119 |
|
| 120 |
|
| 121 |
\<shared display and inline math 2\><<< |
| 122 |
`<get content template`> |
| 123 |
`<replace nested baseline script marks`> |
| 124 |
`<insert pre mi spaces`> |
| 125 |
`<eliminate begin script marks`> |
| 126 |
>>> |
| 127 |
|
| 128 |
|
| 129 |
\marginpar{Can dom be prevented from creating an xml declaration in |
| 130 |
the output? The xslt part is there just to remove the undesirable |
| 131 |
declaration.} |
| 132 |
|
| 133 |
|
| 134 |
\<remove xml declaration\><<< |
| 135 |
<set name="rmXmlDecl" > |
| 136 |
`<open xslt script`> |
| 137 |
`<close xslt script`> |
| 138 |
</set> |
| 139 |
<xslt name="." xml="." xsl="rmXmlDecl" /> |
| 140 |
>>> |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
\AtEndDocument{\OutputCodE\<HtSpk.java\>} |
| 149 |
\ifdojava |
| 150 |
\Needs{" |
| 151 |
javac HtSpk.java -d \XTPIPES . |
| 152 |
"} |
| 153 |
\fi |
| 154 |
|
| 155 |
\<HtSpk.java\><<< |
| 156 |
package tex4ht; |
| 157 |
/* HtSpk.java (`version), generated from `jobname.tex |
| 158 |
Copyright (C) 2009-2010 TeX Users Group |
| 159 |
Copyright (C) `CopyYear.2006. Eitan M. Gurari |
| 160 |
`<TeX4ht copyright`> */ |
| 161 |
import org.w3c.dom.*; |
| 162 |
public class HtSpk { |
| 163 |
`<static void fracLevel(dom)`> |
| 164 |
`<static void scriptLevel(dom)`> |
| 165 |
`<static void rootLevel(dom)`> |
| 166 |
} |
| 167 |
>>> |
| 168 |
|
| 169 |
|
| 170 |
%%%%%%%%%%%%%%%%%% |
| 171 |
\section{Line Break Elements} |
| 172 |
%%%%%%%%%%%%%%%%%% |
| 173 |
|
| 174 |
Avoid short versions \verb+<br />+. |
| 175 |
|
| 176 |
\<non short tag br elements\><<< |
| 177 |
<script element="br" > |
| 178 |
<set name="br" > |
| 179 |
<![CDATA[ |
| 180 |
<xsl:stylesheet version="1.0" |
| 181 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 182 |
> |
| 183 |
<xsl:output omit-xml-declaration = "yes" /> |
| 184 |
<xsl:template match="br" > |
| 185 |
<xsl:copy> |
| 186 |
<xsl:apply-templates select="@*" /> |
| 187 |
<xsl:comment>`<comment`></xsl:comment> |
| 188 |
</xsl:copy> |
| 189 |
</xsl:template> |
| 190 |
<xsl:template match="*|@*|text()|comment()" > |
| 191 |
<xsl:copy> |
| 192 |
<xsl:apply-templates select="*|@*|text()|comment()" /> |
| 193 |
</xsl:copy> |
| 194 |
</xsl:template> |
| 195 |
</xsl:stylesheet> |
| 196 |
]]> |
| 197 |
</set> |
| 198 |
<xslt name="." xml="." xsl="br" /> |
| 199 |
</script> |
| 200 |
>>> |
| 201 |
|
| 202 |
%%%%%%%%%%%%%%%%%% |
| 203 |
\section{Capital Letters in Math} |
| 204 |
%%%%%%%%%%%%%%%%%% |
| 205 |
|
| 206 |
\<capital math letters\><<< |
| 207 |
<script element="span::mi" > |
| 208 |
<set name="math-cap" > |
| 209 |
`<open xslt script`> |
| 210 |
`<span.mi cap letters`> |
| 211 |
`<close xslt script`> |
| 212 |
</set> |
| 213 |
<xslt name="." xml="." xsl="math-cap" /> |
| 214 |
</script> |
| 215 |
>>> |
| 216 |
|
| 217 |
% (translate(.,'abcdefghijklmnopqrstuvwxyz', |
| 218 |
% 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') = . ) |
| 219 |
% and |
| 220 |
|
| 221 |
\<span.mi cap letters\><<< |
| 222 |
<xsl:template match="span[ @class = 'mi' ]" > |
| 223 |
<xsl:copy> |
| 224 |
<xsl:apply-templates select="@*" /> |
| 225 |
<xsl:if test=" string-length(.) = 1 " > |
| 226 |
<xsl:if test=" |
| 227 |
(translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ', |
| 228 |
'') = '' ) |
| 229 |
" > |
| 230 |
<span class="capital-description" |
| 231 |
title="speech-extra" > |
| 232 |
<xsl:text> capital </xsl:text> |
| 233 |
</span> |
| 234 |
</xsl:if> |
| 235 |
</xsl:if> |
| 236 |
<xsl:apply-templates select="*|text()|comment()" /> |
| 237 |
</xsl:copy> |
| 238 |
</xsl:template> |
| 239 |
>>> |
| 240 |
|
| 241 |
%%%%%%%%%%%%%%%%%% |
| 242 |
\section{Superscripts and Subscripts} |
| 243 |
%%%%%%%%%%%%%%%%%% |
| 244 |
|
| 245 |
%%%%%%%%%%%%% |
| 246 |
\subsection{Insert Sub-Levels Info} |
| 247 |
%%%%%%%%%%%%% |
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
\<set levels for sub and sup scripts\><<< |
| 253 |
<dom name="." xml="." method="scriptLevel" class="tex4ht.HtSpk" /> |
| 254 |
`<remove xml declaration`> |
| 255 |
>>> |
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
\<static void scriptLevel(dom)\><<< |
| 260 |
public static void scriptLevel(Node dom) { |
| 261 |
setScriptLevel(dom.getFirstChild(), ""); |
| 262 |
} |
| 263 |
private static void setScriptLevel(Node node, String prefix) { |
| 264 |
String clName = null; |
| 265 |
if (node.hasChildNodes()) { |
| 266 |
if (node.hasAttributes()) { |
| 267 |
Node cl = node.getAttributes().getNamedItem("class"); |
| 268 |
if (cl != null) { |
| 269 |
clName = cl.getNodeValue(); |
| 270 |
if( clName.equals("mrow-sub") |
| 271 |
|| |
| 272 |
clName.equals("mrow-super") |
| 273 |
){ |
| 274 |
`<append script prefix`> |
| 275 |
} else if( |
| 276 |
clName.equals("msqrt") |
| 277 |
){ prefix = ""; } |
| 278 |
} } |
| 279 |
`<script invoke children`> |
| 280 |
} } |
| 281 |
>>> |
| 282 |
|
| 283 |
\<script invoke children\><<< |
| 284 |
NodeList children = node.getChildNodes(); |
| 285 |
for (int i = 0; i < children.getLength(); i++) { |
| 286 |
Node child = children.item(i); |
| 287 |
if (child.getNodeType() == Node.ELEMENT_NODE) { |
| 288 |
setScriptLevel(child, prefix); |
| 289 |
} } |
| 290 |
>>> |
| 291 |
|
| 292 |
\<append script prefix\><<< |
| 293 |
if( !prefix.equals("") ){ |
| 294 |
`<use current script prefix`> |
| 295 |
} |
| 296 |
if( clName.equals( "mrow-sub" ) ){ prefix += " sub "; } |
| 297 |
else |
| 298 |
if( clName.equals( "mrow-super" ) ){ prefix += " super "; } |
| 299 |
>>> |
| 300 |
|
| 301 |
|
| 302 |
\<use current script prefix\><<< |
| 303 |
Node child = node.getFirstChild(); |
| 304 |
if( (child.getNodeType() == Node.ELEMENT_NODE) |
| 305 |
&& |
| 306 |
child.hasAttributes() |
| 307 |
){ |
| 308 |
Node cls = child.getAttributes().getNamedItem("class"); |
| 309 |
if (cls != null) { |
| 310 |
String clsName = cls.getNodeValue(); |
| 311 |
if ( clsName.equals("begin-script") |
| 312 |
|| |
| 313 |
clsName.equals("mid-script") |
| 314 |
) { |
| 315 |
child = child.getFirstChild(); |
| 316 |
String s = child.getNodeValue(); |
| 317 |
((org.w3c.dom.Text) child).setData( prefix + s ); |
| 318 |
} } } |
| 319 |
>>> |
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
%%%%%%%%%%%%% |
| 324 |
\subsection{Eliminate End Script Marks} |
| 325 |
%%%%%%%%%%%%% |
| 326 |
|
| 327 |
|
| 328 |
The following takes care of end-scripts that semantically can be |
| 329 |
merged into other end markers. |
| 330 |
|
| 331 |
\<eliminate baseline script marks\><<< |
| 332 |
<xsl:template match="span[ |
| 333 |
(@class = 'end-script') |
| 334 |
and |
| 335 |
ancestor::* [ following-sibling::* [ |
| 336 |
not( @class = 'content-less' ) |
| 337 |
] |
| 338 |
][1] |
| 339 |
/ following-sibling::* [ |
| 340 |
not( @class = 'content-less' ) |
| 341 |
][1] |
| 342 |
/ self::* |
| 343 |
[ |
| 344 |
(@class = 'end-math') |
| 345 |
or |
| 346 |
(@class = 'end-script') |
| 347 |
or |
| 348 |
(@class = 'end-root') |
| 349 |
or |
| 350 |
(@class = 'end-stack') |
| 351 |
or |
| 352 |
(@class = 'mid-stack') |
| 353 |
or |
| 354 |
(@class = 'end-array') |
| 355 |
or |
| 356 |
(@class = 'tr') |
| 357 |
or |
| 358 |
(@title = 'implicit-baseline') |
| 359 |
] |
| 360 |
]" > |
| 361 |
</xsl:template> |
| 362 |
>>> |
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
%%%%%%%%%%%%% |
| 367 |
\subsection{Replace Nested Baseline Script Marks} |
| 368 |
%%%%%%%%%%%%% |
| 369 |
|
| 370 |
|
| 371 |
\<replace nested baseline script marks\><<< |
| 372 |
<xsl:template match="span[ |
| 373 |
(@class = 'end-script') |
| 374 |
and |
| 375 |
ancestor::*[ preceding-sibling::* [ |
| 376 |
((@class = 'begin-script') or (@class = 'mid-script')) ]] |
| 377 |
`% and |
| 378 |
( normalize-space(.) = 'baseline' ) REMOVE `% |
| 379 |
]" > |
| 380 |
<xsl:copy> |
| 381 |
<xsl:apply-templates select="*|@*|comment()" /> |
| 382 |
<xsl:value-of select=" |
| 383 |
ancestor::*[ preceding-sibling::* [ |
| 384 |
((@class = 'begin-script') or |
| 385 |
(@class = 'mid-script')) ]] [1] |
| 386 |
/ preceding-sibling::* [ |
| 387 |
((@class = 'begin-script') or |
| 388 |
(@class = 'mid-script')) ][1] |
| 389 |
" /> |
| 390 |
</xsl:copy> |
| 391 |
</xsl:template> |
| 392 |
>>> |
| 393 |
|
| 394 |
|
| 395 |
%%%%%%%%%%%%% |
| 396 |
\subsection{Eliminate Begin Script Marks} |
| 397 |
%%%%%%%%%%%%% |
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
\<eliminate begin script marks\><<< |
| 402 |
<xsl:template match="span[ |
| 403 |
(@class = 'begin-script') |
| 404 |
and |
| 405 |
following-sibling::* [1] / child::*[ |
| 406 |
(position() = 1) |
| 407 |
and |
| 408 |
(@class = 'mrow-base') |
| 409 |
and |
| 410 |
( normalize-space(.) = '' ) |
| 411 |
] |
| 412 |
]" > |
| 413 |
</xsl:template> |
| 414 |
>>> |
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
%%%%%%%%%%%%% |
| 419 |
\subsection{Undo Empty Scripts} |
| 420 |
%%%%%%%%%%%%% |
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
\<undo empty scripts\><<< |
| 426 |
<script element="span::msup" > |
| 427 |
<set name="m-sub-sup" > |
| 428 |
`<open xslt script`> |
| 429 |
`<undo if empty su`> |
| 430 |
`<close xslt script`> |
| 431 |
</set> |
| 432 |
<xslt name="." xml="." xsl="m-sub-sup" /> |
| 433 |
`<superscript 2 and 3 into verbose`> |
| 434 |
</script> |
| 435 |
<script element="span::msub" > |
| 436 |
`<sub sup script`> |
| 437 |
</script> |
| 438 |
<script element="span::msubsup" > |
| 439 |
`<subsup prime`> |
| 440 |
`<sub sup script`> |
| 441 |
`<sub superscript 2 and 3 into verbose`> |
| 442 |
</script> |
| 443 |
>>> |
| 444 |
|
| 445 |
\<sub sup script\><<< |
| 446 |
<set name="m-sub-sup" > |
| 447 |
`<open xslt script`> |
| 448 |
`<undo if empty su`> |
| 449 |
`<close xslt script`> |
| 450 |
</set> |
| 451 |
<xslt name="." xml="." xsl="m-sub-sup" /> |
| 452 |
>>> |
| 453 |
|
| 454 |
\<undo if empty su\><<< |
| 455 |
<xsl:template match="span[ |
| 456 |
((@class = 'msup') or (@class = 'msub') |
| 457 |
or (@class = 'msubsup')) |
| 458 |
and |
| 459 |
not( |
| 460 |
child::span[ (@class = 'mrow-sub') ] |
| 461 |
/ child::span[ (@class != 'begin-script') |
| 462 |
and |
| 463 |
(@class != 'end-script') |
| 464 |
and |
| 465 |
(@class != 'mid-script') |
| 466 |
] |
| 467 |
) |
| 468 |
and |
| 469 |
not( |
| 470 |
child::span[ (@class = 'mrow-super') ] |
| 471 |
/ child::span[ (@class != 'begin-script') |
| 472 |
and |
| 473 |
(@class != 'end-script') |
| 474 |
and |
| 475 |
(@class != 'mid-script') |
| 476 |
] |
| 477 |
) |
| 478 |
]" > |
| 479 |
<xsl:apply-templates select="child::span[ |
| 480 |
@class = 'mrow-base' ]/*" /> |
| 481 |
</xsl:template> |
| 482 |
>>> |
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
\begin{verbatim} |
| 487 |
<span class="msup"> |
| 488 |
<span class="mrow-base"> |
| 489 |
......... |
| 490 |
</span> |
| 491 |
<span class="mrow-super"> |
| 492 |
<span class="begin-script"> superscript </span> |
| 493 |
<span class="end-script"> baseline </span> |
| 494 |
</span> |
| 495 |
</span> |
| 496 |
\end{verbatim} |
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
%%%%%%%%%%%%% |
| 502 |
\subsection{Squared} |
| 503 |
%%%%%%%%%%%%% |
| 504 |
|
| 505 |
\<superscript 2 and 3 into verbose\><<< |
| 506 |
<set name="m-sup-2-3" > |
| 507 |
`<open xslt script`> |
| 508 |
`<superscript into squared abd cube`> |
| 509 |
`<close xslt script`> |
| 510 |
</set> |
| 511 |
<xslt name="." xml="." xsl="m-sup-2-3" /> |
| 512 |
>>> |
| 513 |
|
| 514 |
\<superscript into squared abd cube\><<< |
| 515 |
<xsl:template match="span[ |
| 516 |
(@class = 'msup') |
| 517 |
and |
| 518 |
(normalize-space( |
| 519 |
child::span[ (@class = 'mrow-super') ] |
| 520 |
/ child::span[ (@class != 'begin-script') |
| 521 |
and |
| 522 |
(@class != 'end-script') |
| 523 |
] |
| 524 |
) = '2') |
| 525 |
and `<su verbose not on op`> |
| 526 |
]" > |
| 527 |
<xsl:copy> |
| 528 |
<xsl:apply-templates select="*|@*|text()|comment()" |
| 529 |
mode="squared" /> |
| 530 |
</xsl:copy> |
| 531 |
</xsl:template> |
| 532 |
>>> |
| 533 |
|
| 534 |
|
| 535 |
\<su verbose not on op\><<< |
| 536 |
not( |
| 537 |
child::span[ (@class = 'mrow-base') ] |
| 538 |
/ child::span[ not( @title = 'speech-extra' ) ] |
| 539 |
[ position() = last() ] |
| 540 |
/ self::* [ @class = 'mo-op' ] |
| 541 |
) |
| 542 |
>>> |
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
\<superscript into squared abd cube\><<< |
| 548 |
<xsl:template match="*|@*|text()|comment()" |
| 549 |
mode="squared" > |
| 550 |
<xsl:copy> |
| 551 |
<xsl:choose> |
| 552 |
<xsl:when test=" @class = 'mrow-super' "> |
| 553 |
<xsl:apply-templates select="@*" /> |
| 554 |
<span class="mo-op"> |
| 555 |
<xsl:text> squared </xsl:text> |
| 556 |
</span> |
| 557 |
</xsl:when> |
| 558 |
<xsl:otherwise> |
| 559 |
<xsl:apply-templates select="*|@*|text()|comment()" /> |
| 560 |
</xsl:otherwise> |
| 561 |
</xsl:choose> |
| 562 |
</xsl:copy> |
| 563 |
</xsl:template> |
| 564 |
>>> |
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
\begin{verbatim} |
| 572 |
<span class="msup"> |
| 573 |
<span class="mrow-base"> |
| 574 |
<span class="mo-op">cos</span> |
| 575 |
</span> |
| 576 |
<span class="mrow-super"> |
| 577 |
<span class="begin-script"> superscript </span> |
| 578 |
<span class="mn">2</span> |
| 579 |
<span class="end-script"> baseline </span> |
| 580 |
</span> |
| 581 |
</span> |
| 582 |
\end{verbatim} |
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
\<superscript into squared abd cube\><<< |
| 588 |
<xsl:template match="span[ |
| 589 |
(@class = 'msup') |
| 590 |
and |
| 591 |
(normalize-space( |
| 592 |
child::span[ (@class = 'mrow-super') ] |
| 593 |
/ child::span[ (@class != 'begin-script') |
| 594 |
and |
| 595 |
(@class != 'end-script') |
| 596 |
] |
| 597 |
) = '3') |
| 598 |
and `<su verbose not on op`> |
| 599 |
]" > |
| 600 |
<xsl:copy> |
| 601 |
<xsl:apply-templates select="*|@*|text()|comment()" |
| 602 |
mode="cube" /> |
| 603 |
</xsl:copy> |
| 604 |
</xsl:template> |
| 605 |
>>> |
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
\<superscript into squared abd cube\><<< |
| 610 |
<xsl:template match="*|@*|text()|comment()" |
| 611 |
mode="cube" > |
| 612 |
<xsl:copy> |
| 613 |
<xsl:choose> |
| 614 |
<xsl:when test=" @class = 'mrow-super' "> |
| 615 |
<xsl:apply-templates select="@*" /> |
| 616 |
<span class="mo-op"> |
| 617 |
<xsl:text> cube </xsl:text> |
| 618 |
</span> |
| 619 |
</xsl:when> |
| 620 |
<xsl:otherwise> |
| 621 |
<xsl:apply-templates select="*|@*|text()|comment()" /> |
| 622 |
</xsl:otherwise> |
| 623 |
</xsl:choose> |
| 624 |
</xsl:copy> |
| 625 |
</xsl:template> |
| 626 |
>>> |
| 627 |
|
| 628 |
|
| 629 |
\<sub superscript 2 and 3 into verbose\><<< |
| 630 |
<set name="m-subsup-2-3" > |
| 631 |
`<open xslt script`> |
| 632 |
`<subsup into sub squared and cube`> |
| 633 |
`<close xslt script`> |
| 634 |
</set> |
| 635 |
<xslt name="." xml="." xsl="m-subsup-2-3" /> |
| 636 |
>>> |
| 637 |
|
| 638 |
|
| 639 |
|
| 640 |
|
| 641 |
|
| 642 |
\<subsup into sub squared and cube\><<< |
| 643 |
<xsl:template match="span[ |
| 644 |
(@class = 'msubsup') |
| 645 |
and |
| 646 |
(normalize-space( |
| 647 |
child::span[ (@class = 'mrow-super') ] |
| 648 |
/ child::span[ (@class != 'mid-script') |
| 649 |
and |
| 650 |
(@class != 'end-script') |
| 651 |
] |
| 652 |
) = '2') |
| 653 |
and `<su verbose not on op`> |
| 654 |
]" > |
| 655 |
<xsl:copy> |
| 656 |
<xsl:attribute name="class" > |
| 657 |
<xsl:text>msub</xsl:text> |
| 658 |
</xsl:attribute> |
| 659 |
<xsl:apply-templates select="*|text()|comment()" |
| 660 |
mode="sub-squared" /> |
| 661 |
</xsl:copy> |
| 662 |
</xsl:template> |
| 663 |
>>> |
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
\<subsup into sub squared and cube\><<< |
| 668 |
<xsl:template match="*|@*|text()|comment()" |
| 669 |
mode="sub-squared" > |
| 670 |
<xsl:copy> |
| 671 |
<xsl:choose> |
| 672 |
<xsl:when test=" @class = 'mrow-sub' "> |
| 673 |
<xsl:apply-templates select="*[ |
| 674 |
not( @class = 'end-script' ) |
| 675 |
] |
| 676 |
|@*|text()|comment()" /> |
| 677 |
<xsl:apply-templates select=" |
| 678 |
following-sibling::*[1] / *[ |
| 679 |
@class = 'end-script' |
| 680 |
] " /> |
| 681 |
</xsl:when> |
| 682 |
<xsl:when test=" @class = 'mrow-super' "> |
| 683 |
<xsl:attribute name="class" > |
| 684 |
<xsl:text>squared-super</xsl:text> |
| 685 |
</xsl:attribute> |
| 686 |
<span class="mo-op"> |
| 687 |
<xsl:text> squared </xsl:text> |
| 688 |
</span> |
| 689 |
</xsl:when> |
| 690 |
<xsl:otherwise> |
| 691 |
<xsl:apply-templates select="*|@*|text()|comment()" /> |
| 692 |
</xsl:otherwise> |
| 693 |
</xsl:choose> |
| 694 |
</xsl:copy> |
| 695 |
</xsl:template> |
| 696 |
>>> |
| 697 |
|
| 698 |
|
| 699 |
\<subsup into sub squared and cube\><<< |
| 700 |
<xsl:template match="span[ |
| 701 |
(@class = 'msubsup') |
| 702 |
and |
| 703 |
(normalize-space( |
| 704 |
child::span[ (@class = 'mrow-super') ] |
| 705 |
/ child::span[ (@class != 'mid-script') |
| 706 |
and |
| 707 |
(@class != 'end-script') |
| 708 |
] |
| 709 |
) = '3') |
| 710 |
and `<su verbose not on op`> |
| 711 |
]" > |
| 712 |
<xsl:copy> |
| 713 |
<xsl:attribute name="class" > |
| 714 |
<xsl:text>msub</xsl:text> |
| 715 |
</xsl:attribute> |
| 716 |
<xsl:apply-templates select="*|text()|comment()" |
| 717 |
mode="sub-cube" /> |
| 718 |
</xsl:copy> |
| 719 |
</xsl:template> |
| 720 |
>>> |
| 721 |
|
| 722 |
|
| 723 |
|
| 724 |
\<subsup into sub squared and cube\><<< |
| 725 |
<xsl:template match="*|@*|text()|comment()" |
| 726 |
mode="sub-cube" > |
| 727 |
<xsl:copy> |
| 728 |
<xsl:choose> |
| 729 |
<xsl:when test=" @class = 'mrow-sub' "> |
| 730 |
<xsl:apply-templates select="*[ |
| 731 |
not( @class = 'end-script' ) |
| 732 |
] |
| 733 |
|@*|text()|comment()" /> |
| 734 |
<xsl:apply-templates select=" |
| 735 |
following-sibling::*[1] / *[ |
| 736 |
@class = 'end-script' |
| 737 |
] " /> |
| 738 |
</xsl:when> |
| 739 |
<xsl:when test=" @class = 'mrow-super' "> |
| 740 |
<xsl:attribute name="class" > |
| 741 |
<xsl:text>cube-super</xsl:text> |
| 742 |
</xsl:attribute> |
| 743 |
<span class="mo-op"> |
| 744 |
<xsl:text> cube </xsl:text> |
| 745 |
</span> |
| 746 |
</xsl:when> |
| 747 |
<xsl:otherwise> |
| 748 |
<xsl:apply-templates select="*|@*|text()|comment()" /> |
| 749 |
</xsl:otherwise> |
| 750 |
</xsl:choose> |
| 751 |
</xsl:copy> |
| 752 |
</xsl:template> |
| 753 |
>>> |
| 754 |
|
| 755 |
|
| 756 |
|
| 757 |
%%%%%%%%%%%%% |
| 758 |
\subsection{Numeric Subscripts (Rule 77)} |
| 759 |
%%%%%%%%%%%%% |
| 760 |
|
| 761 |
\<compress numeric subscripts\><<< |
| 762 |
<set name="num-sub" > |
| 763 |
`<open xslt script`> |
| 764 |
`<num sub`> |
| 765 |
`<close xslt script`> |
| 766 |
</set> |
| 767 |
<xslt name="." xml="." xsl="num-sub" /> |
| 768 |
>>> |
| 769 |
|
| 770 |
|
| 771 |
|
| 772 |
\<num sub\><<< |
| 773 |
<xsl:template match="span[ |
| 774 |
(@class = 'msub') |
| 775 |
and |
| 776 |
(count( child::span[ @class = 'mrow-base' ] |
| 777 |
/ child::* ) = 1 ) |
| 778 |
and not( ancestor::*[ |
| 779 |
(@class = 'msub') |
| 780 |
or |
| 781 |
(@class = 'msup') |
| 782 |
or |
| 783 |
(@class = 'msubsup') |
| 784 |
] ) |
| 785 |
and |
| 786 |
not( child::span[ @class = 'mrow-sub' ] |
| 787 |
/ child::* [ |
| 788 |
not( @title = 'speech-extra' ) |
| 789 |
and |
| 790 |
not( @class = 'mn' ) |
| 791 |
and |
| 792 |
not( |
| 793 |
(@class = 'mo-punc') |
| 794 |
and |
| 795 |
( . = ',' ) |
| 796 |
and |
| 797 |
preceding-sibling::*[1][ @class = 'mn' ] |
| 798 |
and |
| 799 |
following-sibling::*[1][ @class = 'mn' ] |
| 800 |
and |
| 801 |
following-sibling::*[2][ @class = 'mn' ] |
| 802 |
and |
| 803 |
following-sibling::*[3][ @class = 'mn' ] |
| 804 |
and |
| 805 |
( not(following-sibling::*[4]) |
| 806 |
or |
| 807 |
not(following-sibling::*[4][ @class = 'mn' ]) |
| 808 |
) |
| 809 |
) |
| 810 |
and |
| 811 |
not( |
| 812 |
(@class = 'mo-punc') |
| 813 |
and |
| 814 |
( . = '.' ) |
| 815 |
and |
| 816 |
following-sibling::*[1][ @class = 'mn' ] |
| 817 |
and |
| 818 |
not( |
| 819 |
following-sibling::*[ |
| 820 |
(@class = 'mo-punc') |
| 821 |
and |
| 822 |
(. = '.') |
| 823 |
] |
| 824 |
) |
| 825 |
) |
| 826 |
]) |
| 827 |
]" > |
| 828 |
<xsl:copy> |
| 829 |
<xsl:apply-templates select="@*" /> |
| 830 |
<xsl:apply-templates select="*[1]" /> |
| 831 |
<span class="mrow-sub"> |
| 832 |
<span class="space" title="speech-extra"> |
| 833 |
<xsl:text> </xsl:text> |
| 834 |
</span> |
| 835 |
<xsl:apply-templates |
| 836 |
select="*[2] / *[ |
| 837 |
not(@title = 'speech-extra') |
| 838 |
and |
| 839 |
not( |
| 840 |
(@class = 'mo-punc') |
| 841 |
and (. = ',') |
| 842 |
) |
| 843 |
]" /> |
| 844 |
</span> |
| 845 |
</xsl:copy> |
| 846 |
</xsl:template> |
| 847 |
>>> |
| 848 |
|
| 849 |
Emacspeak doesn't read fluently numbers with commas. For instance `10,000' is |
| 850 |
treated as `ten comma zero zero zero'. |
| 851 |
|
| 852 |
\begin{verbatim} |
| 853 |
<span class="msub"> |
| 854 |
<span class="mrow-base"> |
| 855 |
<span class="mi">x</span> |
| 856 |
</span> |
| 857 |
<span class="mrow-sub"> |
| 858 |
<span class="begin-script" title="speech-extra"> subscript </span> |
| 859 |
<span class="mn">1</span> |
| 860 |
<span class="end-script" title="speech-extra"> baseline </span> |
| 861 |
</span> |
| 862 |
</span> |
| 863 |
\end{verbatim} |
| 864 |
|
| 865 |
%%%%%%%%%%%%% |
| 866 |
\subsection{Primes} |
| 867 |
%%%%%%%%%%%%% |
| 868 |
|
| 869 |
\<remove scrip indicators from primes\><<< |
| 870 |
<xsl:template match="span[ |
| 871 |
(@class = 'begin-script') |
| 872 |
and |
| 873 |
following-sibling::*[ |
| 874 |
child::span / child::span[ |
| 875 |
(@class = 'ch 2032') or (@class = 'ch 2033') |
| 876 |
or (@class = 'ch 2034') |
| 877 |
] ] |
| 878 |
]" > |
| 879 |
</xsl:template> |
| 880 |
>>> |
| 881 |
|
| 882 |
|
| 883 |
|
| 884 |
\<remove scrip indicators from primes\><<< |
| 885 |
<xsl:template match="span[ |
| 886 |
(@class = 'end-script') |
| 887 |
and |
| 888 |
preceding-sibling::*[ |
| 889 |
child::span / child::span[ |
| 890 |
(@class = 'ch 2032') or (@class = 'ch 2033') |
| 891 |
or (@class = 'ch 2034') |
| 892 |
] ] |
| 893 |
]" > |
| 894 |
</xsl:template> |
| 895 |
>>> |
| 896 |
|
| 897 |
|
| 898 |
|
| 899 |
\begin{verbatim} |
| 900 |
<span class="msup"> |
| 901 |
<span class="mrow-base"> |
| 902 |
<span class="mi">x</span> |
| 903 |
</span> |
| 904 |
<span class="mrow-super"> |
| 905 |
<span class="begin-script"> superscript </span> |
| 906 |
<span class="mo-op"> |
| 907 |
<span class="char"> |
| 908 |
<span class="ch 2033">double prime</span> |
| 909 |
</span> |
| 910 |
</span> |
| 911 |
<span class="end-script"> baseline </span> |
| 912 |
</span> |
| 913 |
</span> |
| 914 |
\end{verbatim} |
| 915 |
|
| 916 |
\<subsup prime\><<< |
| 917 |
<set name="subsup-prime" > |
| 918 |
`<open xslt script`> |
| 919 |
`<compress subsup prime`> |
| 920 |
`<close xslt script`> |
| 921 |
</set> |
| 922 |
<xslt name="." xml="." xsl="subsup-prime" /> |
| 923 |
>>> |
| 924 |
|
| 925 |
|
| 926 |
\<compress subsup prime\><<< |
| 927 |
<xsl:template match="span[ |
| 928 |
(@class = 'msubsup') |
| 929 |
and |
| 930 |
(count( |
| 931 |
child::* [ @class='mrow-super' ] |
| 932 |
/ child::span [ not(@title = 'speech-extra') ] ) = 1) |
| 933 |
and |
| 934 |
(count( |
| 935 |
child::* [ @class='mrow-super' ] |
| 936 |
/ child::span [ not(@title = 'speech-extra') ] |
| 937 |
/ child::span) = 1) |
| 938 |
and |
| 939 |
child::* [ @class='mrow-super' ] |
| 940 |
/ child::span [ not(@title = 'speech-extra') ] |
| 941 |
/ child::span[ @class='char' ] |
| 942 |
/ child::span[ |
| 943 |
(@class = 'ch 2032') or (@class = 'ch 2033') |
| 944 |
or (@class = 'ch 2034') |
| 945 |
] |
| 946 |
]" > |
| 947 |
<xsl:copy> |
| 948 |
<xsl:attribute name="class" > |
| 949 |
<xsl:text>msub</xsl:text> |
| 950 |
</xsl:attribute> |
| 951 |
<span class="mrow-base"> |
| 952 |
<xsl:apply-templates select=" |
| 953 |
*[@class = 'mrow-base'] / * |
| 954 |
" /> |
| 955 |
<xsl:apply-templates select=" |
| 956 |
*[@class = 'mrow-super'] |
| 957 |
/ child::span [ not(@title = 'speech-extra') ] |
| 958 |
" /> |
| 959 |
</span> |
| 960 |
<xsl:apply-templates select="*[@class = 'mrow-sub']" /> |
| 961 |
</xsl:copy> |
| 962 |
</xsl:template> |
| 963 |
>>> |
| 964 |
|
| 965 |
|
| 966 |
|
| 967 |
\begin{verbatim} |
| 968 |
<span class="msubsup"> |
| 969 |
<span class="mrow-base"> |
| 970 |
<span class="mi">x</span> |
| 971 |
</span> |
| 972 |
<span class="mrow-sub"> |
| 973 |
...... |
| 974 |
</span> |
| 975 |
<span class="mrow-super"> |
| 976 |
<span class="mid-script" title="speech-extra"> superscript </span> |
| 977 |
<span class="mi"> |
| 978 |
<span class="char" title="ch-verbose"> |
| 979 |
<span class="ch 2032" title="ch-verbose">prime</span> |
| 980 |
</span> |
| 981 |
</span> |
| 982 |
</span> |
| 983 |
</span> |
| 984 |
\end{verbatim} |
| 985 |
|
| 986 |
|
| 987 |
%%%%%%%%%%%%%%%%%% |
| 988 |
\section{Over and Under Limit Scripts} |
| 989 |
%%%%%%%%%%%%%%%%%% |
| 990 |
|
| 991 |
|
| 992 |
\<over and under scripts\><<< |
| 993 |
<script element="span::limits-msub-msup" > |
| 994 |
<set name="smash" > |
| 995 |
`<open xslt script`> |
| 996 |
`<smash over and under scripts`> |
| 997 |
`<close xslt script`> |
| 998 |
</set> |
| 999 |
<xslt name="." xml="." xsl="smash" /> |
| 1000 |
</script> |
| 1001 |
>>> |
| 1002 |
|
| 1003 |
\<smash over and under scripts\><<< |
| 1004 |
<xsl:template match="span[ |
| 1005 |
(@class = 'limits-msub-msup') |
| 1006 |
and |
| 1007 |
child::*[ (position() = 1) |
| 1008 |
and (@class = 'limits-mrow-base') |
| 1009 |
and child::*[ (position() = 1) |
| 1010 |
and (@class = 'limits-msub-msup') |
| 1011 |
] ] |
| 1012 |
]" > |
| 1013 |
<xsl:copy> |
| 1014 |
<xsl:apply-templates select="@*" /> |
| 1015 |
<xsl:apply-templates select=" |
| 1016 |
*[1] |
| 1017 |
/ *[1] |
| 1018 |
/ *[ not(@class='limits-mrow-super') ] " /> |
| 1019 |
<xsl:apply-templates select=" *[ |
| 1020 |
preceding-sibling::* |
| 1021 |
and |
| 1022 |
not(@class='limits-mrow-super') ]" /> |
| 1023 |
<xsl:apply-templates select=" |
| 1024 |
*[1] |
| 1025 |
/ *[1] |
| 1026 |
/ *[@class='limits-mrow-super' ] " /> |
| 1027 |
<xsl:apply-templates select=" *[ |
| 1028 |
preceding-sibling::* |
| 1029 |
and |
| 1030 |
(@class='limits-mrow-super') ]" /> |
| 1031 |
</xsl:copy> |
| 1032 |
</xsl:template> |
| 1033 |
>>> |
| 1034 |
|
| 1035 |
|
| 1036 |
\<compress limit script\><<< |
| 1037 |
<xsl:template match="span[ @class = 'end-limits-script' ]" > |
| 1038 |
<xsl:if test=" parent::*[ not(following-sibling::*) ] "> |
| 1039 |
<xsl:copy> |
| 1040 |
<xsl:apply-templates select=" @* " /> |
| 1041 |
<xsl:choose> |
| 1042 |
<xsl:when test=" |
| 1043 |
parent::*[ preceding-sibling::span[ |
| 1044 |
@class != 'limits-mrow-base' |
| 1045 |
] ] |
| 1046 |
" > |
| 1047 |
<xsl:text> end scripts </xsl:text> |
| 1048 |
</xsl:when> |
| 1049 |
<xsl:otherwise> |
| 1050 |
<xsl:text> end script </xsl:text> |
| 1051 |
</xsl:otherwise> |
| 1052 |
</xsl:choose> |
| 1053 |
</xsl:copy> |
| 1054 |
</xsl:if> |
| 1055 |
</xsl:template> |
| 1056 |
>>> |
| 1057 |
|
| 1058 |
|
| 1059 |
\<compress limit script\><<< |
| 1060 |
<xsl:template match="span[ @class = 'begin-limits-script' ]" > |
| 1061 |
<xsl:copy> |
| 1062 |
<xsl:apply-templates select=" @* " /> |
| 1063 |
<xsl:choose> |
| 1064 |
<xsl:when test=" |
| 1065 |
parent::*[ @class = 'limits-mrow-super' ] |
| 1066 |
" > |
| 1067 |
<xsl:apply-templates |
| 1068 |
select=" parent::* |
| 1069 |
/ preceding-sibling::*[1] " |
| 1070 |
mode = "extra-over" /> |
| 1071 |
</xsl:when> |
| 1072 |
<xsl:when test=" |
| 1073 |
parent::*[ @class = 'limits-mrow-sub' ] |
| 1074 |
" > |
| 1075 |
<xsl:apply-templates |
| 1076 |
select=" parent::* |
| 1077 |
/ preceding-sibling::*[1] " |
| 1078 |
mode = "extra-under" /> |
| 1079 |
</xsl:when> |
| 1080 |
</xsl:choose> |
| 1081 |
<xsl:apply-templates select="*|text()|comment()" /> |
| 1082 |
</xsl:copy> |
| 1083 |
</xsl:template> |
| 1084 |
>>> |
| 1085 |
|
| 1086 |
|
| 1087 |
|
| 1088 |
\<compress limit script\><<< |
| 1089 |
<xsl:template match="*" mode="extra-over" > |
| 1090 |
<xsl:if test = " self::span[ @class = 'limits-mrow-super' ] " > |
| 1091 |
<xsl:text> over </xsl:text> |
| 1092 |
<xsl:apply-templates select=" preceding-sibling::*[1] " |
| 1093 |
mode = "extra-over" /> |
| 1094 |
</xsl:if> |
| 1095 |
</xsl:template> |
| 1096 |
>>> |
| 1097 |
|
| 1098 |
|
| 1099 |
\<compress limit script\><<< |
| 1100 |
<xsl:template match="*" mode="extra-under" > |
| 1101 |
<xsl:if test = " self::span[ @class = 'limits-mrow-sub' ] " > |
| 1102 |
<xsl:text> under </xsl:text> |
| 1103 |
<xsl:apply-templates select=" preceding-sibling::*[1] " |
| 1104 |
mode = "extra-under" /> |
| 1105 |
</xsl:if> |
| 1106 |
</xsl:template> |
| 1107 |
>>> |
| 1108 |
|
| 1109 |
|
| 1110 |
|
| 1111 |
|
| 1112 |
|
| 1113 |
|
| 1114 |
%%%%%%%%%%%%%%%%%% |
| 1115 |
\section{Fractions} |
| 1116 |
%%%%%%%%%%%%%%%%%% |
| 1117 |
|
| 1118 |
%%%%%%%%%%%%% |
| 1119 |
\subsection{Outline} |
| 1120 |
%%%%%%%%%%%%% |
| 1121 |
|
| 1122 |
|
| 1123 |
|
| 1124 |
\<span frac elements\><<< |
| 1125 |
<script element="span::mfrac" > |
| 1126 |
<set name="mfrac" > |
| 1127 |
`<open xslt script`> |
| 1128 |
`<frac templates`> |
| 1129 |
`<close xslt script`> |
| 1130 |
</set> |
| 1131 |
<xslt name="." xml="." xsl="mfrac" /> |
| 1132 |
</script> |
| 1133 |
>>> |
| 1134 |
|
| 1135 |
\<frac templates\><<< |
| 1136 |
<xsl:template match="span[ @class = 'mfrac' ]" > |
| 1137 |
<xsl:copy> |
| 1138 |
<xsl:choose> |
| 1139 |
`<constant fracs`> |
| 1140 |
`<prepend continuos fractions`> |
| 1141 |
`<tail continuos fractions`> |
| 1142 |
<xsl:otherwise> |
| 1143 |
<xsl:apply-templates select="*|@*|text()|comment()" /> |
| 1144 |
</xsl:otherwise> |
| 1145 |
</xsl:choose> |
| 1146 |
</xsl:copy> |
| 1147 |
</xsl:template> |
| 1148 |
>>> |
| 1149 |
|
| 1150 |
%%%%%%%%%%%%% |
| 1151 |
\subsection{Continuos Fractions} |
| 1152 |
%%%%%%%%%%%%% |
| 1153 |
|
| 1154 |
%%%%%%%%%%%%% |
| 1155 |
\subsubsection{Get Three Bottom Levels} |
| 1156 |
%%%%%%%%%%%%% |
| 1157 |
|
| 1158 |
|
| 1159 |
|
| 1160 |
\<tail continuos fractions\><<< |
| 1161 |
<xsl:when test=" `%check numeral numerator`% |
| 1162 |
(translate( |
| 1163 |
normalize-space( |
| 1164 |
child::span[ @class = 'mrow-numerator' ]), |
| 1165 |
'0123456789','')= '') |
| 1166 |
and `<check equality of numerators`> |
| 1167 |
and `<check ops before two top fracs`> |
| 1168 |
"> |
| 1169 |
`<a,b := top 2 pre op values`> |
| 1170 |
<xsl:choose> |
| 1171 |
<xsl:when test=" |
| 1172 |
( translate($a,'0123456789 ','') = '') |
| 1173 |
and (normalize-space($a)=normalize-space($b)) |
| 1174 |
and starts-with( $c, normalize-space( $a )) |
| 1175 |
and starts-with( |
| 1176 |
normalize-space( |
| 1177 |
substring-after( $c, normalize-space( $a )) ) |
| 1178 |
, |
| 1179 |
normalize-space( |
| 1180 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1181 |
child::span[ @class = 'mfrac' ] / |
| 1182 |
preceding-sibling::*[1] ) |
| 1183 |
) |
| 1184 |
" > |
| 1185 |
<xsl:attribute name="class"> |
| 1186 |
<xsl:value-of select=" 'continuous-mfrac' " /> |
| 1187 |
</xsl:attribute> |
| 1188 |
<xsl:apply-templates select="*|text()|comment()" /> |
| 1189 |
</xsl:when> |
| 1190 |
<xsl:otherwise> |
| 1191 |
<xsl:apply-templates select="*|@*|text()|comment()" /> |
| 1192 |
</xsl:otherwise> |
| 1193 |
</xsl:choose> |
| 1194 |
</xsl:when> |
| 1195 |
>>> |
| 1196 |
|
| 1197 |
|
| 1198 |
\<check equality of numerators\><<< |
| 1199 |
( normalize-space( |
| 1200 |
child::span[ @class = 'mrow-numerator' ]) |
| 1201 |
and |
| 1202 |
normalize-space( |
| 1203 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1204 |
child::span[ @class = 'mfrac' ] / |
| 1205 |
child::span[ @class = 'mrow-numerator' ]) |
| 1206 |
) |
| 1207 |
and |
| 1208 |
( normalize-space( |
| 1209 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1210 |
child::span[ @class = 'mfrac' ] / |
| 1211 |
child::span[ @class = 'mrow-numerator' ]) |
| 1212 |
and |
| 1213 |
normalize-space( |
| 1214 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1215 |
child::span[ @class = 'mfrac' ] / |
| 1216 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1217 |
child::span[ @class = 'mfrac' ] / |
| 1218 |
child::span[ @class = 'mrow-numerator' ]) |
| 1219 |
) |
| 1220 |
>>> |
| 1221 |
|
| 1222 |
|
| 1223 |
|
| 1224 |
\<check ops before two top fracs\><<< |
| 1225 |
( child::span[ @class = 'mrow-enumerator' ] / |
| 1226 |
child::span[ @class = 'mfrac' ] / |
| 1227 |
preceding-sibling::*[1][@class = 'mo-bin'] |
| 1228 |
) |
| 1229 |
and |
| 1230 |
( normalize-space( |
| 1231 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1232 |
child::span[ @class = 'mfrac' ] / |
| 1233 |
preceding-sibling::*[1] ) |
| 1234 |
= |
| 1235 |
normalize-space( |
| 1236 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1237 |
child::span[ @class = 'mfrac' ] / |
| 1238 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1239 |
child::span[ @class = 'mfrac' ] / |
| 1240 |
preceding-sibling::*[1] ) |
| 1241 |
) |
| 1242 |
>>> |
| 1243 |
|
| 1244 |
|
| 1245 |
|
| 1246 |
\<a,b := top 2 pre op values\><<< |
| 1247 |
<xsl:variable name="a"> |
| 1248 |
<xsl:apply-templates select=" |
| 1249 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1250 |
child::span[ @class = 'mfrac' ] / |
| 1251 |
preceding-sibling::*[2] |
| 1252 |
" mode="enum-op" /> |
| 1253 |
</xsl:variable> |
| 1254 |
<xsl:variable name="b"> |
| 1255 |
<xsl:apply-templates select=" |
| 1256 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1257 |
child::span[ @class = 'mfrac' ] / |
| 1258 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1259 |
child::span[ @class = 'mfrac' ] / |
| 1260 |
preceding-sibling::*[2] |
| 1261 |
" mode="enum-op" /> |
| 1262 |
</xsl:variable> |
| 1263 |
<xsl:variable name="c"> |
| 1264 |
<xsl:value-of select=" |
| 1265 |
normalize-space( |
| 1266 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1267 |
child::span[ @class = 'mfrac' ] / |
| 1268 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1269 |
child::span[ @class = 'mfrac' ] / |
| 1270 |
child::span[ @class = 'mrow-enumerator' ] ) |
| 1271 |
" /> |
| 1272 |
</xsl:variable> |
| 1273 |
>>> |
| 1274 |
|
| 1275 |
|
| 1276 |
\<frac templates\><<< |
| 1277 |
<xsl:template match="*" mode="enum-op"> |
| 1278 |
<xsl:if test="preceding-sibling::*" > |
| 1279 |
<xsl:apply-templates select=" preceding-sibling::*[1] " /> |
| 1280 |
</xsl:if> |
| 1281 |
<xsl:value-of select="." /> |
| 1282 |
</xsl:template> |
| 1283 |
>>> |
| 1284 |
|
| 1285 |
|
| 1286 |
|
| 1287 |
|
| 1288 |
%%%%%%%%%%%%% |
| 1289 |
\subsubsection{Prepend Existing one} |
| 1290 |
%%%%%%%%%%%%% |
| 1291 |
|
| 1292 |
|
| 1293 |
|
| 1294 |
\<prepend continuos fractions\><<< |
| 1295 |
<xsl:when test=" |
| 1296 |
(@class = 'mfrac') |
| 1297 |
and |
| 1298 |
child::span[ @class = 'mrow-enumerator' ] |
| 1299 |
/ child::span[ @class = 'continuous-mfrac' ] |
| 1300 |
and |
| 1301 |
( normalize-space( |
| 1302 |
child::span[ @class = 'mrow-numerator' ] |
| 1303 |
) |
| 1304 |
= |
| 1305 |
normalize-space( |
| 1306 |
child::span[ @class = 'mrow-enumerator' ] |
| 1307 |
/ child::span[ @class = 'continuous-mfrac' ] |
| 1308 |
/ child::span[ @class = 'mrow-numerator' ] |
| 1309 |
) |
| 1310 |
) |
| 1311 |
and `<check equality of op with cont frac`> |
| 1312 |
" > |
| 1313 |
`<a,b := cont top 2 pre op values`> |
| 1314 |
<xsl:choose> |
| 1315 |
<xsl:when test=" |
| 1316 |
normalize-space($a)=normalize-space($b) |
| 1317 |
" > |
| 1318 |
<xsl:attribute name="class"> |
| 1319 |
<xsl:value-of select=" 'continuous-mfrac' " /> |
| 1320 |
</xsl:attribute> |
| 1321 |
<xsl:apply-templates select="*|text()|comment()" /> |
| 1322 |
</xsl:when> |
| 1323 |
<xsl:otherwise> |
| 1324 |
<xsl:apply-templates select="*|@*|text()|comment()" /> |
| 1325 |
</xsl:otherwise> |
| 1326 |
</xsl:choose> |
| 1327 |
</xsl:when> |
| 1328 |
>>> |
| 1329 |
|
| 1330 |
\<check equality of op with cont frac\><<< |
| 1331 |
( |
| 1332 |
normalize-space( |
| 1333 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1334 |
child::span[ @class = 'mfrac' ] / |
| 1335 |
preceding-sibling::*[1] ) |
| 1336 |
= |
| 1337 |
normalize-space( |
| 1338 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1339 |
child::span[ @class = 'mfrac' ] / |
| 1340 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1341 |
child::span[ @class = 'continuous-mfrac' ] / |
| 1342 |
preceding-sibling::*[1] ) |
| 1343 |
) |
| 1344 |
>>> |
| 1345 |
|
| 1346 |
|
| 1347 |
\<a,b := cont top 2 pre op values\><<< |
| 1348 |
<xsl:variable name="a"> |
| 1349 |
<xsl:apply-templates select=" |
| 1350 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1351 |
child::span[ @class = 'mcontinuous-mfrac' ] / |
| 1352 |
preceding-sibling::*[2] |
| 1353 |
" mode="enum-op" /> |
| 1354 |
</xsl:variable> |
| 1355 |
<xsl:variable name="b"> |
| 1356 |
<xsl:apply-templates select=" |
| 1357 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1358 |
child::span[ @class = 'mcontinuous-mfrac' ] / |
| 1359 |
child::span[ @class = 'mrow-enumerator' ] / |
| 1360 |
child::span[ |
| 1361 |
(@class = 'mfrac') or (@class = 'mcontinuous-mfrac') |
| 1362 |
] / |
| 1363 |
preceding-sibling::*[2] |
| 1364 |
" mode="enum-op" /> |
| 1365 |
</xsl:variable> |
| 1366 |
>>> |
| 1367 |
|
| 1368 |
%%%%%%%%%%%%% |
| 1369 |
\subsection{Word Fractions} |
| 1370 |
%%%%%%%%%%%%% |
| 1371 |
|
| 1372 |
|
| 1373 |
|
| 1374 |
\<constant fracs\><<< |
| 1375 |
<xsl:when test=" |
| 1376 |
(string-length( |
| 1377 |
normalize-space(child::span[ @class = 'mrow-numerator' ][1]) |
| 1378 |
) = 1) |
| 1379 |
and |
| 1380 |
(string-length( |
| 1381 |
normalize-space(child::span[ @class = 'mrow-enumerator' ][1]) |
| 1382 |
) = 1) |
| 1383 |
"> |
| 1384 |
`<a := numerator; b := enumerator`> |
| 1385 |
<xsl:choose> |
| 1386 |
<xsl:when test=" |
| 1387 |
(translate($a,'123456789','') != '') |
| 1388 |
or |
| 1389 |
(translate($b,'123456789','') != '') |
| 1390 |
" > |
| 1391 |
<xsl:apply-templates select="*|@*|text()|comment()" /> |
| 1392 |
</xsl:when> |
| 1393 |
<xsl:when test=" $a < $b "> |
| 1394 |
<xsl:attribute name="class"> |
| 1395 |
<xsl:text>word-frac</xsl:text> |
| 1396 |
</xsl:attribute> |
| 1397 |
`<word numerator`> |
| 1398 |
`<word enumerator`> |
| 1399 |
</xsl:when> |
| 1400 |
<xsl:otherwise> |
| 1401 |
<xsl:apply-templates select="*|@*|text()|comment()" /> |
| 1402 |
</xsl:otherwise> |
| 1403 |
</xsl:choose> |
| 1404 |
</xsl:when> |
| 1405 |
>>> |
| 1406 |
|
| 1407 |
|
| 1408 |
\<a := numerator; b := enumerator\><<< |
| 1409 |
<xsl:variable name="a"> |
| 1410 |
<xsl:value-of select=" |
| 1411 |
normalize-space(child::span[ @class = 'mrow-numerator' ][1]) |
| 1412 |
" /> |
| 1413 |
</xsl:variable> |
| 1414 |
<xsl:variable name="b"> |
| 1415 |
<xsl:value-of select=" |
| 1416 |
normalize-space(child::span[ @class = 'mrow-enumerator' ][1]) |
| 1417 |
" /> |
| 1418 |
</xsl:variable> |
| 1419 |
>>> |
| 1420 |
|
| 1421 |
|
| 1422 |
\<word numerator\><<< |
| 1423 |
<xsl:choose> |
| 1424 |
<xsl:when test=" $a = 1 "><xsl:text> one </xsl:text></xsl:when> |
| 1425 |
<xsl:when test=" $a = 2 "><xsl:text> two </xsl:text></xsl:when> |
| 1426 |
<xsl:when test=" $a = 3 "><xsl:text> three </xsl:text></xsl:when> |
| 1427 |
<xsl:when test=" $a = 4 "><xsl:text> four </xsl:text></xsl:when> |
| 1428 |
<xsl:when test=" $a = 5 "><xsl:text> five </xsl:text></xsl:when> |
| 1429 |
<xsl:when test=" $a = 6 "><xsl:text> six </xsl:text></xsl:when> |
| 1430 |
<xsl:when test=" $a = 7 "><xsl:text> seven </xsl:text></xsl:when> |
| 1431 |
<xsl:when test=" $a = 8 "><xsl:text> eight </xsl:text></xsl:when> |
| 1432 |
<xsl:when test=" $a = 9 "><xsl:text> nine </xsl:text></xsl:when> |
| 1433 |
</xsl:choose> |
| 1434 |
>>> |
| 1435 |
|
| 1436 |
|
| 1437 |
\<word enumerator\><<< |
| 1438 |
<xsl:choose> |
| 1439 |
<xsl:when test=" $b = 2 "><xsl:text> half</xsl:text></xsl:when> |
| 1440 |
<xsl:when test=" $b = 3 "><xsl:text> third</xsl:text></xsl:when> |
| 1441 |
<xsl:when test=" $b = 4 "><xsl:text> fourth</xsl:text></xsl:when> |
| 1442 |
<xsl:when test=" $b = 5 "><xsl:text> fifth</xsl:text></xsl:when> |
| 1443 |
<xsl:when test=" $b = 6 "><xsl:text> sixth</xsl:text></xsl:when> |
| 1444 |
<xsl:when test=" $b = 7 "><xsl:text> seventh</xsl:text></xsl:when> |
| 1445 |
<xsl:when test=" $b = 8 "><xsl:text> eighth</xsl:text></xsl:when> |
| 1446 |
<xsl:when test=" $b = 9 "><xsl:text> nineth</xsl:text></xsl:when> |
| 1447 |
</xsl:choose> |
| 1448 |
<xsl:if test=" $a > 1 "><xsl:text>s</xsl:text></xsl:if> |
| 1449 |
<xsl:text> </xsl:text> |
| 1450 |
>>> |
| 1451 |
|
| 1452 |
|
| 1453 |
%%%%%%%%%%%%% |
| 1454 |
\subsection{Prefix `and' Connectors} |
| 1455 |
%%%%%%%%%%%%% |
| 1456 |
|
| 1457 |
\<fraction 'and' prefix\><<< |
| 1458 |
<xsl:template match="span[ |
| 1459 |
((@class = 'mfrac') and |
| 1460 |
(translate( |
| 1461 |
concat( |
| 1462 |
span[ (@class = 'mrow-numerator')], |
| 1463 |
span[ (@class = 'mrow-enumerator')] |
| 1464 |
) ,'0123456789','') = '') |
| 1465 |
and |
| 1466 |
not(descendant::*/descendant::*/descendant::*) |
| 1467 |
or |
| 1468 |
(@class = 'word-frac')) |
| 1469 |
and |
| 1470 |
preceding-sibling::*[1] |
| 1471 |
/ self::span[ @class = 'mn'] |
| 1472 |
]" > |
| 1473 |
<xsl:text> and </xsl:text> |
| 1474 |
<xsl:copy> |
| 1475 |
<xsl:apply-templates select="*|@*|text()|comment()" /> |
| 1476 |
</xsl:copy> |
| 1477 |
</xsl:template> |
| 1478 |
>>> |
| 1479 |
|
| 1480 |
%%%%%%%%%%%%% |
| 1481 |
\subsection{Hyper Complex Fractions} |
| 1482 |
%%%%%%%%%%%%% |
| 1483 |
|
| 1484 |
|
| 1485 |
\<set levels for hyper complex fracs\><<< |
| 1486 |
<dom name="." xml="." method="fracLevel" class="tex4ht.HtSpk" /> |
| 1487 |
`<remove xml declaration`> |
| 1488 |
>>> |
| 1489 |
|
| 1490 |
|
| 1491 |
|
| 1492 |
\<static void fracLevel(dom)\><<< |
| 1493 |
public static void fracLevel(Node dom) { |
| 1494 |
setFracLevel(dom.getFirstChild(), 0); |
| 1495 |
} |
| 1496 |
private static int setFracLevel(Node node, int cont) { |
| 1497 |
int level = 0; |
| 1498 |
String clName = null; |
| 1499 |
if (node.hasChildNodes()) { |
| 1500 |
if (node.hasAttributes()) { |
| 1501 |
Node cl = node.getAttributes().getNamedItem("class"); |
| 1502 |
if (cl != null) { clName = cl.getNodeValue(); } |
| 1503 |
} |
| 1504 |
`<count levels inherited from children`> |
| 1505 |
if( clName != null ){ |
| 1506 |
`<block on sub and super scripts`> |
| 1507 |
`<deal with continuou fracs`> |
| 1508 |
if (clName.equals("mfrac")) { |
| 1509 |
if( cont > 0 ){ |
| 1510 |
`<remove end of nested continuous frac`> |
| 1511 |
} else if( level > 0 ){ |
| 1512 |
`<set extra levels for frac`> |
| 1513 |
} |
| 1514 |
level++; |
| 1515 |
} } } |
| 1516 |
return level; |
| 1517 |
} |
| 1518 |
>>> |
| 1519 |
|
| 1520 |
|
| 1521 |
\<count levels inherited from children\><<< |
| 1522 |
NodeList children = node.getChildNodes(); |
| 1523 |
int max = 0; |
| 1524 |
for (int i = 0; i < children.getLength(); i++) { |
| 1525 |
Node child = children.item(i); |
| 1526 |
if (child.getNodeType() == Node.ELEMENT_NODE) { |
| 1527 |
int d = setFracLevel(child, |
| 1528 |
(clName != null) && |
| 1529 |
clName.equals("continuous-mfrac")? |
| 1530 |
2 : |
| 1531 |
((clName != null) && |
| 1532 |
clName.equals("continuous-mfrac")? |
| 1533 |
(cont-1) : cont) |
| 1534 |
); |
| 1535 |
if (d > max) { max = d; } |
| 1536 |
} } |
| 1537 |
level += max; |
| 1538 |
>>> |
| 1539 |
|
| 1540 |
|
| 1541 |
|
| 1542 |
|
| 1543 |
The `cont' parameter is for determining whether the parent and the |
| 1544 |
grandparent are frac elements marked as continuous. |
| 1545 |
|
| 1546 |
|
| 1547 |
\<block on sub and super scripts\><<< |
| 1548 |
if( clName.equals("msub") || clName.equals("msup") || |
| 1549 |
clName.equals("msubsup") |
| 1550 |
) { |
| 1551 |
return 0; |
| 1552 |
} |
| 1553 |
>>> |
| 1554 |
|
| 1555 |
|
| 1556 |
\<deal with continuou fracs\><<< |
| 1557 |
if( clName.equals("continuous-mfrac") ) { |
| 1558 |
if( cont > 0 ){ |
| 1559 |
`<remove end of nested continuous frac`> |
| 1560 |
} else { `<set continuous frac`> } `%root of continuous chain`% |
| 1561 |
return 0; |
| 1562 |
} |
| 1563 |
>>> |
| 1564 |
|
| 1565 |
|
| 1566 |
|
| 1567 |
\<set extra levels for frac\><<< |
| 1568 |
for (int i = 0; i < children.getLength(); i++) { |
| 1569 |
Node child = children.item(i); |
| 1570 |
if (child.getNodeType() == Node.ELEMENT_NODE) { |
| 1571 |
Node cls = child.getAttributes() |
| 1572 |
.getNamedItem("class"); |
| 1573 |
if (cls != null) { |
| 1574 |
String clsName = cls.getNodeValue(); |
| 1575 |
if (clsName.equals("begin-end")) { |
| 1576 |
child = child.getFirstChild(); |
| 1577 |
String s = child.getNodeValue(); |
| 1578 |
String bg = "", ov = "", en = ""; |
| 1579 |
for(int j=0; j<level; j++){ |
| 1580 |
bg += " begin "; ov += " over "; en += " end "; |
| 1581 |
} |
| 1582 |
s = s.replaceFirst("begin", bg + "begin"); |
| 1583 |
s = s.replaceFirst("over", ov + "over"); |
| 1584 |
s = s.replaceFirst("end", en + "end"); |
| 1585 |
((org.w3c.dom.Text) child).setData(s); |
| 1586 |
} } } } |
| 1587 |
>>> |
| 1588 |
|
| 1589 |
|
| 1590 |
\<set continuous frac\><<< |
| 1591 |
for (int i = 0; i < children.getLength(); i++) { |
| 1592 |
Node child = children.item(i); |
| 1593 |
if (child.getNodeType() == Node.ELEMENT_NODE) { |
| 1594 |
Node cls = child.getAttributes() |
| 1595 |
.getNamedItem("class"); |
| 1596 |
if (cls != null) { |
| 1597 |
String clsName = cls.getNodeValue(); |
| 1598 |
if ( clsName.equals("begin-end")) { |
| 1599 |
child = child.getFirstChild(); |
| 1600 |
String s = child.getNodeValue(); |
| 1601 |
s = s.replaceFirst("begin", "begin continued"); |
| 1602 |
s = s.replaceFirst("end", "end continued"); |
| 1603 |
((org.w3c.dom.Text) child).setData(s); |
| 1604 |
} } } } |
| 1605 |
>>> |
| 1606 |
|
| 1607 |
\<remove end of nested continuous frac\><<< |
| 1608 |
Node child = node.getLastChild(); |
| 1609 |
if (child.getNodeType() == Node.ELEMENT_NODE) { |
| 1610 |
Node cls = child.getAttributes() .getNamedItem("class"); |
| 1611 |
if (cls != null) { |
| 1612 |
String clsName = cls.getNodeValue(); |
| 1613 |
if ( clsName.equals("begin-end")) { |
| 1614 |
node.removeChild( child ); |
| 1615 |
} } } |
| 1616 |
>>> |
| 1617 |
|
| 1618 |
|
| 1619 |
|
| 1620 |
|
| 1621 |
%%%%%%%%%%%%% |
| 1622 |
\subsection{Set Levels on Roots} |
| 1623 |
%%%%%%%%%%%%% |
| 1624 |
|
| 1625 |
\<set levels for roots\><<< |
| 1626 |
<dom name="." xml="." method="rootLevel" class="tex4ht.HtSpk" /> |
| 1627 |
`<remove xml declaration`> |
| 1628 |
>>> |
| 1629 |
|
| 1630 |
\<static void rootLevel(dom)\><<< |
| 1631 |
public static void rootLevel(Node dom) { |
| 1632 |
setRootLevel(dom.getFirstChild()); |
| 1633 |
} |
| 1634 |
private static int setRootLevel( Node node ){ |
| 1635 |
int level = 0; |
| 1636 |
String clName = null; |
| 1637 |
if (node.hasChildNodes()) { |
| 1638 |
if (node.hasAttributes()) { |
| 1639 |
Node cl = node.getAttributes().getNamedItem("class"); |
| 1640 |
if (cl != null) { clName = cl.getNodeValue(); } |
| 1641 |
} |
| 1642 |
`<count root levels inherited from children`> |
| 1643 |
if( clName != null ){ |
| 1644 |
`<block for roots`> |
| 1645 |
if( clName.equals("msqrt") || clName.equals("root") ){ |
| 1646 |
`<set extra levels for roots`> |
| 1647 |
level++; |
| 1648 |
} } } |
| 1649 |
return level; |
| 1650 |
} |
| 1651 |
>>> |
| 1652 |
|
| 1653 |
|
| 1654 |
\<count root levels inherited from children\><<< |
| 1655 |
NodeList children = node.getChildNodes(); |
| 1656 |
int max = 0; |
| 1657 |
for (int i = 0; i < children.getLength(); i++) { |
| 1658 |
Node child = children.item(i); |
| 1659 |
if (child.getNodeType() == Node.ELEMENT_NODE) { |
| 1660 |
int d = setRootLevel(child); |
| 1661 |
if( d > max ){ max = d; } |
| 1662 |
} } |
| 1663 |
level += max; |
| 1664 |
>>> |
| 1665 |
|
| 1666 |
|
| 1667 |
\<block for roots\><<< |
| 1668 |
if( clName.equals("msub") || clName.equals("msup") || |
| 1669 |
clName.equals("msubsup") |
| 1670 |
) { |
| 1671 |
return 0; |
| 1672 |
} |
| 1673 |
>>> |
| 1674 |
|
| 1675 |
|
| 1676 |
|
| 1677 |
|
| 1678 |
\<set extra levels for roots\><<< |
| 1679 |
for (int i = 0; i < children.getLength(); i++) { |
| 1680 |
Node child = children.item(i); |
| 1681 |
if (child.getNodeType() == Node.ELEMENT_NODE) { |
| 1682 |
Node cls = child.getAttributes() |
| 1683 |
.getNamedItem("class"); |
| 1684 |
if (cls != null) { |
| 1685 |
String clsName = cls.getNodeValue(); |
| 1686 |
if( clsName.equals("begin-root") |
| 1687 |
|| clsName.equals("mid-root") |
| 1688 |
|| clsName.equals("end-root") |
| 1689 |
){ |
| 1690 |
child = child.getFirstChild(); |
| 1691 |
String s = child.getNodeValue(); |
| 1692 |
String nested = ""; |
| 1693 |
for(int j=0; j<level; j++){ |
| 1694 |
nested += " nested "; |
| 1695 |
} |
| 1696 |
((org.w3c.dom.Text) child).setData( nested + s); |
| 1697 |
} } } } |
| 1698 |
>>> |
| 1699 |
|
| 1700 |
|
| 1701 |
|
| 1702 |
%%%%%%%%%%%%%%%%%% |
| 1703 |
\section{Odd Ends} |
| 1704 |
%%%%%%%%%%%%%%%%%% |
| 1705 |
|
| 1706 |
%%%%%%%%%%%%% |
| 1707 |
\subsection{Remove Empty Array Cells} |
| 1708 |
%%%%%%%%%%%%% |
| 1709 |
|
| 1710 |
Empty array celles at end of rows can make it more difficult to |
| 1711 |
detect deletable baseline indicators. |
| 1712 |
|
| 1713 |
|
| 1714 |
|
| 1715 |
\<remove multline eqnum cell\><<< |
| 1716 |
<script element="div::tr" > |
| 1717 |
<set name="bold" > |
| 1718 |
`<open xslt script`> |
| 1719 |
`<remove empty cells from rows`> |
| 1720 |
`<close xslt script`> |
| 1721 |
</set> |
| 1722 |
<xslt name="." xml="." xsl="bold" /> |
| 1723 |
</script> |
| 1724 |
>>> |
| 1725 |
|
| 1726 |
\<remove empty cells from rows\><<< |
| 1727 |
<xsl:template match="div[ |
| 1728 |
parent::div[ @class = 'tr' ] |
| 1729 |
and ( normalize-space(.) = '' ) |
| 1730 |
and not( normalize-space(following-sibling::*) != '' ) |
| 1731 |
]" > |
| 1732 |
</xsl:template> |
| 1733 |
>>> |
| 1734 |
|
| 1735 |
|
| 1736 |
|
| 1737 |
|
| 1738 |
|
| 1739 |
%%%%%%%%%%%%% |
| 1740 |
\subsection{'minus' into 'negative'} |
| 1741 |
%%%%%%%%%%%%% |
| 1742 |
|
| 1743 |
|
| 1744 |
|
| 1745 |
\<'minus' into 'negative'\><<< |
| 1746 |
<xsl:template match="span[ |
| 1747 |
(@class = 'mo-bin') |
| 1748 |
and |
| 1749 |
( preceding-sibling::*[ |
| 1750 |
(position()=1) |
| 1751 |
and |
| 1752 |
( (@title='speech-extra') |
| 1753 |
or (@class='mo-bin') |
| 1754 |
or (@class='mo-rel') ) |
| 1755 |
] |
| 1756 |
and |
| 1757 |
( |
| 1758 |
following-sibling::*[ (@class='mn') or (@class='mi') ] |
| 1759 |
or |
| 1760 |
(count(following-sibling::*[ |
| 1761 |
not(@title = 'speech-extra') |
| 1762 |
]) = 1) |
| 1763 |
) |
| 1764 |
or |
| 1765 |
not(preceding-sibling::*) |
| 1766 |
) |
| 1767 |
and |
| 1768 |
(normalize-space(.)='minus') |
| 1769 |
]" > |
| 1770 |
<xsl:copy> |
| 1771 |
<xsl:attribute name="class"> |
| 1772 |
<xsl:text>mo-unary</xsl:text> |
| 1773 |
</xsl:attribute> |
| 1774 |
<xsl:apply-templates select="*|text()|comment()" |
| 1775 |
mode="minus-neg" /> |
| 1776 |
</xsl:copy> |
| 1777 |
</xsl:template> |
| 1778 |
>>> |
| 1779 |
|
| 1780 |
|
| 1781 |
\<'minus' into 'negative'\><<< |
| 1782 |
<xsl:template match="*|@*|text()|comment()" mode="minus-neg" > |
| 1783 |
<xsl:copy> |
| 1784 |
<xsl:apply-templates select="*|@*|text()|comment()" |
| 1785 |
mode="minus-neg" /> |
| 1786 |
</xsl:copy> |
| 1787 |
</xsl:template> |
| 1788 |
>>> |
| 1789 |
|
| 1790 |
\begin{verbatim} |
| 1791 |
<span class="begin-script"> subscript </span> |
| 1792 |
<span class="mo-bin"> |
| 1793 |
<span class="char"> |
| 1794 |
<span class="ch 2212">minus</span> |
| 1795 |
</span> |
| 1796 |
</Span> |
| 1797 |
<span class="mn">2</span> |
| 1798 |
\end{verbatim} |
| 1799 |
|
| 1800 |
|
| 1801 |
|
| 1802 |
|
| 1803 |
\<'minus' into 'negative'\><<< |
| 1804 |
<xsl:template match="text()" mode="minus-neg" > |
| 1805 |
<xsl:choose> |
| 1806 |
<xsl:when test=" . = 'minus' " > |
| 1807 |
<xsl:text>negative</xsl:text> |
| 1808 |
</xsl:when> |
| 1809 |
<xsl:otherwise> |
| 1810 |
<xsl:value-of select="." /> |
| 1811 |
</xsl:otherwise> |
| 1812 |
</xsl:choose> |
| 1813 |
</xsl:template> |
| 1814 |
>>> |
| 1815 |
|
| 1816 |
%%%%%%%%%%%%% |
| 1817 |
\subsection{Short-Cuts for Modifiers} |
| 1818 |
%%%%%%%%%%%%% |
| 1819 |
|
| 1820 |
\<short cut modifiers\><<< |
| 1821 |
<script element="span::munder-underline" > |
| 1822 |
<set name="munder" > |
| 1823 |
`<open xslt script`> |
| 1824 |
`<get content template`> |
| 1825 |
`<under modifier templates`> |
| 1826 |
`<close xslt script`> |
| 1827 |
</set> |
| 1828 |
<xslt name="." xml="." xsl="munder" /> |
| 1829 |
</script> |
| 1830 |
>>> |
| 1831 |
|
| 1832 |
|
| 1833 |
|
| 1834 |
|
| 1835 |
\<short cut modifiers\><<< |
| 1836 |
<script element="span::mover-overline" > |
| 1837 |
<set name="mover" > |
| 1838 |
`<open xslt script`> |
| 1839 |
`<get content template`> |
| 1840 |
`<over modifier templates`> |
| 1841 |
`<close xslt script`> |
| 1842 |
</set> |
| 1843 |
<xslt name="." xml="." xsl="mover" /> |
| 1844 |
</script> |
| 1845 |
>>> |
| 1846 |
|
| 1847 |
|
| 1848 |
|
| 1849 |
|
| 1850 |
|
| 1851 |
|
| 1852 |
|
| 1853 |
|
| 1854 |
|
| 1855 |
\<under modifier templates\><<< |
| 1856 |
<xsl:template match="span[ |
| 1857 |
(@class = 'munder-underline') |
| 1858 |
and |
| 1859 |
child::span[ |
| 1860 |
(@class = 'mo-0332') |
| 1861 |
and |
| 1862 |
descendant::span[ @class = 'mi' ] |
| 1863 |
] |
| 1864 |
]" > |
| 1865 |
<xsl:copy> |
| 1866 |
<xsl:apply-templates select="@*" /> |
| 1867 |
<xsl:variable name="content"> |
| 1868 |
<xsl:apply-templates select="*" mode="content" /> |
| 1869 |
</xsl:variable> |
| 1870 |
<xsl:choose> |
| 1871 |
<xsl:when test=" |
| 1872 |
string-length( normalize-space( $content )) = 1 |
| 1873 |
" > |
| 1874 |
<xsl:apply-templates |
| 1875 |
select=" *[ @class != 'begin-end' ] " /> |
| 1876 |
<span class="begin-end" title="speech-extra" > |
| 1877 |
<xsl:text> under bar </xsl:text> |
| 1878 |
</span> |
| 1879 |
</xsl:when> |
| 1880 |
<xsl:otherwise> |
| 1881 |
<xsl:apply-templates select="*|text()|comment()" /> |
| 1882 |
</xsl:otherwise> |
| 1883 |
</xsl:choose> |
| 1884 |
</xsl:copy> |
| 1885 |
</xsl:template> |
| 1886 |
>>> |
| 1887 |
|
| 1888 |
|
| 1889 |
|
| 1890 |
|
| 1891 |
|
| 1892 |
|
| 1893 |
|
| 1894 |
|
| 1895 |
\<over modifier templates\><<< |
| 1896 |
<xsl:template match="span[ |
| 1897 |
(@class = 'mover-overline') |
| 1898 |
and |
| 1899 |
child::span[ |
| 1900 |
(@class = 'mo-00AF') |
| 1901 |
and |
| 1902 |
descendant::span[ @class = 'mi' ] |
| 1903 |
] |
| 1904 |
]" > |
| 1905 |
<xsl:copy> |
| 1906 |
<xsl:apply-templates select="@*" /> |
| 1907 |
<xsl:variable name="content"> |
| 1908 |
<xsl:apply-templates select="*" mode="content" /> |
| 1909 |
</xsl:variable> |
| 1910 |
<xsl:choose> |
| 1911 |
<xsl:when test=" |
| 1912 |
string-length( normalize-space( $content )) = 1 |
| 1913 |
" > |
| 1914 |
<xsl:apply-templates |
| 1915 |
select=" *[ @class != 'begin-end' ] " /> |
| 1916 |
<span class="begin-end" title="speech-extra" > |
| 1917 |
<xsl:text> over bar </xsl:text> |
| 1918 |
</span> |
| 1919 |
</xsl:when> |
| 1920 |
<xsl:otherwise> |
| 1921 |
<xsl:apply-templates select="*|text()|comment()" /> |
| 1922 |
</xsl:otherwise> |
| 1923 |
</xsl:choose> |
| 1924 |
</xsl:copy> |
| 1925 |
</xsl:template> |
| 1926 |
>>> |
| 1927 |
|
| 1928 |
|
| 1929 |
|
| 1930 |
\begin{verbatim} |
| 1931 |
<span class="mover-overline"> |
| 1932 |
<span class="begin-end" title="speech-extra"> modified above </span> |
| 1933 |
<span class="mo-00AF"> |
| 1934 |
<span class="mathvariant-bold"> |
| 1935 |
<span title="speech-extra" class="begin-end"> bold </span> |
| 1936 |
<span class="mi"> |
| 1937 |
<span title="speech-extra" |
| 1938 |
class="capital-description"> capital </span> |
| 1939 |
Z |
| 1940 |
</span> |
| 1941 |
</span> |
| 1942 |
</span> |
| 1943 |
<span class="begin-end" title="speech-extra"> with bar </span> |
| 1944 |
</span> |
| 1945 |
\end{verbatim} |
| 1946 |
|
| 1947 |
|
| 1948 |
|
| 1949 |
\begin{verbatim} |
| 1950 |
<span class="munder-underline"> |
| 1951 |
<span class="begin-end" title="speech-extra" > modified under </span> |
| 1952 |
<span class="mo-0332"> |
| 1953 |
<span class="mi">x</span> |
| 1954 |
</span> |
| 1955 |
<span class="begin-end" title="speech-extra" > with bar </span> |
| 1956 |
</span> |
| 1957 |
\end{verbatim} |
| 1958 |
|
| 1959 |
%%%%%%%%%%%%% |
| 1960 |
\subsection{Font Decorations} |
| 1961 |
%%%%%%%%%%%%% |
| 1962 |
|
| 1963 |
|
| 1964 |
|
| 1965 |
|
| 1966 |
|
| 1967 |
\<bold math\><<< |
| 1968 |
<script element="span::mathvariant-bold" > |
| 1969 |
<set name="bold" > |
| 1970 |
`<open xslt script`> |
| 1971 |
`<get content template`> |
| 1972 |
`<math bold templates`> |
| 1973 |
`<close xslt script`> |
| 1974 |
</set> |
| 1975 |
<xslt name="." xml="." xsl="bold" /> |
| 1976 |
</script> |
| 1977 |
>>> |
| 1978 |
|
| 1979 |
|
| 1980 |
|
| 1981 |
\<math bold templates\><<< |
| 1982 |
<xsl:template match="span[ @class = 'mathvariant-bold' ]" > |
| 1983 |
<xsl:copy> |
| 1984 |
<xsl:apply-templates select="@*" /> |
| 1985 |
<xsl:variable name="content"> |
| 1986 |
<xsl:apply-templates select="*" mode="content" /> |
| 1987 |
</xsl:variable> |
| 1988 |
<xsl:choose> |
| 1989 |
<xsl:when test=" |
| 1990 |
string-length( normalize-space( $content )) = 1 |
| 1991 |
" > |
| 1992 |
<span class="begin-end" title="speech-extra" > |
| 1993 |
<xsl:text> bold </xsl:text> |
| 1994 |
</span> |
| 1995 |
<xsl:apply-templates select="*|text()|comment()" /> |
| 1996 |
</xsl:when> |
| 1997 |
<xsl:otherwise> |
| 1998 |
<span class="begin-end" title="speech-extra" > |
| 1999 |
<xsl:text> begin bold </xsl:text> |
| 2000 |
</span> |
| 2001 |
<xsl:apply-templates select="*|text()|comment()" /> |
| 2002 |
<span class="begin-end" title="speech-extra" > |
| 2003 |
<xsl:text> end bold </xsl:text> |
| 2004 |
</span> |
| 2005 |
</xsl:otherwise> |
| 2006 |
</xsl:choose> |
| 2007 |
</xsl:copy> |
| 2008 |
</xsl:template> |
| 2009 |
>>> |
| 2010 |
|
| 2011 |
|
| 2012 |
%%%%%%%%%%%%% |
| 2013 |
\section{Eliminate Inline Math Narrative} |
| 2014 |
%%%%%%%%%%%%% |
| 2015 |
|
| 2016 |
|
| 2017 |
%%%%%%%%%%%%% |
| 2018 |
\subsection{Simple Sub-Sup (Core Content of Length One)} |
| 2019 |
%%%%%%%%%%%%% |
| 2020 |
|
| 2021 |
|
| 2022 |
|
| 2023 |
|
| 2024 |
\<eliminate inline math narrative\><<< |
| 2025 |
<xsl:template match="span[ |
| 2026 |
(@class = 'inline-math') |
| 2027 |
and |
| 2028 |
(count( `<math content element`> ) = 1) |
| 2029 |
]" > |
| 2030 |
<xsl:copy> |
| 2031 |
<xsl:variable name="content"> |
| 2032 |
<xsl:apply-templates |
| 2033 |
select="`<math content element`>" |
| 2034 |
mode="content" /> |
| 2035 |
</xsl:variable> |
| 2036 |
<xsl:choose> |
| 2037 |
<xsl:when test=" |
| 2038 |
string-length( normalize-space( $content )) = 1 |
| 2039 |
" > |
| 2040 |
<xsl:attribute name="class"> |
| 2041 |
<xsl:text>semi-math</xsl:text> |
| 2042 |
</xsl:attribute> |
| 2043 |
<xsl:apply-templates select="`<math content element`>" /> |
| 2044 |
</xsl:when> |
| 2045 |
`<simple sub or sup`> |
| 2046 |
<xsl:otherwise> |
| 2047 |
<xsl:apply-templates select="*|@*|comment()|text()" /> |
| 2048 |
</xsl:otherwise> |
| 2049 |
</xsl:choose> |
| 2050 |
</xsl:copy> |
| 2051 |
</xsl:template> |
| 2052 |
>>> |
| 2053 |
|
| 2054 |
|
| 2055 |
\<math content element\><<< |
| 2056 |
child::*[ not(@title) or (@title != 'speech-extra') ] |
| 2057 |
>>> |
| 2058 |
|
| 2059 |
|
| 2060 |
\<simple sub or sup\><<< |
| 2061 |
<xsl:when test=" child::*[ |
| 2062 |
(position() = 2) |
| 2063 |
and |
| 2064 |
((@class = 'msub') or (@class = 'msup') or (@class = 'msubsup')) |
| 2065 |
]" > |
| 2066 |
<xsl:variable name="content"> |
| 2067 |
<xsl:apply-templates select="child::*[2] / child::*[ |
| 2068 |
@class = 'mrow-base' ]" |
| 2069 |
mode="content" /> |
| 2070 |
</xsl:variable> |
| 2071 |
<xsl:choose> |
| 2072 |
<xsl:when test=" |
| 2073 |
string-length( normalize-space( $content )) = 1 |
| 2074 |
" > |
| 2075 |
<xsl:attribute name="class"> |
| 2076 |
<xsl:text>semi-math</xsl:text> |
| 2077 |
</xsl:attribute> |
| 2078 |
<xsl:apply-templates select="*[2]" /> |
| 2079 |
`% |
| 2080 |
<span class="end-script" title="speech-extra"> |
| 2081 |
<xsl:text> baseline </xsl:text> |
| 2082 |
</span> |
| 2083 |
`% |
| 2084 |
</xsl:when> |
| 2085 |
<xsl:otherwise> |
| 2086 |
<xsl:apply-templates select="*|@*|comment()|text()" /> |
| 2087 |
</xsl:otherwise> |
| 2088 |
</xsl:choose> |
| 2089 |
</xsl:when> |
| 2090 |
>>> |
| 2091 |
|
| 2092 |
|
| 2093 |
\begin{verbatim} |
| 2094 |
<span class="inline-math"> |
| 2095 |
<span class="msub"> |
| 2096 |
<span class="mrow-base"> |
| 2097 |
<span class="mi">C</span> |
| 2098 |
</span> |
| 2099 |
<span class="mrow-sub"> |
| 2100 |
<span class="mi">i</span> |
| 2101 |
</span> |
| 2102 |
</span> |
| 2103 |
</span> |
| 2104 |
\end{verbatim} |
| 2105 |
|
| 2106 |
|
| 2107 |
|
| 2108 |
|
| 2109 |
%%%%%%%%%%%%% |
| 2110 |
\subsection{Unary Op on Core Content of Length One} |
| 2111 |
%%%%%%%%%%%%% |
| 2112 |
|
| 2113 |
The `mo-unary' is established in the first pass over inline-math, |
| 2114 |
so we need to wait for the second pass with the following. |
| 2115 |
|
| 2116 |
|
| 2117 |
\<eliminate inline math narrative 2\><<< |
| 2118 |
<xsl:template match="span[ |
| 2119 |
(@class = 'inline-math') |
| 2120 |
and |
| 2121 |
(count( `<math content element`> ) = 2) |
| 2122 |
and |
| 2123 |
child::span[ |
| 2124 |
(@class = 'mo-unary') |
| 2125 |
and |
| 2126 |
following-sibling::*[1] |
| 2127 |
/ descendant::span[ @class = 'mi' ] |
| 2128 |
] |
| 2129 |
]" > |
| 2130 |
<xsl:copy> |
| 2131 |
<xsl:variable name="content"> |
| 2132 |
<xsl:apply-templates |
| 2133 |
select="child::*[ |
| 2134 |
(not(@title) or (@title != 'speech-extra')) |
| 2135 |
and not( @class = 'mo-unary' ) |
| 2136 |
]" |
| 2137 |
mode="content" /> |
| 2138 |
</xsl:variable> |
| 2139 |
<xsl:choose> |
| 2140 |
<xsl:when test=" |
| 2141 |
string-length( normalize-space( $content )) = 1 |
| 2142 |
" > |
| 2143 |
<xsl:attribute name="class"> |
| 2144 |
<xsl:text>semi-math</xsl:text> |
| 2145 |
</xsl:attribute> |
| 2146 |
<xsl:apply-templates select="`<math content element`>" /> |
| 2147 |
</xsl:when> |
| 2148 |
<xsl:otherwise> |
| 2149 |
<xsl:apply-templates select="*|@*|comment()|text()" /> |
| 2150 |
</xsl:otherwise> |
| 2151 |
</xsl:choose> |
| 2152 |
</xsl:copy> |
| 2153 |
</xsl:template> |
| 2154 |
>>> |
| 2155 |
|
| 2156 |
|
| 2157 |
|
| 2158 |
\begin{verbatim} |
| 2159 |
<span class="inline-math"> |
| 2160 |
<span class="begin-math" title="speech-extra"> begin math </span> |
| 2161 |
<span name="mo-unary"> |
| 2162 |
<span class="char" title="ch-verbose"> |
| 2163 |
<span class="ch 2212" title="ch-verbose">negative</span> |
| 2164 |
</span> |
| 2165 |
</span> |
| 2166 |
<span class="mathvariant-bold"> |
| 2167 |
<span title="speech-extra" class="begin-end"> bold </span> |
| 2168 |
<span title="speech-extra" class="space"><!----> </span> |
| 2169 |
<span class="mi"> |
| 2170 |
<span title="speech-extra" class="capital-description"> |
| 2171 |
capital |
| 2172 |
</span> |
| 2173 |
A |
| 2174 |
</span> |
| 2175 |
</span> |
| 2176 |
<span class="end-math" title="speech-extra">end math</span> |
| 2177 |
</span> |
| 2178 |
\end{verbatim} |
| 2179 |
|
| 2180 |
%%%%%%%%%%%%%%%%%% |
| 2181 |
\section{Empty Elements} |
| 2182 |
%%%%%%%%%%%%%%%%%% |
| 2183 |
|
| 2184 |
|
| 2185 |
%%%%%%%%%%%%% |
| 2186 |
\subsection{Set for W3} |
| 2187 |
%%%%%%%%%%%%% |
| 2188 |
|
| 2189 |
|
| 2190 |
|
| 2191 |
\<set empty elements for the w3 browser\><<< |
| 2192 |
<set name="empty-el" > |
| 2193 |
`<open xslt script`> |
| 2194 |
`<tags for empty templates`> |
| 2195 |
`<close xslt script`> |
| 2196 |
</set> |
| 2197 |
<xslt name="." xml="." xsl="empty-el" /> |
| 2198 |
>>> |
| 2199 |
|
| 2200 |
\<tags for empty templates\><<< |
| 2201 |
<xsl:template match="*[ not(child::*) ]" > |
| 2202 |
<xsl:copy> |
| 2203 |
<xsl:apply-templates select="@*|comment()|text()" /> |
| 2204 |
<xsl:if test=" normalize-space(.) = '' " > |
| 2205 |
<xsl:comment>`<comment`></xsl:comment> |
| 2206 |
</xsl:if> |
| 2207 |
</xsl:copy> |
| 2208 |
</xsl:template> |
| 2209 |
>>> |
| 2210 |
|
| 2211 |
Note: Java 5 complains when comments contain just white spaced. |
| 2212 |
|
| 2213 |
|
| 2214 |
\<comment\><<< |
| 2215 |
.>>> |
| 2216 |
|
| 2217 |
%%%%%%%%%%%%% |
| 2218 |
\subsection{Remove Split Arrays} |
| 2219 |
%%%%%%%%%%%%% |
| 2220 |
|
| 2221 |
\<remove empty split entries\><<< |
| 2222 |
<script element="div::split-side" > |
| 2223 |
<set name="clean-split" > |
| 2224 |
`<open xslt script`> |
| 2225 |
`<get content template`> |
| 2226 |
`<clean math split`> |
| 2227 |
`<close xslt script`> |
| 2228 |
</set> |
| 2229 |
<xslt name="." xml="." xsl="clean-split" /> |
| 2230 |
</script> |
| 2231 |
>>> |
| 2232 |
|
| 2233 |
|
| 2234 |
\<clean math split\><<< |
| 2235 |
<xsl:template match=" div[ @class='split-side' ] |
| 2236 |
" > |
| 2237 |
<xsl:variable name="content"> |
| 2238 |
<xsl:apply-templates select="*" mode="content" /> |
| 2239 |
</xsl:variable> |
| 2240 |
<xsl:if test=" |
| 2241 |
string-length( normalize-space( $content )) != 0 |
| 2242 |
" > |
| 2243 |
<xsl:copy> |
| 2244 |
<xsl:apply-templates select=" *|@*|text()|comment() " /> |
| 2245 |
</xsl:copy> |
| 2246 |
</xsl:if> |
| 2247 |
</xsl:template> |
| 2248 |
>>> |
| 2249 |
|
| 2250 |
|
| 2251 |
%%%%%%%%%%%%%%%%%% |
| 2252 |
\section{Spaces around Math Identifiers} |
| 2253 |
%%%%%%%%%%%%%%%%%% |
| 2254 |
|
| 2255 |
The following is to cause a pause. For instance, between the |
| 2256 |
variables in \verb+<mi>i</mi><mi>j</mi>+. |
| 2257 |
|
| 2258 |
|
| 2259 |
\<insert pre mi spaces\><<< |
| 2260 |
<xsl:template match="span[ @class = 'mi' ]" > |
| 2261 |
<span class="space" title="speech-extra"> |
| 2262 |
<xsl:text> </xsl:text> |
| 2263 |
</span> |
| 2264 |
<xsl:copy> |
| 2265 |
<xsl:apply-templates select="*|@*|text()|comment()" /> |
| 2266 |
</xsl:copy> |
| 2267 |
</xsl:template> |
| 2268 |
>>> |
| 2269 |
|
| 2270 |
|
| 2271 |
|
| 2272 |
%%%%%%%%%%%%%%%%%% |
| 2273 |
\section{Prose} |
| 2274 |
%%%%%%%%%%%%%%%%%% |
| 2275 |
|
| 2276 |
%%%%%%%%%%%%% |
| 2277 |
\subsection{Tables} |
| 2278 |
%%%%%%%%%%%%% |
| 2279 |
|
| 2280 |
\<measure tablesREMOVE\><<< |
| 2281 |
<script element="div::table" > |
| 2282 |
<set name="rows" > |
| 2283 |
`<open xslt script`> |
| 2284 |
`<record number of rows`> |
| 2285 |
`<close xslt script`> |
| 2286 |
</set> |
| 2287 |
<xslt name="." xml="." xsl="rows" /> |
| 2288 |
</script> |
| 2289 |
>>> |
| 2290 |
|
| 2291 |
|
| 2292 |
\<record number of rowsREMOVE\><<< |
| 2293 |
<xsl:template match=" |
| 2294 |
div[ (@class='table') |
| 2295 |
and |
| 2296 |
((@title='tabular') or (@title='array')) |
| 2297 |
] |
| 2298 |
" > |
| 2299 |
<xsl:copy> |
| 2300 |
<xsl:apply-templates select="@*" /> |
| 2301 |
<div class="begin-end" title="speech-extra"> |
| 2302 |
<xsl:value-of select=" |
| 2303 |
concat( child::*[1] /self::div[ |
| 2304 |
(@class = 'begin-end') and (@title = 'speech-extra') |
| 2305 |
], |
| 2306 |
' with ', |
| 2307 |
count(child::*) - 2 , |
| 2308 |
' rows ' |
| 2309 |
) " /> |
| 2310 |
</div> |
| 2311 |
<xsl:apply-templates select=" *[position() > 1] |
| 2312 |
| @* | text() | comment() " /> |
| 2313 |
</xsl:copy> |
| 2314 |
</xsl:template> |
| 2315 |
>>> |
| 2316 |
|
| 2317 |
|
| 2318 |
|
| 2319 |
|
| 2320 |
|
| 2321 |
%%%%%%%%%%%%% |
| 2322 |
\subsection{New Theorems} |
| 2323 |
%%%%%%%%%%%%% |
| 2324 |
|
| 2325 |
\<boundaries on theorems\><<< |
| 2326 |
<script element="div::newtheorem" > |
| 2327 |
<set name="newtheorem" > |
| 2328 |
`<open xslt script`> |
| 2329 |
`<annotate bounderies of theorems`> |
| 2330 |
`<tags for empty templates`> |
| 2331 |
`<close xslt script`> |
| 2332 |
</set> |
| 2333 |
<xslt name="." xml="." xsl="newtheorem" /> |
| 2334 |
</script> |
| 2335 |
>>> |
| 2336 |
|
| 2337 |
|
| 2338 |
\<annotate bounderies of theorems\><<< |
| 2339 |
<xsl:template match=" |
| 2340 |
div[ (@class='newtheorem') |
| 2341 |
and |
| 2342 |
child::*[1] / child::span[ @class = 'theorem-head' ] |
| 2343 |
] |
| 2344 |
" > |
| 2345 |
<xsl:copy> |
| 2346 |
<xsl:apply-templates select="*|@*|text()|comment()" /> |
| 2347 |
<div class="begin-end" title="speech-extra"> |
| 2348 |
<xsl:value-of select=" |
| 2349 |
concat( ' end ', |
| 2350 |
string( child::*[1] / |
| 2351 |
child::span[ @class = 'theorem-head' ] ) |
| 2352 |
) " /> |
| 2353 |
</div> |
| 2354 |
</xsl:copy> |
| 2355 |
</xsl:template> |
| 2356 |
>>> |
| 2357 |
|
| 2358 |
|
| 2359 |
|
| 2360 |
|
| 2361 |
|
| 2362 |
|
| 2363 |
|
| 2364 |
|
| 2365 |
|
| 2366 |
%%%%%%%%%%%%%%%%%% |
| 2367 |
\section{Shared} |
| 2368 |
%%%%%%%%%%%%%%%%%% |
| 2369 |
|
| 2370 |
|
| 2371 |
|
| 2372 |
\<open xslt script\><<< |
| 2373 |
<![CDATA[ |
| 2374 |
<xsl:stylesheet version="1.0" |
| 2375 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 2376 |
> |
| 2377 |
<xsl:output omit-xml-declaration = "yes" /> |
| 2378 |
>>> |
| 2379 |
|
| 2380 |
\<close xslt script\><<< |
| 2381 |
<xsl:template match="*|@*|text()|comment()" > |
| 2382 |
<xsl:copy> |
| 2383 |
<xsl:apply-templates select="*|@*|text()|comment()" /> |
| 2384 |
</xsl:copy> |
| 2385 |
</xsl:template> |
| 2386 |
</xsl:stylesheet> |
| 2387 |
]]> |
| 2388 |
>>> |
| 2389 |
|
| 2390 |
|
| 2391 |
\<get content template\><<< |
| 2392 |
<xsl:template match="*" mode="content" > |
| 2393 |
<xsl:choose> |
| 2394 |
<xsl:when test=" @class = 'char' " > |
| 2395 |
<xsl:text>x</xsl:text> |
| 2396 |
</xsl:when> |
| 2397 |
<xsl:when test=" not( |
| 2398 |
(@title = 'speech-extra') or (@class = 'accent-char') |
| 2399 |
) " > |
| 2400 |
<xsl:apply-templates select="*|text()" mode="content" /> |
| 2401 |
</xsl:when> |
| 2402 |
</xsl:choose> |
| 2403 |
</xsl:template> |
| 2404 |
>>> |
| 2405 |
|
| 2406 |
|
| 2407 |
%%%%%%%%%%%%%%%%%% |
| 2408 |
\section{To Do} |
| 2409 |
%%%%%%%%%%%%%%%%%% |
| 2410 |
|
| 2411 |
\begin{itemize} |
| 2412 |
\item |
| 2413 |
Left subscripts and tensors. |
| 2414 |
\end{itemize} |
| 2415 |
|
| 2416 |
|
| 2417 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2418 |
|
| 2419 |
\ifdojava |
| 2420 |
\AtEndDocument{\Needs{% |
| 2421 |
"pushd \XTPIPES || exit 1 |
| 2422 |
; |
| 2423 |
jar cf tex4ht.jar * |
| 2424 |
; |
| 2425 |
popd |
| 2426 |
; |
| 2427 |
mkdir -p \TEXMFTEXivBIN || exit 1 |
| 2428 |
; |
| 2429 |
mv \XTPIPES tex4ht.jar \TEXMFTEXivBIN . |
| 2430 |
"}} |
| 2431 |
\fi |
| 2432 |
|
| 2433 |
|
| 2434 |
|
| 2435 |
\end{document} |
| 2436 |
|
| 2437 |
|
| 2438 |
|
| 2439 |
|
| 2440 |
|