5

Using \citefield{key}{field} with BibLatex, it is possible to cite a specific data field of the bibliography entry.

Is it possible to do this with multiple fields, e.g. to use it as new citation style, by combining the field keywords (e.g. {field1 | field2})?

Or is the best way to do this by simply using two \citefield commands?

4

If you plan to print multiple fields it is probably best to define a new \cite* command. That can even be a good idea if you only plan to print one field, because it can save some typing, see How to extract BibTeX entries (as DOI, abstract, etc.) for example.

You could use something like

\DeclareCiteCommand{\citesomefields}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printfield{<field1>}%
   \setunit{\addcomma\space}% <- or any other punctuation you'd like: \addperiod, \addspace, ...
   \printfield{<field2>}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

That command can then be used like \citesomefields{sigfridsson} and you get to see <field1> and <field2> of the entry sigfridsson. The advantage of this approach is that it handles multiple citations as well as pre- and postnotes.

In this definition we explicitly disable tracking of the "citations" with \boolfalse{citetracker}\boolfalse{pagetracker}, this is what happens in the pre-defined \citeauthor and \citetitle commands as well. If you want to track your "citations" (for example if you want to use the new command as a drop-in replacement for the real \cite - which I'm not too fond of, if you want to modify the appearance of citations, modify \cite and its output, don't try to come up with a manual solution) just remove the two lines from the pre-code hook above.

  • I'd say that if you plan to use the same \citefield more than once or twice in your document it is a good idea to make it into a new \cite* command with \DeclareCiteCommand. – moewe Aug 2 '16 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.