Biblatex 拆分参考书目并使用不同的引用样式

Biblatex 拆分参考书目并使用不同的引用样式

我是新手。我曾使用 LaTeX 撰写过相同的文章,到目前为止,我能够自己解决问题。但现在我陷入困境。

我必须将我的参考书目分为可靠和不可靠来源。可靠来源应以内联字母样式引用。不可靠来源应以脚注形式引用,并采用详细注释样式。两者也都应打印在各自的参考书目中。

我已经使用过这个答案:Biblatex:两种具有不同风格和排序的书目 我设法分割参考书目并使用给定的不同样式。

我不知道如何告诉二级参考书目对我的脚注使用详细注释。

我希望有一个人可以帮助我!

提前致谢。(我的 MWE 是给定链接的答案)

答案1

这不是一个完整的解决方案,但我希望它可能会有用。

主要思想是列出一份“不可靠”来源的清单

\gdef\unreliable{}
\listadd{\unreliable}{LinkD01}
\listadd{\unreliable}{LinkC04}

然后使用以下引用命令,其具有通常的格式\mycite[prenote][postnote]{key}

\usepackage{xparse}
\DeclareDocumentCommand{\mycite}{oom}{%
  \ifinlist{#3}{\unreliable} %in the list of 'reliables'?
    {\IfNoValueTF{#2}
      {\IfNoValueTF{#1}
        {\footfullcite{#3}}
        {\footfullcite[#1]{#3}}}
      {\footfullcite[#1][#2]{#3}}}
    {\IfNoValueTF{#2}
      {\IfNoValueTF{#1}
        {\cite{#3}}
        {\cite[#1]{#3}}}
      {\cite[#1][#2]{#3}}}}

如您所见,\mycite并不完全支持引用多个键。

如果您\unreliable使用 手动将键添加到列表中\listadd,这基本上足以解决问题。但也可以自动填充列表。为此,我们首先定义一个特殊的bibenvironment

\defbibenvironment{counting}
  {}
  {}
  {\listxadd{\unreliable}{\thefield{entrykey}}}

然后在文档开头填写列表:

\begingroup%
  \makeatletter%
  \def\blx@driver#1{}%
  \printbibliography[env=counting,heading=none,keyword=secondary]%
  \makeatother%
\endgroup%

该列表将包含所有带有关键字的来源secondary

因为我不知道为什么这个\ifinlist命令在这种自动情况下对我不起作用。因此在下面的 MWE 中,我改用以下命令:

\newtoggle{tempa}
\newcommand{\ifunreliable}[3]{%
  \renewcommand*{\do}[1]{%
    \togglefalse{tempa}%
    \ifstrequal{#1}{##1}
      {\toggletrue{tempa}\listbreak}
      {}}%
  \dolistloop{\unreliable}%
  \iftoggle{tempa}{#2}{#3}%
  }

满的平均能量损失自动填充列表:

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

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

\gdef\unreliable{}
\defbibenvironment{counting}
  {}
  {}
  {\listxadd{\unreliable}{\thefield{entrykey}}}

\newtoggle{tempa}
\newcommand{\ifunreliable}[3]{%
  \renewcommand*{\do}[1]{%
    \togglefalse{tempa}%
    \ifstrequal{#1}{##1}
      {\toggletrue{tempa}\listbreak}
      {}}%
  \dolistloop{\unreliable}%
  \iftoggle{tempa}{#2}{#3}%
  }
\usepackage{xparse}
\DeclareDocumentCommand{\mycite}{oom}{%
  \ifunreliable{#3}
    {\IfNoValueTF{#2}
      {\IfNoValueTF{#1}
        {\footfullcite{#3}}
        {\footfullcite[#1]{#3}}}
      {\footfullcite[#1][#2]{#3}}}
    {\IfNoValueTF{#2}
      {\IfNoValueTF{#1}
        {\cite{#3}}
        {\cite[#1]{#3}}}
      {\cite[#1][#2]{#3}}}}

\begin{document}
\begingroup%
  \makeatletter%
  \def\blx@driver#1{}%
  \printbibliography[env=counting,heading=none,keyword=secondary]%
  \makeatother%
\endgroup%

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

\printbibliography[title=Bibliography, keyword=primary]

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

答案2

一位好心人建议我使用\footfullcite{}。这正是我想要的!

相关内容