同一参考书目的不同引用样式

同一参考书目的不同引用样式

我正在尝试使用 biblatex 创建具有两种不同样式的参考书目。这意味着论文和书籍的作者、年份引用,以及在线引用的数字样式。可以吗?

\documentclass{article}

\usepackage[sorting=nyt,style=authoryear, backend=bibtex8]{biblatex} 
\addbibresource{dummy} 

\DeclareCiteCommand{\parencite}
{\ifentrytype{online}{\bibopenbracket}{\bibopenparen}%
\usebibmacro{prenote}}%
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{postnote}%
\ifentrytype{online}{\bibclosebracket}{\bibcloseparen}}
\begin{document}

\parencite{Rouhiainen.2004}
\parencite{Wikipedia.27.02.2017}

\printbibliography[heading=bibintoc,title={Literature},nottype=online]

\printbibliography[heading=bibintoc,title={ Internet Sources },type=online]


\end{document}

.bib 文件的内容如下:

@online{Wikipedia.27.02.2017,
 author = {Wikipedia, the free encyclopedia},
 year = {2017},
 title = {MALDI-TOF},
 url = {https://de.wikipedia.org/wiki/MALDI-TOF},
 urldate = {02.06.2017}
}
@article{Rouhiainen.2004,
 author = {Rouhiainen, Leo and Vakkilainen, Tanja and Siemer, Berit Lumbye and Buikema, William and Haselkorn, Robert and Sivonen, Kaarina},
 year = {2004},
 title = {Genes coding for hepatotoxic heptapeptides (microcystins) in the cyanobacterium Anabaena strain 90},
 pages = {686--692},
 volume = {70},
 number = {2},
 issn = {0099-2240},
 journal = {Applied and environmental microbiology}
}

答案1

一般情况下,无法在一个文档中混合或切换不同的样式。这是因为一些相关选项必须在加载时设置,而一些设置可能会发生冲突 - 如果必须将选项传递给 Biber,这肯定会出现问题。

然而,在很多特殊情况下,我们还是可以想出一个可行的解决方案。就像这个案例一样。

平均能量损失

\documentclass{article}

\usepackage[sorting=nyt,style=authoryear, backend=bibtex8, defernumbers]{biblatex} 

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

% bib environment for numeric citations (@online) from numeric.bbx
\defbibenvironment{onlinebib}
  {\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}

% taken from numeric.cbx
\providebool{bbx:subentry}
\newbibmacro*{cite:num}{%
  \printtext[bibhyperref]{%
    \printfield{labelprefix}%
    \printfield{labelnumber}%
    \ifbool{bbx:subentry}
      {\printfield{entrysetcount}}
      {}}}

% switch citation style based on entry type
\DeclareCiteCommand{\parencite}
  {\ifentrytype{online}{\bibopenbracket}{\bibopenparen}%
   \usebibmacro{prenote}}%
  {\usebibmacro{citeindex}%
   \ifentrytype{online}{\usebibmacro{cite:num}}{\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{postnote}%
   \ifentrytype{online}{\bibclosebracket}{\bibcloseparen}}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@online{Wikipedia.27.02.2017,
  author  = {Wikipedia, the free encyclopedia},
  year    = {2017},
  title   = {MALDI-TOF},
  url     = {https://de.wikipedia.org/wiki/MALDI-TOF},
  urldate = {2017-06-02},
}
@article{Rouhiainen.2004,
  author  = {Rouhiainen, Leo and Vakkilainen, Tanja and Siemer, Berit Lumbye and Buikema, William and Haselkorn, Robert and Sivonen, Kaarina},
  year    = {2004},
  title   = {Genes coding for hepatotoxic heptapeptides (microcystins) in the cyanobacterium Anabaena strain 90},
  pages   = {686--692},
  volume  = {70},
  number  = {2},
  issn    = {0099-2240},
  journal = {Applied and environmental microbiology},
}
\end{filecontents}

\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
\parencite{Rouhiainen.2004} \parencite{Wikipedia.27.02.2017} \parencite{sigfridsson} \parencite{worman} \parencite{ctan} \parencite{baez/online}


\printbibliography[nottype=online, heading=bibintoc, title={Literature}]
\printbibliography[env=onlinebib,  type=online, heading=bibintoc, title={Internet Sources}, resetnumbers]
\end{document}

示例输出

相关内容