如何在两种不同的引用样式中使用不同的排序参数(Biblatex)

如何在两种不同的引用样式中使用不同的排序参数(Biblatex)

经过多次尝试(基于问题/答案),我无法获得预期的结果。 (我使用的是 TexStudio + LiveTex + Ubuntu)

我需要以numeric样式和sorting=none(必须按文档中出现的顺序排序)打印我引用的参考文献,然后按关键字但以authoryear样式和sorting=ydnt(必须按年份降序排序)打印一组未引用的参考文献

正如您所知,如果我使用ydnt数字\usepackage[]{biblatex}样式,则它们将不会按照文档中出现的数字顺序排列。

下一张图片展示了我目前的情况:

我目前的结果

我的代码如下:

\documentclass[12pt]{article}

\usepackage{csquotes} 
\usepackage[
    style = numeric, 
    backend=biber,
    % sorting=ydnt,
    maxnames=1
    ]{biblatex} 

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

\defbibenvironment{mycumstomstyle}
% The following definition is copied from authortitle.bbx/authoryear.bbx
    {\list %authoryear
        {}
        {\setlength{\leftmargin}{\bibhang}%
            \setlength{\itemindent}{-\leftmargin}%
            \setlength{\itemsep}{\bibitemsep}%
            \setlength{\parsep}{\bibparsep}}}
    {\endlist}
    {\item}

\addbibresource{papers.bib}

\begin{document}

\section{State of Art}
Research institutes \cite{Adjiri2019}
the reent publications first. \cite{Ak2016a} 

\printbibliography[category=cited]

\appendix
\section{Appendix: Literature research}
\nocite{*}
\printbibliography[env=mycumstomstyle, title = Machine Learning for vertical wind speed extrapolation, keyword=ML.WS.vertical, notcategory=cited]

\end{document}

papers.bib这里

答案1

如果想要使用不同的排序模式,则应通过引入新的引用上下文来指定排序模式,因此对于特定情况,需要\newrefcontext[sorting=ydnt]在第二个之前\printbibliography。因此代码应该看起来像

\documentclass[12pt]{article}

\usepackage{csquotes} 
\usepackage[
    style = numeric, 
    backend=biber,
    % sorting=ydnt,
    maxnames=1
    ]{biblatex} 

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

\defbibenvironment{mycumstomstyle}
% The following definition is copied from authortitle.bbx/authoryear.bbx
    {\list %authoryear
        {}
        {\setlength{\leftmargin}{\bibhang}%
            \setlength{\itemindent}{-\leftmargin}%
            \setlength{\itemsep}{\bibitemsep}%
            \setlength{\parsep}{\bibparsep}}}
    {\endlist}
    {\item}

\addbibresource{papers.bib}

\begin{document}

\section{State of Art}
Research institutes \cite{Adjiri2019}
the reent publications first. \cite{Ak2016a} 

\printbibliography[category=cited]

\newrefcontext[sorting=ydnt]
\appendix
\section{Appendix: Literature research}
\nocite{*}
\printbibliography[env=mycumstomstyle, title = Machine Learning for vertical wind speed extrapolation, keyword=ML.WS.vertical, notcategory=cited]

\end{document}

相关内容