Skip to content

Commit 5a3e692

Browse files
authored
Merge pull request #713 from Mathics3/correct-mathics-asy-number-tracking
Corrects tracking asy number in documentation
2 parents bb38d34 + c39b973 commit 5a3e692

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

mathics/doc/latex_doc.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
# We keep track of the number of \begin{asy}'s we see so that
5959
# we can assocation asymptote file numbers with where they are
6060
# in the document
61-
asy_count = 0
61+
next_asy_number = 1
6262

6363
ITALIC_RE = re.compile(r"(?s)<(?P<tag>i)>(?P<content>.*?)</(?P=tag)>")
6464

@@ -565,10 +565,11 @@ def latex(self, doc_data: dict) -> str:
565565

566566
test_text = result["result"]
567567
if test_text: # is not None and result['result'].strip():
568-
if test_text.find("\\begin{asy}") >= 0:
569-
global asy_count
570-
asy_count += 1
571-
text += f"%% mathics-{asy_count}.asy\n"
568+
asy_count = test_text.count("\\begin{asy}")
569+
if asy_count >= 0:
570+
global next_asy_number
571+
text += f"%% mathics-{next_asy_number}.asy\n"
572+
next_asy_number += asy_count
572573

573574
text += "\\begin{testresult}%s\\end{testresult}" % result["result"]
574575
text += "\\end{testcase}"

0 commit comments

Comments
 (0)