# format @book and @inbook entries in biblatex

I've just turned to biblatex from bibtex. I am newbie to the biblatex. I am trying to figure out how to use the biblatex to meet my uni's bibliography requirements. My LaTex code is

\documentclass[12pt,a4paper, british]{article}
\usepackage{babel} % Switch to English style quotation mark, remember to add british to document option
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{xpatch}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{hyperref}
\hypersetup{unicode=true}

\usepackage{filecontents}
\begin{filecontents}{test.bib}
@Article{Vanschoenwinkel2016,
author  = {Vanschoenwinkel, Janka and Mendelsohn, Robert and Van Passel,
Steven},
title   = {Do Western and Eastern Europe have the same agricultural climate
response? Taking adaptive capacity into account},
journal = {Global Environmental Change},
year    = {2016},
volume  = {41},
number  = {7},
pages   = {74-87}
}

pages     = {1-18},
title     = {Economic effects of climate change on US agriculture},
publisher = {Cambridge University Press},
year      = {1999},
author    = {Adams, Ricahard M. and Mccarl, Bruce A. and Segerson, Kathleen and Rosenzweig, Cynthia and Bryant, Kelly J and Dixon, Bruce L and Conner, Richard and Evenson, Robert E and OJima, Dennis},
editor    = {Mendelsohn, Robert and Neumann, James E.},
type      = {Book Section},
isbn      = {0521607698},
booktitle = {The Impact of Climate Change on the United States Economy},
}

@Book{Cline2007,
title     = {Global Warming and Agriculture:Impacts Estimates by Contry},
publisher = {Edward},
year      = {2007},
author    = {Cline, William R.},
type      = {Book},
}

@TechReport{Dasgupta2007,
author      = {Dasgupta, Susmita and Laplante, Benoit and Meisner, Craig and Wheeler, David and Yan, Jianping},
title       = {The Impact of Sea Level Rise on Developing Countries: A Comparative Analysis},
institution = {World Bank},
year        = {2007},
type        = {Report},
number      = {World Bank Policy Research Working paper 4136},
}
\end{filecontents}

\usepackage[autostyle]{csquotes}

\usepackage[style=authoryear, giveninits=true,backend=biber, maxcitenames=3,%
maxbibnames=9, sortcites, url=false, backref=false,]{biblatex}

\renewcommand{\labelnamepunct}{\addspace} % Replace dot with comma in reference after Author + Year

\renewbibmacro{in:}{} % Suppress In: in the reference list

%use ":" after year in the intext citation
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}

%format page range of @article and @incollection follow this format: volume(number): page range.

\DeclareFieldFormat[article,incollection]{pages}{#1}

%format volume and number as follow: volume(number)

\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
\printfield{number}%
\printfield{eid}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}

% replace dot “.” by comma “,” after title in biblatex for @article
\xpatchbibdriver{article}
{\usebibmacro{title}%
\newunit}
{\usebibmacro{title}%
{}
{}

\begin{document}
This is cited by @ariticle entry: \parencite{Vanschoenwinkel2016}.
This is cited by @inbook entry: (\cite{Adams1999}).
This is cited by @book entry \cite{Cline2007}.
This is cited by @technicalreport: \parencite{Dasgupta2007}

\printbibliography

\end{document}


and the output is

Now, I want reformat for @inbook and @book with the format as following:

Any suggestion for me with above format?

Secondly, I would like to put the title of @Techreport between single quotes ' '

• Don't use the inbook entry type for papers included in an edited volume. Use the incollection entry type. inbook is typically for use to reference a single chapter of a book by one author or set of authors. For your edited book, you need to change author to editor in the .bib entry. (How else can biblatex know that the name is an editor? :) ) – Alan Munn Jun 17 '18 at 0:00
• Are your other typographic conventions British? (Spelling, other punctuation?) If so, just switch to British and csquates will sort things out. If not, you need to figure out if you're using a suitable ready-made variant and, if not, what kind of hodge-podge your publisher requires. (They sometimes require pretty bizarre mixtures for reasons I've never understood.) – cfr Jun 17 '18 at 1:05
• @cfr: I did configure in the code with option: \documentclass[12pt,a4paper, british]{article}, and use package \usepackage[autostyle]{csquotes} – Vũ Võ Jun 17 '18 at 6:04
• @VũVõ You don't need autostyle. If you have british, then just loading csquotes will get you single quotation marks as primary and Biblatex will use those. Make sure csquotes is loaded before biblatex. – cfr Jun 17 '18 at 14:43

You can use biblatex-ext to move the editors around and simplify some of the code you have already.

\documentclass[12pt,a4paper, british]{article}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[autostyle]{csquotes}

\usepackage[style=ext-authoryear, giveninits=true, uniquename=init, backend=biber, maxcitenames=3,%
maxbibnames=9, sortcites, url=false, isbn=false, backref=false,
articlein=false, innamebeforetitle=true]{biblatex}

\usepackage{xpatch}

\usepackage{hyperref}
\hypersetup{unicode=true}

\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareFieldFormat{translatortype}{\mkbibparens{#1}}

\DeclareFieldFormat[report]{title}{\mkbibquote{#1}}
% replace dot “.” by comma “,” after title in biblatex for @article
\xpatchbibdriver{article}
{\usebibmacro{title}%
\newunit}
{\usebibmacro{title}%
{}
{}

% remove chapter and pages
\xpatchbibdriver{incollection}
{\usebibmacro{chapter+pages}}
{}
{}{}

% add them into the new position
\xpatchbibmacro{incollection:parent}
{\usebibmacro{maintitle+booktitle}%
\newunit\newblock}
{\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\usebibmacro{chapter+pages}}
{}{}

\renewbibmacro*{in:}{%
\printtext[emph]{%
\bibstring{in}\intitlepunct}}

%format volume and number as follow: volume(number)
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}

%format page range of @article and @incollection follow this format: volume(number): page range.
\DeclareFieldFormat[article]{pages}{#1}

%use ":" after year in the intext citation
\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}}

\usepackage{filecontents}
\begin{filecontents}{test.bib}
@Article{Vanschoenwinkel2016,
author  = {Vanschoenwinkel, Janka and Mendelsohn, Robert and Van Passel,
Steven},
title   = {Do Western and Eastern Europe have the same agricultural climate
response? Taking adaptive capacity into account},
journal = {Global Environmental Change},
year    = {2016},
volume  = {41},
number  = {7},
pages   = {74-87}
}

pages     = {1-18},
title     = {Economic effects of climate change on US agriculture},
publisher = {Cambridge University Press},
year      = {1999},
author    = {Adams, Ricahard M. and Mccarl, Bruce A. and Segerson, Kathleen and Rosenzweig, Cynthia and Bryant, Kelly J and Dixon, Bruce L and Conner, Richard and Evenson, Robert E and OJima, Dennis},
editor    = {Mendelsohn, Robert and Neumann, James E.},
type      = {Book Section},
isbn      = {0521607698},
booktitle = {The Impact of Climate Change on the United States Economy},
}

@Book{Cline2007,
title     = {Global Warming and Agriculture: Impacts Estimates by Contry},
publisher = {Edward},
year      = {2007},
author    = {Cline, William R.},
type      = {Book},
}

@TechReport{Dasgupta2007,
author      = {Dasgupta, Susmita and Laplante, Benoit and Meisner, Craig and Wheeler, David and Yan, Jianping},
title       = {The Impact of Sea Level Rise on Developing Countries: A Comparative Analysis},
institution = {World Bank},
year        = {2007},
type        = {Report},
number      = {World Bank Policy Research Working paper 4136},
}
\end{filecontents}
\nocite{westfahl:frontier,westfahl:space}
\begin{document}
This is cited by @article entry: \parencite{Vanschoenwinkel2016}.
This is cited by @inbook entry: \parencite{Adams1999}.
This is cited by @book entry \cite{Cline2007}.
This is cited by @technicalreport: \parencite{Dasgupta2007}

\printbibliography
\end{document}


Should get you closer to what you want

• biblatex-ext's innamebeforetitle option does the major work of moving the editors of @incollections.
• xpatch is used to move the pages from after the publisher to after the book title.
• @incollection instead of @inbook (as pointed out by Alan Munn); on the other hand a quick google search suggests that Mr Cline is the author of Cline2007 and so the "(ed.)" would not be appropriate. If he is indeed the editor and the thing turns out to be a collection, you should still the the correct results.
• There were a few issues with punctuation that left me baffled and I could not figure out a way to algorithmically describe what I saw, so you may have to tweak that a bit.
• Are you sure that babel affects the quotation marks? – cfr Jun 17 '18 at 14:49
• @cfr Well yes and no. If you refer to the comments in the code after \usepackage{babel}, there were copied from the original MWE and I didn't actually read them before, but they are indeed not entirely accurate. But together with csquotes (which is loaded much later in the preamble) babel does indeed affect the quotation marks (though you could argue that csquotes does the real work here). I will remove misleading comments and reorder the preamble to load hyperref last. – moewe Jun 17 '18 at 14:57
• It is really csquotes, I think. At least, that's how it works for me. I didn't notice that comment was from the OP, but I still think you're right to remove it - thanks for editing. (Can't upvote again.) – cfr Jun 17 '18 at 15:05
• @cfr Yes it is csquotes that does the real work here. If you don't load csquotes biblatex uses an emulation of csquotes' commands so that quotation marks produced by biblatex always come out as American-style 66-99 quotation marks. If csquotes is loaded with autostyle it gets the style from the active language. – moewe Jun 17 '18 at 15:14
• @cfr That is because the default is autostyle=tryonce, which only tries to adapt the quotation mark once (to the main language). autostyle=true continuously adapts the quotation marks to any language changes throughout the document. It makes no difference in the MWE, but again I did not question the intentions of the OP. – moewe Jun 18 '18 at 5:14