]> git.lyx.org Git - lyx.git/commitdiff
Use \ifthenelse instead of relying on TeX primitives
authorEnrico Forestieri <forenr@lyx.org>
Mon, 19 Jun 2023 17:53:16 +0000 (19:53 +0200)
committerEnrico Forestieri <forenr@lyx.org>
Mon, 19 Jun 2023 17:53:16 +0000 (19:53 +0200)
This fixes the issue reported here:
https://www.mail-archive.com/lyx-users@lists.lyx.org/msg115156.html

The problem is due to the use of the mathpazo package because
it defines the macro \f@family as "ppl\n", i.e., it appends a
newline character at the end. Now, the "\if" TeX primitive
expands its arguments for comparing them and the newline causes
a "missing \begin{document}" error. Instead of complicating the
code to account for this, it is better using the ifthen package.

lib/scripts/legacy_lyxpreview2ppm.py
status.23x

index 08703fb38046b94dfc5001da10ac003877220613..90dccc2870f89522bc19b924a6103328961b944f 100644 (file)
@@ -252,11 +252,10 @@ def legacy_latex_file(latex_file, fg_color, bg_color):
 \\definecolor{lyxbg}{rgb}{%s}
 \\pagecolor{lyxbg}
 \\usepackage[%s,tightpage]{preview}
+\\usepackage{ifthen}
 \\makeatletter
-\\def\\t@a{cmr}
-\\if\\f@family\\t@a
-\\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,aecompl}}
-\\fi
+\\ifthenelse{\\equal{\\f@family}{cmr}}{
+\\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,aecompl}}}{}
 \\g@addto@macro\\preview{\\begingroup\\color{lyxbg}\\special{ps::clippath fill}\\color{lyxfg}}
 \\g@addto@macro\\endpreview{\\endgroup}
 \\makeatother
index cc11a217471df654f186ad982be6d42c37777515..efed0217de2d1753d062e3e26e75ea5933eeb7aa 100644 (file)
@@ -52,6 +52,8 @@ What's new
 
 - Avoid crashing on a recursive macro definition (bug 12633).
 
+- Fix issue with on-screen instant preview and the mathpazo package.
+
 
 * INTERNALS