I'm writing a paper on a very large number of pieces of artwork, and I've been trying to automate the creation of my section headings, but I've run into a roadblock when I try to check if a Biblatex author entry actually exists.
I would like to do something like this:
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\newcommand{\sectiontitle}[1]{\section{%
%check for author field in #1 and include "\citeauthor{#1} - " if it exists%
\citetitle{#1}}}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTWORK{gizapyramid,
title = {Pyramids at Gizeh},
location = {Giza, Egypt},
year = {ca.\@ 2500 BCE}
}
@ARTWORK{bar,
title = {A Bar at the Folies-Berg\`{e}re},
location = {London, England},
year = {1882},
author = {Manet, \'{E}douard}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\sectiontitle{bar}
\sectiontitle{gizapyramid}
\end{document}
To achieve the same result as this:
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTWORK{gizapyramid,
title = {Pyramids at Gizeh},
location = {Giza, Egypt},
year = {ca.\@ 2500 BCE}
}
@ARTWORK{bar,
title = {A Bar at the Folies-Berg\`{e}re},
location = {London, England},
year = {1882},
author = {Manet, \'{E}douard}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\section{\citeauthor{bar} - \citetitle{bar}}
\section{\citetitle{gizapyramid}}
\end{document}
However, I'm not sure how to do the check I want to accomplish this. How can I check if the Biblatex author entry actually exists and implement this into my code?