Skip to content

Commit

Permalink
replace heuristic shift in TikZ alignment with depth of last row
Browse files Browse the repository at this point in the history
  • Loading branch information
xworld21 committed Jan 25, 2025
1 parent 704ac3f commit bfb3aeb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/LaTeXML/Package/pgfsys-latexml.def.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ sub tikzAlignmentBindings {

# Note that pgf *seems* to have set the coordinate system to the center(?) (w/ \pgfsys@transformcm)
# Additionally, there's a svg:g outside the alignment (w/ ltx_svg_fog)
# The following tweaks (heuristically) the transform to position the alignment object
# The following tweaks the transform to position the alignment object
#
# Coordinates are currently pgf: y moves UP
# Coordinates of alignment are : y moves DOWN
Expand All @@ -939,14 +939,14 @@ sub openTikzAlignment {
my $h = ($props{cheight} && $props{cheight}->pxValue) || 0;
my $d = ($props{cdepth} && $props{cdepth}->pxValue) || 0;
my @rowheights = ($props{rowheights} ? @{ $props{rowheights} } : (Dimension(0)));
my @rowdepths = ($props{rowdepths} ? @{ $props{rowdepths} } : (Dimension(0)));
my @colwidths = ($props{columnwidths} ? @{ $props{columnwidths} } : (Dimension(0)));
my $x = 0;
# This SHOULD be just $h+$d, but the shift is necessary to align
# w/additional material outside the \halign ( arrows & such)
my $y = ($h + $d) - $rowheights[-1]->pxValue / 2; # HEURISTIC adjustment! half of LAST row!?
my $y = ($h + $d) - $rowdepths[-1]->pxValue; # set baseline to baseline of last row
Debug("TIKZ Alignment size $w x $h + $d"
. " rows: " . join(',', map { $_->pxValue; } @rowheights)
. " cols: " . join(',', map { $_->pxValue; } @colwidths)
. " rows: " . join(',', map { $_->pxValue; } @rowheights)
. " cols: " . join(',', map { $_->pxValue; } @colwidths)
. " depths: " . join(',', map { $_->pxValue; } @rowdepths)
. " => alignment adjustment = $x, $y") if $LaTeXML::DEBUG{pgf};
my $array = $doc->openElement($tag, class => 'ltx_tikzmatrix',
_scopebegin => 1,
Expand Down

0 comments on commit bfb3aeb

Please sign in to comment.