参考书目:将具有相同标题的参考文献分组;如果重复(或为空),则不打印标题字段

参考书目:将具有相同标题的参考文献分组;如果重复(或为空),则不打印标题字段

我的自定义书目中有以下 MWE,但我发现有很多具有相同标题(和作者)的演讲,我想将它们组合在一起...我想我需要使用 \iffieldundef 和/或 \iffieldsequal...这是我最好的尝试(在我的 bib 文件中注释重复的标题和作者字段):

\documentclass{article}

%%%%%%%%%%%%%%%%
% Bibliography %
%%%%%%%%%%%%%%%%

\RequirePackage[style=verbose, maxnames=99, sorting=ydnt, backend=biber]{biblatex}

\DeclareFieldFormat[article]{title}{#1\par}
\DeclareFieldFormat[misc]{title}{#1\par}
\DeclareFieldFormat[thesis]{title}{#1\par}

\DeclareBibliographyDriver{article}{%
  \printfield{title}%
  \newblock%
  \printnames{author}%
  \par%
  \newblock%
  {%
    \usebibmacro{journal+issuetitle}%
    \setunit{\space}%
    \printfield{pages}%
    \newunit%
    \printlist{publisher}%
    %\setunit*{\addcomma\space}%
    %\printfield{year}%included in issuetitle
    \newunit%
  }
  \par\vspace{0.3\baselineskip}
}

\DeclareBibliographyDriver{misc}{%
  \printfield{title}%
  \newblock%
  \printnames{author}%
  \par%
  \newblock%
  {%
    \printfield{type} (\printfield{month} \printfield{year})
    \setunit{\addperiod\space}%
    \printfield{note}%
    \setunit*{\addcomma\space}%
    \printlist{location}%
    \newunit%
  }
  \par\vspace{0.3\baselineskip}
}

\DeclareBibliographyDriver{thesis}{%
  \printfield{title}%
  \newblock%
  \printnames{author}%
  \par%
  \newblock%
  {%
    \printfield{type}
    \setunit{\addperiod\space}%
    \usebibmacro{institution+location+date}%includes year
    \setunit{\addperiod\space}%
    \printfield{url}%
    \newunit%
  }
  \par\vspace{0.3\baselineskip}
}

\DeclareNameFormat{author}{%
  \ifblank{#3}{}{#3\space}#1%
  \ifthenelse{\value{listcount}<\value{liststop}}
    {\addcomma\space}
    {}%
}

\newcommand{\printbibsection}[1]{
  \begin{refsection}
    \nocite{*}
    \printbibliography[sorting=chronological, type={#1}, heading=none]
  \end{refsection}
}

\DeclareSortingScheme{chronological}{
  \sort[direction=descending]{\field{year}}
  \sort[direction=descending]{\field{month}}
  \sort[direction=descending]{\field{day}} %I include the day in entries in the same month and year
}

\begin{filecontents}{\jobname.bib}
@misc{Doe2013b,
location = {This University},
note = {Poster Symposium},
author = {Doe, John},
title = {{Investigating tissue-specificity}},
type = {POSTER},
month = {Sep},
year = {2013}
}
@misc{Doe2014c,
location = {This Other Center},
author = {Doe, John},
title = {{Variability in gene expression}},
type = {TALK},
month = {Sep},
year = {2014}
}
@misc{Doe2014b,
location = {This School},
%author = {Doe, John},
%title = {{Variability in gene expression}},
type = {TALK},
day = 30, %I include the day in entries in the same month and year
month = {Jul},
year = {2014}
}
@misc{Doe2014a,
location = {This Center},
%author = {Doe, John},
%title = {{Variability in gene expression}},
type = {TALK},
day = 23, %I include the day in entries in the same month and year
month = {Jul},
year = {2014}
}
@misc{Doe2014,
location = {This College},
note = {Annual International Symposium},
%author = {Doe, John},
%title = {{Variability in gene expression}},
type = {POSTER},
month = {May},
year = {2014}
}
\end{filecontents}

\addbibresource{\jobname.bib}
\begin{document}

\printbibsection{misc}
\end{document}

其结果如下:

在此处输入图片描述

我想删除 TALKS/POSTERS 之间的 \newblocks,包括它们前面的连字符...有人吗?谢谢!

编辑

评论重复的标题并使用 \iffieldundef 我生成了以下 MWE:

\documentclass{article}

\usepackage{fontawesome}
\newfontfamily{\FA}{FontAwesome}

%%%%%%%%%%%%%%%%
% Bibliography %
%%%%%%%%%%%%%%%%

\RequirePackage[style=verbose, maxnames=99, sorting=ydnt, backend=biber]{biblatex}

\DeclareFieldFormat[misc]{title}{#1\par}

\newbibmacro*{newtitle}{%
  \iffieldundef{title}
  {}
  {\printfield{title}%
  \newblock
  \printnames{author}%
  \par
  \newblock
  }
}

\DeclareBibliographyDriver{misc}{%
  \usebibmacro{newtitle}%
  {%
    \faCaretRight \hspace{1px}%
    \printfield{type} (\printfield{month} \printfield{year})%
    \setunit{\addperiod\space}%
    \printfield{note}%
    \setunit*{\addcomma\space}%
    \printlist{location}%
    \newunit%
  }
  \par\vspace{0.3\baselineskip}
}

\DeclareNameFormat{author}{%
  \ifblank{#3}{}{#3\space}#1%
  \ifthenelse{\value{listcount}<\value{liststop}}
    {\addcomma\space}
    {}%
}

\newcommand{\printbibsection}[1]{
  \begin{refsection}
    \nocite{*}
    \printbibliography[sorting=chronological, type={#1}, heading=none]
  \end{refsection}
}

\DeclareSortingScheme{chronological}{
  \sort[direction=descending]{\field{year}}
  \sort[direction=descending]{\field{month}}
  \sort[direction=descending]{\field{day}} %I include the day in entries in the same month and year
}

\begin{filecontents}{\jobname.bib}
@misc{Doe2013b,
location = {This University},
note = {Poster Symposium},
author = {Doe, John},
title = {{Investigating tissue-specificity}},
type = {POSTER},
month = {Sep},
year = {2013}
}
@misc{Doe2014c,
location = {This Other Center},
author = {Doe, John},
title = {{Variability in gene expression}},
type = {TALK},
month = {Sep},
year = {2014}
}
@misc{Doe2014b,
location = {This School},
author = {Doe, John},
%title = {{Variability in gene expression}},
type = {TALK},
day = 30, %I include the day in entries in the same month and year
month = {Jul},
year = {2014}
}
@misc{Doe2014a,
location = {This Center},
author = {Doe, John},
%title = {{Variability in gene expression}},
type = {TALK},
day = 23, %I include the day in entries in the same month and year
month = {Jul},
year = {2014}
}
@misc{Doe2014,
location = {This College},
note = {Annual International Symposium},
author = {Doe, John},
%title = {{Variability in gene expression}},
type = {POSTER},
month = {May},
year = {2014}
}
\end{filecontents}

\addbibresource{\jobname.bib}
\begin{document}

\printbibsection{misc}
\end{document}

由此产生了如下结果:

在此处输入图片描述

这或多或少是我想要的,但现在我面临缩进的问题!!我怎样才能让新的 TALK/POSTER 行具有与第一行相同的缩进??我注意到一个奇怪的事情是,如果我删除后面的 %

 \newbibmacro*{newtitle}{

或者

 \DeclareBibliographyDriver{misc}{

缩进发生了变化... 这是为什么呢??但是,我从来没有让新行的缩进与第一行的缩进相同... 此外,TALKS/POSTERS 之间的间距也应该与作者和第一个 TALK 之间的间距相同...

再次感谢!

答案1

title您可以使用- author-字段对参考书目条目进行排序 date。这样,相同的标题将被依次处理,您可以保存第一个标题(\savefield)并与其他标题进行比较。如果相等,则不会打印任何标题,如果不同,则会打印标题。

相同的逻辑适用于author字段,但优先级第二并使用\savename

在 MWE 下方使用具有相同作者姓名的 bibtex 条目。

    \documentclass{article}

\RequirePackage[style=verbose, maxnames=99, sorting=ydnt, backend=biber]{biblatex}
%%%%%%%%%%%%%%%%
% Bibliography %
%%%%%%%%%%%%%%%%

\DeclareFieldFormat[misc]{title}{#1\\}


\newbibmacro*{bib:svtitle}{%
  \savefield{title}{\lasttitle}}
  
\newbibmacro*{bib:svauthor}{%
  \savename{author}{\lastauthor}}

\newbibmacro*{verifytitle}{%
    \iffieldequals{title}{\lasttitle}{\hspace{\bibhang}}{%
        \printfield{title}\undef\lastauthor}%
    \usebibmacro{bib:svtitle}%
}

\renewbibmacro*{finentry}{\adddot\finentry}

\newbibmacro*{verifyauthor}{%
    \ifnameequals{author}{\lastauthor}
        {}
        {\printnames{author}\\}%
    \usebibmacro{bib:svauthor}}

\newbibmacro*{newtitle}{%
    \usebibmacro{verifytitle}}

\newbibmacro*{newauthor}{%
    \usebibmacro{verifyauthor}}

\DeclareBibliographyDriver{misc}{%
  \usebibmacro{newtitle}%
  \usebibmacro{newauthor}%
  {%
    \printtext{--\space}\printfield{type} (\printfield{month} \printfield{year})%
    \setunit{\addperiod\space}%
    \printfield{note}%
    \setunit*{\addcomma\space}%
    \printlist{location}%
  }
  \usebibmacro{finentry}%
}

\DeclareSortingScheme{chronological}{
  \sort{\field{title}}
  \sort{\name{author}}
  \sort[direction=descending]{\field{year}}
  \sort[direction=descending]{\field{month}}
  \sort[direction=descending]{\field{day}} 
}

\newcommand{\printbibsection}[1]{
  \begin{refsection}
    \nocite{*}
    \printbibliography[sorting=chronological, type={#1}, heading=none]
  \end{refsection}
}


\begin{filecontents}{\jobname.bib}
@misc{Doe2013b,
location = {This University},
note = {Poster Symposium},
author = {Doe, John},
title = {{Investigating tissue-specificity}},
type = {POSTER},
month = {Sep},
year = {2013}
}
@misc{Doe2014c,
location = {This Other Center},
author = {Doe, John},
title = {{Variability in gene expression}},
type = {TALK},
month = {Sep},
year = {2014}
}
@misc{Doe2014b,
location = {This School},
author = {Doe, John},
title = {{Variability in gene expression}},
type = {TALK},
day = 30, %I include the day in entries in the same month and year
month = {Jul},
year = {2014}
}
@misc{Doe2014a,
location = {This Center},
author = {Doe, John},
title = {{Variability in gene expression}},
type = {TALK},
day = 23, %I include the day in entries in the same month and year
month = {Jul},
year = {2014}
}
@misc{Doe2014,
location = {This College},
note = {Annual International Symposium},
author = {Doe, John},
title = {{Variability in gene expression}},
type = {POSTER},
month = {May},
year = {2014}
}
\end{filecontents}

\addbibresource{\jobname.bib}
\begin{document}
    \printbibsection{misc}
\end{document}

具有相同标题和相同作者姓名的条目

下面是具有更多 bibtex 条目的 MWE,这些条目具有相同的标题,但不同的作者。

\documentclass{article}

\RequirePackage[style=verbose, maxnames=99, sorting=ydnt, backend=biber]{biblatex}
%%%%%%%%%%%%%%%%
% Bibliography %
%%%%%%%%%%%%%%%%

\DeclareFieldFormat[misc]{title}{#1\\}
\DeclareFieldFormat[misc]{type}{#1}


\newbibmacro*{bib:svtitle}{%
  \savefield{title}{\lasttitle}}
  
\newbibmacro*{bib:svauthor}{%
  \savename{author}{\lastauthor}}

\newbibmacro*{verifytitle}{%
    \iffieldequals{title}{\lasttitle}{\hspace{\bibhang}}{%
        \printfield{title}}%
    \usebibmacro{bib:svtitle}%
}

\renewbibmacro*{finentry}{\adddot\finentry}

\newbibmacro*{verifyauthor}{%
    \ifnameequals{author}{\lastauthor}
        {}
        {\printnames{author}\\}%
    \usebibmacro{bib:svauthor}}

\newbibmacro*{newtitle}{%
    \usebibmacro{verifytitle}}

\newbibmacro*{newauthor}{%
    \usebibmacro{verifyauthor}}

\DeclareBibliographyDriver{misc}{%
  \usebibmacro{newtitle}%
  \usebibmacro{newauthor}%
  {%
    \printtext{--\space}\printfield{type} (\printfield{month} \printfield{year})%
    \setunit{\addperiod\space}%
    \printfield{note}%
    \setunit*{\addcomma\space}%
    \printlist{location}%
  }
  \usebibmacro{finentry}%
}

\DeclareSortingScheme{chronological}{
  \sort{\field{title}}
  \sort{\name{author}}
  \sort[direction=descending]{\field{year}}
  \sort[direction=descending]{\field{month}}
  \sort[direction=descending]{\field{day}} 
}

\newcommand{\printbibsection}[1]{
  \begin{refsection}
    \nocite{*}
    \printbibliography[sorting=chronological, type={#1}, heading=none]
  \end{refsection}
}


\begin{filecontents}{\jobname.bib}
@misc{Doe2013,
location = {This University},
note = {Poster Symposium},
author = {Doe, John First},
title = {{Investigating tissue-specificity}},
type = {POSTER},
month = {Sep},
year = {2013}
}
@misc{Doe2014a,
location = {This Other Center},
author = {Doe, John Second},
title = {{Variability in gene expression}},
type = {TALK},
month = {Sep},
year = {2014}
}
@misc{Doe2014b,
location = {This School},
author = {Moe, John},
title = {{Variability in gene expression}},
type = {TALK},
day = 30, %I include the day in entries in the same month and year
month = {Jul},
year = {2014}
}

@misc{Doe2014c,
location = {This School},
author = {Moe, John},
title = {{Variability in gene expression}},
type = {TALK},
day = 30, %I include the day in entries in the same month and year
month = {Jul},
year = {2014}
}

@misc{Moe2014d,
location = {This School},
author = {Moe, John},
title = {{Other title in gene expression}},
type = {TALK},
day = 30, %I include the day in entries in the same month and year
month = {Jul},
year = {2014}
}

@misc{Doe2014e,
location = {This Center},
author = {Doe, John},
title = {{Variability in gene expression}},
type = {TALK},
day = 23, %I include the day in entries in the same month and year
month = {Jul},
year = {2014}
}
@misc{Doe2014f,
location = {This College},
note = {Annual International Symposium},
author = {Doe, John},
title = {{Other title in gene expression}},
type = {POSTER},
month = {May},
year = {2014}
}
\end{filecontents}

\addbibresource{\jobname.bib}
\begin{document}
    \printbibsection{misc}
\end{document}

在此处输入图片描述

编辑

将“Variability”改为author name“Moe”,并修复了@DaniCee 评论中的点“2”。为此,undef\lasttitle每次打印时都会添加一个新的title。为了修复条目的问题,order将排序更改为year- month- title- day

\documentclass{article}

\RequirePackage[style=verbose, maxnames=99, sorting=ydnt, backend=biber]{biblatex}
%%%%%%%%%%%%%%%%
% Bibliography %
%%%%%%%%%%%%%%%%

\DeclareFieldFormat[misc]{title}{#1\\}
\DeclareFieldFormat[misc]{type}{#1}


\newbibmacro*{bib:svtitle}{%
  \savefield{title}{\lasttitle}}

\newbibmacro*{bib:svauthor}{%
  \savename{author}{\lastauthor}}
  

\newbibmacro*{verifytitle}{%
    \iffieldequals{title}{\lasttitle}{\hspace{\bibhang}}{%
        \printfield{title}%
        \undef\lastauthor}%
    \usebibmacro{bib:svtitle}%
}

\renewbibmacro*{finentry}{\adddot\finentry}

\newbibmacro*{verifyauthor}{%
    \ifnameequals{author}{\lastauthor}
        {}
        {\printnames{author}\\}%
    \usebibmacro{bib:svauthor}}

\newbibmacro*{newtitle}{%
    \usebibmacro{verifytitle}}

\newbibmacro*{newauthor}{%
    \usebibmacro{verifyauthor}}

\DeclareBibliographyDriver{misc}{%
  \usebibmacro{newtitle}%
  \usebibmacro{newauthor}%
  {%
    \printtext{--\space}\printfield{type} (\printfield{month} \printfield{year})%
    \setunit{\addperiod\space}%
    \printfield{note}%
    \setunit*{\addcomma\space}%
    \printlist{location}%
  }
  \usebibmacro{finentry}%
}

\DeclareSortingScheme{chronological}{
  \sort[direction=descending]{\field{year}}
  \sort[direction=descending]{\field{month}}
  \sort{\field{title}}
  \sort[direction=descending]{\field{day}} 
}

\newcommand{\printbibsection}[1]{
  \begin{refsection}
    \nocite{*}
    \printbibliography[sorting=chronological, type={#1}, heading=none]
  \end{refsection}
}


\begin{filecontents}{\jobname.bib}
@misc{Doe2013,
location = {This University},
note = {Poster Symposium},
author = {Doe, John First},
title = {{Investigating tissue-specificity}},
type = {POSTER},
month = {Sep},
year = {2013}
}
@misc{Doe2014a,
location = {This Other Center},
author = {Moe, John Second},
title = {{Variability in gene expression}},
type = {TALK},
month = {Sep},
year = {2014}
}
@misc{Doe2014b,
location = {This School},
author = {Moe, John},
title = {{Variability in gene expression}},
type = {TALK},
day = 30, %I include the day in entries in the same month and year
month = {apr},
year = {2014}
}

@misc{Doe2014c,
location = {This School},
author = {Moe, John},
title = {{Variability in gene expression}},
type = {TALK},
day = 30, %I include the day in entries in the same month and year
month = {June},
year = {2014}
}

@misc{Moe2014d,
location = {This School},
author = {Moe, John},
title = {{Other title in gene expression}},
type = {TALK},
day = 30, %I include the day in entries in the same month and year
month = {oct},
year = {2012}
}

@misc{Doe2014e,
location = {This Center},
author = {Moe, John},
title = {{Variability in gene expression}},
type = {TALK},
day = 23, %I include the day in entries in the same month and year
month = {Jul},
year = {2014}
}
@misc{Doe2014f,
location = {This College},
note = {Annual International Symposium},
author = {Doe, John},
title = {{Other title in gene expression}},
type = {POSTER},
month = {May},
year = {2014}
}
\end{filecontents}

\addbibresource{\jobname.bib}
\begin{document}
    \printbibsection{misc}
\end{document}

在此处输入图片描述

答案2

也许这不是最优雅的解决方案,因为它需要注释参考书目条目的标题字段,并使用 hspace 手动调整缩进...此外,我无法在组中的最后一个条目后留出更大的空间。但这是一个 MWE:

\documentclass{article}

\usepackage{fontawesome}
\newfontfamily{\FA}{FontAwesome}

%%%%%%%%%%%%%%%%
% Bibliography %
%%%%%%%%%%%%%%%%

\RequirePackage[style=verbose, maxnames=99, sorting=ydnt, backend=biber]{biblatex}

\DeclareFieldFormat[misc]{title}{#1\par}

\newbibmacro*{newtitle}{%
  \iffieldundef{title}
  {\hspace{11.65px}%
  }
  {\printfield{title}%
  \par\vspace{0.1\baselineskip}%
  \newblock
  \printnames{author}%
  \par\vspace{0.1\baselineskip}%
  \newblock
  }
}

\DeclareBibliographyDriver{misc}{%
  \usebibmacro{newtitle}%
  {\scriptsize \faCaretRight}
  {%
    \footnotesize
    \printfield{type} (\printfield{month} \printfield{year})%
    \setunit{\addperiod\space}%
    \printfield{note}%
    \setunit*{\addcomma\space}%
    \printlist{location}%
    \newunit
  }
  \par\vspace{0.1\baselineskip}
}

\DeclareNameFormat{author}{%
  \ifblank{#3}{}{#3\space}#1%
  \ifthenelse{\value{listcount}<\value{liststop}}
    {\addcomma\space}
    {}%
}

\newcommand{\printbibsection}[1]{
  \begin{refsection}
    \nocite{*}
    \printbibliography[sorting=chronological, type={#1}, heading=none]
  \end{refsection}
}

\DeclareSortingScheme{chronological}{
  \sort[direction=descending]{\field{year}}
  \sort[direction=descending]{\field{month}}
  \sort[direction=descending]{\field{day}} %I include the day in entries in the same month and year
}

\begin{filecontents}{\jobname.bib}
@misc{Doe2013b,
location = {This University},
note = {Poster Symposium},
author = {Doe, John},
title = {{Investigating tissue-specificity}},
type = {POSTER},
month = {Sep},
year = {2013}
}
@misc{Doe2014c,
location = {This Other Center},
author = {Doe, John},
title = {{Variability in gene expression}},
type = {TALK},
month = {Sep},
year = {2014}
}
@misc{Doe2014b,
location = {This School},
author = {Doe, John},
%title = {{Variability in gene expression}},
type = {TALK},
day = 30, %I include the day in entries in the same month and year
month = {Jul},
year = {2014}
}
@misc{Doe2014a,
location = {This Center},
author = {Doe, John},
%title = {{Variability in gene expression}},
type = {TALK},
day = 23, %I include the day in entries in the same month and year
month = {Jul},
year = {2014}
}
@misc{Doe2014,
location = {This College},
note = {Annual International Symposium},
author = {Doe, John},
%title = {{Variability in gene expression}},
type = {POSTER},
month = {May},
year = {2014}
}
\end{filecontents}

\addbibresource{\jobname.bib}
\begin{document}

\printbibsection{misc}
\end{document}

其结果为:

在此处输入图片描述

相关内容