Biblatex:打印枚举中单个条目的参考书目

Biblatex:打印枚举中单个条目的参考书目

我有以下 LaTeX 代码

\documentclass{article}
\usepackage{filecontents}
\usepackage{biblatex}

\DeclareBibliographyCategory{firstpaper}
\DeclareBibliographyCategory{secondpaper}
\DeclareBibliographyCategory{enumpapers}

\begin{filecontents}{\jobname.bib}
    @misc{Gyro2012,
        author = {Gearloose, Gyro},
        title = {1st paper with a very loooooooooooong title, so it spans multiple rows},
    }
    @misc{Gyro2013,
        author = {Gearloose, Gyro},
        title = {2nd paper},
    }
    @misc{Stark2012,
        author = {Stark, Anthony Edward},
        title = {3rd paper},
    }
    @misc{Stark2013,
        author = {Stark, Anthony Edward},
        title = {4th paper},
    }
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\nocite{*}

\addtocategory{firstpaper}{Gyro2012}
\addtocategory{secondpaper}{Gyro2013}
\addtocategory{enumpapers}{Gyro2012,Gyro2013}

\begin{enumerate}
    \item \printbibliography[heading=none,category=firstpaper]
    \setcounter{enumi}{9} % Two digits to test alignment
    \item \printbibliography[heading=none,category=secondpaper]
\end{enumerate}

\printbibliography[notcategory=enumpapers]

\end{document}

输出结果如下

LaTeX 输出

我的问题是:如何才能实现相同的输出,而无需为枚举中出现的每篇论文声明自己的类别?换句话说:我正在寻找类似于 \fullcite 命令的东西,它还可以打印 [1] 等等(首选解决方案)。

我想还有一个使用 \defbibenvironment 的解决方案,但我的后续问题是:如何将参考书目条目重新排列为仅适用于枚举的特定顺序。

此外,我只寻找与 biblatex 兼容的解决方案。

答案1

我们不必为每个条目定义一个单独的类别,而是可以动态创建一个bibcheck,但我们确实保留了该enumpapers类别,因为这样非常方便。

\DeclareBibliographyCategory{enumpapers}

我们的新命令\enumcite将密钥添加到enumpapers,为输入密钥创建 bibcheck 并打印参考书目

\newcommand{\enumcite}[1]{%
  \addtocategory{enumpapers}{#1}%
  \defbibcheck{key#1}{
    \iffieldequalstr{entrykey}{#1}
      {}
      {\skipentry}}%
  \printbibliography[heading=none,check=key#1]%
}

我们可以\enumcite这样使用

\begin{enumerate}
    \item \enumcite{Gyro2012}
    \setcounter{enumi}{9} % Two digits to test alignment
    \item \enumcite{Gyro2013}
\end{enumerate}

平均能量损失

\documentclass{article}
\usepackage{filecontents}
\usepackage{biblatex}
\begin{filecontents*}{\jobname.bib}
@misc{Gyro2012,
  author = {Gearloose, Gyro},
  title = {1st paper with a very loooooooooooong title, so it spans multiple rows},
}
@misc{Gyro2013,
  author = {Gearloose, Gyro},
  title = {2nd paper},
}
@misc{Stark2012,
  author = {Stark, Anthony Edward},
  title = {3rd paper},
}
@misc{Stark2013,
  author = {Stark, Anthony Edward},
  title = {4th paper},
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\DeclareBibliographyCategory{enumpapers}

\newcommand{\enumcite}[1]{%
  \addtocategory{enumpapers}{#1}%
  \defbibcheck{key#1}{
    \iffieldequalstr{entrykey}{#1}
      {}
      {\skipentry}}%
  \printbibliography[heading=none,check=key#1]%
}

\begin{document}

\nocite{*}

\begin{enumerate}
    \item \enumcite{Gyro2012}
    \setcounter{enumi}{9} % Two digits to test alignment
    \item \enumcite{Gyro2013}
\end{enumerate}

\printbibliography[notcategory=enumpapers]
\end{document}

在此处输入图片描述

答案2

更多的是权宜之计,而不是适当的解决方案,但你可以替换

\item \printbibliography[heading=none,category=firstpaper]

比如:

\item \cite{Gyro2012}\quad \fullcite{Gyro2012}

\cite部分生成括号([1]),并且\quad必须在括号和引用之间具有正确的水平间距。

通过创建一个命令可以轻松简化解决方法:

\newcommand{\enumcite}[1]{\cite{#1}\quad \fullcite{#1}}
\enumcite{Gyro2012}

这样你就不必为每篇论文创建一个类别。(可能的)问题是你引用了同一篇论文两次。


平均能量损失(产生与您的相同的输出):

\documentclass{article}
\usepackage{filecontents}
\usepackage{biblatex}

\DeclareBibliographyCategory{firstpaper}
\DeclareBibliographyCategory{secondpaper}
\DeclareBibliographyCategory{enumpapers}

\begin{filecontents}{\jobname.bib}
    @misc{Gyro2012,
        author = {Gearloose, Gyro},
        title = {1st paper with a very loooooooooooong title, so it spans multiple rows},
    }
    @misc{Gyro2013,
        author = {Gearloose, Gyro},
        title = {2nd paper},
    }
    @misc{Stark2012,
        author = {Stark, Anthony Edward},
        title = {3rd paper},
    }
    @misc{Stark2013,
        author = {Stark, Anthony Edward},
        title = {4th paper},
    }
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\nocite{*}


\newcommand{\enumcite}[1]{\cite{#1}\quad \fullcite{#1}}

\addtocategory{enumpapers}{Gyro2012,Gyro2013}

\begin{enumerate}
    \item \enumcite{Gyro2012}
    \setcounter{enumi}{9} % Two digits to test alignment
    \item \enumcite{Gyro2013}
\end{enumerate}

\printbibliography[notcategory=enumpapers]

\end{document}

相关内容