# LaTeX: edit .bst file

I am using the plainyr-rev.bst for a report (standard bibliography, but sorted in reverse order according to the year of publication). This works well, but I would like to alter it a little bit:

instead of:

Author A ..., 1999
Author B ..., 1999
Author C ..., 1995
Author D ..., 1995
Author E ..., 1990


I would like something along the lines of:

1999  Author A ..., 1999
Author B ..., 1999

1995  Author C ..., 1995
Author D ..., 1995

1990  Author E ..., 1990


The idea is to make it easier on the eyes: I have about 200 entries and having year indicators would make it much easier to read around in the bibliography.

I have found a manual workaround: I first generate the .bbl file and then copy & paste these few lines of LaTeX between bibitem entries of different years (this is specific to my page layout):

\item[]
\hskip-\leftmargin
\begin{minipage}{\hintscolumnwidth}
\raggedleft\hintfont{1999} %add right year
\vspace{-1.2cm}
\end{minipage}


I looked at different FUNCTIONS within the .bst file but I have no idea where to add these lines to make it work automatically (i.e. without me copy & pasting in the bbl). Any suggestions?

-

## migrated from stackoverflow.comJun 26 '12 at 16:54

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Jun 26 '12 at 17:22
add comment

## 1 Answer

I think its a bit more complicated than a simple modification, the reason being that the bst file is simply viewing it on an reference by reference basis and doesn't have the knowledge (as is) to insert the per year changes you want.

What you have is different functions (i.e. article, book ...) that create a format string for each reference type. They know the year. The string they create is output by output.bibitem. However, it doesn't know the year.

What you can possibly do is edit each reference type function to store/compare the year of that reference vs a previous reference. And if the year changes do an output (ala output.bibitem) (something like

"\begin{thebibliography}{9}" write\$ newline


(something I've used in my modified bst files). That fits your formatting (as you seem to already know what it should be).

Annoying that you would have to do it every where.

Sorry I couldn't be more help.

-
add comment