我记得不久前看过一篇精彩的评论文章。可惜我找不到它了,所以我既不能引用它,也不能截图。独特之处在于参考书目。某些特别值得注意的论文通过将引用文章的标题加粗来强调。如果我没记错的话,条目后面的页面也被涂成了非常浅的橙色。在其他条目中,文本没有加粗。此外,在页边空白处还可以看到一个包含一到两句话的小框。
每个小信息框都有一个引用参考书目条目的标题和一两句话描述文章。所有这些框都与它们描述的参考资料放在同一页上。
我想在我的论文中重复这个设计,因为我可以自由地这样做。使用 biblatex 可以实现吗?
编辑:有人在线下问我这个问题是什么意思。为了尽量避免歧义,我从一份随机书目中截取了一张截图,并在上面画了画。显然我不想要这么丑陋的东西,我也不打算使用这种书目风格。但现在这个想法应该很清楚了。强调特殊的书目条目,并在页边空白处放一个简短的信息框。
答案1
更新的解决方案
经过一段时间,我终于让bibitem
高亮显示以可接受的方式工作了。下面的代码与以前的版本不同,因为许多宏名称已经更改,并且结构也更加完善,以便其他人在自己的工作中更容易使用。具体来说,
- 包含信息框文本的字段可以自定义
\def\notefield{annotation}
。 - 您必须明确命名要显示信息框的条目。如果您选择包含一个
\notefield
空的或不存在的项目,则bibitem
该条目的 仍会突出显示,但不会出现信息框。 - 每个方面的颜色和样式可以单独控制。
- 对“重要”的引用已迁移至“信息框”
结果
示例代码现在可运行,biblatex-examples.bib
看起来会更好一些。
代码
示例 bib 文件biblatex-examples.bib
有许多条目;annotation
每个条目都填充了 字段;vazques-de-parga
条目还包含一个note
字段,因此您可以看到将 更改为 时会发生什么。\notefield
与此相关的注释散布在下面的代码中。annotation
note
\documentclass[]{article}
% Set page geometry - this adds a bit more room for the marginpars to live comfortably
\usepackage[includemp,marginparwidth=4cm,reversemarginpar]{geometry}
\newlength{\innermarginparwidth}
\setlength{\innermarginparwidth}{\marginparwidth}
\addtolength{\innermarginparwidth}{-1em}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Load packages
\usepackage{tikz} % Tikz basic
\usetikzlibrary{tikzmark} % Gives \tikzmark for markers
\usetikzlibrary{calc} % Node position calculations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% User Customizable Options
%
% Some basic options for biblatex
\usepackage[backend=biber,sorting=nyt,style=ieee]{biblatex}
%
% Load bibliography
\addbibresource{biblatex-examples.bib} % Load some examples
\def\notefield{annotation} % Set the bibentry-field that contains your notes---could also be "note"
%
% Set colors & style
\definecolor{InfoboxBackground}{HTML}{F6F6FF}
\definecolor{InfoboxFrame}{HTML}{000077} % Remove frame by making this the same as background
\definecolor{InfoboxText}{HTML}{4444FF}
\definecolor{BibitemText}{HTML}{000077}
\definecolor{BibitemHighlight}{HTML}{FFFF00}
\def\bibitemstyle{\bfseries\color{BibitemText}}
\def\infoboxstyle{\slshape}
\def\infoboxsep{6pt} % inner margins of box
\def\infoboxrule{1pt} % width of rule around box
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Setup Infobox
\DeclareBibliographyCategory{UseInfobox} % Make a category for entries that should have infoboxes
\newbibmacro*{infoboxnote}{\printfield[infoboxnote]{\notefield}} % New bibmacro to print out the infoboxnote-styled note
\DeclareFieldFormat{\notefield}{} % Disable printing of \notefield in other ordinary circumstances
\DeclareFieldFormat{infoboxnote}{\marginpar{\fboxsep\infoboxsep\fboxrule\infoboxrule\fcolorbox{InfoboxFrame}{InfoboxBackground}{\parbox[t]{\innermarginparwidth}{\color{InfoboxText}\infoboxstyle\printfield[labelnumberwidth]{labelnumber} #1}}}} % Insert \marginpar with note
% New \highlight command for bibitem highlighting
% Takes parameter {entrykey} to make \tikzmark pairs unique
% \highlight command should appear before the text to highlight so it is set behind
\newcommand{\highlight}[1]{%
\begin{tikzpicture}[remember picture, overlay]
\coordinate (begin) at ($ (pic cs:#1beg) + (-.5ex,2ex) $);
\coordinate (end) at ($ (pic cs:#1end) + (0,-.8ex) $);
\coordinate (penult) at ($ (begin |- end) + (0,-.5ex) $);
\coordinate (right) at ($ (begin) + (\linewidth+1ex,0) $);
\fill[BibitemHighlight] (begin) -- (right |- begin) -- (right |- end) -- ( begin |- end) -- cycle;
\end{tikzpicture}}
% Set the \tikzmarks ; Place the infoboxnote ; set style for bibitem
\AtEveryBibitem{%
\ifcategory{UseInfobox}%
{\highlight{\thefield{entrykey}}\tikzmark{\thefield{entrykey}beg}\usebibmacro{infoboxnote}\bibitemstyle}%
{}}
\renewbibmacro*{finentry}{\finentry\tikzmark{\thefield{entrykey}end}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
% Identify the entries you want to have an infobox
\addtocategory{UseInfobox}{bertram,sarfraz,vazques-de-parga} % Add items that you want to have infoboxes for
\nocite{bertram,sarfraz,companion,knuth:ct,kullback,wilde,vazques-de-parga}
% Example of \highlight command with regular text to demonstrate how things work
% Note that command highlights with rectangle starting where text starts; indentation not supported
\noindent\highlight{UNIQUE}\tikzmark{UNIQUEbeg}This is a line that goes all the way to the end and has a tikzmark that marks the ultimate end on the next line.\tikzmark{UNIQUEend}
\printbibliography
\end{document}
原始帖子
这可以完成您想要的所有操作biblatex
...除了 bib-entry 的(背景)突出显示(这在保持多行条目的能力的同时特别难以实现)。
解决方案用于在边距中\marginpar
设置条目的字段。正如所写,您只需向条目添加一个字段;当正常设置注释字段时(您必须使用要使用注释的样式),注释将放置在边距中,条目本身将添加到类别中。然后,每个条目都以特殊字体排版(此处为粗体和彩色)。note
note
\marginpar
important
important
另一种方法是手动指定要突出显示的条目(使用\addtocategory{important}{paperA,...}
)并从中删除相应的代码\DeclareFieldFormat{note}{...}
。然后,您可以保留所有重要文件的笔记,但只包括最重要的文件(或您有空间的文件)。
解决方案如下:
\documentclass[]{article}
\begin{filecontents}{\jobname.bib}
@inproceedings{paperA,
booktitle = {Proceedings},
year = {2003},
author = {Alpha, Author},
title = {AAA Title of Paper},
note={This paper is of special significance},
}
@inproceedings{paperB,
booktitle = {Proceedings},
year = {2002},
author = {Bravo, Author},
title = {BBB Title of Paper},
note={This paper is also of special significance},
}
@inproceedings{paperC,
booktitle = {Proceedings},
year = {2004},
author = {Charlie, Author},
title = {CCC Title of Paper},
}
@inproceedings{paperD,
booktitle = {Proceedings},
year = {2001},
author = {Bravo, Author},
title = {DDD Title of Paper},
}
@inproceedings{paperE,
booktitle = {Proceedings},
year = {2001},
author = {Bravo, Author},
title = {BEE Title of Paper},
}
\end{filecontents}
\usepackage[svgnames]{xcolor}
\usepackage[includemp,marginparwidth=4cm,reversemarginpar]{geometry}
% Some basic options for biblatex
\usepackage[backend=biber,sorting=nyt,style=ieee]{biblatex}
\addbibresource{\jobname}
%% Highlight entries
\DeclareBibliographyCategory{important}
\DeclareFieldFormat{note}{\addtocategory{important}{\thefield{entrykey}}\marginpar{\printfield[labelnumberwidth]{labelnumber} #1}}
\AtEveryBibitem{%
\ifcategory{important}%
{\bfseries\color{Maroon}}%
{}%
}
\begin{document}
\nocite{*}
~ % Type something....
\printbibliography
\end{document}
编辑以获得更多颜色:
您可以使用注释本身来添加更多颜色\colorbox
:
\usepackage{xcolor}
\definecolor{ImportantBackground}{HTML}{FFE3D6}
\definecolor{Important}{HTML}{A13506}
\usepackage[includemp,marginparwidth=4cm,reversemarginpar]{geometry}
\newlength{\innermarginparwidth}
\setlength{\innermarginparwidth}{\marginparwidth}
\addtolength{\innermarginparwidth}{-1em}
% Some basic options for biblatex
\usepackage[backend=biber,sorting=nyt,style=ieee]{biblatex}
\addbibresource{\jobname}
%% Highlight entries
\DeclareBibliographyCategory{important}
\DeclareFieldFormat{note}{\addtocategory{important}{\thefield{entrykey}}\marginpar{\fboxsep6pt\fcolorbox{ImportantBackground}{ImportantBackground}{\parbox[t]{\innermarginparwidth}{\color{black}\printfield[labelnumberwidth]{labelnumber} #1}}}}
\AtEveryBibitem{%
\ifcategory{important}%
{\bfseries\color{Important}}%
{}%
}