[LyX/master] Improve representation of APA citation

Juergen Spitzmueller spitz at lyx.org
Thu Jul 11 07:21:02 UTC 2024


commit fbbe1eb01386ef6c1bd6e85cf66a5c07cd559863
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Thu Jul 11 09:20:19 2024 +0200

    Improve representation of APA citation
---
 lib/citeengines/biblatex-natbib.citeengine | 13 ++++++++++---
 lib/citeengines/biblatex.citeengine        | 13 ++++++++++---
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/lib/citeengines/biblatex-natbib.citeengine b/lib/citeengines/biblatex-natbib.citeengine
index 2a3a122f42..8ea22cb019 100644
--- a/lib/citeengines/biblatex-natbib.citeengine
+++ b/lib/citeengines/biblatex-natbib.citeengine
@@ -175,6 +175,8 @@ CiteFormat default
 	# Add " , and " before the last item (but " and " if there are only two), else ", "
 	!smartsep {%second%[[{%next%[[%B_namesep%]][[%B_pairnamesep%]]}]][[{%next%[[%B_namesep%]][[%B_lastnamesep%]]}]]}
 
+	# "Author et al." (if > 3 authors) or "??" (variant in parentheses)
+	!abbrvpciteauthor {%abbrvciteauthor%[[{%ifstyle:apa%[[%abbrvciteauthor&%]][[%abbrvciteauthor%]]}]][[??]]}
 	# "Author et al." or "??"
 	!abbrvciteauthor {%abbrvciteauthor%[[%abbrvciteauthor%]][[??]]}
 	# "Author, ..." or "??"
@@ -252,9 +254,12 @@ CiteFormat authoryear
 	!open (
 	!sep ;
 	!close )
+	!aysep {%ifstyle:apa%[[,]]}
 
 	# "cf. Author et. al Year..."
-	!makecite %!ctextbefore%%!startlink%%!abbrvciteauthor% %!makeyear%%!endlink%%!ctextafter%%!nextcite%
+	!makecite %!ctextbefore%%!startlink%%!abbrvciteauthor%%!aysep% %!makeyear%%!endlink%%!ctextafter%%!nextcite%
+	# "cf. Author et. al Year..."
+	!makepcite %!ctextbefore%%!startlink%%!abbrvpciteauthor%%!aysep% %!year%%!endlink%%!ctextafter%%!nextpcite%
 	# "Author et al. (cf. Year..."
 	!makecitet %!startlink%%!makeauthor%%!endlink% %!open%%!textbefore%%!makeyear%%!nextcitet%
 	# "cf. Author et al. Year..."
@@ -264,6 +269,8 @@ CiteFormat authoryear
 
 	# "...; Nextauthor Year..."
 	!nextcite {%next%[[%!sep% %!makecite%]]}
+	# "...; Nextauthor Year..."
+	!nextpcite {%next%[[%!sep% %!makepcite%]]}
 	# "...), [and] Nextauthor (Year..."
 	!nextcitet {%next%[[%!close%%!smartsep%%!startlink%%!makeauthor%%!endlink% %!open%%!makeyear%%!nextcitet%]]}
 	# "...; NextAuthor et al. Year..."
@@ -280,7 +287,7 @@ CiteFormat authoryear
 	# "Author (cf. Year),[ and] NextAuthor (Year, p. xx)"
 	citet %!makecitet%%!textafter%%!close%
 	# "(cf. Author et al., Year; NextAuthor et al., Year, p. xx)"
-	citep %!open%%!textbefore%%!makecitealp%%!textafter%%!close%
+	citep %!open%%!textbefore%%!makepcite%%!textafter%%!close%
 	# "cf. Author et al., Year; NextAuthor et al., Year, p. xx"
 	citealp %!textbefore%%!makecitealp%%!textafter%
 	# "cf. Author Year; NextAuthor Year, p. xx" [NB: textbefore position differs from real natbib!]
@@ -288,7 +295,7 @@ CiteFormat authoryear
 	# "Footnote: cf. Author A Year; Author B Year, p. xx."
 	footcite {%dialog%[[%_footnote%]][[%_foot%]]}: %!textbefore%%!makecite%%!textafter%.
 	# "Auto: (cf. Author A Year; Author B Year, p. xx)"
-	autocite {%dialog%[[%_autocite%]][[%_auto%]]}: %!open%%!textbefore%%!makecite%%!textafter%%!close%
+	autocite {%dialog%[[%_autocite%]][[%_auto%]]}: %!open%%!textbefore%%!makepcite%%!textafter%%!close%
 
 	# Fallback style: "Author A (cf. Year),[ and] Author B (Year, p. xx)"
 	cite %!makecitet%%!textafter%%!close%
diff --git a/lib/citeengines/biblatex.citeengine b/lib/citeengines/biblatex.citeengine
index a1530c6ea5..fe05a0a9b2 100644
--- a/lib/citeengines/biblatex.citeengine
+++ b/lib/citeengines/biblatex.citeengine
@@ -180,6 +180,8 @@ CiteFormat default
 	# "...; NextKey..."
 	!nextfullcite {%next%[[%!sep% %bibentry%%!nextfullcite%]]}
 
+	# "Author et al." (if > 3 authors) or "??" (variant in parentheses)
+	!abbrvpciteauthor {%abbrvciteauthor%[[{%ifstyle:apa%[[%abbrvciteauthor&%]][[%abbrvciteauthor%]]}]][[??]]}
 	# "Author et al." (if > 3 authors) or "??"
 	!abbrvciteauthor {%abbrvciteauthor%[[%abbrvciteauthor%]][[??]]}
 	# "Author et al." (always) or "??"
@@ -240,14 +242,19 @@ CiteFormat authoryear
 	!open (
 	!sep ;
 	!close )
+	!aysep {%ifstyle:apa%[[,]]}
 
 	# "cf. Author et. al Year..."
-	!makecite %!ctextbefore%%!startlink%%!abbrvciteauthor% %!year%%!endlink%%!ctextafter%%!nextcite%
+	!makecite %!ctextbefore%%!startlink%%!abbrvciteauthor%%!aysep% %!year%%!endlink%%!ctextafter%%!nextcite%
+	# "cf. Author et. al Year..."
+	!makepcite %!ctextbefore%%!startlink%%!abbrvpciteauthor%%!aysep% %!year%%!endlink%%!ctextafter%%!nextpcite%
 	# Author et al. (cf. Year...
 	!maketextcite {%ifqualified%[[%!textbefore%]]}%!startlink%%!abbrvciteauthor%%!endlink% %!open%{%ifqualified%[[%!ctextbefore%]][[%!textbefore%]]}%!year%%!ctextafter%%!nexttextcite%
 
 	# "...; Nextauthor Year..."
 	!nextcite {%next%[[%!sep% %!makecite%]]}
+	# "...; Nextauthor Year..."
+	!nextpcite {%next%[[%!sep% %!makepcite%]]}
 	# "...); Nextauthor (Year..."
 	!nexttextcite {%next%[[%!close%%!smartsep%%!startlink%%!abbrvciteauthor%%!endlink% %!open%%!ctextbefore%%!year%%!ctextafter%%!nexttextcite%]]}
 
@@ -269,7 +276,7 @@ CiteFormat authoryear
 	# "cf. Author A (Year),[ and] Author B (Year, p. xx)"
 	citet %!maketextcite%%!textafter%%!close%
 	# "(cf. Author A Year; Author B Year, p. xx)"
-	citep %!open%%!textbefore%%!makecite%%!textafter%%!close%
+	citep %!open%%!textbefore%%!makepcite%%!textafter%%!close%
 	# This prints year or title, if year is missing
 	citeyear %!textbefore%%!startlink%%!shyeartitle%%!endlink%%!nextshyeartitle%%!textafter%
 	# "(cf. Year; Nextyear, p. xx)"
@@ -277,7 +284,7 @@ CiteFormat authoryear
 	# "Footnote: cf. Author A Year; Author B Year, p. xx."
 	footcite {%dialog%[[%_footnote%]][[%_foot%]]}: %!textbefore%%!makecite%%!textafter%.
 	# "Auto: (cf. Author A Year; Author B Year, p. xx)"
-	autocite {%dialog%[[%_autocite%]][[%_auto%]]}: %!open%%!textbefore%%!makecite%%!textafter%%!close%
+	autocite {%dialog%[[%_autocite%]][[%_auto%]]}: %!open%%!textbefore%%!makepcite%%!textafter%%!close%
 End
 
 CiteFormat numerical


More information about the lyx-cvs mailing list