如果我按如下方式使用 elsarticle,则 pdf latex 会出现错误。我可以使用以下命令来获取参考书目吗?
\documentclass[preprint,12pt]{elsarticle}
\usepackage[square,numbers,sort&compress]{natbib}
\bibliographystyle{unsrt}
\usepackage{usebib}
错误
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/W32TeX)
restricted \write18 enabled.
entering extended mode
(./elsarticle-template-num-names.tex
LaTeX2e <2011/06/27>
Babel <3.9f> and hyphenation patterns for 78 languages loaded.
(c:/texlive/2013/texmf-dist/tex/latex/elsarticle/elsarticle.cls
Document Class: elsarticle 2009/09/17, 1.2.0: Elsevier Ltd
(c:/texlive/2013/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(c:/texlive/2013/texmf-dist/tex/latex/base/size12.clo))
(c:/texlive/2013/texmf-dist/tex/latex/graphics/graphicx.sty
(c:/texlive/2013/texmf-dist/tex/latex/graphics/keyval.sty)
(c:/texlive/2013/texmf-dist/tex/latex/graphics/graphics.sty
(c:/texlive/2013/texmf-dist/tex/latex/graphics/trig.sty)
(c:/texlive/2013/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(c:/texlive/2013/texmf-dist/tex/latex/pdftex-def/pdftex.def
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(c:/texlive/2013/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
(c:/texlive/2013/texmf-dist/tex/latex/psnfss/pifont.sty
(c:/texlive/2013/texmf-dist/tex/latex/psnfss/upzd.fd)
(c:/texlive/2013/texmf-dist/tex/latex/psnfss/upsy.fd))
(./elsarticle-template-num-names.spl)
(c:/texlive/2013/texmf-dist/tex/latex/natbib/natbib.sty))
! LaTeX Error: Option clash for package natbib.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.22 \bibliographystyle
{unsrt}
根据@Mico 的回答,我修改了代码,现在可以正常工作了!!
%\documentclass[preprint,12pt]{elsarticle}
\documentclass[preprint,12pt,square,numbers,sort&compress]{elsarticle}
%\usepackage[square,numbers,sort&compress]{natbib}
\bibliographystyle{unsrt}
\usepackage{usebib}
答案1
相关错误信息是
! LaTeX Error: Option clash for package natbib.
发生这种情况的原因是 (a)elsarticle
文档类natbib
默认加载,并且 (b)natbib
在序言中再次加载,这次带有选项square
、numbers
和sort&compress
。由于natbib
最初加载没有任何选项,选项冲突由指令\usepackage[square,numbers,sort&compress]{natbib}
负责。
natbib
补救措施是在指令的参数中包含相关选项\documentclass
:
\documentclass[preprint,12pt,square,numbers,sort&compress]{elsarticle}