alex-ball / bathbib

BibTeX and biblatex styles for the University of Bath's Harvard referencing style
27 stars 5 forks source link

[Help Wanted] Adding Article Numbers #18

Closed AnzhiZhang closed 10 months ago

AnzhiZhang commented 10 months ago

Hi, I am using the Leeds Harvard referencing style. In Leeds Harvard, journal article with article number required a field article no: xxx [no pagination]

Family name, INITIAL(S). Year. Title of article. Journal Title. Volume, article no: article number [no pagination]

I am using Bath Harvard because it's similar to Leeds Harvard, however, Bath Harvard does not have a field for article numbers. I'd really appreciate it if you could provide any help on how to add this to my reference.

alex-ball commented 10 months ago

That's not true, there is support for article numbers (eid field) in both bath-bst and biblatex-bath.

Using BibTEX:

\begin{filecontents*}[overwrite]{\jobname.bib}
@article{chou.etal2014,
  author = {Chou, C.L. and Teherani, A. and Masters, D.E. and Vener, M. and Wamsley, M. and Poncelet, A.},
  year = {2014},
  title = {Workplace learning through peer groups in medical school clerkships},
  journal = {Medical Education Online},
  volume = {19},
  eid = {article no: 25809 [no pagination]},
}
\end{filecontents*}

\documentclass[margin=3mm,varwidth=80ex]{standalone}

\usepackage{natbib}
\setlength{\bibhang}{0pt}
\newcommand*{\urlprefix}{Available from: }
\newcommand*{\urldateprefix}{Accessed }
\bibliographystyle{bathx}

\begin{document}
\cite{chou.etal2014}
\bibliography{\jobname}
\end{document}

mwe1

Using biblatex:

\begin{filecontents*}[overwrite]{\jobname.bib}
@article{chou.etal2014,
  author = {Chou, C.L. and Teherani, A. and Masters, D.E. and Vener, M. and Wamsley, M. and Poncelet, A.},
  date = {2014},
  title = {Workplace learning through peer groups in medical school clerkships},
  journaltitle = {Medical Education Online},
  volume = {19},
  eid = {25809},
}
\end{filecontents*}

\documentclass[margin=3mm,varwidth=80ex]{standalone}

\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[style=bath]{biblatex}
\DeclareFieldFormat[article]{volume}{\textbf{#1}}
\DeclareFieldFormat[article]{eid}{article no:\addspace#1\addspace[no pagination]}
% biblatex-bath loads xpatch
\xpatchbibmacro{journal+issuetitle}{%
  \usebibmacro{isonline}\setunit*{\addcomma\space}%
}{%
  \usebibmacro{isonline}\setunit*{\addperiod\space}%
}{}{}
\addbibresource{\jobname.bib}

\begin{document}
\cite{chou.etal2014}
\printbibliography
\end{document}

mwe2

AnzhiZhang commented 10 months ago

Thanks! I'd like to know that is there any different between \adddot and \addperiod in patching journal+issuetitle?

alex-ball commented 10 months ago

Sorry, yes, you are absolutely right, the correct command to use is \addperiod (now amended in previous comment). The \addperiod command is for full stops between blocks, \adddot is for marking abbreviations. The two have different interactions with other punctuation, and may trigger slightly different spacing (unless \frenchspacing is active).