summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biblatex/cbx/authoryear-comp.cbx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex/cbx/authoryear-comp.cbx')
-rw-r--r--Master/texmf-dist/tex/latex/biblatex/cbx/authoryear-comp.cbx60
1 files changed, 49 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex/cbx/authoryear-comp.cbx b/Master/texmf-dist/tex/latex/biblatex/cbx/authoryear-comp.cbx
index 5936fe16d88..a290293d0ae 100644
--- a/Master/texmf-dist/tex/latex/biblatex/cbx/authoryear-comp.cbx
+++ b/Master/texmf-dist/tex/latex/biblatex/cbx/authoryear-comp.cbx
@@ -1,7 +1,12 @@
\ProvidesFile{authoryear-comp.cbx}
[\abx@cbxid]
-\ExecuteBibliographyOptions{labeldate,uniquename,uniquelist,sortcites,autocite=inline}
+\ExecuteBibliographyOptions{labeldate,uniquename,uniquelist,sortcites,
+ autocite=inline}
+
+\renewcommand*{\iffinalcitedelim}{%
+ \ifnumequal{\value{textcitecount}}{\value{textcitetotal}-1}}
+
\newbool{cbx:parens}
\newbibmacro*{cite:init}{%
@@ -100,12 +105,13 @@
\savefield{labelyear}{\cbx@lastyear}}
{\usebibmacro{cite:shorthand}%
\global\undef\cbx@lastyear}}%
- \savefield{namehash}{\cbx@lasthash}}%
+ \stepcounter{textcitecount}%
+ \savefield{namehash}{\cbx@lasthash}}%
\setunit{%
\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}%
- \multicitedelim}}
+ \textcitedelim}}
\newbibmacro*{cite:shorthand}{%
\printtext[bibhyperref]{\printfield{shorthand}}}
@@ -139,7 +145,7 @@
\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}%
- \multicitedelim}}}
+ \textcitedelim}}}
\DeclareCiteCommand{\cite}
{\usebibmacro{cite:init}%
@@ -197,19 +203,51 @@
{}
{\usebibmacro{postnote}}
-\DeclareCiteCommand{\textcite}
+\DeclareCiteCommand{\cbx@textcite}
{\usebibmacro{cite:init}}
{\usebibmacro{citeindex}%
\usebibmacro{textcite}}
{}
{\usebibmacro{textcite:postnote}}
+\DeclareCiteCommand{\textcite}[\cbx@textcite@init\cbx@textcite]
+ {\gdef\cbx@savedkeys{}%
+ \citetrackerfalse%
+ \pagetrackerfalse%
+ \DeferNextCitekeyHook%
+ \usebibmacro{cite:init}}
+ {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
+ {\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}%
+ \global\clearfield{multipostnote}}
+ {}%
+ \xappto\cbx@savedkeys{\thefield{entrykey},}%
+ \iffieldequals{namehash}{\cbx@lasthash}
+ {}
+ {\stepcounter{textcitetotal}%
+ \savefield{namehash}{\cbx@lasthash}}}
+ {}
+ {\protected@xappto\cbx@savedcites{%
+ [\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}
+
+\newrobustcmd{\cbx@textcite@init}[2]{%
+ \setcounter{textcitetotal}{0}%
+ \setcounter{textcitecount}{0}%
+ \def\cbx@savedcites{#1}#2\cbx@savedcites\empty}
+
+\DeclareMultiCiteCommand{\cbx@textcites}{\cbx@textcite}{}
+\DeclareMultiCiteCommand{\textcites}[\cbx@textcites@init\cbx@textcites]{\textcite}{}
+
+\let\cbx@textcites@init\cbx@textcite@init
+\pretocmd{\cbx@textcites@init}{\UseNextMultiCiteHook}{}{}
+
\DeclareMultiCiteCommand{\cites}{\cite}{\setunit{\multicitedelim}}
-\DeclareMultiCiteCommand{\parencites}[\mkbibparens]{\parencite}{\setunit{\multicitedelim}}
-\DeclareMultiCiteCommand{\footcites}[\mkbibfootnote]{\footcite}{\setunit{\multicitedelim}}
-\DeclareMultiCiteCommand{\footcitetexts}[\mkbibfootnotetext]{\footcitetext}{\setunit{\multicitedelim}}
-\DeclareMultiCiteCommand{\smartcites}[\iffootnote\mkbibparens\mkbibfootnote]{\smartcite}
- {\setunit{\multicitedelim}}
-\DeclareMultiCiteCommand{\textcites}{\textcite}{}
+\DeclareMultiCiteCommand{\parencites}[\mkbibparens]{\parencite}
+ {\setunit{\multicitedelim}}
+\DeclareMultiCiteCommand{\footcites}[\mkbibfootnote]{\footcite}
+ {\setunit{\multicitedelim}}
+\DeclareMultiCiteCommand{\footcitetexts}[\mkbibfootnotetext]
+ {\footcitetext}{\setunit{\multicitedelim}}
+\DeclareMultiCiteCommand{\smartcites}[\iffootnote\mkbibparens\mkbibfootnote]
+ {\smartcite}{\setunit{\multicitedelim}}
\endinput