[Tex/LaTex] How to modify the abbrvnat bibliography style

bibliographiesbibtexnatbib

I want make my bibliography in which there is comma between author and article name instead of full stop. And also i want to write name of article in inverted commas (as x). Is there any way of writing such type of bibliography

Example:

 G. Agarwal & S. Sindh,"A comparison between public key authority and certification authority for distribution of public key". International Journal of Computer Science and Information Technologies.1(5):332--336,2010.

My bibliography code:

\RequirePackage{filecontents}
 \begin{filecontents}{mybib.bib}
  @article{link:cac,
 title   = {A comparison between public key authority and certification authority for distribution of public key},
 author  = {Agarwal, Gaurav and Singh, Saurabh},
 journal = {International Journal of Computer Science and Information Technologies},
 volume  = {1},
  number  = {5},
  pages   = {332--336},
  year    = {2010}
 }
\end{filecontents}

\documentclass{article}
 \usepackage[numbers]{natbib}
  \bibliographystyle{abbrvnat}

 \begin{document}
        \noindent
        \citet{link:cac}, \cite{link:cac}
        \bibliography{mybib}
        \end{document}

Best Answer

As with most traditional BiBTeX formatting issues, this requires hacking the .bst file itself, but it's not that hard to do. An alternative is to use biblatex.

First locate the original abbrvnat.bst file. You can find the exact path for your system by using kpsewhich abbrvnat.bst from the command line. On a current TeXLive system it is in:

/usr/local/texlive/2017/texmf-dist/bibtex/bst/natbib/abbrvnat.bst

Make a copy of this file, and call it e.g. abbrvnat-quotes.bst. Put this in your local texmf folder: ...texmf/bibtex/bst/ or simply place it in the same folder as your source document if you only need this style for that document.

Now you need to make the following changes to the file:

  1. Add a new function enquote to the file. This should go with the other functions. A simple way is to find the emphasize function and copy it and then make it look like this:

FUNCTION {enquote}
 { duplicate$ empty$
     { pop$ "" }
     { "``" swap$ * "''" * }
   if$
 }

For a more flexible version of the enquote function, you can use the csquotes package. See How to modify a bibliography style to surround titles in quotes in a bibliography? for details on how to do this.

  1. Find the article function (line 699) and make the following modifications: Change the following line:

format.title "title" output.check

to:

format.title enquote "title" output.check
  1. To add a comma after the author name requires more extensive changes, since you need to change the format for every publication type. But the general method is the same. In each publication type you will find the following lines:

author format.key output
new.block

You need to change all of these pairs of lines to:

author format.key output

For more complex items, the simple line author format.key output may not be present. In that case you need to look for the new.block line that is between the author output code (whatever that is) and the title code. For the book type, for example you will find:

author empty$
    { format.editors "author and editor" output.check
      editor format.key output
    }
    { format.authors output.nonnull
      crossref missing$
        { "author and editor" editor either.or.check }
        'skip$
      if$
    }
  if$
  new.block
  format.btitle "title" output.check

In this case you need to remove the new.block line.

Save the file and use \bibliographystyle{abbrvnat-quotes} in your source document.

\RequirePackage{filecontents}
 \begin{filecontents}{mybib.bib}
  @article{link:cac,
 title   = {A comparison between public key authority and certification authority for distribution of public key},
 author  = {Agarwal, Gaurav and Singh, Saurabh},
 journal = {International Journal of Computer Science and Information Technologies},
 volume  = {1},
  number  = {5},
  pages   = {332--336},
  year    = {2010}
 }
\end{filecontents}

\documentclass{article}
\usepackage[numbers]{natbib}
\bibliographystyle{abbrvnat-quotes}

\begin{document}
\noindent
\citet{link:cac}, \cite{link:cac}
\bibliography{mybib}
\end{document}

output of code