Jürgen Spitzmüller wrote:
> A possibility for native support without this additional module would be a 
> line
> 
> Requires natbibapa 1
> 
> which causes LyX to load apacite with natbibapa option instead of natbib 
> itself (and plain apacite) if natbib is required.

Such as the attached.

Jürgen
diff --git a/lib/layouts/apa6.layout b/lib/layouts/apa6.layout
index 9641621..ed4ecbf 100644
--- a/lib/layouts/apa6.layout
+++ b/lib/layouts/apa6.layout
@@ -8,6 +8,9 @@ Columns                 1
 Sides                   1
 PageStyle               Headers
 
+# If natbib is selected, do not load the natbib package directly
+# but rather apacite with "natbibapa" option
+Requires natbibapa
 
 ClassOptions
 	Other "man"
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 562f9b1..b0f7308 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -909,6 +909,11 @@ string const LaTeXFeatures::getPackages() const
 	    params_.use_package("esint") != BufferParams::package_off)
 		packages << "\\usepackage{esint}\n";
 
+	if (mustProvide("natbibapa") && mustProvide("natbib")) {
+		packages << "\\PassOptionsToPackage{natbibapa}{apacite}\n"
+			 << "\\usepackage{apacite}\n";
+	}
+	
 	// Known bibliography packages (simple \usepackage{package})
 	for (int i = 0; i < nb_bibliofeatures; ++i) {
 		if (mustProvide(bibliofeatures[i]))
@@ -924,7 +929,8 @@ string const LaTeXFeatures::getPackages() const
 	// Some classes load natbib themselves, but still allow (or even require)
 	// plain numeric citations (ReVTeX is such a case, see bug 5182).
 	// This special case is indicated by the "natbib-internal" key.
-	if (mustProvide("natbib") && !isProvided("natbib-internal")) {
+	if (mustProvide("natbib") && !isProvided("natbib-internal")
+	    && !mustProvide("natbibapa")) {
 		packages << "\\usepackage[";
 		if (params_.citeEngineType() == ENGINE_TYPE_NUMERICAL)
 			packages << "numbers";

Reply via email to