Skip to content

Commit

Permalink
better respect digestable keys in thmtools; soften hypertarget error …
Browse files Browse the repository at this point in the history
…to a warning (#2281)
  • Loading branch information
dginev authored Dec 21, 2023
1 parent 43bf4b3 commit e42782a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/LaTeXML/Package/LaTeX.pool.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -3062,7 +3062,7 @@ sub defineNewTheorem {
$listname =~ s/\#/hash/g;
$otherthmset = $otherthmset && ToString($otherthmset);
$type = undef if IsEmpty($type);
$within = $within ? ToString($within) : undef;
$within = $within ? ToString(Digest($within)) : undef;

my $counter = $otherthmset || $thmset;
$counter =~ s/\s+/./; # convert spaces to period?
Expand Down
4 changes: 2 additions & 2 deletions lib/LaTeXML/Package/hyperref.sty.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ sub localized_anchor {
my ($document, $whatsit) = @_;
my $model = $STATE->getModel;
my $node = $document->getNode;
my $id = $whatsit->getProperty('id');
my @candidates = ($node);
my $candidate;
while ($candidate = pop(@candidates)) {
Expand All @@ -236,13 +237,12 @@ sub localized_anchor {
unshift(@candidates, $candidate->childNodes); }
elsif ($type = XML_TEXT_NODE) {
last; } }
my $id = $whatsit->getProperty('id');
if ($candidate) {
my $anchor = $document->wrapNodes('ltx:anchor', $candidate);
$anchor->setAttribute('xml:id', $id);
$document->closeNode($anchor) if $document->isOpen($anchor); }
else {
Error("No available insertion point for ltx:anchor, failing \\hypertarget to $id"); }
Warn("No available insertion point for ltx:anchor, failing \\hypertarget to $id"); }
return; }

# \hyperdef{category}{name}{text}
Expand Down
8 changes: 5 additions & 3 deletions lib/LaTeXML/Package/thmtools.sty.ltxml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ sub thmtools_style {
DefPrimitive('\declaretheorem OptionalKeyVals {}', sub {
my ($stomach, $kv, $thmset) = @_;
# Activate any requested style
my $name = ToString($thmset);
if (my $style = ToString($kv && $kv->getValue('style')) || 'plain') {
useTheoremStyle($style); }
my $name = ToString($thmset);
my $style = $kv && $kv->getValue('style');
if ($style) {
$style = ToString(Digest($style)); }
useTheoremStyle($style || 'plain');
thmtools_style($name, $kv);
useTheoremStyle($name);
my $type = ($kv
Expand Down

0 comments on commit e42782a

Please sign in to comment.