Skip to content

Instantly share code, notes, and snippets.

@lueck
Created September 6, 2018 22:05
Show Gist options
  • Select an option

  • Save lueck/2ea804ffe973d4a6f9ae1e585822084d to your computer and use it in GitHub Desktop.

Select an option

Save lueck/2ea804ffe973d4a6f9ae1e585822084d to your computer and use it in GitHub Desktop.
Citation style for biblatex with special handling of InReference entry types
%% Citation style for biblatex. Like authortitle-ibid, but special
%% handling for citations of type InReference. If a special keyword is
%% present in the entry's keyword list, then the citation is printed
%% as AUTHOR: TITLE, in: BOOKTITLE, [VOLUME], PAGES. This is intended
%% for publications which make extensive use of reference books the
%% articles of which should not appear in the bibliography, but only
%% the reference book.
\ProvidesFile{authortitle-iinref.cbx}
\RequireCitationStyle{authortitle-ibid}
\newcommand*{\inrefnobib}{NOBIB}
% The special keyword may be defined using 'inrefnobib=MYKEY' package
% option. Defaults to NOBIB.
\DeclareBibliographyOption[string]{inrefnobib}[NOBIB]{%
\renewcommand*{\inrefnobib}{#1}}
\def\ifnobibkeyword{\noexpand\ifkeyword{\inrefnobib}}
\letbibmacro*{origcite}{cite}
\renewbibmacro*{cite}{%
\ifthenelse{\ifentrytype{inreference}\AND\ifnobibkeyword}{%
\usebibmacro{cite:inreference}}{%
\usebibmacro{origcite}}}
\newbibmacro*{cite:inreference}{%
\printnames{labelname}%
\setunit*{\printdelim{nametitledelim}}%
\usebibmacro{cite:inreftitle}%
\newunit\newblock%
\usebibmacro{in:}%
\usebibmacro{citebooktitle}
\newunit\newblock%
\usebibmacro{volume+pages}%
}
\newbibmacro*{cite:inreftitle}{%
\printtext[bibhyperref]{%
\printfield[inreference]{labeltitle}}}
\newbibmacro*{citebooktitle}{%
\iffieldundef{shorthand}
{\usebibmacro{cite:booktitle}}%
{\usebibmacro{cite:shorthand}}}
\newbibmacro*{cite:booktitle}{%
\printtext[bibhyperref]{\printfield[citetitle]{booktitle}}}
\newbibmacro*{volume+pages}{%
\iffieldundef{volume}{}{%
\printfield{volume}%
\newunit}%
\iffieldundef{pages}{}{%
\printfield{pages}%
\newunit}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment