0

I have three different .bib files for three different bibliographies that should have three different styles.

MWE:

\documentclass{report}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage[autostyle,italian=guillemets]{csquotes}

\begin{filecontents}{biblio.bib}
@book{raty:spectroscopy,
    author = {Raty, Juka and Peiponen, Kai-Erik and Asakura, Toshimitsu},   
    title = {UV-Visible Reflection Spectroscopy of Liquids},
    publisher = {Berlino, Heidelberg: Springer-Verlag},
    series = {Springer Series in Optical Sciences},
    date = {2004}
}
\end{filecontents}
\begin{filecontents}{quotes.bib}
@patent{bayer:array,
    title = {Color imaging array},
    author = {Bayer, Bryce Edward},
    date = {1976-07-20},
    note={Eastman Kodak Company},
    number={US3971065 A},
    options = {skipbib=true}
}
\end{filecontents}
\begin{filecontents}{images.bib}
@inreference{wiki:specscheme,
    booktitle = {Wikimedia Commons},
    title = {Single beam spectrophotometer},
    url = {commons.wikimedia.org},
    publisher = {Wikimedia Foundation},
    date = {2008-01-16},
    urldate = {2017-04-04}
}

@manual{thorlabs:filter,
    author = {ThorLabs},
    title = {FGB39 datasheet},
    url = {www.thorlabs.com},
    date = {2012},
    urldate = {2017-04-14}
}
\end{filecontents}

\usepackage[backend=biber,dateabbrev=true,language=italian,style=numeric,sorting=none]{biblatex}
\addbibresource{biblio.bib}
\addbibresource{quotes.bib}
\addbibresource{images.bib}
\DeclareBibliographyCategory{Bibliografia}
\DeclareBibliographyCategory{Citazioni}
\DeclareBibliographyCategory{Referenze}
\addtocategory{Bibliografia}{raty:spectroscopy}
\addtocategory{Citazioni}{bayer:array}
\addtocategory{Referenze}{wiki:specscheme}
\addtocategory{Referenze}{thorlabs:filter}
\defbibheading{Bibliografia}{\chapter*{Bibliografia}}
\defbibheading{Referenze}{\chapter*{Fonti delle immagini}}

\begin{document}

This is just an example\footfullcite{bayer:array}.

Image 1 \cite{wiki:specscheme} and 2 \cite{thorlabs:filter}.

\nocite{raty:spectroscopy}
\printbibliography[heading=Bibliografia, title={Bibliography}, category=Bibliografia]
\printbibliography[heading=Referenze, title={Images references}, category=Referenze]

\end{document}

First: how can I add automatically every entry in the three files in the corresponding cateory, without calling addbibresource for each entry?

Second more important: as you see I have three different types of quotations. The first one as footnote should not be included in the bibliography and it must not count for the next numerical bibliography. The second one are images references which should be sorted numerical. The last one are not cited directly in the text and they should use the authortitle style, and not counted for the previous type.

Actually they all use the same style and every entry is counted for the numerical style.

lockstep
  • 250,273
Frank
  • 77

1 Answers1

2

I've been able to solve the problem thanks to several similar but not same questions. Not perfectly clean, not so aestetically beautiful but as long as it can't be done in a clean way here it is:

\documentclass{report}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage[autostyle,italian=guillemets]{csquotes}

\begin{filecontents}{biblio.bib}
@book{raty:spectroscopy,
    author = {Raty, Juka and Peiponen, Kai-Erik and Asakura, Toshimitsu},   
    title = {UV-Visible Reflection Spectroscopy of Liquids},
    publisher = {Berlino, Heidelberg: Springer-Verlag},
    series = {Springer Series in Optical Sciences},
    date = {2004}
}
\end{filecontents}
\begin{filecontents}{quotes.bib}
@patent{bayer:array,
    title = {Color imaging array},
    author = {Bayer, Bryce Edward},
    date = {1976-07-20},
    note={Eastman Kodak Company},
    number={US3971065 A},
    options = {skipbib=true}
}
\end{filecontents}
\begin{filecontents}{images.bib}
@inreference{wiki:specscheme,
    booktitle = {Wikimedia Commons},
    title = {Single beam spectrophotometer},
    url = {commons.wikimedia.org},
    publisher = {Wikimedia Foundation},
    date = {2008-01-16},
    urldate = {2017-04-04}
}

@manual{thorlabs:filter,
    author = {ThorLabs},
    title = {FGB39 datasheet},
    url = {www.thorlabs.com},
    date = {2012},
    urldate = {2017-04-14}
}
\end{filecontents}

\usepackage[style=alphabetic,labelnumber,defernumbers=true, backend=biber]{biblatex}
\addbibresource{biblio.bib}
\addbibresource{quotes.bib}
\addbibresource{images.bib}

\DeclareSourcemap
{
        \maps[datatype=bibtex, overwrite]
        {
                \map
                {
                        \perdatasource{biblio.bib}
                        \step[fieldset=KEYWORDS, fieldvalue=primary, append]
                }
                \map
                {
                        \perdatasource{quotes.bib}
                        \step[fieldset=KEYWORDS, fieldvalue=secondary, append]
                }
                \map
                {
                        \perdatasource{images.bib}
                        \step[fieldset=KEYWORDS, fieldvalue=tertiary, append]
                }
        }
}

\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}
\renewbibmacro*{cite}{%
  \printtext[bibhyperref]{%
    \printfield{labelprefix}%
    \ifkeyword{tertiary}
      {\printfield{labelnumber}}
      {\printfield{labelalpha}%
       \printfield{extraalpha}}}}

\defbibenvironment{bibliographyNUM}
  {\list
     {\printtext[labelnumberwidth]{%
        \printfield{prefixnumber}%
        \printfield{labelnumber}}}
     {\setlength{\labelwidth}{\labelnumberwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}

\assignrefcontextkeyws[sorting=none]{tertiary}

\begin{document}

This is just an example\footfullcite{bayer:array}.

Image 1 \cite{wiki:specscheme} and 2 \cite{thorlabs:filter}.

\nocite{raty:spectroscopy}
\printbibliography[title=Biblio, keyword=primary]

\newrefcontext[sorting=none]
\printbibliography[env=bibliographyNUM,title=Images, keyword=tertiary, resetnumbers]

\end{document}

Compiling: pdflatex -> biber -> pdflatex -> pdflatex

If you note that images indexes are all zero, probably you just have to rerun pdflatex

Frank
  • 77