Skip to content

Commit ac3255d

Browse files
authored
Implement pgf baseline (#2535)
* Apply baseline adjustment (from keyword) to shift baseline via vertical-align * reset baseline when range is reset
1 parent b5d5ffe commit ac3255d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/LaTeXML/Package/pgfsys-latexml.def.ltxml

+4-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ DefConstructor('\lxSVG@insertpicture{}', sub {
8686
$document->openElement('ltx:picture');
8787
$document->openElement('svg:svg',
8888
version => "1.1",
89-
width => $props{pxwidth}, height => $props{pxheight},
89+
width => $props{pxwidth}, height => $props{pxheight}, style => $props{style},
9090
viewBox => "$props{minx} $props{miny} $props{pxwidth} $props{pxheight}",
9191
overflow => "visible");
9292
my $x0 = -(0 + $props{minx});
@@ -117,6 +117,7 @@ DefConstructor('\lxSVG@insertpicture{}', sub {
117117
my $w = max($width->pxValue, 1);
118118
my $h = max($height->pxValue, 1);
119119
my $content = $whatsit->getArg(1);
120+
my $base = Dimension(ToString(Expand(T_CS('\pgf@shift@baseline'))))->pxValue;
120121
my ($cwidth, $cheight, $cdepth) = $content->getSize;
121122
Debug("TIKZ size: " . ToString($width) . " x " . ToString($height)) if $LaTeXML::DEBUG{pgf};
122123
Debug("TIKZ pos: " . ToString($minx) . " x " . ToString($miny)) if $LaTeXML::DEBUG{pgf};
@@ -133,6 +134,7 @@ DefConstructor('\lxSVG@insertpicture{}', sub {
133134
$whatsit->setProperty(depth => Dimension(0));
134135
$whatsit->setProperty(pxwidth => $w);
135136
$whatsit->setProperty(pxheight => $h);
137+
$whatsit->setProperty(style => "vertical-align:".$base."px") if $base;
136138
# or tikz macro (see corescopes)
137139
return; },
138140
# \pgfpicture seems to make a 0 sized box, which throws off our postprocessor
@@ -754,6 +756,7 @@ DefMacro('\pgfsys@shadingoutsidepgfpicture{}', <<'EoTeX');
754756
\pgf@picminy=0pt%
755757
\pgf@picmaxx=\pgf@x%
756758
\pgf@picmaxy=\pgf@y%
759+
\def\pgf@shift@baseline{0pt}%
757760
\pgfsys@typesetpicturebox{\pgfpic}%
758761
\endgroup
759762
EoTeX

0 commit comments

Comments
 (0)