27

I am new with LaTeX so please bare with me. If its matter editor that I am using is TeXMaker, the TeXLive is installed. Why \citep and \citet did not display citation as a "Goossens et al. (1993)" or "(Goossens et al., 1993)" but just as a simple number in brackets [1] (exactly same like \cite)?

\documentclass[11pt]{article}


% old citation style (used by \cite)
%\usepackage{cite}

% package used by \citep and \citet
\usepackage[sort&compress,square,comma,authoryear]{natbib}

% 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{My Article}
\author{Author Name}
\date{Today}
\maketitle

Blablabla said by \cite{lamport94} cite example. Blablabla said by \cite[p.~215]{impj} cite example. Blablabla said by \cite{fo,norman,lamport94} multiple cite example. Blablabla said by \nocite{lamport94} nocite example.
Blablabla said by \citep{lamport94} citep example. Blablabla said by \citet*{impj} citet example. Blablabla said by \citet{impj} citet example.

% this must be set to use natbib (citep, citet)
\bibliographystyle{plainnat}

% number 99 determines how much citation can be included in file (maximum 99)
\begin{thebibliography}{99}

\bibitem{lamport94}
  Leslie Lamport,
  \emph{\LaTeX: A Document Preparation System}.
  Addison Wesley, Massachusetts,
  2nd Edition,
  1994.

   \bibitem{notes} John W. Dower {\em Readings compiled for History
  21.479.}  1991.

  \bibitem{impj}  The Japan Reader {\em Imperial Japan 1800-1945} 1973:
  Random House, N.Y.

  \bibitem{norman} E. H. Norman {\em Japan's emergence as a modern
  state} 1940: International Secretariat, Institute of Pacific
  Relations.

  \bibitem{fo} Bob Tadashi Wakabayashi {\em Anti-Foreignism and Western
  Learning in Early-Modern Japan} 1986: Harvard University Press.

\end{thebibliography}



\end{document}
% http://en.wikibooks.org/wiki/LaTeX/Bibliography_Management
1
  • No, I cannot see any errors in tex maker. Seems that I am using pdfTeXk i dont exactly know the log file is here Pastebin Commented Nov 15, 2012 at 23:58

2 Answers 2

24

The author-year citation style requires usage of BibTeX or specially formatted \bibitem commands.

If you don't want to use BibTeX, then you must hand format your thebibliography environment as in the following example.

\documentclass[11pt]{article}


\usepackage[sort&compress,square,comma,authoryear]{natbib}

% makes color citations
\usepackage[colorlinks=true,urlcolor=blue,citecolor=red,linkcolor=red,bookmarks=true]{hyperref}

% document begin
\begin{document}

% author and title
\title{My Article}
\author{Author Name}
\date{Today}
\maketitle

Blablabla said by \cite{lamport94} cite example. Blablabla said by \cite[p.~215]{impj} cite example. Blablabla said by \cite{fo,norman,lamport94} multiple cite example. Blablabla said by \nocite{lamport94} nocite example.
Blablabla said by \citep{lamport94} citep example. Blablabla said by \citet*{impj} citet example. Blablabla said by \citet{impj} citet example.

% this must be set to use natbib (citep, citet) but requires BibTeX
\bibliographystyle{plainnat}

% number 99 determines how much citation can be included in file (maximum 99)
\begin{thebibliography}{99}

\bibitem[Lamport(1994)]{lamport94}
  Leslie Lamport,
  \emph{\LaTeX: A Document Preparation System}.
  Addison Wesley, Massachusetts,
  2nd Edition,
  1994.

\bibitem[Dower(1991)]{notes} John W. Dower {\em Readings compiled for History
  21.479.}  1991.

\bibitem[Japan Reader(1973)]{impj}  The Japan Reader {\em Imperial Japan 1800-1945} 1973:
  Random House, N.Y.

\bibitem[Norman(1940)]{norman} E. H. Norman {\em Japan's emergence as a modern
  state} 1940: International Secretariat, Institute of Pacific
  Relations.

\bibitem[Wakabayashi(1986]{fo} Bob Tadashi Wakabayashi {\em Anti-Foreignism and Western
  Learning in Early-Modern Japan} 1986: Harvard University Press.

\end{thebibliography}



\end{document}

enter image description here

Never pass explicit driver names to hyperref.


If you want a "mixed" system like "Author [number]", then you can say

\usepackage[sort&compress,square,comma,numbers]{natbib}

\DeclareRobustCommand{\citeext}[1]{\citeauthor{#1}~\cite{#1}}

and then \citeext{lamport} will give you

Lamport [1]

6
  • Thank you very much, this worked. I am also wondering if there is there possibility to add numbers under References section and cite like "said by Lamport [1]" ? Tried to use something like: \usepackage[sort&compress,square,comma,authoryear,numbers]{natbib} But did not worked. Thank you very much Commented Nov 16, 2012 at 23:12
  • @WakanTanka I'll add a way for you.
    – egreg
    Commented Nov 16, 2012 at 23:24
  • what did you mean by this, sorry for my english, id did not catch what you've tried to say. I see some options for \bibliographystyle and also the "number" options for natbib. Also maybe it would be possibe to cite two times one time for author name and second for number. Or by using BibTex. Dont know I am just begginer. Commented Nov 16, 2012 at 23:32
  • @WakanTanka I removed my previous comment because I understood only later what you wanted to say. Now there's an addition to my answer that explains how you can do what you asked for.
    – egreg
    Commented Nov 16, 2012 at 23:33
  • Thank you very much you are magican :) where to add some karma here :) ? May I have some other questions now I am using \usepackage[dvips,dvipdfm,colorlinks=true,urlcolor=blue,citecolor=red,linkcolor=red,bookmarks=true]{hyperref} but this also colrs author name and reference, is there a way to color only reference ? And it would be great if this reference would be clicable, like if you click on author name or number it takes you to reference section in document, can LatTeX do this ? Commented Nov 16, 2012 at 23:55
1

Just change the \usepackage[sort&compress,square,comma,numbers]{natbib} command with round \usepackage[sort&compress,round,comma,numbers]{natbib}.

Find more options here https://en.wikibooks.org/wiki/LaTeX/More_Bibliographies

2
  • 3
    Mhhh, do you think that will really help? This just gives '(1)' instead of '[1]' for numeric citations. The OP seems to want an Author-Year style.
    – moewe
    Commented Jun 7, 2017 at 16:36
  • 1
    Welcome to TeX.SX! Have a look to How do I write a good answer?
    – Bobyandbob
    Commented Jun 7, 2017 at 16:45

You must log in to answer this question.

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