1

Hello latex community!

I'm trying to set a specific command to cite journal articles which doesn't show the author but the journal title, the date and then the article title.

I've found this answer: How to create a \citejournal, \citebooktitle, \cite... command in biblatex?

My problem is that it doesn't not provide the date nor the article title so I've modified it a bit:

\DeclareCiteCommand{\citejournal}
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
    \usebibmacro{journal}
     \usebibmacro{date}
       \usebibmacro{title}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

It's now almost perfect as I see the journal and the article title but the date does not show.

Here is a short MWE with the citation I'm using:

\documentclass{article}
\usepackage[style=authoryear,backend=biber]{biblatex}

\DeclareCiteCommand{\citejournal}
      {\usebibmacro{prenote}}
      {\usebibmacro{citeindex}%
        \usebibmacro{journal}
         \usebibmacro{date}
           \usebibmacro{title}}
      {\multicitedelim}
      {\usebibmacro{postnote}}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{test,
  author = {Author, A.},
  date = {2011-06-12},
  title = {Some relevant article},
  journal = {Test journal}
}
\end{filecontents}

\bibliography{\jobname}

\begin{document}

Some text~\citejournal{test}

\printbibliography

\end{document}

1 Answer 1

2

Basically, you are seeing that the date bibmacro is being cleared, so there is nothing to print. This is a result of your using the authoryear style for biblatex. The example document for the authoryear style gives a bit more detail:

Since this style prints the date label after the author/editor in the bibliography, there are effectively two dates in the bibliography: the full date specification (e.g., “2001”, “June 2006”, “5th Jan. 2008”) and the date label (e.g., “2006a”), as found in citations. The mergedate option controls whether or not date specifications are merged with the date label.

So, when the style works to merge the two fields together, it dispenses with the date bibmacro and "disables" it to avoid any issues.

Your options are to:

  1. Add mergedata=false to prevent the style from merging the dates, which will keep the date bibmacro intact, but also (possibly) affect the presentation of items in the bibliography.

  2. Recreate the bibmacro with \renewbibmacro*{date}{\printdate} - this is the original definition of the macro.

  3. Switch to using \usebibmacro{date+extrayear} in the citation command. This is the "newer" bibmacro that the style defines to make the date label that appears right after the author in the bibliography.

  4. Use a different style that doesn't have these peculiarities.


In any event, you may wish to adjust your delimiter between the fields, depending on what you desire. The example below exercises option 3 above and simply inserts space between each unit.

\DeclareCiteCommand{\citejournal}
      {\usebibmacro{prenote}}
      {\usebibmacro{citeindex}%
        \usebibmacro{journal}
        \setunit{\addspace} % space delimiter
        \usebibmacro{date+extrayear}
        \setunit{\addspace} % space delimiter
           \usebibmacro{title}}
      {\multicitedelim}
      {\usebibmacro{postnote}}

Result:

bib

2
  • +1 Though the command should probably be called \citearticle now, as it does not only print the journal.
    – moewe
    May 31, 2014 at 7:46
  • Thx I've decided to go for the option 2 as I need to print the full date in the citation for the demonstration. What is very surprising is that I am actually using biblatex with authortitle-icomp as a citestyle and authoryear as a bibstyle... when I supress the bibstyle it prints the date in the citation and the bibliography whereas when I had it the date disappear in both. Anyway with solution it works perfectly thanks!
    – ElNikopol
    May 31, 2014 at 10:01

You must log in to answer this question.

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