1

Consider this MWE:

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
    @article{article,
        author  = {Peter Adams}, 
        title   = {The title of the work},
        journal = {The name of the journal},
        year    = 1993,
        number  = 2,
        pages   = {201-213},
        month   = 7,
        note    = {An optional note}, 
        volume  = 4
    }
    @book{book,
        author    = {Peter Babington}, 
        title     = {The title of the work},
        publisher = {The name of the publisher},
        year      = 1993,
        volume    = 4,
        series    = 10,
        address   = {The address},
        edition   = 3,
        month     = 7,
        note      = {An optional note},
        isbn      = {3257227892}
    }
\end{filecontents}

\usepackage[backend=biber]{biblatex}
\addbibresource{\jobname.bib}

\begin{document}

\citefield{article}{journaltitle}

\citefield{book}{journaltitle}

\end{document}

This results in

The name of the journal

journaltitle

How can I specify a replacement text (namely no text at all) for the missing journal title in the book reference?

1 Answer 1

3

The \citefield command is intentionally quite low level. I suggest defining a \citejournal citation command. Something like this:

\DeclareCiteCommand{\citejournal}
  {}
  {\printfield{journaltitle}}
  {\multicitedelim}
  {}

This ignores the prenote and postnote for this citation command.

It will also format the journaltitle with the currently defined field format. If you don't want it formatted then use:

\DeclareCiteCommand{\citejournal}
  {}
  {\printfield[default]{journaltitle}}
  {\multicitedelim}
  {}

Your full MWE then becomes:

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
    @article{article,
        author  = {Peter Adams}, 
        title   = {The title of the work},
        journal = {The name of the journal},
        year    = 1993,
        number  = 2,
        pages   = {201-213},
        month   = 7,
        note    = {An optional note}, 
        volume  = 4
    }
    @book{book,
        author    = {Peter Babington}, 
        title     = {The title of the work},
        publisher = {The name of the publisher},
        year      = 1993,
        volume    = 4,
        series    = 10,
        address   = {The address},
        edition   = 3,
        month     = 7,
        note      = {An optional note},
        isbn      = {3257227892}
    }
\end{filecontents}

\usepackage[backend=biber]{biblatex}
\addbibresource{\jobname.bib}

\DeclareCiteCommand{\citejournal}
  {}
  {\printfield{journaltitle}}
  {\multicitedelim}
  {}

\begin{document}

\citejournal{article}

\citejournal{book}

\end{document}

You must log in to answer this question.

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