1

I'm trying to accomplish the following task:

In my thesis I have to refer to a lot of literature, which works well with the normal authoryear style. I got a template from my institute which I managed to make it work with biblatex and biber.

However, I have to cite some norms that should look like this:

DIN ISO 18351:2010-06: Title (in italic), version (draft, final...)

Can anybody help me with that? I've tried to add "DIN ISO 18351:2010-06" as the author or label, but then in the bibliography it adds something like date unknown... Do I have to define a custom entry type for that? Moreover, I would like to refer to it as (DIN ISO 18351, 2010) in the text. Is that difficult to implement or can I do it somehow with standard commands? The problem here is that I want to cite the title in the text instead of the author.

MWE

\documentclass{article}
\usepackage[
backend=biber,
style=alphabetic,
citestyle=authoryear,
sorting=ynt
]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib} 
@misc{key, author = {DIN ISO 18351}, year = {2010-6}, title = {Title} }
\end{filecontents*}

\addbibresource{\jobname.bib} 

\begin{document}
\section{First section}

\cite{key}

\medskip

\printbibliography


\end{document}

Output:

enter image description here

5
  • Welcome to TeX.SE. It would be helpful if you composed a fully compilable minimal working example with bibliography (MWEB) including \documentclass and the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. Dec 22, 2017 at 23:05
  • documentclass{article} \usepackage[style=author year, backend = biber]{biblatex} \addbibresource{\jobname.bib} \usepackage{filecontents} \begin{filecontents}{\jobname.bib} @misc{key, author = {DIN}, year = {2010-06}, title = {Title}, Number = {DIN ISO 18351}, } \end{filecontents} \begin{document} \cite{key} \printbibliography \end{document}, im sorry, somehow i
    – Pjay
    Dec 22, 2017 at 23:12
  • 1
    What should the label be in the bibliography? Your MWE output gives [18351]. Is that what you want or something else? Dec 23, 2017 at 1:55
  • 1
    By the way, the year field must be an integer, not 2010-6. You should use date = {2010-06} instead. Dec 23, 2017 at 2:55
  • 1
    style=alphabetic, citestyle=authoryear, don't mix very well. Do you want style=alphabetic or style=authoryear,? Do you really want sorting=ynt? Regardless of what style you actually use, it will be hard to find the right reference in the bibliography with that sorting style (with style=authoryear the expected sorting would be sorting=nyt, with alphabetic probably anyt, these are the defaults with the respective styles.)
    – moewe
    Dec 23, 2017 at 10:44

1 Answer 1

3

You question isn't quite clear enough to answer, but this will get you most of the way and probably only need to be tweaked.

Explanation is in comments.

\documentclass{article}

\usepackage[
style=alphabetic,
citestyle=authoryear,
sorting=ynt
]{biblatex}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib} 
@diniso{diniso18351,
  title = {Title},
  number = {18351},
  version = {1.0},
  pubstate = {final},
  date = {2010-06}}
\end{filecontents*}

\addbibresource{\jobname.bib} 

% add new diniso entry type
\DeclareDatamodelEntrytypes{
  diniso}

% set bibliography label template for diniso entry type
\DeclareLabelalphaTemplate[diniso]{%
  \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[diniso]{version}{#1}
\DeclareFieldFormat[diniso]{pubstate}{\mkbibparens{#1}}
\DeclareFieldFormat[diniso]{date}{%
  \thefield{year}%
  \bibdatesep
  \mkmonthzeros{\thefield{month}}}

% custom driver for diniso entry type
\DeclareBibliographyDriver{diniso}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \printtext{DIN ISO}%
  \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{diniso}
      {\printtext[bibhyperref]{%
         \printtext{DIN ISO}%
         \setunit{\addspace}%
         \printfield{number}}}
       {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}}
    {\printtext[bibhyperref]{\printfield{label}}}}

\pagestyle{empty}
\begin{document}
\section{First section}

\parencite{diniso18351}

\printbibliography

\end{document}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .