Estou usando biblatex com biber para minha tese. Eu uso conjuntos para ter várias subentradas:
Quando me refiro a múltiplas subentradas (por exemplo, a & b) de um conjunto, gostaria de obter uma saída como: [1a,b], mas em vez disso obtenho [1a,1b]:
Há uma maneira de resolver isto? E também algo como: [1a-c]?
\RequirePackage{filecontents}
\begin{filecontents}{test.bib}
@article{author1,
journal = {journal},
year = {1999},
author = {author1},
}
@article{author2,
journal = {journal},
year = {1999},
author = {author2},
}
@article{author3,
journal = {journal},
year = {1999},
author = {author3},
}
\end{filecontents}
\documentclass[12pt,a4paper, headinclude=true, titlepage=true,DIV=12,oneside,BCOR=1cm, numbers=noendperiod, toc=bib, chapterprefix=true]{scrreprt}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[backend=biber,citestyle=numeric-comp,bibstyle=chem-angew,mcite=true,subentry,pageranges=true,sorting=none,citetracker]{biblatex}
\addbibresource{my_refs.bib}
\usepackage[ngerman,KeepShorthandsActive]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\addbibresource{test.bib}
\begin{document}
Here I cite a reference with several subentries.\defbibentryset{set1}{author1,author2,author3}\supercite{set1} Somewhere later, I want to refer to some of the subentries.\supercite{author1,author2}
\printbibliography
\end{document}
Responder1
Atualizar
A partir da biblatex
versão 3.15 o numeric-comp
estilo vem com uma subentrycomp
opção (habilitada por padrão) que também compacta referências de subentradas.
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[backend=biber, style=numeric-comp, subentry]{biblatex}
\begin{filecontents}{\jobname.bib}
@article{author1,
journal = {journal},
year = {1999},
author = {author1},
}
@article{author2,
journal = {journal},
year = {1999},
author = {author2},
}
@article{author3,
journal = {journal},
year = {1999},
author = {author3},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\supercite{sigfridsson}
Here I cite a reference with several subentries.\defbibentryset{set1}{author1,author2,author3}\supercite{set1} Somewhere later, I want to refer to some of the subentries.\supercite{author1,author3}
Lorem\supercite{author1,author2}
ipsum\supercite{author1,author2,author3}
ipsum\supercite{vizedom:related}
ipsum\supercite{author1,author2,author3}
ipsum\supercite{author1,author2,author3,vizedom:related,sigfridsson}
ipsum\supercite{author1,author2,author3,vizedom:related,sigfridsson}
ipsum\supercite{author1,author3,vizedom:related,sigfridsson}
ipsum\supercite{author1,author2,vizedom:related,sigfridsson}
ipsum\supercite{author1,vizedom:related,sigfridsson}
ipsum\supercite{author3,vizedom:related,sigfridsson}
ipsum\supercite{set1,vizedom:related,sigfridsson}
\printbibliography
\end{document}
Uma solução '1a,b,c' não é muito complicada. Só precisamos redefinir cite:comp:inset
um pouco para verificar se o último labelnumber
é igual.
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{author1,
journal = {journal},
year = {1999},
author = {author1},
}
@article{author2,
journal = {journal},
year = {1999},
author = {author2},
}
@article{author3,
journal = {journal},
year = {1999},
author = {author3},
}
\end{filecontents}
\documentclass[12pt,a4paper, headinclude=true, titlepage=true,DIV=12,oneside,BCOR=1cm, numbers=noendperiod, toc=bib, chapterprefix=true]{scrreprt}
\usepackage[ngerman,KeepShorthandsActive]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[backend=biber, citestyle=numeric-comp, bibstyle=chem-angew, mcite=true, subentry, pageranges=true, sorting=none, citetracker]{biblatex}
\addbibresource{\jobname.bib}
\makeatletter
\renewbibmacro*{cite:comp:inset}{%
\usebibmacro{cite:dump}%
\ifnumgreater{\value{cbx@tempcntb}}{-1}
{\multicitedelim}
{}%
\printtext[bibhyperref]{%
\iffieldequals{labelnumber}{\cbx@lastnumber}
{}
{\printfield{labelprefix}%
\printfield{labelnumber}}%
\printfield{entrysetcount}}%
\savefield{labelnumber}{\cbx@lastnumber}%
\setcounter{cbx@tempcntb}{-1}}
\makeatother
\begin{document}
Here I cite a reference with several subentries.\defbibentryset{set1}{author1,author2,author3}\supercite{set1} Somewhere later, I want to refer to some of the subentries.\supercite{author1,author2,author3}
\printbibliography
\end{document}
Com mais trabalho você também pode obter '1a-c'. A solução a seguir recria as numeric-comp
macros para @set
entradas. A solução é otimizada para código curto em vez de gentileza conceitual.
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{author1,
journal = {journal},
year = {1999},
author = {author1},
}
@article{author2,
journal = {journal},
year = {1999},
author = {author2},
}
@article{author3,
journal = {journal},
year = {1999},
author = {author3},
}
\end{filecontents}
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[backend=biber, citestyle=numeric-comp, bibstyle=chem-angew, mcite=true, subentry, pageranges=true, sorting=none, citetracker]{biblatex}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\makeatletter
% the first two counters are already defined in numeric-comp.cbx
% cbx@tempcnta % no. of labelnumbers we skipped
% cbx@tempcntb % 'predicted' labelnumber for current cite
\newcounter{cbx@tempcntc}% no. of entrysetcounts we skipped
\newcounter{cbx@tempcntd}% 'predicted' entrysetcount
\renewbibmacro*{cite:init}{%
\global\boolfalse{cbx:parens}%
\global\undef\cbx@lasthash
\global\undef\cbx@lastnumber
\global\undef\cbx@lastprefix
\global\undef\cbx@lastcount
\setcounter{cbx@tempcnta}{0}%
\setcounter{cbx@tempcntb}{-2}%
\setcounter{cbx@tempcntc}{0}%
\setcounter{cbx@tempcntd}{-1}}
\newcommand*{\cbx@iflabelnumberequalslast}{%
\iffieldequals{labelnumber}{\cbx@lastnumber}}
% \iffieldequals is false even if both are empty/undef
% so we need a special test for that case
% this test is optimised for performance and laziness
% rather than prettiness, not that it would matter a lot...
\newcommand*{\cbx@iflabelprefixequalslast}{%
\ifundef\cbx@lastprefix
{\iffieldundef{labelprefix}
{\@firstoftwo}
{\@secondoftwo}}
{\iffieldequals{labelprefix}{\cbx@lastprefix}
{\@firstoftwo}
{\@secondoftwo}}}
% \cbx@iflabelnumberequalslast and \cbx@iflabelprefixequalslast
\newcommand*{\cbx@iflabelequalslast}{%
\iffieldequals{labelnumber}{\cbx@lastnumber}
{\cbx@iflabelprefixequalslast
{\@firstoftwo}
{\@secondoftwo}}
{\@secondoftwo}}
\renewbibmacro*{cite:comp:inset}{%
\stepcounter{cbx@tempcntd}%
% the calls for false \cbx@iflabelequalslast
% are split between stuff that happens before
% the link and that happens within the link
\cbx@iflabelequalslast
{}
{\usebibmacro{cite:dump}%
\ifnumgreater{\value{cbx@tempcntb}}{-1}
{\multicitedelim}
{}}%
\printtext[bibhyperref]{%
\cbx@iflabelequalslast
{}
{\setcounter{cbx@tempcntd}{-1}%
\printfield{labelprefix}%
\printfield{labelnumber}%
\savefield{labelprefix}{\cbx@lastprefix}%
\savefield{labelnumber}{\cbx@lastnumber}}%
\ifnumequal{\thefield{entrysetcount}}{\value{cbx@tempcntd}}
{\savefield{entrykey}{\cbx@lastkey}%
\savefield{entrysetcount}{\cbx@lastcount}%
\stepcounter{cbx@tempcntc}}
{\usebibmacro{cite:dump}%
\ifnumgreater{\value{cbx@tempcntd}}{0}
{\multicitedelim}
{}%
\printfield{entrysetcount}}}%
\setcounter{cbx@tempcntd}{\thefield{entrysetcount}}%
\setcounter{cbx@tempcntb}{-1}}
\renewbibmacro*{cite:dump}{%
% dump subentry
\ifnumgreater{\value{cbx@tempcntc}}{0}
{\ifnumgreater{\value{cbx@tempcntc}}{1}
{\bibrangedash}
{\multicitedelim}%
\bibhyperref[\cbx@lastkey]{%
\printtext[entrysetcount]{\cbx@lastcount}}}
{}%
\setcounter{cbx@tempcntc}{0}%
% dump labelnumber (+labelprefix)
\ifnumgreater{\value{cbx@tempcnta}}{0}
{\ifnumgreater{\value{cbx@tempcnta}}{1}
{\bibrangedash}
{\multicitedelim}%
\bibhyperref[\cbx@lastkey]{%
\ifdef\cbx@lastprefix
{\printtext[labelprefix]{\cbx@lastprefix}}
{}%
\printtext[labelnumber]{\cbx@lastnumber}}%
\global\undef\cbx@lastprefix}
{}%
\setcounter{cbx@tempcnta}{0}}
\makeatother
\begin{document}
\supercite{sigfridsson}
Here I cite a reference with several subentries.\defbibentryset{set1}{author1,author2,author3}\supercite{set1} Somewhere later, I want to refer to some of the subentries.\supercite{author1,author3}
Lorem\supercite{author1,author2}
ipsum\supercite{author1,author2,author3}
ipsum\supercite{vizedom:related}
ipsum\supercite{author1,author2,author3}
ipsum\supercite{author1,author2,author3,vizedom:related,sigfridsson}
ipsum\supercite{author1,author2,author3,vizedom:related,sigfridsson}
ipsum\supercite{author1,author3,vizedom:related,sigfridsson}
ipsum\supercite{author1,author2,vizedom:related,sigfridsson}
ipsum\supercite{author1,vizedom:related,sigfridsson}
ipsum\supercite{author3,vizedom:related,sigfridsson}
ipsum\supercite{set1,vizedom:related,sigfridsson}
\printbibliography
\end{document}
editarCorrigido um problema apósAndiWa perguntacomprimir citação de membros do conjunto no biblatex.