2

I have the following MWE with my custom bibliography, but I find myself with many talks with the same title (and author) that I want to group together... I guess I would need to use \iffieldundef and/or \iffieldsequal... this is my best attempt (commenting repeated title and author fields in my bib file):

\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}

Which produces the following:

enter image description here

I would like to remove the \newblocks between TALKS/POSTERS, including a hyphen before them... Anybody? Thanks!

EDIT

commenting repeated titles and using \iffieldundef I produced the following 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}

Which produces this:

enter image description here

Which is more or less what I want, but now I face the problem of INDENTATIONS!! How can I get the new TALK/POSTER lines to have the same indentation as the first one?? One weird thing I noticed is that if I remove the % after

 \newbibmacro*{newtitle}{

or

 \DeclareBibliographyDriver{misc}{

the indentation changes... WHY IS THAT?? However, I never get to have the same indentation with the new lines as with the first line... Besides, the space between TALKS/POSTERS should also be the same as the space between the author and the first TALK...

Thanks again!

DaniCee
  • 2,217
  • Please check the new edit... I almost got what I wanted, but now I have an indentation problem... Thanks! – DaniCee Sep 16 '14 at 16:01
  • For the % see What is the use of percent signs (%) at the end of lines?, in short: you should have a % at the end of a line in biblatex, if it does not end in a macro call without arguments. Taking that into account you're missing quite a lot of those: after \usebibmacro{newtitle}, \hspace{1px}, (\printfield{month} \printfield{year}) etc. pp. While the ones after \par and \newblock aren't needed. – moewe Sep 16 '14 at 16:21
  • Thanks @moewe, I'll keep that in mind! Any clue on why the vertical space between "type" lines and the indentation is not the same? – DaniCee Sep 16 '14 at 16:36

2 Answers2

1

Maybe it is not the most elegant solution, as it requires to comment title fields of bibliography entries, and adjust manually the indent with hspace... besides, I cannot manage to have a bigger space after the last entry in a group. But here is a 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}

Which produces:

enter image description here

DaniCee
  • 2,217
1

You can sorting the bibliography entries using title - author - date fields. In this way, equal titles will be treated one after another and you can save the first title (\savefield) and compare with the others. If equals, no titles will be printed, if different will be printed.

The same logic is applied to author field, but in second priority and using \savename.

Below a MWE using your bibtex entries that have the same author name.

    \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}

entries with same title and same author name too

Below a MWE with more bibtex entries that have entries with the same title, but different author.

\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}

enter image description here

EDIT

It was changed the 'Variability' author name to 'Moe' and fixed the point '2' in the @DaniCee comment. For this was added undef\lasttitle every time that is printed a new title. To fix the problem with the entries order was changed the sorting to 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}

enter image description here

  • Hi Carlos! Many thanks, it is certainly more cleaner than my first answer... but I have 2 problems with it... First: I still need to print the entries in a reverse chronological order, not alphabetically by title... Second: The author should appear after the title always, even if when it is the same author as the previous entry (change the author of all "Variability" entries to "Moe, John" to see what I mean)... If you could modify these two little things, your answer would be flawless!!! Thanks Carlos! – DaniCee Sep 26 '14 at 00:53
  • Hi @DaniCee! please see my edit. That is what you wanted? – Carlos Lanziano Sep 26 '14 at 02:30