this week I already got some help on the following problem. I have to write a thesis with the bibliography in authoryear style. However, there are some special entry types like norms that have to appear differently. While books and articles work fine, a norm has to look like this in the bibliography:
DIN 18351-1:2006-10: Title, Version.
in the text I want: text text text (DIN 18351-1, 2010)
Here I got a first version of a skript that I tried to modify: Bibliography entry apart from author year style
In the original version, the text "DIN" was written manually in the text and in the bibliography by \printtext{DIN}.
Now I tried to define a field like "institute", where I can write for example ISO, DIN, VDI and so on. I defined a new field "institute" by \DeclareFieldFormat[norm]{institute}{#1} and tried to replace \printtext{DIN ISO} by printfield{institute}, but it doesn't appear when I compile. And I also have the problem that, as there is no author, I don't know how it will sort in the end. If you could help me on that I'd be so grateful!
this is what I have got so far:
\documentclass{article}
\usepackage[
%style = alphabetic,
citestyle=authoryear-comp,
bibstyle=authoryear,
]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@norm{diniso18351,
title = {Title},
number = {18351-1},
version = {Entwurf},
%pubstate = {DIN ISO 18351-1:2010-06},
date = {2010-06},
institute = {VDI}},
@book{Kaltschmitt.2003,
year = {2003},
title = {Erneuerbare Energien: Systemtechnik, Wirtschaftlichkeit, Umweltaspekte},
address = {Berlin, Heidelberg and s.l.},
edition = {dritte, vollst{\"a}ndig neu bearbeitete und erweiterte Auflage},
publisher = {{Springer Berlin Heidelberg}},
isbn = {978-3-662-07116-8},
editor = {Kaltschmitt, Martin and Wiese, Andreas and Streicher, Wolfgang},
doi = {10.1007/978-3-662-07115-1}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
% add new diniso entry type
\DeclareDatamodelEntrytypes{
norm}
% set bibliography label template for diniso entry type
\DeclareLabelalphaTemplate[norm]{%
\labelelement{
\field{number}
}
}
% use comma before year in citations without authors
% this will apply to all entry types
\renewcommand*{\nonameyeardelim}{\addcomma\space}
% field formats for diniso entry type
\DeclareFieldFormat[norm]{version}{#1}
\DeclareFieldFormat[norm]{institute}{#1}
%\DeclareFieldFormat[norm]{pubstate}{\mkbibparens{#1}}
\DeclareFieldFormat[norm]{date}{%
\thefield{year}%
\bibdatesep
\mkmonthzeros{\thefield{month}}}
% custom driver for diniso entry type
\DeclareBibliographyDriver{norm}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
% \printtext{DIN EN ISO}%
\printfield{institute}% This field is not printed
\setunit{\addspace}%
\printfield{number}%
\setunit{\addcolon}%
\printdate
\setunit{\addcolon\space}%
\usebibmacro{title}%
\setunit{\addcomma\space}%
\printfield{version}%
\setunit{\addspace}%
%\printfield{pubstate}%
\usebibmacro{finentry}}
% custom citation label for diniso entry type
\newbibmacro*{cite:label}{%
\iffieldundef{label}
{\ifentrytype{norm}
{\printtext[bibhyperref]{%
%\printtext{DIN EN1 ISO}%
\printfield{institute}% This field is not printed
\printfield{number}
\setunit{\addspace}%
}}
{\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}}
{\printtext[bibhyperref]{\printfield{label}}}}
\pagestyle{empty}
\begin{document}
\section{First section}
quote 1 \parencite{diniso18351}\\
quote 2 \parencite{Kaltschmitt.2003}
\printbibliography
\end{document}

institutioninstead, which is available by default (but it's a list and not a field).type(which is a field) might also be a possible alternative. – moewe Dec 24 '17 at 19:42text text text VDI 4640-1 2010.
That double space doesn't appear when I cite articles, books etc.. Can you image how this happens or is there a command I could add to suppress it?
– Pjay Dec 25 '17 at 12:13text text textVDI 4640-1, 2010, with only one space before2010. Maybe there is some additional code in your template that causes this? – wimi Dec 25 '17 at 13:52\usepackage[ extension=pdf,
hypertexnames=true,
bookmarksopen,
pdfnewwindow
]{hyperref}
https://abload.de/img/unbenanntzmsd0.jpg Do you have an idea how to get rid of that? Or why it only happens with the newly defined entry type? maybe it's because the link is on all the reference and not only on the year... can we change that?
– Pjay Dec 27 '17 at 11:41[bibhyperref]and the spacing problem will be solved (make sure to load the packagehyperreflast). If you want the whole citation label to be hyperlinked, you can have a look here https://tex.stackexchange.com/q/27607/150114 . – wimi Dec 27 '17 at 18:15