From 38d0934e3668d02bfe5bf84444d8ac19ae4e7c30 Mon Sep 17 00:00:00 2001 From: Vincenzo Mantova Date: Fri, 3 Jan 2025 19:58:08 +0000 Subject: [PATCH] reimplement \llap, \rlap using CSS float --- lib/LaTeXML/Engine/plain.pool.ltxml | 5 +- lib/LaTeXML/resources/CSS/LaTeXML.css | 6 +++ .../resources/XSLT/LaTeXML-inline-xhtml.xsl | 51 +++++++++++++------ t/alignment/halignatt.xml | 2 +- t/ams/mathtools.xml | 6 +-- t/structure/plainsample.xml | 2 +- 6 files changed, 48 insertions(+), 24 deletions(-) diff --git a/lib/LaTeXML/Engine/plain.pool.ltxml b/lib/LaTeXML/Engine/plain.pool.ltxml index afa62213cc..2a9044e48c 100644 --- a/lib/LaTeXML/Engine/plain.pool.ltxml +++ b/lib/LaTeXML/Engine/plain.pool.ltxml @@ -536,9 +536,8 @@ 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}'); +DefMacro('\llap{}', '\hbox{\@ADDCLASS{ltx_llap}#1}'); +DefMacro('\rlap{}', '\hbox{\@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 b954b01b1a..4998d0e9d6 100644 --- a/lib/LaTeXML/resources/CSS/LaTeXML.css +++ b/lib/LaTeXML/resources/CSS/LaTeXML.css @@ -510,3 +510,9 @@ cite { font-style: normal; } .ltx_overlay {position:relative; } .ltx_overlay > span:nth-child(2) {position:absolute; left:0; } + +/* \llap, \rlap */ +.ltx__lap_container { + display:inline-block; vertical-align:bottom; width:0pt; white-space:nowrap; /* width 0pt causes extreme wrapping otherwise */ } +.ltx__lap_container>.ltx_llap { float:right; } +.ltx__lap_container>.ltx_rlap { float:left; } diff --git a/lib/LaTeXML/resources/XSLT/LaTeXML-inline-xhtml.xsl b/lib/LaTeXML/resources/XSLT/LaTeXML-inline-xhtml.xsl index 122c5a3ab5..295c0b118c 100644 --- a/lib/LaTeXML/resources/XSLT/LaTeXML-inline-xhtml.xsl +++ b/lib/LaTeXML/resources/XSLT/LaTeXML-inline-xhtml.xsl @@ -33,22 +33,41 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + ltx__lap_container + + + + + + ltx__lap_container + + + + + + +