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; }