两种不同风格和排序的书目,第 2 卷

两种不同风格和排序的书目,第 2 卷

答案莫威出现在这个问题几乎就是我想要实现的:

  • 一个包含在线参考文献的参考书目,这些参考文献按出现顺序编号和排序(这里无需更改,moewes 代码是完美的!)
  • 一份包含所有书籍和文章参考文献的参考书目,按字母顺序排列(几乎是我想要的!)

对于第二个 bib,不再只显示作者的三个字母,后面跟着年份的最后两个数字,例如[Sut68],我希望有第一作者的完整姓氏,后跟逗号、空格,然后是完整年份,例如[萨瑟兰,1968 年]

我真的不知道如何实现这一点,我尝试摆弄 moewes 提供的代码,但除了破坏它之外找不到任何解决方案。如果有人能发布更改的部分来实现这一点,我将不胜感激!

提前谢谢大家!

编辑:这是代码莫威在上述问题的答案中提供,如果有帮助的话:

\documentclass{article}

\usepackage{filecontents}

\begin{filecontents}{biblatextest1.bib}
@BOOK{BookA03,
  author    = {Author Aaa},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2003,
}
@BOOK{BookB02,
  author    = {Author Bbb},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2002,
}
\end{filecontents}

\begin{filecontents}{biblatextest2.bib}
@MISC{LinkC04,
  author  = {Author Ccc},  
  title   = {Some Title},
  year    = 2004,
  url     = {www.test1.com/bild.jpg},
}
@MISC{LinkD01,
  author  = {Author Ddd},
  title   = {Some Title},
  year    = 2001,
  url     = {www.test2.com/bild.jpg},
}
\end{filecontents}

\usepackage[style = alphabetic, labelnumber, defernumbers = true,  backend = biber]{biblatex}
\addbibresource{biblatextest1.bib}
\addbibresource{biblatextest2.bib}

\usepackage{hyperref}

%Append keywords to identify different bibliography entries.
\DeclareSourcemap{
  \maps[datatype=bibtex, overwrite]{
    \map{
      \perdatasource{biblatextest1.bib}
      \step[fieldset=KEYWORDS, fieldvalue=primary, append]
    }
    \map{
      \perdatasource{biblatextest2.bib}
      \step[fieldset=KEYWORDS, fieldvalue=secondary, append]
    }
  }
}

\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}
\renewbibmacro*{cite}{%
  \printtext[bibhyperref]{%
    \printfield{labelprefix}%
    \ifkeyword{secondary}
      {\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]{secondary}
\begin{document}

The first two citations \cite{LinkD01} and \cite{BookB02}. 
The others are \cite{LinkC04} and \cite{BookA03}.

\printbibliography[title=Bibliography, keyword=primary]

\newrefcontext[sorting=none]
\printbibliography[env=bibliographyNUM,title=References, keyword=secondary, resetnumbers]
\end{document}

这产生以下结果(也由莫威):

结果

正如我已经说过的,我只想将 [EXA97] 改为 [Example, 1997]。不过,如果参考书目中根本没有整个括号就更好了!这是我想要的最佳解决方案(我在 photoshop 中编辑了它,因为我不知道如何实现这一点):

完美的解决方案

答案1

该方法类似于Biblatex:两种具有不同风格和排序的书目,但这次我们以authoryear作为基础并复制其定义cite

\documentclass{article}
\usepackage[style = authoryear, labelnumber, defernumbers = true, backend = biber, autocite=inline]{biblatex}
\usepackage{hyperref}

\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}

\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifkeyword{secondary}
       {\printtext[bibhyperref]{%
          \printfield{labelprefix}%
          \printfield{labelnumber}}}
       {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
          {\usebibmacro{cite:label}%
           \setunit{\printdelim{nonameyeardelim}}}
          {\printnames{labelname}%
           \setunit{\printdelim{nameyeardelim}}}%
        \usebibmacro{cite:labeldate+extradate}}}
    {\usebibmacro{cite:shorthand}}}

\DeclareCiteCommand{\parencite}[\mkbibbrackets]
  {\usebibmacro{prenote}}%
  {\usebibmacro{citeindex}%
   \usebibmacro{cite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand*{\parencite}[\mkbibbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{citeyear}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\defbibenvironment{bibliographyNUM}
  {\list
     {\printtext[labelnumberwidth]{%
        \printfield{labelprefix}%
        \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]{secondary}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{BookA03,
  author    = {Author Aaa},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2003,
  keywords  = {primary},
}
@BOOK{BookB02,
  author    = {Author Bbb},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2002,
  keywords  = {primary},
}
@MISC{LinkC04,
  author    = {Author Ccc},  
  title     = {Some Title},
  year      = 2004,
  url       = {www.test1.com/bild.jpg},
  keywords  = {secondary},
}
@MISC{LinkD01,
  author    = {Author Ddd},
  title     = {Some Title},
  year      = 2001,
  url       = {www.test2.com/bild.jpg},
  keywords  = {secondary},
}
\end{filecontents}
\addbibresource{\jobname.bib}


\begin{document}

The first two citations \autocite{LinkD01} and \autocite{BookB02}. 
The others are \autocite{LinkC04} and \autocite{BookA03}.

\printbibliography[title=Bibliography, keyword=primary]

\newrefcontext[sorting=none]
\printbibliography[env=bibliographyNUM,title=References, keyword=secondary, resetnumbers]
\end{document}

前两个引用是 1 和 Bbb 2002。其他的是 2 和 Aaa 2003。//参考书目//Aaa,作者(2003)。一些标题。一些出版商。//Bbb,作者(2002)。一些标题。一些出版商。//参考文献//[1] Ddd,作者(2001)。一些标题。url:www.test2.com/bild.jpg。//[2] Ccc,作者(2004)。一些标题。url:www.test1.com/bild.jpg。

适用于 Overleaf 上过时版本的版本biblatex可以在以下网址找到:https://v1.overleaf.com/read/cppjsymdshwd。所需的更改很小:用 替换就足够cite:labeldate+extradatecite:labelyear+extrayear

相关内容