0

I am trying to figure out how to make a custom citation style, using a custom bibliography style that I have made (derived from JHEP.bst). Specifically, I would like to change it so that when I write \cite{MyRef} in my .tex file, I get an output of the form authour,journal,year rather than an output of the form [n], where n is some integer.

What I don't understand is where the citation style is actually defined. I reckon it should be specified in my .bst file, but I don't understand where. The modifications I have made to JHEP.bst are quite modest. The original file can be found here.

I am aware that there have previously been questions asked about custom citation styles in BibTeX. However, the answers to those questions (as far as I can tell), have just made suggestions about suitable existing styles to do the job, using BibLaTeX instead etc. I am looking for advice about how to do this for my existing .bst file in BibTeX.

2

In the bst file that you reference the \bibitem is written by

FUNCTION {output.bibitem}
{ newline$
  "\bibitem{" write$
  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}

which will produce \bibitem{foo99} for an entry with internal key foo99 You want to construct an optional argument of the form

\bibitem[Smith and Jones, Journal of  Zzzz, 1864]{foo99}

which you could do but it would be a fairly major re-write of the style, as you would have to conditionally construct such a string depending on the entry type and which fields were present. It would almost certainly be easier to use makebst to generate an author-date style BST file that does this and then make minor tweaks to the styling, than to make this major structural change by hand to the existing bst file.

7
  • Alright, thanks!
    – user50733
    Jun 12 '20 at 12:24
  • +1. "It would almost certainly be easier to use makebst to generate ..." -- the understatement of the year! :-)
    – Mico
    Jun 12 '20 at 13:40
  • I have not tested the makebst solution yet, since I wanted to experiment a bit on my own. I was wondering if you could clarify the relationship between how the bibitem is written and how \cite{MyRef} is rendered. If the bibitem has the form \bibitem[Foo]{bar}, should \cite{bar} be rendered as Foo? This doesn't seem to work for me. To clarify, I am referring to how \cite{MyRef} shows up in the text, and not in the bibliography.
    – user50733
    Jun 12 '20 at 14:00
  • 1
    @user50733 by default the optional argument to \bibitem is used as the item label in the bibliography list and as the text for \cite but there are dozens of citation packages that change things so it all depends.... natbib based packages for example place structured information into that argument (using natbib compatible bst files) which means that they can provide variant forms, cite citet etc that show different variants. Jun 12 '20 at 14:03
  • 1
    @user50733 they are separate things, the [] in bibitem are optional arguments but the default rendering for \cite puts the text in typeset [] whether or not the cite text is provided by an optional argument, just as with no optional argument the default is 3 (or whatever) so then \cite makes [3] Jun 12 '20 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.