# Custom BibLaTeX style

I need to produce the following BibLaTeX style:

Currently I get this output:

with the .bib file named Libtest.bib

@unpublished {mi:2009,
author = {T. Miller and X. Meyer and K. Nahel},
title = {Arbitrary title: extensive latex work pays of at university most likely},
type = {Unpublished working paper},
institution = {Random University}
location = {Random location}
date = {2009}
}


Testing:

\documentclass[a4paper, 12pt, headsepline, headings=small,]{scrreprt}
\overfullrule=1mm
\usepackage[onehalfspacing]{setspace}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage[backend=bibtex8,
style=authoryear-icomp,
dashed=false,
autocite=footnote,
maxcitenames=3,
mincitenames=1,
maxbibnames=100,
sorting=nty
]{biblatex}
\bibliography{Libtest}
\renewbibmacro*{cite:labelyear+extrayear}{%
\iffieldundef{labelyear}
{}
{\printtext[bibhyperref]{%
\printtext[parens]{%
\printfield{labelyear}%
\printfield{extrayear}}}}}
\bibliography{Libtest}
\begin{document}
\cite{mi:2009}  argue...
\printbibliography
\end{document}


Maybe someone can help me to change the 'ands' to commas and to achieve the rest of the above output?

Regards, Tom.

-
When you say it seems incorrect, what do you mean? It does, for example, seem very unlikely that Iceland University would be located in Alaska but I take it that's not what you mean. Do you have to use that bib file? Why can't you change it? Because it really ought not be set up like that. Also, please make your code compile - it makes it easier for people to reproduce the issue and work on solutions. Also, you are using biblatex - bibtex8 is just being used as the backend - and the preamble is from your document, I take it, not bibtex. –  cfr Dec 30 '13 at 1:04
\renewcommand{\finalnamedelim}{\addcomma\space} will deal with the ands. If you post something which will compile people can see what else is needed. As it is, that's a bit difficult. –  cfr Dec 30 '13 at 1:12
Well, first of all you need to know what are both the citation style and the bibliographic style you need. Surelly you'll find that the style does exists yet. In my case, in my institute we use the IEEEtr style. In the other hand if you read the biblatex manual (sections 2.1 and 2.2) you'll see that exists few basic fields for each kind of reference, and many other optionals. Your example in the journaltitle is wrong, you should use instead ìnstitution and location. Finally the inclusion of these filds depends of the style you're using for. –  Aradnix Dec 30 '13 at 2:35
If you need to print something else aditional to the obligatory fields in your references, you should put in the field addendum. –  Aradnix Dec 30 '13 at 2:37
First of all it seems your example is not an @article at all, but rather a @report or a @unpublished (see the biblatex documentation for details). "Unpublished working paper" would then be type, "Iceland University" would be institution, "Alaska" location for the former. –  moewe Dec 30 '13 at 8:48

## 1 Answer

You seem to prefer a style printing only the initials of the first names, so we use firstinits=true as package loading option.

You also want a "Last, First" name format for all names, so we issue \DeclareNameAlias{sortname}{last-first}. To get rid of the final "and": \renewcommand*{\finalnamedelim}{\multinamedelim}.

No formatting directives are applied to title by

\DeclareFieldFormat{title}{#1}
\DeclareFieldFormat
[article,inbook,incollection,inproceedings,patent,thesis,unpublished]
{title}{#1}


To strip the year of the parentheses, add the following to your preamble

\renewbibmacro*{date+extrayear}{%
\iffieldundef{\thefield{datelabelsource}year}
{}
{%\printtext[parens]{%
\setunit{\addcomma\space}%
\iffieldsequal{year}{\thefield{datelabelsource}year}
{\printdateextralabel}%
{\printfield{labelyear}%
\printfield{extrayear}}}}%}%


To change the order to "Institution, Location", we use

\renewbibmacro*{publisher+location+date}{%
\printlist{publisher}%
\setunit*{\addcomma\space}%
\printlist{location}%
\setunit*{\addcomma\space}
\usebibmacro{date}%
\newunit}

\renewbibmacro*{institution+location+date}{%
\printlist{institution}%
\setunit*{\addcomma\space}%
\printlist{location}%
\setunit*{\addcomma\space}
\usebibmacro{date}%
\newunit}

\renewbibmacro*{organization+location+date}{%
\printlist{organization}%
\setunit*{\addcomma\space}%
\printlist{location}%
\setunit*{\addcomma\space}
\usebibmacro{date}%
\newunit}


To get rid of the "in" for @articles try this:

\renewbibmacro{in:}{%
\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}


The following will format the volume and number as "#vol (#nr)".

\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
\setunit*{\addspace}%
\printfield[parens]{number}%
\setunit{\addcomma\space}%
\printfield{eid}}


MWE

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear-icomp, dashed=false, autocite=footnote, maxcitenames=3,
mincitenames=1, maxbibnames=100, sorting=nty, firstinits=true, backend=biber]{biblatex}
\usepackage{filecontents}
\usepackage{hyperref}
\begin{filecontents*}{\jobname.bib}
@unpublished {mi:2009,
author = {T. Miller and X. Meyer and K. Nahel},
title = {Arbitrary title: extensive latex work pays of at university most likely},
type = {Unpublished working paper},
institution = {Random University},
location = {Random location},
date = {2009},
}
@inproceedings{author2010title,
AUTHOR   = {Smith, Agent},
TITLE    = {{Entangled in the Matrix}},
eventtitle= {Cyberwhatever Symposium},
ADDRESS  = {Berlin},
DATE     = {2010-06-01}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\renewcommand*{\finalnamedelim}{\multinamedelim}
\DeclareNameAlias{sortname}{last-first}

\DeclareFieldFormat{title}{#1}
\DeclareFieldFormat
[article,inbook,incollection,inproceedings,patent,thesis,unpublished]
{title}{#1}
\DeclareFieldFormat{journaltitle}{#1}
\renewbibmacro*{cite:labelyear+extrayear}{%
\iffieldundef{labelyear}
{}
{\printtext[bibhyperref]{%
\printtext[parens]{%
\printfield{labelyear}%
\printfield{extrayear}}}}}

\renewbibmacro*{date+extrayear}{%
\iffieldundef{\thefield{datelabelsource}year}
{}
{%\printtext[parens]{%
\setunit{\addcomma\space}%
\iffieldsequal{year}{\thefield{datelabelsource}year}
{\printdateextralabel}%
{\printfield{labelyear}%
\printfield{extrayear}}}}%}%

\renewbibmacro*{publisher+location+date}{%
\printlist{publisher}%
\setunit*{\addcomma\space}%
\printlist{location}%
\setunit*{\addcomma\space}
\usebibmacro{date}%
\newunit}

\renewbibmacro*{institution+location+date}{%
\printlist{institution}%
\setunit*{\addcomma\space}%
\printlist{location}%
\setunit*{\addcomma\space}
\usebibmacro{date}%
\newunit}
\renewbibmacro*{organization+location+date}{%
\printlist{organization}%
\setunit*{\addcomma\space}%
\printlist{location}%
\setunit*{\addcomma\space}
\usebibmacro{date}%
\newunit}

\renewbibmacro{in:}{%
\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}

\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
\setunit*{\addspace}%
\printfield[parens]{number}%
\setunit{\addcomma\space}%
\printfield{eid}}

\begin{document}
\cite{mi:2009,markey,wilde,knuth:ct:a,baez/article,reese,itzhaki,cicero,author2010title,bertram}
\printbibliography
\end{document}


gives

-
Excellent work! Thanks a lot. –  TomM Dec 30 '13 at 14:57
I noticed some more things: Before every journal there is the word: 'In:'. Can this be removed? Also can the Vol/Nr be added in the format: Random Journal, 1 (2) --- with 1 being the Vol and 2 being the Nr? –  TomM Dec 30 '13 at 15:39
@TomM Sure, have a look at the edited version. –  moewe Dec 30 '13 at 15:54
@TomM That most certainly is the problem, the proper field usage would be volume = {x}, number = {y}, instead of issue = {Vol. x, Nr. Y}. If you use the latter, there is no way for biblatex to now what number and what volume is. See the biblatex documentation, especially §2.2.2 Data Fields. –  moewe Dec 30 '13 at 16:41
@TomM Regarding the name thing: If you are talking about the editor names, try adding \DeclareNameAlias{default}{last-first}. To help with the location problem, replace \printlist{publisher}% \setunit*{\addcomma\space}% above by \printlist{publisher}% \setunit*{\addperiod\space}% –  moewe Jan 8 at 21:23