带编号样式的参考书目

带编号样式的参考书目

我正在写一篇论文,需要对参考文献进行编号,所有参考文献都在一个.bib文件中,我正在使用期刊模板 + bibtex,我正在使用的包是:

\usepackage{natbib}
\usepackage{hyperref,url}
\newcounter{bibcount}

日志命令包括:

\newcommand\BibTeX{{\rmfamily B\kern-.05em \textsc{i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\def\volumeyear{2016}
\begin{document}

然后:

\bibliography{mybibfile}{}
\bibliographystyle{unsrtnat}

现在我运行时 pdf 文件没有出现,出现以下错误:

  • 包 natbib 错误:参考书目与作者年份引用不兼容。...and\NAT@force@numbers{}\NAT@force@numbers
  • 段落中的 \hbox 过满(太宽 10.09238pt)
  • h' float specifier changed toH T'。
  • 段落中的 \hbox 未满(不良率 10000)

完整代码(MWE):

\documentclass[Afour,sageh,times]{sagej}
\usepackage{moreverb,url}          
\usepackage[colorlinks,bookmarksopen,bookmarksnumbered,citecolor=red,urlcolor=red]{hyperref}
        \newcommand\BibTeX{{\rmfamily B\kern-.05em \textsc{i\kern-.025em                         b}\kern-.08em
        T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}

        \def\volumeyear{2016}
        %% Symbol and math packages
        \usepackage{mathtools}
        \usepackage{bm}
        \usepackage{amssymb}
        \usepackage{array}
        \usepackage[utf8]{inputenc}
        \usepackage[T1]{fontenc}
        \usepackage{textcomp}
        \usepackage{gensymb}

        %% Figure packages
        \usepackage{graphicx}
        \usepackage{float}
        \usepackage{subcaption}
        \usepackage{capt-of}
        \usepackage{natbib}
        \usepackage{hyperref,url}
        \newcounter{bibcount}
        \newcommand\BibTeX{{\rmfamily B\kern-.05em \textsc{i\kern-.025em 
         b}\kern-.08em
        T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
        \def\volumeyear{2016}
        \begin{document}

        \section{Introduction}
        A very very very long introduction.

        \section{Figure}
        \begin{figure}[htb!] 
        \centering 
        \begin{subfigure}[t]{1\linewidth}
        \centering
        \includegraphics[scale=0.23,clip]{f1.png}
        \caption{f1 cap}
        \label{fig:f1}
        \end{subfigure}
        \qquad
        \begin{subfigure}[t]{1\linewidth}
        \centering
       \includegraphics[scale=0.21,clip]{f2.png}
       \caption{f2 cap}
       \label{fig:f2}
       \end{subfigure}
       \caption{ f1 and f2}
       \label{fig:f1f2}
       \end{figure}

       \section{Table}
       \begin{table}[h]
        \small\sf\centering
        \caption{abc\label{tab1}}
        \begin{tabular}{llll}
        \toprule
        abc&a &b & c \\
        \midrule
        \texttt{1}&1 &1   & 1 \\
        \texttt{2}&2  & 2   & 2\\
        \texttt{3}&3     & 3     & 3  \\
        \bottomrule
        \end{tabular}\\[10pt]
        \end{table}


        Citing reference \cite{R1}, reference \cite{R2} and reference \cite{R3}.

        \bibliography{bibsample}{}
        \bibliographystyle{sageV}
        \end{document}

bibsample.bib文件中我们有:

@article{R1,
title = "A Guide to Latex",
journal = "Addison-Wesley",
volume = "1",
number = "1",
pages = "1 - 2",
year = "2003",,
author = "Kopka H and Daly PW",
}

@article{R2,
title = "LaTeX: a Document Preparation System",
journal = "Addison-Wesley",
volume = "1",
number = "1",
pages = "1 - 2",
year = "1994",,
author = "Lamport",
}



@article{R3,
title = "The  LaTeX  Companions",
journal = "Addison-Wesley",
volume = "1",
number = "1",
pages = "1 - 2",
year = "1994",,
author = "Mittelbach F and Goossens M",
}

答案1

在您给出的代码和 bib 文件中存在几个错误,例如调用包的顺序(hyperref在您的情况下应该是最后一个,或者不要,,在您的 bib 条目中写入,,是需要的......)。

因为我没有您使用的类别和样式,所以我将它们更改为类别article和样式plainnat,并且添加了选项numbersnatbib在您的参考书目中获取编号的 bib 条目。

请研究我在以下 MWE 中所做的更改(该包filecontents仅用于获得带有 bib 文件和 TeX 代码的可编译 MWE):

\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{R1,
  title = "A Guide to Latex",
  journal = "Addison-Wesley",
  volume = "1",
  number = "1",
  pages = "1 - 2",
  year = "2003",
  author = "Kopka H and Daly PW",
}
@article{R2,
  title = "LaTeX: a Document Preparation System",
  journal = "Addison-Wesley",
  volume = "1",
  number = "1",
  pages = "1 - 2",
  year = "1994",
  author = "Lamport",
}
@article{R3,
  title = "The  LaTeX  Companions",
  journal = "Addison-Wesley",
  volume = "1",
  number = "1",
  pages = "1 - 2",
  year = "1994",
  author = "Mittelbach F and Goossens M",
}
\end{filecontents}


\documentclass{article}%[Afour,sageh,times]{sagej}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}

\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{booktabs}

\usepackage{url}
\usepackage[numbers]{natbib}
\usepackage[%
  colorlinks,bookmarksopen,bookmarksnumbered,citecolor=red,urlcolor=red
]{hyperref}

\newcommand\BibTeX{{\rmfamily B\kern-.05em \textsc{i\kern-.025em 
  b}\kern-.08em
  T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\def\volumeyear{2016}


\begin{document}

\section{Introduction}
A very very very long introduction.

\section{Figure}
\begin{figure}[htb!] 
\centering 
\begin{subfigure}[t]{1\linewidth}
    \centering
    \includegraphics[scale=0.23,clip]{example-image-a}
    \caption{f1 cap}
    \label{fig:f1}
    \end{subfigure}
    \qquad
    \begin{subfigure}[t]{1\linewidth}
    \centering
   \includegraphics[scale=0.21,clip]{example-image-b}
   \caption{f2 cap}
   \label{fig:f2}
\end{subfigure}
   \caption{ f1 and f2}
   \label{fig:f1f2}
\end{figure}

\section{Table}
\begin{table}[ht]
    \small\sf\centering
    \caption{abc\label{tab1}}
    \begin{tabular}{llll}
    \toprule
    abc&a &b & c \\
    \midrule
    \texttt{1}&1 &1   & 1 \\
    \texttt{2}&2  & 2   & 2\\
    \texttt{3}&3     & 3     & 3  \\
    \bottomrule
    \end{tabular}\\[10pt]
\end{table}


Citing reference \cite{R1}, reference \cite{R2} and reference \cite{R3}.

\bibliographystyle{plainnat} % sageV
\bibliography{\jobname}

\end{document}

以及生成的 pdf 文件:

生成的 pdf

相关内容