3

I would like to remove the year label, if it is undefined. What I get:

EC No 197/38 2012 (n.d.)

But it should be:

EC No 197/38 2012

In the bibliography I get this, but it is correct for me:

EC No 197/38 2012: Waste electrical and electronic equipment (WEEE), 4 July 2012, Commission Regulation.

\documentclass{book}
\usepackage[style=authoryear-icomp]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{biblio.bib}
@Misc{EC4July2012,
  Title                    = {Waste electrical and electronic equipment ({WEEE}), 4 July 2012},
  Author                   = {{EC No 197/38 2012}},
  Type                     = {Commission Regulation},
}
\end{filecontents}

\addbibresource{biblio.bib}

\nocite{*}

\begin{document}
Something \autocite{EC4July2012}.
\printbibliography

\end{document}
Torbjørn T.
  • 206,688
Xeo
  • 305
  • The proper way would be to have the date (in your 4 July 2012) case in the year field in the bibtex entry. – Guido May 21 '14 at 11:35
  • @Guido The problem is that it is a European Comission Regulation. And in the short form citation should be "EC No 197/38 2012". The form and style of laws are difficult to make correct in this case. – Xeo May 21 '14 at 11:41
  • 1
    If you have more of these rules/regulations/laws that need special handling, it might be a good idea to create a new entry type for those (a starting point might be List of People analog to Bibliography and How can I create entirely new data types with BibLaTeX/Biber?), if you can provide a prototype of what your citations contain and how they should look like in citations and bibliographies, we might be able to help you here. – moewe May 22 '14 at 05:17
  • Of course you can also just redefine a cite command to always omit dates for @miscs: \renewbibmacro*{cite:labelyear+extrayear}{% \ifentrytype{misc} {} {\iffieldundef{labelyear} {} {\printtext[bibhyperref]{% \printfield{labelyear}% \printfield{extrayear}}}}} (modulo line breaks and comment characters, if you want that, I can write up an answer). – moewe May 22 '14 at 05:21
  • @moewe It is working with your redefinition, but now i have space before parenthesis in all cites. Author x and Author y ( 2014 ) or (Author y et. al. 2002 )? – Xeo May 23 '14 at 19:44
  • I suppose that is thanks to white-space not being properly commented out, in the above code you should insert line brakes at the points marked with "\n" in this code snippet: \renewbibmacro*{cite:labelyear+extrayear}{%\n \ifentrytype{misc}\n {}\n {\iffieldundef{labelyear}\n {}\n {\printtext[bibhyperref]{%\n \printfield{labelyear}%\n \printfield{extrayear}}}}}\n` and nowhere else – moewe May 25 '14 at 16:16
  • @moewe I guess by now you know what i am asking for ;-) – Johannes_B Dec 06 '14 at 13:46
  • @Johannes_B Your wish is my (very late) command. – moewe Apr 06 '15 at 10:44

1 Answers1

2

Handling of laws, regulations etc. that are supposed to be cited in a very particular way isn't all that easy. If you have several of such documents you might want to consider creating dedicated entrytypes for easy customisation (see How can I create entirely new data types with BibLaTeX/Biber? on how to do that, and How to implement a jurisdiction biblatex entry type? & How to cite a section of a Constitution for a more thought through and an ad-hoc solution; as well as What is the proper way to cite a legal document? for a general discussion).

In your case, there is the obvious ad-hoc solution of suppressing years for @miscs:

\renewbibmacro*{cite:labelyear+extrayear}{%
  \ifentrytype{misc}
    {}
    {\iffieldundef{labelyear}
      {}
      {\printtext[bibhyperref]{%
         \printfield{labelyear}
         \printfield{extrayear}}}}}
moewe
  • 175,683