summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biblatex-shortfields
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-04-10 21:55:58 +0000
committerKarl Berry <karl@freefriends.org>2017-04-10 21:55:58 +0000
commit3813f353852891036ded396c3d78a8803c0b9385 (patch)
treeaeb29d9ed3fd5456da0ba60d8a55d45ccca0a1a4 /Master/texmf-dist/tex/latex/biblatex-shortfields
parentc8cd8edf4451d006d810c0a699f9c6f746d06b66 (diff)
biblatex-shortfields (10apr17)
git-svn-id: svn://tug.org/texlive/trunk@43738 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/biblatex-shortfields')
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-shortfields/biblatex-shortfields.sty143
1 files changed, 143 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/biblatex-shortfields/biblatex-shortfields.sty b/Master/texmf-dist/tex/latex/biblatex-shortfields/biblatex-shortfields.sty
new file mode 100644
index 00000000000..9359094a646
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/biblatex-shortfields/biblatex-shortfields.sty
@@ -0,0 +1,143 @@
+%% Copyright 2017-… Maïeul Rouquette
+%
+% 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-shortfields}[2017/04/09 v1.0.0 Print unique list of short fields]
+\providecommand{\biblatex@claves}{}%
+% 1. Use short version of fields instead of long version
+\renewbibmacro*{series+number}{%
+ \iffieldundef{shortseries}{\printfield{series}}{\printfield{shortseries}}%
+ \setunit*{\addspace}%
+ \printfield{number}%
+ \newunit}
+
+\renewbibmacro*{journal}{%
+ \iffieldundef{shortjournal}{%
+ \iffieldundef{journaltitle}%
+ {}%
+ {\printtext[journaltitle]{%
+ \printfield[titlecase]{journaltitle}%
+ \setunit{\subtitlepunct}%
+ \printfield[titlecase]{journalsubtitle}}}%
+ }{%
+ \printtext[journaltitle]{\printfield[titlecase]{shortjournal}}%
+ }%
+}%
+
+
+% 2. Custom sorting scheme
+
+\DeclareSortingScheme{shortfields}{
+ \sort{
+ \field{claves_definition}
+ \field{shortjournal}
+ \field{shortseries}
+ }
+ \sort{
+ \field{series}
+ \field{journaltitle}
+ }
+}
+
+%3. Bibcheck
+
+\defbibcheck{shortfields}{%
+ %First, the entrytype NOT corresponding to claves
+ \iffieldundef{claves_definition}%
+ {% If not the corresponding to a claves
+ \ifboolexpr{%
+ (test{\iffieldundef{shortseries}} or test{\iffieldundef{series}})%
+ and%
+ (test {\iffieldundef{shortjournal}} or test {\iffieldundef{journaltitle}})%
+ }{%
+ \skipentry%
+ }{%
+ %For series
+ \ifboolexpr{%
+ test {\iffieldundef{series}}%
+ and%
+ test {\iffieldundef{shortseries}}%
+ }{}%
+ {%
+ \ifcsdef{\strfield{shortseries}=\strfield{series}}{%
+ \skipentry%
+ }{%
+ \savefieldcs{series}{\strfield{shortseries}=\strfield{series}}%
+ }%
+ }%
+ % For journal
+ \ifboolexpr{%
+ test {\iffieldundef{journaltitle}}%
+ and%
+ test {\iffieldundef{shortjournal}}%
+ }{}%
+ {%
+ \ifcsdef{\strfield{shortjournal}=\strfield{journaltitle}}{%
+ \skipentry%
+ }{%
+ \savefieldcs{journaltitle}{\strfield{shortjournal}=\strfield{journaltitle}}%
+ }%
+ }%
+ }%
+ }%
+ {}%
+}%
+
+
+\newlength{\shortfieldswidth}
+\setlength{\shortfieldswidth}{4em}
+\defbibenvironment{shortfields}
+ {%
+ \let\old@blx@driver\blx@driver%
+ \ifdef{\clavesadddashinset}{%
+ \clavesadddashinset%Add the dash inside set (modify default style)
+ \renewcommand{\entrysetpunct}{\endgraf}%Break between set of an enty
+ }{}%
+ \renewcommand{\blx@driver}[1]{\blx@bbx@shortfields}%
+ \list{%
+ \iffieldundef{claves_definition}%
+ {%
+ \printfield{shortseries}%
+ \printfield[journaltitle]{shortjournal}%
+ }%
+ {\printfield[claves_definition]{entrykey}}%
+ }%
+ {%
+ \labelwidth\shortfieldswidth
+ \labelsep\biblabelsep
+ \leftmargin\labelwidth
+ \advance\leftmargin\labelsep
+ \itemsep\bibitemsep
+ \parsep\bibparsep
+ \def\makelabel##1{##1\hss}}}
+ {\endlist}
+ {\item}
+
+\DeclareBibliographyDriver{shortfields}{%
+ \iffieldundef{claves_definition}%
+ {%
+ \printfield{series}%
+ \printfield{journaltitle}%
+ }%
+ {\let\blx@driver\old@blx@driver\blx@driver{\thefield{entrytype}}}%
+}
+
+% The use level command
+\newcommand{\printbibshortfields}[1][title=\biblistname]{%
+ \begin{refcontext}[sorting=shortfields]
+ \printbibliography[check=shortfields,env=shortfields,#1]%
+ \end{refcontext}
+}
+
+
+\endinput