mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
* BufferParams.{cpp,h}:
- pass graphics driver to geometry (bug 5613) - put papersize options to package call, not in \geometry which broke compilation in some cases (bug 3838) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27917 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
28bfbe4e03
commit
3d48607f1a
@ -1129,71 +1129,71 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
||||
texrow.newline();
|
||||
}
|
||||
if (use_geometry || nonstandard_papersize) {
|
||||
os << "\\usepackage{geometry}\n";
|
||||
texrow.newline();
|
||||
os << "\\geometry{verbose";
|
||||
odocstringstream ods;
|
||||
if (!getGraphicsDriver("geometry").empty())
|
||||
ods << getGraphicsDriver("geometry");
|
||||
if (orientation == ORIENTATION_LANDSCAPE)
|
||||
os << ",landscape";
|
||||
ods << ",landscape";
|
||||
switch (papersize) {
|
||||
case PAPER_CUSTOM:
|
||||
if (!paperwidth.empty())
|
||||
os << ",paperwidth="
|
||||
ods << ",paperwidth="
|
||||
<< from_ascii(paperwidth);
|
||||
if (!paperheight.empty())
|
||||
os << ",paperheight="
|
||||
ods << ",paperheight="
|
||||
<< from_ascii(paperheight);
|
||||
break;
|
||||
case PAPER_USLETTER:
|
||||
os << ",letterpaper";
|
||||
ods << ",letterpaper";
|
||||
break;
|
||||
case PAPER_USLEGAL:
|
||||
os << ",legalpaper";
|
||||
ods << ",legalpaper";
|
||||
break;
|
||||
case PAPER_USEXECUTIVE:
|
||||
os << ",executivepaper";
|
||||
ods << ",executivepaper";
|
||||
break;
|
||||
case PAPER_A3:
|
||||
os << ",a3paper";
|
||||
ods << ",a3paper";
|
||||
break;
|
||||
case PAPER_A4:
|
||||
os << ",a4paper";
|
||||
ods << ",a4paper";
|
||||
break;
|
||||
case PAPER_A5:
|
||||
os << ",a5paper";
|
||||
ods << ",a5paper";
|
||||
break;
|
||||
case PAPER_B3:
|
||||
os << ",b3paper";
|
||||
ods << ",b3paper";
|
||||
break;
|
||||
case PAPER_B4:
|
||||
os << ",b4paper";
|
||||
ods << ",b4paper";
|
||||
break;
|
||||
case PAPER_B5:
|
||||
os << ",b5paper";
|
||||
ods << ",b5paper";
|
||||
break;
|
||||
default:
|
||||
// default papersize ie PAPER_DEFAULT
|
||||
switch (lyxrc.default_papersize) {
|
||||
case PAPER_DEFAULT: // keep compiler happy
|
||||
case PAPER_USLETTER:
|
||||
os << ",letterpaper";
|
||||
ods << ",letterpaper";
|
||||
break;
|
||||
case PAPER_USLEGAL:
|
||||
os << ",legalpaper";
|
||||
ods << ",legalpaper";
|
||||
break;
|
||||
case PAPER_USEXECUTIVE:
|
||||
os << ",executivepaper";
|
||||
ods << ",executivepaper";
|
||||
break;
|
||||
case PAPER_A3:
|
||||
os << ",a3paper";
|
||||
ods << ",a3paper";
|
||||
break;
|
||||
case PAPER_A4:
|
||||
os << ",a4paper";
|
||||
ods << ",a4paper";
|
||||
break;
|
||||
case PAPER_A5:
|
||||
os << ",a5paper";
|
||||
ods << ",a5paper";
|
||||
break;
|
||||
case PAPER_B5:
|
||||
os << ",b5paper";
|
||||
ods << ",b5paper";
|
||||
break;
|
||||
case PAPER_B3:
|
||||
case PAPER_B4:
|
||||
@ -1201,6 +1201,13 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
||||
break;
|
||||
}
|
||||
}
|
||||
docstring const g_options = trim(ods.str(), ",");
|
||||
os << "\\usepackage";
|
||||
if (!g_options.empty())
|
||||
os << '[' << g_options << ']';
|
||||
os << "{geometry}\n";
|
||||
texrow.newline();
|
||||
os << "\\geometry{verbose";
|
||||
if (!topmargin.empty())
|
||||
os << ",tmargin=" << from_ascii(Length(topmargin).asLatexString());
|
||||
if (!bottommargin.empty())
|
||||
@ -2103,6 +2110,24 @@ string BufferParams::babelCall(string const & lang_opts) const
|
||||
}
|
||||
|
||||
|
||||
docstring BufferParams::getGraphicsDriver(string const & package) const
|
||||
{
|
||||
docstring result;
|
||||
|
||||
if (package == "geometry") {
|
||||
if (graphicsDriver == "dvips"
|
||||
|| graphicsDriver == "dvipdfm"
|
||||
|| graphicsDriver == "pdftex"
|
||||
|| graphicsDriver == "vtex")
|
||||
result = from_ascii(graphicsDriver);
|
||||
else if (graphicsDriver == "dvipdfmx")
|
||||
result = from_ascii("dvipdfm");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void BufferParams::writeEncodingPreamble(odocstream & os,
|
||||
LaTeXFeatures & features, TexRow & texrow) const
|
||||
{
|
||||
|
@ -310,6 +310,8 @@ public:
|
||||
std::string paperSizeName(PapersizePurpose purpose) const;
|
||||
/// set up if and how babel is called
|
||||
std::string babelCall(std::string const & lang_opts) const;
|
||||
/// return supported drivers for specific packages
|
||||
docstring getGraphicsDriver(std::string const & package) const;
|
||||
/// handle inputenc etc.
|
||||
void writeEncodingPreamble(odocstream & os, LaTeXFeatures & features,
|
||||
TexRow & texrow) const;
|
||||
|
Loading…
Reference in New Issue
Block a user