> I thought about something like the attached (untested, not even compiled)
> patch, on top of your patch.

i fixed the patch so it outputs correct tex, but anyway it seems that beamer
simply ignores things in \documentclass options (tested on fullscreen and 
pdfusetitle). if you'd like to play more, below little polished patch.

pavel
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 8767047..abbc966 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -993,6 +993,9 @@ bool BufferParams::writeLaTeX(odocstream & os, 
LaTeXFeatures & features,
                        clsoptions << language_options.str() << ',';
        }
 
+       if (getTextClass().provides("hyperref"))
+               clsoptions << pdfoptions().getOptionalArgs();
+
        // the user-defined options
        if (!options.empty()) {
                clsoptions << options << ',';
diff --git a/src/PDFOptions.cpp b/src/PDFOptions.cpp
index a4a4fcb..6a239b2 100644
--- a/src/PDFOptions.cpp
+++ b/src/PDFOptions.cpp
@@ -87,13 +87,11 @@ void PDFOptions::writeFile(ostream & os) const
 }
 
 
-void PDFOptions::writeLaTeX(odocstream & os, bool hyperref_already_provided) 
const
+string const PDFOptions::getOptionalArgs() const
 {
-       string opt;
-       
        // since LyX uses unicode, also set the PDF strings to unicode strings 
with the
        // hyperref option "unicode"
-       opt += "unicode=true, ";
+       string opt = "unicode=true, ";
        
        // try to extract author and title from document when none is
        // explicitely given
@@ -121,9 +119,14 @@ void PDFOptions::writeLaTeX(odocstream & os, bool 
hyperref_already_provided) con
        opt += "colorlinks="     + convert<string>(colorlinks) + ',';
        if (!pagemode.empty())
                opt += "pdfpagemode=" + pagemode + ',';
-       
+       return opt;
+}
 
 
+void PDFOptions::writeLaTeX(odocstream & os, bool hyperref_already_provided) 
const
+{
+       string opt = getOptionalArgs();
+       
        // load the pdftitle etc. as hypersetup, otherwise you'll get
        // LaTeX-errors when using non-latin characters
        string hyperset;
@@ -146,19 +149,12 @@ void PDFOptions::writeLaTeX(odocstream & os, bool 
hyperref_already_provided) con
        if (!hyperref_already_provided) {
                opt = rtrim(opt,",");
                opt = "\\usepackage[" + opt + "]\n {hyperref}\n";
-
-               if (!hyperset.empty())
-                       opt += "\\hypersetup{" + hyperset + "}\n ";
        } else
-               // only in case hyperref is already loaded by the current text 
class
-               // try to put it into hyperset
-               //
-               // FIXME: this still does not fix the cases where hyperref is 
loaded
-               //        and the option is active only when part of usepackage 
parameter
-               //        (e.g. pdfusetitle).
-               {
-                       opt = "\\hypersetup{" + opt + hyperset + "}\n ";
-               }
+               // opt already used in \documentclass options
+               opt.clear();
+
+       if (!hyperset.empty())
+               opt += "\\hypersetup{" + hyperset + "}\n ";
        
        // FIXME UNICODE
        os << from_utf8(opt);
diff --git a/src/PDFOptions.h b/src/PDFOptions.h
index fa25371..3aff1bf 100644
--- a/src/PDFOptions.h
+++ b/src/PDFOptions.h
@@ -29,6 +29,8 @@ public:
        bool empty() const;
        /// output to lyx header
        void writeFile(std::ostream &) const;
+       /// the options that must be passed as optional arguments
+       std::string const getOptionalArgs() const;
        /// output to tex header
        void writeLaTeX(odocstream &, bool hyperref_already_provided) const;
        /// read tokens from lyx header

Reply via email to