0

Problem Description

This question is emanating from the comment provided by @egreg at Replacing "&" with "and" in apalike2 bibliography style alongside natbib package and citations who mentioned that the apalike2 bibliography style is now old. So I am interested in adopting the apalike2 bibliography style alongside the natbib package but this time using biblatex. Remarks: In other words, I wish to have this bibliography style in biblatex as suggested by Professor @egreg. Below is the MWE which is a very nice solution provided by @egreg to my question at Replacing "&" with "and" in apalike2 bibliography style alongside natbib package and citations:

\begin{filecontents*}{\jobname.bib}
@book{hapa:graphenum,
    author =     {F. Harary and E. M. Palmer},
    title =      {Graphical Enumeration},
    publisher =      {Academic Press},
    pages={465--523},
    year =   1973
}
@book{Knuth94:TheTeXbook,
    author =     {Knuth, Donald Ervin},
    title =      {The \TeX book},
    publisher =      {Addison-Wesley Publishing Company},
    pages={465--523},
    year =   1994,
    series =     {Computers \& Typesetting A},
    address =    {Reading, MA},
    titlenote  =        {with illustrations by Duane Bibby}
}
@book{datta2017latex,
    title={LaTeX in 24 Hours: A Practical Guide for Scientific Writing},
    author={Datta, Dilip},
    pages={465--523},
    year={2017},
    publisher={Springer}
}
\end{filecontents*}

\documentclass[12pt,openany]{book}

\usepackage{natbib}

\usepackage{hyperref} \hypersetup{ colorlinks=true, linkcolor=blue, citecolor=red,
urlcolor=yellow, }

\begin{document}

I want this citation \cite{hapa:graphenum} to be \textcolor{red}{Harary and Palmer }\textcolor{black}{(\textcolor{red}{1973})}. I want this citation \cite{Knuth94:TheTeXbook} to be \textcolor{red}{Knuth }\textcolor{black}{(\textcolor{red}{1994})}. This text is quoted from \citep{datta2017latex} should be (\textcolor{red}{Datta\textcolor{black}{,} 2017}).

\nocite{*}

\bibliographystyle{apalike2-and} \bibliography{\jobname}

\end{document}

where the apalike2-and bibliography is simply the apalike2 style modified at the following line numbers:

 297                 { " et~al." * }
    298                 { " \& " * t * }    % changed from " and " for names -- BJR 10/5/89
    299               if$
329                 { " et~al." * }
330                 { " \& " * t * }    % changed from " and " for names -- BJR 10/5/89
331               if$

1018 { " et~al." * } 1019 { " & " * s #2 "{vv~}{ll}" format.name$ * } % " and " -- BJR 10/5/89 1020 if$

What I have tried so far

Following a comment by @Ulrike Fischer, I modified the code though the following issues have arisen (as a result of using biblatex):

  1. The citations are not hyperlinked which is something I do not like, and
  2. The Bibliography generated using biblatex is different from the one generated using natbib alongside apalike2 I have attached the pictures showing my problems (as a result of using biblatex):
    Problem 1 Problem 2
    and what I am expecting to get (from natbib alongside apalike2):
    Desired Output 1 Desired Output 2 Below is my MWE:
\begin{filecontents*}{references.bib}
@book{hapa:graphenum,
    author =     {F. Harary and E. M. Palmer},
    title =      {Graphical Enumeration},
    publisher =      {Academic Press},
    pages={465--523},
    year =   1973
}
@book{Knuth94:TheTeXbook,
    author =     {Knuth, Donald Ervin},
    title =      {The \TeX book},
    publisher =      {Addison-Wesley Publishing Company},
    pages={465--523},
    year =   1994,
    series =     {Computers \& Typesetting A},
    address =    {Reading, MA},
    titlenote  =        {with illustrations by Duane Bibby}
}
@book{datta2017latex,
    title={LaTeX in 24 Hours: A Practical Guide for Scientific Writing},
    author={Datta, Dilip},
    pages={465--523},
    year={2017},
    publisher={Springer}
}
\end{filecontents*}

\documentclass[12pt,openany]{book} \usepackage[ left=2.5cm, right=2.5cm, top=3cm, bottom=3cm, headheight = 3\baselineskip, headsep = 5mm, a4paper ]{geometry} \usepackage[table]{xcolor} \usepackage{graphicx} \newcommand\HRule{\noindent\rule{\linewidth}{1.5pt}} \usepackage{background} \backgroundsetup{contents={}} \usepackage{fancyhdr} \usepackage{hhline} \pagestyle{fancy}

\usepackage{etoolbox} \usepackage{csquotes}

\usepackage[backend=biber, style=apa]{biblatex}

\addbibresource{references.bib}

\usepackage{hyperref} \hypersetup{ colorlinks=true, linkcolor=blue, citecolor=red,
urlcolor=yellow, } \usepackage{showframe} \begin{document}

\chapter*{Acknowledgements}
I want this citation \textcite{hapa:graphenum} to be \textcolor{red}{Harary and Palmer }\textcolor{black}{(\textcolor{red}{1973})}. I want this citation \textcite{Knuth94:TheTeXbook} to be \textcolor{red}{Knuth }\textcolor{black}{(\textcolor{red}{1994})}.This text is quoted from \parencite{datta2017latex} should be (\textcolor{red}{Datta\textcolor{black}{,} 2017}).
\mainmatter
\setcounter{tocdepth}{1}

\chapter{Introduction}

\backmatter

\nocite{*}
\printbibliography

\end{document}

itc
  • 657
  • natbib and biblatex are incompatible. Either use the one or the other. – Ulrike Fischer Aug 08 '22 at 12:20
  • \usepackage[style=apa]{biblatex} and then read the documentation how to load bib files with biblatex. – Ulrike Fischer Aug 08 '22 at 12:27
  • you didn't run biber. – Ulrike Fischer Aug 08 '22 at 14:31
  • I have modified the code again, can you please assist? @Ulrike Fischer – itc Aug 08 '22 at 14:55
  • Please note that "Harvard style" generally just means author-year citations. It is not a well-defined complete style like "APA style" or "Chicago style". A variety of different institutions have defined their flavour of Harvard style. So if you say you need Harvard style citations, you need to be much more specific and explain exactly what you need. – moewe Aug 08 '22 at 15:39
  • If you're broadly happy with the output you get from apalike2 and natbib I would not be too quick to switch to biblatex. Especially if you have very specific requirements that you cannot change and that are already satisfied by your current setup. Many things are easier with biblatex, but it is a pain having to recreate an existing output in each small detail. If you are more flexible in what you can accept, biblatex is a great solution, though. – moewe Aug 08 '22 at 15:46
  • I mean I need the natbib + apalike2 bibliography style be replicated using biblatex. So far I have managed to provide my trial MWE which is under What I have done so far. So I need help modifying the biblatex code to produce an exact output produced by apalike2 and natbib. – itc Aug 08 '22 at 15:48
  • As I said above, it is theoretically possible to replicate the exact output of your apalike2 + natbib combination with biblatex, but it is going to be extremely painful (it is possible to come up with something that looks similar enough, for some reasonably definition of "similar enough", but every single detail will be tricky). So the question is: Do you really need to use biblatex? If you're OK with the output apalike2 gives you (and you seem to be more than that: you insist on it), then I don't really see the appeal of biblatex for your use case. – moewe Aug 08 '22 at 15:51
  • Noted with many thanks @moewe – itc Aug 08 '22 at 15:53
  • So, I will stick to apalike2+natbib – itc Aug 08 '22 at 15:54

1 Answers1

1

Generally speaking, biblatex is usually thought to be more modern and flexible than BibTeX's .bst styles when it comes to style customisations. biblatex also offers a few features that BibTeX cannot offer (full Unicode support, sourcemapping, ...).

But if you already have a BibTeX-based setup that does exactly what you need, it is not always immediately obvious that a switch to biblatex is the best choice. You cannot use existing .bst files with biblatex, so you would have to recreate its output with biblatex. It can be quite painful to recreate every single detail of that style with biblatex - even if biblatex allows you to apply a number of modifications to your style fairly easily.

If you have some leeway in what you are prepared to accept and expect to want to use some of the more advanced features of biblatex that BibTeX does not offer, a switch to biblatex is a great idea. But if you just want exactly the same output you had with BibTeX, the time required to get that right is probably better spent elsewhere.


It would go beyond what a reasonably short answer on this site can provide to recreate apalike2 output with biblatex, so let me just mention a few points.

moewe
  • 175,683