第二:

第二:

我用

\usepackage[round, sort, numbers]{natbib} 

\bibliographystyle{plainnat}.

\citet{Smith}然后在我的.bib文件中引用我使用:

@article{Smith,
Author = {Smith, D.A.},
Year = {1999},
Title = {Manipulability measures of common social choice functions},
Journal = {Social Choice and Welfare},
Volume = {16},  
Pages = {639-661},
}

在我的.bbl输出是

\bibitem[Smith(1999)]{Smith}
D.A. Smith.
\newblock Manipulability measures of common social choice functions.
\newblock \emph{Social Choice and Welfare}, 16:\penalty0 639--661, 1999.

我输入了,但文件\citet{Smith}中输出的是,数字而不是年份。如何输出作者年份?像。任何帮助都将不胜感激。.texSmith(3)Smith(1999)

这是我的文件,包含所有命令,放入 .cls 文件中

 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
 \ProcessOptions\relax
 \ifx\pdfoutput\undefined
    \LoadClass[dvips, a4paper]{book}
 \else
    \LoadClass[pdftex, a4paper]{book}
  \fi


  \usepackage{amssymb}
  \usepackage{graphics} % for improved inclusion of graphics
 \usepackage[margin=10pt,font=small,labelfont=bf]{caption} % for improved       layout of figure captions with extra margin, smaller font than text
  \usepackage{fancyhdr} % for better header layout
  \usepackage{eucal}
  \usepackage[english]{babel}
  \usepackage[usenames, dvipsnames]{color}
  \usepackage[perpage]{footmisc}
  %\usepackage[round, sort, numbers]{natbib} 
  \usepackage[round, sort, numbers]{natbib}
  %\usepackage[round]{natbib}
  %\usepackage[authoryear,round,colon]{natbib}
  \usepackage{ifthen}
  %\usepackage{multicol} % for pages with multiple text columns, e.g.    References
  \setlength{\columnsep}{20pt} % space between columns; default 10pt quite    narrow
  \usepackage[nottoc]{tocbibind} % correct page numbers for bib in TOC,    nottoc suppresses an entry for TOC itself
  %\usepackage{nextpage}
  %\usepackage{hyperref}
  \usepackage[pdftex]{graphicx}
  \usepackage{amsmath}
  \usepackage{amssymb}
  \usepackage{amsthm}
  \usepackage{color}
  \usepackage[dvipsnames]{xcolor}
  \usepackage{tikz}
  \usepackage{pgfplots}
  \usepgfplotslibrary{fillbetween}
  \usepackage{caption}
  \usetikzlibrary{trees}
  \usepackage{verbatim}
  \usepackage[rightcaption]{sidecap}
  \usepackage{subcaption}
  \usepackage{bm}
  \usepackage{array}
  \usepackage{enumitem}
  \usepackage{multirow}
  \usepackage{floatrow}
  \usepackage{tabularx}
  \usepackage[utf8x]{inputenc} 
  \tikzset{
    treenode/.style = {shape=rectangle, rounded corners,
                  draw, align=center,
                 top color=white, bottom color=blue!20},
root/.style     = {treenode, font=\Large, bottom color=red!30},
env/.style      = {treenode, font=\ttfamily\normalsize},
dummy/.style    = {circle,draw}

}

答案1

好的,让我们一步一步来。

首先:您给出的问题:为了获得您想要的结果,请尝试以下 MWE(请注意,我只使用包filecontents将 bib 文件和 tex 代码合并到一个 MWE 中):

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{Smith,
  Author  = {Smith, D.A.},
  Year    = {1999},
  Title   = {Manipulability measures of common social choice functions},
  Journal = {Social Choice and Welfare},
  Volume  = {16},  
  Pages   = {639--661},
}
\end{filecontents*}


\documentclass[10pt,a4paper]{article}

\usepackage[round, sort]{natbib}  % <======================================


\begin{document}

This is text with \cite{Smith} or \citet{Smith}.

\bibliographystyle{plainnat} 
\bibliography{\jobname}

\end{document}

正如你所见,你得到了结果:

在此处输入图片描述

请在您的计算机上运行我的 MWE 并确认您获得相同的结果。

第二:

您的评论中的另一个问题是,它根本无法编译:

请检查您的日志文件第一的错误,创建一个新问题,在那里添加第一个错误,更改我的 MWE 以显示您的结果错误(例如,通过添加第二个 bib 条目来产生问题)...

相关内容