5

I need to produce the following BibLaTeX style:

enter image description here

Currently I get this output:

enter image description here

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.

TomM
  • 1,694
  • 1
  • 19
  • 31
  • 1
    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 01: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 01:12
  • 1
    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 02: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 02:37
  • 1
    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 08:48
  • There are also some modifications that have to be done to date+extrayear to get what you want, but it would be better to have a full MWE before tackling that. It would also be better to ask your "related question" in a new question. As it stands it has almost nothing to do with the issues discussed here. – moewe Dec 30 '13 at 09:07
  • Thanks for the comments, very helpful. Changed everything mentioned and also included a working code which can be compiled, once you saved the bib file under the above mentioned name. – TomM Dec 30 '13 at 14:09
  • What about the other entry types? Do you also want them to lose the parentheses around the year. What about the title format (do all types have to lose the formatting)? – moewe Dec 30 '13 at 14:26
  • @moewe yes the style should be generally as consistent as possible, ie usuable for each type of entry and produce as similar as possible outputs. What do you mean with lose formatting? – TomM Dec 30 '13 at 14:28
  • "Lose formatting" was meant to mean "no italics/emphasis and no quotation marks etc.". So I suppose you want to get rid of all of that. – moewe Dec 30 '13 at 14:32
  • @moewe yes correct. But if I didn't want intalics I could also write a word in non-italic in the bib-file, correct? That'd allow for more flexibility. But principally you are right, I need to remove all of that anyway. – TomM Dec 30 '13 at 14:35

1 Answers1

12

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}

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*{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 enter image description here

moewe
  • 175,683
  • 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
  • 1
    @TomM Sure, have a look at the edited version. – moewe Dec 30 '13 at 15:54
  • I have just tried the new 2 commands, but in my case the Vol/Nr is not changed. I cannot use biber though - always undefined control sequence in TexStudio. So I am using bibtex8 – TomM Dec 30 '13 at 16:23
  • @TomM Did you try the MWE or a different document? It works here even with bibtex8. If you want to user Biber, you will have to install it, to use it with TeXstudio, see here. – moewe Dec 30 '13 at 16:30
  • Hmm I tried to set TexStudio to use biber, but it doesn't work (same error as before). Maybe the reason is that I always used the field issue = {Vol. x, Nr. Y} in article for the volume and number? Edit: Yeah I used my full document where it doesn't work. – TomM Dec 30 '13 at 16:38
  • 1
    @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
  • I have a little follow-up question, I hope you don't mind if I ask here. If I include @incollection{x:2003, author = {Michael Dall}, title = {Random title}, date = {2003}, editor = {Michael Dall and Pete Dough}, booktitle = {Collection of papers}, location = {New York}, publisher = {XYZ Publishers}, } there are 2 tiny mistakes: 1) the first name comes before the last name: M. Dall instead of Dall. M, and 2) there is a comma before New York instead of a dot. Can I ask you to include this example in the above solution? – TomM Jan 08 '14 at 14:17
  • 1
    @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 08 '14 at 21:23
  • Why printbibliography command does not work as shown above – murugan Apr 23 '16 at 09:44
  • @murugan I just checked the code, compiled the example from above and it still works for me. You will need to be a bit more precise on how it doesn't work for you. It is best to ask a new question for that with a proper MWE. – moewe Apr 23 '16 at 09:55
  • Jobname.bib contains only T.Miller and Smith. The list of authors shown under literatur is not printed. I get the result of \cite{mi:2009,markey,wilde,knuth:ct:a,baez/article,reese,itzhaki,cicero,author2010title,bertram}. But I do not get the entire list from the jobname.bib file under the Literatur heading. Still I am not clear about functioning of biblatex – murugan Apr 23 '16 at 10:06
  • @murugan Please read up on biblatex and using it in Question mark instead of citation number, Biblatex with Biber: Configuring my editor to avoid undefined citations and biblatex in a nutshell (for beginners) as well as relevant linked questions there. Indeed \jobname.bib should only contain two entries, all the other entries in the example reside in biblatex-examples.bib. Are you maybe looking for \nocite (see here)? – moewe Apr 23 '16 at 10:11