Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to prevent natbib from replacing a list of author names by a long dash, which is the default behavior for citations with the same authors. Why? Because I'm using \bibentry to place full citations in a CV and actually want the full citation.

I'm using packages bibentry, natbib and the amnatnat.bst style.

First post, sorry for the lack of fancy formatting, links, etc...

UPDATE: Can I modify the following function in amnatnat.bst to prevent the substitution?

FUNCTION {name.or.dash}
{ 's :=
   oldname empty$
     { s 'oldname := s }
     { s oldname =
         { "---{}---{}---" }
         { s 'oldname := s }
       if$
     }
   if$
}
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Unfortunately it cannot be done with amnatnat.bst. When you run bibtex amnatnat.bst replaces the author lists with ---{}---{}--- if the authors list in the entry bibtex is currently processing in the same as the previous one, and the information about the authors (full) names is lost. Thus the only alternative I see is to change the \bibliographystyle.

If you want to keep the dash for repeated authors in the bibliography and using the full citation in the text, a possible solution is to use biblatex and to use the \fullcite{<key>} command instead of \bibentry{<key>.

EDIT

The simplest way to modify the function in amnatnat.bst is to replace definition of the FUNCTION {name.or.dash} with

FUNCTION {name.or.dash}
{ skip$ }

This would produce a "standard" entry wihtout the dash for repeated names (both in the bibliography and in \bibentry.

If one wants to have both the full references with \bibentry{<key>} and the dash in the bibliography the function can be modified as follows:

FUNCTION {name.or.dash}
{ 's :=
   oldname empty$
     { s 'oldname := s }
     { s oldname =
         { "\andash{" oldname * "}" * }
         { s 'oldname := s }
       if$
     }
   if$
}

and then using the following code in the LaTeX source

\usepackage{etoolbox}
\newcommand{\andash}[1]{#1}
\AtBeginEnvironment{thebibliography}{\renewcommand{\andash}[1]{---{}---{}---}}
\AtEndEnvironment{thebibliography}{\renewcommand\andash[1]{#1}}

The following is an MWE illustrating the usage:

\documentclass{article}
\usepackage{natbib}
\usepackage{bibentry}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Article{first,
  author = "Last, First",
  title = "First Title",
  journal = "Journal Name",
  year = 2012
}
@Article{second,
  author = "Last, First",
  title = "Second Title",
  journal = "Journal Name",
  year = 2011
}
@Article{third,
  author = "More, First",
  title = "Third Title",
  journal = "Journal Name",
  year = 2011
}
\end{filecontents}

\usepackage{etoolbox}
\newcommand{\andash}[1]{#1}
\AtBeginEnvironment{thebibliography}{\renewcommand{\andash}[1]{---{}---{}---}}
\AtEndEnvironment{thebibliography}{\renewcommand\andash[1]{#1}}

\begin{document}
Testing normal citations
\cite{first} 
\cite{second}
\cite{third}

\bibliographystyle{amnatnat}
\nobibliography{\jobname}

Testing \verb|\bibentry|

\bibentry{first}

\bibentry{second}


\bibliography{\jobname}

\section*{More Testing}
Testing \verb|\bibentry| again after the bibliography

\bibentry{second}

\bibentry{first}

\end{document}

PS Comment one of the \bibliography, \nobibliography before running bibtex.

share|improve this answer
    
Thanks! What about modifying amnatnat.bst then? See update to my question. –  Ian Sep 12 '12 at 5:04
    
Substituting the definition of name.or.dash as in your first suggestion generates errors when I run bibtex (You can't pop an empty literal stack for entry <key> while executing---line 1658 of file amnatnat.bst Name 1 in "<author-list>" has a comma at the end for entry C<key> while executing---line 1658 of file amnatnat.bst). But the second suggestion works. –  Ian Sep 12 '12 at 17:54
    
@Ian Thanks! Fixed the first solution. –  Guido Sep 12 '12 at 21:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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