diff --git a/lib/LaTeXML/Engine/plain.pool.ltxml b/lib/LaTeXML/Engine/plain.pool.ltxml index afa62213c..977fe5ab2 100644 --- a/lib/LaTeXML/Engine/plain.pool.ltxml +++ b/lib/LaTeXML/Engine/plain.pool.ltxml @@ -536,9 +536,10 @@ DefConstructor('\ltx@centerline{}', sub { alias => '\centerline', bounded => 1); -# These should be 0 width, but perhaps also shifted? -DefMacro('\llap{}', '\hbox to 0pt{\hss#1}'); -DefMacro('\rlap{}', '\hbox to 0pt{#1\hss}'); +# rely on RTL trickery to shift the \llap content over the previous text (see CSS) +# the zero-width space prevents merging the two boxes in a single ltx:text +DefMacro('\llap{}', '\hbox to 0pt{\@ADDCLASS{ltx_llap}' . "\x{200B}" . '\hbox{\@ADDCLASS{ltx_llap_content}#1}}'); +DefMacro('\rlap{}', '\hbox to 0pt{\@ADDCLASS{ltx_rlap}#1}'); DefMacroI('\m@th', undef, '\mathsurround=0pt '); diff --git a/lib/LaTeXML/resources/CSS/LaTeXML.css b/lib/LaTeXML/resources/CSS/LaTeXML.css index b954b01b1..31949fec5 100644 --- a/lib/LaTeXML/resources/CSS/LaTeXML.css +++ b/lib/LaTeXML/resources/CSS/LaTeXML.css @@ -510,3 +510,15 @@ cite { font-style: normal; } .ltx_overlay {position:relative; } .ltx_overlay > span:nth-child(2) {position:absolute; left:0; } + +/* \llap, \rlap */ +.ltx_llap, .ltx_rlap { + white-space: nowrap; /* width 0pt causes extreme wrapping otherwise */ } + +/* shift \llap over the previous text by shifting text direction */ +.ltx_llap { + direction: rtl; } + +/* restore LTR inside \llap */ +.ltx_llap_content { + direction: ltr; } diff --git a/t/alignment/halignatt.xml b/t/alignment/halignatt.xml index 63ca62606..0f3092bec 100644 --- a/t/alignment/halignatt.xml +++ b/t/alignment/halignatt.xml @@ -50,7 +50,7 @@ 6 51–59 - .95* + .95* * (first quarter only) diff --git a/t/ams/mathtools.xml b/t/ams/mathtools.xml index 0d49e03bf..36b204e92 100644 --- a/t/ams/mathtools.xml +++ b/t/ams/mathtools.xml @@ -7120,7 +7120,7 @@ Then a switch of tag forms.

<tag close=" ">11</tag>Stepped lines - + @@ -7150,7 +7150,7 @@ Then a switch of tag forms.

= - 1 + 1 @@ -7182,7 +7182,7 @@ Then a switch of tag forms.

= - 2 + 2 diff --git a/t/structure/plainsample.xml b/t/structure/plainsample.xml index f05d63c4e..b25e270c5 100644 --- a/t/structure/plainsample.xml +++ b/t/structure/plainsample.xml @@ -80,7 +80,7 @@ finish the remaining cases.

)
- Draft + Draft