Skip to content

Instantly share code, notes, and snippets.

@moewew
Created August 11, 2020 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moewew/6e8bea4dc411155d5017972ac714c4db to your computer and use it in GitHub Desktop.
Save moewew/6e8bea4dc411155d5017972ac714c4db to your computer and use it in GitHub Desktop.
\documentclass{article}
\usepackage%
[backend=biber,%
style=publist]%
{biblatex}
\plauthorname[Giskard]{Reventlov}
\makeatletter
\renewbibmacro{bpl:handlenames}[1][author]{%
\bpl@ifplauthor{\namepartgiven}{\namepartprefix}{\namepartfamily}%
{\global\toggletrue{isplauthor}\stepcounter{pl#1}}%
{\global\togglefalse{isplauthor}}%
%
% Calculate real list stop
\ifnumless{\value{liststop}}{\value{maxnames}}
{\setcounter{realliststop}{\theliststop}}
{\setcounter{realliststop}{\value{minnames}}}%
%
% First case: plauthorhandling=highlight
\if@hlauthor%
% Highlight plauthor(s)
\usebibmacro{bpl:omissiondelim}[#1]%
\iftoggle{isplauthor}{%
\plauthorhl{%
\if@givenfirst% given name first
\ifgiveninits
{\ifdefvoid{\namepartgiveni}{}{\namepartgiveni\addspace}}%
{\ifdefvoid{\namepartgiven}{}{\namepartgiven\addspace}}%
\ifdefvoid{\namepartprefix}%
{}%
{\namepartprefix\addspace}%
\namepartfamily%
\else% family name first
\ifdefvoid{\namepartprefix}%
{}%
{\namepartprefix\addspace}%
\namepartfamily%
\ifgiveninits
{\ifdefvoid{\namepartgiveni}{}{\addcomma\addspace\namepartgiveni\addspace}}%
{\ifdefvoid{\namepartgiven}{}{\addcomma\addspace\namepartgiven\isdot\addspace}}%
\fi
}%
\ifnumequal{\value{listcount}}{\value{liststop}}{}{\usebibmacro{name:andothers}}%
}{%
\ifnumgreater{\value{listcount}}{\value{realliststop}}{}{%
\if@givenfirst% given name first
\ifgiveninits
{\ifdefvoid{\namepartgiveni}{}{\namepartgiveni\addspace}}%
{\ifdefvoid{\namepartgiven}{}{\namepartgiven\addspace}}%
\ifdefvoid{\namepartprefix}%
{}%
{\namepartprefix\addspace}%
\namepartfamily%
\else% family name first
\ifdefvoid{\namepartprefix}%
{}%
{\namepartprefix\addspace}%
\namepartfamily%
\ifgiveninits
{\ifdefvoid{\namepartgiveni}{}{\addcomma\addspace\namepartgiveni\addspace}}%
{\ifdefvoid{\namepartgiven}{}{\addcomma\addspace\namepartgiven\isdot\addspace}}%
\fi
}%
\usebibmacro{name:andothers}%
}%
%
% Second case: plauthorhandling=omit
\else% \if@hlauthor false
\ifthenelse{\value{listcount}=1}%
{\ifthenelse{\value{nonpl#1s}>0}%
{\ifthenelse{\value{pl#1s}=0}
{}
{\bibopenparen\bibstring{with}\addspace}}%
{}%
\iftoggle{isplauthor}%
{\global\toggletrue{plauthorprecedes}}%
{\global\togglefalse{plauthorprecedes}}%
}%
{}%
% Exclude omitted author
\iftoggle{isplauthor}%
{% <- TRUE condition
\global\toggletrue{hadplauthor}%
}% <- end TRUE condition
{% <- FALSE condition
\stepcounter{nonpl#1}%
\ifthenelse{\value{listcount}=1}%
{\global\togglefalse{hadplauthor}}%
{%
\iftoggle{plauthorprecedes}%
{}%
{%
\ifnumgreater{\value{listcount}}{\value{realliststop}}{}{%
\ifnumless{\value{nonpl#1}}{\value{nonpl#1s}}%
{\multinamedelim}%
{\printdelim[#1]{bplfinalnamedelim}}%
}%
}%
}%
\ifnumgreater{\value{listcount}}{\value{realliststop}}{}{%
\ifgiveninits
{\ifdefvoid{\namepartgiveni}{}{\namepartgiveni\addspace}}%
{\ifdefvoid{\namepartgiven}{}{\namepartgiven\addspace}}%
\ifdefvoid{\namepartprefix}{}{\namepartprefix\addspace}%
\global\togglefalse{plauthorprecedes}%
\namepartfamily%
}%
}% <- end FALSE condition
%
\usebibmacro{name:andothers}%
\ifthenelse{\value{nonpl#1s}>0\AND\value{listcount}=\value{liststop}}%
{\ifthenelse{\value{pl#1s}=0}
{}
{\unspace\bibcloseparen}}%
{}%
\fi% end of \if@hlauthor else condition
}
\makeatother
\begin{filecontents}{\jobname.bib}
@book{appleby,
author = {Humphrey Appleby},
title = {On the Importance of the Civil Service},
date = {2001},
}
@book{bppleby,
author = {Humphrey Bppleby and Someone Else},
title = {On the Importance of the Civil Service},
date = {2002},
}
@book{cppleby,
author = {Humphrey Cppleby and Someone Else and A. Third Person},
title = {On the Importance of the Civil Service},
date = {2003},
}
@article{reventlov:2,
author = {Giskard Reventlov and Someone Else},
title = {Turtles},
date = {2012},
}
@article{reventlov:1,
author = {Giskard Reventlov},
title = {Turtles},
date = {2011},
}
@article{reventlov:3,
author = {Giskard Reventlov and Ann Uthor and Bann Tuthor},
title = {Turtles},
date = {2013},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
% MY ARTICLES
\printbibliography[title={Published Articles}, type=article]
% COURSES [BOOKS] BY OTHERS
\printbibliography[title={Courses Taken}, type=book]
\end{document}
@moewew
Copy link
Author

moewew commented Aug 11, 2020

Output

publist-with

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment