3

I am trying to use \citefield{soure1}{abstract} to include an abstract from my BibTeX file in my document. But, I always receive the message

Undefined control sequence.\citefield

Here is an MWE:

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{authoryear,
title = {title},
author = {XY},
journal = {XY},
volume = {119},
pages = {100},
year = {2015},
url = {http://www.url.com},
abstract = {long abstract.}
}
\end{filecontents*}

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[top=2cm,left=1.5cm,right=1.5cm]{geometry}
\usepackage[english,german]{babel}
\usepackage[authoryear]{natbib}
\usepackage[hidelinks]{hyperref}

\pagestyle{myheadings}

\RedeclareSectionCommand[
  beforeskip=-2\baselineskip,
  afterskip=1\baselineskip]{section}
\RedeclareSectionCommand[
  beforeskip=-1\baselineskip,
  afterskip=0.5\baselineskip]{subsection}
\RedeclareSectionCommand[
  beforeskip=-1\baselineskip,
  afterskip=.5\baselineskip]{subsubsection}
\newenvironment{newabstract}

\begin{document}

\begin{newabstract}
  \citefield{authoryear}{abstract}
\end{newabstract}

\section*{Group A}
\subsection*{\cite{authoryear} \\ \href{http://www.url.com}{title} }

\bibliography{authoryear} 
\bibliographystyle{apalike}

\end{document}
Ruben
  • 13,448
C.S.KIT
  • 31
  • 1
    Looks like this is a biblatex command. You didn't declare the use of the biblatex package in your document, but you're using natbib instead. – JMP Apr 12 '16 at 15:30
  • Welcome to TeX.SX! Where did you find the \citefield macro? (It isn't a natbib macro for sure.) Apart from that you document needs to be reworked a little: Look up the syntax for \newenvironment, \bibliography and \bibliographystyle. – Ruben Apr 12 '16 at 15:35
  • @Ruben as stated in my comment above, \citefield is a biblatex command. – JMP Apr 12 '16 at 15:38
  • @JMP, that was just a subtle hint towards beeing aware of where one gets macros and its associated information from. – Ruben Apr 12 '16 at 16:01
  • Thanks for the help! I found the \citefield command under a similar question: http://tex.stackexchange.com/questions/207591/how-to-extract-bibtex-entries-as-doi-abstract-etc – C.S.KIT Apr 15 '16 at 10:18
  • I tried to use the biblatex package (and deleted the natbib macro) but than my citations didn't work anymore and the \citefield command didn't work neither :) – C.S.KIT Apr 15 '16 at 10:20

1 Answers1

3

\citefield is a biblatex command. You may be able to get away with usebib; check the documentation for more information.

\begin{filecontents*}{\jobname.bib}
@article{authoryear,
title = {title},
author = {XY},
journal = {XY},
volume = {119},
pages = {100},
year = {2015},
url = {http://www.url.com},
abstract = {long abstract.}
}
\end{filecontents*}

\documentclass{scrartcl}

\usepackage{hyperref}
\usepackage{usebib}

\newbibfield{abstract}
\bibinput{\jobname}

\begin{document}

\begin{abstract}
\usebibentry{authoryear}{abstract}
\end{abstract}

\section*{Group A}
\subsection*{\cite{authoryear} \\ \href{http://www.url.com}{title} }

\bibliographystyle{apalike}
\bibliography{\jobname}

\end{document}

enter image description here

egreg
  • 1,121,712