summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biblatex-opcit-booktitle
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-10-24 20:30:14 +0000
committerKarl Berry <karl@freefriends.org>2018-10-24 20:30:14 +0000
commit33a39ade6f653864998d0ce54a94f6e09df2bd89 (patch)
treee1baf7cb83f4c202512b9d1b3d67d45ced5cc114 /Master/texmf-dist/tex/latex/biblatex-opcit-booktitle
parent5eaeb0a62717f47efd6054e4390f8b707e9cf584 (diff)
biblatex-opcit-booktitle (24oct18)
git-svn-id: svn://tug.org/texlive/trunk@48983 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.sty67
1 files changed, 57 insertions, 10 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
index 04f3b58428a..fb5063f624d 100644
--- 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
@@ -1,5 +1,5 @@
% Copyright 2015-... Maïeul Rouquette
-%
+%
% Inspired by Paul Stanley http://tex.stackexchange.com/a/172777/7712
%
%
@@ -12,14 +12,20 @@
% 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}[2017/03/27 v1.8.0 Manage op. cit. when using subentry]
+\ProvidesPackage{biblatex-opcit-booktitle}[2018/10/24 v1.9.0 Manage op. cit. when using subentry]
\RequirePackage{xpatch}
+\RequirePackage{xkeyval}%
+
+\newtoggle{opcit@booktitle@bibliography@shorttitle}%
+\newtoggle{opcit@booktitle@bibliography@onlyshorttitle}%
+\DeclareOptionX{bibliography}[]{\toggletrue{opcit@booktitle@bibliography@#1}}%
+\ProcessOptionsX%
+% Declaration of the entries concerned. Some package could have already add their own entry
\def\opcit@booktitle@entrytypes@novolume{}
-% Declaration of the entry concerned. Some package could have already add their own entry
\listadd\opcit@booktitle@entrytypes{inbook}
\listadd\opcit@booktitle@entrytypes{incollection}
\listadd\opcit@booktitle@entrytypes{inproceedings}
@@ -61,7 +67,7 @@
{#1}%
}%
}%
-
+
\RequirePackage{ltxcmds}
@@ -116,20 +122,33 @@
\usebibmacro{cite:seen:related}%
\usebibmacro{cite:full}%
}}%
- {\usebibmacro{related:info}}}}
-
-\newbibmacro*{related:info}{%
- % Here an hack to use the short form of the booktitle without recurring to a .dbx file in order to define new fields (because recurring to a .dbx file for such feature is complex for a little feature)
+ {\usebibmacro{related:info}}}}
+
+% Here an hack to use the short form of the booktitle without recurring to a .dbx file in order to define new fields (because recurring to a .dbx file for such feature is complex for a little feature).
+% The related:info:booktitle macro change the booktitle field to the shorttitle field of the parent entry.
+% The related:info calls this macro and them call the driver of the main entry.
+
+\newbibmacro*{related:info:booktitle}{%
+ \undef\shortbooktitle%
+ \undef\bookentrytype%
\entrydata{\thefield{crossref}}{%
\savefield{shorttitle}{\shortbooktitle}%
\savefield{entrytype}{\bookentrytype}%
}%
\ifdef{\shortbooktitle}%
+ {%
+ \iffieldundef{crossref}%
+ {}%
{%
\restorefield{booktitle}{\shortbooktitle}%
\clearfield{booksubtitle}%
}%
- {}%
+ }%
+ {}%
+}%
+
+\newbibmacro*{related:info}{%
+ \usebibmacro{related:info:booktitle}%
\usebibmacro{cite:full:citepages}%
\printtext[bibhypertarget]{\usedriver%
{\DeclareNameAlias{sortname}{default}}%
@@ -275,4 +294,32 @@
\setunit{\labelnamepunct}\newblock%
}%
}
+
+% Patching begenentry macro to apply bibliography option
+\xpretobibmacro{begentry}%
+ {%
+ \ifbibliography%
+ {\usebibmacro{opcitbooktitle:bibliography}}%
+ {}%
+ }%
+ {}%
+ {\opcit@booktitle@failpatch{begentry}{standard.bbx}}%
+
+\newbibmacro{opcitbooktitle:bibliography}{%
+ \iftoggle{opcit@booktitle@bibliography@shorttitle}%
+ {\usebibmacro{related:info:booktitle}}%
+ {}%
+ \iftoggle{opcit@booktitle@bibliography@onlyshorttitle}{%
+ \usebibmacro{related:info:booktitle}%
+ \iffieldundef{crossref}{}{%
+ \clearlist{publisher}%
+ \clearlist{location}%
+ \clearfield{series}%
+ \clearfield{number}%
+ \clearfield{year}%
+ \clearfield{month}%
+ \clearfield{day}%
+ }%
+ }{}%
+}%
\endinput