GeneralHarvard Referencing in Latex

LaTeX specific issues not fitting into one of the other forums of this category.
xirokx
Posts: 7
Joined: Fri Mar 11, 2016 7:52 pm

Re: Harvard Referencing in Latex

Post by xirokx »

thanks for taking the time to reply

its not as per my required output?

and the biblography does not show only the intext-citation.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Harvard Referencing in Latex

Post by Johannes_B »

Sorry, i am working on quite a few user issues per day, not only here. Can you elaborate?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
xirokx
Posts: 7
Joined: Fri Mar 11, 2016 7:52 pm

Harvard Referencing in Latex

Post by xirokx »

Thanks for your reply and your support

Its nearly there but not quite

Take a look at both screen shots from which you can notice the differences:

required output: http://i.imgur.com/30PgvEZ.jpg
current output: http://i.imgur.com/wXrglSf.jpg

1) The in-text citation is incorrect as I need parenthesis around the author and date

2) For the biblography
- author surname should appear first followed by author initial for each reference
- otherwise the journal and book is 100% spot on
- for the website I need the word [online] in there and instead of using "visited" can we change it to accessed?

Can someone kindly help resolve these minor imperfections?

Please help

Code: Select all

\documentclass{article}

%\usepackage[style=authoryear,firstinits=true,urldate=long]{}%
\usepackage[backend=bibtex,style=authoryear,giveninits=true,urldate=long]{biblatex}
\bibliography{test}

\begin{document}

\section*{Section}
In this section we reference the book ~\cite{Goldman}, the journal ~\cite{Ennals}, and the website \cite{Kleinman}.

\printbibliography{}

\end{document}
test.bib

Code: Select all

@book{Goldman,
  author = {Alvin Goldman},
  title = {Theory of Human Action},
  publisher = {Princeton University Press},
  year = 2016,
  location = {Princeton},
  }

@article{Ennals,
  author = {Richard Ennals},
  title = {Artificial stupidity},
  journal = {AI \& Soc},
  year = 2016,
  }

@online{Kleinman,
  author = {Zoe Kleinman},
  organization = {BBC News},
  title = {Apple custumer goes to the top for iPhone battery answer},
  date = {2016-03-11},
  urldate = {2016-03-11},
  url = {http://www.bbc.co.uk/news/technology-35782865},
  }
Thank you
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Harvard Referencing in Latex

Post by Johannes_B »

This should be close.

Note that as i am also not that familiar with style writing (and this is what you are asking for, it is not just generating a bibliography) it has taken me at least an hour to get the results that seem to e closer to what you want.

Code: Select all

\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
	@book{Goldman,
		author = {Alvin Goldman},
		title = {Theory of Human Action},
		publisher = {Princeton University Press},
		year = 2016,
		location = {Princeton},
	}

	@article{Ennals,
		author = {Richard Ennals},
		title = {Artificial stupidity},
		journal = {AI \& Soc},
		year = 2016,
	}

	@online{Kleinman,
		author = {Zoe Kleinman},
		organization = {BBC News},
		title = {Apple customer goes to the top for iPhone battery answer},
		date = {2016},
		urldate = {2016-03-11},
		url = {http://www.bbc.co.uk/news/technology-35782865},
	}
\end{filecontents}
\documentclass{article}

%\usepackage[style=authoryear,firstinits=true,urldate=long]{}%
\usepackage[%backend=bibtex,
	style=apa,% requires backend biber
%	giveninits=true,
	autocite=inline,
]{biblatex}
\DeclareLanguageMapping{english}{english-apa}
%\bibliography{test}
\addbibresource{\jobname.bib}
\NewBibliographyString{available}
\DefineBibliographyStrings{english}{
	available={Available at},
}
\renewbibmacro*{url+urldate}{%
	\ifthenelse{\(\iffieldundef{url}\AND\iffieldundef{abstracturl}\AND\iffieldundef{abstractloc}\)\OR\NOT\iffieldundef{doi}}
	{}
	{\ifthenelse{\iffieldundef{abstracturl}\AND\iffieldundef{abstractloc}}
	{}
	{
	\printtext{\bibcpstring{abstract}}\addspace}%
	\printtext{%
	\iffieldequalstr{entrytype}{online}
	{\mkbibbrackets{online}\isdot\addspace}%true
	            {}%false
		\bibstring{available}\addcolon}%
	\setunit{\addspace}%
	\iffieldundef{urlyear}
	{}
	{
		\setunit*{\addcomma\addspace}}%
		\setunit*{\addspace}%
		\printfield{urldescription}%
		\setunit*{\addcolon\addspace}%
		\iffieldundef{url}{}{\printfield{url}\renewcommand*{\finentrypunct}{\relax}
		\printtext[brackets]{Accessed~\printurldate}}%
		\iffieldundef{abstractloc}{}{\printfield{abstractloc}\renewcommand*{\finentrypunct}{\relax}}
		\iffieldundef{abstracturl}{}{\printfield{abstracturl}\renewcommand*{\finentrypunct}{\relax}}}}

\begin{document}

\section*{Section}
In this section we reference the book~\autocite{Goldman}, the journal~\autocite{Ennals}, and the website~\autocite{Kleinman}.

\printbibliography{}

\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply