Biber и Biblatex: ссылка на несколько подзаголовков

Biber и Biblatex: ссылка на несколько подзаголовков

Я использую biblatex с biber для своей диссертации. Я использую наборы, чтобы иметь несколько подзаписей:

введите описание изображения здесь

Когда я ссылаюсь на несколько подзаписей (например, a и b) одного набора, я хотел бы получить вывод в виде: [1a,b], но вместо этого я получаю [1a,1b]:

введите описание изображения здесь

Есть ли способ решить это? А также что-то вроде: [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}

решение1

Обновлять

Начиная с biblatexверсии 3.15 numeric-compстиль включает subentrycompопцию (включенную по умолчанию), которая также сжимает ссылки на подстатьи.

\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}

Решение '1a,b,c' не слишком сложное. Нам нужно только немного переопределить, чтобы проверить, совпадает cite:comp:insetли последнее .labelnumber

\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}

введите описание изображения здесь


Приложив больше усилий, вы также можете получить '1a-c'. Следующее решение воссоздает numeric-compмакросы для @setзаписей. Решение оптимизировано для короткого кода, а не для концептуальной приятности.

\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}

1//Здесь я привожу ссылку с несколькими подстатьями. 2 Позже я хочу обратиться к некоторым подстатьям. 2a,c//Лорэм 2a,b//ipsum 2a–c//ipsum 3//ipsum 2a–c//ipsum 1,2a–c,3//ipsum 1,2a–c,3//ipsum 1, 2a,c,3//ipsum 1,2a,b,3//ipsum 1,2a,3//ipsum 1,2c,3//ipsum 1–3

редактироватьИсправлена ​​проблема послеЭндиВвопроссжать цитирование членов множества в biblatex.

Связанный контент