Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
share|improve this question
    
Do you have error messages or warnings? Which engine do you use? pdfLaTeX? LuaTeX, XeLaTeX? –  Kurt Nov 15 '12 at 23:10
    
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 –  Wakan Tanka Nov 15 '12 at 23:58

1 Answer 1

up vote 8 down vote accepted

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]

share|improve this answer
    
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 –  Wakan Tanka Nov 16 '12 at 23:12
    
@WakanTanka I'll add a way for you. –  egreg Nov 16 '12 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. –  Wakan Tanka Nov 16 '12 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 Nov 16 '12 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 ? –  Wakan Tanka Nov 16 '12 at 23:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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