Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Short question: How can I create a new entry type (@music) with fields for the composer, title, opus, editor, series, location and year?

\begin{filecontents*}{\jobname.bib}
@music{citekey,
    composer={Johann Sebastian Bach},
    title={Motetten},
    number={BWV 225--230},
%   opus={}, % no opus in this case
    editor={Konrad Ameln},
    series={Neue Bach-Ausgabe Serie III, Band 1},
    loaction={Kassel},
    publisher={Bärenreiter},
    year={1965},
}
\end{filecontents*}

\documentclass[ngerman]{scrartcl}
\usepackage[style=authortitle]{biblatex}
\bibliography{\jobname}

\begin{document}
\cite{citekey} should look like

Johann Sebastian Bach: Motetten. BWV 225-230, hrsg von Konrad Ameln
= Neue Bach-Ausgabe Serie III, band 1. Kassel: Bärenreiter, 1965

or in general

(composer): (title)[, (opus)][, (number)][hrsg. von (editor)][= (series)].
[(location)][: (publisher)][, (year)][.]

where (xxx)=field and [yyy]=optional

\printbibliography
\end{document}
share|improve this question
add comment

2 Answers

up vote 11 down vote accepted
\documentclass[ngerman]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[style=authortitle,backend=biber]{biblatex}
\DeclareBibliographyDriver{music}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \printfield{usera}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
  \newunit
  \printfield{userb}%
  \newunit\newblock
  \printfield{number}%
  \newunit
  \usebibmacro{byeditor+others}%
  \setunit{=\addspace}
  \printfield{series}%
  \setunit{\adddot\addspace}
  \usebibmacro{publisher+location+date}%
  \newunit\newblock
  \usebibmacro{finentry}}

\renewcommand{\labelnamepunct}{\addcolon\space}
\renewcommand*{\newunitpunct}{\addcomma\space}
\DeclareFieldFormat{title}{#1}

\bibliography{9}
\begin{document}
\cite{citekey} should look like

Johann Sebastian Bach: Motetten. BWV 225-230, hrsg von Konrad Ameln
= Neue Bach-Ausgabe Serie III, band 1. Kassel: Bärenreiter, 1965

or in general

(composer): (title)[, (opus)][, (number)][hrsg. von (editor)][= (series)].
[(location)][: (publisher)][, (year)][.]

where (xxx)=field and [yyy]=optional

\printbibliography
\end{document}

And the corresponding .bib file:

@music{citekey,
    usera={Johann Sebastian Bach},
    userb={myopus},
    title={Motetten},
    number={BWV 225--230},
    editor={Konrad Ameln},
    series={Neue Bach-Ausgabe Serie III, Band 1},
    location={Kassel},
    publisher={Bärenreiter},
    year={1965},
}

enter image description here

share|improve this answer
    
Thank You! That works fine :-D. But is it right that I can’t declare new fieldnames like opus or at least make opus as a synonym for usera like location and adress? –  Tobi May 7 '11 at 17:08
    
@Tobi No, this is not possible at the moment because of bibtex, since biblatex has to define its entrytypes in the .bst file. I've read somewhere that this might be possible when biblatex will only work with biber, which is targeted for version 2.0 of biblatex. –  Thorsten May 7 '11 at 17:18
    
OK, Thanks! –  Tobi May 7 '11 at 17:29
    
There's a crucial typo in your .bib file ("loction" instead of "location"). –  lockstep Jun 12 '11 at 20:23
    
@lockstep Thanks for the hint. Fixed now. –  Thorsten Jun 13 '11 at 6:33
show 4 more comments

My answer builds heavily on Thorsten's answer. I added the following modifications:

  • Instead of using a custom field for the composer, I made use of the author field and the bibmacros built upon on it. Otherwise (as in Thorsten's example), bibliography entries will be listed under the composer in the bibliography, but in-text citations will show the editor's name instead (which I suppose is not what one wants).

  • The format of the custom field used for the opus should default to "op.~" plus the field's content (so there's no need to type "op.~" every time). I have customized the format so that it will use the contents of the field userc as prefix if this field is defined (e.g. as "BWV").

  • I have added support for back-referencing. These references may be turned off by removing the respective package option.

The content of the series field should probably be split up into separate fields, but I have left it alone for now.

\documentclass{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}

\usepackage[style=authortitle,backref=true]{biblatex}

\DeclareBibliographyDriver{music}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
%   \printfield{usera}% DELETED
  \usebibmacro{author/editor+others/translator+others}% NEW
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{maintitle+title}%
  \newunit
  \printfield{userb}%
%   \newunit\newblock% DELETED
  \newunit% NEW
  \printfield{number}%
%   \newunit% DELETED
  \newunit\newblock% NEW
  \usebibmacro{byeditor+others}%
  \setunit{=\addspace}
  \printfield{series}%
%   \setunit{\adddot\addspace}% DELETED
  \setunit{\addperiod\space}% NEW
  \usebibmacro{publisher+location+date}%
%   \newunit\newblock% DELETED
  \setunit{\bibpagerefpunct}\newblock% NEW
  \usebibmacro{pageref}% NEW
  \usebibmacro{finentry}%
}

\renewcommand*{\labelnamepunct}{\addcolon\space}
\renewcommand*{\newunitpunct}{\addcomma\space}
% \DeclareFieldFormat{title}{#1}% DELETED
\DeclareNameAlias{sortname}{first-last}% NEW
\DeclareFieldFormat{userb}{% NEW
  \iffieldundef{userc}{%
    op.~#1%
  }{%
    \printfield{userc}~#1%
  }%
}
\DeclareFieldFormat{number}{\bibstring{number}~#1}% NEW

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@music{citekey,
  author = {Johann Sebastian Bach},
  title = {Motetten},
  userb = {225--230},
  userc = {BWV},
  editor = {Konrad Ameln},
  series = {Neue Bach-Ausgabe Serie III, Band 1},
  volume = {1},
  location = {Kassel},
  publisher = {Bärenreiter},
  year = {1965},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

Ein wenig Text \autocite{citekey}.

\printbibliography

\end{document}
share|improve this answer
    
Also a great solution. How could I change the code, to use the publisher in the citation, for example \citet{abc} would generate Henle (1965)? Thank you! –  johlie Oct 1 '12 at 0:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.