2

I would like to show the rank of the journal in just one of the bibliographies I show in the document. That is, I need to selectively print a field of the bibliography item. note is the field I have chosen to do so. The only thing I came up with is to do something similar to what I do for the bold name but for the note field. However, I did not succeed because I can not understand properly the whole section of "Data Annotations" from biblatex manual.

Here is a MWE of what I have done so far:

\documentclass{article}
\usepackage{hyperref}
\usepackage[
backend=biber,
style=numeric-comp,
]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{file.bib} @article{gillies, author = {Gillies, Alexander}, author+an = {1=highlight}, title = {Herder and the Preparation of {Goethe's} Idea of World Literature}, journaltitle = {Publications of the English Goethe Society}, date = {1933}, % date+an = {=attributed}, series = {newseries}, volume = {9}, % volume+an = {=attributed}, pages = {46-67}, note = {Q1}, note+an={2=rank} } \end{filecontents}

\addbibresource{file.bib}

\begin{document}

\begin{refsection} %comandos para resaltarme como autor en negrita en mis publicaciones \renewcommand*{\mkbibnamegiven}[1]{% \ifitemannotation{highlight} {\textbf{#1}} {#1}}

\renewcommand*{\mkbibnamefamily}[1]{% \ifitemannotation{highlight} {\textbf{#1}} {#1}}

\nocite{gillies}

\printbibliography

\end{refsection}

\nocite{gillies}

\printbibliography

\end{document}

If someone knows how to achieve my purpose either employing the data attributes from biblatex or any other method, they are welcome.

moewe
  • 175,683
Fabio
  • 315

1 Answers1

1

I'd use a slightly different approach. I'd define a new field with a more semantic name for what you want here instead of note. Then you can selectively inject code to print the new field in the bibliography where you want to see the field.

For the new field we need a data model file (.dbx), see also Add field "tome" to biblatex entries.

\documentclass{article}

\begin{filecontents*}{rank.dbx} \ProvidesFile{rank.dbx}[2020/07/05 add rank field]

\DeclareDatamodelFields[type=field,datatype=literal]{rank} \DeclareDatamodelEntryfields{rank} \end{filecontents*}

\usepackage[ backend=biber, style=numeric-comp, datamodel=rank, ]{biblatex} \usepackage{hyperref}

\begin{filecontents}{\jobname.bib} @article{gillies, author = {Gillies, Alexander}, author+an = {1=highlight}, title = {Herder and the Preparation of {Goethe's} Idea of World Literature}, journaltitle = {Publications of the English Goethe Society}, date = {1933}, series = {newseries}, volume = {9}, pages = {46-67}, rank = {Q1}, } \end{filecontents} \addbibresource{\jobname.bib}

\begin{document}

\begin{refsection} \renewcommand{\mkbibcompletename}[1]{% \ifitemannotation{highlight} {\textbf{#1}} {#1}} \renewbibmacro{finentry}{\newunit\newblock\printfield{rank}\finentry}

\nocite{gillies} \printbibliography \end{refsection}

\nocite{gillies} \printbibliography \end{document}

Alexander Gillies. “Herder and the Preparation of Goethe’s Idea of World Literature”. In: Publications of the English Goethe Society. New ser. 9 (1933), pp. 46–67. Q1.//Alexander Gillies. “Herder and the Preparation of Goethe’s Idea of World Literature”. In: Publications of the English Goethe Society. New ser. 9 (1933), pp. 46–67.


I don't quite feel that field annotations are the best solution here, but it can be done. We need to define a few new macros because \AtEveryBibitem and \AtBeginBibliography usually act globally and are only allowed in the preamble.

The idea is to remove all note fields with rank annotation in the second bibliography.

\documentclass{article}

\usepackage[ backend=biber, style=numeric-comp, ]{biblatex} \usepackage{hyperref}

\makeatletter \newrobustcmd{\LocalAtBeginBibliography}{\appto\blx@hook@bibinit} \newrobustcmd{\LocalAtEveryBibitem}{\appto\blx@hook@bibitem} \makeatother

\begin{filecontents}{\jobname.bib} @article{gillies, author = {Gillies, Alexander}, author+an = {1=highlight}, title = {Herder and the Preparation of {Goethe's} Idea of World Literature}, journaltitle = {Publications of the English Goethe Society}, date = {1933}, series = {newseries}, volume = {9}, pages = {46-67}, note = {Q1}, note+an = {=rank}, } \end{filecontents} \addbibresource{\jobname.bib}

\begin{document}

\begin{refsection} \renewcommand*{\mkbibcompletename}[1]{% \ifitemannotation{highlight} {\textbf{#1}} {#1}}

\nocite{gillies} \printbibliography \end{refsection}

\LocalAtBeginBibliography{% \LocalAtEveryBibitem{% \iffieldannotation[note]{rank} {\clearfield{note}} {}}} \nocite{gillies} \printbibliography \end{document}

Alexander Gillies. “Herder and the Preparation of Goethe’s Idea of World Literature”. In: Publications of the English Goethe Society. New ser. 9 (1933). Q1, pp. 46–67.//Alexander Gillies. “Herder and the Preparation of Goethe’s Idea of World Literature”. In: Publications of the English Goethe Society. New ser. 9 (1933), pp. 46–67.


Note that I simplified the code for the bold name by using the new \mkbibcompletename, which applies to the complete name and not only name parts like \mkbibnamefamily and \mkbibnamegiven.

moewe
  • 175,683