The root question here is how can one print a bibliography only when there are sources to be cited?
BACKGROUND
I'm working on expanding a small package (originally by Jackson Taylor and Becca Funke) that formats a paper according to the MLA 13 standard. (This format is commonly used in literature-based classes.)
The package currently provides basic formatting goodies like (something that looks like) a customized /maketitle
and the proper running header (Last \thepage
). I'm trying to make it a bit more functional/robust. This includes a growing list of features:
- Natural use of
\author
\date
support- Optional title page and abstract
- More robust bibliography handling
- General customization of 'customizable' things, such as "Works Cited" / "References" / etc.
MEATY BACKGROUND
Currently, mla13
will print the bibliography whenever you tell it to. Since this is always at the end of a MLA paper, I've just used the appropriate commands to execute it at \end{document}
. This little bit of automation has caused a problem -- how can the references be intelligently printed? That is, if there are no sources to be cited, it's a little awkward for there to be a blank page called 'Works Cited.'
MEAT
Using biblatex
, is it possible to check and see if any source has been cited within the document? I've taken a look at the job.bbl
file, and it seems that if one could check to see if the string \entry
is not found in the file, this would suffice as a switch. I've checked into the primitives \read
and \readline
, but I honestly don't have much of a clue as to how to apply the information (I don't really understand it all that well, either).
Is the way I described possible, and if so, how? Is there a better way for this to be done?
\printbibliography[category=<category name>,...]
command doesn't print anything if the category is empty and the additional options in...
exclude thecheck
andfilter
keys. Under this approach your question is duplicate of tex.stackexchange.com/q/6967/4483.\printbibliography
at all (eg a new page). If you can give an MWE as an answer, I'll see if it works. (I'll still be trying it on my own time throughout the day though, but I've found that the presumption of 'I'm being dumb' is always a safe one.)