1

For my dissertation I have the requirement that all of my own articles that are cited in the text are included in the general references section and all of my own articles are included in an extra references section. I'm using biblatex. To collect all of my paper in the extra section I use keyword filtering in combination with \nocite{*}. To prevent the \nocite{*} to propagate to the general references, I use a “refsection”. That works perfect except that the labels are not synchronized. How can I synchronize the labels? What would be the correct approach to achieve what I have to fulfill?

The following code/picture illustrates the problem:

Image illustrating the problem

\documentclass{scrartcl}

\begin{filecontents}{testbib.bib}
@Article{MyArticleA,
  Title                    = {Article A},
  Author                   = {Me},
  Journal                  = {Nature},
  Year                     = {2015},
  Number                   = {13},
  Pages                    = {156},
}
@Article{MyArticleB,
  Title                    = {Article B},
  Author                   = {Me},
  Journal                  = {Nature},
  Year                     = {2015},
  Number                   = {14},
  Pages                    = {228},
}
@Article{MyArticleC,
  Title                    = {Article C},
  Author                   = {Me},
  Journal                  = {Nature},
  Year                     = {2015},
  Number                   = {15},
  Pages                    = {111},
}
\end{filecontents}

\usepackage[style=alphabetic]{biblatex}
\bibliography{testbib}

\begin{document}

\noindent Citation of Article B: \cite{MyArticleB}; Citation of Article C: \cite{MyArticleC}

\printbibliography

\begin{refsection}
\nocite{*}
\printbibliography[title={My Publications}]
\end{refsection}

\end{document}
  • AFAIK there is no easy answer to your title question. refsections were made to be absolutely separate from each other, so there is no obvious way to synchronise the labels (save for retreating to the shorthand or label fields, but that is hardly going to be automatic). If you employ some more filtering, you might be able to drop the refsections. – moewe Oct 5 '15 at 12:52
  • If you are OK with manually \nociteing your publications, you should be able to do it with refsegments. – moewe Oct 5 '15 at 12:59
  • @moewe This is what I am trying to avoid, still hoping for a solution with \nocite{*}. I would expect it being a common task, but it seems I'm wrong on that. – Chris Oct 5 '15 at 13:20
  • I think questions like that creep up once in a while. You are facing a technical limitation of \nocite and refsection here though. (So no matter how popular this feature might be, those would still have to be overcome.) You might want to consider alternative approaches to your actual problem such as the one in Biblatex: using “dashed” in one refsection but not another. – moewe Oct 5 '15 at 13:25
3

Since refsections are kept completely independent and separate of each other, there is no easy way of making the labels align between two different refsections. Sometimes using refsegments, which are not kept separate, can help solve the problem. In the case at hand, though, refsegments will not do what we want.

In order to keep the \nocite{*}, we need to be able to distinguish works that were really (i.e. visibly) \cited from those added only via \nocite. A easy solution for this is explained in How to split bibliography into “works cited” and “works not cited”?

\DeclareBibliographyCategory{cited}
\AtEveryCitekey{\addtocategory{cited}{\thefield{entrykey}}}

In your MWE that will already be enough, but maybe we also need a way to filter only your publications. You can get inspired by biblatex: filter out publications from a specific author in the references dynamically, biblatex: separating publications of a specific author in the bibliography, How to print a bibliography for a particular author only?. The solution here is based on the fullhash calculated by Biber, it can identify names as uniquely as Biber allows for

\defbibcheck{mywork}{%
  \iffieldequalstr{fullhash}{e06f6e5a8c1d5204dea326aa5f4f8d17}
    {}
    {\skipentry}
}

If you use different formats/versions of your name, for example "A. Uthor", "Anne Uthor" and "Anne K. Uthor" you will have to account for all of these. You can find the namehash generated for a name in the .bbl file. For example

\defbibcheck{mywork}{%
  \ifboolexpr{test {\iffieldequalstr{fullhash}{e06f6e5a8c1d5204dea326aa5f4f8d17}} or test {\iffieldequalstr{fullhash}{fb328aaf7bc297844ac66ad9e0844e1b}}}
    {}
    {\skipentry}
}

will classify both "Anne Uthor" as well as "Anne K. Uthor" as your publication.

Now the "normal" bibliography is

\printbibliography[category=cited]

and your list of publications is

\nocite{*}
\printbibliography[title={My Publications},check=mywork]

Where of course the actual position of \nocite{*} in your document does not really matter.

MWE

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Article{MyArticleA,
  Title                    = {Article A},
  Author                   = {Anne Uthor},
  Journal                  = {Nature},
  Year                     = {2015},
  Number                   = {13},
  Pages                    = {156},
}
@Article{MyArticleB,
  Title                    = {Article B},
  Author                   = {Anne Uthor},
  Journal                  = {Nature},
  Year                     = {2015},
  Number                   = {14},
  Pages                    = {228},
}
@Article{MyArticleC,
  Title                    = {Article C},
  Author                   = {Anne Uthor},
  Journal                  = {Nature},
  Year                     = {2015},
  Number                   = {15},
  Pages                    = {111},
}
@Article{MyArticleD,
  Title                    = {Article D},
  Author                   = {Willard Riter},
  Journal                  = {Nature},
  Year                     = {2015},
  Number                   = {16},
  Pages                    = {112-115},
}
@Article{MyArticleE,
  Title                    = {Article E},
  Author                   = {Willard Riter},
  Journal                  = {Nature},
  Year                     = {2013},
  Number                   = {17},
  Pages                    = {112-115},
}
\end{filecontents}

\usepackage[style=alphabetic]{biblatex}
\bibliography{\jobname}

\DeclareBibliographyCategory{cited}
\AtEveryCitekey{\addtocategory{cited}{\thefield{entrykey}}}
\defbibcheck{mywork}{%
  \iffieldequalstr{fullhash}{e06f6e5a8c1d5204dea326aa5f4f8d17}
    {}
    {\skipentry}
}

\begin{document}
\noindent Citation of Article B: \cite{MyArticleB}; Citation of Article C: \cite{MyArticleC} and \cite{MyArticleE}

\printbibliography[category=cited]

\nocite{*}
\printbibliography[title={My Publications},check=mywork]
\end{document}

enter image description here

Even though MyArticleD is in the .bib file it does not appear in either of the lists, because it is neither one of your (viz. Anne Uthor's) publications nor one of the works cited.

  • Thanks for the solution! I implemented it a bit different. I use a keyword filter for my own publications since they already have a keyword that marks them accordingly. Nevertheless, filtering based on names or name hashes is another option as well. – Chris Oct 6 '15 at 12:19
  • @Chris Using a keyword would have been the easy option. But since I wasn't too sure what you were using and I didn't find any solution here using fullhash I thought it would be a nice touch. – moewe Oct 6 '15 at 12:22
  • It is. But what is the benefit of using hashes over name strings? I guess implementation-wise it makes a difference, but for the user string and hash are the same, aren't they? – Chris Oct 6 '15 at 12:34
  • @Chris Hashes are far more fancy ;-). They were explicitly designed to uniquely identify authors (save for different spellings, use of initials etc., of course). Plus, in this case string comparison - if done right, as in the answers I linked to - is slightly longer than comparing hashes. The only drawback I see is that you have to get the hash from the .bbl once whereas you will have no problem finding the correct input for the string comparison. – moewe Oct 6 '15 at 12:41
  • Then maybe I misunderstood, but you are using several hashes to cover different use of initials in your example above. How can the hash be independent of spelling etc.? – Chris Oct 6 '15 at 12:54

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.