Background
Bibulous is a drop-in replacement for BibTeX and as such inherits its approach to bibliography and citation typesetting as well as its conceptual limitations. The user-facing workings of BibTeX are explained nicely in Question mark or bold citation key instead of citation number. For your endeavour of formatting the citations individually it is important to understand what BibTeX/Bibulous actually produce.
Standard BibTeX bibliographies
When you run BibTeX or Bibulous that program creates a .bbl
file. That file is then read by LaTeX and typeset at the point in your document where you write \bibliography{...}
. The .bbl
file contains something like
\begin{thebibliography}{2}
\bibitem{elk} Anne Elk: \emph{A Theory on Brontosauruses}. 1972.
\bibitem{appleby} Humphrey Appleby: \emph{On the Importance of the Civil Service}. 1980.
\end{thebibliography}
thebibliography
is essentially a glorified list (enumerate
) environment that numbers its items and creates a label for each entry key that can be referenced with \cite
later. The workings of that mechanism are comparable to \label
-\ref
: TeX writes the label (number) corresponding to each key into the .aux
file, so it can be used right from the start in the next run, see Understanding how references and labels work. \bibitem
supports an optional argument to override the citation number with a custom label, so one could use \bibitem[Elk72]{elk}
to obtain the label "Elk72" in citations instead of "1".
In this scenario the entry data are not known to LaTeX in any useful way. LaTeX just happens upon the data once, but only as text that is typeset at some point. The only thing that is really 'known' and usable when you \cite
an item is its corresponding label.
Note that it would be possible to extract more entry data for more involved use from a .bib
file by different means such as the usebib
package, which essentially reads the .bib
file as a key-value list. usebib
in particular is limited by the fact that name lists are not parsed and every other solution would have to overcome this not insignificant obstacle.
natbib
For most numeric "[1]" and alphabetic "[Elk72]" citation styles this approach is more than sufficient. But for citation styles with author-year labels "(Appleby 1980)" it might be more useful to have LaTeX 'know' the author (Appleby) and year (1980) of an entry separately instead of a fixed label (Appleby 1980). That would allow easier switching between citation formats like "Appleby 1980", "Appleby (1980)", "(Appleby, 1980)". So when you use natbib
(and a few other packages with a similar strategy, I don't even know if natbib
was the first package to implement such a behaviour, but it is probably the most popular) your .bbl
file might contain
\begin{thebibliography}{2}
\bibitem[Elk(1972)]{elk} Anne Elk: \emph{A Theory on Brontosauruses}. 1972.
\bibitem[Appleby(1980)]{appleby} Humphrey Appleby: \emph{On the Importance of the Civil Service}. 1980.
\end{thebibliography}
where the optional argument is used to tell LaTeX that the author of appleby
is "Appleby" and that its year label is "1980". With that information natbib
can now provide a more fine-grained control over citation output.
natbib
understands several slightly different formats to pass the entry data, but all of them just give the author list (possibly a long and a short form) and the year. Additional entry data is not supposed to be passed on.
jurabib
The package jurabib
takes this one step further and provides much more entry data in the optional argument for use in the document
\begin{thebibliography}{}
\backrefparscanfalse
\bibitem[{Appleby\jbdy {1980}}%
{}%
{{0}{}{book}{1980}{}{}{}{}%
{1980}}%
{{On the Importance of the Civil Service}%
{}{}{2}{}{}{}{}{}}%
]{appleby}
\jbbibargs {\bibnf {Appleby} {Humphrey} {H.} {} {}} {Humphrey Appleby} {au}
{sexless} {\bibtfont {On the Importance of the Civil Service}\bibatsep {}
\apyformat {1980}} {\bibhowcited} \jbdoitem {{Appleby}{Humphrey}{H.}{}{}} {}
{} \bibAnnoteFile {appleby}
\end{thebibliography}
Again, that data is passed on through the .aux
file and is available from the beginning of the document in the next run. That means that jurabib
's citation commands can afford a great bit of freedom and variety in the output, they can even change their format on the fly.
biblatex
I believe that the completely different approach biblatex
takes to bibliographies is inspired by jurabib
. But instead of going through the .bbl
file and via the label through the .aux
, biblatex
directly has all entry data in the .bbl
file in a format that is accessible for it. Instead of reading the .bbl
only at the point in the document where your bibliography is to be typeset, biblatex
reads the .bbl
at the beginning of the document. That means that all entry data of all entries is accessible from the start. The entry data of the entry shown above would look like
\refsection{0}
\datalist[entry]{nyt/global//global/global}
\entry{appleby}{book}{}
\name{author}{1}{}{%
{{uniquename=0,uniquepart=base,hash=dd90e644e3018ab2c6a7ffa2a58522d0}{%
family={Appleby},
familyi={A\bibinitperiod},
given={Humphrey},
giveni={H\bibinitperiod},
givenun=0}}%
}
\strng{namehash}{dd90e644e3018ab2c6a7ffa2a58522d0}
\strng{fullhash}{dd90e644e3018ab2c6a7ffa2a58522d0}
\strng{bibnamehash}{dd90e644e3018ab2c6a7ffa2a58522d0}
\strng{authorbibnamehash}{dd90e644e3018ab2c6a7ffa2a58522d0}
\strng{authornamehash}{dd90e644e3018ab2c6a7ffa2a58522d0}
\strng{authorfullhash}{dd90e644e3018ab2c6a7ffa2a58522d0}
\field{sortinit}{A}
\field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
\field{extradatescope}{labelyear}
\field{labeldatesource}{}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{title}{On the Importance of the Civil Service}
\field{year}{1980}
\field{dateera}{ce}
\endentry
\enddatalist
\endrefsection
biblatex
can use all entry data when you \cite
and entry, which makes it possible to create very flexible and complex citation styles in a way that would be extremely tricky with natbib
.
Customised citations with Bibulous
If your customised citations are static, you can in principle use the optional argument of \bibitem
to provide a fixed citation output. This will not work together with natbib
any more because natbib
requires a particular format and only digests author and year information.
In Bibulous the optional argument of \bibitem
can be defined via the SPECIAL-TEMPLATE
citelabel
, so you would have to populate that variable depending on the entry type. As far as I can see, there is currently no easy way to populate SPECIAL-TEMPLATE
s with type-specific values, but that should be possible with VARIABLE
s and a short function written in DEFINITION
s. I believe that https://github.com/nzhagen/bibulous/issues/15 is currently blocking this course of action, so I think that it is currently not possible to obtain type-specific citation formats in Bibulous.
But even if we were able to populate the optional argument of \bibitem
with a citation label, that would still feel cheap to me since you only pass a string with all the data on to LaTeX and not the actual data in a useful format. You would have to do copy what jurabib
does and pass all entry data on to LaTeX in a macro format.
A related request at the Bibulous bug tracker with a similar answer is at https://github.com/nzhagen/bibulous/issues/13.
Customised citations with biblatex
With biblatex
it is possible to produce different citation output for different types.
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear, backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}
\letbibmacro{cite:default}{cite}
\renewbibmacro{cite}{%
\ifbibmacroundef{cite:\strfield{entrytype}}
{\usebibmacro{cite:default}}
{\usebibmacro*{cite:\strfield{entrytype}}}}
\newbibmacro*{cite:article}{%
\iffieldundef{shorthand}
{\printnames{labelname}%
\setunit{\addcomma\space}%
\printfield{journaltitle}%
\setunit{\addcomma\space}%
\usebibmacro{cite:labeldate+extradate}}
{\usebibmacro{cite:shorthand}}}
\begin{document}
\cite{sigfridsson}
\cite{nussbaum}
\printbibliography
\end{document}
natbib
but full blown changes like you have them in mind were not intended to be made that way. It is probably possible to hack something together, but it won't be pretty and might break.biblatex
would be better at that sort of thing because it has access to all the entry data in the bibliography and citations.