From: Enrico Forestieri Date: Wed, 3 Jun 2015 17:02:54 +0000 (+0200) Subject: Account for the trailing optional argument of \usepackage. X-Git-Tag: 2.2.0alpha1~560 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=5998555743811cf51e406061723d53a05cf685c3;p=features.git Account for the trailing optional argument of \usepackage. The full syntax is \usepackage[]{}[] even if this is not documented in my old Lamport's LaTeX book... --- diff --git a/lib/scripts/lyxpreview2bitmap.py b/lib/scripts/lyxpreview2bitmap.py index 8aaaaaf56b..3e055429eb 100755 --- a/lib/scripts/lyxpreview2bitmap.py +++ b/lib/scripts/lyxpreview2bitmap.py @@ -193,8 +193,10 @@ def fix_latex_file(latex_file, pdf_output): tmp.write("\\def\\t@a{microtype}\n") tmp.write("\\let\\oldusepkg\\usepackage\n") tmp.write("\\def\\usepackage{\\@ifnextchar[\\@usepkg{\\@usepkg[]}}\n") - tmp.write("\\def\@usepkg[#1]#2{\\def\\t@b{#2}") - tmp.write("\\ifx\\t@a\\t@b\\else\\oldusepkg[#1]{#2}\\fi}\n") + tmp.write("\\def\\@usepkg[#1]#2{\\@ifnextchar[") + tmp.write("{\\@@usepkg[#1]{#2}}{\\@@usepkg[#1]{#2}[]}}\n") + tmp.write("\\def\@@usepkg[#1]#2[#3]{\\def\\t@b{#2}") + tmp.write("\\ifx\\t@a\\t@b\\else\\oldusepkg[#1]{#2}[#3]\\fi}\n") tmp.write(line) continue