]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
GuiBox.cpp: fix #6721
[lyx.git] / src / BufferParams.cpp
index d944c744a60340f2e20a2082b8d1cfca3c0fb2d0..920b6566d7bbd1753447c1693be175af0ef4bd54 100644 (file)
@@ -1177,7 +1177,8 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
 
        // all paper sizes except of A4, A5, B5 and the US sizes need the
        // geometry package
-       bool nonstandard_papersize = papersize != PAPER_USLETTER
+       bool nonstandard_papersize = papersize != PAPER_DEFAULT
+               && papersize != PAPER_USLETTER
                && papersize != PAPER_USLEGAL
                && papersize != PAPER_USEXECUTIVE
                && papersize != PAPER_A4
@@ -1335,8 +1336,11 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
        // XeTeX works without fontenc
        if (font_encoding() != "default" && language->lang() != "japanese"
            && !useXetex) {
+               size_t fars = language_options.str().find("farsi");
+               size_t arab = language_options.str().find("arabic");
                if (language->lang() == "arabic_arabi"
-                   || language->lang() == "farsi") {
+                       || language->lang() == "farsi" || fars != string::npos
+                       || arab != string::npos) {
                        os << "\\usepackage[" << from_ascii(font_encoding())
                           << ",LFE,LAE]{fontenc}\n";
                        texrow.newline();
@@ -1536,26 +1540,30 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                        os << '[' << g_options << ']';
                os << "{geometry}\n";
                texrow.newline();
-               os << "\\geometry{verbose";
-               if (!topmargin.empty())
-                       os << ",tmargin=" << from_ascii(Length(topmargin).asLatexString());
-               if (!bottommargin.empty())
-                       os << ",bmargin=" << from_ascii(Length(bottommargin).asLatexString());
-               if (!leftmargin.empty())
-                       os << ",lmargin=" << from_ascii(Length(leftmargin).asLatexString());
-               if (!rightmargin.empty())
-                       os << ",rmargin=" << from_ascii(Length(rightmargin).asLatexString());
-               if (!headheight.empty())
-                       os << ",headheight=" << from_ascii(Length(headheight).asLatexString());
-               if (!headsep.empty())
-                       os << ",headsep=" << from_ascii(Length(headsep).asLatexString());
-               if (!footskip.empty())
-                       os << ",footskip=" << from_ascii(Length(footskip).asLatexString());
-               if (!columnsep.empty())
-                       os << ",columnsep=" << from_ascii(Length(columnsep).asLatexString());
-               os << "}\n";
-               texrow.newline();
-       } else if (orientation == ORIENTATION_LANDSCAPE) {
+               // output this if only use_geometry is true
+               if (use_geometry) {
+                       os << "\\geometry{verbose";
+                       if (!topmargin.empty())
+                               os << ",tmargin=" << from_ascii(Length(topmargin).asLatexString());
+                       if (!bottommargin.empty())
+                               os << ",bmargin=" << from_ascii(Length(bottommargin).asLatexString());
+                       if (!leftmargin.empty())
+                               os << ",lmargin=" << from_ascii(Length(leftmargin).asLatexString());
+                       if (!rightmargin.empty())
+                               os << ",rmargin=" << from_ascii(Length(rightmargin).asLatexString());
+                       if (!headheight.empty())
+                               os << ",headheight=" << from_ascii(Length(headheight).asLatexString());
+                       if (!headsep.empty())
+                               os << ",headsep=" << from_ascii(Length(headsep).asLatexString());
+                       if (!footskip.empty())
+                               os << ",footskip=" << from_ascii(Length(footskip).asLatexString());
+                       if (!columnsep.empty())
+                               os << ",columnsep=" << from_ascii(Length(columnsep).asLatexString());
+                       os << "}\n";
+                       texrow.newline();
+               }
+       } else if (orientation == ORIENTATION_LANDSCAPE
+                  || papersize != PAPER_DEFAULT) {
                features.require("papersize");
        }