BibLaTeX,多个不同风格的参考书目太复杂

BibLaTeX,多个不同风格的参考书目太复杂

编辑

我在文档的最后使用了两个参考书目:

主要参考书目,分为几个子类别:

  • 文章
  • 字典
  • 法律文本
  • ETC

第二份书目称为“参考”,其中包括新闻文章、播客、视频等。

主要参考书目必须采用 APA 7 格式。第二参考书目必须采用数字格式。

最后,无论引用的参考书目是什么,我希望引用遵循以下格式:

(作者姓氏、年份、页数)

这是一个最小的工作示例:

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

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

\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifkeyword{ref}
       {\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]{ref}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@BOOK{BookA,
  author    = {Author Aaa},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2003,
  page = {42--81},
  keywords  = {rapport},
}
@BOOK{BookB,
  author    = {Author Bbb},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2002,
  page = {34--138},
  keywords  = {rapport},
}
@MISC{LinkC,
  author    = {Author Ccc},  
  title     = {Some Title},
  year      = 2004,
  url       = {www.test1.com},
  keywords  = {ref},
}
@MISC{LinkD,
  author    = {Author Ddd},
  title     = {Some Title},
  year      = 2001,
  url       = {www.test2.com},
  keywords  = {ref},
}
@BOOK{LinkE,
  author    = {Author Eee},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2003,
  page = {4--11},
  keywords  = {livre},
}
@BOOK{BookF,
  author    = {Author Fff},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2002,
  page = {4--18},
  keywords  = {livre},
}
@BOOK{LinkG,
  author    = {Author Ggg},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2003,
  page = {4--13},
  keywords  = {manuel},
}
@BOOK{BookH,
  author    = {Author Hhh},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2002,
  page = {1--23},
  keywords  = {manuel},
}
@BOOK{LinkI,
  author    = {Author Iii},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2003,
  page = {12--13},
  keywords  = {article},
}
@BOOK{BookJ,
  author    = {Author Jjj},
  title     = {Some Title},
  publisher = {Some Publisher},
  year      = 2002,
  page = {1--13},
  keywords  = {article},
}
@MISC{LinkK,
  author    = {Author Kkk},
  title     = {Some Title},
  year      = 2001,
  url       = {www.test3.com},
  keywords  = {ref},
}
@MISC{LinkL,
  author    = {Author Lll},
  title     = {Some Title},
  year      = 2001,
  url       = {www.test4.com},
  keywords  = {ref},
}
\end{filecontents}
\addbibresource{\jobname.bib}


\begin{document}

\par{Some text \autocite{LinkD} test \autocite{BookB}.}
\par{Some text \autocite{LinkC} test \autocite{BookA}.
\par{Some text \autocite{LinkE} test \autocite{BookF} test \autocite{LinkK}.
\par{Some text \autocite{LinkG} test \autocite{BookH} test \autocite{LinkL}.
\par{Some text \autocite{LinkI} test \autocite{BookJ}.

\section*{Bibliographie}

\printbibliography[heading=subbibintoc,title=Livre, keyword=livre]
\printbibliography[heading=subbibintoc,title=Manuel, keyword=manuel]
\printbibliography[heading=subbibintoc,title=Article, keyword=article]
\printbibliography[heading=subbibintoc,title=Rapport d'enquête, keyword=rapport]

\newrefcontext[sorting=none]
\printbibliography[env=bibliographyNUM,title=Référence, keyword=ref, resetnumbers]
\end{document}

平均能量损失

代码来自@moewe邮政

问题 :

  • 当我尝试更改时style=authoryear出现style=apa此错误:

在此处输入图片描述

  • 当我引用主要参考书目时它是这样的:

    [作者姓氏,年份]

  • 当我引用第二份参考书目(参考文献)时,它是这样的:

    [引用数]

在此处输入图片描述

问题

由于我不完全理解@moewe 提供的代码,我无法自己修复这些问题。为什么获取具有不同风格的多个书目如此复杂?

我们能想象在命令中\printbibliography像这样设置样式吗:

\printbibliography[style=apa, citationstyle=something, heading=bibintoc, title=Livre, keyword=livre]

相关内容