On 06/21/2016 06:58 AM, PhilipPirrip wrote:
> I was wondering if there's a special reason why
> provides fontenc 1
> provides inputenc 1
> provides amsmath 1
>
> prevent the corresponding packages from loading, but
>
> provides fontspec 1
> provides listings 1
> provides polyglossia 1
>
> -for example- don't?
>
> Should I report a bug?

Yes, that's a bug. This should work for all LyX-loaded packages.

I think

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 373eee5..592833a 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -1589,7 +1589,8 @@ bool BufferParams::writeLaTeX(otexstream & os,
LaTeXFeatures & features,
                os << from_ascii(ams);
 
        if (useNonTeXFonts) {
-               os << "\\usepackage{fontspec}\n";
+               if (!features.isProvided("fontspec"))
+                       os << "\\usepackage{fontspec}\n";
                if (features.mustProvide("unicode-math")
                    && features.isAvailable("unicode-math"))
                        os << "\\usepackage{unicode-math}\n";
@@ -2115,7 +2115,7 @@ bool BufferParams::writeLaTeX(otexstream & os,
LaTeXFeatures & features,
        }
        if (features.isRequired("bicaption"))
                lyxpreamble += "\\usepackage{bicaption}\n";
-       if (!listings_params.empty() || features.isRequired("listings"))
+       if (!listings_params.empty() || features.mustProvide("listings"))
                lyxpreamble += "\\usepackage{listings}\n";
        if (!listings_params.empty()) {
                lyxpreamble += "\\lstset{";

fixes the case of listings and fontspec. But I'd like to hear from
others, as I'm not expert on this.

I'm not sure how to handle polyglossia.

Richard

Reply via email to