[LyX/master] Partial fix for #12605
Enrico Forestieri
forenr at lyx.org
Sat Dec 10 09:42:13 UTC 2022
commit ae961f004b5c9bb10f4cab0f41e5f3c33d7c183a
Author: Enrico Forestieri <forenr at lyx.org>
Date: Sat Dec 10 11:31:51 2022 +0100
Partial fix for #12605
The equation number is now correctly generated when using
\ref in \tag, but if equations are numbered within sections,
the \tag'ed equations in the first sections are numbered wrongly.
However, I think this is a preview.sty bug not a lyx one.
---
lib/scripts/lyxpreview_tools.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/scripts/lyxpreview_tools.py b/lib/scripts/lyxpreview_tools.py
index cca359e..1a6b1c1 100644
--- a/lib/scripts/lyxpreview_tools.py
+++ b/lib/scripts/lyxpreview_tools.py
@@ -293,7 +293,7 @@ def run_latex(latex, latex_file, bibtex = None):
latex_status, latex_stdout = run_tex(latex, latex_file)
# Rerun latex if necessary
progress("Checking if a latex rerun is necessary")
- if string_in_file("Warning: Citation", log_file):
+ if string_in_file("Warning: (Citation|Reference)", log_file):
latex_status, latex_stdout = run_tex(latex, latex_file)
return latex_status, latex_stdout
@@ -312,9 +312,10 @@ def run_tex(tex, tex_file):
def string_in_file(string, infile):
if not os.path.isfile(infile):
return False
+ string_re = re.compile(string.encode())
f = open(infile, 'rb')
for line in f.readlines():
- if string.encode() in line:
+ if string_re.search(line):
f.close()
return True
f.close()
More information about the lyx-cvs
mailing list