3

I am looking for a way to highlight references to my own previous publications using BibLaTeX (alphabetic cite and bibliography style), for example by using double brackets as citation marks in the text and in the bibliography. It should look the following way:

This is a paper published by myself [[MS15]] and that is a paper published
by someone else [AB14].

References:
[[MS15]]    Moser, S., ...., Title, Year.
[AB14]      Author X., ...., Title, Year.

I've a working solution using BibTex. Therefore I copied "alphadin.bst" to my LaTeX project folder and added some additional entries for custom bibtex types which are used for my own publications:

FUNCTION {output.mybibitem}
{ newline$
  "\bibitem[{[" write$
  label write$%
  "]}]{" write$
  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}

FUNCTION {output.bibitem}
{ newline$
  "\bibitem[" write$
  label write$%
  "]{" write$
  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}

[...]

FUNCTION {article}
{ output.bibitem
article.common
}

FUNCTION {myarticle}
{  output.mybibitem
article.common
}

This allows me to add custom entries to the Bibtex file (e.g. "myarticle"). They are printed with double brackets both in the cite mark and in the bibliography.

For various reasons I'd like to switch to BibLaTeX and Biber as the backend. Therefore my question: Is there a similar solution or even a much nicer way to accomplish this? I don't necessarily need extra types for "my" publications in the bibliography file. It would be also possible to use, for example, keywords and using the available standard types.

I don't like to have the local, modified copy of "alphadin.bst" of the current BibTex solution at all. So if I could "patch" BibLaTeX's behavior without having a completely redundant style file, it would be great.

Thank you very much in advance for any helpful solutions!

Kind regards,

Steffen

2

Using keywords will be very easy from a programming point of view. So you simply add keyowrds={mywork} to your entries and use the standard entry types.

@Article{Benji,
  author    = {Benji},
  keywords  = {mywork},
}

With numeric and numeric-verb you could use

\DeclareFieldFormat{labelnumberwidth}{\ifkeyword{mywork}{[\mkbibbrackets{#1}]}{\mkbibbrackets{#1}}}

\renewbibmacro*{cite}{%
  \printtext[bibhyperref]{%
    \ifkeyword{mywork}{[}{}%
    \printfield{prefixnumber}%
    \printfield{labelnumber}%
    \ifkeyword{mywork}{]}{}%
    \ifbool{bbx:subentry}
      {\printfield{entrysetcount}}
      {}}}

In a very similar question over at goLaTeX the OP uses style=ieee which is much harder to get right. It can be done with xpatch

\makeatletter
\newtoggle{cbx@lastmywork}
\xpatchbibmacro{cite:comp:comp}
  {\savefield{labelnumber}{\cbx@lastnumber}}
  {\savefield{labelnumber}{\cbx@lastnumber}%
   \ifkeyword{mywork}{\toggletrue{cbx@lastmywork}}{\togglefalse{cbx@lastmywork}}}
  {}{}
\xpatchbibmacro{cite:dump}
  {\printtext{\cbx@lastnumber}}
  {\printtext[labelnumber]{\cbx@lastnumber}}
  {}{}
\DeclareFieldFormat{labelnumber}{%
  \ifboolexpr{test {\ifkeyword{mywork}} or togl {cbx@lastmywork}}
    {[#1]}
    {#1}}
\makeatother

For numeric-comp we can drop the patching of cite:dump,

\makeatletter
\newtoggle{cbx@lastmywork}
\xpatchbibmacro{cite:comp:comp}
  {\savefield{labelnumber}{\cbx@lastnumber}}
  {\savefield{labelnumber}{\cbx@lastnumber}%
   \ifkeyword{mywork}{\toggletrue{cbx@lastmywork}}{\togglefalse{cbx@lastmywork}}}
  {}{}
\DeclareFieldFormat{labelnumber}{%
  \ifboolexpr{test {\ifkeyword{mywork}} or togl {cbx@lastmywork}}
    {[#1]}
    {#1}}
\makeatother

is enough.

MWE for numeric

\documentclass{scrartcl}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Article{Einstein,
  author    = {Einstein},
}
@Article{Benji,
  author    = {Benji},
  keywords  = {mywork},
}
\end{filecontents}
\usepackage[style=numeric]{biblatex}
\addbibresource{\jobname.bib}

\DeclareFieldFormat{labelnumberwidth}{\ifkeyword{mywork}{[\mkbibbrackets{#1}]}{\mkbibbrackets{#1}}}

\renewbibmacro*{cite}{%
  \printtext[bibhyperref]{%
    \ifkeyword{mywork}{[}{}%
    \printfield{prefixnumber}%
    \printfield{labelnumber}%
    \ifkeyword{mywork}{]}{}%
    \ifbool{bbx:subentry}
      {\printfield{entrysetcount}}
      {}}}

\begin{document}
Fremdquelle \cite{Einstein}

Eigenquelle \cite{Benji} and \cite{Benji,Einstein} and \cite{Einstein,Benji}

\printbibliography
\end{document}

example output with <code>style=numeric</code>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.