summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biblatex-opcit-booktitle
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-06-14 17:53:25 +0000
committerKarl Berry <karl@freefriends.org>2015-06-14 17:53:25 +0000
commit02f01f7ec631cb85a67d59c9be5ab48e9d936d30 (patch)
tree1d8a3631280d569e424181c9b880b40685cd2534 /Master/texmf-dist/tex/latex/biblatex-opcit-booktitle
parent0064febc472a7423c4e27f5e6708263587c19b89 (diff)
biblatex-opcit-booktitle (6jun15)
git-svn-id: svn://tug.org/texlive/trunk@37533 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex-opcit-booktitle')
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-opcit-booktitle/biblatex-opcit-booktitle.sty94
1 files changed, 94 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex-opcit-booktitle/biblatex-opcit-booktitle.sty b/Master/texmf-dist/tex/latex/biblatex-opcit-booktitle/biblatex-opcit-booktitle.sty
new file mode 100644
index 00000000000..90cb51fa48c
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/biblatex-opcit-booktitle/biblatex-opcit-booktitle.sty
@@ -0,0 +1,94 @@
+% Copyright 2015-... Maïeul Rouquette
+%
+% Inspired by Paul Stanley http://tex.stackexchange.com/a/172777/7712
+%
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Maïeul Rouquette
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{biblatex-opcit-booktitle}[2015/06/05 v1.0.2 Manage op. cit. when using subentry]
+\RequirePackage{xpatch}
+
+\newbibmacro*{cite:seen:related}{%
+ {\xifinlistcs{\thefield{crossref}}{blx@bsee@\the\c@refsection}
+ {}
+ {\listcsxadd{blx@bsee@\the\c@refsection}{\thefield{crossref}}}}}
+
+\newcommand{\ifrelatedunseen}[2]{%
+ \xifinlistcs{\thefield{crossref}}{blx@bsee@\the\c@refsection}
+ {#2}
+ {#1}}
+
+\xpatchbibmacro{cite}%
+ {\usebibmacro{cite:full}%
+ \usebibmacro{cite:save}}%
+ {\usebibmacro{cite:test:ifrelated}}%
+ {}%
+ {}%
+
+
+\newbibmacro*{cite:test:ifrelated}%
+ {\ifboolexpr {
+ test {\iffieldundef{crossref}}
+ or not ( test {\ifentrytype{inbook}}
+ or test {\ifentrytype{incollection}}
+ or test {\ifentrytype{inproceedings}}
+ or test {\ifentrytype{bookinbook}} ) }
+ {\usebibmacro{cite:full}%
+ \usebibmacro{cite:save}}
+ {\ifrelatedunseen
+ {\usebibmacro{cite:seen:related}%
+ \usebibmacro{cite:full}%
+ \usebibmacro{cite:save}}
+ {\usebibmacro{related:info}}}}
+
+\newbibmacro*{related:info}{%
+ \usebibmacro{cite:full:citepages}%
+ \usedriver%
+ {\DeclareNameAlias{sortname}{default}}%
+ {inbook:rel}
+}
+
+\DeclareBibliographyDriver{inbook:rel}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/translator+others}%
+ \setunit{\labelnamepunct}\newblock
+ \usebibmacro{title}%
+ \newunit
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}%
+ \newunit\newblock
+ \usebibmacro{in:}%
+ \usebibmacro{maintitle+booktitle}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}%
+ \newunit%
+ \iffieldundef{maintitle}%
+ {\printfield{volume}%
+ \printfield{part}}
+ {}%
+ \newunit%
+ \bibstring[\mkibid]{opcit}%
+ \newunit\newblock
+ \usebibmacro{chapter+pages}%
+ \newunit\newblock
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}}
+\endinput