summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biblatex-gost/gost-inline.cbx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-07-18 23:29:16 +0000
committerKarl Berry <karl@freefriends.org>2013-07-18 23:29:16 +0000
commit549f87a2032890440c9d3fc9faa568628588e2b3 (patch)
treea3f51974b1e68ac611e7a047d82c369e5ad8a64e /Master/texmf-dist/tex/latex/biblatex-gost/gost-inline.cbx
parent16369bdd3c6726591b6196400880febbfb529a2e (diff)
biblatex-gost (18jul13)
git-svn-id: svn://tug.org/texlive/trunk@31233 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex-gost/gost-inline.cbx')
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gost/gost-inline.cbx448
1 files changed, 364 insertions, 84 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex-gost/gost-inline.cbx b/Master/texmf-dist/tex/latex/biblatex-gost/gost-inline.cbx
index 5491eea6a82..1e01516a8ba 100644
--- a/Master/texmf-dist/tex/latex/biblatex-gost/gost-inline.cbx
+++ b/Master/texmf-dist/tex/latex/biblatex-gost/gost-inline.cbx
@@ -1,5 +1,5 @@
\ProvidesFile{gost-inline.cbx}
-[2013/04/03\space v0.8\space biblatex-gost styles]
+[2013/07/17\space v0.9\space biblatex-gost styles]
\DeclareLabelname
[inbook,incollection,inproceedings,inreference,suppbook,suppcollection,suppperiodical,bookinbook]
@@ -10,9 +10,11 @@
\DeclareFieldFormat{bibhypertarget}{%
\bibhypertarget{\thefield{entrykey}:\the\value{instcount}}{#1}}
\providecommand*{\mkibid}[1]{#1}
-\newtoggle{cbx:loccit}
-\newtoggle{cbx:t:bookibid} % for .. // Ibid. in inbook, incollection,..
-\newtoggle{cbx:f:bookibid}
+\renewcommand*{\iffinalcitedelim}{%
+ \ifnumequal{\value{textcitecount}}{\value{textcitetotal}-1}}
+
+\newtoggle{cbx:loccit} % needed because \blx@loccittracker is executed before 'postnote'
+\newtoggle{cbx:xrefloccit}
\newtoggle{cbx:opt:inbookibid}
\DeclareBibliographyOption{strict}[true]{%
@@ -74,9 +76,9 @@
test {\ifnumequal{\value{citecount}}{\value{citetotal}}}
and
(
- not test {\iffieldundef{pages}}
- or
- not test {\iffieldundef{pagetotal}}
+ not test {\iffieldundef{pages}}
+ or
+ not test {\iffieldundef{pagetotal}}
)
}
{\usebibmacro{cite:postnote:pages}}
@@ -93,58 +95,292 @@
{\def\blx@mincrossrefs{1}}
{}}
-\AtEveryCitekey{%
- \ifcsdef{abx@field@hyphenation}{%
- \edef\blx@languagename{\abx@field@hyphenation}%
- \select@language{\abx@field@hyphenation}%
- \blx@hyphenreset}%
- {}%
-}
-
\DeclareNameAlias{labelname}{author}
\DeclareFieldFormat*{citetitle}{#1}
\renewcommand{\postnotedelim}{\addperiod\space}
\renewcommand{\multicitedelim}{\addsemicolondelim\space}
+% two xref trackers below should go before the option execution
+%
+% xref ibidem tracker
+
+\appto\blx@ibidtracker@gobal{%
+ \ifbool{citetracker}
+ {\blx@imc@iffieldundef{crossref}
+ {\blx@imc@iffieldundef{xref}
+ {\global\undef\blx@lastxref@text}
+ {\blx@imc@savefield{xref}{\blx@lastxref@text}}}
+ {\blx@imc@savefield{crossref}{\blx@lastxref@text}}}
+ {}}
+
+\appto\blx@ibidtracker@context{%
+ \ifbool{citetracker}
+ {\iftoggle{blx@footnote}
+ {\blx@imc@iffieldundef{crossref}
+ {\blx@imc@iffieldundef{xref}
+ {\global\undef\blx@lastxref@foot}
+ {\blx@imc@savefield{xref}{\blx@lastxref@foot}}}
+ {\blx@imc@savefield{crossref}{\blx@lastxref@foot}}}
+ {\blx@imc@iffieldundef{crossref}
+ {\blx@imc@iffieldundef{xref}
+ {\global\undef\blx@lastxref@text}
+ {\blx@imc@savefield{xref}{\blx@lastxref@text}}}
+ {\blx@imc@savefield{crossref}{\blx@lastxref@text}}}}
+ {}}
+
+\appto\blx@ibidreset@force{%
+ \global\undef\blx@lastxref@text%
+ \global\undef\blx@lastxref@foot}
+
+\appto\blx@ibidreset@gobal{%
+ \global\undef\blx@lastxref@text}
+
+\appto\blx@ibidreset@context{%
+ \iftoggle{blx@footnote}
+ {\global\undef\blx@lastxref@foot}
+ {\global\undef\blx@lastxref@text}}
+
+\protected\appto\abx@savetrackers{%
+ \global\let\blx@saved@lastxref@text\blx@lastxref@text%
+ \global\let\blx@saved@lastxref@foot\blx@lastxref@foot}
+
+\protected\appto\abx@resttrackers{%
+ \global\let\blx@lastxref@text\blx@saved@lastxref@text%
+ \global\let\blx@lastxref@foot\blx@saved@lastxref@foot}
+
+\protected\appto\abx@cleartrackers{%
+ \global\undef\blx@saved@lastxref@text%
+ \global\undef\blx@saved@lastxref@foot}
+
+% {<true>}{<false>}
+
+\def\blx@xrefibid@check#1{%
+ \ifboolexpr{
+ test {\blx@imc@iffieldequalcs{crossref}{blx@lastxref@#1}}
+ or
+ test {\blx@imc@iffieldequals{xref}{blx@lastxref@#1}}
+ }}
+
+\def\blx@ifxrefibid@global{%
+ \blx@xrefibid@check{text}}
+
+\def\blx@ifxrefibid@context{%
+ \iftoggle{blx@footnote}
+ {\blx@xrefibid@check{foot}}
+ {\blx@xrefibid@check{text}}}
+
+\def\blx@ifxrefibid@strict{%
+ \blx@ifcitesingle
+ {\blx@ifciteibid@global}
+ {\@secondoftwo}}%
+
+\def\blx@ifxrefibid@constrict{%
+ \blx@ifcitesingle
+ {\iftoggle{blx@footnote}
+ {\blx@ifmpfncheck
+ {\blx@xrefibid@check{foot}}
+ {\@secondoftwo}}
+ {\blx@xrefibid@check{text}}}
+ {\@secondoftwo}}%
+
+\blx@regimcs{\ifxrefibid}
+
+\appto\blx@blxinit{%
+ \appto\blx@TE@hook{%
+ \def\ifxrefibid{\blx@TE\blx@imc@ifxrefibid}}}
+
+\appto\blx@opt@ibidtracker@true{%
+ \let\blx@imc@ifxrefibid\blx@ifxrefibid@global}
+\appto\blx@opt@ibidtracker@false{%
+ \let\blx@imc@ifxrefibid\@secondoftwo}
+\appto\blx@opt@ibidtracker@context{%
+ \let\blx@imc@ifxrefibid\blx@ifxrefibid@context}
+\appto\blx@opt@ibidtracker@strict{%
+ \let\blx@imc@ifxrefibid\blx@ifxrefibid@strict}
+\appto\blx@opt@ibidtracker@constrict{%
+ \let\blx@imc@ifxrefibid\blx@ifxrefibid@constrict}
+
+% end of xref ibidem tracker code
+
+% xrefloccit tracker
+% {<true>}{<false>}
+
+\def\blx@ifxrefloccit@global{%
+ \blx@xrefloccit@check{text}}
+
+\def\blx@ifxrefloccit@context{%
+ \iftoggle{blx@footnote}
+ {\blx@xrefloccit@check{foot}}
+ {\blx@xrefloccit@check{text}}}
+
+\def\blx@ifxrefloccit@strict{%
+ \blx@ifcitesingle
+ {\blx@xrefloccit@numcheck{text}}
+ {\@secondoftwo}}%
+
+\def\blx@ifxrefloccit@constrict{%
+ \blx@ifcitesingle
+ {\iftoggle{blx@footnote}
+ {\blx@ifmpfncheck
+ {\blx@xrefloccit@numcheck{foot}}
+ {\@secondoftwo}}
+ {\blx@xrefloccit@numcheck{text}}}
+ {\@secondoftwo}}
+
+\def\blx@xrefloccit@check#1{%
+ \blx@imc@ifxrefibid
+ {\blx@imc@iffieldundef{postnote}
+ {\@secondoftwo}
+ {\blx@imc@iffieldequalcs{postnote}{blx@xreflastnote@#1}}}
+ {\@secondoftwo}}
+
+\def\blx@xrefloccit@numcheck#1{%
+ \blx@imc@ifxrefibid
+ {\blx@imc@iffieldundef{postnote}
+ {\@secondoftwo}
+ {\expandafter\blx@imc@ifpages
+ \expandafter{\abx@field@postnote}
+ {\blx@imc@iffieldequalcs{postnote}{blx@xreflastnote@#1}}
+ {\@secondoftwo}}}
+ {\@secondoftwo}}
+
+\blx@regimcs{\ifxrefloccit}
+
+% loccit tracker patching
+
+\appto\blx@loccittracker@gobal{%
+ \ifbool{citetracker}
+ {\blx@xrefloccit@tracker{text}}
+ {}}
+
+\appto\blx@loccittracker@context{%
+ \ifbool{citetracker}
+ {\iftoggle{blx@footnote}
+ {\blx@xrefloccit@tracker{foot}}
+ {\blx@xrefloccit@tracker{text}}}
+ {}}
+
+\appto\blx@loccittracker@strict{%
+ \ifbool{citetracker}
+ {\blx@xrefloccit@stricttracker{text}}
+ {}}
+
+\appto\blx@loccittracker@constrict{%
+ \ifbool{citetracker}
+ {\iftoggle{blx@footnote}
+ {\blx@mpfnsave
+ \blx@xrefloccit@stricttracker{foot}}
+ {\blx@xrefloccit@stricttracker{text}}}
+ {}}
+
+\def\blx@xrefloccit@tracker#1{%
+ \global\csundef{blx@xreflastnote@#1}%
+ \blx@imc@iffieldundef{postnote}
+ {}
+ {\global\cslet{blx@xreflastnote@#1}\abx@field@postnote}}
+
+\def\blx@xrefloccit@stricttracker#1{%
+ \global\csundef{blx@xreflastnote@#1}%
+ \blx@imc@iffieldundef{postnote}
+ {}
+ {\blx@ifcitesingle
+ {\expandafter\blx@imc@ifpages
+ \expandafter{\abx@field@postnote}
+ {\global\cslet{blx@xreflastnote@#1}\abx@field@postnote}
+ {}}
+ {}}}
+
+\apptocmd\blx@loccit@reset{% #1
+ \begingroup
+ \global\csundef{blx@xreflastnote@#1}%
+ \endgroup}
+ {}
+ {}
+
+\protected\appto\abx@savetrackers{%
+ \begingroup
+ \global\csletcs{blx@saved@xreflastnote@text}{blx@xreflastnote@text}%
+ \global\csletcs{blx@saved@xreflastnote@foot}{blx@xreflastnote@foot}%
+ \endgroup}
+
+\protected\appto\abx@resttrackers{%
+ \begingroup
+ %\blx@loccit@reset{text}%
+ \global\csletcs{blx@xreflastnote@text}{blx@saved@xreflastnote@text}%
+ %\blx@loccit@reset{foot}%
+ \global\csletcs{blx@xreflastnote@foot}{blx@saved@xreflastnote@foot}%
+ \endgroup}
+
+\protected\appto\abx@cleartrackers{%
+ \begingroup
+ \global\csundef{blx@saved@xreflastnote@text}%
+ \global\csundef{blx@saved@xreflastnote@foot}%
+ \endgroup}
+
+\appto\blx@blxinit{%
+ \appto\blx@TE@hook{%
+ \def\ifxrefloccit{\blx@TE\blx@imc@ifxrefloccit}}}
+
+\appto\blx@opt@loccittracker@true{%
+ \let\blx@imc@ifxrefloccit\blx@ifxrefloccit@global}
+\appto\blx@opt@loccittracker@false{%
+ \let\blx@imc@ifxrefloccit\@secondoftwo}
+\appto\blx@opt@loccittracker@context{%
+ \let\blx@imc@ifxrefloccit\blx@ifxrefloccit@context}
+\appto\blx@opt@loccittracker@strict{%
+ \let\blx@imc@ifxrefloccit\blx@ifxrefloccit@strict}
+\appto\blx@opt@loccittracker@constrict{%
+ \let\blx@imc@ifxrefloccit\blx@ifxrefloccit@constrict}
+
+% end of xrefloccit tracker code
+
\ExecuteBibliographyOptions{citetracker=constrict,autocite=inline,inbookibid=false,
citepages=omit,strict,opcittracker=constrict,labeltitle,
citeisbn=false,citeurl=false,citedoi=false,citeeprint=false}
+\newbibmacro*{set:cbx:loccit:toggles}{%
+ \ifloccit
+ {\global\toggletrue{cbx:loccit}}
+ {\global\togglefalse{cbx:loccit}}%
+ \ifxrefloccit
+ {\global\toggletrue{cbx:xrefloccit}}
+ {\global\togglefalse{cbx:xrefloccit}}}
+
\newbibmacro*{cite:seen}{% the same for cite and footcite
- \ifciteibid
- {\ifloccit{\global\toggletrue{cbx:loccit}}{}%
- \usebibmacro{cite:ibid}}
- {\ifopcit
- {\ifloccit{\global\toggletrue{cbx:loccit}}{}%
- \usebibmacro{cite:opcit}}
+ \iffirstonpage
+ {\iffieldundef{shorthand}
+ {\usebibmacro{cite:short}}
+ {\usebibmacro{cite:shorthand}}}
+ {\ifciteibid
+ {\usebibmacro{cite:ibid}}
+ {\ifopcit
+ {\usebibmacro{cite:opcit}}
{\iffieldundef{shorthand}
{\usebibmacro{cite:short}}
- {\usebibmacro{cite:shorthand}}}}%
-}
+ {\usebibmacro{cite:shorthand}}}}}}
\newbibmacro*{cite}{%
\usebibmacro{cite:citepages}%
- \global\togglefalse{cbx:loccit}%
- \ifboolexpr{%
- not test {\ifdefvoid{\cbx@t@lastcrossref}}
- and
- test {\iffieldequals{crossref}{\cbx@t@lastcrossref}}
- }%
- {\global\toggletrue{cbx:t:bookibid}}
- {\global\togglefalse{cbx:t:bookibid}%
- \savefield{crossref}{\cbx@t@lastcrossref}%
- \global\xdef\cbx@t@bookref{\thefield{entrykey}:\the\value{instcount}}}%
+ \usebibmacro{set:cbx:loccit:toggles}%
\ifciteseen
- {\global\togglefalse{cbx:t:bookibid}%
- \global\undef\cbx@t@lastcrossref%
- \global\undef\cbx@t@bookref%
- \usebibmacro{cite:seen}}
+ {\usebibmacro{cite:seen}}
{\usebibmacro{cite:full}%
- \usebibmacro{cite:save}}}
+ \usebibmacro{cite:save}{t}}}
-\newbibmacro*{cite:save}{%
- \csxdef{cbx@t@\thefield{entrykey}}{\the\value{instcount}}}%
+\newbibmacro*{cite:save:bookref}[1]{%
+ \usebibmacro{cbx:bookibid:check}
+ {}
+ {\iffieldundef{crossref}
+ {\iffieldundef{xref}
+ {}
+ {\csxdef{cbx@#1@bookref@\thefield{xref}}{\thefield{entrykey}:\the\value{instcount}}}}
+ {\csxdef{cbx@#1@bookref@\thefield{crossref}}{\thefield{entrykey}:\the\value{instcount}}}}}
+
+\newbibmacro*{cite:save}[1]{%
+ \csxdef{cbx@#1@\thefield{entrykey}}{\the\value{instcount}}%
+ \label{cbx@\the\value{instcount}}% what for?
+ \usebibmacro{cite:save:bookref}{#1}}
\newbibmacro{cite:clearfields}{%
\renewbibmacro*{series+number}{}%
@@ -161,6 +397,8 @@
\usebibmacro{shorthandintro}}
\newbibmacro*{cite:short}{%
+ \global\togglefalse{cbx:loccit}% always print postnote after short citation
+ \global\togglefalse{cbx:xrefloccit}%
\ifnameundef{labelname}
{\printfield{label}}
{\printnames{labelname}}%
@@ -201,33 +439,21 @@
\printfield[bibhyperlink]{shorthand}}
\newbibmacro*{cite:postnote:ibidpage}{%
- \iftoggle{cbx:loccit}
+ \ifboolexpr{
+ togl {cbx:loccit}
+ or
+ togl {cbx:xrefloccit}
+ }
{}
{\usebibmacro{postnote}}}
\newbibmacro*{footcite}{%
\usebibmacro{cite:citepages}%
- \global\togglefalse{cbx:loccit}%
- \ifboolexpr{%
- not test {\ifdefvoid{\cbx@f@lastcrossref}} % undef, \relax, or empty
- and
- test {\iffieldequals{crossref}{\cbx@f@lastcrossref}}
- }%
- {\global\toggletrue{cbx:f:bookibid}}
- {\global\togglefalse{cbx:f:bookibid}%
- \savefield{crossref}{\cbx@f@lastcrossref}%
- \global\xdef\cbx@f@bookref{\thefield{entrykey}:\the\value{instcount}}}%
+ \usebibmacro{set:cbx:loccit:toggles}%
\ifciteseen
- {\global\togglefalse{cbx:f:bookibid}%
- \global\undef\cbx@f@lastcrossref%
- \global\undef\cbx@f@bookref%
- \usebibmacro{cite:seen}}
+ {\usebibmacro{cite:seen}}
{\usebibmacro{cite:full}%
- \usebibmacro{footcite:save}}}
-
-\newbibmacro*{footcite:save}{%
- \csxdef{cbx@f@\thefield{entrykey}}{\the\value{instcount}}%
- \label{cbx@\the\value{instcount}}}
+ \usebibmacro{cite:save}{f}}}
\DeclareCiteCommand{\cite}
{\usebibmacro{prenote}}
@@ -270,35 +496,89 @@
{\multicitedelim}
{\usebibmacro{cite:postnote}}
-\DeclareCiteCommand{\textcite}[\cbx@textcite\footcite]
- {\gdef\cbx@savedkeys{}}
- {\printnames{labelname}%
- \xappto\cbx@savedkeys{\thefield{entrykey},}}
- {\multinamedelim}
- {\protected@xappto\cbx@savedcites{%
- [\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}
+\newbibmacro*{textcite}{%
+ \ifnameundef{labelname}
+ {\printfield[citetitle]{labeltitle}}
+ {\printnames{labelname}}}
+
+\newbibmacro*{textcite:init}{%
+ \citetrackerfalse%
+ \pagetrackerfalse%
+ \iffirstcitekey
+ {\global\undef\cbx@lasthash}
+ {}}
-\newrobustcmd{\cbx@textcite}[2]{%
- \def\cbx@savedcites{#1}#2\cbx@savedcites}
+\newbibmacro*{textcite:count}{%
+ \stepcounter{textcitetotal}%
+ \ifnumgreater{\value{labelname}}{\value{textcitemaxnames}}
+ {\setcounter{textcitemaxnames}{\value{labelname}}}
+ {}}
-\DeclareMultiCiteCommand{\textcites}[\cbx@textcite\footcites]{\textcite}{\multicitedelim}
+\DeclareCiteCommand{\cbx@textcite}
+ {\usebibmacro{textcite:init}}
+ {\iffieldequals{namehash}{\cbx@lasthash}
+ {}
+ {\iffirstcitekey
+ {}
+ {\textcitedelim}%
+ \stepcounter{textcitecount}%
+ \usebibmacro{textcite}%
+ \savefield{namehash}{\cbx@lasthash}}}
+ {}
+ {}
+
+\DeclareCiteCommand{\textcite}[\cbx@textcite@init\cbx@textcite\footcite]
+ {\usebibmacro{textcite:init}%
+ \gdef\cbx@savedkeys{}%
+ \DeferNextCitekeyHook}
+ {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
+ {\protected@xappto\cbx@footcite@args{%
+ (\thefield{multiprenote})(\thefield{multipostnote})}}
+ {}%
+ \xappto\cbx@savedkeys{\thefield{entrykey},}%
+ \iffieldequals{namehash}{\cbx@lasthash}
+ {}
+ {\usebibmacro{textcite:count}%
+ \savefield{namehash}{\cbx@lasthash}}%
+ \ifnumequal{\value{citecount}}{\value{citetotal}}
+ {\protected@xappto\cbx@textcite@args{{\cbx@savedkeys}}%
+ \protected@xappto\cbx@footcite@args{%
+ [\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}%
+ \iflastcitekey
+ {\protected@xappto\cbx@textcite@args{\thefield{postpunct}}%
+ \protected@xappto\cbx@footcite@args{\nopunct}}
+ {}}
+ {}}
+ {}
+ {}
+
+\newrobustcmd{\cbx@textcite@init}[3]{%
+ \setcounter{textcitetotal}{0}%
+ \setcounter{textcitecount}{0}%
+ \setcounter{textcitemaxnames}{0}%
+ \def\cbx@textcite@args{#1}\def\cbx@footcite@args{#2}#3%
+ \cbx@textcite@args\empty\cbx@footcite@args\empty}
+
+\DeclareMultiCiteCommand{\cbx@textcites}{\cbx@textcite}{}
+\DeclareMultiCiteCommand{\textcites}
+ [\cbx@textcites@init\cbx@textcites\footcites]{\textcite}{}
+
+\let\cbx@textcites@init\cbx@textcite@init
+\pretocmd{\cbx@textcites@init}{%
+ \UseNextMultiCiteHook%
+ \AtNextMultiCite{%
+ \renewbibmacro{multiprenote}{}%
+ \renewbibmacro{multipostnote}{}}}{}{}
\renewbibmacro*{cbx:bookibid:check}[2]{%
\ifboolexpr{%
- test {\ifcitation}
- and
- test {\iftoggle{cbx:opt:inbookibid}}
- and
- ( ( test {\iffootnote}
+ togl {cbx:opt:inbookibid}
and
- test {\iftoggle{cbx:f:bookibid}} )
- or
- ( not test {\iffootnote}
- and
- test {\iftoggle{cbx:t:bookibid}} )
- )
- }
- {#1}
- {#2}}
+ test {\ifcitation}
+ and
+ test {\ifxrefibid}
+ }
+ {#1}
+ {#2}}
\endinput