PDFOptions.cpp: clean up the appearance of the parameters in the LaTeX-output

BufferParams.cpp: move the hyperref call to the right position

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20431 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2007-09-22 12:53:22 +00:00
parent 1f83c98eb4
commit 9c59de3c67
2 changed files with 22 additions and 23 deletions

View File

@ -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.

View File

@ -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<string>(bookmarks) + ',';
if (bookmarks) {
opt += "bookmarksnumbered=" + convert<string>(bookmarksnumbered) + ',';
@ -101,23 +100,23 @@ void PDFOptions::writeLaTeX(odocstringstream &os) const
if (bookmarksopen && !bookmarksopenlevel.empty())
opt += "bookmarksopenlevel=" + bookmarksopenlevel + ',';
}
opt += "\n ";
opt += "breaklinks=" + convert<string>(breaklinks) + ',';
opt += "pdfborder={0 0 " ;
opt += (pdfborder ?'0':'1');
opt += "},\n";
opt += "colorlinks=" + convert<string>(colorlinks) + ',';
opt += "},";
opt += "backref=" + convert<string>(backref) + ',';
opt += "pagebackref=" + convert<string>(pagebackref) + ',';
opt += "\n ";
opt += "colorlinks=" + convert<string>(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);