使用 biblatex 和 refsection 的带编号列表的独立出版物列表

使用 biblatex 和 refsection 的带编号列表的独立出版物列表

我想为一篇论文添加一个出版物列表,按出版日期排序,编号为 1、2、3。此外,论文的作者应在此列表中以粗体突出显示。

\defbibenvironment{bibliography}我尝试的方法是使用带有修改的and 的refsection \ExecuteBibliographyOptions{labelnumber}。这在原则上是可行的,但编号是根据参考书目(我不想要的)而不是列表索引。通过使用选项可以独立编号defernumbers,但数字永远不会从 1 开始。在此示例中,它将是 4,5,6。一个小错误是每个列表都以空格开头,而不是作者姓名。正常的参考书目采用不同的样式(字母顺序),必须保持不变。

如果无法根据列表索引对引用进行编号,则第二个问题仍然悬而未决。我希望论文作者的名字在出版物列表中突出显示(粗体)。在这种情况下,我不知道如何实现这一点。

这张图显示了编号的错误:

在此处输入图片描述

这是一个可以借鉴的例子:

\documentclass{article}

\usepackage{filecontents}

\usepackage[
  style=alphabetic, % Loads the bibliography and the citation style 
  %style=numeric,
]{biblatex}  

\ExecuteBibliographyOptions{%
sorting=nty, % Sort by name, title, year.
maxbibnames=15,%
%defernumbers,
}%      

\addbibresource{publications.bib}
\ExecuteBibliographyOptions{labelnumber}
\begin{document}

\begin{filecontents*}{publications.bib}
@Article{Pospiech2010,
  Title                    = {Single-sweep laser writing of 3D-waveguide devices},
  Author                   = {Matthias Pospiech and Moritz Emons and Benjamin V\"{a}ckenstedt and Guido Palmer and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2010},
  Number                   = {7},
  Pages                    = {6994--7001},
  Volume                   = {18},
}

@Article{Pospiech2009,
  Title                    = {Double waveguide couplers produced by simultaneous femtosecond writing},
  Author                   = {Matthias Pospiech and Moritz Emons and Andy Steinmann and Guido Palmer and Roberto Osellame and Nicola Bellini and Giulio Cerullo and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2009},
  Number                   = {5},
  Pages                    = {3555--3563},
  Volume                   = {17},
}

@Article{Siegel2007,
  Title                    = {Theoretical and experimental limits of cavity-dumping in passively mode-locked thin-disk oscillators},
  Author                   = {Martin Siegel and Guido Palmer and Andy Steinmann and Matthias Pospiech and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2007},
  Month                    = {Dec},
  Number                   = {25},
  Pages                    = {16860--16869},
  Volume                   = {15},
}

\end{filecontents*}

\newcommand{\numberedreferences}{%
\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{%
        \printfield{prefixnumber}%
        \printfield{labelnumber}.%
        }%
     }%
  {\setlength{\labelwidth}{\labelnumberwidth}%
   \setlength{\leftmargin}{\labelwidth}%
   \setlength{\labelsep}{\biblabelsep}%
   \addtolength{\labelsep}{1em}
   \addtolength{\leftmargin}{\labelsep}%
   \setlength{\itemsep}{\bibitemsep}%
   \setlength{\parsep}{\bibparsep}}%
   % fails to compile if included
   %\renewcommand*{\makelabel}[1]{\hss##1}
  }
  {\endlist}
  {\item}
}%

\section*{Scientific publications}
\begin{refsection}[publications]%
\numberedreferences
\nocite{*}
% supposed to be numbered and with author highlighted (bold)
\printbibliography[heading=none, sorting=ynt]
\end{refsection}

% standard style
\nocite{*}
\printbibliography    

\end{document}

编辑:此代码显示了如果部分内容包含在条件中,下面示例中的代码如何失败:

\documentclass{article}

\usepackage{filecontents}
\usepackage{ltxcmds}
\makeatletter
\newcommand{\IfPackageLoaded}[2]{\ltx@ifpackageloaded{#1}{#2}{}}
\makeatother

\usepackage{biblatex}  
\usepackage{xpatch}

\IfPackageLoaded{biblatex}{%

% \boldnames: etoolbox-list of names to typeset bold in \printbibiliography
\newcommand*{\boldnames}{}

\newbibmacro*{name:bold}[2]{%
  \def\do##1{\ifstrequal{#1, #2}{##1}{\bfseries\listbreak}{}}%
  \dolistloop{\boldnames}}

\xpretobibmacro{name:last-first}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xapptobibmacro{name:last-first}{\endgroup}{}{}

%
\DeclareNameAlias{default}{last-first/first-last}

}% \IfPackageLoaded{biblatex}

\addbibresource{publications.bib}

\begin{document}

\begin{filecontents*}{publications.bib}
@Article{Pospiech2010,
  Title                    = {Single-sweep laser writing of 3D-waveguide devices},
  Author                   = {Matthias Pospiech and Moritz Emons and Benjamin V\"{a}ckenstedt and Guido Palmer and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2010},
  Number                   = {7},
  Pages                    = {6994--7001},
  Volume                   = {18},
}
\end{filecontents*}

\begin{refsection}%
\nocite{*}
\printbibliography[heading=none, sorting=ynt, resetnumbers=true] %env=numbered+bold, 
\end{refsection}

\end{document}

错误是

! Undefined control sequence.
<argument> \blx@do 
                   {Pospiech2009}\blx@listloop@i 

答案1

biblatex包允许对不同的 有独立的编号方案refsections。要获得不同书目中真正独立的编号,您还需要将选项传递resetnumbers=true给每个附加\printbibliography命令(除了defernumbers您已经传递给包的选项之外)。但请注意,您可能需要 3 到 4 次编译运行以确保列表编号正确。

\printbibliography[heading=none, sorting=ynt, resetnumbers=true]

此外,在您的命令中,以下代码无法编译:

   % fails to compile if included
   \renewcommand*{\makelabel}[1]{\hss##1}

原因是您\defbibenvironment在定义中包含了(定义环境)\newcommand。因此,##1传入的参数\renewcommand不是传递给的参数\defbibenvironment(应该如此),而是传递给的(不存在的)参数\newcommand

幸运的是,您不需要创建新命令来应用新的书目样式,您只需创建一个新的书目环境并将其传递给\printbibliography

\DeclareFieldFormat{labelnumberwidth}{#1\adddot}
\newlength{\periodwidth}
\settowidth{\periodwidth}{.}

\defbibenvironment{numbered+bold}
  {\list
     {\printtext[labelnumberwidth]{%
        \printfield{prefixnumber}%
        \printfield{labelnumber}%
        }%
     }%
  {
   \setlength{\labelwidth}{\labelnumberwidth}%
   \setlength{\leftmargin}{\labelwidth}%
   \setlength{\labelsep}{\biblabelsep}%
   \addtolength{\labelsep}{1em}
   \addtolength{\leftmargin}{\labelsep}%
   \setlength{\itemsep}{\bibitemsep}%
   \setlength{\parsep}{\bibparsep}}%
   \renewcommand*{\makelabel}[1]{\hss##1}%
  }
  {\endlist}
  {\item\hskip-\periodwidth}

一旦定义,就可以像这样使用:

\printbibliography[env=numbered+bold, heading=none, sorting=ynt, resetnumbers=true]

请注意,我还更正了作者列表的缩进。作者前面的额外空格是由于从样式更改为文档中间样式而造成的。据我所知,这不被鼓励也不被支持alphabetic,而且似乎即使您可以成功将参考书目更改为使用数字标签,样式的一些副作用仍然存在。我无法跟踪这个额外空格被添加到哪里,但一个可能的解决方法是添加一个负水平空格,其长度等于正在使用的句点字符的长度。numericbiblatexalphabetic

将特定作者姓名加粗已包含在丹尼尔。但请注意,这与我们创建的新环境无关\forcsvlist{\listadd\boldnames}{{Pospiech, Matthias}, {Pospiech, M.}}。如果您在调用最后一个之前再次用 填充列表printbibliography,它还会以粗体标记该书目的作者。

完整代码:

\documentclass{article}

\usepackage{filecontents}

\usepackage[
  style=alphabetic, % Loads the bibliography and the citation style 
  backend=biber,
  defernumbers=true
]{biblatex}  

\ExecuteBibliographyOptions{%
  sorting=nty, % Sort by name, title, year.
  maxbibnames=15,%
}%      

\addbibresource{publications.bib}

% Emphasize own name in References with boldface
\usepackage{xpatch}

% \boldnames: etoolbox-list of names to typeset bold in \printbibiliography
\newcommand*{\boldnames}{}

\newbibmacro*{name:bold}[2]{%
  \def\do##1{\ifstrequal{#1, #2}{##1}{\bfseries\listbreak}{}}%
  \dolistloop{\boldnames}}


\xpretobibmacro{name:last}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:first-last}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:last-first}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:delim}{\begingroup\normalfont}{}{}
\xapptobibmacro{name:last}{\endgroup}{}{}
\xapptobibmacro{name:first-last}{\endgroup}{}{}
\xapptobibmacro{name:last-first}{\endgroup}{}{}
\xapptobibmacro{name:delim}{\endgroup}{}{}

\DeclareNameAlias{default}{last-first/first-last}


\begin{document}

\begin{filecontents*}{publications.bib}
@Article{Pospiech2010,
  Title                    = {Single-sweep laser writing of 3D-waveguide devices},
  Author                   = {Matthias Pospiech and Moritz Emons and Benjamin V\"{a}ckenstedt and Guido Palmer and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2010},
  Number                   = {7},
  Pages                    = {6994--7001},
  Volume                   = {18},
}

@Article{Pospiech2009,
  Title                    = {Double waveguide couplers produced by simultaneous femtosecond writing},
  Author                   = {Matthias Pospiech and Moritz Emons and Andy Steinmann and Guido Palmer and Roberto Osellame and Nicola Bellini and Giulio Cerullo and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2009},
  Number                   = {5},
  Pages                    = {3555--3563},
  Volume                   = {17},
}

@Article{Siegel2007,
  Title                    = {Theoretical and experimental limits of cavity-dumping in passively mode-locked thin-disk oscillators},
  Author                   = {Martin Siegel and Guido Palmer and Andy Steinmann and Matthias Pospiech and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2007},
  Month                    = {Dec},
  Number                   = {25},
  Pages                    = {16860--16869},
  Volume                   = {15},
}

\end{filecontents*}

\DeclareFieldFormat{labelnumberwidth}{#1\adddot}
\newlength{\periodwidth}
\settowidth{\periodwidth}{.}

\defbibenvironment{numbered+bold}
  {\list
     {\printtext[labelnumberwidth]{%
        \printfield{prefixnumber}%
        \printfield{labelnumber}%
        }%
     }%
  {
   \setlength{\labelwidth}{\labelnumberwidth}%
   \setlength{\leftmargin}{\labelwidth}%
   \setlength{\labelsep}{\biblabelsep}%
   \addtolength{\labelsep}{1em}
   \addtolength{\leftmargin}{\labelsep}%
   \setlength{\itemsep}{\bibitemsep}%
   \setlength{\parsep}{\bibparsep}}%
   \renewcommand*{\makelabel}[1]{\hss##1}%
  }
  {\endlist}
  {\item\hskip-\periodwidth}

\section*{Scientific publications}
\begin{refsection}[publications]%

\nocite{*}
% supposed to be numbered and with author highlighted (bold)
\forcsvlist{\listadd\boldnames}{{Pospiech, Matthias}, {Pospiech, M.}}
\printbibliography[env=numbered+bold, heading=none, sorting=ynt, resetnumbers=true]
\end{refsection}

% standard style
\nocite{*}
\printbibliography    

\end{document}

编辑:我还添加了结果参考书目的屏幕截图:

射击

答案2

下面提供了一个解决方案大胆的作者以及计数问题。

实现粗体作者功能的大部分代码均来自此站点;但是,我目前无法找到原始出处以予以认可 :-(


编辑:粗体作者代码最初由用户提供奥德丽在他的回答中使用 biblatex 将特定作者设为粗体


解决您的编号问题的方法是科学出版物部分只是用\printfield{labelnumer}自己的计数器替换:

\documentclass{article}

\usepackage{filecontents}

\usepackage[
  style=alphabetic, % Loads the bibliography and the citation style 
  %style=numeric,
]{biblatex}  

\ExecuteBibliographyOptions{%
sorting=nty, % Sort by name, title, year.
maxbibnames=15,%
%defernumbers,
}%      

\addbibresource{publications.bib}
\ExecuteBibliographyOptions{labelnumber}


% Emphasize own name in References with boldface
\usepackage{xpatch}% or use https://tex.stackexchange.com/a/40705

% \boldnames: etoolbox-list of names to typeset bold in \printbibiliography
\newcommand*{\boldnames}{}

\newbibmacro*{name:bold}[2]{%
  \def\do##1{\ifstrequal{#1, #2}{##1}{\bfseries\listbreak}{}}%
  \dolistloop{\boldnames}}


\xpretobibmacro{name:last}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:first-last}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:last-first}{\begingroup\usebibmacro{name:bold}{#1}{#2}}{}{}
\xpretobibmacro{name:delim}{\begingroup\normalfont}{}{}
\xapptobibmacro{name:last}{\endgroup}{}{}
\xapptobibmacro{name:first-last}{\endgroup}{}{}
\xapptobibmacro{name:last-first}{\endgroup}{}{}
\xapptobibmacro{name:delim}{\endgroup}{}{}

\DeclareNameAlias{default}{last-first/first-last}




\begin{document}

\begin{filecontents*}{publications.bib}
@Article{Pospiech2010,
  Title                    = {Single-sweep laser writing of 3D-waveguide devices},
  Author                   = {Matthias Pospiech and Moritz Emons and Benjamin V\"{a}ckenstedt and Guido Palmer and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2010},
  Number                   = {7},
  Pages                    = {6994--7001},
  Volume                   = {18},
}

@Article{Pospiech2009,
  Title                    = {Double waveguide couplers produced by simultaneous femtosecond writing},
  Author                   = {Matthias Pospiech and Moritz Emons and Andy Steinmann and Guido Palmer and Roberto Osellame and Nicola Bellini and Giulio Cerullo and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2009},
  Number                   = {5},
  Pages                    = {3555--3563},
  Volume                   = {17},
}

@Article{Siegel2007,
  Title                    = {Theoretical and experimental limits of cavity-dumping in passively mode-locked thin-disk oscillators},
  Author                   = {Martin Siegel and Guido Palmer and Andy Steinmann and Matthias Pospiech and Uwe Morgner},
  Journal                  = {Opt. Express},
  Year                     = {2007},
  Month                    = {Dec},
  Number                   = {25},
  Pages                    = {16860--16869},
  Volume                   = {15},
}

\end{filecontents*}

\newcommand{\numberedreferences}{%
\newcount\mycount

\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{%
        \global\advance\mycount 1
        \printfield{prefixnumber}%
        \the\mycount.%
        }%
     }%
  {\setlength{\labelwidth}{\labelnumberwidth}%
   \setlength{\leftmargin}{\labelwidth}%
   \setlength{\labelsep}{\biblabelsep}%
   \addtolength{\labelsep}{1em}
   \addtolength{\leftmargin}{\labelsep}%
   \setlength{\itemsep}{\bibitemsep}%
   \setlength{\parsep}{\bibparsep}}%
   % fails to compile if included
   %\renewcommand*{\makelabel}[1]{\hss##1}
  }
  {\endlist}
  {\item}
}%

\section*{Scientific publications}
\begin{refsection}[publications]%
\numberedreferences
\nocite{*}
% supposed to be numbered and with author highlighted (bold)
\forcsvlist{\listadd\boldnames}
  {{Pospiech, Matthias}, {Pospiech, M.}}
\printbibliography[heading=none, sorting=ynt]
\end{refsection}

% standard style
\renewcommand*{\boldnames}{}
\nocite{*}
\printbibliography    

\end{document}

在此处输入图片描述

相关内容