第二种方式

第二种方式

我有许多作者和年份相同的文章。在我的 latex 文档中,一些引用键与 Zotero 中的原始引用键不同。这非常烦人,因为文章在参考书目中的显示顺序是错误的。例如:

Zotero:1.文章 = bahn2017a 2.文章 = bahn2017b 3.文章 = bahn2017c 4.文章 = bahn2017d

乳胶:1.文章 = bahn2017a 2.文章 = bahn2017d 3.文章 = bahn2017b 4.文章 = bahn2017c

真正奇怪的是,当我使用 textcite 等在文本中进行引用时,.bib 文件中的条目列表以正确的顺序包含文章,并带有来自 Zotero 的正确引用键。所以,我猜一定是 biblatex 改变了引用键。但它为什么要这样做,更重要的是:我如何强制 biblatex 使用原始顺序?

 \documentclass{report}
\usepackage{polyglossia}
\setdefaultlanguage[variant=british]{english}

\usepackage[backend=biber,maxbibnames=99,urldate=short,sortlocale=danish,firstinits=true,style=authoryear-icomp,dashed=false,doi=false,isbn=false,url=true,]{biblatex}

\addbibresource{\jobname.bib}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{bahn2017c,
    title = {Evolution of Teachers' Anticipation of Didactical Situations in the Course of Three Lesson Studies},
    journaltitle = {Annales de Didactique et de Sciences Cognitives},
    date = {2017},
    author = {Bahn, Jacob},
    file = {/home/jb/.mozilla/firefox/mwad0hks.default/zotero/storage/Y3G88PIA/Bahn - 2017 - Evolution of teachers' anticipation of didactical .pdf},
    pubstate = {submitted}
}
@inproceedings{bahn2017d,
    location = {{Nagoya, Japan}},
    title = {How Infrastructures of Lesson Studies Impact on Teachers' Learning},
    eventtitle = {{{WALS International Conference}}, {{November}} 24-26, 2017},
    date = {2017},
    author = {Bahn, Jacob},
    file = {/home/jb/.mozilla/firefox/mwad0hks.default/zotero/storage/MVURD5TC/wals-pres.pdf},
    pubstate = {submitted}
}
@article{bahn2017a,
    title = {An Experiment with {{Open}}-Ended {{Approach}} in Grade Four Probability Teaching},
    journaltitle = {Recherches en Didactique des Mathématiques},
    date = {2017},
    author = {Bahn, Jacob},
    file = {/home/jb/.mozilla/firefox/mwad0hks.default/zotero/storage/LN55IYG2/Bahn - 2017 - An experiment with Open-ended Approach in grade fo.pdf},
    pubstate = {submitted}
}
@article{bahn2017b,
    title = {Teachers Learning from Their First Lesson Study},
    journaltitle = {Journal of Mathematics Teacher Education},
    date = {2017},
    author = {Bahn, Jacob},
    file = {/home/jb/.mozilla/firefox/mwad0hks.default/zotero/storage/3H3WVRMA/Bahn - 2017 - Teachers learning from their first lesson study.pdf},
    pubstate = {submitted}
}

\end{filecontents}

\begin{document}
\chapter{List of papers and abstracts}
\noindent \fullcite{bahn2017a}.\\

\bigskip \noindent \fullcite{bahn2017b}.\\

\bigskip \noindent \fullcite{bahn2017c}.\\

\bigskip \noindent \fullcite{bahn2017d}.\\

\section{References}
\sloppy
\printbibliography[heading=none]
\end{document}

答案1

我认为 David 的第一个建议(即使用sortyear)是最合理的。但由于使用 Zotero,您无法添加自定义字段的要求确实使事情变得复杂。顺便说一句,您可能需要考虑更灵活的替代方案,例如 JabRef(请参阅LaTeX 和书目管理工具)。

不过,还是有一种方法可以动态更改数据,即使用 biblatex DeclareSourcemap。对于你的情况,你可以使用:

\DeclareSourcemap{
    \maps[datatype=bibtex]{
        \map{
            \step[fieldsource=entrykey, match=bahn2017a, fieldset=sortyear, fieldvalue=2017a]
            \step[fieldsource=entrykey, match=bahn2017b, fieldset=sortyear, fieldvalue=2017b]
            \step[fieldsource=entrykey, match=bahn2017c, fieldset=sortyear, fieldvalue=2017c]
            \step[fieldsource=entrykey, match=bahn2017d, fieldset=sortyear, fieldvalue=2017d]
        }
    }
}

本质上,这实现了 David 的第一个替代方案,而无需直接编辑您的 bib 文件。

一位 MWE 表示:

\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage[variant=british]{english}

\usepackage[backend=biber,maxbibnames=99,urldate=short,sortlocale=danish,giveninits=true,style=authoryear-icomp,dashed=false,doi=false,isbn=false,url=true,]{biblatex}

\addbibresource{\jobname.bib}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{bahn2017c,
    title = {Evolution of Teachers' Anticipation of Didactical Situations in the Course of Three Lesson Studies},
    journaltitle = {Annales de Didactique et de Sciences Cognitives},
    date = {2017},
    author = {Bahn, Jacob},
    file = {/home/jb/.mozilla/firefox/mwad0hks.default/zotero/storage/Y3G88PIA/Bahn - 2017 - Evolution of teachers' anticipation of didactical .pdf},
    pubstate = {submitted}
}
@inproceedings{bahn2017d,
    location = {{Nagoya, Japan}},
    title = {How Infrastructures of Lesson Studies Impact on Teachers' Learning},
    eventtitle = {{{WALS International Conference}}, {{November}} 24-26, 2017},
    date = {2017},
    author = {Bahn, Jacob},
    file = {/home/jb/.mozilla/firefox/mwad0hks.default/zotero/storage/MVURD5TC/wals-pres.pdf},
    pubstate = {submitted}
}
@article{bahn2017a,
    title = {An Experiment with {{Open}}-Ended {{Approach}} in Grade Four Probability Teaching},
    journaltitle = {Recherches en Didactique des Mathématiques},
    date = {2017},
    author = {Bahn, Jacob},
    file = {/home/jb/.mozilla/firefox/mwad0hks.default/zotero/storage/LN55IYG2/Bahn - 2017 - An experiment with Open-ended Approach in grade fo.pdf},
    pubstate = {submitted}
}
@article{bahn2017b,
    title = {Teachers Learning from Their First Lesson Study},
    journaltitle = {Journal of Mathematics Teacher Education},
    date = {2017},
    author = {Bahn, Jacob},
    file = {/home/jb/.mozilla/firefox/mwad0hks.default/zotero/storage/3H3WVRMA/Bahn - 2017 - Teachers learning from their first lesson study.pdf},
    pubstate = {submitted}
}

\end{filecontents}

\DeclareSourcemap{
    \maps[datatype=bibtex]{
        \map{
            \step[fieldsource=entrykey, match=bahn2017a, fieldset=sortyear, fieldvalue=2017a]
            \step[fieldsource=entrykey, match=bahn2017b, fieldset=sortyear, fieldvalue=2017b]
            \step[fieldsource=entrykey, match=bahn2017c, fieldset=sortyear, fieldvalue=2017c]
            \step[fieldsource=entrykey, match=bahn2017d, fieldset=sortyear, fieldvalue=2017d]
        }
    }
}


\begin{document}
\noindent \fullcite{bahn2017a}.\\

\bigskip \noindent \fullcite{bahn2017b}.\\

\bigskip \noindent \fullcite{bahn2017c}.\\

\bigskip \noindent \fullcite{bahn2017d}.\\

\section{References}
\sloppy
\printbibliography[heading=none]
\end{document}

enter image description here

答案2

我建议您sortyear在您的条目中添加一个字段。

像这样(顺便说一句,你giveninits不应该使用firstinits

\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage[variant=british]{english}

\usepackage[backend=biber,maxbibnames=99,urldate=short,sortlocale=danish,giveninits=true,style=authoryear-icomp,dashed=false,doi=false,isbn=false,url=true,]{biblatex}

\addbibresource{\jobname.bib}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{bahn2017c,
    title = {Evolution of Teachers' Anticipation of Didactical Situations in the Course of Three Lesson Studies},
    journaltitle = {Annales de Didactique et de Sciences Cognitives},
    date = {2017},
    sortyear = {2017c},
    author = {Bahn, Jacob},
    file = {/home/jb/.mozilla/firefox/mwad0hks.default/zotero/storage/Y3G88PIA/Bahn - 2017 - Evolution of teachers' anticipation of didactical .pdf},
    pubstate = {submitted}
}
@inproceedings{bahn2017d,
    location = {{Nagoya, Japan}},
    title = {How Infrastructures of Lesson Studies Impact on Teachers' Learning},
    eventtitle = {{{WALS International Conference}}, {{November}} 24-26, 2017},
    date = {2017},
    sortyear = {2017d},
    author = {Bahn, Jacob},
    file = {/home/jb/.mozilla/firefox/mwad0hks.default/zotero/storage/MVURD5TC/wals-pres.pdf},
    pubstate = {submitted}
}
@article{bahn2017a,
    title = {An Experiment with {{Open}}-Ended {{Approach}} in Grade Four Probability Teaching},
    journaltitle = {Recherches en Didactique des Mathématiques},
    date = {2017},
    sortyear = {2017a},
    author = {Bahn, Jacob},
    file = {/home/jb/.mozilla/firefox/mwad0hks.default/zotero/storage/LN55IYG2/Bahn - 2017 - An experiment with Open-ended Approach in grade fo.pdf},
    pubstate = {submitted}
}
@article{bahn2017b,
    title = {Teachers Learning from Their First Lesson Study},
    journaltitle = {Journal of Mathematics Teacher Education},
    date = {2017},
    sortyear = {2017b},
    author = {Bahn, Jacob},
    file = {/home/jb/.mozilla/firefox/mwad0hks.default/zotero/storage/3H3WVRMA/Bahn - 2017 - Teachers learning from their first lesson study.pdf},
    pubstate = {submitted}
}

\end{filecontents}

\begin{document}
\noindent \fullcite{bahn2017a}.\\

\bigskip \noindent \fullcite{bahn2017b}.\\

\bigskip \noindent \fullcite{bahn2017c}.\\

\bigskip \noindent \fullcite{bahn2017d}.\\

\section{References}
\sloppy
\printbibliography[heading=none]
\end{document}

enter image description here


第二种方式

如果您想使用输入键进行排序(我不推荐这样做),您需要添加几个块。

在之前添加\begin{document}

\DeclareSortingTemplate{nkyt}{
  \sort{
    \field{presort}
  }
  \sort[final]{
    \field{sortkey}
  }
  \sort{
    \field{sortname}
    \field{author}
    \field{editor}
    \field{translator}
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{entrykey}
  }
  \sort{
    \field{sortyear}
    \field{year}
  }
  \sort{
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{volume}
    \literal{0}
  }
}

然后添加\begin{document}

\newrefcontext[sorting=nkyt]

输出与上面相同,您不需要字段sortyear


第三条道路

将该选项添加date=year到您的biblatex选项中。

以 格式提供文章的完整日期date = {yyyy-mm-dd}

在之前添加\begin{document}

\DeclareSortingTemplate{nyt}{
  \sort{
    \field{presort}
  }
  \sort[final]{
    \field{sortkey}
  }
  \sort{
    \field{sortname}
    \field{author}
    \field{editor}
    \field{translator}
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{sortyear}
    \field{year}
  }
  \sort{
    \field{month}
  }
  \sort{
    \field{sorttitle}
    \field{title}
  }
  \sort{
    \field{volume}
    \literal{0}
  }
}

事实上,我认为这可能是最好的解决方案。

答案3

无需离开 Zotero 即可完成此操作。请注意,以下内容将影响全部您的 BBT 驱动的 biblatex 从 Zotero 导出,所以我不建议保留它。但如果您想这样做:

  1. 安装基础体温Zotero 中的插件(完整披露:我是该插件的作者),如果你还没有它;如果你使用 Zotero 并且你的键看起来像“bahn2017b”,你很可能已经在使用它了
  2. 进入 BBT 偏好设置并安装以下后记

    如果(Translator.BetterBibLaTeX)this.add({name:'sortname',value:item.date,enc:'date'})

这将为每个参考文献添加一个名为“sortname”的字段,但其值设置为参考文献的完整日期。由于默认排序是“nyt”,因此这将按完整日期对您的参考文献进行排序,精度可达您在 Zotero 的日期字段中指定的任何精度。

相关内容