0

In the following book sample, I'm using the natbib package to generate the bibliography with a specific style as described in this page. However, some reference titles—such as of articles (and other reference types)—are generated without quotes. Therefore, I was wondering how to add quotes around these reference titles—excluding that of books (which should remain italicized without quotes).

I checked the solution of @AlanMunn here, but I would rather—as a Windows user—not to manipulate any external file. Besides, the biblatex solution of @JoeCorneli (2nd answer) did not work in the sense that it did not generate any bibliography section at all.

Thanks for any suggestion you could provide.

\documentclass[12pt]{extbook}

\pagestyle{myheadings}

\usepackage{setspace} \onehalfspacing

\usepackage{hyperref} \hypersetup{hidelinks} \usepackage{pgfornament} \usepackage{lipsum}

\usepackage{natbib}

\title{Book Title}

\author{Author} \date{}

\newcommand\institute{ Department \par \medskip University \par City, State}

\begin{document}

\frontmatter

\begin{titlepage}
    \makeatletter
    \centering
    {\LARGE\bfseries\baselineskip1.25em\@title\par} \par
    \vfill
    {\large\bfseries\@author} \par
    \@date
    \makeatother
    \vfill
    \pgfornament[width=.35\linewidth]{84} \bigskip \par
    \institute
\end{titlepage}

% Empty page
\phantom{}
\pagebreak

% Dedication
\vspace*{\fill}
\begingroup
\centering
\lipsum[1-1]
\endgroup
\vspace*{\fill}

\chapter{Preface}  
\lipsum[2-3]

\tableofcontents
\addcontentsline{toc}{chapter}{Contents}

\chapter{Introduction}
\lipsum[4-6]

\mainmatter

\chapter{Title 1}
\lipsum[5-9]
\citep{Karmarkar:84}

\chapter{Title 2}
\lipsum[10-14]

\backmatter     
\bibliographystyle{abbrvnat}        
\bibliography{references.bib}
\addcontentsline{toc}{chapter}{Bibliography}

\end{document}


EDIT (1)

In light of @AlanMunn comments below, the biblatex solution needs to be compiled with biber, which explains why it did not work for me in the first place. However, the generated reference style is not similar to the desired abbrvnat style here; please see the figure below.

enter image description here


EDIT (2)

In light of @cfr comments below, I'm adding the contents of a separate bibtex file—reference.bib—that includes the reference entries.

@article{Karmarkar:84,
    author = {Karmarkar, Narendra},
    title = {{A New Polynomial-Time Algorithm for Linear Programming}},
    journal = {Combinatorica},
    year = {1984},
    volume = {4},
    number = {4},
    pages = {373-395}
}
AEW
  • 819
  • 1
    If you are sticking to natbib then you are forced to use the kind of solution given in my answer. But it's not "changing a system file", but modifying a copy of a system file. Not the same thing. Furthermore that solution provides you a way to create your own .bst file from scratch using makebst. If you're able to use biblatex then the other solution should work, in which case you need to explain what you mean by "[it] didn't work". – Alan Munn Jul 14 '23 at 22:07
  • @AlanMunn: I'm not using italics and quotation marks at the same time. Book titles should be italicized without quotes, while titles of other reference types should have quotes but not italicized. Thanks. – AEW Jul 14 '23 at 22:16
  • Oh sorry, I misread your question. I'll delete the second comment. :) – Alan Munn Jul 14 '23 at 22:17
  • It's fine. I will add the error message for the biblatex solution. – AEW Jul 14 '23 at 22:20
  • 1
    Remember that if you change to the biblatex solution you should delete all your .aux files, and you need to compile the bibliography with biber not bibtex. If you're using Overleaf, the compilation should be automatic, but if you're using a local distribution you may need to configure your editor to use biber. – Alan Munn Jul 14 '23 at 22:27
  • OK, thank you; that explains why it didn't work in the first place. However, the style is different from natbib's abbrvnat (https://www.overleaf.com/learn/latex/Natbib_bibliography_styles) which is the one that I need to use. – AEW Jul 14 '23 at 22:38
  • I was wondering if there is a solution using natbib other that editing the .bst, since I'm a Windows user with a local distribution. – AEW Jul 14 '23 at 22:42
  • 1
    Well that solution uses apa but if you load biblatex without any style, you'll get something very close to abbrvnat. – Alan Munn Jul 14 '23 at 23:01
  • @AlanMunn: Please see the figure in the new edit. – AEW Jul 14 '23 at 23:32
  • Your example appears to hardcode the bibliography i.e. not to use BibTeX or Biber/Biblatex etc. at all? – cfr Jul 15 '23 at 01:43
  • @cfr: I need natbib style with quotes for titles other than book references. – AEW Jul 15 '23 at 01:47
  • In your example, you hardcode the reference information, you you can just use quotes in place of \emph{}. I assume your real document doesn't hardcode them and you need a different example to illustrate the problem. – cfr Jul 15 '23 at 01:59
  • 1
    Some of the changes you want to apply to the biblatex style are FAQs and straightforward. They can be found at https://tex.stackexchange.com/q/12806/35864 and https://tex.stackexchange.com/q/10682/35864 (don't always take the very first answer you come across, shop around and compare). ... – moewe Jul 15 '23 at 06:17
  • ... If you remove the number presumably you want to cite entries with author-year style in your document. In that case pass style=authoryear, to biblatex as an option. Then the year will be moved to right after the authors and not to the end. That makes sense, because a work is identified by author and year. Having the year at the end of the entry makes it less prominent and thus harder to find. – moewe Jul 15 '23 at 06:18
  • Do note though: If you have to use abbrvnat switching to biblatex is not a good idea. biblatex uses its own style format and cannot use natbib's/BibTeX's styles. While there are generally biblatex styles that look broadly similar to natbib/BibTeX styles, it is extremely painful to modify these styles so that they look exactly the same. biblatex is most efficient if you want to have easy customisation for common things like titles in quotation marks vs italics vs no markup and can live with the other decisions of the style. – moewe Jul 15 '23 at 06:22
  • @cfr: I'm not hardcoding the bibliography. What's inside \begin{thebibliography} ... \end{thebibliography} comes from a .bib file. I should have mentioned that. Sorry for the confusion. Thanks. – AEW Jul 15 '23 at 20:15

0 Answers0