[LyX/2.4.x] Fix loading order of fancyhdr (#13118)

Juergen Spitzmueller spitz at lyx.org
Fri Nov 1 15:15:31 UTC 2024


commit 008c7cfa477cedf9593351bbb66e172cd29ae746
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Fri Nov 1 14:49:29 2024 +0100

    Fix loading order of fancyhdr (#13118)
    
    This must be loaded after geometry (amends ca4fc01847c721)
    
    (cherry picked from commit 561aa8bb32180b6af9f1679bbb53890c898de68d)
---
 src/BufferParams.cpp  | 6 ------
 src/LaTeXFeatures.cpp | 6 ++++++
 status.24x            | 2 ++
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index ad6b831eb3..dcd539dfd1 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -2119,12 +2119,6 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
 		features.require("papersize");
 	}
 
-	if (tokenPos(tclass.opt_pagestyle(), '|', pagestyle) >= 0) {
-		if (pagestyle == "fancy")
-			os << "\\usepackage{fancyhdr}\n";
-		os << "\\pagestyle{" << from_ascii(pagestyle) << "}\n";
-	}
-
 	// only output when the background color is not default
 	if (isbackgroundcolor) {
 		// only require color here, the background color will be defined
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index ab7c62c355..7a4831ccd3 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -1389,6 +1389,12 @@ string const LaTeXFeatures::getPackages() const
 	if (!params_.set_geometry.empty())
 		packages << params_.set_geometry;
 
+	if (tokenPos(params_.documentClass().opt_pagestyle(), '|', params_.pagestyle) >= 0) {
+		if (params_.pagestyle == "fancy")
+			packages << "\\usepackage{fancyhdr}\n";
+		packages << "\\pagestyle{" << params_.pagestyle << "}\n";
+	}
+
 	// These must be loaded after graphicx, since they try
 	// to load graphicx without options
 	if (mustProvide("rotating"))
diff --git a/status.24x b/status.24x
index 8bf34af6f2..f2d63aed2c 100644
--- a/status.24x
+++ b/status.24x
@@ -70,6 +70,8 @@ What's new
 
 - Fix LaTeX error with listings, book classes and utf8 encoding.
 
+- Fix loading order of fancyhdr (bug 13118).
+
 
 * USER INTERFACE
 


More information about the lyx-cvs mailing list