Comments below.
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index e566cdd..2d297e2 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -1123,6 +1171,52 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures
& features,
+ from_utf8(preamble) + '\n';
}
+ // PDF support. 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."
+ //TODO does the ending ',' hurt ?
I expect people will think this is at best ugly. I guess I'd do it by
outputting the comma BEFORE each bit...but only after testing some flag
that tells us whether we've done the first one yet.
+ if (pdfoptions().use_hyperref) {
+ os << "\\usepackage[\n";
+ if (!pdfoptions().title.empty())
+ os << "pdftitle={" << from_utf8(pdfoptions().title) <<
"},\n";
+ if (!pdfoptions().author.empty())
+ os << "pdfauthor={" << from_utf8(pdfoptions().author) <<
"},\n";
+ if (!pdfoptions().subject.empty())
+ os << "pdfsubject={" << from_utf8(pdfoptions().subject) <<
"},\n";
+ if (!pdfoptions().keywords.empty())
+ os << "pdfkeywords={" << from_utf8(pdfoptions().keywords) <<
"},\n";
+
+ os << "bookmarks=" <<
+ from_utf8(convert<string>(pdfoptions().bookmarks)) <<
',';
+ if (pdfoptions().bookmarks) {
+ os << "bookmarksnumbered=" <<
+
from_utf8(convert<string>(pdfoptions().bookmarksnumbered)) << ',';
+ os << "bookmarksopen=" <<
+
from_utf8(convert<string>(pdfoptions().bookmarksopen)) << ',';
+
+ if (pdfoptions().bookmarksopen &&
!pdfoptions().bookmarksopenlevel.empty())
+ os << "bookmarksopennumbered=" <<
+ from_utf8(pdfoptions().bookmarksopenlevel)
<< ',';
+ }
+
+ os << "breaklinks=" <<
+ from_utf8(convert<string>(pdfoptions().breaklinks)) <<
',';
+ os << "pdfborder={0 0 " <<
+ pdfoptions().pdfborder << "},\n";
+ os << "colorlinks=" <<
+ from_utf8(convert<string>(pdfoptions().colorlinks)) <<
',';
+ os << "backref=" <<
+ from_utf8(convert<string>(pdfoptions().backref)) << ',';
+ os << "pagebackref=" <<
+ from_utf8(convert<string>(pdfoptions().pagebackref)) <<
',';
+
+ if (!pdfoptions().pagemode.empty())
+ os << "pdfpagemode=" << from_utf8(pdfoptions().pagemode)
<< ',';
+ os << from_utf8(pdfoptions().quoted_options_get());
+
+ os << "]{hyperref}";
+ }
+
It might help make the code a little clearer if all of this stuff were
taken out into a PDFOptions::writeLatex(odocstream &) routine that could
just be called directly here, without even checking use_hyperref. You
could do that there. And then changing all of this stuff doesn't mean
messing with BufferParams.
Richard
--
==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto