diff --git a/lib/LaTeXML/Package/TeX.pool.ltxml b/lib/LaTeXML/Package/TeX.pool.ltxml index dbc9308fd..d9019fb2b 100644 --- a/lib/LaTeXML/Package/TeX.pool.ltxml +++ b/lib/LaTeXML/Package/TeX.pool.ltxml @@ -4531,6 +4531,35 @@ DefMacroI('\active@math@prime', undef, sub { AssignMathcode("'" => 0x8000); Let("'", '\active@math@prime'); +# Experiment: When we detect a math element containing solely a floating superscript in the +# *Frontmatter* of a document, assume it is a note mark, and normalize it down to +# plain text. +DefRewrite(xpath => 'descendant::ltx:Math[child::ltx:XMath[child::ltx:XMApp[' . + '(@role="FLOATSUPERSCRIPT" or @role="FLOATSUBSCRIPT") and ' . + 'not(preceding-sibling::*) and not(following-sibling::*) ' . + 'and not(./*/*[not(self::ltx:XMTok)]) ]]]', + replace => sub { + my ($document, $math) = @_; + # We can assume the grandchild of the XMath node is the XMArg, + # which we need to normalize to scripted Unicode. + if (my @xmath = element_nodes($math)) { + if (my @xmapp = element_nodes($xmath[0])) { + if (my @xmarg = element_nodes($xmapp[0])) { + if (my $role = $xmapp[0]->getAttribute('role')) { + my $text = $xmarg[0]->textContent; + local $LaTeXML::BOX = $document->getNodeBox($xmarg[0]); + if ($role eq 'FLOATSUPERSCRIPT') { + $document->insertElement('ltx:sup', $text); + return; } + elsif ($role eq 'FLOATSUBSCRIPT') { + $document->insertElement('ltx:sub', $text); + return; } + } } } } + # should never happen, but just in case: + Info("rewrite", "footnotemark", "Failed to find floating node in: " . $math->toString(1)); + $document->getNode->appendChild($math); + return; }); + #====================================================================== # \choose & friends, also need VERY special argument handling diff --git a/t/ams/amsdisplay.xml b/t/ams/amsdisplay.xml index 09bd9884d..7b10fff78 100644 --- a/t/ams/amsdisplay.xml +++ b/t/ams/amsdisplay.xml @@ -945,20 +945,8 @@ - (15a - - - - - - ) - 15a - - - - - - + (15a) + 15a @@ -976,20 +964,8 @@ - (15a - - - ′′ - - - ) - 15a - - - ′′ - - - + (15a′′) + 15a′′ diff --git a/t/ams/mathtools.xml b/t/ams/mathtools.xml index 123414ab5..836594071 100644 --- a/t/ams/mathtools.xml +++ b/t/ams/mathtools.xml @@ -945,20 +945,8 @@ In the star form \ref* becomes Non-textual

- (n - - - th - - - ) - n - - - th - - - + (nth) + nth diff --git a/t/complex/aliceblog.xml b/t/complex/aliceblog.xml index 944e28c89..ffc231f0a 100644 --- a/t/complex/aliceblog.xml +++ b/t/complex/aliceblog.xml @@ -67,17 +67,7 @@ The Trouble with Bob -

Date: 10 - - - - - t - h - - - - of September, 2011.Alice.

+

Date: 10th of September, 2011.Alice.

The trouble with Bob is that he takes much better photos than I do.

@@ -92,17 +82,7 @@ by Jo’s Barbeque -

Date: 14 - - - - - t - h - - - - of September, 2011.

+

Date: 14th of September, 2011.

Eve.

@@ -114,17 +94,7 @@ by I will post my photos nevertheless… -

Date: 15 - - - - - t - h - - - - of September, 2011.

+

Date: 15th of September, 2011.

Alice.

diff --git a/t/encoding/ansinew.xml b/t/encoding/ansinew.xml index 60b4492b6..34f58a92f 100644 --- a/t/encoding/ansinew.xml +++ b/t/encoding/ansinew.xml @@ -107,20 +107,8 @@ ± - - - - 2 - - - - - - - 3 - - - + 2 + 3 ´ @@ -130,13 +118,7 @@ · ¸ - - - - 1 - - - + 1 º » ¼ diff --git a/t/encoding/cp1252.xml b/t/encoding/cp1252.xml index ec6d19156..35429a699 100644 --- a/t/encoding/cp1252.xml +++ b/t/encoding/cp1252.xml @@ -107,20 +107,8 @@ ± - - - - 2 - - - - - - - 3 - - - + 2 + 3 ´ @@ -130,13 +118,7 @@ · ¸ - - - - 1 - - - + 1 º » ¼ diff --git a/t/encoding/cp437.xml b/t/encoding/cp437.xml index 51056da36..863d6c516 100644 --- a/t/encoding/cp437.xml +++ b/t/encoding/cp437.xml @@ -222,20 +222,8 @@ - - - - n - - - - - - - 2 - - - + n + 2 diff --git a/t/encoding/cp437de.xml b/t/encoding/cp437de.xml index 5816af482..09da695df 100644 --- a/t/encoding/cp437de.xml +++ b/t/encoding/cp437de.xml @@ -218,20 +218,8 @@ - - - - n - - - - - - - 2 - - - + n + 2 diff --git a/t/encoding/cp850.pdf b/t/encoding/cp850.pdf index 8c316d866..9796c6570 100644 Binary files a/t/encoding/cp850.pdf and b/t/encoding/cp850.pdf differ diff --git a/t/encoding/cp850.xml b/t/encoding/cp850.xml index 8ef023b4d..af526abfa 100644 --- a/t/encoding/cp850.xml +++ b/t/encoding/cp850.xml @@ -204,27 +204,9 @@ ° ¨ · - - - - 1 - - - - - - - 3 - - - - - - - 2 - - - + 1 + 3 + 2 diff --git a/t/encoding/cp858.pdf b/t/encoding/cp858.pdf index f4d4ca089..33bfded60 100644 Binary files a/t/encoding/cp858.pdf and b/t/encoding/cp858.pdf differ diff --git a/t/encoding/cp858.xml b/t/encoding/cp858.xml index 020cbd7ea..f2042071e 100644 --- a/t/encoding/cp858.xml +++ b/t/encoding/cp858.xml @@ -204,27 +204,9 @@ ° ¨ · - - - - 1 - - - - - - - 3 - - - - - - - 2 - - - + 1 + 3 + 2 diff --git a/t/encoding/cp865.xml b/t/encoding/cp865.xml index b777342ef..94e786c6e 100644 --- a/t/encoding/cp865.xml +++ b/t/encoding/cp865.xml @@ -222,20 +222,8 @@ - - - - n - - - - - - - 2 - - - + n + 2 diff --git a/t/encoding/decmulti.xml b/t/encoding/decmulti.xml index 3297ebeef..a5c9474a5 100644 --- a/t/encoding/decmulti.xml +++ b/t/encoding/decmulti.xml @@ -65,20 +65,8 @@ ± - - - - 2 - - - - - - - 3 - - - + 2 + 3 @@ -88,13 +76,7 @@ · - - - - 1 - - - + 1 º » ¼ diff --git a/t/encoding/latin1.xml b/t/encoding/latin1.xml index a941821fd..52916d21d 100644 --- a/t/encoding/latin1.xml +++ b/t/encoding/latin1.xml @@ -69,20 +69,8 @@ ± - - - - 2 - - - - - - - 3 - - - + 2 + 3 ´ @@ -92,13 +80,7 @@ · ¸ - - - - 1 - - - + 1 º » ¼ diff --git a/t/encoding/latin3.xml b/t/encoding/latin3.xml index e3da9ab29..27eca8328 100644 --- a/t/encoding/latin3.xml +++ b/t/encoding/latin3.xml @@ -61,20 +61,8 @@ Bx ° - - - - 2 - - - - - - - 3 - - - + 2 + 3 ´ diff --git a/t/encoding/latin5.xml b/t/encoding/latin5.xml index eac43c73c..e01fef24d 100644 --- a/t/encoding/latin5.xml +++ b/t/encoding/latin5.xml @@ -69,20 +69,8 @@ ± - - - - 2 - - - - - - - 3 - - - + 2 + 3 ´ @@ -92,13 +80,7 @@ · ¸ - - - - 1 - - - + 1 º » ¼ diff --git a/t/encoding/latin9.xml b/t/encoding/latin9.xml index 8cf6e7149..2c62a142c 100644 --- a/t/encoding/latin9.xml +++ b/t/encoding/latin9.xml @@ -259,20 +259,8 @@ ± - - - - 2 - - - - - - - 3 - - - + 2 + 3 Ž @@ -282,13 +270,7 @@ · ž - - - - 1 - - - + 1 º » Œ diff --git a/t/expansion/noexpand.xml b/t/expansion/noexpand.xml index 50fd42868..a0aa6cf40 100644 --- a/t/expansion/noexpand.xml +++ b/t/expansion/noexpand.xml @@ -30,22 +30,10 @@

noexpand STAR:

-

square: - - - 2 - - -

+

square: 2

-

noexpand square: - - - 2 - - -

+

noexpand square: 2

@@ -74,22 +62,10 @@

unexpanded STAR: STAR

-

square: - - - 2 - - -

+

square: 2

-

unexpanded square: - - - 2 - - -

+

unexpanded square: 2

diff --git a/t/graphics/graphrot.xml b/t/graphics/graphrot.xml index 855be97f5..bcf271b86 100644 --- a/t/graphics/graphrot.xml +++ b/t/graphics/graphrot.xml @@ -267,27 +267,9 @@ the whales Save the whale Save the 0 - - - o - - - - -40 - - - o - - - - -80 - - - o - - - + 0o + -40o + -80o @@ -310,27 +292,9 @@ the whales Save the whale Save the 120 - - - o - - - - -160 - - - o - - - - -200 - - - o - - - + 120o + -160o + -200o @@ -353,27 +317,9 @@ the whales Save the whale Save the -240 - - - o - - - - -280 - - - o - - - - -320 - - - o - - - + -240o + -280o + -320o diff --git a/t/math/niceunits.xml b/t/math/niceunits.xml index c32a1e3bd..6e29335f7 100644 --- a/t/math/niceunits.xml +++ b/t/math/niceunits.xml @@ -222,19 +222,7 @@

In arXiv examples: -Dose (10 - - - 14 - - -  ions/cm - - - 2 - - - )

+Dose (1014 ions/cm2)

And also handles mathematics diff --git a/t/math/testscripts.xml b/t/math/testscripts.xml index 5fada6f0e..2a74b8daa 100644 --- a/t/math/testscripts.xml +++ b/t/math/testscripts.xml @@ -55,19 +55,7 @@ -

- - - a - - - , - - - a - - -

+

a, a

diff --git a/t/parse/scripts.pdf b/t/parse/scripts.pdf index fd20cfc6a..f00a8b7a8 100644 Binary files a/t/parse/scripts.pdf and b/t/parse/scripts.pdf differ diff --git a/t/parse/scripts.xml b/t/parse/scripts.xml index f8deb5b5b..9a9b5d30a 100644 --- a/t/parse/scripts.xml +++ b/t/parse/scripts.xml @@ -5,22 +5,10 @@ -

A - - - c - - -

+

Ac

-

A - - - d - - -

+

Ad

A @@ -128,41 +116,10 @@

-

- - - - - - - - - - - < - x - 3 - - , - - > - - 0 - - - - - -

+

x<3,>0

-

- - - ′′′ - - -

+

′′′

diff --git a/t/structure/eqnums.xml b/t/structure/eqnums.xml index 753de7ac9..2fd09c2ea 100644 --- a/t/structure/eqnums.xml +++ b/t/structure/eqnums.xml @@ -61,20 +61,8 @@ even if later on, the equation tag is removed or set explicitly!

Numbered, Tag before (w/eq=1)

- (1 - - - - - - ) - 1 - - - - - - + (1) + 1 @@ -89,20 +77,8 @@ even if later on, the equation tag is removed or set explicitly!

Numbered, Tag after (w/eq=1)

- (1 - - - ′′ - - - ) - 1 - - - ′′ - - - + (1′′) + 1′′ @@ -162,20 +138,8 @@ even if later on, the equation tag is removed or set explicitly!

UnNumbered, Tag before (w/eq=1)

- (1 - - - ′′′ - - - ) - 1 - - - ′′′ - - - + (1′′′) + 1′′′ @@ -190,20 +154,8 @@ even if later on, the equation tag is removed or set explicitly!

UnNumbered, Tag after (w/eq=1)

- (1 - - - ′′′′ - - - ) - 1 - - - ′′′′ - - - + (1′′′′) + 1′′′′ @@ -622,20 +574,8 @@ until the end of line mark!

- (7 - - - - - - ) - 7 - - - - - - + (7) + 7 @@ -667,20 +607,8 @@ until the end of line mark!

- (7 - - - ′′ - - - ) - 7 - - - ′′ - - - + (7′′) + 7′′ @@ -746,20 +674,8 @@ until the end of line mark!

- (7 - - - ′′′ - - - ) - 7 - - - ′′′ - - - + (7′′′) + 7′′′ @@ -791,20 +707,8 @@ until the end of line mark!

- (7 - - - ′′′′ - - - ) - 7 - - - ′′′′ - - - + (7′′′′) + 7′′′′