I am using the natbib package with a bibliography style very similar to humannat. I would like to get a long dash instead of the full author name in multiple references where the author is the same. I would be grateful for any suggestions.

Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you.
–
GuidoNov 3 '12 at 23:27

1 Answer
1

The bibliography style file humannat.bst has been around more or less unchanged for at least twenty years. As such, my first inclination is to recommend that you not bother modifying the file. Instead, select a more modern bibliography style file, preferably one that already knows about such "new-fangled" [!] fields such as url and doi. The header information in the file humannat.bst states that it is based on the (by now equally obsolete) apalike bibliography style. Thus, you may want to start your search for a more recent bibliography style with apa.bst and apa6.bst. Just a thought.

If you are, however, committed to using the humannat bibliography style, you could proceed as follows to instruct BibTeX to replace instances of repeated authors (and editors) with long dashes:

Make a copy of humannat.bst and call it, say, myhumannat.bst. Do not edit/overwrite existing files of this nature.

Open the file myhumannat.bst in your favorite text editor and search for the function named article. (It starts on line 586 in my local copy of this file.)

You didn't specify in your question just how long the "dash" should be. I've chosen a length of "three em-dashes" in the function above. If you'd rather have a dash of only one or two em-dashes in length, you are free to modify the function in the obvious manner.

Next, there should be 11 instances of the following two lines of code in humannat.bst (in the functions article, booklet, incollection, inproceedings, manual, mastersthesis, misc, phdthesis, proceedings, techreport, and unpublished, respectively):

author format.key output % special for
output.year.check % apalike

In all of these instances, insert the line

name.or.dash

between these two lines of code.

The functions that need further, special attention are those for entries of type @book and @inbook, because they have to deal with both repeated author(s) and repeated editor(s). To modify the book function, search for the following lines of code:

Give the same search-and-replace treatment to the first few lines of the inbook function. Of course, if you're sure you won't ever have entries of type @inbook in your bib files, you may skip this step.

Save the file myhumannat.bst and update the TeX filename database in a way that's appropriate for your TeX distribution, so that BibTeX can find it when LaTeX encounters the instruction