0

I want to see title, year, abstract and type of a reference (eg. if it is book, article, ...) in citation in my draft (to be able to check if it is correct (for debugging;) ), I have many references).

What I have

Bibtex entry:

@article{Wang2016,
    author = {Wang, Jane Ling and Chiou, Jeng Min and M{\"{u}}ller, Hans Georg},
    issn = {2326831X},
    journal = {Annual Review of Statistics and Its Application},
    month = {jun},
    number = {1},
    pages = {257--295},
    publisher = {Annual Reviews Inc.},
    title = {{Functional Data Analysis}},
    url = {http://www.annualreviews.org/doi/10.1146/annurev-statistics-041715-033624},
    volume = {3},
    year = {2016}
}

My code:

    \renewcommand{\cite}[1]{
    \oldcite{#1} {
        \color{gray} \citefield{#1}{title}, \textit{\citefield{#1}{journaltitle}},
        \citefield{#1}{year} \textbackslash cite\{$#1$\} }
    }{} %
.
.
.
\cite{Wang2016}

Result:

[10] Functional Data Analysis, Annual Review of Statistics and Its Application, 2016 \cite{Wang2016}

What I want:

[10] @article Functional Data Analysis, Annual Review of Statistics and Its Application, 2016 \cite{Wang2016}

My question

How can I put into cite the type of reference (@article, @book and so on)?

\citefield{#1}{type} does not work for me (according to https://www.ctan.org/pkg/biblatex it is something different).

2
  • Welcome to TeX.SE!
    – Mensch
    May 19, 2021 at 21:28
  • \citefield{#1}{entrytype}?
    – Ivan
    May 20, 2021 at 0:16

1 Answer 1

0

As Ivan points out in the comments, the field is available as entrytype, so \citefield{#1}{entrytype} would work.

Usually it is more elegant and safer (for citation tracking purposes) to define a new \...cite command with \DeclareCiteCommand instead of putting together several \...cite... commands into one \newcommand.

Here you could go about as shown below. Use \autocite instead of \cite as your go-to command (a quick search-and-replace \cite{ -> \autocite{ and \cite[ -> \autocite[ with your editor should make this easy), so you can easily switch between the debug cite command and normal citations.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=numeric]{biblatex}

\DeclareFieldFormat{entrytype}{\texttt{@#1}}
\DeclareFieldFormat{entrykey}{\texttt{\textbackslash autocite\{#1\}}}

\newbibmacro{checkcite}{%
  \printtext[brackets]{%
    \usebibmacro{cite}%
  }%
  \setunit{\addspace}%
  \printfield{entrytype}%
  \setunit{\addspace}%
  \usebibmacro{title}%
  \setunit{\addcomma\space}%
  \ifentrytype{article}
    {\usebibmacro{journal}}
    {}%
  \setunit{\addcomma\space}%
  \usebibmacro{date}%
  \setunit{\addspace}%
  \printfield{entrykey}%
}

\DeclareCiteCommand{\checkcite}
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{checkcite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareMultiCiteCommand{\checkcite}{\checkcites}{\multicitedelim}
\DeclareAutoCiteCommand{check}{\checkcite}{\checkcites}

\ExecuteBibliographyOptions{autocite=check}
% use autocite=plain or autocite=inline
% to go back to normal citations

\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{sigfridsson}

\printbibliography
\end{document}

[1] @article ‘Comparison of methods for deriving atomic charges from the electrostatic potential and moments’, Journal of Computational Chemistry, 1998 \autocite{sigfridsson}

1
  • Thank You a lot! :-)
    – Janko
    May 20, 2021 at 11:19

You must log in to answer this question.

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