\printbibliography — 每页一个条目

\printbibliography — 每页一个条目

我想用每页单个条目

我需要对下面的 MWE 进行哪些更改才能有效地生成参考书目,如以下手动生成的代码所示:

\begin{preview}
  \fullcite{goossens93}
\end{preview}
\begin{preview}
  \fullcite{greenwade93}
\end{preview}
\begin{preview}
  \fullcite{knuth79}
\end{preview}

序言中需要包含以下内容:

\usepackage[active,tightpage]{preview}
\setlength\PreviewBorder{2pt}%

这样就生成了所需的 3 页文档:

在此处输入图片描述

我刚刚意识到图片中缺少引用标签——我想要显示出来。

附加问题:

我希望在每个参考书目条目的末尾调用一个自定义宏 - 传递引用键的参数。计划的用途之一是添加指向 .bibtex 的链接以便于更正。

如果需要,我可以发布一个单独的问题,但怀疑解决原始问题也可能提供此功能。

平均能量损失

\begin{filecontents*}{complete-bibliography.bib}
@book{goossens93,
    author   ={Michel Goossens},
    title    ={The {LaTeX} Companion},
    year     ={1993},
    publisher={Addison-Wesley},
    address  ={Reading, Massachusetts},
}

@article{greenwade93, 
    author ={George D. Greenwade},
    title  ={The {C}omprehensive {TeX} {A}rchive {N}etwork ({CTAN})},
    year   ={1993},
    journal={TUGBoat},
    volume ={14},
    number ={3},
    pages  ={342--351},
    url    ={www.ctan.org},
}

@book{knuth79,
    author   ={Donald E. Knuth},
    title    ={{TeX} and Metafont, New Directions in Typesetting},
    year     ={1979},
    publisher={American Mathematical Society and Digital Press},
    address  ={Stanford},
}
\end{filecontents*}


\documentclass{article}

\usepackage{biblatex}
\addbibresource{complete-bibliography.bib}

%\usepackage[active,tightpage]{preview}
%\setlength\PreviewBorder{2pt}%


\begin{document} 
\nocite{*}
\printbibliography% <-- Make this equivalent to below.
%% -------------- Desired Output
%\begin{preview}
%\fullcite{goossens93}
%\end{preview}
%\begin{preview}
%\fullcite{greenwade93}
%\end{preview}
%\begin{preview}
%\fullcite{knuth79}
%\end{preview}
\end{document}

答案1

这里有一个选项,它重新定义biblatex书目环境以使用preview environment而不是列表,并修改finentrybibmacro 以关闭preview环境并使用输入键添加奖励宏。可能有更优雅的方式。

更新以显示使用tcolorbox(在评论中请求)

诀窍在于,宏的结尾tcolorbox必须位于finentry宏中的当前组之后。

\documentclass{article}
\begin{filecontents}[overwrite]{\jobname.bib}
@book{goossens93,
  author   ={Michel Goossens},
  title    ={The {LaTeX} Companion},
  year     ={1993},
  publisher={Addison-Wesley},
  address  ={Reading, Massachusetts},
}
@article{greenwade93, 
  author ={George D. Greenwade},
  title  ={The {C}omprehensive {TeX} {A}rchive {N}etwork ({CTAN})},
  year   ={1993},
  journal={TUGBoat},
  volume ={14},
  number ={3},
  pages  ={342--351},
  url    ={www.ctan.org},
}
@book{knuth79,
  author   ={Donald E. Knuth},
  title    ={{TeX} and Metafont, New Directions in Typesetting},
  year     ={1979},
  publisher={American Mathematical Society and Digital Press},
  address  ={Stanford},
}
\end{filecontents}
\usepackage{tcolorbox}
\tcbset{colback=green!10, colframe=blue}
\usepackage[active,tightpage]{preview}
\setlength\PreviewBorder{2pt}
\usepackage{biblatex}
\addbibresource{\jobname.bib}
\newcommand{\startbibentry}{%
  \begin{preview}%
    \begin{tcolorbox}}
\newcommand{\stopbibentry}{%
    \end{tcolorbox}%
  \end{preview}}
\newcommand{\showentrykey}[1]{The entry key is: \texttt{#1}}
\renewbibmacro*{finentry}{%
  \finentry
  \par
  \smallskip
  \leftskip\labelnumberwidth
  \showentrykey{\strfield{entrykey}}%
  \par
  \aftergroup\stopbibentry}
\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}~}
\defbibenvironment{bibliography}
  {}
  {}
  {\startbibentry
   \hangindent\labelnumberwidth
   \printtext[labelnumberwidth]{%
     \printfield{labelprefix}%
     \printfield{labelnumber}}}
\begin{document} 
\nocite{*}
\printbibliography[heading=none]
\end{document}

输出

相关内容