[LyX/2.3.x] Ignore geometry-related settings if the class provides geometry

Juergen Spitzmueller spitz at lyx.org
Wed Jan 29 14:48:59 UTC 2020


commit b0a286893868bfcbf6ba51e88571e73bc8e110e9
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Wed Jan 29 11:25:01 2020 +0100

    Ignore geometry-related settings if the class provides geometry
    
    Fixes #11724
    
    (cherry picked from commit dce9e44a1421350f275c9a3131f7e0532477c3a6)
---
 src/BufferParams.cpp |   18 ++++++++----------
 status.23x           |    4 +++-
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 1b740dc..8b40867 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -1803,7 +1803,8 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
 		os << "}\n";
 	}
 
-	if (use_geometry || nonstandard_papersize) {
+	if (!features.isProvided("geometry")
+            && (use_geometry || nonstandard_papersize)) {
 		odocstringstream ods;
 		if (!getGraphicsDriver("geometry").empty())
 			ods << getGraphicsDriver("geometry");
@@ -1915,20 +1916,17 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
 			break;
 		}
 		docstring g_options = trim(ods.str(), ",");
+		os << "\\usepackage";
 		// geometry-light means that the class works with geometry, but overwrites
 		// the package options and paper sizes (memoir does this).
 		// In this case, all options need to go to \geometry
 		// and the standard paper sizes need to go to the class options.
-		if (!features.isProvided("geometry")) {
-			os << "\\usepackage";
-			if (!g_options.empty() && !features.isProvided("geometry-light")) {
-				os << '[' << g_options << ']';
-				g_options.clear();
-			}
-			os << "{geometry}\n";
+		if (!g_options.empty() && !features.isProvided("geometry-light")) {
+			os << '[' << g_options << ']';
+			g_options.clear();
 		}
-		if (use_geometry || features.isProvided("geometry")
-		    || features.isProvided("geometry-light")) {
+		os << "{geometry}\n";
+		if (use_geometry || features.isProvided("geometry-light")) {
 			os << "\\geometry{verbose";
 			if (!g_options.empty())
 				// Output general options here with "geometry light".
diff --git a/status.23x b/status.23x
index ee8dbd8..e7e08f9 100644
--- a/status.23x
+++ b/status.23x
@@ -47,6 +47,8 @@ What's new
 - Fix problems with recent LaTeX when \input at path contains tilde and space
   (bug 11699).
 
+- Fix output with class-provided geometry package (bug 11724).
+
 - Fix erroneous space in output caused by changebar module (bug 11473).
 
 - Correctly strike out deleted text after deleted display math (bug 11716).
@@ -56,7 +58,7 @@ What's new
 
 - Fix backspace deletion of selected items with change tracking (bug 11630).
 
-- Fix display glith where the change tracking cue blinks with the cursor
+- Fix display glitch where the change tracking cue blinks with the cursor
   (bug 11684).
 
 - Consider shorthand in biblatex cite display (bug 11696).


More information about the lyx-cvs mailing list