Preview: do not overwrite fg/bg color names that beamer uses

Rename them to lyxfg/lyxbg

Fixes bug #12563.

(cherry picked from commit a20477993b)
This commit is contained in:
Jean-Marc Lasgouttes 2022-10-08 16:42:55 +02:00 committed by Richard Kimberly Heck
parent f2d901fb4f
commit e7f9554f39

View File

@ -235,9 +235,9 @@ def legacy_latex_file(latex_file, fg_color, bg_color):
else: else:
tmp.write(b""" tmp.write(b"""
\\usepackage{color} \\usepackage{color}
\\definecolor{fg}{rgb}{%s} \\definecolor{lyxfg}{rgb}{%s}
\\definecolor{bg}{rgb}{%s} \\definecolor{lyxbg}{rgb}{%s}
\\pagecolor{bg} \\pagecolor{lyxbg}
\\usepackage{polyglossia} \\usepackage{polyglossia}
""" % (fg_color_gr, bg_color_gr)) """ % (fg_color_gr, bg_color_gr))
polyglossia = True polyglossia = True
@ -248,16 +248,16 @@ def legacy_latex_file(latex_file, fg_color, bg_color):
if not polyglossia: if not polyglossia:
tmp.write(b""" tmp.write(b"""
\\usepackage{color} \\usepackage{color}
\\definecolor{fg}{rgb}{%s} \\definecolor{lyxfg}{rgb}{%s}
\\definecolor{bg}{rgb}{%s} \\definecolor{lyxbg}{rgb}{%s}
\\pagecolor{bg} \\pagecolor{lyxbg}
\\usepackage[%s,tightpage]{preview} \\usepackage[%s,tightpage]{preview}
\\makeatletter \\makeatletter
\\def\\t@a{cmr} \\def\\t@a{cmr}
\\if\\f@family\\t@a \\if\\f@family\\t@a
\\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,aecompl}} \\IfFileExists{lmodern.sty}{\\usepackage{lmodern}}{\\usepackage{ae,aecompl}}
\\fi \\fi
\\g@addto@macro\\preview{\\begingroup\\color{bg}\\special{ps::clippath fill}\\color{fg}} \\g@addto@macro\\preview{\\begingroup\\color{lyxbg}\\special{ps::clippath fill}\\color{lyxfg}}
\\g@addto@macro\\endpreview{\\endgroup} \\g@addto@macro\\endpreview{\\endgroup}
\\makeatother \\makeatother
""" % (fg_color_gr, bg_color_gr, previewopts)) """ % (fg_color_gr, bg_color_gr, previewopts))
@ -265,7 +265,7 @@ def legacy_latex_file(latex_file, fg_color, bg_color):
tmp.write(b""" tmp.write(b"""
\\usepackage[%s,tightpage]{preview} \\usepackage[%s,tightpage]{preview}
\\makeatletter \\makeatletter
\\g@addto@macro\\preview{\\begingroup\\color{bg}\\special{ps::clippath fill}\\color{fg}} \\g@addto@macro\\preview{\\begingroup\\color{lyxbg}\\special{ps::clippath fill}\\color{lyxfg}}
\\g@addto@macro\\endpreview{\\endgroup} \\g@addto@macro\\endpreview{\\endgroup}
\\makeatother \\makeatother
""" % previewopts) """ % previewopts)