3

I'm fairly new on using LaTex, so maybe this is a really simple question to answer. I've rewritten the whole question due to the comments made.

What I'm trying to do is to declare my own command that is just like \footcite but that exclude the year.

The problem is that I in some citation don't want the year to be printed, just the author. So in general the command \footcite works perfectly with verbose-ibid, but for some specific citations the year shouldn't be printed.

Here is an example of my LaTex code (which I hope is MWA):

    \documentclass{book}
   \usepackage[utf8]{inputenc}
    \usepackage[swedish]{babel}
    \usepackage[style=verbose-ibid, backend=biber, labeldate, isbn=false, url=false, sorting=nyt, hyperref=true, pagetracker=true]{biblatex}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
    @book{200910rp162,
    Address = {Stockholm},
    Author = {Prop.{ }2009/10:162},
    Title = {Ers{"a}ttning vid expropritaion},
    Year = {2010},
    Keywords = {offentligttryck},
    }
    @book{Babcock1931rev,
    Address = {Ann Arbor},
    Author = {Babcock, Frederick M.},
    Publisher = {University of Michigan, School of Business Administration, Bureau of Business Research},
    Title = {Real estate valuation : a statement of the appraisal problem and a discussion of the principles involved in the development ...},
    Year = {1931}, 
    keywords={litteratur}, }
\end{filecontents*}
\addbibresource{\jobname.bib}

\DeclareNameAlias{default}{last-first}
\renewbibmacro*{cite:short}{%
  \printnames{labelname}%
  \setunit*{\nameyeardelim}%
  \iffieldundef{labelyear}
    {}
    {\printtext[parens]{\printtext[bibhyperlink]{%
       \printfield{labelyear}%
       \printfield{extrayear}}}}}
\begin{document}

Some text that I have a citation on.\footcite[s. 12]{200910rp162}

And some other text I cite on another page.\footcite[s. 15]{200910rp162}

Text.\footcite[s. 12]{Babcock1931rev}

Text2.\footcite[s. 15]{200910rp162}


\end{document}

In my presented example footnote 1-3 is good. It's the 4th that is wrong, I don't want it to display the year (2010) for that specific source. But for "normal" literature I want it just like how \footcite works.

enter image description here

Edit: Regarding the comment. I'm writing a book about Swedish Law, and it's customary to cite Government bills that precede a new law by the name of the bill, e.g. Prop 2009/10:162 and a page reference. That's why I put the name of the bill as author in my .bib. And I also put the { } so that it comes out as Prop. 2009/10:162, otherwise LaTex treats the 2009/10:162 as surname and put it first. For all my "normal" citations I perfectly happy :). It's just for this "Prop-citations" I'm struggling.

I tried to make my own command with:

    \DeclareCiteCommand{\footciteauthor}[\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{citeauthor}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}

But it didn't work. I also tried the tips with shorthand. It works okay, but then the "ibid-tracker" doesn't work.

Final edit: I manage to make my own solution, that I don't think is the best one, but at least it works for now. This is what I did (I reckon that it could be interesting if someone else has the same problem). First I took away all Year-entries in the .bib for the sources that I don't want year to be showed. Then I added this to my preamble:

\renewbibmacro*{date+extrayear}{%
    \iffieldundef{year}
      {\printtext{}}
      {\printtext[parens]{\printdateextra}}}%

\DeclareNameAlias{default}{last-first}
\renewbibmacro*{cite:short}{%
  \printnames{labelname}%
  \setunit*{\nameyeardelim}%
  \iffieldundef{year}
    {\printtext{}}
    {\printtext[parens]{\printtext[bibhyperlink]{%
       \printfield{labelyear}%
       \printfield{extrayear}}}}}

Sorry for long post :)

6
  • 1
    Welcome to TeX.SX! Would it be possible to prepare a full MWE that shows what you are talking about. I don't think "Prop.{ }2009/10:162" is actually something one would want in the author field, so I assume one solution could be to use the .bib fields differently. You could try shorthand for example.
    – moewe
    Jun 13, 2016 at 11:56
  • Thanks! I added som info about the question. Not sure what you mean by shorthand though.
    – Eric
    Jun 13, 2016 at 12:34
  • 1
    Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Jun 13, 2016 at 14:07
  • Just use shorthand = {Prop. 2009/10:162}, instead of Author = {Prop.{ }2009/10:162}, in your example above.
    – moewe
    Jun 13, 2016 at 16:19
  • I think I found what is the problem, it's my change to author-year for verbose-ibid. I now tried to exclude the Year in the .bib for the sources where I don't want any year. But then I get (n.d.) instead. I would like it to be nothing if Year is undefined in the .bib.
    – Eric
    Jun 14, 2016 at 7:33

0

Browse other questions tagged .