[LyX/master] Rerun latex if necessary when generating previews
Enrico Forestieri
forenr at lyx.org
Wed May 21 06:31:06 UTC 2025
On Mon, May 19, 2025 at 09:34:54PM +0000, Enrico Forestieri wrote:
>
>commit 1888d50eb18277fd93aab2859233887ae5919ebf
>Author: Enrico Forestieri <forenr at lyx.org>
>Date: Mon May 19 23:19:15 2025 +0200
>
> Rerun latex if necessary when generating previews
>
> Recent versions of dvipng may produce a last page whose content
> simply states that "LaTeX was unable to guess the total number
> of pages correctly. As there was some unprocessed data that
> should have been added to the final page this extra page has
> been added to receive it. If you rerun the document (without
> altering it) this surplus page will go away, because LaTeX now
> knows how many pages to expect for this document."
>
> This confuses the lyxpreview2bitmap.py script, making it unable
> to distinguish pages that should follow the dvipng route or the
> legacy route. However, the presence of the extra page is reported
> in the log file and hence we know we have to rerun latex.
Riki, this is also needed in stable.
>---
> lib/scripts/lyxpreview_tools.py | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/lib/scripts/lyxpreview_tools.py b/lib/scripts/lyxpreview_tools.py
>index 56ff33e38b..27ddf22695 100644
>--- a/lib/scripts/lyxpreview_tools.py
>+++ b/lib/scripts/lyxpreview_tools.py
>@@ -293,7 +293,8 @@ 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|Reference)", log_file):
>+ if string_in_file("Warning: (Citation|Reference)", log_file) or \
>+ string_in_file("Warning: Temporary extra page", log_file):
> latex_status, latex_stdout = run_tex(latex, latex_file)
>
> return latex_status, latex_stdout
--
Enrico
More information about the lyx-devel
mailing list