I am LaTeX newbie so please bare with me. I would like to have citations in following format:
e.g. "Bauer et al. (1988) [1]"
so "1st Author et al. (year of publishing) [number in references]".
Thus I would like to have both numbered references and also citations which contain the first author's name
e.g. [1] David S. Bauer and Michael E. Koblentz. NIDX-an expert system ...
As you can see from the code bellow I use macro
\DeclareRobustCommand{\citeext}[1]{\citeauthor{#1}~\citeyearpar{#1}~\cite{#1}}
according to Wiki LaTex Bibliography Management \citeauthor
(without *
) and \citeyearpar
should work as I expect, but currently I get the citations in following format:
David S. Bauer and Michael E. Koblentz [1988] [2]
There are two main problems:
- Why are square brackets around the year of publishing instead of round brackets?
- Why are the full names of the authors displayed instead of just the name of the first author (other authors should be displayed like "et al.")?
MWE:
\documentclass[11pt]{article}
\usepackage[sort&compress,numbers,square,comma,numbers]{natbib}
% makro by which I can cite both author and year simultaneously
% ~ - tilde represent space
\DeclareRobustCommand{\citeext}[1]{\citeauthor{#1}~\citeyearpar{#1}~\cite{#1}}
% what is #1 argument
% this is an macro and I see that citep and citet have troubles so better not use but what is citep vs. citeauthor?
% makes color citations
\usepackage[dvips,dvipdfm,colorlinks=true,urlcolor=blue,citecolor=red,linkcolor=red,bookmarks=true]{hyperref}
% document begin
\begin{document}
% author and title
\title{Work}
\author{Author1 \and Author2\v{C}\'y}
\date{\today}
%\ % this adds empty page to beginning
\maketitle
\pagebreak
%\newline
Bauer (IV.) citation \citeext{Bauer1988}. Anderson (I.) citation \citeext{Anderson1980}. Landwehr (II.) citation \citeext{Landwehr1981}. Denning (III.) citation \citeext{Denning1987}. \citeext{Anderson1981}
% this must be set to use natbib (citep, citet) but requires BibTeX
\bibliographystyle{plainnat}
\bibliography{bibliography}
\end{document}
PS: I based my solution on this post: citet and citep behaves like cite.
Best Answer
Finally I figured it out, nearly immediately after posting :)
does the magic. Before I had tried some hacking with
\setcitestyle
but it did not work. One question remains: Why are the names of all authors displayed in the citation?