diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 50828faad7..b2c4d5daa7 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -1115,11 +1115,20 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, texrow.newline(); } - // Now insert the LyX specific LaTeX commands... + // Now insert the LyX specific LaTeX commands... // The optional packages; docstring lyxpreamble(from_ascii(features.getPackages())); + // PDF support. Hyperref manual: "Make sure it comes last of your loaded + // packages, to give it a fighting chance of not being over-written, + // since its job is to redefine many LATEX commands." + // Has to be put into lyxpreamble (preserving line-counting for error + // parsing). + odocstringstream oss; + pdfoptions().writeLaTeX(oss); + lyxpreamble += oss.str(); + // this might be useful... lyxpreamble += "\n\\makeatletter\n"; @@ -1183,15 +1192,6 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, if (!bullets_def.empty()) lyxpreamble += bullets_def + "}\n\n"; - // PDF support. Hypreref manual: "Make sure it comes last of your loaded - // packages, to give it a fighting chance of not being over-written, - // since its job is to redefine many LATEX commands." - // Has to be put into lyxpreamble (preserving line-counting for error - // parsing). - odocstringstream oss; - pdfoptions().writeLaTeX(oss); - lyxpreamble += oss.str(); - // We try to load babel late, in case it interferes // with other packages. // Jurabib has to be called after babel, though. diff --git a/src/PDFOptions.cpp b/src/PDFOptions.cpp index 69be850248..1fdaab61f0 100644 --- a/src/PDFOptions.cpp +++ b/src/PDFOptions.cpp @@ -85,14 +85,13 @@ void PDFOptions::writeLaTeX(odocstringstream &os) const opt = "\\usepackage["; if (!title.empty()) - opt += "pdftitle={" + title + "},\n"; + opt += "pdftitle={" + title + "},\n "; if (!author.empty()) - opt += "pdfauthor={" + author + "},\n"; + opt += "pdfauthor={" + author + "},\n "; if (!subject.empty()) - opt += "pdfsubject={" + subject + "},\n"; + opt += "pdfsubject={" + subject + "},\n "; if (!keywords.empty()) - opt += "pdfkeywords={" + keywords + "},\n"; - + opt += "pdfkeywords={" + keywords + "},\n "; opt += "bookmarks=" + convert(bookmarks) + ','; if (bookmarks) { opt += "bookmarksnumbered=" + convert(bookmarksnumbered) + ','; @@ -101,23 +100,23 @@ void PDFOptions::writeLaTeX(odocstringstream &os) const if (bookmarksopen && !bookmarksopenlevel.empty()) opt += "bookmarksopenlevel=" + bookmarksopenlevel + ','; } - + opt += "\n "; opt += "breaklinks=" + convert(breaklinks) + ','; - + opt += "pdfborder={0 0 " ; opt += (pdfborder ?'0':'1'); - opt += "},\n"; - - opt += "colorlinks=" + convert(colorlinks) + ','; + opt += "},"; + opt += "backref=" + convert(backref) + ','; opt += "pagebackref=" + convert(pagebackref) + ','; - + opt += "\n "; + opt += "colorlinks=" + convert(colorlinks) + ','; if (!pagemode.empty()) opt += "pdfpagemode=" + pagemode + ','; + opt += "\n "; opt += quoted_options_get(); - opt = support::rtrim(opt,","); - opt += "]{hyperref}\n"; + opt += "]\n {hyperref}\n"; // FIXME UNICODE os << from_utf8(opt);